mbed library sources
Fork of mbed-src by
targets/cmsis/TARGET_STM/TARGET_NUCLEO_F411RE/stm32f4xx_hal_hcd.h@235:685d5f11838f, 2014-06-23 (annotated)
- Committer:
- mbed_official
- Date:
- Mon Jun 23 14:00:09 2014 +0100
- Revision:
- 235:685d5f11838f
Synchronized with git revision 9728c76667962b289ee9c4c687ef9f115db48cd3
Full URL: https://github.com/mbedmicro/mbed/commit/9728c76667962b289ee9c4c687ef9f115db48cd3/
[NUCLEO_F411RE] Add all target files
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mbed_official | 235:685d5f11838f | 1 | /** |
mbed_official | 235:685d5f11838f | 2 | ****************************************************************************** |
mbed_official | 235:685d5f11838f | 3 | * @file stm32f4xx_hal_hcd.h |
mbed_official | 235:685d5f11838f | 4 | * @author MCD Application Team |
mbed_official | 235:685d5f11838f | 5 | * @version V1.1.0 |
mbed_official | 235:685d5f11838f | 6 | * @date 19-June-2014 |
mbed_official | 235:685d5f11838f | 7 | * @brief Header file of HCD HAL module. |
mbed_official | 235:685d5f11838f | 8 | ****************************************************************************** |
mbed_official | 235:685d5f11838f | 9 | * @attention |
mbed_official | 235:685d5f11838f | 10 | * |
mbed_official | 235:685d5f11838f | 11 | * <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2> |
mbed_official | 235:685d5f11838f | 12 | * |
mbed_official | 235:685d5f11838f | 13 | * Redistribution and use in source and binary forms, with or without modification, |
mbed_official | 235:685d5f11838f | 14 | * are permitted provided that the following conditions are met: |
mbed_official | 235:685d5f11838f | 15 | * 1. Redistributions of source code must retain the above copyright notice, |
mbed_official | 235:685d5f11838f | 16 | * this list of conditions and the following disclaimer. |
mbed_official | 235:685d5f11838f | 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
mbed_official | 235:685d5f11838f | 18 | * this list of conditions and the following disclaimer in the documentation |
mbed_official | 235:685d5f11838f | 19 | * and/or other materials provided with the distribution. |
mbed_official | 235:685d5f11838f | 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
mbed_official | 235:685d5f11838f | 21 | * may be used to endorse or promote products derived from this software |
mbed_official | 235:685d5f11838f | 22 | * without specific prior written permission. |
mbed_official | 235:685d5f11838f | 23 | * |
mbed_official | 235:685d5f11838f | 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
mbed_official | 235:685d5f11838f | 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
mbed_official | 235:685d5f11838f | 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
mbed_official | 235:685d5f11838f | 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
mbed_official | 235:685d5f11838f | 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
mbed_official | 235:685d5f11838f | 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
mbed_official | 235:685d5f11838f | 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
mbed_official | 235:685d5f11838f | 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
mbed_official | 235:685d5f11838f | 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
mbed_official | 235:685d5f11838f | 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
mbed_official | 235:685d5f11838f | 34 | * |
mbed_official | 235:685d5f11838f | 35 | ****************************************************************************** |
mbed_official | 235:685d5f11838f | 36 | */ |
mbed_official | 235:685d5f11838f | 37 | |
mbed_official | 235:685d5f11838f | 38 | /* Define to prevent recursive inclusion -------------------------------------*/ |
mbed_official | 235:685d5f11838f | 39 | #ifndef __STM32F4xx_HAL_HCD_H |
mbed_official | 235:685d5f11838f | 40 | #define __STM32F4xx_HAL_HCD_H |
mbed_official | 235:685d5f11838f | 41 | |
mbed_official | 235:685d5f11838f | 42 | #ifdef __cplusplus |
mbed_official | 235:685d5f11838f | 43 | extern "C" { |
mbed_official | 235:685d5f11838f | 44 | #endif |
mbed_official | 235:685d5f11838f | 45 | |
mbed_official | 235:685d5f11838f | 46 | /* Includes ------------------------------------------------------------------*/ |
mbed_official | 235:685d5f11838f | 47 | #include "stm32f4xx_ll_usb.h" |
mbed_official | 235:685d5f11838f | 48 | |
mbed_official | 235:685d5f11838f | 49 | /** @addtogroup STM32F4xx_HAL_Driver |
mbed_official | 235:685d5f11838f | 50 | * @{ |
mbed_official | 235:685d5f11838f | 51 | */ |
mbed_official | 235:685d5f11838f | 52 | |
mbed_official | 235:685d5f11838f | 53 | /** @addtogroup HCD |
mbed_official | 235:685d5f11838f | 54 | * @{ |
mbed_official | 235:685d5f11838f | 55 | */ |
mbed_official | 235:685d5f11838f | 56 | |
mbed_official | 235:685d5f11838f | 57 | /* Exported types ------------------------------------------------------------*/ |
mbed_official | 235:685d5f11838f | 58 | |
mbed_official | 235:685d5f11838f | 59 | /** |
mbed_official | 235:685d5f11838f | 60 | * @brief HCD Status structures structure definition |
mbed_official | 235:685d5f11838f | 61 | */ |
mbed_official | 235:685d5f11838f | 62 | typedef enum |
mbed_official | 235:685d5f11838f | 63 | { |
mbed_official | 235:685d5f11838f | 64 | HAL_HCD_STATE_RESET = 0x00, |
mbed_official | 235:685d5f11838f | 65 | HAL_HCD_STATE_READY = 0x01, |
mbed_official | 235:685d5f11838f | 66 | HAL_HCD_STATE_ERROR = 0x02, |
mbed_official | 235:685d5f11838f | 67 | HAL_HCD_STATE_BUSY = 0x03, |
mbed_official | 235:685d5f11838f | 68 | HAL_HCD_STATE_TIMEOUT = 0x04 |
mbed_official | 235:685d5f11838f | 69 | } HCD_StateTypeDef; |
mbed_official | 235:685d5f11838f | 70 | |
mbed_official | 235:685d5f11838f | 71 | typedef USB_OTG_GlobalTypeDef HCD_TypeDef; |
mbed_official | 235:685d5f11838f | 72 | typedef USB_OTG_CfgTypeDef HCD_InitTypeDef; |
mbed_official | 235:685d5f11838f | 73 | typedef USB_OTG_HCTypeDef HCD_HCTypeDef ; |
mbed_official | 235:685d5f11838f | 74 | typedef USB_OTG_URBStateTypeDef HCD_URBStateTypeDef ; |
mbed_official | 235:685d5f11838f | 75 | typedef USB_OTG_HCStateTypeDef HCD_HCStateTypeDef ; |
mbed_official | 235:685d5f11838f | 76 | |
mbed_official | 235:685d5f11838f | 77 | /** |
mbed_official | 235:685d5f11838f | 78 | * @brief HCD Handle Structure definition |
mbed_official | 235:685d5f11838f | 79 | */ |
mbed_official | 235:685d5f11838f | 80 | typedef struct |
mbed_official | 235:685d5f11838f | 81 | { |
mbed_official | 235:685d5f11838f | 82 | HCD_TypeDef *Instance; /*!< Register base address */ |
mbed_official | 235:685d5f11838f | 83 | HCD_InitTypeDef Init; /*!< HCD required parameters */ |
mbed_official | 235:685d5f11838f | 84 | HCD_HCTypeDef hc[15]; /*!< Host channels parameters */ |
mbed_official | 235:685d5f11838f | 85 | HAL_LockTypeDef Lock; /*!< HCD peripheral status */ |
mbed_official | 235:685d5f11838f | 86 | __IO HCD_StateTypeDef State; /*!< HCD communication state */ |
mbed_official | 235:685d5f11838f | 87 | void *pData; /*!< Pointer Stack Handler */ |
mbed_official | 235:685d5f11838f | 88 | |
mbed_official | 235:685d5f11838f | 89 | } HCD_HandleTypeDef; |
mbed_official | 235:685d5f11838f | 90 | |
mbed_official | 235:685d5f11838f | 91 | /* Exported constants --------------------------------------------------------*/ |
mbed_official | 235:685d5f11838f | 92 | /** @defgroup HCD_Exported_Constants |
mbed_official | 235:685d5f11838f | 93 | * @{ |
mbed_official | 235:685d5f11838f | 94 | */ |
mbed_official | 235:685d5f11838f | 95 | |
mbed_official | 235:685d5f11838f | 96 | /** @defgroup HCD_Instance_definition |
mbed_official | 235:685d5f11838f | 97 | * @{ |
mbed_official | 235:685d5f11838f | 98 | */ |
mbed_official | 235:685d5f11838f | 99 | |
mbed_official | 235:685d5f11838f | 100 | #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) || defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) |
mbed_official | 235:685d5f11838f | 101 | #define IS_HCD_ALL_INSTANCE(INSTANCE) (((INSTANCE) == USB_OTG_FS) || \ |
mbed_official | 235:685d5f11838f | 102 | ((INSTANCE) == USB_OTG_HS)) |
mbed_official | 235:685d5f11838f | 103 | #elif defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F411xE) |
mbed_official | 235:685d5f11838f | 104 | #define IS_HCD_ALL_INSTANCE(INSTANCE) (((INSTANCE) == USB_OTG_FS)) |
mbed_official | 235:685d5f11838f | 105 | #endif |
mbed_official | 235:685d5f11838f | 106 | |
mbed_official | 235:685d5f11838f | 107 | /** |
mbed_official | 235:685d5f11838f | 108 | * @} |
mbed_official | 235:685d5f11838f | 109 | */ |
mbed_official | 235:685d5f11838f | 110 | |
mbed_official | 235:685d5f11838f | 111 | /** @defgroup HCD_Speed |
mbed_official | 235:685d5f11838f | 112 | * @{ |
mbed_official | 235:685d5f11838f | 113 | */ |
mbed_official | 235:685d5f11838f | 114 | #define HCD_SPEED_HIGH 0 |
mbed_official | 235:685d5f11838f | 115 | #define HCD_SPEED_LOW 2 |
mbed_official | 235:685d5f11838f | 116 | #define HCD_SPEED_FULL 3 |
mbed_official | 235:685d5f11838f | 117 | |
mbed_official | 235:685d5f11838f | 118 | /** |
mbed_official | 235:685d5f11838f | 119 | * @} |
mbed_official | 235:685d5f11838f | 120 | */ |
mbed_official | 235:685d5f11838f | 121 | |
mbed_official | 235:685d5f11838f | 122 | /** @defgroup HCD_PHY_Module |
mbed_official | 235:685d5f11838f | 123 | * @{ |
mbed_official | 235:685d5f11838f | 124 | */ |
mbed_official | 235:685d5f11838f | 125 | #define HCD_PHY_ULPI 1 |
mbed_official | 235:685d5f11838f | 126 | #define HCD_PHY_EMBEDDED 2 |
mbed_official | 235:685d5f11838f | 127 | /** |
mbed_official | 235:685d5f11838f | 128 | * @} |
mbed_official | 235:685d5f11838f | 129 | */ |
mbed_official | 235:685d5f11838f | 130 | /** |
mbed_official | 235:685d5f11838f | 131 | * @} |
mbed_official | 235:685d5f11838f | 132 | */ |
mbed_official | 235:685d5f11838f | 133 | |
mbed_official | 235:685d5f11838f | 134 | /* Exported macro ------------------------------------------------------------*/ |
mbed_official | 235:685d5f11838f | 135 | |
mbed_official | 235:685d5f11838f | 136 | /** @defgroup HCD_Interrupt_Clock |
mbed_official | 235:685d5f11838f | 137 | * @brief macros to handle interrupts and specific clock configurations |
mbed_official | 235:685d5f11838f | 138 | * @{ |
mbed_official | 235:685d5f11838f | 139 | */ |
mbed_official | 235:685d5f11838f | 140 | #define __HAL_HCD_ENABLE(__HANDLE__) USB_EnableGlobalInt ((__HANDLE__)->Instance) |
mbed_official | 235:685d5f11838f | 141 | #define __HAL_HCD_DISABLE(__HANDLE__) USB_DisableGlobalInt ((__HANDLE__)->Instance) |
mbed_official | 235:685d5f11838f | 142 | |
mbed_official | 235:685d5f11838f | 143 | |
mbed_official | 235:685d5f11838f | 144 | #define __HAL_HCD_GET_FLAG(__HANDLE__, __INTERRUPT__) ((USB_ReadInterrupts((__HANDLE__)->Instance) & (__INTERRUPT__)) == (__INTERRUPT__)) |
mbed_official | 235:685d5f11838f | 145 | #define __HAL_HCD_CLEAR_FLAG(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->GINTSTS) = (__INTERRUPT__)) |
mbed_official | 235:685d5f11838f | 146 | #define __HAL_HCD_IS_INVALID_INTERRUPT(__HANDLE__) (USB_ReadInterrupts((__HANDLE__)->Instance) == 0) |
mbed_official | 235:685d5f11838f | 147 | |
mbed_official | 235:685d5f11838f | 148 | |
mbed_official | 235:685d5f11838f | 149 | #define __HAL_HCD_CLEAR_HC_INT(chnum, __INTERRUPT__) (USBx_HC(chnum)->HCINT = (__INTERRUPT__)) |
mbed_official | 235:685d5f11838f | 150 | #define __HAL_HCD_MASK_HALT_HC_INT(chnum) (USBx_HC(chnum)->HCINTMSK &= ~USB_OTG_HCINTMSK_CHHM) |
mbed_official | 235:685d5f11838f | 151 | #define __HAL_HCD_UNMASK_HALT_HC_INT(chnum) (USBx_HC(chnum)->HCINTMSK |= USB_OTG_HCINTMSK_CHHM) |
mbed_official | 235:685d5f11838f | 152 | #define __HAL_HCD_MASK_ACK_HC_INT(chnum) (USBx_HC(chnum)->HCINTMSK &= ~USB_OTG_HCINTMSK_ACKM) |
mbed_official | 235:685d5f11838f | 153 | #define __HAL_HCD_UNMASK_ACK_HC_INT(chnum) (USBx_HC(chnum)->HCINTMSK |= USB_OTG_HCINTMSK_ACKM) |
mbed_official | 235:685d5f11838f | 154 | |
mbed_official | 235:685d5f11838f | 155 | /** |
mbed_official | 235:685d5f11838f | 156 | * @} |
mbed_official | 235:685d5f11838f | 157 | */ |
mbed_official | 235:685d5f11838f | 158 | |
mbed_official | 235:685d5f11838f | 159 | /* Exported functions --------------------------------------------------------*/ |
mbed_official | 235:685d5f11838f | 160 | |
mbed_official | 235:685d5f11838f | 161 | /* Initialization/de-initialization functions **********************************/ |
mbed_official | 235:685d5f11838f | 162 | HAL_StatusTypeDef HAL_HCD_Init(HCD_HandleTypeDef *hhcd); |
mbed_official | 235:685d5f11838f | 163 | HAL_StatusTypeDef HAL_HCD_DeInit (HCD_HandleTypeDef *hhcd); |
mbed_official | 235:685d5f11838f | 164 | HAL_StatusTypeDef HAL_HCD_HC_Init(HCD_HandleTypeDef *hhcd, |
mbed_official | 235:685d5f11838f | 165 | uint8_t ch_num, |
mbed_official | 235:685d5f11838f | 166 | uint8_t epnum, |
mbed_official | 235:685d5f11838f | 167 | uint8_t dev_address, |
mbed_official | 235:685d5f11838f | 168 | uint8_t speed, |
mbed_official | 235:685d5f11838f | 169 | uint8_t ep_type, |
mbed_official | 235:685d5f11838f | 170 | uint16_t mps); |
mbed_official | 235:685d5f11838f | 171 | |
mbed_official | 235:685d5f11838f | 172 | HAL_StatusTypeDef HAL_HCD_HC_Halt(HCD_HandleTypeDef *hhcd, |
mbed_official | 235:685d5f11838f | 173 | uint8_t ch_num); |
mbed_official | 235:685d5f11838f | 174 | |
mbed_official | 235:685d5f11838f | 175 | void HAL_HCD_MspInit(HCD_HandleTypeDef *hhcd); |
mbed_official | 235:685d5f11838f | 176 | void HAL_HCD_MspDeInit(HCD_HandleTypeDef *hhcd); |
mbed_official | 235:685d5f11838f | 177 | |
mbed_official | 235:685d5f11838f | 178 | /* I/O operation functions *****************************************************/ |
mbed_official | 235:685d5f11838f | 179 | HAL_StatusTypeDef HAL_HCD_HC_SubmitRequest(HCD_HandleTypeDef *hhcd, |
mbed_official | 235:685d5f11838f | 180 | uint8_t pipe, |
mbed_official | 235:685d5f11838f | 181 | uint8_t direction , |
mbed_official | 235:685d5f11838f | 182 | uint8_t ep_type, |
mbed_official | 235:685d5f11838f | 183 | uint8_t token, |
mbed_official | 235:685d5f11838f | 184 | uint8_t* pbuff, |
mbed_official | 235:685d5f11838f | 185 | uint16_t length, |
mbed_official | 235:685d5f11838f | 186 | uint8_t do_ping); |
mbed_official | 235:685d5f11838f | 187 | |
mbed_official | 235:685d5f11838f | 188 | /* Non-Blocking mode: Interrupt */ |
mbed_official | 235:685d5f11838f | 189 | void HAL_HCD_IRQHandler(HCD_HandleTypeDef *hhcd); |
mbed_official | 235:685d5f11838f | 190 | void HAL_HCD_SOF_Callback(HCD_HandleTypeDef *hhcd); |
mbed_official | 235:685d5f11838f | 191 | void HAL_HCD_Connect_Callback(HCD_HandleTypeDef *hhcd); |
mbed_official | 235:685d5f11838f | 192 | void HAL_HCD_Disconnect_Callback(HCD_HandleTypeDef *hhcd); |
mbed_official | 235:685d5f11838f | 193 | void HAL_HCD_HC_NotifyURBChange_Callback(HCD_HandleTypeDef *hhcd, |
mbed_official | 235:685d5f11838f | 194 | uint8_t chnum, |
mbed_official | 235:685d5f11838f | 195 | HCD_URBStateTypeDef urb_state); |
mbed_official | 235:685d5f11838f | 196 | |
mbed_official | 235:685d5f11838f | 197 | /* Peripheral Control functions ************************************************/ |
mbed_official | 235:685d5f11838f | 198 | HAL_StatusTypeDef HAL_HCD_ResetPort(HCD_HandleTypeDef *hhcd); |
mbed_official | 235:685d5f11838f | 199 | HAL_StatusTypeDef HAL_HCD_Start(HCD_HandleTypeDef *hhcd); |
mbed_official | 235:685d5f11838f | 200 | HAL_StatusTypeDef HAL_HCD_Stop(HCD_HandleTypeDef *hhcd); |
mbed_official | 235:685d5f11838f | 201 | |
mbed_official | 235:685d5f11838f | 202 | /* Peripheral State functions **************************************************/ |
mbed_official | 235:685d5f11838f | 203 | HCD_StateTypeDef HAL_HCD_GetState(HCD_HandleTypeDef *hhcd); |
mbed_official | 235:685d5f11838f | 204 | HCD_URBStateTypeDef HAL_HCD_HC_GetURBState(HCD_HandleTypeDef *hhcd, uint8_t chnum); |
mbed_official | 235:685d5f11838f | 205 | uint32_t HAL_HCD_HC_GetXferCount(HCD_HandleTypeDef *hhcd, uint8_t chnum); |
mbed_official | 235:685d5f11838f | 206 | HCD_HCStateTypeDef HAL_HCD_HC_GetState(HCD_HandleTypeDef *hhcd, uint8_t chnum); |
mbed_official | 235:685d5f11838f | 207 | uint32_t HAL_HCD_GetCurrentFrame(HCD_HandleTypeDef *hhcd); |
mbed_official | 235:685d5f11838f | 208 | uint32_t HAL_HCD_GetCurrentSpeed(HCD_HandleTypeDef *hhcd); |
mbed_official | 235:685d5f11838f | 209 | |
mbed_official | 235:685d5f11838f | 210 | /** |
mbed_official | 235:685d5f11838f | 211 | * @} |
mbed_official | 235:685d5f11838f | 212 | */ |
mbed_official | 235:685d5f11838f | 213 | |
mbed_official | 235:685d5f11838f | 214 | /** |
mbed_official | 235:685d5f11838f | 215 | * @} |
mbed_official | 235:685d5f11838f | 216 | */ |
mbed_official | 235:685d5f11838f | 217 | |
mbed_official | 235:685d5f11838f | 218 | #ifdef __cplusplus |
mbed_official | 235:685d5f11838f | 219 | } |
mbed_official | 235:685d5f11838f | 220 | #endif |
mbed_official | 235:685d5f11838f | 221 | |
mbed_official | 235:685d5f11838f | 222 | #endif /* __STM32F4xx_HAL_HCD_H */ |
mbed_official | 235:685d5f11838f | 223 | |
mbed_official | 235:685d5f11838f | 224 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |