STM32F769IDiscovery  1.00
uDANTE Audio Networking with STM32F7 DISCO board
usbh_pipes.c
Go to the documentation of this file.
1 
28 /* Includes ------------------------------------------------------------------*/
29 #include "usbh_pipes.h"
30 
79 static uint16_t USBH_GetFreePipe (USBH_HandleTypeDef *phost);
80 
81 
94  uint8_t pipe_num,
95  uint8_t epnum,
96  uint8_t dev_address,
97  uint8_t speed,
98  uint8_t ep_type,
99  uint16_t mps)
100 {
101 
102  USBH_LL_OpenPipe(phost,
103  pipe_num,
104  epnum,
105  dev_address,
106  speed,
107  ep_type,
108  mps);
109 
110  return USBH_OK;
111 
112 }
113 
122  uint8_t pipe_num)
123 {
124 
125  USBH_LL_ClosePipe(phost, pipe_num);
126 
127  return USBH_OK;
128 
129 }
130 
138 uint8_t USBH_AllocPipe (USBH_HandleTypeDef *phost, uint8_t ep_addr)
139 {
140  uint16_t pipe;
141 
142  pipe = USBH_GetFreePipe(phost);
143 
144  if (pipe != 0xFFFF)
145  {
146  phost->Pipes[pipe] = 0x8000 | ep_addr;
147  }
148  return pipe;
149 }
150 
159 {
160  if(idx < 11)
161  {
162  phost->Pipes[idx] &= 0x7FFF;
163  }
164  return USBH_OK;
165 }
166 
173 static uint16_t USBH_GetFreePipe (USBH_HandleTypeDef *phost)
174 {
175  uint8_t idx = 0;
176 
177  for (idx = 0 ; idx < 11 ; idx++)
178  {
179  if ((phost->Pipes[idx] & 0x8000) == 0)
180  {
181  return idx;
182  }
183  }
184  return 0xFFFF;
185 }
202 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
203 
204 
uint32_t idx
Definition: lcd_log.c:247
Header file for usbh_pipes.c.
uint8_t USBH_AllocPipe(USBH_HandleTypeDef *phost, uint8_t ep_addr)
USBH_Alloc_Pipe Allocate a new Pipe.
Definition: usbh_pipes.c:138
USBH_StatusTypeDef USBH_LL_ClosePipe(USBH_HandleTypeDef *phost, uint8_t)
USBH_LL_ClosePipe Close a pipe of the Low Level Driver.
USBH_StatusTypeDef USBH_OpenPipe(USBH_HandleTypeDef *phost, uint8_t pipe_num, uint8_t epnum, uint8_t dev_address, uint8_t speed, uint8_t ep_type, uint16_t mps)
USBH_Open_Pipe Open a pipe.
Definition: usbh_pipes.c:93
USBH_StatusTypeDef USBH_FreePipe(USBH_HandleTypeDef *phost, uint8_t idx)
USBH_Free_Pipe Free the USB Pipe.
Definition: usbh_pipes.c:158
USBH_StatusTypeDef USBH_LL_OpenPipe(USBH_HandleTypeDef *phost, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint16_t)
USBH_LL_OpenPipe Open a pipe of the Low Level Driver.
uint32_t Pipes[15]
Definition: usbh_def.h:460
USBH_StatusTypeDef USBH_ClosePipe(USBH_HandleTypeDef *phost, uint8_t pipe_num)
USBH_ClosePipe Close a pipe.
Definition: usbh_pipes.c:121
USBH_StatusTypeDef
Definition: usbh_def.h:302