meh

Fork of mbed by mbed official

Committer:
Kojto
Date:
Wed Sep 02 14:17:43 2015 +0100
Revision:
106:ba1f97679dad
Parent:
99:dbbf35b96557
Child:
110:165afa46840b
Release 106  of the mbed library

Changes:
- new platform - Nucleo F446RE
- STM32F4 Cube driver update v2.3.2
- ST cmsis driver v2.3.2
- nordic bugfix gcc linker start address
- lpc11u68 - bugfix for serial ports

Who changed what in which revision?

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