Mercurial > public > ostc4
comparison Common/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_hcd.h @ 128:c78bcbd5deda FlipDisplay
Added current STM32 standandard libraries in version independend folder structure
author | Ideenmodellierer |
---|---|
date | Sun, 17 Feb 2019 21:12:22 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
127:1369f8660eaa | 128:c78bcbd5deda |
---|---|
1 /** | |
2 ****************************************************************************** | |
3 * @file stm32f4xx_hal_hcd.h | |
4 * @author MCD Application Team | |
5 * @brief Header file of HCD HAL module. | |
6 ****************************************************************************** | |
7 * @attention | |
8 * | |
9 * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2> | |
10 * | |
11 * Redistribution and use in source and binary forms, with or without modification, | |
12 * are permitted provided that the following conditions are met: | |
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. | |
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 | |
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 * | |
33 ****************************************************************************** | |
34 */ | |
35 | |
36 /* Define to prevent recursive inclusion -------------------------------------*/ | |
37 #ifndef __STM32F4xx_HAL_HCD_H | |
38 #define __STM32F4xx_HAL_HCD_H | |
39 | |
40 #ifdef __cplusplus | |
41 extern "C" { | |
42 #endif | |
43 #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) || \ | |
44 defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || \ | |
45 defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F411xE) || defined(STM32F446xx) || \ | |
46 defined(STM32F469xx) || defined(STM32F479xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || \ | |
47 defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx) | |
48 /* Includes ------------------------------------------------------------------*/ | |
49 #include "stm32f4xx_ll_usb.h" | |
50 | |
51 /** @addtogroup STM32F4xx_HAL_Driver | |
52 * @{ | |
53 */ | |
54 | |
55 /** @addtogroup HCD | |
56 * @{ | |
57 */ | |
58 | |
59 /* Exported types ------------------------------------------------------------*/ | |
60 /** @defgroup HCD_Exported_Types HCD Exported Types | |
61 * @{ | |
62 */ | |
63 | |
64 /** @defgroup HCD_Exported_Types_Group1 HCD State Structure definition | |
65 * @{ | |
66 */ | |
67 typedef enum | |
68 { | |
69 HAL_HCD_STATE_RESET = 0x00U, | |
70 HAL_HCD_STATE_READY = 0x01U, | |
71 HAL_HCD_STATE_ERROR = 0x02U, | |
72 HAL_HCD_STATE_BUSY = 0x03U, | |
73 HAL_HCD_STATE_TIMEOUT = 0x04U | |
74 } HCD_StateTypeDef; | |
75 | |
76 typedef USB_OTG_GlobalTypeDef HCD_TypeDef; | |
77 typedef USB_OTG_CfgTypeDef HCD_InitTypeDef; | |
78 typedef USB_OTG_HCTypeDef HCD_HCTypeDef ; | |
79 typedef USB_OTG_URBStateTypeDef HCD_URBStateTypeDef ; | |
80 typedef USB_OTG_HCStateTypeDef HCD_HCStateTypeDef ; | |
81 /** | |
82 * @} | |
83 */ | |
84 | |
85 /** @defgroup HCD_Exported_Types_Group2 HCD Handle Structure definition | |
86 * @{ | |
87 */ | |
88 typedef struct | |
89 { | |
90 HCD_TypeDef *Instance; /*!< Register base address */ | |
91 HCD_InitTypeDef Init; /*!< HCD required parameters */ | |
92 HCD_HCTypeDef hc[15U]; /*!< Host channels parameters */ | |
93 HAL_LockTypeDef Lock; /*!< HCD peripheral status */ | |
94 __IO HCD_StateTypeDef State; /*!< HCD communication state */ | |
95 void *pData; /*!< Pointer Stack Handler */ | |
96 } HCD_HandleTypeDef; | |
97 /** | |
98 * @} | |
99 */ | |
100 | |
101 /** | |
102 * @} | |
103 */ | |
104 | |
105 /* Exported constants --------------------------------------------------------*/ | |
106 /** @defgroup HCD_Exported_Constants HCD Exported Constants | |
107 * @{ | |
108 */ | |
109 | |
110 /** @defgroup HCD_Speed HCD Speed | |
111 * @{ | |
112 */ | |
113 #define HCD_SPEED_HIGH 0U | |
114 #define HCD_SPEED_LOW 2U | |
115 #define HCD_SPEED_FULL 3U | |
116 /** | |
117 * @} | |
118 */ | |
119 | |
120 /** @defgroup HCD_PHY_Module HCD PHY Module | |
121 * @{ | |
122 */ | |
123 #define HCD_PHY_ULPI 1U | |
124 #define HCD_PHY_EMBEDDED 2U | |
125 /** | |
126 * @} | |
127 */ | |
128 | |
129 /** | |
130 * @} | |
131 */ | |
132 | |
133 /* Exported macro ------------------------------------------------------------*/ | |
134 /** @defgroup HCD_Exported_Macros HCD Exported Macros | |
135 * @brief macros to handle interrupts and specific clock configurations | |
136 * @{ | |
137 */ | |
138 #define __HAL_HCD_ENABLE(__HANDLE__) USB_EnableGlobalInt ((__HANDLE__)->Instance) | |
139 #define __HAL_HCD_DISABLE(__HANDLE__) USB_DisableGlobalInt ((__HANDLE__)->Instance) | |
140 | |
141 #define __HAL_HCD_GET_FLAG(__HANDLE__, __INTERRUPT__) ((USB_ReadInterrupts((__HANDLE__)->Instance) & (__INTERRUPT__)) == (__INTERRUPT__)) | |
142 #define __HAL_HCD_CLEAR_FLAG(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->GINTSTS) = (__INTERRUPT__)) | |
143 #define __HAL_HCD_IS_INVALID_INTERRUPT(__HANDLE__) (USB_ReadInterrupts((__HANDLE__)->Instance) == 0U) | |
144 | |
145 #define __HAL_HCD_CLEAR_HC_INT(chnum, __INTERRUPT__) (USBx_HC(chnum)->HCINT = (__INTERRUPT__)) | |
146 #define __HAL_HCD_MASK_HALT_HC_INT(chnum) (USBx_HC(chnum)->HCINTMSK &= ~USB_OTG_HCINTMSK_CHHM) | |
147 #define __HAL_HCD_UNMASK_HALT_HC_INT(chnum) (USBx_HC(chnum)->HCINTMSK |= USB_OTG_HCINTMSK_CHHM) | |
148 #define __HAL_HCD_MASK_ACK_HC_INT(chnum) (USBx_HC(chnum)->HCINTMSK &= ~USB_OTG_HCINTMSK_ACKM) | |
149 #define __HAL_HCD_UNMASK_ACK_HC_INT(chnum) (USBx_HC(chnum)->HCINTMSK |= USB_OTG_HCINTMSK_ACKM) | |
150 /** | |
151 * @} | |
152 */ | |
153 | |
154 /* Exported functions --------------------------------------------------------*/ | |
155 /** @addtogroup HCD_Exported_Functions HCD Exported Functions | |
156 * @{ | |
157 */ | |
158 | |
159 /* Initialization/de-initialization functions ********************************/ | |
160 /** @addtogroup HCD_Exported_Functions_Group1 Initialization and de-initialization functions | |
161 * @{ | |
162 */ | |
163 HAL_StatusTypeDef HAL_HCD_Init(HCD_HandleTypeDef *hhcd); | |
164 HAL_StatusTypeDef HAL_HCD_DeInit(HCD_HandleTypeDef *hhcd); | |
165 HAL_StatusTypeDef HAL_HCD_HC_Init(HCD_HandleTypeDef *hhcd, | |
166 uint8_t ch_num, | |
167 uint8_t epnum, | |
168 uint8_t dev_address, | |
169 uint8_t speed, | |
170 uint8_t ep_type, | |
171 uint16_t mps); | |
172 | |
173 HAL_StatusTypeDef HAL_HCD_HC_Halt(HCD_HandleTypeDef *hhcd, uint8_t ch_num); | |
174 | |
175 void HAL_HCD_MspInit(HCD_HandleTypeDef *hhcd); | |
176 void HAL_HCD_MspDeInit(HCD_HandleTypeDef *hhcd); | |
177 /** | |
178 * @} | |
179 */ | |
180 | |
181 /* I/O operation functions ***************************************************/ | |
182 /** @addtogroup HCD_Exported_Functions_Group2 Input and Output operation functions | |
183 * @{ | |
184 */ | |
185 HAL_StatusTypeDef HAL_HCD_HC_SubmitRequest(HCD_HandleTypeDef *hhcd, | |
186 uint8_t ch_num, | |
187 uint8_t direction, | |
188 uint8_t ep_type, | |
189 uint8_t token, | |
190 uint8_t* pbuff, | |
191 uint16_t length, | |
192 uint8_t do_ping); | |
193 | |
194 /* Non-Blocking mode: Interrupt */ | |
195 void HAL_HCD_IRQHandler(HCD_HandleTypeDef *hhcd); | |
196 void HAL_HCD_SOF_Callback(HCD_HandleTypeDef *hhcd); | |
197 void HAL_HCD_Connect_Callback(HCD_HandleTypeDef *hhcd); | |
198 void HAL_HCD_Disconnect_Callback(HCD_HandleTypeDef *hhcd); | |
199 void HAL_HCD_HC_NotifyURBChange_Callback(HCD_HandleTypeDef *hhcd, | |
200 uint8_t chnum, | |
201 HCD_URBStateTypeDef urb_state); | |
202 /** | |
203 * @} | |
204 */ | |
205 | |
206 /* Peripheral Control functions **********************************************/ | |
207 /** @addtogroup HCD_Exported_Functions_Group3 Peripheral Control functions | |
208 * @{ | |
209 */ | |
210 HAL_StatusTypeDef HAL_HCD_ResetPort(HCD_HandleTypeDef *hhcd); | |
211 HAL_StatusTypeDef HAL_HCD_Start(HCD_HandleTypeDef *hhcd); | |
212 HAL_StatusTypeDef HAL_HCD_Stop(HCD_HandleTypeDef *hhcd); | |
213 /** | |
214 * @} | |
215 */ | |
216 | |
217 /* Peripheral State functions ************************************************/ | |
218 /** @addtogroup HCD_Exported_Functions_Group4 Peripheral State functions | |
219 * @{ | |
220 */ | |
221 HCD_StateTypeDef HAL_HCD_GetState(HCD_HandleTypeDef *hhcd); | |
222 HCD_URBStateTypeDef HAL_HCD_HC_GetURBState(HCD_HandleTypeDef *hhcd, uint8_t chnum); | |
223 uint32_t HAL_HCD_HC_GetXferCount(HCD_HandleTypeDef *hhcd, uint8_t chnum); | |
224 HCD_HCStateTypeDef HAL_HCD_HC_GetState(HCD_HandleTypeDef *hhcd, uint8_t chnum); | |
225 uint32_t HAL_HCD_GetCurrentFrame(HCD_HandleTypeDef *hhcd); | |
226 uint32_t HAL_HCD_GetCurrentSpeed(HCD_HandleTypeDef *hhcd); | |
227 /** | |
228 * @} | |
229 */ | |
230 | |
231 /** | |
232 * @} | |
233 */ | |
234 | |
235 /* Private macros ------------------------------------------------------------*/ | |
236 /** @defgroup HCD_Private_Macros HCD Private Macros | |
237 * @{ | |
238 */ | |
239 | |
240 /** | |
241 * @} | |
242 */ | |
243 | |
244 /** | |
245 * @} | |
246 */ | |
247 | |
248 /** | |
249 * @} | |
250 */ | |
251 #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || | |
252 STM32F401xC || STM32F401xE || STM32F411xE || STM32F446xx || STM32F469xx || STM32F479xx || STM32F412Zx || STM32F412Rx || | |
253 STM32F412Vx || STM32F412Cx || defined(STM32F413xx) || defined(STM32F423xx) */ | |
254 #ifdef __cplusplus | |
255 } | |
256 #endif | |
257 | |
258 #endif /* __STM32F4xx_HAL_HCD_H */ | |
259 | |
260 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |