The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

mbed 2

This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.

Committer:
Kojto
Date:
Tue Feb 14 11:24:20 2017 +0000
Revision:
136:ef9c61f8c49f
Parent:
135:176b8275d35d
Child:
139:856d2700e60b
Release 136 of the mbed library

Ports for Upcoming Targets


Fixes and Changes

3432: Target STM USBHOST support https://github.com/ARMmbed/mbed-os/pull/3432
3181: NUCLEO_F207ZG extending PeripheralPins.c: all available alternate functions can be used now https://github.com/ARMmbed/mbed-os/pull/3181
3626: NUCLEO_F412ZG : Add USB Device +Host https://github.com/ARMmbed/mbed-os/pull/3626
3628: Fix warnings https://github.com/ARMmbed/mbed-os/pull/3628
3629: STM32: L0 LL layer https://github.com/ARMmbed/mbed-os/pull/3629
3632: IDE Export support for platform VK_RZ_A1H https://github.com/ARMmbed/mbed-os/pull/3632
3642: Missing IRQ pin fix for platform VK_RZ_A1H https://github.com/ARMmbed/mbed-os/pull/3642
3664: Fix ncs36510 sleep definitions https://github.com/ARMmbed/mbed-os/pull/3664
3655: [STM32F4] Modify folder structure https://github.com/ARMmbed/mbed-os/pull/3655
3657: [STM32L4] Modify folder structure https://github.com/ARMmbed/mbed-os/pull/3657
3658: [STM32F3] Modify folder structure https://github.com/ARMmbed/mbed-os/pull/3658
3685: STM32: I2C: reset state machine https://github.com/ARMmbed/mbed-os/pull/3685
3692: uVisor: Standardize available legacy heap and stack https://github.com/ARMmbed/mbed-os/pull/3692
3621: Fix for #2884, LPC824: export to LPCXpresso, target running with wron https://github.com/ARMmbed/mbed-os/pull/3621
3649: [STM32F7] Modify folder structure https://github.com/ARMmbed/mbed-os/pull/3649
3695: Enforce device_name is valid in targets.json https://github.com/ARMmbed/mbed-os/pull/3695
3723: NCS36510: spi_format function bug fix https://github.com/ARMmbed/mbed-os/pull/3723

Who changed what in which revision?

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