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
TARGET_NUCLEO_F401RE/stm32f4xx_ll_usb.h@99:dbbf35b96557, 2015-05-13 (annotated)
- Committer:
- Kojto
- Date:
- Wed May 13 08:08:21 2015 +0200
- Revision:
- 99:dbbf35b96557
- Parent:
- 90:cb3d968589d8
- Child:
- 106:ba1f97679dad
Release 99 of the mbed library
Changes:
- new targets - MAXWSNENV, DISCO_L053C8
- STM32F4xx - ST Cube driver
- KSDK mcu - SPI timing fix
- Nordic - update to softdevice s130
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
emilmont | 77:869cf507173a | 1 | /** |
emilmont | 77:869cf507173a | 2 | ****************************************************************************** |
emilmont | 77:869cf507173a | 3 | * @file stm32f4xx_ll_usb.h |
emilmont | 77:869cf507173a | 4 | * @author MCD Application Team |
Kojto | 99:dbbf35b96557 | 5 | * @version V1.3.0 |
Kojto | 99:dbbf35b96557 | 6 | * @date 09-March-2015 |
emilmont | 77:869cf507173a | 7 | * @brief Header file of USB Core HAL module. |
emilmont | 77:869cf507173a | 8 | ****************************************************************************** |
emilmont | 77:869cf507173a | 9 | * @attention |
emilmont | 77:869cf507173a | 10 | * |
Kojto | 99:dbbf35b96557 | 11 | * <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2> |
emilmont | 77:869cf507173a | 12 | * |
emilmont | 77:869cf507173a | 13 | * Redistribution and use in source and binary forms, with or without modification, |
emilmont | 77:869cf507173a | 14 | * are permitted provided that the following conditions are met: |
emilmont | 77:869cf507173a | 15 | * 1. Redistributions of source code must retain the above copyright notice, |
emilmont | 77:869cf507173a | 16 | * this list of conditions and the following disclaimer. |
emilmont | 77:869cf507173a | 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
emilmont | 77:869cf507173a | 18 | * this list of conditions and the following disclaimer in the documentation |
emilmont | 77:869cf507173a | 19 | * and/or other materials provided with the distribution. |
emilmont | 77:869cf507173a | 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
emilmont | 77:869cf507173a | 21 | * may be used to endorse or promote products derived from this software |
emilmont | 77:869cf507173a | 22 | * without specific prior written permission. |
emilmont | 77:869cf507173a | 23 | * |
emilmont | 77:869cf507173a | 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
emilmont | 77:869cf507173a | 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
emilmont | 77:869cf507173a | 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
emilmont | 77:869cf507173a | 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
emilmont | 77:869cf507173a | 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
emilmont | 77:869cf507173a | 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
emilmont | 77:869cf507173a | 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
emilmont | 77:869cf507173a | 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
emilmont | 77:869cf507173a | 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
emilmont | 77:869cf507173a | 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
emilmont | 77:869cf507173a | 34 | * |
emilmont | 77:869cf507173a | 35 | ****************************************************************************** |
emilmont | 77:869cf507173a | 36 | */ |
emilmont | 77:869cf507173a | 37 | |
emilmont | 77:869cf507173a | 38 | /* Define to prevent recursive inclusion -------------------------------------*/ |
emilmont | 77:869cf507173a | 39 | #ifndef __STM32F4xx_LL_USB_H |
emilmont | 77:869cf507173a | 40 | #define __STM32F4xx_LL_USB_H |
emilmont | 77:869cf507173a | 41 | |
emilmont | 77:869cf507173a | 42 | #ifdef __cplusplus |
emilmont | 77:869cf507173a | 43 | extern "C" { |
emilmont | 77:869cf507173a | 44 | #endif |
emilmont | 77:869cf507173a | 45 | |
emilmont | 77:869cf507173a | 46 | /* Includes ------------------------------------------------------------------*/ |
emilmont | 77:869cf507173a | 47 | #include "stm32f4xx_hal_def.h" |
emilmont | 77:869cf507173a | 48 | |
emilmont | 77:869cf507173a | 49 | /** @addtogroup STM32F4xx_HAL |
emilmont | 77:869cf507173a | 50 | * @{ |
emilmont | 77:869cf507173a | 51 | */ |
emilmont | 77:869cf507173a | 52 | |
emilmont | 77:869cf507173a | 53 | /** @addtogroup USB_Core |
emilmont | 77:869cf507173a | 54 | * @{ |
emilmont | 77:869cf507173a | 55 | */ |
emilmont | 77:869cf507173a | 56 | |
emilmont | 77:869cf507173a | 57 | /* Exported types ------------------------------------------------------------*/ |
emilmont | 77:869cf507173a | 58 | |
emilmont | 77:869cf507173a | 59 | /** |
emilmont | 77:869cf507173a | 60 | * @brief USB Mode definition |
emilmont | 77:869cf507173a | 61 | */ |
emilmont | 77:869cf507173a | 62 | typedef enum |
emilmont | 77:869cf507173a | 63 | { |
emilmont | 77:869cf507173a | 64 | USB_OTG_DEVICE_MODE = 0, |
emilmont | 77:869cf507173a | 65 | USB_OTG_HOST_MODE = 1, |
emilmont | 77:869cf507173a | 66 | USB_OTG_DRD_MODE = 2 |
emilmont | 77:869cf507173a | 67 | |
emilmont | 77:869cf507173a | 68 | }USB_OTG_ModeTypeDef; |
emilmont | 77:869cf507173a | 69 | |
emilmont | 77:869cf507173a | 70 | /** |
emilmont | 77:869cf507173a | 71 | * @brief URB States definition |
emilmont | 77:869cf507173a | 72 | */ |
emilmont | 77:869cf507173a | 73 | typedef enum { |
emilmont | 77:869cf507173a | 74 | URB_IDLE = 0, |
emilmont | 77:869cf507173a | 75 | URB_DONE, |
emilmont | 77:869cf507173a | 76 | URB_NOTREADY, |
emilmont | 77:869cf507173a | 77 | URB_NYET, |
emilmont | 77:869cf507173a | 78 | URB_ERROR, |
emilmont | 77:869cf507173a | 79 | URB_STALL |
emilmont | 77:869cf507173a | 80 | |
emilmont | 77:869cf507173a | 81 | }USB_OTG_URBStateTypeDef; |
emilmont | 77:869cf507173a | 82 | |
emilmont | 77:869cf507173a | 83 | /** |
emilmont | 77:869cf507173a | 84 | * @brief Host channel States definition |
emilmont | 77:869cf507173a | 85 | */ |
emilmont | 77:869cf507173a | 86 | typedef enum { |
emilmont | 77:869cf507173a | 87 | HC_IDLE = 0, |
emilmont | 77:869cf507173a | 88 | HC_XFRC, |
emilmont | 77:869cf507173a | 89 | HC_HALTED, |
emilmont | 77:869cf507173a | 90 | HC_NAK, |
emilmont | 77:869cf507173a | 91 | HC_NYET, |
emilmont | 77:869cf507173a | 92 | HC_STALL, |
emilmont | 77:869cf507173a | 93 | HC_XACTERR, |
emilmont | 77:869cf507173a | 94 | HC_BBLERR, |
emilmont | 77:869cf507173a | 95 | HC_DATATGLERR |
emilmont | 77:869cf507173a | 96 | |
emilmont | 77:869cf507173a | 97 | }USB_OTG_HCStateTypeDef; |
emilmont | 77:869cf507173a | 98 | |
emilmont | 77:869cf507173a | 99 | /** |
emilmont | 77:869cf507173a | 100 | * @brief PCD Initialization Structure definition |
emilmont | 77:869cf507173a | 101 | */ |
emilmont | 77:869cf507173a | 102 | typedef struct |
emilmont | 77:869cf507173a | 103 | { |
emilmont | 77:869cf507173a | 104 | uint32_t dev_endpoints; /*!< Device Endpoints number. |
emilmont | 77:869cf507173a | 105 | This parameter depends on the used USB core. |
emilmont | 77:869cf507173a | 106 | This parameter must be a number between Min_Data = 1 and Max_Data = 15 */ |
emilmont | 77:869cf507173a | 107 | |
emilmont | 77:869cf507173a | 108 | uint32_t Host_channels; /*!< Host Channels number. |
emilmont | 77:869cf507173a | 109 | This parameter Depends on the used USB core. |
emilmont | 77:869cf507173a | 110 | This parameter must be a number between Min_Data = 1 and Max_Data = 15 */ |
emilmont | 77:869cf507173a | 111 | |
emilmont | 77:869cf507173a | 112 | uint32_t speed; /*!< USB Core speed. |
emilmont | 77:869cf507173a | 113 | This parameter can be any value of @ref USB_Core_Speed_ */ |
emilmont | 77:869cf507173a | 114 | |
emilmont | 77:869cf507173a | 115 | uint32_t dma_enable; /*!< Enable or disable of the USB embedded DMA. */ |
emilmont | 77:869cf507173a | 116 | |
emilmont | 77:869cf507173a | 117 | uint32_t ep0_mps; /*!< Set the Endpoint 0 Max Packet size. |
emilmont | 77:869cf507173a | 118 | This parameter can be any value of @ref USB_EP0_MPS_ */ |
emilmont | 77:869cf507173a | 119 | |
emilmont | 77:869cf507173a | 120 | uint32_t phy_itface; /*!< Select the used PHY interface. |
emilmont | 77:869cf507173a | 121 | This parameter can be any value of @ref USB_Core_PHY_ */ |
emilmont | 77:869cf507173a | 122 | |
emilmont | 77:869cf507173a | 123 | uint32_t Sof_enable; /*!< Enable or disable the output of the SOF signal. */ |
emilmont | 77:869cf507173a | 124 | |
Kojto | 99:dbbf35b96557 | 125 | uint32_t low_power_enable; /*!< Enable or disable the low power mode. */ |
Kojto | 99:dbbf35b96557 | 126 | |
Kojto | 99:dbbf35b96557 | 127 | uint32_t lpm_enable; /*!< Enable or disable Link Power Management. */ |
emilmont | 77:869cf507173a | 128 | |
emilmont | 77:869cf507173a | 129 | uint32_t vbus_sensing_enable; /*!< Enable or disable the VBUS Sensing feature. */ |
emilmont | 77:869cf507173a | 130 | |
emilmont | 77:869cf507173a | 131 | uint32_t use_dedicated_ep1; /*!< Enable or disable the use of the dedicated EP1 interrupt. */ |
emilmont | 77:869cf507173a | 132 | |
emilmont | 77:869cf507173a | 133 | uint32_t use_external_vbus; /*!< Enable or disable the use of the external VBUS. */ |
emilmont | 77:869cf507173a | 134 | |
emilmont | 77:869cf507173a | 135 | }USB_OTG_CfgTypeDef; |
emilmont | 77:869cf507173a | 136 | |
emilmont | 77:869cf507173a | 137 | typedef struct |
emilmont | 77:869cf507173a | 138 | { |
emilmont | 77:869cf507173a | 139 | uint8_t num; /*!< Endpoint number |
emilmont | 77:869cf507173a | 140 | This parameter must be a number between Min_Data = 1 and Max_Data = 15 */ |
emilmont | 77:869cf507173a | 141 | |
emilmont | 77:869cf507173a | 142 | uint8_t is_in; /*!< Endpoint direction |
emilmont | 77:869cf507173a | 143 | This parameter must be a number between Min_Data = 0 and Max_Data = 1 */ |
emilmont | 77:869cf507173a | 144 | |
emilmont | 77:869cf507173a | 145 | uint8_t is_stall; /*!< Endpoint stall condition |
emilmont | 77:869cf507173a | 146 | This parameter must be a number between Min_Data = 0 and Max_Data = 1 */ |
emilmont | 77:869cf507173a | 147 | |
emilmont | 77:869cf507173a | 148 | uint8_t type; /*!< Endpoint type |
emilmont | 77:869cf507173a | 149 | This parameter can be any value of @ref USB_EP_Type_ */ |
emilmont | 77:869cf507173a | 150 | |
emilmont | 77:869cf507173a | 151 | uint8_t data_pid_start; /*!< Initial data PID |
emilmont | 77:869cf507173a | 152 | This parameter must be a number between Min_Data = 0 and Max_Data = 1 */ |
emilmont | 77:869cf507173a | 153 | |
emilmont | 77:869cf507173a | 154 | uint8_t even_odd_frame; /*!< IFrame parity |
emilmont | 77:869cf507173a | 155 | This parameter must be a number between Min_Data = 0 and Max_Data = 1 */ |
emilmont | 77:869cf507173a | 156 | |
emilmont | 77:869cf507173a | 157 | uint16_t tx_fifo_num; /*!< Transmission FIFO number |
emilmont | 77:869cf507173a | 158 | This parameter must be a number between Min_Data = 1 and Max_Data = 15 */ |
emilmont | 77:869cf507173a | 159 | |
emilmont | 77:869cf507173a | 160 | uint32_t maxpacket; /*!< Endpoint Max packet size |
emilmont | 77:869cf507173a | 161 | This parameter must be a number between Min_Data = 0 and Max_Data = 64KB */ |
emilmont | 77:869cf507173a | 162 | |
emilmont | 77:869cf507173a | 163 | uint8_t *xfer_buff; /*!< Pointer to transfer buffer */ |
emilmont | 77:869cf507173a | 164 | |
emilmont | 77:869cf507173a | 165 | uint32_t dma_addr; /*!< 32 bits aligned transfer buffer address */ |
emilmont | 77:869cf507173a | 166 | |
emilmont | 77:869cf507173a | 167 | uint32_t xfer_len; /*!< Current transfer length */ |
emilmont | 77:869cf507173a | 168 | |
emilmont | 77:869cf507173a | 169 | uint32_t xfer_count; /*!< Partial transfer length in case of multi packet transfer */ |
emilmont | 77:869cf507173a | 170 | |
emilmont | 77:869cf507173a | 171 | }USB_OTG_EPTypeDef; |
emilmont | 77:869cf507173a | 172 | |
emilmont | 77:869cf507173a | 173 | typedef struct |
emilmont | 77:869cf507173a | 174 | { |
emilmont | 77:869cf507173a | 175 | uint8_t dev_addr ; /*!< USB device address. |
emilmont | 77:869cf507173a | 176 | This parameter must be a number between Min_Data = 1 and Max_Data = 255 */ |
emilmont | 77:869cf507173a | 177 | |
emilmont | 77:869cf507173a | 178 | uint8_t ch_num; /*!< Host channel number. |
emilmont | 77:869cf507173a | 179 | This parameter must be a number between Min_Data = 1 and Max_Data = 15 */ |
emilmont | 77:869cf507173a | 180 | |
emilmont | 77:869cf507173a | 181 | uint8_t ep_num; /*!< Endpoint number. |
emilmont | 77:869cf507173a | 182 | This parameter must be a number between Min_Data = 1 and Max_Data = 15 */ |
emilmont | 77:869cf507173a | 183 | |
emilmont | 77:869cf507173a | 184 | uint8_t ep_is_in; /*!< Endpoint direction |
emilmont | 77:869cf507173a | 185 | This parameter must be a number between Min_Data = 0 and Max_Data = 1 */ |
emilmont | 77:869cf507173a | 186 | |
emilmont | 77:869cf507173a | 187 | uint8_t speed; /*!< USB Host speed. |
emilmont | 77:869cf507173a | 188 | This parameter can be any value of @ref USB_Core_Speed_ */ |
emilmont | 77:869cf507173a | 189 | |
emilmont | 77:869cf507173a | 190 | uint8_t do_ping; /*!< Enable or disable the use of the PING protocol for HS mode. */ |
emilmont | 77:869cf507173a | 191 | |
emilmont | 77:869cf507173a | 192 | uint8_t process_ping; /*!< Execute the PING protocol for HS mode. */ |
emilmont | 77:869cf507173a | 193 | |
emilmont | 77:869cf507173a | 194 | uint8_t ep_type; /*!< Endpoint Type. |
emilmont | 77:869cf507173a | 195 | This parameter can be any value of @ref USB_EP_Type_ */ |
emilmont | 77:869cf507173a | 196 | |
emilmont | 77:869cf507173a | 197 | uint16_t max_packet; /*!< Endpoint Max packet size. |
emilmont | 77:869cf507173a | 198 | This parameter must be a number between Min_Data = 0 and Max_Data = 64KB */ |
emilmont | 77:869cf507173a | 199 | |
emilmont | 77:869cf507173a | 200 | uint8_t data_pid; /*!< Initial data PID. |
emilmont | 77:869cf507173a | 201 | This parameter must be a number between Min_Data = 0 and Max_Data = 1 */ |
emilmont | 77:869cf507173a | 202 | |
emilmont | 77:869cf507173a | 203 | uint8_t *xfer_buff; /*!< Pointer to transfer buffer. */ |
emilmont | 77:869cf507173a | 204 | |
emilmont | 77:869cf507173a | 205 | uint32_t xfer_len; /*!< Current transfer length. */ |
emilmont | 77:869cf507173a | 206 | |
emilmont | 77:869cf507173a | 207 | uint32_t xfer_count; /*!< Partial transfer length in case of multi packet transfer. */ |
emilmont | 77:869cf507173a | 208 | |
emilmont | 77:869cf507173a | 209 | uint8_t toggle_in; /*!< IN transfer current toggle flag. |
emilmont | 77:869cf507173a | 210 | This parameter must be a number between Min_Data = 0 and Max_Data = 1 */ |
emilmont | 77:869cf507173a | 211 | |
emilmont | 77:869cf507173a | 212 | uint8_t toggle_out; /*!< OUT transfer current toggle flag |
emilmont | 77:869cf507173a | 213 | This parameter must be a number between Min_Data = 0 and Max_Data = 1 */ |
emilmont | 77:869cf507173a | 214 | |
emilmont | 77:869cf507173a | 215 | uint32_t dma_addr; /*!< 32 bits aligned transfer buffer address. */ |
emilmont | 77:869cf507173a | 216 | |
emilmont | 77:869cf507173a | 217 | uint32_t ErrCnt; /*!< Host channel error count.*/ |
emilmont | 77:869cf507173a | 218 | |
emilmont | 77:869cf507173a | 219 | USB_OTG_URBStateTypeDef urb_state; /*!< URB state. |
emilmont | 77:869cf507173a | 220 | This parameter can be any value of @ref USB_OTG_URBStateTypeDef */ |
emilmont | 77:869cf507173a | 221 | |
emilmont | 77:869cf507173a | 222 | USB_OTG_HCStateTypeDef state; /*!< Host Channel state. |
emilmont | 77:869cf507173a | 223 | This parameter can be any value of @ref USB_OTG_HCStateTypeDef */ |
emilmont | 77:869cf507173a | 224 | |
emilmont | 77:869cf507173a | 225 | }USB_OTG_HCTypeDef; |
emilmont | 77:869cf507173a | 226 | |
emilmont | 77:869cf507173a | 227 | /* Exported constants --------------------------------------------------------*/ |
emilmont | 77:869cf507173a | 228 | |
Kojto | 99:dbbf35b96557 | 229 | /** @defgroup PCD_Exported_Constants PCD Exported Constants |
emilmont | 77:869cf507173a | 230 | * @{ |
emilmont | 77:869cf507173a | 231 | */ |
emilmont | 77:869cf507173a | 232 | |
Kojto | 99:dbbf35b96557 | 233 | /** @defgroup USB_Core_Mode_ USB Core Mode |
emilmont | 77:869cf507173a | 234 | * @{ |
emilmont | 77:869cf507173a | 235 | */ |
emilmont | 77:869cf507173a | 236 | #define USB_OTG_MODE_DEVICE 0 |
emilmont | 77:869cf507173a | 237 | #define USB_OTG_MODE_HOST 1 |
emilmont | 77:869cf507173a | 238 | #define USB_OTG_MODE_DRD 2 |
emilmont | 77:869cf507173a | 239 | /** |
emilmont | 77:869cf507173a | 240 | * @} |
emilmont | 77:869cf507173a | 241 | */ |
emilmont | 77:869cf507173a | 242 | |
Kojto | 99:dbbf35b96557 | 243 | /** @defgroup USB_Core_Speed_ USB Core Speed |
emilmont | 77:869cf507173a | 244 | * @{ |
emilmont | 77:869cf507173a | 245 | */ |
emilmont | 77:869cf507173a | 246 | #define USB_OTG_SPEED_HIGH 0 |
emilmont | 77:869cf507173a | 247 | #define USB_OTG_SPEED_HIGH_IN_FULL 1 |
emilmont | 77:869cf507173a | 248 | #define USB_OTG_SPEED_LOW 2 |
emilmont | 77:869cf507173a | 249 | #define USB_OTG_SPEED_FULL 3 |
emilmont | 77:869cf507173a | 250 | /** |
emilmont | 77:869cf507173a | 251 | * @} |
emilmont | 77:869cf507173a | 252 | */ |
emilmont | 77:869cf507173a | 253 | |
Kojto | 99:dbbf35b96557 | 254 | /** @defgroup USB_Core_PHY_ USB Core PHY |
emilmont | 77:869cf507173a | 255 | * @{ |
emilmont | 77:869cf507173a | 256 | */ |
emilmont | 77:869cf507173a | 257 | #define USB_OTG_ULPI_PHY 1 |
emilmont | 77:869cf507173a | 258 | #define USB_OTG_EMBEDDED_PHY 2 |
emilmont | 77:869cf507173a | 259 | /** |
emilmont | 77:869cf507173a | 260 | * @} |
emilmont | 77:869cf507173a | 261 | */ |
emilmont | 77:869cf507173a | 262 | |
Kojto | 99:dbbf35b96557 | 263 | /** @defgroup USB_Core_MPS_ USB Core MPS |
emilmont | 77:869cf507173a | 264 | * @{ |
emilmont | 77:869cf507173a | 265 | */ |
emilmont | 77:869cf507173a | 266 | #define USB_OTG_HS_MAX_PACKET_SIZE 512 |
emilmont | 77:869cf507173a | 267 | #define USB_OTG_FS_MAX_PACKET_SIZE 64 |
emilmont | 77:869cf507173a | 268 | #define USB_OTG_MAX_EP0_SIZE 64 |
emilmont | 77:869cf507173a | 269 | /** |
emilmont | 77:869cf507173a | 270 | * @} |
emilmont | 77:869cf507173a | 271 | */ |
emilmont | 77:869cf507173a | 272 | |
Kojto | 99:dbbf35b96557 | 273 | /** @defgroup USB_Core_Phy_Frequency_ USB Core Phy Frequency |
emilmont | 77:869cf507173a | 274 | * @{ |
emilmont | 77:869cf507173a | 275 | */ |
emilmont | 77:869cf507173a | 276 | #define DSTS_ENUMSPD_HS_PHY_30MHZ_OR_60MHZ (0 << 1) |
emilmont | 77:869cf507173a | 277 | #define DSTS_ENUMSPD_FS_PHY_30MHZ_OR_60MHZ (1 << 1) |
emilmont | 77:869cf507173a | 278 | #define DSTS_ENUMSPD_LS_PHY_6MHZ (2 << 1) |
emilmont | 77:869cf507173a | 279 | #define DSTS_ENUMSPD_FS_PHY_48MHZ (3 << 1) |
emilmont | 77:869cf507173a | 280 | /** |
emilmont | 77:869cf507173a | 281 | * @} |
emilmont | 77:869cf507173a | 282 | */ |
emilmont | 77:869cf507173a | 283 | |
Kojto | 99:dbbf35b96557 | 284 | /** @defgroup USB_CORE_Frame_Interval_ USB CORE Frame Interval |
emilmont | 77:869cf507173a | 285 | * @{ |
emilmont | 77:869cf507173a | 286 | */ |
emilmont | 77:869cf507173a | 287 | #define DCFG_FRAME_INTERVAL_80 0 |
emilmont | 77:869cf507173a | 288 | #define DCFG_FRAME_INTERVAL_85 1 |
emilmont | 77:869cf507173a | 289 | #define DCFG_FRAME_INTERVAL_90 2 |
emilmont | 77:869cf507173a | 290 | #define DCFG_FRAME_INTERVAL_95 3 |
emilmont | 77:869cf507173a | 291 | /** |
emilmont | 77:869cf507173a | 292 | * @} |
emilmont | 77:869cf507173a | 293 | */ |
emilmont | 77:869cf507173a | 294 | |
Kojto | 99:dbbf35b96557 | 295 | /** @defgroup USB_EP0_MPS_ USB EP0 MPS |
emilmont | 77:869cf507173a | 296 | * @{ |
emilmont | 77:869cf507173a | 297 | */ |
emilmont | 77:869cf507173a | 298 | #define DEP0CTL_MPS_64 0 |
emilmont | 77:869cf507173a | 299 | #define DEP0CTL_MPS_32 1 |
emilmont | 77:869cf507173a | 300 | #define DEP0CTL_MPS_16 2 |
emilmont | 77:869cf507173a | 301 | #define DEP0CTL_MPS_8 3 |
emilmont | 77:869cf507173a | 302 | /** |
emilmont | 77:869cf507173a | 303 | * @} |
emilmont | 77:869cf507173a | 304 | */ |
emilmont | 77:869cf507173a | 305 | |
Kojto | 99:dbbf35b96557 | 306 | /** @defgroup USB_EP_Speed_ USB EP Speed |
emilmont | 77:869cf507173a | 307 | * @{ |
emilmont | 77:869cf507173a | 308 | */ |
emilmont | 77:869cf507173a | 309 | #define EP_SPEED_LOW 0 |
emilmont | 77:869cf507173a | 310 | #define EP_SPEED_FULL 1 |
emilmont | 77:869cf507173a | 311 | #define EP_SPEED_HIGH 2 |
emilmont | 77:869cf507173a | 312 | /** |
emilmont | 77:869cf507173a | 313 | * @} |
emilmont | 77:869cf507173a | 314 | */ |
emilmont | 77:869cf507173a | 315 | |
Kojto | 99:dbbf35b96557 | 316 | /** @defgroup USB_EP_Type_ USB EP Type |
emilmont | 77:869cf507173a | 317 | * @{ |
emilmont | 77:869cf507173a | 318 | */ |
emilmont | 77:869cf507173a | 319 | #define EP_TYPE_CTRL 0 |
emilmont | 77:869cf507173a | 320 | #define EP_TYPE_ISOC 1 |
emilmont | 77:869cf507173a | 321 | #define EP_TYPE_BULK 2 |
emilmont | 77:869cf507173a | 322 | #define EP_TYPE_INTR 3 |
emilmont | 77:869cf507173a | 323 | #define EP_TYPE_MSK 3 |
emilmont | 77:869cf507173a | 324 | /** |
emilmont | 77:869cf507173a | 325 | * @} |
emilmont | 77:869cf507173a | 326 | */ |
emilmont | 77:869cf507173a | 327 | |
Kojto | 99:dbbf35b96557 | 328 | /** @defgroup USB_STS_Defines_ USB STS Defines |
emilmont | 77:869cf507173a | 329 | * @{ |
emilmont | 77:869cf507173a | 330 | */ |
emilmont | 77:869cf507173a | 331 | #define STS_GOUT_NAK 1 |
emilmont | 77:869cf507173a | 332 | #define STS_DATA_UPDT 2 |
emilmont | 77:869cf507173a | 333 | #define STS_XFER_COMP 3 |
emilmont | 77:869cf507173a | 334 | #define STS_SETUP_COMP 4 |
emilmont | 77:869cf507173a | 335 | #define STS_SETUP_UPDT 6 |
emilmont | 77:869cf507173a | 336 | /** |
emilmont | 77:869cf507173a | 337 | * @} |
emilmont | 77:869cf507173a | 338 | */ |
emilmont | 77:869cf507173a | 339 | |
Kojto | 99:dbbf35b96557 | 340 | /** @defgroup HCFG_SPEED_Defines_ HCFG SPEED Defines |
emilmont | 77:869cf507173a | 341 | * @{ |
emilmont | 77:869cf507173a | 342 | */ |
emilmont | 77:869cf507173a | 343 | #define HCFG_30_60_MHZ 0 |
emilmont | 77:869cf507173a | 344 | #define HCFG_48_MHZ 1 |
emilmont | 77:869cf507173a | 345 | #define HCFG_6_MHZ 2 |
emilmont | 77:869cf507173a | 346 | /** |
emilmont | 77:869cf507173a | 347 | * @} |
emilmont | 77:869cf507173a | 348 | */ |
emilmont | 77:869cf507173a | 349 | |
Kojto | 99:dbbf35b96557 | 350 | /** @defgroup HPRT0_PRTSPD_SPEED_Defines_ HPRT0 PRTSPD SPEED Defines |
emilmont | 77:869cf507173a | 351 | * @{ |
emilmont | 77:869cf507173a | 352 | */ |
emilmont | 77:869cf507173a | 353 | #define HPRT0_PRTSPD_HIGH_SPEED 0 |
emilmont | 77:869cf507173a | 354 | #define HPRT0_PRTSPD_FULL_SPEED 1 |
emilmont | 77:869cf507173a | 355 | #define HPRT0_PRTSPD_LOW_SPEED 2 |
emilmont | 77:869cf507173a | 356 | /** |
emilmont | 77:869cf507173a | 357 | * @} |
emilmont | 77:869cf507173a | 358 | */ |
emilmont | 77:869cf507173a | 359 | |
emilmont | 77:869cf507173a | 360 | #define HCCHAR_CTRL 0 |
emilmont | 77:869cf507173a | 361 | #define HCCHAR_ISOC 1 |
emilmont | 77:869cf507173a | 362 | #define HCCHAR_BULK 2 |
emilmont | 77:869cf507173a | 363 | #define HCCHAR_INTR 3 |
emilmont | 77:869cf507173a | 364 | |
emilmont | 77:869cf507173a | 365 | #define HC_PID_DATA0 0 |
emilmont | 77:869cf507173a | 366 | #define HC_PID_DATA2 1 |
emilmont | 77:869cf507173a | 367 | #define HC_PID_DATA1 2 |
emilmont | 77:869cf507173a | 368 | #define HC_PID_SETUP 3 |
emilmont | 77:869cf507173a | 369 | |
emilmont | 77:869cf507173a | 370 | #define GRXSTS_PKTSTS_IN 2 |
emilmont | 77:869cf507173a | 371 | #define GRXSTS_PKTSTS_IN_XFER_COMP 3 |
emilmont | 77:869cf507173a | 372 | #define GRXSTS_PKTSTS_DATA_TOGGLE_ERR 5 |
emilmont | 77:869cf507173a | 373 | #define GRXSTS_PKTSTS_CH_HALTED 7 |
emilmont | 77:869cf507173a | 374 | |
emilmont | 77:869cf507173a | 375 | #define USBx_PCGCCTL *(__IO uint32_t *)((uint32_t)USBx + USB_OTG_PCGCCTL_BASE) |
emilmont | 77:869cf507173a | 376 | #define USBx_HPRT0 *(__IO uint32_t *)((uint32_t)USBx + USB_OTG_HOST_PORT_BASE) |
emilmont | 77:869cf507173a | 377 | |
emilmont | 77:869cf507173a | 378 | #define USBx_DEVICE ((USB_OTG_DeviceTypeDef *)((uint32_t )USBx + USB_OTG_DEVICE_BASE)) |
emilmont | 77:869cf507173a | 379 | #define USBx_INEP(i) ((USB_OTG_INEndpointTypeDef *)((uint32_t)USBx + USB_OTG_IN_ENDPOINT_BASE + (i)*USB_OTG_EP_REG_SIZE)) |
emilmont | 77:869cf507173a | 380 | #define USBx_OUTEP(i) ((USB_OTG_OUTEndpointTypeDef *)((uint32_t)USBx + USB_OTG_OUT_ENDPOINT_BASE + (i)*USB_OTG_EP_REG_SIZE)) |
emilmont | 77:869cf507173a | 381 | #define USBx_DFIFO(i) *(__IO uint32_t *)((uint32_t)USBx + USB_OTG_FIFO_BASE + (i) * USB_OTG_FIFO_SIZE) |
emilmont | 77:869cf507173a | 382 | |
emilmont | 77:869cf507173a | 383 | #define USBx_HOST ((USB_OTG_HostTypeDef *)((uint32_t )USBx + USB_OTG_HOST_BASE)) |
emilmont | 77:869cf507173a | 384 | #define USBx_HC(i) ((USB_OTG_HostChannelTypeDef *)((uint32_t)USBx + USB_OTG_HOST_CHANNEL_BASE + (i)*USB_OTG_HOST_CHANNEL_SIZE)) |
Kojto | 99:dbbf35b96557 | 385 | /** |
Kojto | 99:dbbf35b96557 | 386 | * @} |
Kojto | 99:dbbf35b96557 | 387 | */ |
emilmont | 77:869cf507173a | 388 | /* Exported macro ------------------------------------------------------------*/ |
emilmont | 77:869cf507173a | 389 | #define USB_MASK_INTERRUPT(__INSTANCE__, __INTERRUPT__) ((__INSTANCE__)->GINTMSK &= ~(__INTERRUPT__)) |
emilmont | 77:869cf507173a | 390 | #define USB_UNMASK_INTERRUPT(__INSTANCE__, __INTERRUPT__) ((__INSTANCE__)->GINTMSK |= (__INTERRUPT__)) |
emilmont | 77:869cf507173a | 391 | |
emilmont | 77:869cf507173a | 392 | #define CLEAR_IN_EP_INTR(__EPNUM__, __INTERRUPT__) (USBx_INEP(__EPNUM__)->DIEPINT = (__INTERRUPT__)) |
emilmont | 77:869cf507173a | 393 | #define CLEAR_OUT_EP_INTR(__EPNUM__, __INTERRUPT__) (USBx_OUTEP(__EPNUM__)->DOEPINT = (__INTERRUPT__)) |
emilmont | 77:869cf507173a | 394 | |
emilmont | 77:869cf507173a | 395 | /* Exported functions --------------------------------------------------------*/ |
emilmont | 77:869cf507173a | 396 | HAL_StatusTypeDef USB_CoreInit(USB_OTG_GlobalTypeDef *USBx, USB_OTG_CfgTypeDef Init); |
emilmont | 77:869cf507173a | 397 | HAL_StatusTypeDef USB_DevInit(USB_OTG_GlobalTypeDef *USBx, USB_OTG_CfgTypeDef Init); |
emilmont | 77:869cf507173a | 398 | HAL_StatusTypeDef USB_EnableGlobalInt(USB_OTG_GlobalTypeDef *USBx); |
emilmont | 77:869cf507173a | 399 | HAL_StatusTypeDef USB_DisableGlobalInt(USB_OTG_GlobalTypeDef *USBx); |
emilmont | 77:869cf507173a | 400 | HAL_StatusTypeDef USB_SetCurrentMode(USB_OTG_GlobalTypeDef *USBx , USB_OTG_ModeTypeDef mode); |
emilmont | 77:869cf507173a | 401 | HAL_StatusTypeDef USB_SetDevSpeed(USB_OTG_GlobalTypeDef *USBx , uint8_t speed); |
emilmont | 77:869cf507173a | 402 | HAL_StatusTypeDef USB_FlushRxFifo (USB_OTG_GlobalTypeDef *USBx); |
emilmont | 77:869cf507173a | 403 | HAL_StatusTypeDef USB_FlushTxFifo (USB_OTG_GlobalTypeDef *USBx, uint32_t num ); |
emilmont | 77:869cf507173a | 404 | HAL_StatusTypeDef USB_ActivateEndpoint(USB_OTG_GlobalTypeDef *USBx, USB_OTG_EPTypeDef *ep); |
emilmont | 77:869cf507173a | 405 | HAL_StatusTypeDef USB_DeactivateEndpoint(USB_OTG_GlobalTypeDef *USBx, USB_OTG_EPTypeDef *ep); |
emilmont | 77:869cf507173a | 406 | HAL_StatusTypeDef USB_ActivateDedicatedEndpoint(USB_OTG_GlobalTypeDef *USBx, USB_OTG_EPTypeDef *ep); |
emilmont | 77:869cf507173a | 407 | HAL_StatusTypeDef USB_DeactivateDedicatedEndpoint(USB_OTG_GlobalTypeDef *USBx, USB_OTG_EPTypeDef *ep); |
emilmont | 77:869cf507173a | 408 | HAL_StatusTypeDef USB_EPStartXfer(USB_OTG_GlobalTypeDef *USBx , USB_OTG_EPTypeDef *ep, uint8_t dma); |
emilmont | 77:869cf507173a | 409 | HAL_StatusTypeDef USB_EP0StartXfer(USB_OTG_GlobalTypeDef *USBx , USB_OTG_EPTypeDef *ep, uint8_t dma); |
emilmont | 77:869cf507173a | 410 | HAL_StatusTypeDef USB_WritePacket(USB_OTG_GlobalTypeDef *USBx, uint8_t *src, uint8_t ch_ep_num, uint16_t len, uint8_t dma); |
emilmont | 77:869cf507173a | 411 | void * USB_ReadPacket(USB_OTG_GlobalTypeDef *USBx, uint8_t *dest, uint16_t len); |
emilmont | 77:869cf507173a | 412 | HAL_StatusTypeDef USB_EPSetStall(USB_OTG_GlobalTypeDef *USBx , USB_OTG_EPTypeDef *ep); |
emilmont | 77:869cf507173a | 413 | HAL_StatusTypeDef USB_EPClearStall(USB_OTG_GlobalTypeDef *USBx , USB_OTG_EPTypeDef *ep); |
emilmont | 77:869cf507173a | 414 | HAL_StatusTypeDef USB_SetDevAddress (USB_OTG_GlobalTypeDef *USBx, uint8_t address); |
emilmont | 77:869cf507173a | 415 | HAL_StatusTypeDef USB_DevConnect (USB_OTG_GlobalTypeDef *USBx); |
emilmont | 77:869cf507173a | 416 | HAL_StatusTypeDef USB_DevDisconnect (USB_OTG_GlobalTypeDef *USBx); |
emilmont | 77:869cf507173a | 417 | HAL_StatusTypeDef USB_StopDevice(USB_OTG_GlobalTypeDef *USBx); |
emilmont | 77:869cf507173a | 418 | HAL_StatusTypeDef USB_ActivateSetup (USB_OTG_GlobalTypeDef *USBx); |
emilmont | 77:869cf507173a | 419 | HAL_StatusTypeDef USB_EP0_OutStart(USB_OTG_GlobalTypeDef *USBx, uint8_t dma, uint8_t *psetup); |
emilmont | 77:869cf507173a | 420 | uint8_t USB_GetDevSpeed(USB_OTG_GlobalTypeDef *USBx); |
emilmont | 77:869cf507173a | 421 | uint32_t USB_GetMode(USB_OTG_GlobalTypeDef *USBx); |
emilmont | 77:869cf507173a | 422 | uint32_t USB_ReadInterrupts (USB_OTG_GlobalTypeDef *USBx); |
emilmont | 77:869cf507173a | 423 | uint32_t USB_ReadDevAllOutEpInterrupt (USB_OTG_GlobalTypeDef *USBx); |
emilmont | 77:869cf507173a | 424 | uint32_t USB_ReadDevOutEPInterrupt (USB_OTG_GlobalTypeDef *USBx , uint8_t epnum); |
emilmont | 77:869cf507173a | 425 | uint32_t USB_ReadDevAllInEpInterrupt (USB_OTG_GlobalTypeDef *USBx); |
emilmont | 77:869cf507173a | 426 | uint32_t USB_ReadDevInEPInterrupt (USB_OTG_GlobalTypeDef *USBx , uint8_t epnum); |
emilmont | 77:869cf507173a | 427 | void USB_ClearInterrupts (USB_OTG_GlobalTypeDef *USBx, uint32_t interrupt); |
emilmont | 77:869cf507173a | 428 | |
emilmont | 77:869cf507173a | 429 | HAL_StatusTypeDef USB_HostInit (USB_OTG_GlobalTypeDef *USBx, USB_OTG_CfgTypeDef cfg); |
emilmont | 77:869cf507173a | 430 | HAL_StatusTypeDef USB_InitFSLSPClkSel(USB_OTG_GlobalTypeDef *USBx , uint8_t freq); |
emilmont | 77:869cf507173a | 431 | HAL_StatusTypeDef USB_ResetPort(USB_OTG_GlobalTypeDef *USBx); |
emilmont | 77:869cf507173a | 432 | HAL_StatusTypeDef USB_DriveVbus (USB_OTG_GlobalTypeDef *USBx, uint8_t state); |
emilmont | 77:869cf507173a | 433 | uint32_t USB_GetHostSpeed (USB_OTG_GlobalTypeDef *USBx); |
emilmont | 77:869cf507173a | 434 | uint32_t USB_GetCurrentFrame (USB_OTG_GlobalTypeDef *USBx); |
emilmont | 77:869cf507173a | 435 | HAL_StatusTypeDef USB_HC_Init(USB_OTG_GlobalTypeDef *USBx, |
emilmont | 77:869cf507173a | 436 | uint8_t ch_num, |
emilmont | 77:869cf507173a | 437 | uint8_t epnum, |
emilmont | 77:869cf507173a | 438 | uint8_t dev_address, |
emilmont | 77:869cf507173a | 439 | uint8_t speed, |
emilmont | 77:869cf507173a | 440 | uint8_t ep_type, |
emilmont | 77:869cf507173a | 441 | uint16_t mps); |
emilmont | 77:869cf507173a | 442 | HAL_StatusTypeDef USB_HC_StartXfer(USB_OTG_GlobalTypeDef *USBx, USB_OTG_HCTypeDef *hc, uint8_t dma); |
emilmont | 77:869cf507173a | 443 | uint32_t USB_HC_ReadInterrupt (USB_OTG_GlobalTypeDef *USBx); |
emilmont | 77:869cf507173a | 444 | HAL_StatusTypeDef USB_HC_Halt(USB_OTG_GlobalTypeDef *USBx , uint8_t hc_num); |
emilmont | 77:869cf507173a | 445 | HAL_StatusTypeDef USB_DoPing(USB_OTG_GlobalTypeDef *USBx , uint8_t ch_num); |
emilmont | 77:869cf507173a | 446 | HAL_StatusTypeDef USB_StopHost(USB_OTG_GlobalTypeDef *USBx); |
emilmont | 77:869cf507173a | 447 | |
emilmont | 77:869cf507173a | 448 | /** |
emilmont | 77:869cf507173a | 449 | * @} |
emilmont | 77:869cf507173a | 450 | */ |
emilmont | 77:869cf507173a | 451 | |
emilmont | 77:869cf507173a | 452 | /** |
emilmont | 77:869cf507173a | 453 | * @} |
emilmont | 77:869cf507173a | 454 | */ |
emilmont | 77:869cf507173a | 455 | |
emilmont | 77:869cf507173a | 456 | #ifdef __cplusplus |
emilmont | 77:869cf507173a | 457 | } |
emilmont | 77:869cf507173a | 458 | #endif |
emilmont | 77:869cf507173a | 459 | |
emilmont | 77:869cf507173a | 460 | |
emilmont | 77:869cf507173a | 461 | #endif /* __STM32F4xx_LL_USB_H */ |
emilmont | 77:869cf507173a | 462 | |
emilmont | 77:869cf507173a | 463 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |