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