Fork of the official mbed C/C SDK provides the software platform and libraries to build your applications for RenBED.

Dependents:   1-RenBuggyTimed RenBED_RGB RenBED_RGB_PWM RenBED_RGB

Fork of mbed by mbed official

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