Rev 2 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2 | Rev 9 | ||
---|---|---|---|
Line 4... | Line 4... | ||
4 | * @author MCD Application Team |
4 | * @author MCD Application Team |
5 | * @brief Header file of USB Low Layer HAL module. |
5 | * @brief Header file of USB Low Layer HAL module. |
6 | ****************************************************************************** |
6 | ****************************************************************************** |
7 | * @attention |
7 | * @attention |
8 | * |
8 | * |
9 | * <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2> |
9 | * <h2><center>© Copyright (c) 2016 STMicroelectronics. |
- | 10 | * All rights reserved.</center></h2> |
|
10 | * |
11 | * |
11 | * Redistribution and use in source and binary forms, with or without modification, |
12 | * This software component is licensed by ST under BSD 3-Clause license, |
12 | * are permitted provided that the following conditions are met: |
13 | * the "License"; You may not use this file except in compliance with the |
13 | * 1. Redistributions of source code must retain the above copyright notice, |
- | |
14 | * this list of conditions and the following disclaimer. |
- | |
15 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
- | |
16 | * this list of conditions and the following disclaimer in the documentation |
- | |
17 | * and/or other materials provided with the distribution. |
14 | * License. You may obtain a copy of the License at: |
18 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
- | |
19 | * may be used to endorse or promote products derived from this software |
15 | * opensource.org/licenses/BSD-3-Clause |
20 | * without specific prior written permission. |
- | |
21 | * |
- | |
22 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
- | |
23 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
- | |
24 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
- | |
25 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
- | |
26 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
- | |
27 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
- | |
28 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
- | |
29 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
- | |
30 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
- | |
31 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
- | |
32 | * |
16 | * |
33 | ****************************************************************************** |
17 | ****************************************************************************** |
34 | */ |
18 | */ |
35 | 19 | ||
36 | /* Define to prevent recursive inclusion -------------------------------------*/ |
20 | /* Define to prevent recursive inclusion -------------------------------------*/ |
37 | #ifndef __STM32F1xx_LL_USB_H |
21 | #ifndef STM32F1xx_LL_USB_H |
38 | #define __STM32F1xx_LL_USB_H |
22 | #define STM32F1xx_LL_USB_H |
39 | 23 | ||
40 | #ifdef __cplusplus |
24 | #ifdef __cplusplus |
41 | extern "C" { |
25 | extern "C" { |
42 | #endif |
26 | #endif |
43 | 27 | ||
44 | #if defined(STM32F102x6) || defined(STM32F102xB) || \ |
- | |
45 | defined(STM32F103x6) || defined(STM32F103xB) || \ |
- | |
46 | defined(STM32F103xE) || defined(STM32F103xG) || \ |
- | |
47 | defined(STM32F105xC) || defined(STM32F107xC) |
- | |
48 | - | ||
49 | /* Includes ------------------------------------------------------------------*/ |
28 | /* Includes ------------------------------------------------------------------*/ |
50 | #include "stm32f1xx_hal_def.h" |
29 | #include "stm32f1xx_hal_def.h" |
51 | 30 | ||
- | 31 | #if defined (USB) || defined (USB_OTG_FS) |
|
52 | /** @addtogroup STM32F1xx_HAL_Driver |
32 | /** @addtogroup STM32F1xx_HAL_Driver |
53 | * @{ |
33 | * @{ |
54 | */ |
34 | */ |
55 | 35 | ||
56 | /** @addtogroup USB_LL |
36 | /** @addtogroup USB_LL |
57 | * @{ |
37 | * @{ |
58 | */ |
38 | */ |
59 | 39 | ||
60 | /* Exported types ------------------------------------------------------------*/ |
40 | /* Exported types ------------------------------------------------------------*/ |
61 | /** @defgroup USB_LL_Exported_Types USB Low Layer Exported Types |
- | |
62 | * @{ |
- | |
63 | */ |
41 | |
64 | /** |
42 | /** |
65 | * @brief USB Mode definition |
43 | * @brief USB Mode definition |
66 | */ |
44 | */ |
- | 45 | #if defined (USB_OTG_FS) |
|
- | 46 | ||
67 | typedef enum |
47 | typedef enum |
68 | { |
48 | { |
69 | USB_DEVICE_MODE = 0, |
49 | USB_DEVICE_MODE = 0, |
70 | USB_HOST_MODE = 1, |
50 | USB_HOST_MODE = 1, |
71 | USB_DRD_MODE = 2 |
51 | USB_DRD_MODE = 2 |
72 | }USB_ModeTypeDef; |
52 | } USB_ModeTypeDef; |
73 | 53 | ||
74 | #if defined (USB_OTG_FS) |
- | |
75 | /** |
54 | /** |
76 | * @brief URB States definition |
55 | * @brief URB States definition |
77 | */ |
56 | */ |
78 | typedef enum { |
57 | typedef enum |
- | 58 | { |
|
79 | URB_IDLE = 0, |
59 | URB_IDLE = 0, |
80 | URB_DONE, |
60 | URB_DONE, |
81 | URB_NOTREADY, |
61 | URB_NOTREADY, |
82 | URB_NYET, |
62 | URB_NYET, |
83 | URB_ERROR, |
63 | URB_ERROR, |
84 | URB_STALL |
64 | URB_STALL |
85 | }USB_OTG_URBStateTypeDef; |
65 | } USB_OTG_URBStateTypeDef; |
86 | 66 | ||
87 | /** |
67 | /** |
88 | * @brief Host channel States definition |
68 | * @brief Host channel States definition |
89 | */ |
69 | */ |
90 | typedef enum { |
70 | typedef enum |
- | 71 | { |
|
91 | HC_IDLE = 0, |
72 | HC_IDLE = 0, |
92 | HC_XFRC, |
73 | HC_XFRC, |
93 | HC_HALTED, |
74 | HC_HALTED, |
94 | HC_NAK, |
75 | HC_NAK, |
95 | HC_NYET, |
76 | HC_NYET, |
96 | HC_STALL, |
77 | HC_STALL, |
97 | HC_XACTERR, |
78 | HC_XACTERR, |
98 | HC_BBLERR, |
79 | HC_BBLERR, |
99 | HC_DATATGLERR |
80 | HC_DATATGLERR |
100 | }USB_OTG_HCStateTypeDef; |
81 | } USB_OTG_HCStateTypeDef; |
101 | 82 | ||
102 | /** |
83 | /** |
103 | * @brief USB OTG Initialization Structure definition |
84 | * @brief USB Instance Initialization Structure definition |
104 | */ |
85 | */ |
105 | typedef struct |
86 | typedef struct |
106 | { |
87 | { |
107 | uint32_t dev_endpoints; /*!< Device Endpoints number. |
88 | uint32_t dev_endpoints; /*!< Device Endpoints number. |
108 | This parameter depends on the used USB core. |
89 | This parameter depends on the used USB core. |
109 | This parameter must be a number between Min_Data = 1 and Max_Data = 15 */ |
90 | This parameter must be a number between Min_Data = 1 and Max_Data = 15 */ |
110 | 91 | ||
111 | uint32_t Host_channels; /*!< Host Channels number. |
92 | uint32_t Host_channels; /*!< Host Channels number. |
112 | This parameter Depends on the used USB core. |
93 | This parameter Depends on the used USB core. |
113 | This parameter must be a number between Min_Data = 1 and Max_Data = 15 */ |
94 | This parameter must be a number between Min_Data = 1 and Max_Data = 15 */ |
114 | 95 | ||
115 | uint32_t speed; /*!< USB Core speed. |
96 | uint32_t speed; /*!< USB Core speed. |
116 | This parameter can be any value of @ref USB_Core_Speed_ */ |
97 | This parameter can be any value of @ref USB_Core_Speed */ |
- | 98 | ||
- | 99 | uint32_t dma_enable; /*!< Enable or disable of the USB embedded DMA used only for OTG HS. */ |
|
117 | 100 | ||
118 | uint32_t ep0_mps; /*!< Set the Endpoint 0 Max Packet size. |
101 | uint32_t ep0_mps; /*!< Set the Endpoint 0 Max Packet size. */ |
- | 102 | ||
- | 103 | uint32_t phy_itface; /*!< Select the used PHY interface. |
|
119 | This parameter can be any value of @ref USB_EP0_MPS_ */ |
104 | This parameter can be any value of @ref USB_Core_PHY */ |
120 | 105 | ||
121 | uint32_t Sof_enable; /*!< Enable or disable the output of the SOF signal. */ |
106 | uint32_t Sof_enable; /*!< Enable or disable the output of the SOF signal. */ |
122 | 107 | ||
123 | uint32_t low_power_enable; /*!< Enable or disable the low power mode. */ |
108 | uint32_t low_power_enable; /*!< Enable or disable the low power mode. */ |
124 | 109 | ||
- | 110 | uint32_t lpm_enable; /*!< Enable or disable Link Power Management. */ |
|
- | 111 | ||
- | 112 | uint32_t battery_charging_enable; /*!< Enable or disable Battery charging. */ |
|
- | 113 | ||
125 | uint32_t vbus_sensing_enable; /*!< Enable or disable the VBUS Sensing feature. */ |
114 | uint32_t vbus_sensing_enable; /*!< Enable or disable the VBUS Sensing feature. */ |
- | 115 | ||
- | 116 | uint32_t use_dedicated_ep1; /*!< Enable or disable the use of the dedicated EP1 interrupt. */ |
|
126 | 117 | ||
127 | uint32_t use_external_vbus; /*!< Enable or disable the use of the external VBUS. */ |
118 | uint32_t use_external_vbus; /*!< Enable or disable the use of the external VBUS. */ |
- | 119 | ||
128 | }USB_OTG_CfgTypeDef; |
120 | } USB_OTG_CfgTypeDef; |
129 | 121 | ||
130 | typedef struct |
122 | typedef struct |
131 | { |
123 | { |
132 | uint8_t num; /*!< Endpoint number |
124 | uint8_t num; /*!< Endpoint number |
133 | This parameter must be a number between Min_Data = 1 and Max_Data = 15 */ |
125 | This parameter must be a number between Min_Data = 1 and Max_Data = 15 */ |
134 | 126 | ||
135 | uint8_t is_in; /*!< Endpoint direction |
127 | uint8_t is_in; /*!< Endpoint direction |
136 | This parameter must be a number between Min_Data = 0 and Max_Data = 1 */ |
128 | This parameter must be a number between Min_Data = 0 and Max_Data = 1 */ |
137 | 129 | ||
138 | uint8_t is_stall; /*!< Endpoint stall condition |
130 | uint8_t is_stall; /*!< Endpoint stall condition |
139 | This parameter must be a number between Min_Data = 0 and Max_Data = 1 */ |
131 | This parameter must be a number between Min_Data = 0 and Max_Data = 1 */ |
140 | 132 | ||
141 | uint8_t type; /*!< Endpoint type |
133 | uint8_t type; /*!< Endpoint type |
142 | This parameter can be any value of @ref USB_EP_Type_ */ |
134 | This parameter can be any value of @ref USB_EP_Type_ */ |
143 | 135 | ||
144 | uint8_t data_pid_start; /*!< Initial data PID |
136 | uint8_t data_pid_start; /*!< Initial data PID |
145 | This parameter must be a number between Min_Data = 0 and Max_Data = 1 */ |
137 | This parameter must be a number between Min_Data = 0 and Max_Data = 1 */ |
146 | 138 | ||
147 | uint8_t even_odd_frame; /*!< IFrame parity |
139 | uint8_t even_odd_frame; /*!< IFrame parity |
148 | This parameter must be a number between Min_Data = 0 and Max_Data = 1 */ |
140 | This parameter must be a number between Min_Data = 0 and Max_Data = 1 */ |
149 | 141 | ||
150 | uint16_t tx_fifo_num; /*!< Transmission FIFO number |
142 | uint16_t tx_fifo_num; /*!< Transmission FIFO number |
151 | This parameter must be a number between Min_Data = 1 and Max_Data = 15 */ |
143 | This parameter must be a number between Min_Data = 1 and Max_Data = 15 */ |
152 | 144 | ||
153 | uint32_t maxpacket; /*!< Endpoint Max packet size |
145 | uint32_t maxpacket; /*!< Endpoint Max packet size |
154 | This parameter must be a number between Min_Data = 0 and Max_Data = 64KB */ |
146 | This parameter must be a number between Min_Data = 0 and Max_Data = 64KB */ |
155 | 147 | ||
156 | uint8_t *xfer_buff; /*!< Pointer to transfer buffer */ |
148 | uint8_t *xfer_buff; /*!< Pointer to transfer buffer */ |
157 | 149 | ||
158 | uint32_t dma_addr; /*!< 32 bits aligned transfer buffer address */ |
150 | uint32_t dma_addr; /*!< 32 bits aligned transfer buffer address */ |
159 | 151 | ||
160 | uint32_t xfer_len; /*!< Current transfer length */ |
152 | uint32_t xfer_len; /*!< Current transfer length */ |
161 | 153 | ||
162 | uint32_t xfer_count; /*!< Partial transfer length in case of multi packet transfer */ |
154 | uint32_t xfer_count; /*!< Partial transfer length in case of multi packet transfer */ |
163 | }USB_OTG_EPTypeDef; |
155 | } USB_OTG_EPTypeDef; |
164 | 156 | ||
165 | typedef struct |
157 | typedef struct |
166 | { |
158 | { |
167 | uint8_t dev_addr ; /*!< USB device address. |
159 | uint8_t dev_addr; /*!< USB device address. |
168 | This parameter must be a number between Min_Data = 1 and Max_Data = 255 */ |
160 | This parameter must be a number between Min_Data = 1 and Max_Data = 255 */ |
169 | 161 | ||
170 | uint8_t ch_num; /*!< Host channel number. |
162 | uint8_t ch_num; /*!< Host channel number. |
171 | This parameter must be a number between Min_Data = 1 and Max_Data = 15 */ |
163 | This parameter must be a number between Min_Data = 1 and Max_Data = 15 */ |
172 | 164 | ||
173 | uint8_t ep_num; /*!< Endpoint number. |
165 | uint8_t ep_num; /*!< Endpoint number. |
174 | This parameter must be a number between Min_Data = 1 and Max_Data = 15 */ |
166 | This parameter must be a number between Min_Data = 1 and Max_Data = 15 */ |
175 | 167 | ||
176 | uint8_t ep_is_in; /*!< Endpoint direction |
168 | uint8_t ep_is_in; /*!< Endpoint direction |
177 | This parameter must be a number between Min_Data = 0 and Max_Data = 1 */ |
169 | This parameter must be a number between Min_Data = 0 and Max_Data = 1 */ |
178 | 170 | ||
179 | uint8_t speed; /*!< USB Host speed. |
171 | uint8_t speed; /*!< USB Host speed. |
180 | This parameter can be any value of @ref USB_Core_Speed_ */ |
172 | This parameter can be any value of @ref USB_Core_Speed_ */ |
181 | 173 | ||
182 | uint8_t do_ping; /*!< Enable or disable the use of the PING protocol for HS mode. */ |
174 | uint8_t do_ping; /*!< Enable or disable the use of the PING protocol for HS mode. */ |
183 | 175 | ||
184 | uint8_t process_ping; /*!< Execute the PING protocol for HS mode. */ |
176 | uint8_t process_ping; /*!< Execute the PING protocol for HS mode. */ |
185 | 177 | ||
186 | uint8_t ep_type; /*!< Endpoint Type. |
178 | uint8_t ep_type; /*!< Endpoint Type. |
187 | This parameter can be any value of @ref USB_EP_Type_ */ |
179 | This parameter can be any value of @ref USB_EP_Type_ */ |
188 | 180 | ||
189 | uint16_t max_packet; /*!< Endpoint Max packet size. |
181 | uint16_t max_packet; /*!< Endpoint Max packet size. |
190 | This parameter must be a number between Min_Data = 0 and Max_Data = 64KB */ |
182 | This parameter must be a number between Min_Data = 0 and Max_Data = 64KB */ |
191 | 183 | ||
192 | uint8_t data_pid; /*!< Initial data PID. |
184 | uint8_t data_pid; /*!< Initial data PID. |
193 | This parameter must be a number between Min_Data = 0 and Max_Data = 1 */ |
185 | This parameter must be a number between Min_Data = 0 and Max_Data = 1 */ |
194 | 186 | ||
195 | uint8_t *xfer_buff; /*!< Pointer to transfer buffer. */ |
187 | uint8_t *xfer_buff; /*!< Pointer to transfer buffer. */ |
196 | 188 | ||
197 | uint32_t xfer_len; /*!< Current transfer length. */ |
189 | uint32_t xfer_len; /*!< Current transfer length. */ |
198 | 190 | ||
199 | uint32_t xfer_count; /*!< Partial transfer length in case of multi packet transfer. */ |
191 | uint32_t xfer_count; /*!< Partial transfer length in case of multi packet transfer. */ |
200 | 192 | ||
201 | uint8_t toggle_in; /*!< IN transfer current toggle flag. |
193 | uint8_t toggle_in; /*!< IN transfer current toggle flag. |
202 | This parameter must be a number between Min_Data = 0 and Max_Data = 1 */ |
194 | This parameter must be a number between Min_Data = 0 and Max_Data = 1 */ |
203 | 195 | ||
204 | uint8_t toggle_out; /*!< OUT transfer current toggle flag |
196 | uint8_t toggle_out; /*!< OUT transfer current toggle flag |
205 | This parameter must be a number between Min_Data = 0 and Max_Data = 1 */ |
197 | This parameter must be a number between Min_Data = 0 and Max_Data = 1 */ |
206 | 198 | ||
207 | uint32_t dma_addr; /*!< 32 bits aligned transfer buffer address. */ |
199 | uint32_t dma_addr; /*!< 32 bits aligned transfer buffer address. */ |
208 | 200 | ||
209 | uint32_t ErrCnt; /*!< Host channel error count.*/ |
201 | uint32_t ErrCnt; /*!< Host channel error count. */ |
210 | 202 | ||
211 | USB_OTG_URBStateTypeDef urb_state; /*!< URB state. |
203 | USB_OTG_URBStateTypeDef urb_state; /*!< URB state. |
212 | This parameter can be any value of @ref USB_OTG_URBStateTypeDef */ |
204 | This parameter can be any value of @ref USB_OTG_URBStateTypeDef */ |
213 | 205 | ||
214 | USB_OTG_HCStateTypeDef state; /*!< Host Channel state. |
206 | USB_OTG_HCStateTypeDef state; /*!< Host Channel state. |
215 | This parameter can be any value of @ref USB_OTG_HCStateTypeDef */ |
207 | This parameter can be any value of @ref USB_OTG_HCStateTypeDef */ |
216 | }USB_OTG_HCTypeDef; |
208 | } USB_OTG_HCTypeDef; |
217 | #endif /* USB_OTG_FS */ |
209 | #endif /* defined (USB_OTG_FS) */ |
218 | 210 | ||
219 | #if defined (USB) |
211 | #if defined (USB) |
- | 212 | ||
- | 213 | typedef enum |
|
- | 214 | { |
|
- | 215 | USB_DEVICE_MODE = 0 |
|
- | 216 | } USB_ModeTypeDef; |
|
- | 217 | ||
220 | /** |
218 | /** |
221 | * @brief USB Initialization Structure definition |
219 | * @brief USB Initialization Structure definition |
222 | */ |
220 | */ |
223 | typedef struct |
221 | typedef struct |
224 | { |
222 | { |
225 | uint32_t dev_endpoints; /*!< Device Endpoints number. |
223 | uint32_t dev_endpoints; /*!< Device Endpoints number. |
226 | This parameter depends on the used USB core. |
224 | This parameter depends on the used USB core. |
227 | This parameter must be a number between Min_Data = 1 and Max_Data = 15 */ |
225 | This parameter must be a number between Min_Data = 1 and Max_Data = 15 */ |
228 | 226 | ||
229 | uint32_t speed; /*!< USB Core speed. |
227 | uint32_t speed; /*!< USB Core speed. |
230 | This parameter can be any value of @ref USB_Core_Speed */ |
228 | This parameter can be any value of @ref USB_Core_Speed */ |
231 | 229 | ||
232 | uint32_t ep0_mps; /*!< Set the Endpoint 0 Max Packet size. |
230 | uint32_t ep0_mps; /*!< Set the Endpoint 0 Max Packet size. */ |
233 | This parameter can be any value of @ref USB_EP0_MPS */ |
- | |
234 | 231 | ||
235 | uint32_t phy_itface; /*!< Select the used PHY interface. |
232 | uint32_t phy_itface; /*!< Select the used PHY interface. |
236 | This parameter can be any value of @ref USB_Core_PHY */ |
233 | This parameter can be any value of @ref USB_Core_PHY */ |
237 | 234 | ||
238 | uint32_t Sof_enable; /*!< Enable or disable the output of the SOF signal. */ |
235 | uint32_t Sof_enable; /*!< Enable or disable the output of the SOF signal. */ |
239 | 236 | ||
240 | uint32_t low_power_enable; /*!< Enable or disable Low Power mode */ |
237 | uint32_t low_power_enable; /*!< Enable or disable Low Power mode */ |
241 | 238 | ||
242 | uint32_t lpm_enable; /*!< Enable or disable Battery charging. */ |
239 | uint32_t lpm_enable; /*!< Enable or disable Battery charging. */ |
243 | 240 | ||
244 | uint32_t battery_charging_enable; /*!< Enable or disable Battery charging. */ |
241 | uint32_t battery_charging_enable; /*!< Enable or disable Battery charging. */ |
245 | } USB_CfgTypeDef; |
242 | } USB_CfgTypeDef; |
246 | 243 | ||
247 | typedef struct |
244 | typedef struct |
248 | { |
245 | { |
249 | uint8_t num; /*!< Endpoint number |
246 | uint8_t num; /*!< Endpoint number |
250 | This parameter must be a number between Min_Data = 1 and Max_Data = 15 */ |
247 | This parameter must be a number between Min_Data = 1 and Max_Data = 15 */ |
251 | 248 | ||
252 | uint8_t is_in; /*!< Endpoint direction |
249 | uint8_t is_in; /*!< Endpoint direction |
253 | This parameter must be a number between Min_Data = 0 and Max_Data = 1 */ |
250 | This parameter must be a number between Min_Data = 0 and Max_Data = 1 */ |
254 | 251 | ||
255 | uint8_t is_stall; /*!< Endpoint stall condition |
252 | uint8_t is_stall; /*!< Endpoint stall condition |
256 | This parameter must be a number between Min_Data = 0 and Max_Data = 1 */ |
253 | This parameter must be a number between Min_Data = 0 and Max_Data = 1 */ |
257 | 254 | ||
258 | uint8_t type; /*!< Endpoint type |
255 | uint8_t type; /*!< Endpoint type |
259 | This parameter can be any value of @ref USB_EP_Type */ |
256 | This parameter can be any value of @ref USB_EP_Type */ |
- | 257 | ||
- | 258 | uint8_t data_pid_start; /*!< Initial data PID |
|
- | 259 | This parameter must be a number between Min_Data = 0 and Max_Data = 1 */ |
|
260 | 260 | ||
261 | uint16_t pmaadress; /*!< PMA Address |
261 | uint16_t pmaadress; /*!< PMA Address |
262 | This parameter can be any value between Min_addr = 0 and Max_addr = 1K */ |
262 | This parameter can be any value between Min_addr = 0 and Max_addr = 1K */ |
263 | 263 | ||
264 | uint16_t pmaaddr0; /*!< PMA Address0 |
264 | uint16_t pmaaddr0; /*!< PMA Address0 |
265 | This parameter can be any value between Min_addr = 0 and Max_addr = 1K */ |
265 | This parameter can be any value between Min_addr = 0 and Max_addr = 1K */ |
266 | 266 | ||
267 | uint16_t pmaaddr1; /*!< PMA Address1 |
267 | uint16_t pmaaddr1; /*!< PMA Address1 |
268 | This parameter can be any value between Min_addr = 0 and Max_addr = 1K */ |
268 | This parameter can be any value between Min_addr = 0 and Max_addr = 1K */ |
269 | 269 | ||
270 | uint8_t doublebuffer; /*!< Double buffer enable |
270 | uint8_t doublebuffer; /*!< Double buffer enable |
271 | This parameter can be 0 or 1 */ |
271 | This parameter can be 0 or 1 */ |
272 | 272 | ||
273 | uint16_t tx_fifo_num; /*!< This parameter is not required by USB Device FS peripheral, it is used |
273 | uint16_t tx_fifo_num; /*!< This parameter is not required by USB Device FS peripheral, it is used |
274 | only by USB OTG FS peripheral |
274 | only by USB OTG FS peripheral |
275 | This parameter is added to ensure compatibility across USB peripherals */ |
275 | This parameter is added to ensure compatibility across USB peripherals */ |
276 | 276 | ||
277 | uint32_t maxpacket; /*!< Endpoint Max packet size |
277 | uint32_t maxpacket; /*!< Endpoint Max packet size |
278 | This parameter must be a number between Min_Data = 0 and Max_Data = 64KB */ |
278 | This parameter must be a number between Min_Data = 0 and Max_Data = 64KB */ |
279 | 279 | ||
280 | uint8_t *xfer_buff; /*!< Pointer to transfer buffer */ |
280 | uint8_t *xfer_buff; /*!< Pointer to transfer buffer */ |
281 | 281 | ||
282 | uint32_t xfer_len; /*!< Current transfer length */ |
282 | uint32_t xfer_len; /*!< Current transfer length */ |
283 | 283 | ||
284 | uint32_t xfer_count; /*!< Partial transfer length in case of multi packet transfer */ |
284 | uint32_t xfer_count; /*!< Partial transfer length in case of multi packet transfer */ |
- | 285 | ||
- | 286 | uint32_t xfer_len_db; /*!< double buffer transfer length used with bulk double buffer in */ |
|
- | 287 | ||
- | 288 | uint8_t xfer_fill_db; /*!< double buffer Need to Fill new buffer used with bulk_in */ |
|
285 | 289 | ||
286 | } USB_EPTypeDef; |
290 | } USB_EPTypeDef; |
287 | #endif /* USB */ |
291 | #endif /* defined (USB) */ |
- | 292 | ||
- | 293 | /* Exported constants --------------------------------------------------------*/ |
|
- | 294 | ||
- | 295 | /** @defgroup PCD_Exported_Constants PCD Exported Constants |
|
- | 296 | * @{ |
|
- | 297 | */ |
|
- | 298 | ||
- | 299 | #if defined (USB_OTG_FS) |
|
- | 300 | /** @defgroup USB_OTG_CORE VERSION ID |
|
- | 301 | * @{ |
|
- | 302 | */ |
|
- | 303 | #define USB_OTG_CORE_ID_300A 0x4F54300AU |
|
- | 304 | #define USB_OTG_CORE_ID_310A 0x4F54310AU |
|
288 | /** |
305 | /** |
289 | * @} |
306 | * @} |
290 | */ |
307 | */ |
291 | 308 | ||
292 | /* Exported constants --------------------------------------------------------*/ |
- | |
293 | /** @defgroup USB_LL_Exported_Constants USB Low Layer Exported Constants |
309 | /** @defgroup USB_Core_Mode_ USB Core Mode |
294 | * @{ |
310 | * @{ |
295 | */ |
311 | */ |
- | 312 | #define USB_OTG_MODE_DEVICE 0U |
|
296 | #if defined (USB_OTG_FS) |
313 | #define USB_OTG_MODE_HOST 1U |
- | 314 | #define USB_OTG_MODE_DRD 2U |
|
- | 315 | /** |
|
- | 316 | * @} |
|
- | 317 | */ |
|
- | 318 | ||
297 | /** @defgroup USB_LL_Core_Mode USB Low Layer Core Mode |
319 | /** @defgroup USB_LL Device Speed |
298 | * @{ |
320 | * @{ |
299 | */ |
321 | */ |
300 | #define USB_OTG_MODE_DEVICE 0 |
- | |
301 | #define USB_OTG_MODE_HOST 1 |
322 | #define USBD_FS_SPEED 2U |
302 | #define USB_OTG_MODE_DRD 2 |
323 | #define USBH_FSLS_SPEED 1U |
303 | /** |
324 | /** |
304 | * @} |
325 | * @} |
305 | */ |
326 | */ |
306 | 327 | ||
307 | /** @defgroup USB_LL_Core_Speed USB Low Layer Core Speed |
328 | /** @defgroup USB_LL_Core_Speed USB Low Layer Core Speed |
308 | * @{ |
329 | * @{ |
309 | */ |
330 | */ |
310 | #define USB_OTG_SPEED_LOW 2 |
- | |
311 | #define USB_OTG_SPEED_FULL 3 |
331 | #define USB_OTG_SPEED_FULL 3U |
312 | - | ||
313 | /** |
332 | /** |
314 | * @} |
333 | * @} |
315 | */ |
334 | */ |
316 | 335 | ||
317 | /** @defgroup USB_LL_Core_PHY USB Low Layer Core PHY |
336 | /** @defgroup USB_LL_Core_PHY USB Low Layer Core PHY |
318 | * @{ |
337 | * @{ |
319 | */ |
338 | */ |
320 | #define USB_OTG_ULPI_PHY 1 |
339 | #define USB_OTG_ULPI_PHY 1U |
321 | #define USB_OTG_EMBEDDED_PHY 2 |
340 | #define USB_OTG_EMBEDDED_PHY 2U |
- | 341 | /** |
|
- | 342 | * @} |
|
- | 343 | */ |
|
- | 344 | ||
- | 345 | /** @defgroup USB_LL_Turnaround_Timeout Turnaround Timeout Value |
|
- | 346 | * @{ |
|
- | 347 | */ |
|
- | 348 | #ifndef USBD_FS_TRDT_VALUE |
|
- | 349 | #define USBD_FS_TRDT_VALUE 5U |
|
- | 350 | #define USBD_DEFAULT_TRDT_VALUE 9U |
|
- | 351 | #endif /* USBD_HS_TRDT_VALUE */ |
|
322 | /** |
352 | /** |
323 | * @} |
353 | * @} |
324 | */ |
354 | */ |
325 | 355 | ||
326 | /** @defgroup USB_LL_Core_MPS USB Low Layer Core MPS |
356 | /** @defgroup USB_LL_Core_MPS USB Low Layer Core MPS |
327 | * @{ |
357 | * @{ |
328 | */ |
358 | */ |
329 | #define USB_OTG_FS_MAX_PACKET_SIZE 64 |
359 | #define USB_OTG_FS_MAX_PACKET_SIZE 64U |
330 | #define USB_OTG_MAX_EP0_SIZE 64 |
360 | #define USB_OTG_MAX_EP0_SIZE 64U |
331 | /** |
361 | /** |
332 | * @} |
362 | * @} |
333 | */ |
363 | */ |
334 | 364 | ||
335 | /** @defgroup USB_LL_Core_PHY_Frequency USB Low Layer Core PHY Frequency |
365 | /** @defgroup USB_LL_Core_PHY_Frequency USB Low Layer Core PHY Frequency |
336 | * @{ |
366 | * @{ |
337 | */ |
367 | */ |
338 | #define DSTS_ENUMSPD_FS_PHY_30MHZ_OR_60MHZ (1 << 1) |
368 | #define DSTS_ENUMSPD_HS_PHY_30MHZ_OR_60MHZ (0U << 1) |
339 | #define DSTS_ENUMSPD_LS_PHY_6MHZ (2 << 1) |
369 | #define DSTS_ENUMSPD_FS_PHY_30MHZ_OR_60MHZ (1U << 1) |
340 | #define DSTS_ENUMSPD_FS_PHY_48MHZ (3 << 1) |
370 | #define DSTS_ENUMSPD_FS_PHY_48MHZ (3U << 1) |
341 | /** |
371 | /** |
342 | * @} |
372 | * @} |
343 | */ |
373 | */ |
344 | 374 | ||
345 | /** @defgroup USB_LL_CORE_Frame_Interval USB Low Layer Core Frame Interval |
375 | /** @defgroup USB_LL_CORE_Frame_Interval USB Low Layer Core Frame Interval |
346 | * @{ |
376 | * @{ |
347 | */ |
377 | */ |
348 | #define DCFG_FRAME_INTERVAL_80 0 |
378 | #define DCFG_FRAME_INTERVAL_80 0U |
349 | #define DCFG_FRAME_INTERVAL_85 1 |
379 | #define DCFG_FRAME_INTERVAL_85 1U |
350 | #define DCFG_FRAME_INTERVAL_90 2 |
380 | #define DCFG_FRAME_INTERVAL_90 2U |
351 | #define DCFG_FRAME_INTERVAL_95 3 |
381 | #define DCFG_FRAME_INTERVAL_95 3U |
352 | /** |
382 | /** |
353 | * @} |
383 | * @} |
354 | */ |
384 | */ |
355 | 385 | ||
356 | /** @defgroup USB_LL_EP0_MPS USB Low Layer EP0 MPS |
386 | /** @defgroup USB_LL_EP0_MPS USB Low Layer EP0 MPS |
357 | * @{ |
387 | * @{ |
358 | */ |
388 | */ |
359 | #define DEP0CTL_MPS_64 0 |
389 | #define EP_MPS_64 0U |
360 | #define DEP0CTL_MPS_32 1 |
390 | #define EP_MPS_32 1U |
361 | #define DEP0CTL_MPS_16 2 |
391 | #define EP_MPS_16 2U |
362 | #define DEP0CTL_MPS_8 3 |
392 | #define EP_MPS_8 3U |
363 | /** |
393 | /** |
364 | * @} |
394 | * @} |
365 | */ |
395 | */ |
366 | 396 | ||
367 | /** @defgroup USB_LL_EP_Speed USB Low Layer EP Speed |
397 | /** @defgroup USB_LL_EP_Speed USB Low Layer EP Speed |
368 | * @{ |
398 | * @{ |
369 | */ |
399 | */ |
370 | #define EP_SPEED_LOW 0 |
400 | #define EP_SPEED_LOW 0U |
371 | #define EP_SPEED_FULL 1 |
401 | #define EP_SPEED_FULL 1U |
372 | #define EP_SPEED_HIGH 2 |
402 | #define EP_SPEED_HIGH 2U |
373 | /** |
403 | /** |
374 | * @} |
404 | * @} |
375 | */ |
405 | */ |
376 | 406 | ||
377 | /** @defgroup USB_LL_EP_Type USB Low Layer EP Type |
407 | /** @defgroup USB_LL_EP_Type USB Low Layer EP Type |
378 | * @{ |
408 | * @{ |
379 | */ |
409 | */ |
380 | #define EP_TYPE_CTRL 0 |
410 | #define EP_TYPE_CTRL 0U |
381 | #define EP_TYPE_ISOC 1 |
411 | #define EP_TYPE_ISOC 1U |
382 | #define EP_TYPE_BULK 2 |
412 | #define EP_TYPE_BULK 2U |
383 | #define EP_TYPE_INTR 3 |
413 | #define EP_TYPE_INTR 3U |
384 | #define EP_TYPE_MSK 3 |
414 | #define EP_TYPE_MSK 3U |
385 | /** |
415 | /** |
386 | * @} |
416 | * @} |
387 | */ |
417 | */ |
388 | 418 | ||
389 | /** @defgroup USB_LL_STS_Defines USB Low Layer STS Defines |
419 | /** @defgroup USB_LL_STS_Defines USB Low Layer STS Defines |
390 | * @{ |
420 | * @{ |
391 | */ |
421 | */ |
392 | #define STS_GOUT_NAK 1 |
422 | #define STS_GOUT_NAK 1U |
393 | #define STS_DATA_UPDT 2 |
423 | #define STS_DATA_UPDT 2U |
394 | #define STS_XFER_COMP 3 |
424 | #define STS_XFER_COMP 3U |
395 | #define STS_SETUP_COMP 4 |
425 | #define STS_SETUP_COMP 4U |
396 | #define STS_SETUP_UPDT 6 |
426 | #define STS_SETUP_UPDT 6U |
397 | /** |
427 | /** |
398 | * @} |
428 | * @} |
399 | */ |
429 | */ |
400 | 430 | ||
401 | /** @defgroup USB_LL_HCFG_SPEED_Defines USB Low Layer HCFG Speed Defines |
431 | /** @defgroup USB_LL_HCFG_SPEED_Defines USB Low Layer HCFG Speed Defines |
402 | * @{ |
432 | * @{ |
403 | */ |
433 | */ |
404 | #define HCFG_30_60_MHZ 0 |
434 | #define HCFG_30_60_MHZ 0U |
405 | #define HCFG_48_MHZ 1 |
435 | #define HCFG_48_MHZ 1U |
406 | #define HCFG_6_MHZ 2 |
436 | #define HCFG_6_MHZ 2U |
407 | /** |
437 | /** |
408 | * @} |
438 | * @} |
409 | */ |
439 | */ |
410 | 440 | ||
411 | /** @defgroup USB_LL_HPRT0_PRTSPD_SPEED_Defines USB Low Layer HPRT0 PRTSPD Speed Defines |
441 | /** @defgroup USB_LL_HPRT0_PRTSPD_SPEED_Defines USB Low Layer HPRT0 PRTSPD Speed Defines |
412 | * @{ |
442 | * @{ |
413 | */ |
443 | */ |
414 | #define HPRT0_PRTSPD_HIGH_SPEED 0 |
444 | #define HPRT0_PRTSPD_HIGH_SPEED 0U |
415 | #define HPRT0_PRTSPD_FULL_SPEED 1 |
445 | #define HPRT0_PRTSPD_FULL_SPEED 1U |
416 | #define HPRT0_PRTSPD_LOW_SPEED 2 |
446 | #define HPRT0_PRTSPD_LOW_SPEED 2U |
417 | /** |
447 | /** |
418 | * @} |
448 | * @} |
419 | */ |
449 | */ |
420 | 450 | ||
421 | #define HCCHAR_CTRL 0 |
451 | #define HCCHAR_CTRL 0U |
422 | #define HCCHAR_ISOC 1 |
452 | #define HCCHAR_ISOC 1U |
423 | #define HCCHAR_BULK 2 |
453 | #define HCCHAR_BULK 2U |
424 | #define HCCHAR_INTR 3 |
454 | #define HCCHAR_INTR 3U |
425 | 455 | ||
426 | #define HC_PID_DATA0 0 |
456 | #define HC_PID_DATA0 0U |
427 | #define HC_PID_DATA2 1 |
457 | #define HC_PID_DATA2 1U |
428 | #define HC_PID_DATA1 2 |
458 | #define HC_PID_DATA1 2U |
429 | #define HC_PID_SETUP 3 |
459 | #define HC_PID_SETUP 3U |
430 | 460 | ||
431 | #define GRXSTS_PKTSTS_IN 2 |
461 | #define GRXSTS_PKTSTS_IN 2U |
432 | #define GRXSTS_PKTSTS_IN_XFER_COMP 3 |
462 | #define GRXSTS_PKTSTS_IN_XFER_COMP 3U |
433 | #define GRXSTS_PKTSTS_DATA_TOGGLE_ERR 5 |
463 | #define GRXSTS_PKTSTS_DATA_TOGGLE_ERR 5U |
434 | #define GRXSTS_PKTSTS_CH_HALTED 7 |
464 | #define GRXSTS_PKTSTS_CH_HALTED 7U |
435 | 465 | ||
436 | #define USBx_PCGCCTL *(__IO uint32_t *)((uint32_t)USBx + USB_OTG_PCGCCTL_BASE) |
466 | #define USBx_PCGCCTL *(__IO uint32_t *)((uint32_t)USBx_BASE + USB_OTG_PCGCCTL_BASE) |
437 | #define USBx_HPRT0 *(__IO uint32_t *)((uint32_t)USBx + USB_OTG_HOST_PORT_BASE) |
467 | #define USBx_HPRT0 *(__IO uint32_t *)((uint32_t)USBx_BASE + USB_OTG_HOST_PORT_BASE) |
438 | 468 | ||
439 | #define USBx_DEVICE ((USB_OTG_DeviceTypeDef *)((uint32_t )USBx + USB_OTG_DEVICE_BASE)) |
469 | #define USBx_DEVICE ((USB_OTG_DeviceTypeDef *)(USBx_BASE + USB_OTG_DEVICE_BASE)) |
440 | #define USBx_INEP(i) ((USB_OTG_INEndpointTypeDef *)((uint32_t)USBx + USB_OTG_IN_ENDPOINT_BASE + (i)*USB_OTG_EP_REG_SIZE)) |
470 | #define USBx_INEP(i) ((USB_OTG_INEndpointTypeDef *)(USBx_BASE + USB_OTG_IN_ENDPOINT_BASE + ((i) * USB_OTG_EP_REG_SIZE))) |
441 | #define USBx_OUTEP(i) ((USB_OTG_OUTEndpointTypeDef *)((uint32_t)USBx + USB_OTG_OUT_ENDPOINT_BASE + (i)*USB_OTG_EP_REG_SIZE)) |
471 | #define USBx_OUTEP(i) ((USB_OTG_OUTEndpointTypeDef *)(USBx_BASE + USB_OTG_OUT_ENDPOINT_BASE + ((i) * USB_OTG_EP_REG_SIZE))) |
442 | #define USBx_DFIFO(i) *(__IO uint32_t *)((uint32_t)USBx + USB_OTG_FIFO_BASE + (i) * USB_OTG_FIFO_SIZE) |
472 | #define USBx_DFIFO(i) *(__IO uint32_t *)(USBx_BASE + USB_OTG_FIFO_BASE + ((i) * USB_OTG_FIFO_SIZE)) |
443 | 473 | ||
444 | #define USBx_HOST ((USB_OTG_HostTypeDef *)((uint32_t )USBx + USB_OTG_HOST_BASE)) |
474 | #define USBx_HOST ((USB_OTG_HostTypeDef *)(USBx_BASE + USB_OTG_HOST_BASE)) |
445 | #define USBx_HC(i) ((USB_OTG_HostChannelTypeDef *)((uint32_t)USBx + USB_OTG_HOST_CHANNEL_BASE + (i)*USB_OTG_HOST_CHANNEL_SIZE)) |
475 | #define USBx_HC(i) ((USB_OTG_HostChannelTypeDef *)(USBx_BASE + USB_OTG_HOST_CHANNEL_BASE + ((i) * USB_OTG_HOST_CHANNEL_SIZE))) |
446 | #endif /* USB_OTG_FS */ |
476 | #endif /* defined (USB_OTG_FS) */ |
447 | 477 | ||
448 | #if defined (USB) |
478 | #if defined (USB) |
449 | /** @defgroup USB_LL_EP0_MPS USB Low Layer EP0 MPS |
479 | /** @defgroup USB_LL_EP0_MPS USB Low Layer EP0 MPS |
450 | * @{ |
480 | * @{ |
451 | */ |
481 | */ |
452 | #define DEP0CTL_MPS_64 0 |
482 | #define EP_MPS_64 0U |
453 | #define DEP0CTL_MPS_32 1 |
483 | #define EP_MPS_32 1U |
454 | #define DEP0CTL_MPS_16 2 |
484 | #define EP_MPS_16 2U |
455 | #define DEP0CTL_MPS_8 3 |
485 | #define EP_MPS_8 3U |
456 | /** |
486 | /** |
457 | * @} |
487 | * @} |
458 | */ |
488 | */ |
459 | 489 | ||
460 | /** @defgroup USB_LL_EP_Type USB Low Layer EP Type |
490 | /** @defgroup USB_LL_EP_Type USB Low Layer EP Type |
461 | * @{ |
491 | * @{ |
462 | */ |
492 | */ |
463 | #define EP_TYPE_CTRL 0 |
493 | #define EP_TYPE_CTRL 0U |
464 | #define EP_TYPE_ISOC 1 |
494 | #define EP_TYPE_ISOC 1U |
465 | #define EP_TYPE_BULK 2 |
495 | #define EP_TYPE_BULK 2U |
466 | #define EP_TYPE_INTR 3 |
496 | #define EP_TYPE_INTR 3U |
467 | #define EP_TYPE_MSK 3 |
497 | #define EP_TYPE_MSK 3U |
- | 498 | /** |
|
- | 499 | * @} |
|
- | 500 | */ |
|
- | 501 | ||
- | 502 | /** @defgroup USB_LL Device Speed |
|
- | 503 | * @{ |
|
- | 504 | */ |
|
- | 505 | #define USBD_FS_SPEED 2U |
|
468 | /** |
506 | /** |
469 | * @} |
507 | * @} |
470 | */ |
508 | */ |
471 | 509 | ||
472 | #define BTABLE_ADDRESS (0x000) |
510 | #define BTABLE_ADDRESS 0x000U |
- | 511 | #define PMA_ACCESS 2U |
|
- | 512 | #endif /* defined (USB) */ |
|
- | 513 | #if defined (USB_OTG_FS) |
|
- | 514 | #define EP_ADDR_MSK 0xFU |
|
- | 515 | #endif /* defined (USB_OTG_FS) */ |
|
- | 516 | #if defined (USB) |
|
- | 517 | #define EP_ADDR_MSK 0x7U |
|
473 | #endif /* USB */ |
518 | #endif /* defined (USB) */ |
474 | /** |
519 | /** |
475 | * @} |
520 | * @} |
476 | */ |
521 | */ |
477 | 522 | ||
478 | /* Exported macros -----------------------------------------------------------*/ |
523 | /* Exported macro ------------------------------------------------------------*/ |
479 | /** @defgroup USB_LL_Exported_Macros USB Low Layer Exported Macros |
524 | /** @defgroup USB_LL_Exported_Macros USB Low Layer Exported Macros |
480 | * @{ |
525 | * @{ |
481 | */ |
526 | */ |
482 | #if defined (USB_OTG_FS) |
527 | #if defined (USB_OTG_FS) |
483 | #define USB_MASK_INTERRUPT(__INSTANCE__, __INTERRUPT__) ((__INSTANCE__)->GINTMSK &= ~(__INTERRUPT__)) |
528 | #define USB_MASK_INTERRUPT(__INSTANCE__, __INTERRUPT__) ((__INSTANCE__)->GINTMSK &= ~(__INTERRUPT__)) |
484 | #define USB_UNMASK_INTERRUPT(__INSTANCE__, __INTERRUPT__) ((__INSTANCE__)->GINTMSK |= (__INTERRUPT__)) |
529 | #define USB_UNMASK_INTERRUPT(__INSTANCE__, __INTERRUPT__) ((__INSTANCE__)->GINTMSK |= (__INTERRUPT__)) |
485 | 530 | ||
486 | #define CLEAR_IN_EP_INTR(__EPNUM__, __INTERRUPT__) (USBx_INEP(__EPNUM__)->DIEPINT = (__INTERRUPT__)) |
531 | #define CLEAR_IN_EP_INTR(__EPNUM__, __INTERRUPT__) (USBx_INEP(__EPNUM__)->DIEPINT = (__INTERRUPT__)) |
487 | #define CLEAR_OUT_EP_INTR(__EPNUM__, __INTERRUPT__) (USBx_OUTEP(__EPNUM__)->DOEPINT = (__INTERRUPT__)) |
532 | #define CLEAR_OUT_EP_INTR(__EPNUM__, __INTERRUPT__) (USBx_OUTEP(__EPNUM__)->DOEPINT = (__INTERRUPT__)) |
488 | #endif /* USB_OTG_FS */ |
533 | #endif /* defined (USB_OTG_FS) */ |
489 | /** |
534 | /** |
490 | * @} |
535 | * @} |
491 | */ |
536 | */ |
492 | 537 | ||
493 | /* Exported functions --------------------------------------------------------*/ |
538 | /* Exported functions --------------------------------------------------------*/ |
494 | /** @addtogroup USB_LL_Exported_Functions USB Low Layer Exported Functions |
539 | /** @addtogroup USB_LL_Exported_Functions USB Low Layer Exported Functions |
495 | * @{ |
540 | * @{ |
496 | */ |
541 | */ |
497 | /** @addtogroup USB_LL_Exported_Functions_Group1 Peripheral Control functions |
- | |
498 | * @{ |
- | |
499 | */ |
- | |
500 | #if defined (USB_OTG_FS) |
542 | #if defined (USB_OTG_FS) |
501 | HAL_StatusTypeDef USB_CoreInit(USB_OTG_GlobalTypeDef *USBx, USB_OTG_CfgTypeDef Init); |
543 | HAL_StatusTypeDef USB_CoreInit(USB_OTG_GlobalTypeDef *USBx, USB_OTG_CfgTypeDef cfg); |
502 | HAL_StatusTypeDef USB_DevInit(USB_OTG_GlobalTypeDef *USBx, USB_OTG_CfgTypeDef Init); |
544 | HAL_StatusTypeDef USB_DevInit(USB_OTG_GlobalTypeDef *USBx, USB_OTG_CfgTypeDef cfg); |
503 | HAL_StatusTypeDef USB_EnableGlobalInt(USB_OTG_GlobalTypeDef *USBx); |
545 | HAL_StatusTypeDef USB_EnableGlobalInt(USB_OTG_GlobalTypeDef *USBx); |
504 | HAL_StatusTypeDef USB_DisableGlobalInt(USB_OTG_GlobalTypeDef *USBx); |
546 | HAL_StatusTypeDef USB_DisableGlobalInt(USB_OTG_GlobalTypeDef *USBx); |
- | 547 | HAL_StatusTypeDef USB_SetTurnaroundTime(USB_OTG_GlobalTypeDef *USBx, uint32_t hclk, uint8_t speed); |
|
505 | HAL_StatusTypeDef USB_SetCurrentMode(USB_OTG_GlobalTypeDef *USBx , USB_ModeTypeDef mode); |
548 | HAL_StatusTypeDef USB_SetCurrentMode(USB_OTG_GlobalTypeDef *USBx, USB_ModeTypeDef mode); |
506 | HAL_StatusTypeDef USB_SetDevSpeed(USB_OTG_GlobalTypeDef *USBx , uint8_t speed); |
549 | HAL_StatusTypeDef USB_SetDevSpeed(USB_OTG_GlobalTypeDef *USBx, uint8_t speed); |
507 | HAL_StatusTypeDef USB_FlushRxFifo (USB_OTG_GlobalTypeDef *USBx); |
550 | HAL_StatusTypeDef USB_FlushRxFifo(USB_OTG_GlobalTypeDef *USBx); |
508 | HAL_StatusTypeDef USB_FlushTxFifo (USB_OTG_GlobalTypeDef *USBx, uint32_t num ); |
551 | HAL_StatusTypeDef USB_FlushTxFifo(USB_OTG_GlobalTypeDef *USBx, uint32_t num); |
509 | HAL_StatusTypeDef USB_ActivateEndpoint(USB_OTG_GlobalTypeDef *USBx, USB_OTG_EPTypeDef *ep); |
552 | HAL_StatusTypeDef USB_ActivateEndpoint(USB_OTG_GlobalTypeDef *USBx, USB_OTG_EPTypeDef *ep); |
510 | HAL_StatusTypeDef USB_DeactivateEndpoint(USB_OTG_GlobalTypeDef *USBx, USB_OTG_EPTypeDef *ep); |
553 | HAL_StatusTypeDef USB_DeactivateEndpoint(USB_OTG_GlobalTypeDef *USBx, USB_OTG_EPTypeDef *ep); |
- | 554 | HAL_StatusTypeDef USB_ActivateDedicatedEndpoint(USB_OTG_GlobalTypeDef *USBx, USB_OTG_EPTypeDef *ep); |
|
- | 555 | HAL_StatusTypeDef USB_DeactivateDedicatedEndpoint(USB_OTG_GlobalTypeDef *USBx, USB_OTG_EPTypeDef *ep); |
|
511 | HAL_StatusTypeDef USB_EPStartXfer(USB_OTG_GlobalTypeDef *USBx , USB_OTG_EPTypeDef *ep); |
556 | HAL_StatusTypeDef USB_EPStartXfer(USB_OTG_GlobalTypeDef *USBx, USB_OTG_EPTypeDef *ep); |
512 | HAL_StatusTypeDef USB_EP0StartXfer(USB_OTG_GlobalTypeDef *USBx , USB_OTG_EPTypeDef *ep); |
557 | HAL_StatusTypeDef USB_EP0StartXfer(USB_OTG_GlobalTypeDef *USBx, USB_OTG_EPTypeDef *ep); |
513 | HAL_StatusTypeDef USB_WritePacket(USB_OTG_GlobalTypeDef *USBx, uint8_t *src, uint8_t ch_ep_num, uint16_t len); |
558 | HAL_StatusTypeDef USB_WritePacket(USB_OTG_GlobalTypeDef *USBx, uint8_t *src, |
- | 559 | uint8_t ch_ep_num, uint16_t len); |
|
- | 560 | ||
514 | void * USB_ReadPacket(USB_OTG_GlobalTypeDef *USBx, uint8_t *dest, uint16_t len); |
561 | void *USB_ReadPacket(USB_OTG_GlobalTypeDef *USBx, uint8_t *dest, uint16_t len); |
515 | HAL_StatusTypeDef USB_EPSetStall(USB_OTG_GlobalTypeDef *USBx , USB_OTG_EPTypeDef *ep); |
562 | HAL_StatusTypeDef USB_EPSetStall(USB_OTG_GlobalTypeDef *USBx, USB_OTG_EPTypeDef *ep); |
516 | HAL_StatusTypeDef USB_EPClearStall(USB_OTG_GlobalTypeDef *USBx , USB_OTG_EPTypeDef *ep); |
563 | HAL_StatusTypeDef USB_EPClearStall(USB_OTG_GlobalTypeDef *USBx, USB_OTG_EPTypeDef *ep); |
517 | HAL_StatusTypeDef USB_SetDevAddress (USB_OTG_GlobalTypeDef *USBx, uint8_t address); |
564 | HAL_StatusTypeDef USB_SetDevAddress(USB_OTG_GlobalTypeDef *USBx, uint8_t address); |
518 | HAL_StatusTypeDef USB_DevConnect (USB_OTG_GlobalTypeDef *USBx); |
565 | HAL_StatusTypeDef USB_DevConnect(USB_OTG_GlobalTypeDef *USBx); |
519 | HAL_StatusTypeDef USB_DevDisconnect (USB_OTG_GlobalTypeDef *USBx); |
566 | HAL_StatusTypeDef USB_DevDisconnect(USB_OTG_GlobalTypeDef *USBx); |
520 | HAL_StatusTypeDef USB_StopDevice(USB_OTG_GlobalTypeDef *USBx); |
567 | HAL_StatusTypeDef USB_StopDevice(USB_OTG_GlobalTypeDef *USBx); |
521 | HAL_StatusTypeDef USB_ActivateSetup (USB_OTG_GlobalTypeDef *USBx); |
568 | HAL_StatusTypeDef USB_ActivateSetup(USB_OTG_GlobalTypeDef *USBx); |
522 | HAL_StatusTypeDef USB_EP0_OutStart(USB_OTG_GlobalTypeDef *USBx, uint8_t *psetup); |
569 | HAL_StatusTypeDef USB_EP0_OutStart(USB_OTG_GlobalTypeDef *USBx, uint8_t *psetup); |
523 | uint8_t USB_GetDevSpeed(USB_OTG_GlobalTypeDef *USBx); |
570 | uint8_t USB_GetDevSpeed(USB_OTG_GlobalTypeDef *USBx); |
524 | uint32_t USB_GetMode(USB_OTG_GlobalTypeDef *USBx); |
571 | uint32_t USB_GetMode(USB_OTG_GlobalTypeDef *USBx); |
525 | uint32_t USB_ReadInterrupts (USB_OTG_GlobalTypeDef *USBx); |
572 | uint32_t USB_ReadInterrupts(USB_OTG_GlobalTypeDef *USBx); |
526 | uint32_t USB_ReadDevAllOutEpInterrupt (USB_OTG_GlobalTypeDef *USBx); |
573 | uint32_t USB_ReadDevAllOutEpInterrupt(USB_OTG_GlobalTypeDef *USBx); |
527 | uint32_t USB_ReadDevOutEPInterrupt (USB_OTG_GlobalTypeDef *USBx , uint8_t epnum); |
574 | uint32_t USB_ReadDevOutEPInterrupt(USB_OTG_GlobalTypeDef *USBx, uint8_t epnum); |
528 | uint32_t USB_ReadDevAllInEpInterrupt (USB_OTG_GlobalTypeDef *USBx); |
575 | uint32_t USB_ReadDevAllInEpInterrupt(USB_OTG_GlobalTypeDef *USBx); |
529 | uint32_t USB_ReadDevInEPInterrupt (USB_OTG_GlobalTypeDef *USBx , uint8_t epnum); |
576 | uint32_t USB_ReadDevInEPInterrupt(USB_OTG_GlobalTypeDef *USBx, uint8_t epnum); |
530 | void USB_ClearInterrupts (USB_OTG_GlobalTypeDef *USBx, uint32_t interrupt); |
577 | void USB_ClearInterrupts(USB_OTG_GlobalTypeDef *USBx, uint32_t interrupt); |
531 | 578 | ||
532 | HAL_StatusTypeDef USB_HostInit (USB_OTG_GlobalTypeDef *USBx, USB_OTG_CfgTypeDef cfg); |
579 | HAL_StatusTypeDef USB_HostInit(USB_OTG_GlobalTypeDef *USBx, USB_OTG_CfgTypeDef cfg); |
533 | HAL_StatusTypeDef USB_InitFSLSPClkSel(USB_OTG_GlobalTypeDef *USBx , uint8_t freq); |
580 | HAL_StatusTypeDef USB_InitFSLSPClkSel(USB_OTG_GlobalTypeDef *USBx, uint8_t freq); |
534 | HAL_StatusTypeDef USB_ResetPort(USB_OTG_GlobalTypeDef *USBx); |
581 | HAL_StatusTypeDef USB_ResetPort(USB_OTG_GlobalTypeDef *USBx); |
535 | HAL_StatusTypeDef USB_DriveVbus (USB_OTG_GlobalTypeDef *USBx, uint8_t state); |
582 | HAL_StatusTypeDef USB_DriveVbus(USB_OTG_GlobalTypeDef *USBx, uint8_t state); |
536 | uint32_t USB_GetHostSpeed (USB_OTG_GlobalTypeDef *USBx); |
583 | uint32_t USB_GetHostSpeed(USB_OTG_GlobalTypeDef *USBx); |
537 | uint32_t USB_GetCurrentFrame (USB_OTG_GlobalTypeDef *USBx); |
584 | uint32_t USB_GetCurrentFrame(USB_OTG_GlobalTypeDef *USBx); |
538 | HAL_StatusTypeDef USB_HC_Init(USB_OTG_GlobalTypeDef *USBx, |
585 | HAL_StatusTypeDef USB_HC_Init(USB_OTG_GlobalTypeDef *USBx, uint8_t ch_num, |
539 | uint8_t ch_num, |
- | |
540 | uint8_t epnum, |
- | |
541 | uint8_t dev_address, |
586 | uint8_t epnum, uint8_t dev_address, uint8_t speed, |
542 | uint8_t speed, |
587 | uint8_t ep_type, uint16_t mps); |
543 | uint8_t ep_type, |
588 | HAL_StatusTypeDef USB_HC_StartXfer(USB_OTG_GlobalTypeDef *USBx, |
544 | uint16_t mps); |
589 | USB_OTG_HCTypeDef *hc); |
545 | HAL_StatusTypeDef USB_HC_StartXfer(USB_OTG_GlobalTypeDef *USBx, USB_OTG_HCTypeDef *hc); |
- | |
- | 590 | ||
546 | uint32_t USB_HC_ReadInterrupt (USB_OTG_GlobalTypeDef *USBx); |
591 | uint32_t USB_HC_ReadInterrupt(USB_OTG_GlobalTypeDef *USBx); |
547 | HAL_StatusTypeDef USB_HC_Halt(USB_OTG_GlobalTypeDef *USBx , uint8_t hc_num); |
592 | HAL_StatusTypeDef USB_HC_Halt(USB_OTG_GlobalTypeDef *USBx, uint8_t hc_num); |
548 | HAL_StatusTypeDef USB_DoPing(USB_OTG_GlobalTypeDef *USBx , uint8_t ch_num); |
593 | HAL_StatusTypeDef USB_DoPing(USB_OTG_GlobalTypeDef *USBx, uint8_t ch_num); |
549 | HAL_StatusTypeDef USB_StopHost(USB_OTG_GlobalTypeDef *USBx); |
594 | HAL_StatusTypeDef USB_StopHost(USB_OTG_GlobalTypeDef *USBx); |
550 | HAL_StatusTypeDef USB_ActivateRemoteWakeup(USB_OTG_GlobalTypeDef *USBx); |
595 | HAL_StatusTypeDef USB_ActivateRemoteWakeup(USB_OTG_GlobalTypeDef *USBx); |
551 | HAL_StatusTypeDef USB_DeActivateRemoteWakeup(USB_OTG_GlobalTypeDef *USBx); |
596 | HAL_StatusTypeDef USB_DeActivateRemoteWakeup(USB_OTG_GlobalTypeDef *USBx); |
552 | #endif /* USB_OTG_FS */ |
597 | #endif /* defined (USB_OTG_FS) */ |
553 | 598 | ||
554 | #if defined (USB) |
599 | #if defined (USB) |
555 | HAL_StatusTypeDef USB_CoreInit(USB_TypeDef *USBx, USB_CfgTypeDef Init); |
600 | HAL_StatusTypeDef USB_CoreInit(USB_TypeDef *USBx, USB_CfgTypeDef cfg); |
556 | HAL_StatusTypeDef USB_DevInit(USB_TypeDef *USBx, USB_CfgTypeDef Init); |
601 | HAL_StatusTypeDef USB_DevInit(USB_TypeDef *USBx, USB_CfgTypeDef cfg); |
557 | HAL_StatusTypeDef USB_EnableGlobalInt(USB_TypeDef *USBx); |
602 | HAL_StatusTypeDef USB_EnableGlobalInt(USB_TypeDef *USBx); |
558 | HAL_StatusTypeDef USB_DisableGlobalInt(USB_TypeDef *USBx); |
603 | HAL_StatusTypeDef USB_DisableGlobalInt(USB_TypeDef *USBx); |
559 | HAL_StatusTypeDef USB_SetCurrentMode(USB_TypeDef *USBx , USB_ModeTypeDef mode); |
604 | HAL_StatusTypeDef USB_SetCurrentMode(USB_TypeDef *USBx, USB_ModeTypeDef mode); |
560 | HAL_StatusTypeDef USB_SetDevSpeed(USB_TypeDef *USBx , uint8_t speed); |
605 | HAL_StatusTypeDef USB_SetDevSpeed(USB_TypeDef *USBx, uint8_t speed); |
561 | HAL_StatusTypeDef USB_FlushRxFifo (USB_TypeDef *USBx); |
606 | HAL_StatusTypeDef USB_FlushRxFifo(USB_TypeDef *USBx); |
562 | HAL_StatusTypeDef USB_FlushTxFifo (USB_TypeDef *USBx, uint32_t num ); |
607 | HAL_StatusTypeDef USB_FlushTxFifo(USB_TypeDef *USBx, uint32_t num); |
563 | HAL_StatusTypeDef USB_ActivateEndpoint(USB_TypeDef *USBx, USB_EPTypeDef *ep); |
608 | HAL_StatusTypeDef USB_ActivateEndpoint(USB_TypeDef *USBx, USB_EPTypeDef *ep); |
564 | HAL_StatusTypeDef USB_DeactivateEndpoint(USB_TypeDef *USBx, USB_EPTypeDef *ep); |
609 | HAL_StatusTypeDef USB_DeactivateEndpoint(USB_TypeDef *USBx, USB_EPTypeDef *ep); |
565 | HAL_StatusTypeDef USB_EPStartXfer(USB_TypeDef *USBx , USB_EPTypeDef *ep); |
610 | HAL_StatusTypeDef USB_EPStartXfer(USB_TypeDef *USBx, USB_EPTypeDef *ep); |
566 | HAL_StatusTypeDef USB_WritePacket(USB_TypeDef *USBx, uint8_t *src, uint8_t ch_ep_num, uint16_t len); |
- | |
567 | void * USB_ReadPacket(USB_TypeDef *USBx, uint8_t *dest, uint16_t len); |
- | |
568 | HAL_StatusTypeDef USB_EPSetStall(USB_TypeDef *USBx , USB_EPTypeDef *ep); |
611 | HAL_StatusTypeDef USB_EPSetStall(USB_TypeDef *USBx, USB_EPTypeDef *ep); |
569 | HAL_StatusTypeDef USB_EPClearStall(USB_TypeDef *USBx , USB_EPTypeDef *ep); |
612 | HAL_StatusTypeDef USB_EPClearStall(USB_TypeDef *USBx, USB_EPTypeDef *ep); |
570 | HAL_StatusTypeDef USB_SetDevAddress (USB_TypeDef *USBx, uint8_t address); |
613 | HAL_StatusTypeDef USB_SetDevAddress(USB_TypeDef *USBx, uint8_t address); |
571 | HAL_StatusTypeDef USB_DevConnect (USB_TypeDef *USBx); |
614 | HAL_StatusTypeDef USB_DevConnect(USB_TypeDef *USBx); |
572 | HAL_StatusTypeDef USB_DevDisconnect (USB_TypeDef *USBx); |
615 | HAL_StatusTypeDef USB_DevDisconnect(USB_TypeDef *USBx); |
573 | HAL_StatusTypeDef USB_StopDevice(USB_TypeDef *USBx); |
616 | HAL_StatusTypeDef USB_StopDevice(USB_TypeDef *USBx); |
574 | HAL_StatusTypeDef USB_EP0_OutStart(USB_TypeDef *USBx, uint8_t *psetup); |
617 | HAL_StatusTypeDef USB_EP0_OutStart(USB_TypeDef *USBx, uint8_t *psetup); |
575 | uint32_t USB_ReadInterrupts (USB_TypeDef *USBx); |
- | |
576 | uint32_t USB_ReadDevAllOutEpInterrupt (USB_TypeDef *USBx); |
- | |
577 | uint32_t USB_ReadDevOutEPInterrupt (USB_TypeDef *USBx , uint8_t epnum); |
618 | HAL_StatusTypeDef USB_WritePacket(USB_TypeDef *USBx, uint8_t *src, |
578 | uint32_t USB_ReadDevAllInEpInterrupt (USB_TypeDef *USBx); |
- | |
579 | uint32_t USB_ReadDevInEPInterrupt (USB_TypeDef *USBx , uint8_t epnum); |
619 | uint8_t ch_ep_num, uint16_t len); |
- | 620 | ||
580 | void USB_ClearInterrupts (USB_TypeDef *USBx, uint32_t interrupt); |
621 | void *USB_ReadPacket(USB_TypeDef *USBx, uint8_t *dest, uint16_t len); |
581 | 622 | ||
- | 623 | uint32_t USB_ReadInterrupts(USB_TypeDef *USBx); |
|
- | 624 | uint32_t USB_ReadDevAllOutEpInterrupt(USB_TypeDef *USBx); |
|
- | 625 | uint32_t USB_ReadDevOutEPInterrupt(USB_TypeDef *USBx, uint8_t epnum); |
|
- | 626 | uint32_t USB_ReadDevAllInEpInterrupt(USB_TypeDef *USBx); |
|
- | 627 | uint32_t USB_ReadDevInEPInterrupt(USB_TypeDef *USBx, uint8_t epnum); |
|
- | 628 | void USB_ClearInterrupts(USB_TypeDef *USBx, uint32_t interrupt); |
|
582 | HAL_StatusTypeDef USB_ActivateRemoteWakeup(USB_TypeDef *USBx); |
629 | HAL_StatusTypeDef USB_ActivateRemoteWakeup(USB_TypeDef *USBx); |
583 | HAL_StatusTypeDef USB_DeActivateRemoteWakeup(USB_TypeDef *USBx); |
630 | HAL_StatusTypeDef USB_DeActivateRemoteWakeup(USB_TypeDef *USBx); |
- | 631 | ||
- | 632 | void USB_WritePMA(USB_TypeDef *USBx, uint8_t *pbUsrBuf, |
|
584 | void USB_WritePMA(USB_TypeDef *USBx, uint8_t *pbUsrBuf, uint16_t wPMABufAddr, uint16_t wNBytes); |
633 | uint16_t wPMABufAddr, uint16_t wNBytes); |
- | 634 | ||
- | 635 | void USB_ReadPMA(USB_TypeDef *USBx, uint8_t *pbUsrBuf, |
|
585 | void USB_ReadPMA(USB_TypeDef *USBx, uint8_t *pbUsrBuf, uint16_t wPMABufAddr, uint16_t wNBytes); |
636 | uint16_t wPMABufAddr, uint16_t wNBytes); |
586 | #endif /* USB */ |
637 | #endif /* defined (USB) */ |
587 | /** |
638 | /** |
588 | * @} |
639 | * @} |
589 | */ |
640 | */ |
- | 641 | ||
590 | /** |
642 | /** |
591 | * @} |
643 | * @} |
592 | */ |
644 | */ |
593 | 645 | ||
594 | /** |
646 | /** |
595 | * @} |
647 | * @} |
596 | */ |
648 | */ |
597 | 649 | ||
598 | /** |
650 | /** |
599 | * @} |
651 | * @} |
600 | */ |
652 | */ |
601 | - | ||
602 | #endif /* STM32F102x6 || STM32F102xB || */ |
653 | #endif /* defined (USB) || defined (USB_OTG_FS) */ |
603 | /* STM32F103x6 || STM32F103xB || */ |
- | |
604 | /* STM32F103xE || STM32F103xG || */ |
- | |
605 | /* STM32F105xC || STM32F107xC */ |
- | |
606 | 654 | ||
607 | #ifdef __cplusplus |
655 | #ifdef __cplusplus |
608 | } |
656 | } |
609 | #endif |
657 | #endif |
610 | 658 | ||
611 | 659 | ||
612 | #endif /* __STM32F1xx_LL_USB_H */ |
660 | #endif /* STM32F1xx_LL_USB_H */ |
613 | 661 | ||
614 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |
662 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |