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_pcd.h@87:085cde657901, 2014-02-08 (annotated)
- Committer:
- mbed_official
- Date:
- Sat Feb 08 19:45:06 2014 +0000
- Revision:
- 87:085cde657901
- Child:
- 106:ced8cbb51063
Synchronized with git revision 9272cdeb45ec7e6077641536509413da8fd2ebc2
Full URL: https://github.com/mbedmicro/mbed/commit/9272cdeb45ec7e6077641536509413da8fd2ebc2/
Add NUCLEO_F401RE, improvements
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_pcd.h |
mbed_official | 87:085cde657901 | 4 | * @author MCD Application Team |
mbed_official | 87:085cde657901 | 5 | * @version V1.0.0RC2 |
mbed_official | 87:085cde657901 | 6 | * @date 04-February-2014 |
mbed_official | 87:085cde657901 | 7 | * @brief Header file of PCD 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_PCD_H |
mbed_official | 87:085cde657901 | 40 | #define __STM32F4xx_HAL_PCD_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 PCD |
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 PCD State structures definition |
mbed_official | 87:085cde657901 | 61 | */ |
mbed_official | 87:085cde657901 | 62 | typedef enum |
mbed_official | 87:085cde657901 | 63 | { |
mbed_official | 87:085cde657901 | 64 | PCD_READY = 0x00, |
mbed_official | 87:085cde657901 | 65 | PCD_ERROR = 0x01, |
mbed_official | 87:085cde657901 | 66 | PCD_BUSY = 0x02, |
mbed_official | 87:085cde657901 | 67 | PCD_TIMEOUT = 0x03 |
mbed_official | 87:085cde657901 | 68 | } PCD_StateTypeDef; |
mbed_official | 87:085cde657901 | 69 | |
mbed_official | 87:085cde657901 | 70 | |
mbed_official | 87:085cde657901 | 71 | typedef USB_OTG_GlobalTypeDef PCD_TypeDef; |
mbed_official | 87:085cde657901 | 72 | typedef USB_OTG_CfgTypeDef PCD_InitTypeDef; |
mbed_official | 87:085cde657901 | 73 | typedef USB_OTG_EPTypeDef PCD_EPTypeDef ; |
mbed_official | 87:085cde657901 | 74 | |
mbed_official | 87:085cde657901 | 75 | /** |
mbed_official | 87:085cde657901 | 76 | * @brief PCD Handle Structure definition |
mbed_official | 87:085cde657901 | 77 | */ |
mbed_official | 87:085cde657901 | 78 | typedef struct |
mbed_official | 87:085cde657901 | 79 | { |
mbed_official | 87:085cde657901 | 80 | PCD_TypeDef *Instance; /*!< Register base address */ |
mbed_official | 87:085cde657901 | 81 | PCD_InitTypeDef Init; /*!< PCD required parameters */ |
mbed_official | 87:085cde657901 | 82 | PCD_EPTypeDef IN_ep[15]; /*!< IN endpoint parameters */ |
mbed_official | 87:085cde657901 | 83 | PCD_EPTypeDef OUT_ep[15]; /*!< OUT endpoint parameters */ |
mbed_official | 87:085cde657901 | 84 | HAL_LockTypeDef Lock; /*!< PCD peripheral status */ |
mbed_official | 87:085cde657901 | 85 | __IO PCD_StateTypeDef State; /*!< PCD communication state */ |
mbed_official | 87:085cde657901 | 86 | uint32_t Setup[12]; /*!< Setup packet buffer */ |
mbed_official | 87:085cde657901 | 87 | void *pData; /*!< Pointer to upper stack Handler */ |
mbed_official | 87:085cde657901 | 88 | |
mbed_official | 87:085cde657901 | 89 | } PCD_HandleTypeDef; |
mbed_official | 87:085cde657901 | 90 | |
mbed_official | 87:085cde657901 | 91 | /* Exported constants --------------------------------------------------------*/ |
mbed_official | 87:085cde657901 | 92 | /** @defgroup PCD_Exported_Constants |
mbed_official | 87:085cde657901 | 93 | * @{ |
mbed_official | 87:085cde657901 | 94 | */ |
mbed_official | 87:085cde657901 | 95 | |
mbed_official | 87:085cde657901 | 96 | /** @defgroup PCD_Speed |
mbed_official | 87:085cde657901 | 97 | * @{ |
mbed_official | 87:085cde657901 | 98 | */ |
mbed_official | 87:085cde657901 | 99 | #define PCD_SPEED_HIGH 0 |
mbed_official | 87:085cde657901 | 100 | #define PCD_SPEED_HIGH_IN_FULL 1 |
mbed_official | 87:085cde657901 | 101 | #define PCD_SPEED_LOW 2 |
mbed_official | 87:085cde657901 | 102 | #define PCD_SPEED_FULL 3 |
mbed_official | 87:085cde657901 | 103 | /** |
mbed_official | 87:085cde657901 | 104 | * @} |
mbed_official | 87:085cde657901 | 105 | */ |
mbed_official | 87:085cde657901 | 106 | |
mbed_official | 87:085cde657901 | 107 | /** @defgroup PCD_PHY_Module |
mbed_official | 87:085cde657901 | 108 | * @{ |
mbed_official | 87:085cde657901 | 109 | */ |
mbed_official | 87:085cde657901 | 110 | #define PCD_PHY_ULPI 1 |
mbed_official | 87:085cde657901 | 111 | #define PCD_PHY_EMBEDDED 2 |
mbed_official | 87:085cde657901 | 112 | /** |
mbed_official | 87:085cde657901 | 113 | * @} |
mbed_official | 87:085cde657901 | 114 | */ |
mbed_official | 87:085cde657901 | 115 | |
mbed_official | 87:085cde657901 | 116 | /** @defgroup PCD_Instance_definition |
mbed_official | 87:085cde657901 | 117 | * @{ |
mbed_official | 87:085cde657901 | 118 | */ |
mbed_official | 87:085cde657901 | 119 | #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) || defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) |
mbed_official | 87:085cde657901 | 120 | #define IS_PCD_ALL_INSTANCE(INSTANCE) (((INSTANCE) == USB_OTG_FS) || \ |
mbed_official | 87:085cde657901 | 121 | ((INSTANCE) == USB_OTG_HS)) |
mbed_official | 87:085cde657901 | 122 | #elif defined(STM32F401xC) || defined(STM32F401xE) |
mbed_official | 87:085cde657901 | 123 | #define IS_PCD_ALL_INSTANCE(INSTANCE) (((INSTANCE) == USB_OTG_FS)) |
mbed_official | 87:085cde657901 | 124 | #endif |
mbed_official | 87:085cde657901 | 125 | |
mbed_official | 87:085cde657901 | 126 | /** |
mbed_official | 87:085cde657901 | 127 | * @} |
mbed_official | 87:085cde657901 | 128 | */ |
mbed_official | 87:085cde657901 | 129 | |
mbed_official | 87:085cde657901 | 130 | /** |
mbed_official | 87:085cde657901 | 131 | * @} |
mbed_official | 87:085cde657901 | 132 | */ |
mbed_official | 87:085cde657901 | 133 | |
mbed_official | 87:085cde657901 | 134 | /* Exported macro ------------------------------------------------------------*/ |
mbed_official | 87:085cde657901 | 135 | |
mbed_official | 87:085cde657901 | 136 | /** @defgroup PCD_Interrupt_Clock |
mbed_official | 87:085cde657901 | 137 | * @brief macros to handle interrupts and specific clock configurations |
mbed_official | 87:085cde657901 | 138 | * @{ |
mbed_official | 87:085cde657901 | 139 | */ |
mbed_official | 87:085cde657901 | 140 | #define __HAL_PCD_ENABLE(__HANDLE__) USB_EnableGlobalInt ((__HANDLE__)->Instance) |
mbed_official | 87:085cde657901 | 141 | #define __HAL_PCD_DISABLE(__HANDLE__) USB_DisableGlobalInt ((__HANDLE__)->Instance) |
mbed_official | 87:085cde657901 | 142 | |
mbed_official | 87:085cde657901 | 143 | #define __HAL_GET_FLAG(__HANDLE__, __INTERRUPT__) ((USB_ReadInterrupts((__HANDLE__)->Instance) & (__INTERRUPT__)) == (__INTERRUPT__)) |
mbed_official | 87:085cde657901 | 144 | #define __HAL_CLEAR_FLAG(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->GINTSTS) |= (__INTERRUPT__)) |
mbed_official | 87:085cde657901 | 145 | #define __HAL_IS_INVALID_INTERRUPT(__HANDLE__) (USB_ReadInterrupts((__HANDLE__)->Instance) == 0) |
mbed_official | 87:085cde657901 | 146 | /** |
mbed_official | 87:085cde657901 | 147 | * @} |
mbed_official | 87:085cde657901 | 148 | */ |
mbed_official | 87:085cde657901 | 149 | |
mbed_official | 87:085cde657901 | 150 | /* Exported functions --------------------------------------------------------*/ |
mbed_official | 87:085cde657901 | 151 | |
mbed_official | 87:085cde657901 | 152 | /* Initialization/de-initialization functions **********************************/ |
mbed_official | 87:085cde657901 | 153 | HAL_StatusTypeDef HAL_PCD_Init(PCD_HandleTypeDef *hpcd); |
mbed_official | 87:085cde657901 | 154 | HAL_StatusTypeDef HAL_PCD_DeInit (PCD_HandleTypeDef *hpcd); |
mbed_official | 87:085cde657901 | 155 | void HAL_PCD_MspInit(PCD_HandleTypeDef *hpcd); |
mbed_official | 87:085cde657901 | 156 | void HAL_PCD_MspDeInit(PCD_HandleTypeDef *hpcd); |
mbed_official | 87:085cde657901 | 157 | |
mbed_official | 87:085cde657901 | 158 | /* I/O operation functions *****************************************************/ |
mbed_official | 87:085cde657901 | 159 | /* Non-Blocking mode: Interrupt */ |
mbed_official | 87:085cde657901 | 160 | HAL_StatusTypeDef HAL_PCD_Start(PCD_HandleTypeDef *hpcd); |
mbed_official | 87:085cde657901 | 161 | HAL_StatusTypeDef HAL_PCD_Stop(PCD_HandleTypeDef *hpcd); |
mbed_official | 87:085cde657901 | 162 | void HAL_PCD_IRQHandler(PCD_HandleTypeDef *hpcd); |
mbed_official | 87:085cde657901 | 163 | |
mbed_official | 87:085cde657901 | 164 | __weak void HAL_PCD_DataOutStageCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum); |
mbed_official | 87:085cde657901 | 165 | __weak void HAL_PCD_DataInStageCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum); |
mbed_official | 87:085cde657901 | 166 | __weak void HAL_PCD_SetupStageCallback(PCD_HandleTypeDef *hpcd); |
mbed_official | 87:085cde657901 | 167 | __weak void HAL_PCD_SOFCallback(PCD_HandleTypeDef *hpcd); |
mbed_official | 87:085cde657901 | 168 | __weak void HAL_PCD_ResetCallback(PCD_HandleTypeDef *hpcd); |
mbed_official | 87:085cde657901 | 169 | __weak void HAL_PCD_SuspendCallback(PCD_HandleTypeDef *hpcd); |
mbed_official | 87:085cde657901 | 170 | __weak void HAL_PCD_ResumeCallback(PCD_HandleTypeDef *hpcd); |
mbed_official | 87:085cde657901 | 171 | __weak void HAL_PCD_ISOOUTIncompleteCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum); |
mbed_official | 87:085cde657901 | 172 | __weak void HAL_PCD_ISOINIncompleteCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum); |
mbed_official | 87:085cde657901 | 173 | __weak void HAL_PCD_ConnectCallback(PCD_HandleTypeDef *hpcd); |
mbed_official | 87:085cde657901 | 174 | __weak void HAL_PCD_DisconnectCallback(PCD_HandleTypeDef *hpcd); |
mbed_official | 87:085cde657901 | 175 | |
mbed_official | 87:085cde657901 | 176 | /* Peripheral Control functions ************************************************/ |
mbed_official | 87:085cde657901 | 177 | HAL_StatusTypeDef HAL_PCD_DevConnect(PCD_HandleTypeDef *hpcd); |
mbed_official | 87:085cde657901 | 178 | HAL_StatusTypeDef HAL_PCD_DevDisconnect(PCD_HandleTypeDef *hpcd); |
mbed_official | 87:085cde657901 | 179 | HAL_StatusTypeDef HAL_PCD_SetAddress(PCD_HandleTypeDef *hpcd, uint8_t address); |
mbed_official | 87:085cde657901 | 180 | HAL_StatusTypeDef HAL_PCD_EP_Open(PCD_HandleTypeDef *hpcd, uint8_t ep_addr, uint16_t ep_mps, uint8_t ep_type); |
mbed_official | 87:085cde657901 | 181 | HAL_StatusTypeDef HAL_PCD_EP_Close(PCD_HandleTypeDef *hpcd, uint8_t ep_addr); |
mbed_official | 87:085cde657901 | 182 | HAL_StatusTypeDef HAL_PCD_EP_Receive(PCD_HandleTypeDef *hpcd, uint8_t ep_addr, uint8_t *pBuf, uint32_t len); |
mbed_official | 87:085cde657901 | 183 | HAL_StatusTypeDef HAL_PCD_EP_Transmit(PCD_HandleTypeDef *hpcd, uint8_t ep_addr, uint8_t *pBuf, uint32_t len); |
mbed_official | 87:085cde657901 | 184 | uint16_t HAL_PCD_EP_GetRxCount(PCD_HandleTypeDef *hpcd, uint8_t ep_addr); |
mbed_official | 87:085cde657901 | 185 | HAL_StatusTypeDef HAL_PCD_EP_SetStall(PCD_HandleTypeDef *hpcd, uint8_t ep_addr); |
mbed_official | 87:085cde657901 | 186 | HAL_StatusTypeDef HAL_PCD_EP_ClrStall(PCD_HandleTypeDef *hpcd, uint8_t ep_addr); |
mbed_official | 87:085cde657901 | 187 | HAL_StatusTypeDef HAL_PCD_EP_Flush(PCD_HandleTypeDef *hpcd, uint8_t ep_addr); |
mbed_official | 87:085cde657901 | 188 | HAL_StatusTypeDef HAL_PCD_SetTxFiFo(PCD_HandleTypeDef *hpcd, uint8_t fifo, uint16_t size); |
mbed_official | 87:085cde657901 | 189 | HAL_StatusTypeDef HAL_PCD_SetRxFiFo(PCD_HandleTypeDef *hpcd, uint16_t size); |
mbed_official | 87:085cde657901 | 190 | |
mbed_official | 87:085cde657901 | 191 | /* Peripheral State functions **************************************************/ |
mbed_official | 87:085cde657901 | 192 | PCD_StateTypeDef HAL_PCD_GetState(PCD_HandleTypeDef *hpcd); |
mbed_official | 87:085cde657901 | 193 | |
mbed_official | 87:085cde657901 | 194 | /** |
mbed_official | 87:085cde657901 | 195 | * @} |
mbed_official | 87:085cde657901 | 196 | */ |
mbed_official | 87:085cde657901 | 197 | |
mbed_official | 87:085cde657901 | 198 | /** |
mbed_official | 87:085cde657901 | 199 | * @} |
mbed_official | 87:085cde657901 | 200 | */ |
mbed_official | 87:085cde657901 | 201 | |
mbed_official | 87:085cde657901 | 202 | #ifdef __cplusplus |
mbed_official | 87:085cde657901 | 203 | } |
mbed_official | 87:085cde657901 | 204 | #endif |
mbed_official | 87:085cde657901 | 205 | |
mbed_official | 87:085cde657901 | 206 | |
mbed_official | 87:085cde657901 | 207 | #endif /* __STM32F4xx_HAL_PCD_H */ |
mbed_official | 87:085cde657901 | 208 | |
mbed_official | 87:085cde657901 | 209 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |