mbed library sources
Dependents: frdm_kl05z_gpio_test
Fork of mbed-src by
targets/cmsis/TARGET_STM/TARGET_NUCLEO_F411RE/stm32f4xx_ll_usb.h@323:9e901b0a5aa1, 2014-09-13 (annotated)
- Committer:
- shaoziyang
- Date:
- Sat Sep 13 14:25:46 2014 +0000
- Revision:
- 323:9e901b0a5aa1
- Parent:
- 235:685d5f11838f
test with CLOCK_SETUP = 0
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_ll_usb.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 USB Core 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_LL_USB_H |
mbed_official | 235:685d5f11838f | 40 | #define __STM32F4xx_LL_USB_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_hal_def.h" |
mbed_official | 235:685d5f11838f | 48 | |
mbed_official | 235:685d5f11838f | 49 | /** @addtogroup STM32F4xx_HAL |
mbed_official | 235:685d5f11838f | 50 | * @{ |
mbed_official | 235:685d5f11838f | 51 | */ |
mbed_official | 235:685d5f11838f | 52 | |
mbed_official | 235:685d5f11838f | 53 | /** @addtogroup USB_Core |
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 USB Mode definition |
mbed_official | 235:685d5f11838f | 61 | */ |
mbed_official | 235:685d5f11838f | 62 | typedef enum |
mbed_official | 235:685d5f11838f | 63 | { |
mbed_official | 235:685d5f11838f | 64 | USB_OTG_DEVICE_MODE = 0, |
mbed_official | 235:685d5f11838f | 65 | USB_OTG_HOST_MODE = 1, |
mbed_official | 235:685d5f11838f | 66 | USB_OTG_DRD_MODE = 2 |
mbed_official | 235:685d5f11838f | 67 | |
mbed_official | 235:685d5f11838f | 68 | }USB_OTG_ModeTypeDef; |
mbed_official | 235:685d5f11838f | 69 | |
mbed_official | 235:685d5f11838f | 70 | /** |
mbed_official | 235:685d5f11838f | 71 | * @brief URB States definition |
mbed_official | 235:685d5f11838f | 72 | */ |
mbed_official | 235:685d5f11838f | 73 | typedef enum { |
mbed_official | 235:685d5f11838f | 74 | URB_IDLE = 0, |
mbed_official | 235:685d5f11838f | 75 | URB_DONE, |
mbed_official | 235:685d5f11838f | 76 | URB_NOTREADY, |
mbed_official | 235:685d5f11838f | 77 | URB_NYET, |
mbed_official | 235:685d5f11838f | 78 | URB_ERROR, |
mbed_official | 235:685d5f11838f | 79 | URB_STALL |
mbed_official | 235:685d5f11838f | 80 | |
mbed_official | 235:685d5f11838f | 81 | }USB_OTG_URBStateTypeDef; |
mbed_official | 235:685d5f11838f | 82 | |
mbed_official | 235:685d5f11838f | 83 | /** |
mbed_official | 235:685d5f11838f | 84 | * @brief Host channel States definition |
mbed_official | 235:685d5f11838f | 85 | */ |
mbed_official | 235:685d5f11838f | 86 | typedef enum { |
mbed_official | 235:685d5f11838f | 87 | HC_IDLE = 0, |
mbed_official | 235:685d5f11838f | 88 | HC_XFRC, |
mbed_official | 235:685d5f11838f | 89 | HC_HALTED, |
mbed_official | 235:685d5f11838f | 90 | HC_NAK, |
mbed_official | 235:685d5f11838f | 91 | HC_NYET, |
mbed_official | 235:685d5f11838f | 92 | HC_STALL, |
mbed_official | 235:685d5f11838f | 93 | HC_XACTERR, |
mbed_official | 235:685d5f11838f | 94 | HC_BBLERR, |
mbed_official | 235:685d5f11838f | 95 | HC_DATATGLERR |
mbed_official | 235:685d5f11838f | 96 | |
mbed_official | 235:685d5f11838f | 97 | }USB_OTG_HCStateTypeDef; |
mbed_official | 235:685d5f11838f | 98 | |
mbed_official | 235:685d5f11838f | 99 | /** |
mbed_official | 235:685d5f11838f | 100 | * @brief PCD Initialization Structure definition |
mbed_official | 235:685d5f11838f | 101 | */ |
mbed_official | 235:685d5f11838f | 102 | typedef struct |
mbed_official | 235:685d5f11838f | 103 | { |
mbed_official | 235:685d5f11838f | 104 | uint32_t dev_endpoints; /*!< Device Endpoints number. |
mbed_official | 235:685d5f11838f | 105 | This parameter depends on the used USB core. |
mbed_official | 235:685d5f11838f | 106 | This parameter must be a number between Min_Data = 1 and Max_Data = 15 */ |
mbed_official | 235:685d5f11838f | 107 | |
mbed_official | 235:685d5f11838f | 108 | uint32_t Host_channels; /*!< Host Channels number. |
mbed_official | 235:685d5f11838f | 109 | This parameter Depends on the used USB core. |
mbed_official | 235:685d5f11838f | 110 | This parameter must be a number between Min_Data = 1 and Max_Data = 15 */ |
mbed_official | 235:685d5f11838f | 111 | |
mbed_official | 235:685d5f11838f | 112 | uint32_t speed; /*!< USB Core speed. |
mbed_official | 235:685d5f11838f | 113 | This parameter can be any value of @ref USB_Core_Speed_ */ |
mbed_official | 235:685d5f11838f | 114 | |
mbed_official | 235:685d5f11838f | 115 | uint32_t dma_enable; /*!< Enable or disable of the USB embedded DMA. */ |
mbed_official | 235:685d5f11838f | 116 | |
mbed_official | 235:685d5f11838f | 117 | uint32_t ep0_mps; /*!< Set the Endpoint 0 Max Packet size. |
mbed_official | 235:685d5f11838f | 118 | This parameter can be any value of @ref USB_EP0_MPS_ */ |
mbed_official | 235:685d5f11838f | 119 | |
mbed_official | 235:685d5f11838f | 120 | uint32_t phy_itface; /*!< Select the used PHY interface. |
mbed_official | 235:685d5f11838f | 121 | This parameter can be any value of @ref USB_Core_PHY_ */ |
mbed_official | 235:685d5f11838f | 122 | |
mbed_official | 235:685d5f11838f | 123 | uint32_t Sof_enable; /*!< Enable or disable the output of the SOF signal. */ |
mbed_official | 235:685d5f11838f | 124 | |
mbed_official | 235:685d5f11838f | 125 | uint32_t low_power_enable; /*!< Enable or disable the low power mode. */ |
mbed_official | 235:685d5f11838f | 126 | |
mbed_official | 235:685d5f11838f | 127 | uint32_t vbus_sensing_enable; /*!< Enable or disable the VBUS Sensing feature. */ |
mbed_official | 235:685d5f11838f | 128 | |
mbed_official | 235:685d5f11838f | 129 | uint32_t use_dedicated_ep1; /*!< Enable or disable the use of the dedicated EP1 interrupt. */ |
mbed_official | 235:685d5f11838f | 130 | |
mbed_official | 235:685d5f11838f | 131 | uint32_t use_external_vbus; /*!< Enable or disable the use of the external VBUS. */ |
mbed_official | 235:685d5f11838f | 132 | |
mbed_official | 235:685d5f11838f | 133 | }USB_OTG_CfgTypeDef; |
mbed_official | 235:685d5f11838f | 134 | |
mbed_official | 235:685d5f11838f | 135 | typedef struct |
mbed_official | 235:685d5f11838f | 136 | { |
mbed_official | 235:685d5f11838f | 137 | uint8_t num; /*!< Endpoint number |
mbed_official | 235:685d5f11838f | 138 | This parameter must be a number between Min_Data = 1 and Max_Data = 15 */ |
mbed_official | 235:685d5f11838f | 139 | |
mbed_official | 235:685d5f11838f | 140 | uint8_t is_in; /*!< Endpoint direction |
mbed_official | 235:685d5f11838f | 141 | This parameter must be a number between Min_Data = 0 and Max_Data = 1 */ |
mbed_official | 235:685d5f11838f | 142 | |
mbed_official | 235:685d5f11838f | 143 | uint8_t is_stall; /*!< Endpoint stall condition |
mbed_official | 235:685d5f11838f | 144 | This parameter must be a number between Min_Data = 0 and Max_Data = 1 */ |
mbed_official | 235:685d5f11838f | 145 | |
mbed_official | 235:685d5f11838f | 146 | uint8_t type; /*!< Endpoint type |
mbed_official | 235:685d5f11838f | 147 | This parameter can be any value of @ref USB_EP_Type_ */ |
mbed_official | 235:685d5f11838f | 148 | |
mbed_official | 235:685d5f11838f | 149 | uint8_t data_pid_start; /*!< Initial data PID |
mbed_official | 235:685d5f11838f | 150 | This parameter must be a number between Min_Data = 0 and Max_Data = 1 */ |
mbed_official | 235:685d5f11838f | 151 | |
mbed_official | 235:685d5f11838f | 152 | uint8_t even_odd_frame; /*!< IFrame parity |
mbed_official | 235:685d5f11838f | 153 | This parameter must be a number between Min_Data = 0 and Max_Data = 1 */ |
mbed_official | 235:685d5f11838f | 154 | |
mbed_official | 235:685d5f11838f | 155 | uint16_t tx_fifo_num; /*!< Transmission FIFO number |
mbed_official | 235:685d5f11838f | 156 | This parameter must be a number between Min_Data = 1 and Max_Data = 15 */ |
mbed_official | 235:685d5f11838f | 157 | |
mbed_official | 235:685d5f11838f | 158 | uint32_t maxpacket; /*!< Endpoint Max packet size |
mbed_official | 235:685d5f11838f | 159 | This parameter must be a number between Min_Data = 0 and Max_Data = 64KB */ |
mbed_official | 235:685d5f11838f | 160 | |
mbed_official | 235:685d5f11838f | 161 | uint8_t *xfer_buff; /*!< Pointer to transfer buffer */ |
mbed_official | 235:685d5f11838f | 162 | |
mbed_official | 235:685d5f11838f | 163 | uint32_t dma_addr; /*!< 32 bits aligned transfer buffer address */ |
mbed_official | 235:685d5f11838f | 164 | |
mbed_official | 235:685d5f11838f | 165 | uint32_t xfer_len; /*!< Current transfer length */ |
mbed_official | 235:685d5f11838f | 166 | |
mbed_official | 235:685d5f11838f | 167 | uint32_t xfer_count; /*!< Partial transfer length in case of multi packet transfer */ |
mbed_official | 235:685d5f11838f | 168 | |
mbed_official | 235:685d5f11838f | 169 | }USB_OTG_EPTypeDef; |
mbed_official | 235:685d5f11838f | 170 | |
mbed_official | 235:685d5f11838f | 171 | typedef struct |
mbed_official | 235:685d5f11838f | 172 | { |
mbed_official | 235:685d5f11838f | 173 | uint8_t dev_addr ; /*!< USB device address. |
mbed_official | 235:685d5f11838f | 174 | This parameter must be a number between Min_Data = 1 and Max_Data = 255 */ |
mbed_official | 235:685d5f11838f | 175 | |
mbed_official | 235:685d5f11838f | 176 | uint8_t ch_num; /*!< Host channel number. |
mbed_official | 235:685d5f11838f | 177 | This parameter must be a number between Min_Data = 1 and Max_Data = 15 */ |
mbed_official | 235:685d5f11838f | 178 | |
mbed_official | 235:685d5f11838f | 179 | uint8_t ep_num; /*!< Endpoint number. |
mbed_official | 235:685d5f11838f | 180 | This parameter must be a number between Min_Data = 1 and Max_Data = 15 */ |
mbed_official | 235:685d5f11838f | 181 | |
mbed_official | 235:685d5f11838f | 182 | uint8_t ep_is_in; /*!< Endpoint direction |
mbed_official | 235:685d5f11838f | 183 | This parameter must be a number between Min_Data = 0 and Max_Data = 1 */ |
mbed_official | 235:685d5f11838f | 184 | |
mbed_official | 235:685d5f11838f | 185 | uint8_t speed; /*!< USB Host speed. |
mbed_official | 235:685d5f11838f | 186 | This parameter can be any value of @ref USB_Core_Speed_ */ |
mbed_official | 235:685d5f11838f | 187 | |
mbed_official | 235:685d5f11838f | 188 | uint8_t do_ping; /*!< Enable or disable the use of the PING protocol for HS mode. */ |
mbed_official | 235:685d5f11838f | 189 | |
mbed_official | 235:685d5f11838f | 190 | uint8_t process_ping; /*!< Execute the PING protocol for HS mode. */ |
mbed_official | 235:685d5f11838f | 191 | |
mbed_official | 235:685d5f11838f | 192 | uint8_t ep_type; /*!< Endpoint Type. |
mbed_official | 235:685d5f11838f | 193 | This parameter can be any value of @ref USB_EP_Type_ */ |
mbed_official | 235:685d5f11838f | 194 | |
mbed_official | 235:685d5f11838f | 195 | uint16_t max_packet; /*!< Endpoint Max packet size. |
mbed_official | 235:685d5f11838f | 196 | This parameter must be a number between Min_Data = 0 and Max_Data = 64KB */ |
mbed_official | 235:685d5f11838f | 197 | |
mbed_official | 235:685d5f11838f | 198 | uint8_t data_pid; /*!< Initial data PID. |
mbed_official | 235:685d5f11838f | 199 | This parameter must be a number between Min_Data = 0 and Max_Data = 1 */ |
mbed_official | 235:685d5f11838f | 200 | |
mbed_official | 235:685d5f11838f | 201 | uint8_t *xfer_buff; /*!< Pointer to transfer buffer. */ |
mbed_official | 235:685d5f11838f | 202 | |
mbed_official | 235:685d5f11838f | 203 | uint32_t xfer_len; /*!< Current transfer length. */ |
mbed_official | 235:685d5f11838f | 204 | |
mbed_official | 235:685d5f11838f | 205 | uint32_t xfer_count; /*!< Partial transfer length in case of multi packet transfer. */ |
mbed_official | 235:685d5f11838f | 206 | |
mbed_official | 235:685d5f11838f | 207 | uint8_t toggle_in; /*!< IN transfer current toggle flag. |
mbed_official | 235:685d5f11838f | 208 | This parameter must be a number between Min_Data = 0 and Max_Data = 1 */ |
mbed_official | 235:685d5f11838f | 209 | |
mbed_official | 235:685d5f11838f | 210 | uint8_t toggle_out; /*!< OUT transfer current toggle flag |
mbed_official | 235:685d5f11838f | 211 | This parameter must be a number between Min_Data = 0 and Max_Data = 1 */ |
mbed_official | 235:685d5f11838f | 212 | |
mbed_official | 235:685d5f11838f | 213 | uint32_t dma_addr; /*!< 32 bits aligned transfer buffer address. */ |
mbed_official | 235:685d5f11838f | 214 | |
mbed_official | 235:685d5f11838f | 215 | uint32_t ErrCnt; /*!< Host channel error count.*/ |
mbed_official | 235:685d5f11838f | 216 | |
mbed_official | 235:685d5f11838f | 217 | USB_OTG_URBStateTypeDef urb_state; /*!< URB state. |
mbed_official | 235:685d5f11838f | 218 | This parameter can be any value of @ref USB_OTG_URBStateTypeDef */ |
mbed_official | 235:685d5f11838f | 219 | |
mbed_official | 235:685d5f11838f | 220 | USB_OTG_HCStateTypeDef state; /*!< Host Channel state. |
mbed_official | 235:685d5f11838f | 221 | This parameter can be any value of @ref USB_OTG_HCStateTypeDef */ |
mbed_official | 235:685d5f11838f | 222 | |
mbed_official | 235:685d5f11838f | 223 | }USB_OTG_HCTypeDef; |
mbed_official | 235:685d5f11838f | 224 | |
mbed_official | 235:685d5f11838f | 225 | /* Exported constants --------------------------------------------------------*/ |
mbed_official | 235:685d5f11838f | 226 | |
mbed_official | 235:685d5f11838f | 227 | /** @defgroup PCD_Exported_Constants |
mbed_official | 235:685d5f11838f | 228 | * @{ |
mbed_official | 235:685d5f11838f | 229 | */ |
mbed_official | 235:685d5f11838f | 230 | |
mbed_official | 235:685d5f11838f | 231 | /** @defgroup USB_Core_Mode_ |
mbed_official | 235:685d5f11838f | 232 | * @{ |
mbed_official | 235:685d5f11838f | 233 | */ |
mbed_official | 235:685d5f11838f | 234 | #define USB_OTG_MODE_DEVICE 0 |
mbed_official | 235:685d5f11838f | 235 | #define USB_OTG_MODE_HOST 1 |
mbed_official | 235:685d5f11838f | 236 | #define USB_OTG_MODE_DRD 2 |
mbed_official | 235:685d5f11838f | 237 | /** |
mbed_official | 235:685d5f11838f | 238 | * @} |
mbed_official | 235:685d5f11838f | 239 | */ |
mbed_official | 235:685d5f11838f | 240 | |
mbed_official | 235:685d5f11838f | 241 | /** @defgroup USB_Core_Speed_ |
mbed_official | 235:685d5f11838f | 242 | * @{ |
mbed_official | 235:685d5f11838f | 243 | */ |
mbed_official | 235:685d5f11838f | 244 | #define USB_OTG_SPEED_HIGH 0 |
mbed_official | 235:685d5f11838f | 245 | #define USB_OTG_SPEED_HIGH_IN_FULL 1 |
mbed_official | 235:685d5f11838f | 246 | #define USB_OTG_SPEED_LOW 2 |
mbed_official | 235:685d5f11838f | 247 | #define USB_OTG_SPEED_FULL 3 |
mbed_official | 235:685d5f11838f | 248 | /** |
mbed_official | 235:685d5f11838f | 249 | * @} |
mbed_official | 235:685d5f11838f | 250 | */ |
mbed_official | 235:685d5f11838f | 251 | |
mbed_official | 235:685d5f11838f | 252 | /** @defgroup USB_Core_PHY_ |
mbed_official | 235:685d5f11838f | 253 | * @{ |
mbed_official | 235:685d5f11838f | 254 | */ |
mbed_official | 235:685d5f11838f | 255 | #define USB_OTG_ULPI_PHY 1 |
mbed_official | 235:685d5f11838f | 256 | #define USB_OTG_EMBEDDED_PHY 2 |
mbed_official | 235:685d5f11838f | 257 | /** |
mbed_official | 235:685d5f11838f | 258 | * @} |
mbed_official | 235:685d5f11838f | 259 | */ |
mbed_official | 235:685d5f11838f | 260 | |
mbed_official | 235:685d5f11838f | 261 | /** @defgroup USB_Core_MPS_ |
mbed_official | 235:685d5f11838f | 262 | * @{ |
mbed_official | 235:685d5f11838f | 263 | */ |
mbed_official | 235:685d5f11838f | 264 | #define USB_OTG_HS_MAX_PACKET_SIZE 512 |
mbed_official | 235:685d5f11838f | 265 | #define USB_OTG_FS_MAX_PACKET_SIZE 64 |
mbed_official | 235:685d5f11838f | 266 | #define USB_OTG_MAX_EP0_SIZE 64 |
mbed_official | 235:685d5f11838f | 267 | /** |
mbed_official | 235:685d5f11838f | 268 | * @} |
mbed_official | 235:685d5f11838f | 269 | */ |
mbed_official | 235:685d5f11838f | 270 | |
mbed_official | 235:685d5f11838f | 271 | /** @defgroup USB_Core_Phy_Frequency_ |
mbed_official | 235:685d5f11838f | 272 | * @{ |
mbed_official | 235:685d5f11838f | 273 | */ |
mbed_official | 235:685d5f11838f | 274 | #define DSTS_ENUMSPD_HS_PHY_30MHZ_OR_60MHZ (0 << 1) |
mbed_official | 235:685d5f11838f | 275 | #define DSTS_ENUMSPD_FS_PHY_30MHZ_OR_60MHZ (1 << 1) |
mbed_official | 235:685d5f11838f | 276 | #define DSTS_ENUMSPD_LS_PHY_6MHZ (2 << 1) |
mbed_official | 235:685d5f11838f | 277 | #define DSTS_ENUMSPD_FS_PHY_48MHZ (3 << 1) |
mbed_official | 235:685d5f11838f | 278 | /** |
mbed_official | 235:685d5f11838f | 279 | * @} |
mbed_official | 235:685d5f11838f | 280 | */ |
mbed_official | 235:685d5f11838f | 281 | |
mbed_official | 235:685d5f11838f | 282 | /** @defgroup USB_CORE_Frame_Interval_ |
mbed_official | 235:685d5f11838f | 283 | * @{ |
mbed_official | 235:685d5f11838f | 284 | */ |
mbed_official | 235:685d5f11838f | 285 | #define DCFG_FRAME_INTERVAL_80 0 |
mbed_official | 235:685d5f11838f | 286 | #define DCFG_FRAME_INTERVAL_85 1 |
mbed_official | 235:685d5f11838f | 287 | #define DCFG_FRAME_INTERVAL_90 2 |
mbed_official | 235:685d5f11838f | 288 | #define DCFG_FRAME_INTERVAL_95 3 |
mbed_official | 235:685d5f11838f | 289 | /** |
mbed_official | 235:685d5f11838f | 290 | * @} |
mbed_official | 235:685d5f11838f | 291 | */ |
mbed_official | 235:685d5f11838f | 292 | |
mbed_official | 235:685d5f11838f | 293 | /** @defgroup USB_EP0_MPS_ |
mbed_official | 235:685d5f11838f | 294 | * @{ |
mbed_official | 235:685d5f11838f | 295 | */ |
mbed_official | 235:685d5f11838f | 296 | #define DEP0CTL_MPS_64 0 |
mbed_official | 235:685d5f11838f | 297 | #define DEP0CTL_MPS_32 1 |
mbed_official | 235:685d5f11838f | 298 | #define DEP0CTL_MPS_16 2 |
mbed_official | 235:685d5f11838f | 299 | #define DEP0CTL_MPS_8 3 |
mbed_official | 235:685d5f11838f | 300 | /** |
mbed_official | 235:685d5f11838f | 301 | * @} |
mbed_official | 235:685d5f11838f | 302 | */ |
mbed_official | 235:685d5f11838f | 303 | |
mbed_official | 235:685d5f11838f | 304 | /** @defgroup USB_EP_Speed_ |
mbed_official | 235:685d5f11838f | 305 | * @{ |
mbed_official | 235:685d5f11838f | 306 | */ |
mbed_official | 235:685d5f11838f | 307 | #define EP_SPEED_LOW 0 |
mbed_official | 235:685d5f11838f | 308 | #define EP_SPEED_FULL 1 |
mbed_official | 235:685d5f11838f | 309 | #define EP_SPEED_HIGH 2 |
mbed_official | 235:685d5f11838f | 310 | /** |
mbed_official | 235:685d5f11838f | 311 | * @} |
mbed_official | 235:685d5f11838f | 312 | */ |
mbed_official | 235:685d5f11838f | 313 | |
mbed_official | 235:685d5f11838f | 314 | /** @defgroup USB_EP_Type_ |
mbed_official | 235:685d5f11838f | 315 | * @{ |
mbed_official | 235:685d5f11838f | 316 | */ |
mbed_official | 235:685d5f11838f | 317 | #define EP_TYPE_CTRL 0 |
mbed_official | 235:685d5f11838f | 318 | #define EP_TYPE_ISOC 1 |
mbed_official | 235:685d5f11838f | 319 | #define EP_TYPE_BULK 2 |
mbed_official | 235:685d5f11838f | 320 | #define EP_TYPE_INTR 3 |
mbed_official | 235:685d5f11838f | 321 | #define EP_TYPE_MSK 3 |
mbed_official | 235:685d5f11838f | 322 | /** |
mbed_official | 235:685d5f11838f | 323 | * @} |
mbed_official | 235:685d5f11838f | 324 | */ |
mbed_official | 235:685d5f11838f | 325 | |
mbed_official | 235:685d5f11838f | 326 | /** @defgroup USB_STS_Defines_ |
mbed_official | 235:685d5f11838f | 327 | * @{ |
mbed_official | 235:685d5f11838f | 328 | */ |
mbed_official | 235:685d5f11838f | 329 | #define STS_GOUT_NAK 1 |
mbed_official | 235:685d5f11838f | 330 | #define STS_DATA_UPDT 2 |
mbed_official | 235:685d5f11838f | 331 | #define STS_XFER_COMP 3 |
mbed_official | 235:685d5f11838f | 332 | #define STS_SETUP_COMP 4 |
mbed_official | 235:685d5f11838f | 333 | #define STS_SETUP_UPDT 6 |
mbed_official | 235:685d5f11838f | 334 | /** |
mbed_official | 235:685d5f11838f | 335 | * @} |
mbed_official | 235:685d5f11838f | 336 | */ |
mbed_official | 235:685d5f11838f | 337 | |
mbed_official | 235:685d5f11838f | 338 | /** @defgroup HCFG_SPEED_Defines_ |
mbed_official | 235:685d5f11838f | 339 | * @{ |
mbed_official | 235:685d5f11838f | 340 | */ |
mbed_official | 235:685d5f11838f | 341 | #define HCFG_30_60_MHZ 0 |
mbed_official | 235:685d5f11838f | 342 | #define HCFG_48_MHZ 1 |
mbed_official | 235:685d5f11838f | 343 | #define HCFG_6_MHZ 2 |
mbed_official | 235:685d5f11838f | 344 | /** |
mbed_official | 235:685d5f11838f | 345 | * @} |
mbed_official | 235:685d5f11838f | 346 | */ |
mbed_official | 235:685d5f11838f | 347 | |
mbed_official | 235:685d5f11838f | 348 | /** @defgroup HPRT0_PRTSPD_SPEED_Defines_ |
mbed_official | 235:685d5f11838f | 349 | * @{ |
mbed_official | 235:685d5f11838f | 350 | */ |
mbed_official | 235:685d5f11838f | 351 | #define HPRT0_PRTSPD_HIGH_SPEED 0 |
mbed_official | 235:685d5f11838f | 352 | #define HPRT0_PRTSPD_FULL_SPEED 1 |
mbed_official | 235:685d5f11838f | 353 | #define HPRT0_PRTSPD_LOW_SPEED 2 |
mbed_official | 235:685d5f11838f | 354 | /** |
mbed_official | 235:685d5f11838f | 355 | * @} |
mbed_official | 235:685d5f11838f | 356 | */ |
mbed_official | 235:685d5f11838f | 357 | |
mbed_official | 235:685d5f11838f | 358 | #define HCCHAR_CTRL 0 |
mbed_official | 235:685d5f11838f | 359 | #define HCCHAR_ISOC 1 |
mbed_official | 235:685d5f11838f | 360 | #define HCCHAR_BULK 2 |
mbed_official | 235:685d5f11838f | 361 | #define HCCHAR_INTR 3 |
mbed_official | 235:685d5f11838f | 362 | |
mbed_official | 235:685d5f11838f | 363 | #define HC_PID_DATA0 0 |
mbed_official | 235:685d5f11838f | 364 | #define HC_PID_DATA2 1 |
mbed_official | 235:685d5f11838f | 365 | #define HC_PID_DATA1 2 |
mbed_official | 235:685d5f11838f | 366 | #define HC_PID_SETUP 3 |
mbed_official | 235:685d5f11838f | 367 | |
mbed_official | 235:685d5f11838f | 368 | #define GRXSTS_PKTSTS_IN 2 |
mbed_official | 235:685d5f11838f | 369 | #define GRXSTS_PKTSTS_IN_XFER_COMP 3 |
mbed_official | 235:685d5f11838f | 370 | #define GRXSTS_PKTSTS_DATA_TOGGLE_ERR 5 |
mbed_official | 235:685d5f11838f | 371 | #define GRXSTS_PKTSTS_CH_HALTED 7 |
mbed_official | 235:685d5f11838f | 372 | |
mbed_official | 235:685d5f11838f | 373 | #define USBx_PCGCCTL *(__IO uint32_t *)((uint32_t)USBx + USB_OTG_PCGCCTL_BASE) |
mbed_official | 235:685d5f11838f | 374 | #define USBx_HPRT0 *(__IO uint32_t *)((uint32_t)USBx + USB_OTG_HOST_PORT_BASE) |
mbed_official | 235:685d5f11838f | 375 | |
mbed_official | 235:685d5f11838f | 376 | #define USBx_DEVICE ((USB_OTG_DeviceTypeDef *)((uint32_t )USBx + USB_OTG_DEVICE_BASE)) |
mbed_official | 235:685d5f11838f | 377 | #define USBx_INEP(i) ((USB_OTG_INEndpointTypeDef *)((uint32_t)USBx + USB_OTG_IN_ENDPOINT_BASE + (i)*USB_OTG_EP_REG_SIZE)) |
mbed_official | 235:685d5f11838f | 378 | #define USBx_OUTEP(i) ((USB_OTG_OUTEndpointTypeDef *)((uint32_t)USBx + USB_OTG_OUT_ENDPOINT_BASE + (i)*USB_OTG_EP_REG_SIZE)) |
mbed_official | 235:685d5f11838f | 379 | #define USBx_DFIFO(i) *(__IO uint32_t *)((uint32_t)USBx + USB_OTG_FIFO_BASE + (i) * USB_OTG_FIFO_SIZE) |
mbed_official | 235:685d5f11838f | 380 | |
mbed_official | 235:685d5f11838f | 381 | #define USBx_HOST ((USB_OTG_HostTypeDef *)((uint32_t )USBx + USB_OTG_HOST_BASE)) |
mbed_official | 235:685d5f11838f | 382 | #define USBx_HC(i) ((USB_OTG_HostChannelTypeDef *)((uint32_t)USBx + USB_OTG_HOST_CHANNEL_BASE + (i)*USB_OTG_HOST_CHANNEL_SIZE)) |
mbed_official | 235:685d5f11838f | 383 | |
mbed_official | 235:685d5f11838f | 384 | /* Exported macro ------------------------------------------------------------*/ |
mbed_official | 235:685d5f11838f | 385 | #define USB_MASK_INTERRUPT(__INSTANCE__, __INTERRUPT__) ((__INSTANCE__)->GINTMSK &= ~(__INTERRUPT__)) |
mbed_official | 235:685d5f11838f | 386 | #define USB_UNMASK_INTERRUPT(__INSTANCE__, __INTERRUPT__) ((__INSTANCE__)->GINTMSK |= (__INTERRUPT__)) |
mbed_official | 235:685d5f11838f | 387 | |
mbed_official | 235:685d5f11838f | 388 | #define CLEAR_IN_EP_INTR(__EPNUM__, __INTERRUPT__) (USBx_INEP(__EPNUM__)->DIEPINT = (__INTERRUPT__)) |
mbed_official | 235:685d5f11838f | 389 | #define CLEAR_OUT_EP_INTR(__EPNUM__, __INTERRUPT__) (USBx_OUTEP(__EPNUM__)->DOEPINT = (__INTERRUPT__)) |
mbed_official | 235:685d5f11838f | 390 | |
mbed_official | 235:685d5f11838f | 391 | /* Exported functions --------------------------------------------------------*/ |
mbed_official | 235:685d5f11838f | 392 | HAL_StatusTypeDef USB_CoreInit(USB_OTG_GlobalTypeDef *USBx, USB_OTG_CfgTypeDef Init); |
mbed_official | 235:685d5f11838f | 393 | HAL_StatusTypeDef USB_DevInit(USB_OTG_GlobalTypeDef *USBx, USB_OTG_CfgTypeDef Init); |
mbed_official | 235:685d5f11838f | 394 | HAL_StatusTypeDef USB_EnableGlobalInt(USB_OTG_GlobalTypeDef *USBx); |
mbed_official | 235:685d5f11838f | 395 | HAL_StatusTypeDef USB_DisableGlobalInt(USB_OTG_GlobalTypeDef *USBx); |
mbed_official | 235:685d5f11838f | 396 | HAL_StatusTypeDef USB_SetCurrentMode(USB_OTG_GlobalTypeDef *USBx , USB_OTG_ModeTypeDef mode); |
mbed_official | 235:685d5f11838f | 397 | HAL_StatusTypeDef USB_SetDevSpeed(USB_OTG_GlobalTypeDef *USBx , uint8_t speed); |
mbed_official | 235:685d5f11838f | 398 | HAL_StatusTypeDef USB_FlushRxFifo (USB_OTG_GlobalTypeDef *USBx); |
mbed_official | 235:685d5f11838f | 399 | HAL_StatusTypeDef USB_FlushTxFifo (USB_OTG_GlobalTypeDef *USBx, uint32_t num ); |
mbed_official | 235:685d5f11838f | 400 | HAL_StatusTypeDef USB_ActivateEndpoint(USB_OTG_GlobalTypeDef *USBx, USB_OTG_EPTypeDef *ep); |
mbed_official | 235:685d5f11838f | 401 | HAL_StatusTypeDef USB_DeactivateEndpoint(USB_OTG_GlobalTypeDef *USBx, USB_OTG_EPTypeDef *ep); |
mbed_official | 235:685d5f11838f | 402 | HAL_StatusTypeDef USB_ActivateDedicatedEndpoint(USB_OTG_GlobalTypeDef *USBx, USB_OTG_EPTypeDef *ep); |
mbed_official | 235:685d5f11838f | 403 | HAL_StatusTypeDef USB_DeactivateDedicatedEndpoint(USB_OTG_GlobalTypeDef *USBx, USB_OTG_EPTypeDef *ep); |
mbed_official | 235:685d5f11838f | 404 | HAL_StatusTypeDef USB_EPStartXfer(USB_OTG_GlobalTypeDef *USBx , USB_OTG_EPTypeDef *ep, uint8_t dma); |
mbed_official | 235:685d5f11838f | 405 | HAL_StatusTypeDef USB_EP0StartXfer(USB_OTG_GlobalTypeDef *USBx , USB_OTG_EPTypeDef *ep, uint8_t dma); |
mbed_official | 235:685d5f11838f | 406 | HAL_StatusTypeDef USB_WritePacket(USB_OTG_GlobalTypeDef *USBx, uint8_t *src, uint8_t ch_ep_num, uint16_t len, uint8_t dma); |
mbed_official | 235:685d5f11838f | 407 | void * USB_ReadPacket(USB_OTG_GlobalTypeDef *USBx, uint8_t *dest, uint16_t len); |
mbed_official | 235:685d5f11838f | 408 | HAL_StatusTypeDef USB_EPSetStall(USB_OTG_GlobalTypeDef *USBx , USB_OTG_EPTypeDef *ep); |
mbed_official | 235:685d5f11838f | 409 | HAL_StatusTypeDef USB_EPClearStall(USB_OTG_GlobalTypeDef *USBx , USB_OTG_EPTypeDef *ep); |
mbed_official | 235:685d5f11838f | 410 | HAL_StatusTypeDef USB_SetDevAddress (USB_OTG_GlobalTypeDef *USBx, uint8_t address); |
mbed_official | 235:685d5f11838f | 411 | HAL_StatusTypeDef USB_DevConnect (USB_OTG_GlobalTypeDef *USBx); |
mbed_official | 235:685d5f11838f | 412 | HAL_StatusTypeDef USB_DevDisconnect (USB_OTG_GlobalTypeDef *USBx); |
mbed_official | 235:685d5f11838f | 413 | HAL_StatusTypeDef USB_StopDevice(USB_OTG_GlobalTypeDef *USBx); |
mbed_official | 235:685d5f11838f | 414 | HAL_StatusTypeDef USB_ActivateSetup (USB_OTG_GlobalTypeDef *USBx); |
mbed_official | 235:685d5f11838f | 415 | HAL_StatusTypeDef USB_EP0_OutStart(USB_OTG_GlobalTypeDef *USBx, uint8_t dma, uint8_t *psetup); |
mbed_official | 235:685d5f11838f | 416 | uint8_t USB_GetDevSpeed(USB_OTG_GlobalTypeDef *USBx); |
mbed_official | 235:685d5f11838f | 417 | uint32_t USB_GetMode(USB_OTG_GlobalTypeDef *USBx); |
mbed_official | 235:685d5f11838f | 418 | uint32_t USB_ReadInterrupts (USB_OTG_GlobalTypeDef *USBx); |
mbed_official | 235:685d5f11838f | 419 | uint32_t USB_ReadDevAllOutEpInterrupt (USB_OTG_GlobalTypeDef *USBx); |
mbed_official | 235:685d5f11838f | 420 | uint32_t USB_ReadDevOutEPInterrupt (USB_OTG_GlobalTypeDef *USBx , uint8_t epnum); |
mbed_official | 235:685d5f11838f | 421 | uint32_t USB_ReadDevAllInEpInterrupt (USB_OTG_GlobalTypeDef *USBx); |
mbed_official | 235:685d5f11838f | 422 | uint32_t USB_ReadDevInEPInterrupt (USB_OTG_GlobalTypeDef *USBx , uint8_t epnum); |
mbed_official | 235:685d5f11838f | 423 | void USB_ClearInterrupts (USB_OTG_GlobalTypeDef *USBx, uint32_t interrupt); |
mbed_official | 235:685d5f11838f | 424 | |
mbed_official | 235:685d5f11838f | 425 | HAL_StatusTypeDef USB_HostInit (USB_OTG_GlobalTypeDef *USBx, USB_OTG_CfgTypeDef cfg); |
mbed_official | 235:685d5f11838f | 426 | HAL_StatusTypeDef USB_InitFSLSPClkSel(USB_OTG_GlobalTypeDef *USBx , uint8_t freq); |
mbed_official | 235:685d5f11838f | 427 | HAL_StatusTypeDef USB_ResetPort(USB_OTG_GlobalTypeDef *USBx); |
mbed_official | 235:685d5f11838f | 428 | HAL_StatusTypeDef USB_DriveVbus (USB_OTG_GlobalTypeDef *USBx, uint8_t state); |
mbed_official | 235:685d5f11838f | 429 | uint32_t USB_GetHostSpeed (USB_OTG_GlobalTypeDef *USBx); |
mbed_official | 235:685d5f11838f | 430 | uint32_t USB_GetCurrentFrame (USB_OTG_GlobalTypeDef *USBx); |
mbed_official | 235:685d5f11838f | 431 | HAL_StatusTypeDef USB_HC_Init(USB_OTG_GlobalTypeDef *USBx, |
mbed_official | 235:685d5f11838f | 432 | uint8_t ch_num, |
mbed_official | 235:685d5f11838f | 433 | uint8_t epnum, |
mbed_official | 235:685d5f11838f | 434 | uint8_t dev_address, |
mbed_official | 235:685d5f11838f | 435 | uint8_t speed, |
mbed_official | 235:685d5f11838f | 436 | uint8_t ep_type, |
mbed_official | 235:685d5f11838f | 437 | uint16_t mps); |
mbed_official | 235:685d5f11838f | 438 | HAL_StatusTypeDef USB_HC_StartXfer(USB_OTG_GlobalTypeDef *USBx, USB_OTG_HCTypeDef *hc, uint8_t dma); |
mbed_official | 235:685d5f11838f | 439 | uint32_t USB_HC_ReadInterrupt (USB_OTG_GlobalTypeDef *USBx); |
mbed_official | 235:685d5f11838f | 440 | HAL_StatusTypeDef USB_HC_Halt(USB_OTG_GlobalTypeDef *USBx , uint8_t hc_num); |
mbed_official | 235:685d5f11838f | 441 | HAL_StatusTypeDef USB_DoPing(USB_OTG_GlobalTypeDef *USBx , uint8_t ch_num); |
mbed_official | 235:685d5f11838f | 442 | HAL_StatusTypeDef USB_StopHost(USB_OTG_GlobalTypeDef *USBx); |
mbed_official | 235:685d5f11838f | 443 | |
mbed_official | 235:685d5f11838f | 444 | /** |
mbed_official | 235:685d5f11838f | 445 | * @} |
mbed_official | 235:685d5f11838f | 446 | */ |
mbed_official | 235:685d5f11838f | 447 | |
mbed_official | 235:685d5f11838f | 448 | /** |
mbed_official | 235:685d5f11838f | 449 | * @} |
mbed_official | 235:685d5f11838f | 450 | */ |
mbed_official | 235:685d5f11838f | 451 | |
mbed_official | 235:685d5f11838f | 452 | #ifdef __cplusplus |
mbed_official | 235:685d5f11838f | 453 | } |
mbed_official | 235:685d5f11838f | 454 | #endif |
mbed_official | 235:685d5f11838f | 455 | |
mbed_official | 235:685d5f11838f | 456 | |
mbed_official | 235:685d5f11838f | 457 | #endif /* __STM32F4xx_LL_USB_H */ |
mbed_official | 235:685d5f11838f | 458 | |
mbed_official | 235:685d5f11838f | 459 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |