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