Select one of the symbols to view example projects that use it.
 
Outline
Includes
#include "usbh_pipes.h"
USBH_OpenPipe(USBH_HandleTypeDef *, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint16_t)
USBH_ClosePipe(USBH_HandleTypeDef *, uint8_t)
USBH_AllocPipe(USBH_HandleTypeDef *, uint8_t)
USBH_FreePipe(USBH_HandleTypeDef *, uint8_t)
USBH_GetFreePipe(USBH_HandleTypeDef *)
Files
loading...
SourceVuSTM32 Libraries and SamplesSTM32_USB_Host_LibraryCore/Src/usbh_pipes.c
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
/** ****************************************************************************** * @file usbh_pipes.c * @author MCD Application Team * @brief This file implements functions for opening and closing Pipes ****************************************************************************** * @attention * * Copyright (c) 2015 STMicroelectronics. * All rights reserved. * * This software is licensed under terms that can be found in the LICENSE file * in the root directory of this software component. * If no LICENSE file comes with this software, it is provided AS-IS. * ****************************************************************************** *//* ... */ /* Includes ------------------------------------------------------------------*/ #include "usbh_pipes.h" /** @addtogroup USBH_LIB * @{ *//* ... */ /** @addtogroup USBH_LIB_CORE * @{ *//* ... */ /** @defgroup USBH_PIPES * @brief This file includes opening and closing Pipes * @{ *//* ... */ /** @defgroup USBH_PIPES_Private_Defines * @{ *//* ... */ /** * @} *//* ... */ /** @defgroup USBH_PIPES_Private_TypesDefinitions * @{ *//* ... */ /** * @} *//* ... */ /** @defgroup USBH_PIPES_Private_Macros * @{ *//* ... */ /** * @} *//* ... */ /** @defgroup USBH_PIPES_Private_Variables * @{ *//* ... */ /** * @} *//* ... */ /** @defgroup USBH_PIPES_Private_Functions * @{ *//* ... */ static uint16_t USBH_GetFreePipe(USBH_HandleTypeDef *phost); /** * @brief USBH_Open_Pipe * Open a pipe * @param phost: Host Handle * @param pipe_num: Pipe Number * @param dev_address: USB Device address allocated to attached device * @param speed : USB device speed (Full/Low) * @param ep_type: end point type (Bulk/int/ctl) * @param mps: max pkt size * @retval USBH Status *//* ... */ 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) { (void)USBH_LL_OpenPipe(phost, pipe_num, epnum, dev_address, speed, ep_type, mps); return USBH_OK; }{ ... } /** * @brief USBH_ClosePipe * Close a pipe * @param phost: Host Handle * @param pipe_num: Pipe Number * @retval USBH Status *//* ... */ USBH_StatusTypeDef USBH_ClosePipe(USBH_HandleTypeDef *phost, uint8_t pipe_num) { (void)USBH_LL_ClosePipe(phost, pipe_num); return USBH_OK; }{ ... } /** * @brief USBH_Alloc_Pipe * Allocate a new Pipe * @param phost: Host Handle * @param ep_addr: End point for which the Pipe to be allocated * @retval Pipe number *//* ... */ uint8_t USBH_AllocPipe(USBH_HandleTypeDef *phost, uint8_t ep_addr) { uint16_t pipe; pipe = USBH_GetFreePipe(phost); if (pipe != 0xFFFFU) { phost->Pipes[pipe & 0xFU] = (uint32_t)(0x8000U | ep_addr); }if (pipe != 0xFFFFU) { ... } return (uint8_t)pipe; }{ ... } /** * @brief USBH_Free_Pipe * Free the USB Pipe * @param phost: Host Handle * @param idx: Pipe number to be freed * @retval USBH Status *//* ... */ USBH_StatusTypeDef USBH_FreePipe(USBH_HandleTypeDef *phost, uint8_t idx) { if (idx < USBH_MAX_PIPES_NBR) { phost->Pipes[idx] &= 0x7FFFU; }if (idx < USBH_MAX_PIPES_NBR) { ... } return USBH_OK; }{ ... } /** * @brief USBH_GetFreePipe * @param phost: Host Handle * Get a free Pipe number for allocation to a device endpoint * @retval idx: Free Pipe number *//* ... */ static uint16_t USBH_GetFreePipe(USBH_HandleTypeDef *phost) { uint8_t idx = 0U; for (idx = 0U; idx < USBH_MAX_PIPES_NBR; idx++) { if ((phost->Pipes[idx] & 0x8000U) == 0U) { return (uint16_t)idx; }if ((phost->Pipes[idx] & 0x8000U) == 0U) { ... } }for (idx = 0U; idx < USBH_MAX_PIPES_NBR; idx++) { ... } return 0xFFFFU; }{ ... } /** * @} *//* ... */ /** * @} *//* ... */ /** * @} *//* ... */ /** * @} *//* ... */ Includes
Details