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:
<>
Date:
Wed Apr 12 16:07:08 2017 +0100
Revision:
140:97feb9bacc10
Parent:
128:9bcdf88f62b0
Child:
145:64910690c574
Release 140 of the mbed library

Ports for Upcoming Targets

3841: Add nRf52840 target https://github.com/ARMmbed/mbed-os/pull/3841
3992: Introducing UBLOX_C030 platform. https://github.com/ARMmbed/mbed-os/pull/3992

Fixes and Changes

3951: [NUCLEO_F303ZE] Correct ARDUINO pin https://github.com/ARMmbed/mbed-os/pull/3951
4021: Fixing a macro to detect when RTOS was in use for the NRF52840_DK https://github.com/ARMmbed/mbed-os/pull/4021
3979: KW24D: Add missing SPI defines and Arduino connector definitions https://github.com/ARMmbed/mbed-os/pull/3979
3990: UBLOX_C027: construct a ticker-based wait, rather than calling wait_ms(), in the https://github.com/ARMmbed/mbed-os/pull/3990
4003: Fixed OBOE in async serial tx for NRF52 target, fixes #4002 https://github.com/ARMmbed/mbed-os/pull/4003
4012: STM32: Correct I2C master error handling https://github.com/ARMmbed/mbed-os/pull/4012
4020: NUCLEO_L011K4 remove unsupported tool chain files https://github.com/ARMmbed/mbed-os/pull/4020
4065: K66F: Move bss section to m_data_2 Section https://github.com/ARMmbed/mbed-os/pull/4065
4014: Issue 3763: Reduce heap allocation in the GCC linker file https://github.com/ARMmbed/mbed-os/pull/4014
4030: [STM32L0] reduce IAR heap and stack size for small targets https://github.com/ARMmbed/mbed-os/pull/4030
4109: NUCLEO_L476RG : minor serial pin update https://github.com/ARMmbed/mbed-os/pull/4109
3982: Ticker - kl25z bugfix for handling events in the past https://github.com/ARMmbed/mbed-os/pull/3982

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Kojto 122:f9eeca106725 1 /**
Kojto 122:f9eeca106725 2 ******************************************************************************
Kojto 122:f9eeca106725 3 * @file stm32l4xx_ll_usb.h
Kojto 122:f9eeca106725 4 * @author MCD Application Team
Kojto 122:f9eeca106725 5 * @version V1.5.1
Kojto 122:f9eeca106725 6 * @date 31-May-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 __STM32L4xx_LL_USB_H
Kojto 122:f9eeca106725 40 #define __STM32L4xx_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 #if defined(STM32L475xx) || defined(STM32L476xx) || \
Kojto 122:f9eeca106725 47 defined(STM32L485xx) || defined(STM32L486xx) || \
Kojto 122:f9eeca106725 48 defined(STM32L432xx) || defined(STM32L433xx) || \
Kojto 122:f9eeca106725 49 defined(STM32L442xx) || defined(STM32L443xx)
Kojto 122:f9eeca106725 50
Kojto 122:f9eeca106725 51 /* Includes ------------------------------------------------------------------*/
Kojto 122:f9eeca106725 52 #include "stm32l4xx_hal_def.h"
Kojto 122:f9eeca106725 53
Kojto 122:f9eeca106725 54 /** @addtogroup STM32L4xx_HAL
Kojto 122:f9eeca106725 55 * @{
Kojto 122:f9eeca106725 56 */
Kojto 122:f9eeca106725 57
Kojto 122:f9eeca106725 58 /** @addtogroup USB_Core
Kojto 122:f9eeca106725 59 * @{
Kojto 122:f9eeca106725 60 */
Kojto 122:f9eeca106725 61
Kojto 122:f9eeca106725 62 /* Exported types ------------------------------------------------------------*/
Kojto 122:f9eeca106725 63
Kojto 122:f9eeca106725 64 /**
Kojto 122:f9eeca106725 65 * @brief USB Mode definition
Kojto 122:f9eeca106725 66 */
Kojto 122:f9eeca106725 67 typedef enum
Kojto 122:f9eeca106725 68 {
Kojto 122:f9eeca106725 69 USB_DEVICE_MODE = 0,
Kojto 122:f9eeca106725 70 USB_HOST_MODE = 1,
Kojto 122:f9eeca106725 71 USB_DRD_MODE = 2
Kojto 122:f9eeca106725 72
Kojto 122:f9eeca106725 73 }USB_ModeTypeDef;
Kojto 122:f9eeca106725 74
Kojto 122:f9eeca106725 75 #if defined (USB_OTG_FS)
Kojto 122:f9eeca106725 76 /**
Kojto 122:f9eeca106725 77 * @brief URB States definition
Kojto 122:f9eeca106725 78 */
Kojto 122:f9eeca106725 79 typedef enum {
Kojto 122:f9eeca106725 80 URB_IDLE = 0,
Kojto 122:f9eeca106725 81 URB_DONE,
Kojto 122:f9eeca106725 82 URB_NOTREADY,
Kojto 122:f9eeca106725 83 URB_NYET,
Kojto 122:f9eeca106725 84 URB_ERROR,
Kojto 122:f9eeca106725 85 URB_STALL
Kojto 122:f9eeca106725 86
Kojto 122:f9eeca106725 87 }USB_OTG_URBStateTypeDef;
Kojto 122:f9eeca106725 88
Kojto 122:f9eeca106725 89 /**
Kojto 122:f9eeca106725 90 * @brief Host channel States definition
Kojto 122:f9eeca106725 91 */
Kojto 122:f9eeca106725 92 typedef enum {
Kojto 122:f9eeca106725 93 HC_IDLE = 0,
Kojto 122:f9eeca106725 94 HC_XFRC,
Kojto 122:f9eeca106725 95 HC_HALTED,
Kojto 122:f9eeca106725 96 HC_NAK,
Kojto 122:f9eeca106725 97 HC_NYET,
Kojto 122:f9eeca106725 98 HC_STALL,
Kojto 122:f9eeca106725 99 HC_XACTERR,
Kojto 122:f9eeca106725 100 HC_BBLERR,
Kojto 122:f9eeca106725 101 HC_DATATGLERR
Kojto 122:f9eeca106725 102
Kojto 122:f9eeca106725 103 }USB_OTG_HCStateTypeDef;
Kojto 122:f9eeca106725 104
Kojto 122:f9eeca106725 105 /**
Kojto 122:f9eeca106725 106 * @brief PCD Initialization Structure definition
Kojto 122:f9eeca106725 107 */
Kojto 122:f9eeca106725 108 typedef struct
Kojto 122:f9eeca106725 109 {
Kojto 122:f9eeca106725 110 uint32_t dev_endpoints; /*!< Device Endpoints number.
Kojto 122:f9eeca106725 111 This parameter depends on the used USB core.
Kojto 122:f9eeca106725 112 This parameter must be a number between Min_Data = 1 and Max_Data = 15 */
Kojto 122:f9eeca106725 113
Kojto 122:f9eeca106725 114 uint32_t Host_channels; /*!< Host Channels number.
Kojto 122:f9eeca106725 115 This parameter Depends on the used USB core.
Kojto 122:f9eeca106725 116 This parameter must be a number between Min_Data = 1 and Max_Data = 15 */
Kojto 122:f9eeca106725 117
Kojto 122:f9eeca106725 118 uint32_t speed; /*!< USB Core speed.
Kojto 122:f9eeca106725 119 This parameter can be any value of @ref USB_Core_Speed_ */
Kojto 122:f9eeca106725 120
Kojto 122:f9eeca106725 121 uint32_t dma_enable; /*!< Enable or disable of the USB embedded DMA. */
Kojto 122:f9eeca106725 122
Kojto 122:f9eeca106725 123 uint32_t ep0_mps; /*!< Set the Endpoint 0 Max Packet size.
Kojto 122:f9eeca106725 124 This parameter can be any value of @ref USB_EP0_MPS_ */
Kojto 122:f9eeca106725 125
Kojto 122:f9eeca106725 126 uint32_t phy_itface; /*!< Select the used PHY interface.
Kojto 122:f9eeca106725 127 This parameter can be any value of @ref USB_Core_PHY_ */
Kojto 122:f9eeca106725 128
Kojto 122:f9eeca106725 129 uint32_t Sof_enable; /*!< Enable or disable the output of the SOF signal. */
Kojto 122:f9eeca106725 130
Kojto 122:f9eeca106725 131 uint32_t low_power_enable; /*!< Enable or disable the low power mode. */
Kojto 122:f9eeca106725 132
Kojto 122:f9eeca106725 133 uint32_t lpm_enable; /*!< Enable or disable Battery charging. */
Kojto 122:f9eeca106725 134
Kojto 122:f9eeca106725 135 uint32_t battery_charging_enable; /*!< Enable or disable Battery charging. */
Kojto 122:f9eeca106725 136
Kojto 122:f9eeca106725 137 uint32_t vbus_sensing_enable; /*!< Enable or disable the VBUS Sensing feature. */
Kojto 122:f9eeca106725 138
Kojto 122:f9eeca106725 139 uint32_t use_dedicated_ep1; /*!< Enable or disable the use of the dedicated EP1 interrupt. */
Kojto 122:f9eeca106725 140
Kojto 122:f9eeca106725 141 uint32_t use_external_vbus; /*!< Enable or disable the use of the external VBUS. */
Kojto 122:f9eeca106725 142
Kojto 122:f9eeca106725 143 }USB_OTG_CfgTypeDef;
Kojto 122:f9eeca106725 144
Kojto 122:f9eeca106725 145 typedef struct
Kojto 122:f9eeca106725 146 {
Kojto 122:f9eeca106725 147 uint8_t num; /*!< Endpoint number
Kojto 122:f9eeca106725 148 This parameter must be a number between Min_Data = 1 and Max_Data = 15 */
Kojto 122:f9eeca106725 149
Kojto 122:f9eeca106725 150 uint8_t is_in; /*!< Endpoint direction
Kojto 122:f9eeca106725 151 This parameter must be a number between Min_Data = 0 and Max_Data = 1 */
Kojto 122:f9eeca106725 152
Kojto 122:f9eeca106725 153 uint8_t is_stall; /*!< Endpoint stall condition
Kojto 122:f9eeca106725 154 This parameter must be a number between Min_Data = 0 and Max_Data = 1 */
Kojto 122:f9eeca106725 155
Kojto 122:f9eeca106725 156 uint8_t type; /*!< Endpoint type
Kojto 122:f9eeca106725 157 This parameter can be any value of @ref USB_EP_Type_ */
Kojto 122:f9eeca106725 158
Kojto 122:f9eeca106725 159 uint8_t data_pid_start; /*!< Initial data PID
Kojto 122:f9eeca106725 160 This parameter must be a number between Min_Data = 0 and Max_Data = 1 */
Kojto 122:f9eeca106725 161
Kojto 122:f9eeca106725 162 uint8_t even_odd_frame; /*!< IFrame parity
Kojto 122:f9eeca106725 163 This parameter must be a number between Min_Data = 0 and Max_Data = 1 */
Kojto 122:f9eeca106725 164
Kojto 122:f9eeca106725 165 uint16_t tx_fifo_num; /*!< Transmission FIFO number
Kojto 122:f9eeca106725 166 This parameter must be a number between Min_Data = 1 and Max_Data = 15 */
Kojto 122:f9eeca106725 167
Kojto 122:f9eeca106725 168 uint32_t maxpacket; /*!< Endpoint Max packet size
Kojto 122:f9eeca106725 169 This parameter must be a number between Min_Data = 0 and Max_Data = 64KB */
Kojto 122:f9eeca106725 170
Kojto 122:f9eeca106725 171 uint8_t *xfer_buff; /*!< Pointer to transfer buffer */
Kojto 122:f9eeca106725 172
Kojto 122:f9eeca106725 173 uint32_t dma_addr; /*!< 32 bits aligned transfer buffer address */
Kojto 122:f9eeca106725 174
Kojto 122:f9eeca106725 175 uint32_t xfer_len; /*!< Current transfer length */
Kojto 122:f9eeca106725 176
Kojto 122:f9eeca106725 177 uint32_t xfer_count; /*!< Partial transfer length in case of multi packet transfer */
Kojto 122:f9eeca106725 178
Kojto 122:f9eeca106725 179 }USB_OTG_EPTypeDef;
Kojto 122:f9eeca106725 180
Kojto 122:f9eeca106725 181 typedef struct
Kojto 122:f9eeca106725 182 {
Kojto 122:f9eeca106725 183 uint8_t dev_addr ; /*!< USB device address.
Kojto 122:f9eeca106725 184 This parameter must be a number between Min_Data = 1 and Max_Data = 255 */
Kojto 122:f9eeca106725 185
Kojto 122:f9eeca106725 186 uint8_t ch_num; /*!< Host channel number.
Kojto 122:f9eeca106725 187 This parameter must be a number between Min_Data = 1 and Max_Data = 15 */
Kojto 122:f9eeca106725 188
Kojto 122:f9eeca106725 189 uint8_t ep_num; /*!< Endpoint number.
Kojto 122:f9eeca106725 190 This parameter must be a number between Min_Data = 1 and Max_Data = 15 */
Kojto 122:f9eeca106725 191
Kojto 122:f9eeca106725 192 uint8_t ep_is_in; /*!< Endpoint direction
Kojto 122:f9eeca106725 193 This parameter must be a number between Min_Data = 0 and Max_Data = 1 */
Kojto 122:f9eeca106725 194
Kojto 122:f9eeca106725 195 uint8_t speed; /*!< USB Host speed.
Kojto 122:f9eeca106725 196 This parameter can be any value of @ref USB_Core_Speed_ */
Kojto 122:f9eeca106725 197
Kojto 122:f9eeca106725 198 uint8_t do_ping; /*!< Enable or disable the use of the PING protocol for HS mode. */
Kojto 122:f9eeca106725 199
Kojto 122:f9eeca106725 200 uint8_t process_ping; /*!< Execute the PING protocol for HS mode. */
Kojto 122:f9eeca106725 201
Kojto 122:f9eeca106725 202 uint8_t ep_type; /*!< Endpoint Type.
Kojto 122:f9eeca106725 203 This parameter can be any value of @ref USB_EP_Type_ */
Kojto 122:f9eeca106725 204
Kojto 122:f9eeca106725 205 uint16_t max_packet; /*!< Endpoint Max packet size.
Kojto 122:f9eeca106725 206 This parameter must be a number between Min_Data = 0 and Max_Data = 64KB */
Kojto 122:f9eeca106725 207
Kojto 122:f9eeca106725 208 uint8_t data_pid; /*!< Initial data PID.
Kojto 122:f9eeca106725 209 This parameter must be a number between Min_Data = 0 and Max_Data = 1 */
Kojto 122:f9eeca106725 210
Kojto 122:f9eeca106725 211 uint8_t *xfer_buff; /*!< Pointer to transfer buffer. */
Kojto 122:f9eeca106725 212
Kojto 122:f9eeca106725 213 uint32_t xfer_len; /*!< Current transfer length. */
Kojto 122:f9eeca106725 214
Kojto 122:f9eeca106725 215 uint32_t xfer_count; /*!< Partial transfer length in case of multi packet transfer. */
Kojto 122:f9eeca106725 216
Kojto 122:f9eeca106725 217 uint8_t toggle_in; /*!< IN transfer current toggle flag.
Kojto 122:f9eeca106725 218 This parameter must be a number between Min_Data = 0 and Max_Data = 1 */
Kojto 122:f9eeca106725 219
Kojto 122:f9eeca106725 220 uint8_t toggle_out; /*!< OUT transfer current toggle flag
Kojto 122:f9eeca106725 221 This parameter must be a number between Min_Data = 0 and Max_Data = 1 */
Kojto 122:f9eeca106725 222
Kojto 122:f9eeca106725 223 uint32_t dma_addr; /*!< 32 bits aligned transfer buffer address. */
Kojto 122:f9eeca106725 224
Kojto 122:f9eeca106725 225 uint32_t ErrCnt; /*!< Host channel error count.*/
Kojto 122:f9eeca106725 226
Kojto 122:f9eeca106725 227 USB_OTG_URBStateTypeDef urb_state; /*!< URB state.
Kojto 122:f9eeca106725 228 This parameter can be any value of @ref USB_OTG_URBStateTypeDef */
Kojto 122:f9eeca106725 229
Kojto 122:f9eeca106725 230 USB_OTG_HCStateTypeDef state; /*!< Host Channel state.
Kojto 122:f9eeca106725 231 This parameter can be any value of @ref USB_OTG_HCStateTypeDef */
Kojto 122:f9eeca106725 232
Kojto 122:f9eeca106725 233 }USB_OTG_HCTypeDef;
Kojto 122:f9eeca106725 234 #endif /* USB_OTG_FS */
Kojto 122:f9eeca106725 235
Kojto 122:f9eeca106725 236 #if defined (USB)
Kojto 122:f9eeca106725 237 /**
Kojto 122:f9eeca106725 238 * @brief USB Initialization Structure definition
Kojto 122:f9eeca106725 239 */
Kojto 122:f9eeca106725 240 typedef struct
Kojto 122:f9eeca106725 241 {
Kojto 122:f9eeca106725 242 uint32_t dev_endpoints; /*!< Device Endpoints number.
Kojto 122:f9eeca106725 243 This parameter depends on the used USB core.
Kojto 122:f9eeca106725 244 This parameter must be a number between Min_Data = 1 and Max_Data = 15 */
Kojto 122:f9eeca106725 245
Kojto 122:f9eeca106725 246 uint32_t speed; /*!< USB Core speed.
Kojto 122:f9eeca106725 247 This parameter can be any value of @ref USB_Core_Speed */
Kojto 122:f9eeca106725 248
Kojto 122:f9eeca106725 249 uint32_t dma_enable; /*!< Enable or disable of the USB embedded DMA. */
Kojto 122:f9eeca106725 250
Kojto 122:f9eeca106725 251 uint32_t ep0_mps; /*!< Set the Endpoint 0 Max Packet size.
Kojto 122:f9eeca106725 252 This parameter can be any value of @ref USB_EP0_MPS */
Kojto 122:f9eeca106725 253
Kojto 122:f9eeca106725 254 uint32_t phy_itface; /*!< Select the used PHY interface.
Kojto 122:f9eeca106725 255 This parameter can be any value of @ref USB_Core_PHY */
Kojto 122:f9eeca106725 256
Kojto 122:f9eeca106725 257 uint32_t Sof_enable; /*!< Enable or disable the output of the SOF signal. */
Kojto 122:f9eeca106725 258
Kojto 122:f9eeca106725 259 uint32_t low_power_enable; /*!< Enable or disable Low Power mode */
Kojto 122:f9eeca106725 260
Kojto 122:f9eeca106725 261 uint32_t lpm_enable; /*!< Enable or disable Battery charging. */
Kojto 122:f9eeca106725 262
Kojto 122:f9eeca106725 263 uint32_t battery_charging_enable; /*!< Enable or disable Battery charging. */
Kojto 122:f9eeca106725 264 } USB_CfgTypeDef;
Kojto 122:f9eeca106725 265
Kojto 122:f9eeca106725 266 typedef struct
Kojto 122:f9eeca106725 267 {
Kojto 122:f9eeca106725 268 uint8_t num; /*!< Endpoint number
Kojto 122:f9eeca106725 269 This parameter must be a number between Min_Data = 1 and Max_Data = 15 */
Kojto 122:f9eeca106725 270
Kojto 122:f9eeca106725 271 uint8_t is_in; /*!< Endpoint direction
Kojto 122:f9eeca106725 272 This parameter must be a number between Min_Data = 0 and Max_Data = 1 */
Kojto 122:f9eeca106725 273
Kojto 122:f9eeca106725 274 uint8_t is_stall; /*!< Endpoint stall condition
Kojto 122:f9eeca106725 275 This parameter must be a number between Min_Data = 0 and Max_Data = 1 */
Kojto 122:f9eeca106725 276
Kojto 122:f9eeca106725 277 uint8_t type; /*!< Endpoint type
Kojto 122:f9eeca106725 278 This parameter can be any value of @ref USB_EP_Type */
Kojto 122:f9eeca106725 279
Kojto 122:f9eeca106725 280 uint16_t pmaadress; /*!< PMA Address
Kojto 122:f9eeca106725 281 This parameter can be any value between Min_addr = 0 and Max_addr = 1K */
Kojto 122:f9eeca106725 282
Kojto 122:f9eeca106725 283 uint16_t pmaaddr0; /*!< PMA Address0
Kojto 122:f9eeca106725 284 This parameter can be any value between Min_addr = 0 and Max_addr = 1K */
Kojto 122:f9eeca106725 285
Kojto 122:f9eeca106725 286 uint16_t pmaaddr1; /*!< PMA Address1
Kojto 122:f9eeca106725 287 This parameter can be any value between Min_addr = 0 and Max_addr = 1K */
Kojto 122:f9eeca106725 288
Kojto 122:f9eeca106725 289 uint8_t doublebuffer; /*!< Double buffer enable
Kojto 122:f9eeca106725 290 This parameter can be 0 or 1 */
Kojto 122:f9eeca106725 291
Kojto 122:f9eeca106725 292 uint16_t tx_fifo_num; /*!< This parameter is not required by USB Device FS peripheral, it is used
Kojto 122:f9eeca106725 293 only by USB OTG FS peripheral
Kojto 122:f9eeca106725 294 This parameter is added to ensure compatibility across USB peripherals */
Kojto 122:f9eeca106725 295
Kojto 122:f9eeca106725 296 uint32_t maxpacket; /*!< Endpoint Max packet size
Kojto 122:f9eeca106725 297 This parameter must be a number between Min_Data = 0 and Max_Data = 64KB */
Kojto 122:f9eeca106725 298
Kojto 122:f9eeca106725 299 uint8_t *xfer_buff; /*!< Pointer to transfer buffer */
Kojto 122:f9eeca106725 300
Kojto 122:f9eeca106725 301 uint32_t xfer_len; /*!< Current transfer length */
Kojto 122:f9eeca106725 302
Kojto 122:f9eeca106725 303 uint32_t xfer_count; /*!< Partial transfer length in case of multi packet transfer */
Kojto 122:f9eeca106725 304
Kojto 122:f9eeca106725 305 } USB_EPTypeDef;
Kojto 122:f9eeca106725 306 #endif /* USB */
Kojto 122:f9eeca106725 307
Kojto 122:f9eeca106725 308 /* Exported constants --------------------------------------------------------*/
Kojto 122:f9eeca106725 309
Kojto 122:f9eeca106725 310 /** @defgroup PCD_Exported_Constants PCD Exported Constants
Kojto 122:f9eeca106725 311 * @{
Kojto 122:f9eeca106725 312 */
Kojto 122:f9eeca106725 313 #if defined (USB_OTG_FS)
Kojto 122:f9eeca106725 314 /** @defgroup USB_Core_Mode_ USB Core Mode
Kojto 122:f9eeca106725 315 * @{
Kojto 122:f9eeca106725 316 */
Kojto 122:f9eeca106725 317 #define USB_OTG_MODE_DEVICE 0
Kojto 122:f9eeca106725 318 #define USB_OTG_MODE_HOST 1
Kojto 122:f9eeca106725 319 #define USB_OTG_MODE_DRD 2
Kojto 122:f9eeca106725 320 /**
Kojto 122:f9eeca106725 321 * @}
Kojto 122:f9eeca106725 322 */
Kojto 122:f9eeca106725 323
Kojto 122:f9eeca106725 324 /** @defgroup USB_Core_Speed_ USB Core Speed
Kojto 122:f9eeca106725 325 * @{
Kojto 122:f9eeca106725 326 */
Kojto 122:f9eeca106725 327 #define USB_OTG_SPEED_HIGH 0
Kojto 122:f9eeca106725 328 #define USB_OTG_SPEED_HIGH_IN_FULL 1
Kojto 122:f9eeca106725 329 #define USB_OTG_SPEED_LOW 2
Kojto 122:f9eeca106725 330 #define USB_OTG_SPEED_FULL 3
Kojto 122:f9eeca106725 331 /**
Kojto 122:f9eeca106725 332 * @}
Kojto 122:f9eeca106725 333 */
Kojto 122:f9eeca106725 334
Kojto 122:f9eeca106725 335 /** @defgroup USB_Core_PHY_ USB Core PHY
Kojto 122:f9eeca106725 336 * @{
Kojto 122:f9eeca106725 337 */
Kojto 122:f9eeca106725 338 #define USB_OTG_EMBEDDED_PHY 1
Kojto 122:f9eeca106725 339 /**
Kojto 122:f9eeca106725 340 * @}
Kojto 122:f9eeca106725 341 */
Kojto 122:f9eeca106725 342
Kojto 122:f9eeca106725 343 /** @defgroup USB_Core_MPS_ USB Core MPS
Kojto 122:f9eeca106725 344 * @{
Kojto 122:f9eeca106725 345 */
Kojto 122:f9eeca106725 346 #define USB_OTG_FS_MAX_PACKET_SIZE 64
Kojto 122:f9eeca106725 347 #define USB_OTG_MAX_EP0_SIZE 64
Kojto 122:f9eeca106725 348 /**
Kojto 122:f9eeca106725 349 * @}
Kojto 122:f9eeca106725 350 */
Kojto 122:f9eeca106725 351
Kojto 122:f9eeca106725 352 /** @defgroup USB_Core_Phy_Frequency_ USB Core Phy Frequency
Kojto 122:f9eeca106725 353 * @{
Kojto 122:f9eeca106725 354 */
Kojto 122:f9eeca106725 355 #define DSTS_ENUMSPD_HS_PHY_30MHZ_OR_60MHZ (0 << 1)
Kojto 122:f9eeca106725 356 #define DSTS_ENUMSPD_FS_PHY_30MHZ_OR_60MHZ (1 << 1)
Kojto 122:f9eeca106725 357 #define DSTS_ENUMSPD_LS_PHY_6MHZ (2 << 1)
Kojto 122:f9eeca106725 358 #define DSTS_ENUMSPD_FS_PHY_48MHZ (3 << 1)
Kojto 122:f9eeca106725 359 /**
Kojto 122:f9eeca106725 360 * @}
Kojto 122:f9eeca106725 361 */
Kojto 122:f9eeca106725 362
Kojto 122:f9eeca106725 363 /** @defgroup USB_CORE_Frame_Interval_ USB CORE Frame Interval
Kojto 122:f9eeca106725 364 * @{
Kojto 122:f9eeca106725 365 */
Kojto 122:f9eeca106725 366 #define DCFG_FRAME_INTERVAL_80 0
Kojto 122:f9eeca106725 367 #define DCFG_FRAME_INTERVAL_85 1
Kojto 122:f9eeca106725 368 #define DCFG_FRAME_INTERVAL_90 2
Kojto 122:f9eeca106725 369 #define DCFG_FRAME_INTERVAL_95 3
Kojto 122:f9eeca106725 370 /**
Kojto 122:f9eeca106725 371 * @}
Kojto 122:f9eeca106725 372 */
Kojto 122:f9eeca106725 373
Kojto 122:f9eeca106725 374 /** @defgroup USB_EP0_MPS_ USB EP0 MPS
Kojto 122:f9eeca106725 375 * @{
Kojto 122:f9eeca106725 376 */
Kojto 122:f9eeca106725 377 #define DEP0CTL_MPS_64 0
Kojto 122:f9eeca106725 378 #define DEP0CTL_MPS_32 1
Kojto 122:f9eeca106725 379 #define DEP0CTL_MPS_16 2
Kojto 122:f9eeca106725 380 #define DEP0CTL_MPS_8 3
Kojto 122:f9eeca106725 381 /**
Kojto 122:f9eeca106725 382 * @}
Kojto 122:f9eeca106725 383 */
Kojto 122:f9eeca106725 384
Kojto 122:f9eeca106725 385 /** @defgroup USB_EP_Speed_ USB EP Speed
Kojto 122:f9eeca106725 386 * @{
Kojto 122:f9eeca106725 387 */
Kojto 122:f9eeca106725 388 #define EP_SPEED_LOW 0
Kojto 122:f9eeca106725 389 #define EP_SPEED_FULL 1
Kojto 122:f9eeca106725 390 #define EP_SPEED_HIGH 2
Kojto 122:f9eeca106725 391 /**
Kojto 122:f9eeca106725 392 * @}
Kojto 122:f9eeca106725 393 */
Kojto 122:f9eeca106725 394
Kojto 122:f9eeca106725 395 /** @defgroup USB_EP_Type_ USB EP Type
Kojto 122:f9eeca106725 396 * @{
Kojto 122:f9eeca106725 397 */
Kojto 122:f9eeca106725 398 #define EP_TYPE_CTRL 0
Kojto 122:f9eeca106725 399 #define EP_TYPE_ISOC 1
Kojto 122:f9eeca106725 400 #define EP_TYPE_BULK 2
Kojto 122:f9eeca106725 401 #define EP_TYPE_INTR 3
Kojto 122:f9eeca106725 402 #define EP_TYPE_MSK 3
Kojto 122:f9eeca106725 403 /**
Kojto 122:f9eeca106725 404 * @}
Kojto 122:f9eeca106725 405 */
Kojto 122:f9eeca106725 406
Kojto 122:f9eeca106725 407 /** @defgroup USB_STS_Defines_ USB STS Defines
Kojto 122:f9eeca106725 408 * @{
Kojto 122:f9eeca106725 409 */
Kojto 122:f9eeca106725 410 #define STS_GOUT_NAK 1
Kojto 122:f9eeca106725 411 #define STS_DATA_UPDT 2
Kojto 122:f9eeca106725 412 #define STS_XFER_COMP 3
Kojto 122:f9eeca106725 413 #define STS_SETUP_COMP 4
Kojto 122:f9eeca106725 414 #define STS_SETUP_UPDT 6
Kojto 122:f9eeca106725 415 /**
Kojto 122:f9eeca106725 416 * @}
Kojto 122:f9eeca106725 417 */
Kojto 122:f9eeca106725 418
Kojto 122:f9eeca106725 419 /** @defgroup HCFG_SPEED_Defines_ HCFG SPEED Defines
Kojto 122:f9eeca106725 420 * @{
Kojto 122:f9eeca106725 421 */
Kojto 122:f9eeca106725 422 #define HCFG_30_60_MHZ 0
Kojto 122:f9eeca106725 423 #define HCFG_48_MHZ 1
Kojto 122:f9eeca106725 424 #define HCFG_6_MHZ 2
Kojto 122:f9eeca106725 425 /**
Kojto 122:f9eeca106725 426 * @}
Kojto 122:f9eeca106725 427 */
Kojto 122:f9eeca106725 428
Kojto 122:f9eeca106725 429 /** @defgroup HPRT0_PRTSPD_SPEED_Defines_ HPRT0 PRTSPD SPEED Defines
Kojto 122:f9eeca106725 430 * @{
Kojto 122:f9eeca106725 431 */
Kojto 122:f9eeca106725 432 #define HPRT0_PRTSPD_HIGH_SPEED 0
Kojto 122:f9eeca106725 433 #define HPRT0_PRTSPD_FULL_SPEED 1
Kojto 122:f9eeca106725 434 #define HPRT0_PRTSPD_LOW_SPEED 2
Kojto 122:f9eeca106725 435 /**
Kojto 122:f9eeca106725 436 * @}
Kojto 122:f9eeca106725 437 */
Kojto 122:f9eeca106725 438
Kojto 122:f9eeca106725 439 #define HCCHAR_CTRL 0
Kojto 122:f9eeca106725 440 #define HCCHAR_ISOC 1
Kojto 122:f9eeca106725 441 #define HCCHAR_BULK 2
Kojto 122:f9eeca106725 442 #define HCCHAR_INTR 3
Kojto 122:f9eeca106725 443
Kojto 122:f9eeca106725 444 #define HC_PID_DATA0 0
Kojto 122:f9eeca106725 445 #define HC_PID_DATA2 1
Kojto 122:f9eeca106725 446 #define HC_PID_DATA1 2
Kojto 122:f9eeca106725 447 #define HC_PID_SETUP 3
Kojto 122:f9eeca106725 448
Kojto 122:f9eeca106725 449 #define GRXSTS_PKTSTS_IN 2
Kojto 122:f9eeca106725 450 #define GRXSTS_PKTSTS_IN_XFER_COMP 3
Kojto 122:f9eeca106725 451 #define GRXSTS_PKTSTS_DATA_TOGGLE_ERR 5
Kojto 122:f9eeca106725 452 #define GRXSTS_PKTSTS_CH_HALTED 7
Kojto 122:f9eeca106725 453
Kojto 122:f9eeca106725 454 #define USBx_PCGCCTL *(__IO uint32_t *)((uint32_t)USBx + USB_OTG_PCGCCTL_BASE)
Kojto 122:f9eeca106725 455 #define USBx_HPRT0 *(__IO uint32_t *)((uint32_t)USBx + USB_OTG_HOST_PORT_BASE)
Kojto 122:f9eeca106725 456
Kojto 122:f9eeca106725 457 #define USBx_DEVICE ((USB_OTG_DeviceTypeDef *)((uint32_t )USBx + USB_OTG_DEVICE_BASE))
Kojto 122:f9eeca106725 458 #define USBx_INEP(i) ((USB_OTG_INEndpointTypeDef *)((uint32_t)USBx + USB_OTG_IN_ENDPOINT_BASE + (i)*USB_OTG_EP_REG_SIZE))
Kojto 122:f9eeca106725 459 #define USBx_OUTEP(i) ((USB_OTG_OUTEndpointTypeDef *)((uint32_t)USBx + USB_OTG_OUT_ENDPOINT_BASE + (i)*USB_OTG_EP_REG_SIZE))
Kojto 122:f9eeca106725 460 #define USBx_DFIFO(i) *(__IO uint32_t *)((uint32_t)USBx + USB_OTG_FIFO_BASE + (i) * USB_OTG_FIFO_SIZE)
Kojto 122:f9eeca106725 461
Kojto 122:f9eeca106725 462 #define USBx_HOST ((USB_OTG_HostTypeDef *)((uint32_t )USBx + USB_OTG_HOST_BASE))
Kojto 122:f9eeca106725 463 #define USBx_HC(i) ((USB_OTG_HostChannelTypeDef *)((uint32_t)USBx + USB_OTG_HOST_CHANNEL_BASE + (i)*USB_OTG_HOST_CHANNEL_SIZE))
Kojto 122:f9eeca106725 464
Kojto 122:f9eeca106725 465 #endif /* USB_OTG_FS */
Kojto 122:f9eeca106725 466
Kojto 122:f9eeca106725 467 #if defined (USB)
Kojto 122:f9eeca106725 468 /** @defgroup USB_LL_EP0_MPS USB Low Layer EP0 MPS
Kojto 122:f9eeca106725 469 * @{
Kojto 122:f9eeca106725 470 */
Kojto 122:f9eeca106725 471 #define DEP0CTL_MPS_64 0
Kojto 122:f9eeca106725 472 #define DEP0CTL_MPS_32 1
Kojto 122:f9eeca106725 473 #define DEP0CTL_MPS_16 2
Kojto 122:f9eeca106725 474 #define DEP0CTL_MPS_8 3
Kojto 122:f9eeca106725 475 /**
Kojto 122:f9eeca106725 476 * @}
Kojto 122:f9eeca106725 477 */
Kojto 122:f9eeca106725 478
Kojto 122:f9eeca106725 479 /** @defgroup USB_LL_EP_Type USB Low Layer EP Type
Kojto 122:f9eeca106725 480 * @{
Kojto 122:f9eeca106725 481 */
Kojto 122:f9eeca106725 482 #define EP_TYPE_CTRL 0
Kojto 122:f9eeca106725 483 #define EP_TYPE_ISOC 1
Kojto 122:f9eeca106725 484 #define EP_TYPE_BULK 2
Kojto 122:f9eeca106725 485 #define EP_TYPE_INTR 3
Kojto 122:f9eeca106725 486 #define EP_TYPE_MSK 3
Kojto 122:f9eeca106725 487 /**
Kojto 122:f9eeca106725 488 * @}
Kojto 122:f9eeca106725 489 */
Kojto 122:f9eeca106725 490
Kojto 122:f9eeca106725 491 #define BTABLE_ADDRESS (0x000)
Kojto 122:f9eeca106725 492 #endif /* USB */
Kojto 122:f9eeca106725 493
Kojto 122:f9eeca106725 494 /**
Kojto 122:f9eeca106725 495 * @}
Kojto 122:f9eeca106725 496 */
Kojto 122:f9eeca106725 497
Kojto 122:f9eeca106725 498 /* Exported macro ------------------------------------------------------------*/
Kojto 122:f9eeca106725 499 #if defined (USB_OTG_FS)
Kojto 122:f9eeca106725 500 #define USB_MASK_INTERRUPT(__INSTANCE__, __INTERRUPT__) ((__INSTANCE__)->GINTMSK &= ~(__INTERRUPT__))
Kojto 122:f9eeca106725 501 #define USB_UNMASK_INTERRUPT(__INSTANCE__, __INTERRUPT__) ((__INSTANCE__)->GINTMSK |= (__INTERRUPT__))
Kojto 122:f9eeca106725 502
Kojto 122:f9eeca106725 503 #define CLEAR_IN_EP_INTR(__EPNUM__, __INTERRUPT__) (USBx_INEP(__EPNUM__)->DIEPINT = (__INTERRUPT__))
Kojto 122:f9eeca106725 504 #define CLEAR_OUT_EP_INTR(__EPNUM__, __INTERRUPT__) (USBx_OUTEP(__EPNUM__)->DOEPINT = (__INTERRUPT__))
Kojto 122:f9eeca106725 505 #endif /* USB_OTG_FS */
Kojto 122:f9eeca106725 506
Kojto 122:f9eeca106725 507 /* Exported functions --------------------------------------------------------*/
Kojto 122:f9eeca106725 508 #if defined (USB_OTG_FS)
Kojto 122:f9eeca106725 509 HAL_StatusTypeDef USB_CoreInit(USB_OTG_GlobalTypeDef *USBx, USB_OTG_CfgTypeDef Init);
Kojto 122:f9eeca106725 510 HAL_StatusTypeDef USB_DevInit(USB_OTG_GlobalTypeDef *USBx, USB_OTG_CfgTypeDef Init);
Kojto 122:f9eeca106725 511 HAL_StatusTypeDef USB_EnableGlobalInt(USB_OTG_GlobalTypeDef *USBx);
Kojto 122:f9eeca106725 512 HAL_StatusTypeDef USB_DisableGlobalInt(USB_OTG_GlobalTypeDef *USBx);
Kojto 122:f9eeca106725 513 HAL_StatusTypeDef USB_SetCurrentMode(USB_OTG_GlobalTypeDef *USBx , USB_ModeTypeDef mode);
Kojto 122:f9eeca106725 514 HAL_StatusTypeDef USB_SetDevSpeed(USB_OTG_GlobalTypeDef *USBx , uint8_t speed);
Kojto 122:f9eeca106725 515 HAL_StatusTypeDef USB_FlushRxFifo (USB_OTG_GlobalTypeDef *USBx);
Kojto 122:f9eeca106725 516 HAL_StatusTypeDef USB_FlushTxFifo (USB_OTG_GlobalTypeDef *USBx, uint32_t num );
Kojto 122:f9eeca106725 517 HAL_StatusTypeDef USB_ActivateEndpoint(USB_OTG_GlobalTypeDef *USBx, USB_OTG_EPTypeDef *ep);
Kojto 122:f9eeca106725 518 HAL_StatusTypeDef USB_DeactivateEndpoint(USB_OTG_GlobalTypeDef *USBx, USB_OTG_EPTypeDef *ep);
Kojto 122:f9eeca106725 519 HAL_StatusTypeDef USB_ActivateDedicatedEndpoint(USB_OTG_GlobalTypeDef *USBx, USB_OTG_EPTypeDef *ep);
Kojto 122:f9eeca106725 520 HAL_StatusTypeDef USB_DeactivateDedicatedEndpoint(USB_OTG_GlobalTypeDef *USBx, USB_OTG_EPTypeDef *ep);
Kojto 122:f9eeca106725 521 HAL_StatusTypeDef USB_EPStartXfer(USB_OTG_GlobalTypeDef *USBx , USB_OTG_EPTypeDef *ep, uint8_t dma);
Kojto 122:f9eeca106725 522 HAL_StatusTypeDef USB_EP0StartXfer(USB_OTG_GlobalTypeDef *USBx , USB_OTG_EPTypeDef *ep, uint8_t dma);
Kojto 122:f9eeca106725 523 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 524 void * USB_ReadPacket(USB_OTG_GlobalTypeDef *USBx, uint8_t *dest, uint16_t len);
Kojto 122:f9eeca106725 525 HAL_StatusTypeDef USB_EPSetStall(USB_OTG_GlobalTypeDef *USBx , USB_OTG_EPTypeDef *ep);
Kojto 122:f9eeca106725 526 HAL_StatusTypeDef USB_EPClearStall(USB_OTG_GlobalTypeDef *USBx , USB_OTG_EPTypeDef *ep);
Kojto 122:f9eeca106725 527 HAL_StatusTypeDef USB_SetDevAddress (USB_OTG_GlobalTypeDef *USBx, uint8_t address);
Kojto 122:f9eeca106725 528 HAL_StatusTypeDef USB_DevConnect (USB_OTG_GlobalTypeDef *USBx);
Kojto 122:f9eeca106725 529 HAL_StatusTypeDef USB_DevDisconnect (USB_OTG_GlobalTypeDef *USBx);
Kojto 122:f9eeca106725 530 HAL_StatusTypeDef USB_StopDevice(USB_OTG_GlobalTypeDef *USBx);
Kojto 122:f9eeca106725 531 HAL_StatusTypeDef USB_ActivateSetup (USB_OTG_GlobalTypeDef *USBx);
Kojto 122:f9eeca106725 532 HAL_StatusTypeDef USB_EP0_OutStart(USB_OTG_GlobalTypeDef *USBx, uint8_t dma, uint8_t *psetup);
Kojto 122:f9eeca106725 533 uint8_t USB_GetDevSpeed(USB_OTG_GlobalTypeDef *USBx);
Kojto 122:f9eeca106725 534 uint32_t USB_GetMode(USB_OTG_GlobalTypeDef *USBx);
Kojto 122:f9eeca106725 535 uint32_t USB_ReadInterrupts (USB_OTG_GlobalTypeDef *USBx);
Kojto 122:f9eeca106725 536 uint32_t USB_ReadDevAllOutEpInterrupt (USB_OTG_GlobalTypeDef *USBx);
Kojto 122:f9eeca106725 537 uint32_t USB_ReadDevOutEPInterrupt (USB_OTG_GlobalTypeDef *USBx , uint8_t epnum);
Kojto 122:f9eeca106725 538 uint32_t USB_ReadDevAllInEpInterrupt (USB_OTG_GlobalTypeDef *USBx);
Kojto 122:f9eeca106725 539 uint32_t USB_ReadDevInEPInterrupt (USB_OTG_GlobalTypeDef *USBx , uint8_t epnum);
Kojto 122:f9eeca106725 540 void USB_ClearInterrupts (USB_OTG_GlobalTypeDef *USBx, uint32_t interrupt);
Kojto 122:f9eeca106725 541
Kojto 122:f9eeca106725 542 HAL_StatusTypeDef USB_HostInit (USB_OTG_GlobalTypeDef *USBx, USB_OTG_CfgTypeDef cfg);
Kojto 122:f9eeca106725 543 HAL_StatusTypeDef USB_InitFSLSPClkSel(USB_OTG_GlobalTypeDef *USBx , uint8_t freq);
Kojto 122:f9eeca106725 544 HAL_StatusTypeDef USB_ResetPort(USB_OTG_GlobalTypeDef *USBx);
Kojto 122:f9eeca106725 545 HAL_StatusTypeDef USB_DriveVbus (USB_OTG_GlobalTypeDef *USBx, uint8_t state);
Kojto 122:f9eeca106725 546 uint32_t USB_GetHostSpeed (USB_OTG_GlobalTypeDef *USBx);
Kojto 122:f9eeca106725 547 uint32_t USB_GetCurrentFrame (USB_OTG_GlobalTypeDef *USBx);
Kojto 122:f9eeca106725 548 HAL_StatusTypeDef USB_HC_Init(USB_OTG_GlobalTypeDef *USBx,
Kojto 122:f9eeca106725 549 uint8_t ch_num,
Kojto 122:f9eeca106725 550 uint8_t epnum,
Kojto 122:f9eeca106725 551 uint8_t dev_address,
Kojto 122:f9eeca106725 552 uint8_t speed,
Kojto 122:f9eeca106725 553 uint8_t ep_type,
Kojto 122:f9eeca106725 554 uint16_t mps);
Kojto 122:f9eeca106725 555 HAL_StatusTypeDef USB_HC_StartXfer(USB_OTG_GlobalTypeDef *USBx, USB_OTG_HCTypeDef *hc, uint8_t dma);
Kojto 122:f9eeca106725 556 uint32_t USB_HC_ReadInterrupt (USB_OTG_GlobalTypeDef *USBx);
Kojto 122:f9eeca106725 557 HAL_StatusTypeDef USB_HC_Halt(USB_OTG_GlobalTypeDef *USBx , uint8_t hc_num);
Kojto 122:f9eeca106725 558 HAL_StatusTypeDef USB_DoPing(USB_OTG_GlobalTypeDef *USBx , uint8_t ch_num);
Kojto 122:f9eeca106725 559 HAL_StatusTypeDef USB_StopHost(USB_OTG_GlobalTypeDef *USBx);
Kojto 122:f9eeca106725 560 HAL_StatusTypeDef USB_ActivateRemoteWakeup(USB_OTG_GlobalTypeDef *USBx);
Kojto 122:f9eeca106725 561 HAL_StatusTypeDef USB_DeActivateRemoteWakeup(USB_OTG_GlobalTypeDef *USBx);
Kojto 122:f9eeca106725 562 #endif /* USB_OTG_FS */
Kojto 122:f9eeca106725 563
Kojto 122:f9eeca106725 564 #if defined (USB)
Kojto 122:f9eeca106725 565 HAL_StatusTypeDef USB_CoreInit(USB_TypeDef *USBx, USB_CfgTypeDef Init);
Kojto 122:f9eeca106725 566 HAL_StatusTypeDef USB_DevInit(USB_TypeDef *USBx, USB_CfgTypeDef Init);
Kojto 122:f9eeca106725 567 HAL_StatusTypeDef USB_EnableGlobalInt(USB_TypeDef *USBx);
Kojto 122:f9eeca106725 568 HAL_StatusTypeDef USB_DisableGlobalInt(USB_TypeDef *USBx);
Kojto 122:f9eeca106725 569 HAL_StatusTypeDef USB_SetCurrentMode(USB_TypeDef *USBx , USB_ModeTypeDef mode);
Kojto 122:f9eeca106725 570 HAL_StatusTypeDef USB_SetDevSpeed(USB_TypeDef *USBx , uint8_t speed);
Kojto 122:f9eeca106725 571 HAL_StatusTypeDef USB_FlushRxFifo (USB_TypeDef *USBx);
Kojto 122:f9eeca106725 572 HAL_StatusTypeDef USB_FlushTxFifo (USB_TypeDef *USBx, uint32_t num );
Kojto 122:f9eeca106725 573 HAL_StatusTypeDef USB_ActivateEndpoint(USB_TypeDef *USBx, USB_EPTypeDef *ep);
Kojto 122:f9eeca106725 574 HAL_StatusTypeDef USB_DeactivateEndpoint(USB_TypeDef *USBx, USB_EPTypeDef *ep);
Kojto 122:f9eeca106725 575 HAL_StatusTypeDef USB_EPStartXfer(USB_TypeDef *USBx , USB_EPTypeDef *ep ,uint8_t dma);
Kojto 122:f9eeca106725 576 HAL_StatusTypeDef USB_WritePacket(USB_TypeDef *USBx, uint8_t *src, uint8_t ch_ep_num, uint16_t len);
Kojto 122:f9eeca106725 577 void * USB_ReadPacket(USB_TypeDef *USBx, uint8_t *dest, uint16_t len);
Kojto 122:f9eeca106725 578 HAL_StatusTypeDef USB_EPSetStall(USB_TypeDef *USBx , USB_EPTypeDef *ep);
Kojto 122:f9eeca106725 579 HAL_StatusTypeDef USB_EPClearStall(USB_TypeDef *USBx , USB_EPTypeDef *ep);
Kojto 122:f9eeca106725 580 HAL_StatusTypeDef USB_SetDevAddress (USB_TypeDef *USBx, uint8_t address);
Kojto 122:f9eeca106725 581 HAL_StatusTypeDef USB_DevConnect (USB_TypeDef *USBx);
Kojto 122:f9eeca106725 582 HAL_StatusTypeDef USB_DevDisconnect (USB_TypeDef *USBx);
Kojto 122:f9eeca106725 583 HAL_StatusTypeDef USB_StopDevice(USB_TypeDef *USBx);
Kojto 122:f9eeca106725 584 HAL_StatusTypeDef USB_EP0_OutStart(USB_TypeDef *USBx, uint8_t dma, uint8_t *psetup);
Kojto 122:f9eeca106725 585 uint32_t USB_ReadInterrupts (USB_TypeDef *USBx);
Kojto 122:f9eeca106725 586 uint32_t USB_ReadDevAllOutEpInterrupt (USB_TypeDef *USBx);
Kojto 122:f9eeca106725 587 uint32_t USB_ReadDevOutEPInterrupt (USB_TypeDef *USBx , uint8_t epnum);
Kojto 122:f9eeca106725 588 uint32_t USB_ReadDevAllInEpInterrupt (USB_TypeDef *USBx);
Kojto 122:f9eeca106725 589 uint32_t USB_ReadDevInEPInterrupt (USB_TypeDef *USBx , uint8_t epnum);
Kojto 122:f9eeca106725 590 void USB_ClearInterrupts (USB_TypeDef *USBx, uint32_t interrupt);
Kojto 122:f9eeca106725 591
Kojto 122:f9eeca106725 592 HAL_StatusTypeDef USB_ActivateRemoteWakeup(USB_TypeDef *USBx);
Kojto 122:f9eeca106725 593 HAL_StatusTypeDef USB_DeActivateRemoteWakeup(USB_TypeDef *USBx);
Kojto 122:f9eeca106725 594 void USB_WritePMA(USB_TypeDef *USBx, uint8_t *pbUsrBuf, uint16_t wPMABufAddr, uint16_t wNBytes);
Kojto 122:f9eeca106725 595 void USB_ReadPMA(USB_TypeDef *USBx, uint8_t *pbUsrBuf, uint16_t wPMABufAddr, uint16_t wNBytes);
Kojto 122:f9eeca106725 596 #endif /* USB */
Kojto 122:f9eeca106725 597 /**
Kojto 122:f9eeca106725 598 * @}
Kojto 122:f9eeca106725 599 */
Kojto 122:f9eeca106725 600
Kojto 122:f9eeca106725 601 /**
Kojto 122:f9eeca106725 602 * @}
Kojto 122:f9eeca106725 603 */
Kojto 122:f9eeca106725 604
Kojto 122:f9eeca106725 605 #endif /* STM32L475xx || STM32L476xx || */
Kojto 122:f9eeca106725 606 /* STM32L485xx || STM32L486xx || */
Kojto 122:f9eeca106725 607 /* STM32L432xx || STM32L433xx || */
Kojto 122:f9eeca106725 608 /* STM32L442xx || STM32L443xx */
Kojto 122:f9eeca106725 609
Kojto 122:f9eeca106725 610 #ifdef __cplusplus
Kojto 122:f9eeca106725 611 }
Kojto 122:f9eeca106725 612 #endif
Kojto 122:f9eeca106725 613
Kojto 122:f9eeca106725 614
Kojto 122:f9eeca106725 615 #endif /* __STM32L4xx_LL_USB_H */
Kojto 122:f9eeca106725 616
Kojto 122:f9eeca106725 617 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/