mbed(SerialHalfDuplex入り)
Fork of mbed by
TARGET_NUCLEO_F302R8/stm32f3xx_hal_pcd.h@90:cb3d968589d8, 2014-10-28 (annotated)
- Committer:
- Kojto
- Date:
- Tue Oct 28 16:40:41 2014 +0000
- Revision:
- 90:cb3d968589d8
Release 90 of the mbed library
Changes:
- Freescale KSDK update (v1.0)
- K22 - new target addition
- KL43Z - new target addition
- Nucleo F091RC - new target addition
- Nucleo L152RE - STM32Cube driver
- Nordic - Softdevice v7.1.0
- Nvic files - BSD License
- LPC824 - various HAL fixes
- Nucleo F411RE - CMSIS - IAR files
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Kojto | 90:cb3d968589d8 | 1 | /** |
Kojto | 90:cb3d968589d8 | 2 | ****************************************************************************** |
Kojto | 90:cb3d968589d8 | 3 | * @file stm32f3xx_hal_pcd.h |
Kojto | 90:cb3d968589d8 | 4 | * @author MCD Application Team |
Kojto | 90:cb3d968589d8 | 5 | * @version V1.1.0 |
Kojto | 90:cb3d968589d8 | 6 | * @date 12-Sept-2014 |
Kojto | 90:cb3d968589d8 | 7 | * @brief Header file of PCD HAL module. |
Kojto | 90:cb3d968589d8 | 8 | ****************************************************************************** |
Kojto | 90:cb3d968589d8 | 9 | * @attention |
Kojto | 90:cb3d968589d8 | 10 | * |
Kojto | 90:cb3d968589d8 | 11 | * <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2> |
Kojto | 90:cb3d968589d8 | 12 | * |
Kojto | 90:cb3d968589d8 | 13 | * Redistribution and use in source and binary forms, with or without modification, |
Kojto | 90:cb3d968589d8 | 14 | * are permitted provided that the following conditions are met: |
Kojto | 90:cb3d968589d8 | 15 | * 1. Redistributions of source code must retain the above copyright notice, |
Kojto | 90:cb3d968589d8 | 16 | * this list of conditions and the following disclaimer. |
Kojto | 90:cb3d968589d8 | 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
Kojto | 90:cb3d968589d8 | 18 | * this list of conditions and the following disclaimer in the documentation |
Kojto | 90:cb3d968589d8 | 19 | * and/or other materials provided with the distribution. |
Kojto | 90:cb3d968589d8 | 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
Kojto | 90:cb3d968589d8 | 21 | * may be used to endorse or promote products derived from this software |
Kojto | 90:cb3d968589d8 | 22 | * without specific prior written permission. |
Kojto | 90:cb3d968589d8 | 23 | * |
Kojto | 90:cb3d968589d8 | 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
Kojto | 90:cb3d968589d8 | 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
Kojto | 90:cb3d968589d8 | 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
Kojto | 90:cb3d968589d8 | 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
Kojto | 90:cb3d968589d8 | 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
Kojto | 90:cb3d968589d8 | 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
Kojto | 90:cb3d968589d8 | 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
Kojto | 90:cb3d968589d8 | 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
Kojto | 90:cb3d968589d8 | 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
Kojto | 90:cb3d968589d8 | 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
Kojto | 90:cb3d968589d8 | 34 | * |
Kojto | 90:cb3d968589d8 | 35 | ****************************************************************************** |
Kojto | 90:cb3d968589d8 | 36 | */ |
Kojto | 90:cb3d968589d8 | 37 | |
Kojto | 90:cb3d968589d8 | 38 | /* Define to prevent recursive inclusion -------------------------------------*/ |
Kojto | 90:cb3d968589d8 | 39 | #ifndef __STM32F3xx_HAL_PCD_H |
Kojto | 90:cb3d968589d8 | 40 | #define __STM32F3xx_HAL_PCD_H |
Kojto | 90:cb3d968589d8 | 41 | |
Kojto | 90:cb3d968589d8 | 42 | #ifdef __cplusplus |
Kojto | 90:cb3d968589d8 | 43 | extern "C" { |
Kojto | 90:cb3d968589d8 | 44 | #endif |
Kojto | 90:cb3d968589d8 | 45 | |
Kojto | 90:cb3d968589d8 | 46 | #if defined(STM32F302xE) || defined(STM32F303xE) || \ |
Kojto | 90:cb3d968589d8 | 47 | defined(STM32F302xC) || defined(STM32F303xC) || \ |
Kojto | 90:cb3d968589d8 | 48 | defined(STM32F302x8) || \ |
Kojto | 90:cb3d968589d8 | 49 | defined(STM32F373xC) |
Kojto | 90:cb3d968589d8 | 50 | |
Kojto | 90:cb3d968589d8 | 51 | /* Includes ------------------------------------------------------------------*/ |
Kojto | 90:cb3d968589d8 | 52 | #include "stm32f3xx_hal_def.h" |
Kojto | 90:cb3d968589d8 | 53 | |
Kojto | 90:cb3d968589d8 | 54 | /** @addtogroup STM32F3xx_HAL_Driver |
Kojto | 90:cb3d968589d8 | 55 | * @{ |
Kojto | 90:cb3d968589d8 | 56 | */ |
Kojto | 90:cb3d968589d8 | 57 | |
Kojto | 90:cb3d968589d8 | 58 | /** @addtogroup PCD |
Kojto | 90:cb3d968589d8 | 59 | * @{ |
Kojto | 90:cb3d968589d8 | 60 | */ |
Kojto | 90:cb3d968589d8 | 61 | |
Kojto | 90:cb3d968589d8 | 62 | /* Exported types ------------------------------------------------------------*/ |
Kojto | 90:cb3d968589d8 | 63 | /** @defgroup PCD_Exported_Types PCD Exported Types |
Kojto | 90:cb3d968589d8 | 64 | * @{ |
Kojto | 90:cb3d968589d8 | 65 | */ |
Kojto | 90:cb3d968589d8 | 66 | |
Kojto | 90:cb3d968589d8 | 67 | /** |
Kojto | 90:cb3d968589d8 | 68 | * @brief PCD State structures definition |
Kojto | 90:cb3d968589d8 | 69 | */ |
Kojto | 90:cb3d968589d8 | 70 | typedef enum |
Kojto | 90:cb3d968589d8 | 71 | { |
Kojto | 90:cb3d968589d8 | 72 | PCD_READY = 0x00, |
Kojto | 90:cb3d968589d8 | 73 | PCD_ERROR = 0x01, |
Kojto | 90:cb3d968589d8 | 74 | PCD_BUSY = 0x02, |
Kojto | 90:cb3d968589d8 | 75 | PCD_TIMEOUT = 0x03 |
Kojto | 90:cb3d968589d8 | 76 | } PCD_StateTypeDef; |
Kojto | 90:cb3d968589d8 | 77 | |
Kojto | 90:cb3d968589d8 | 78 | typedef enum |
Kojto | 90:cb3d968589d8 | 79 | { |
Kojto | 90:cb3d968589d8 | 80 | /* double buffered endpoint direction */ |
Kojto | 90:cb3d968589d8 | 81 | PCD_EP_DBUF_OUT, |
Kojto | 90:cb3d968589d8 | 82 | PCD_EP_DBUF_IN, |
Kojto | 90:cb3d968589d8 | 83 | PCD_EP_DBUF_ERR, |
Kojto | 90:cb3d968589d8 | 84 | }PCD_EP_DBUF_DIR; |
Kojto | 90:cb3d968589d8 | 85 | |
Kojto | 90:cb3d968589d8 | 86 | /* endpoint buffer number */ |
Kojto | 90:cb3d968589d8 | 87 | typedef enum |
Kojto | 90:cb3d968589d8 | 88 | { |
Kojto | 90:cb3d968589d8 | 89 | PCD_EP_NOBUF, |
Kojto | 90:cb3d968589d8 | 90 | PCD_EP_BUF0, |
Kojto | 90:cb3d968589d8 | 91 | PCD_EP_BUF1 |
Kojto | 90:cb3d968589d8 | 92 | }PCD_EP_BUF_NUM; |
Kojto | 90:cb3d968589d8 | 93 | |
Kojto | 90:cb3d968589d8 | 94 | /** |
Kojto | 90:cb3d968589d8 | 95 | * @brief PCD Initialization Structure definition |
Kojto | 90:cb3d968589d8 | 96 | */ |
Kojto | 90:cb3d968589d8 | 97 | typedef struct |
Kojto | 90:cb3d968589d8 | 98 | { |
Kojto | 90:cb3d968589d8 | 99 | uint32_t dev_endpoints; /*!< Device Endpoints number. |
Kojto | 90:cb3d968589d8 | 100 | This parameter depends on the used USB core. |
Kojto | 90:cb3d968589d8 | 101 | This parameter must be a number between Min_Data = 1 and Max_Data = 15 */ |
Kojto | 90:cb3d968589d8 | 102 | |
Kojto | 90:cb3d968589d8 | 103 | uint32_t speed; /*!< USB Core speed. |
Kojto | 90:cb3d968589d8 | 104 | This parameter can be any value of @ref USB_Core_Speed */ |
Kojto | 90:cb3d968589d8 | 105 | |
Kojto | 90:cb3d968589d8 | 106 | uint32_t ep0_mps; /*!< Set the Endpoint 0 Max Packet size. |
Kojto | 90:cb3d968589d8 | 107 | This parameter can be any value of @ref USB_EP0_MPS */ |
Kojto | 90:cb3d968589d8 | 108 | |
Kojto | 90:cb3d968589d8 | 109 | uint32_t phy_itface; /*!< Select the used PHY interface. |
Kojto | 90:cb3d968589d8 | 110 | This parameter can be any value of @ref USB_Core_PHY */ |
Kojto | 90:cb3d968589d8 | 111 | |
Kojto | 90:cb3d968589d8 | 112 | uint32_t Sof_enable; /*!< Enable or disable the output of the SOF signal. */ |
Kojto | 90:cb3d968589d8 | 113 | |
Kojto | 90:cb3d968589d8 | 114 | uint32_t low_power_enable; /*!< Enable or disable Low Power mode */ |
Kojto | 90:cb3d968589d8 | 115 | |
Kojto | 90:cb3d968589d8 | 116 | uint32_t lpm_enable; /*!< Enable or disable Battery charging. */ |
Kojto | 90:cb3d968589d8 | 117 | |
Kojto | 90:cb3d968589d8 | 118 | uint32_t battery_charging_enable; /*!< Enable or disable Battery charging. */ |
Kojto | 90:cb3d968589d8 | 119 | |
Kojto | 90:cb3d968589d8 | 120 | }PCD_InitTypeDef; |
Kojto | 90:cb3d968589d8 | 121 | |
Kojto | 90:cb3d968589d8 | 122 | typedef struct |
Kojto | 90:cb3d968589d8 | 123 | { |
Kojto | 90:cb3d968589d8 | 124 | uint8_t num; /*!< Endpoint number |
Kojto | 90:cb3d968589d8 | 125 | This parameter must be a number between Min_Data = 1 and Max_Data = 15 */ |
Kojto | 90:cb3d968589d8 | 126 | |
Kojto | 90:cb3d968589d8 | 127 | uint8_t is_in; /*!< Endpoint direction |
Kojto | 90:cb3d968589d8 | 128 | This parameter must be a number between Min_Data = 0 and Max_Data = 1 */ |
Kojto | 90:cb3d968589d8 | 129 | |
Kojto | 90:cb3d968589d8 | 130 | uint8_t is_stall; /*!< Endpoint stall condition |
Kojto | 90:cb3d968589d8 | 131 | This parameter must be a number between Min_Data = 0 and Max_Data = 1 */ |
Kojto | 90:cb3d968589d8 | 132 | |
Kojto | 90:cb3d968589d8 | 133 | uint8_t type; /*!< Endpoint type |
Kojto | 90:cb3d968589d8 | 134 | This parameter can be any value of @ref USB_EP_Type */ |
Kojto | 90:cb3d968589d8 | 135 | |
Kojto | 90:cb3d968589d8 | 136 | uint16_t pmaadress; /*!< PMA Address |
Kojto | 90:cb3d968589d8 | 137 | This parameter can be any value between Min_addr = 0 and Max_addr = 1K */ |
Kojto | 90:cb3d968589d8 | 138 | |
Kojto | 90:cb3d968589d8 | 139 | |
Kojto | 90:cb3d968589d8 | 140 | uint16_t pmaaddr0; /*!< PMA Address0 |
Kojto | 90:cb3d968589d8 | 141 | This parameter can be any value between Min_addr = 0 and Max_addr = 1K */ |
Kojto | 90:cb3d968589d8 | 142 | |
Kojto | 90:cb3d968589d8 | 143 | |
Kojto | 90:cb3d968589d8 | 144 | uint16_t pmaaddr1; /*!< PMA Address1 |
Kojto | 90:cb3d968589d8 | 145 | This parameter can be any value between Min_addr = 0 and Max_addr = 1K */ |
Kojto | 90:cb3d968589d8 | 146 | |
Kojto | 90:cb3d968589d8 | 147 | |
Kojto | 90:cb3d968589d8 | 148 | uint8_t doublebuffer; /*!< Double buffer enable |
Kojto | 90:cb3d968589d8 | 149 | This parameter can be 0 or 1 */ |
Kojto | 90:cb3d968589d8 | 150 | |
Kojto | 90:cb3d968589d8 | 151 | uint32_t maxpacket; /*!< Endpoint Max packet size |
Kojto | 90:cb3d968589d8 | 152 | This parameter must be a number between Min_Data = 0 and Max_Data = 64KB */ |
Kojto | 90:cb3d968589d8 | 153 | |
Kojto | 90:cb3d968589d8 | 154 | uint8_t *xfer_buff; /*!< Pointer to transfer buffer */ |
Kojto | 90:cb3d968589d8 | 155 | |
Kojto | 90:cb3d968589d8 | 156 | |
Kojto | 90:cb3d968589d8 | 157 | uint32_t xfer_len; /*!< Current transfer length */ |
Kojto | 90:cb3d968589d8 | 158 | |
Kojto | 90:cb3d968589d8 | 159 | uint32_t xfer_count; /*!< Partial transfer length in case of multi packet transfer */ |
Kojto | 90:cb3d968589d8 | 160 | |
Kojto | 90:cb3d968589d8 | 161 | }PCD_EPTypeDef; |
Kojto | 90:cb3d968589d8 | 162 | |
Kojto | 90:cb3d968589d8 | 163 | typedef USB_TypeDef PCD_TypeDef; |
Kojto | 90:cb3d968589d8 | 164 | |
Kojto | 90:cb3d968589d8 | 165 | /** |
Kojto | 90:cb3d968589d8 | 166 | * @brief PCD Handle Structure definition |
Kojto | 90:cb3d968589d8 | 167 | */ |
Kojto | 90:cb3d968589d8 | 168 | typedef struct |
Kojto | 90:cb3d968589d8 | 169 | { |
Kojto | 90:cb3d968589d8 | 170 | PCD_TypeDef *Instance; /*!< Register base address */ |
Kojto | 90:cb3d968589d8 | 171 | PCD_InitTypeDef Init; /*!< PCD required parameters */ |
Kojto | 90:cb3d968589d8 | 172 | __IO uint8_t USB_Address; /*!< USB Address */ |
Kojto | 90:cb3d968589d8 | 173 | PCD_EPTypeDef IN_ep[8]; /*!< IN endpoint parameters */ |
Kojto | 90:cb3d968589d8 | 174 | PCD_EPTypeDef OUT_ep[8]; /*!< OUT endpoint parameters */ |
Kojto | 90:cb3d968589d8 | 175 | HAL_LockTypeDef Lock; /*!< PCD peripheral status */ |
Kojto | 90:cb3d968589d8 | 176 | __IO PCD_StateTypeDef State; /*!< PCD communication state */ |
Kojto | 90:cb3d968589d8 | 177 | uint32_t Setup[12]; /*!< Setup packet buffer */ |
Kojto | 90:cb3d968589d8 | 178 | void *pData; /*!< Pointer to upper stack Handler */ |
Kojto | 90:cb3d968589d8 | 179 | |
Kojto | 90:cb3d968589d8 | 180 | } PCD_HandleTypeDef; |
Kojto | 90:cb3d968589d8 | 181 | |
Kojto | 90:cb3d968589d8 | 182 | /** |
Kojto | 90:cb3d968589d8 | 183 | * @} |
Kojto | 90:cb3d968589d8 | 184 | */ |
Kojto | 90:cb3d968589d8 | 185 | |
Kojto | 90:cb3d968589d8 | 186 | #include "stm32f3xx_hal_pcd_ex.h" |
Kojto | 90:cb3d968589d8 | 187 | /* Exported constants --------------------------------------------------------*/ |
Kojto | 90:cb3d968589d8 | 188 | /** @defgroup PCD_Exported_Constants PCD Exported Constants |
Kojto | 90:cb3d968589d8 | 189 | * @{ |
Kojto | 90:cb3d968589d8 | 190 | */ |
Kojto | 90:cb3d968589d8 | 191 | |
Kojto | 90:cb3d968589d8 | 192 | /** @defgroup USB_Core_Speed USB Core Speed |
Kojto | 90:cb3d968589d8 | 193 | * @{ |
Kojto | 90:cb3d968589d8 | 194 | */ |
Kojto | 90:cb3d968589d8 | 195 | #define PCD_SPEED_HIGH 0 /* Not Supported */ |
Kojto | 90:cb3d968589d8 | 196 | #define PCD_SPEED_FULL 2 |
Kojto | 90:cb3d968589d8 | 197 | /** |
Kojto | 90:cb3d968589d8 | 198 | * @} |
Kojto | 90:cb3d968589d8 | 199 | */ |
Kojto | 90:cb3d968589d8 | 200 | |
Kojto | 90:cb3d968589d8 | 201 | /** @defgroup USB_Core_PHY USB Core PHY |
Kojto | 90:cb3d968589d8 | 202 | * @{ |
Kojto | 90:cb3d968589d8 | 203 | */ |
Kojto | 90:cb3d968589d8 | 204 | #define PCD_PHY_EMBEDDED 2 |
Kojto | 90:cb3d968589d8 | 205 | /** |
Kojto | 90:cb3d968589d8 | 206 | * @} |
Kojto | 90:cb3d968589d8 | 207 | */ |
Kojto | 90:cb3d968589d8 | 208 | |
Kojto | 90:cb3d968589d8 | 209 | /** @defgroup USB_EP0_MPS USB EP0 MPS |
Kojto | 90:cb3d968589d8 | 210 | * @{ |
Kojto | 90:cb3d968589d8 | 211 | */ |
Kojto | 90:cb3d968589d8 | 212 | #define DEP0CTL_MPS_64 0 |
Kojto | 90:cb3d968589d8 | 213 | #define DEP0CTL_MPS_32 1 |
Kojto | 90:cb3d968589d8 | 214 | #define DEP0CTL_MPS_16 2 |
Kojto | 90:cb3d968589d8 | 215 | #define DEP0CTL_MPS_8 3 |
Kojto | 90:cb3d968589d8 | 216 | |
Kojto | 90:cb3d968589d8 | 217 | #define PCD_EP0MPS_64 DEP0CTL_MPS_64 |
Kojto | 90:cb3d968589d8 | 218 | #define PCD_EP0MPS_32 DEP0CTL_MPS_32 |
Kojto | 90:cb3d968589d8 | 219 | #define PCD_EP0MPS_16 DEP0CTL_MPS_16 |
Kojto | 90:cb3d968589d8 | 220 | #define PCD_EP0MPS_08 DEP0CTL_MPS_8 |
Kojto | 90:cb3d968589d8 | 221 | /** |
Kojto | 90:cb3d968589d8 | 222 | * @} |
Kojto | 90:cb3d968589d8 | 223 | */ |
Kojto | 90:cb3d968589d8 | 224 | |
Kojto | 90:cb3d968589d8 | 225 | /** @defgroup USB_EP_Type USB EP Type |
Kojto | 90:cb3d968589d8 | 226 | * @{ |
Kojto | 90:cb3d968589d8 | 227 | */ |
Kojto | 90:cb3d968589d8 | 228 | #define PCD_EP_TYPE_CTRL 0 |
Kojto | 90:cb3d968589d8 | 229 | #define PCD_EP_TYPE_ISOC 1 |
Kojto | 90:cb3d968589d8 | 230 | #define PCD_EP_TYPE_BULK 2 |
Kojto | 90:cb3d968589d8 | 231 | #define PCD_EP_TYPE_INTR 3 |
Kojto | 90:cb3d968589d8 | 232 | /** |
Kojto | 90:cb3d968589d8 | 233 | * @} |
Kojto | 90:cb3d968589d8 | 234 | */ |
Kojto | 90:cb3d968589d8 | 235 | |
Kojto | 90:cb3d968589d8 | 236 | /** @defgroup USB_ENDP USB ENDP |
Kojto | 90:cb3d968589d8 | 237 | * @{ |
Kojto | 90:cb3d968589d8 | 238 | */ |
Kojto | 90:cb3d968589d8 | 239 | |
Kojto | 90:cb3d968589d8 | 240 | #define PCD_ENDP0 ((uint8_t)0) |
Kojto | 90:cb3d968589d8 | 241 | #define PCD_ENDP1 ((uint8_t)1) |
Kojto | 90:cb3d968589d8 | 242 | #define PCD_ENDP2 ((uint8_t)2) |
Kojto | 90:cb3d968589d8 | 243 | #define PCD_ENDP3 ((uint8_t)3) |
Kojto | 90:cb3d968589d8 | 244 | #define PCD_ENDP4 ((uint8_t)4) |
Kojto | 90:cb3d968589d8 | 245 | #define PCD_ENDP5 ((uint8_t)5) |
Kojto | 90:cb3d968589d8 | 246 | #define PCD_ENDP6 ((uint8_t)6) |
Kojto | 90:cb3d968589d8 | 247 | #define PCD_ENDP7 ((uint8_t)7) |
Kojto | 90:cb3d968589d8 | 248 | |
Kojto | 90:cb3d968589d8 | 249 | /* Endpoint Kind */ |
Kojto | 90:cb3d968589d8 | 250 | #define PCD_SNG_BUF 0 |
Kojto | 90:cb3d968589d8 | 251 | #define PCD_DBL_BUF 1 |
Kojto | 90:cb3d968589d8 | 252 | |
Kojto | 90:cb3d968589d8 | 253 | #define IS_PCD_ALL_INSTANCE IS_USB_ALL_INSTANCE |
Kojto | 90:cb3d968589d8 | 254 | |
Kojto | 90:cb3d968589d8 | 255 | /** |
Kojto | 90:cb3d968589d8 | 256 | * @} |
Kojto | 90:cb3d968589d8 | 257 | */ |
Kojto | 90:cb3d968589d8 | 258 | |
Kojto | 90:cb3d968589d8 | 259 | /** |
Kojto | 90:cb3d968589d8 | 260 | * @} |
Kojto | 90:cb3d968589d8 | 261 | */ |
Kojto | 90:cb3d968589d8 | 262 | |
Kojto | 90:cb3d968589d8 | 263 | /* Exported macros -----------------------------------------------------------*/ |
Kojto | 90:cb3d968589d8 | 264 | |
Kojto | 90:cb3d968589d8 | 265 | /** @defgroup PCD_Exported_Macros PCD Exported Macros |
Kojto | 90:cb3d968589d8 | 266 | * @brief macros to handle interrupts and specific clock configurations |
Kojto | 90:cb3d968589d8 | 267 | * @{ |
Kojto | 90:cb3d968589d8 | 268 | */ |
Kojto | 90:cb3d968589d8 | 269 | #define __HAL_PCD_GET_FLAG(__HANDLE__, __INTERRUPT__) ((((__HANDLE__)->Instance->ISTR) & (__INTERRUPT__)) == (__INTERRUPT__)) |
Kojto | 90:cb3d968589d8 | 270 | #define __HAL_PCD_CLEAR_FLAG(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->ISTR) = ~(__INTERRUPT__)) |
Kojto | 90:cb3d968589d8 | 271 | |
Kojto | 90:cb3d968589d8 | 272 | #define USB_EXTI_LINE_WAKEUP ((uint32_t)0x00040000) /*!< External interrupt line 18 Connected to the USB FS EXTI Line */ |
Kojto | 90:cb3d968589d8 | 273 | |
Kojto | 90:cb3d968589d8 | 274 | #define __HAL_USB_EXTI_ENABLE_IT() EXTI->IMR |= USB_EXTI_LINE_WAKEUP |
Kojto | 90:cb3d968589d8 | 275 | #define __HAL_USB_EXTI_DISABLE_IT() EXTI->IMR &= ~(USB_EXTI_LINE_WAKEUP) |
Kojto | 90:cb3d968589d8 | 276 | #define __HAL_USB_EXTI_GENERATE_SWIT(__EXTILINE__) (EXTI->SWIER |= (__EXTILINE__)) |
Kojto | 90:cb3d968589d8 | 277 | |
Kojto | 90:cb3d968589d8 | 278 | #define __HAL_USB_EXTI_GET_FLAG() EXTI->PR & (USB_EXTI_LINE_WAKEUP) |
Kojto | 90:cb3d968589d8 | 279 | #define __HAL_USB_EXTI_CLEAR_FLAG() EXTI->PR = USB_EXTI_LINE_WAKEUP |
Kojto | 90:cb3d968589d8 | 280 | |
Kojto | 90:cb3d968589d8 | 281 | #define __HAL_USB_EXTI_SET_RISING_EDGE_TRIGGER() do {\ |
Kojto | 90:cb3d968589d8 | 282 | EXTI->FTSR &= ~(USB_EXTI_LINE_WAKEUP);\ |
Kojto | 90:cb3d968589d8 | 283 | EXTI->RTSR |= USB_EXTI_LINE_WAKEUP;\ |
Kojto | 90:cb3d968589d8 | 284 | } while(0) |
Kojto | 90:cb3d968589d8 | 285 | |
Kojto | 90:cb3d968589d8 | 286 | #define __HAL_USB_EXTI_SET_FALLING_EDGE_TRIGGER() do {\ |
Kojto | 90:cb3d968589d8 | 287 | EXTI->FTSR |= (USB_EXTI_LINE_WAKEUP);\ |
Kojto | 90:cb3d968589d8 | 288 | EXTI->RTSR &= ~(USB_EXTI_LINE_WAKEUP);\ |
Kojto | 90:cb3d968589d8 | 289 | } while(0) |
Kojto | 90:cb3d968589d8 | 290 | |
Kojto | 90:cb3d968589d8 | 291 | #define __HAL_USB_EXTI_SET_FALLINGRISING_TRIGGER() do {\ |
Kojto | 90:cb3d968589d8 | 292 | EXTI->RTSR &= ~(USB_EXTI_LINE_WAKEUP);\ |
Kojto | 90:cb3d968589d8 | 293 | EXTI->FTSR &= ~(USB_EXTI_LINE_WAKEUP);\ |
Kojto | 90:cb3d968589d8 | 294 | EXTI->RTSR |= USB_EXTI_LINE_WAKEUP;\ |
Kojto | 90:cb3d968589d8 | 295 | EXTI->FTSR |= USB_EXTI_LINE_WAKEUP;\ |
Kojto | 90:cb3d968589d8 | 296 | } while(0) |
Kojto | 90:cb3d968589d8 | 297 | /** |
Kojto | 90:cb3d968589d8 | 298 | * @} |
Kojto | 90:cb3d968589d8 | 299 | */ |
Kojto | 90:cb3d968589d8 | 300 | |
Kojto | 90:cb3d968589d8 | 301 | /* Internal macros -----------------------------------------------------------*/ |
Kojto | 90:cb3d968589d8 | 302 | |
Kojto | 90:cb3d968589d8 | 303 | /** @defgroup PCD_Private_Macros PCD Private Macros |
Kojto | 90:cb3d968589d8 | 304 | * @brief macros to handle interrupts and specific clock configurations |
Kojto | 90:cb3d968589d8 | 305 | * @{ |
Kojto | 90:cb3d968589d8 | 306 | */ |
Kojto | 90:cb3d968589d8 | 307 | |
Kojto | 90:cb3d968589d8 | 308 | /* SetENDPOINT */ |
Kojto | 90:cb3d968589d8 | 309 | #define PCD_SET_ENDPOINT(USBx, bEpNum,wRegValue) (*(&USBx->EP0R + bEpNum * 2)= (uint16_t)wRegValue) |
Kojto | 90:cb3d968589d8 | 310 | |
Kojto | 90:cb3d968589d8 | 311 | /* GetENDPOINT */ |
Kojto | 90:cb3d968589d8 | 312 | #define PCD_GET_ENDPOINT(USBx, bEpNum) (*(&USBx->EP0R + bEpNum * 2)) |
Kojto | 90:cb3d968589d8 | 313 | |
Kojto | 90:cb3d968589d8 | 314 | |
Kojto | 90:cb3d968589d8 | 315 | |
Kojto | 90:cb3d968589d8 | 316 | /** |
Kojto | 90:cb3d968589d8 | 317 | * @brief sets the type in the endpoint register(bits EP_TYPE[1:0]) |
Kojto | 90:cb3d968589d8 | 318 | * @param USBx: USB peripheral instance register address. |
Kojto | 90:cb3d968589d8 | 319 | * @param bEpNum: Endpoint Number. |
Kojto | 90:cb3d968589d8 | 320 | * @param wType: Endpoint Type. |
Kojto | 90:cb3d968589d8 | 321 | * @retval None |
Kojto | 90:cb3d968589d8 | 322 | */ |
Kojto | 90:cb3d968589d8 | 323 | #define PCD_SET_EPTYPE(USBx, bEpNum,wType) (PCD_SET_ENDPOINT(USBx, bEpNum,\ |
Kojto | 90:cb3d968589d8 | 324 | ((PCD_GET_ENDPOINT(USBx, bEpNum) & USB_EP_T_MASK) | wType ))) |
Kojto | 90:cb3d968589d8 | 325 | |
Kojto | 90:cb3d968589d8 | 326 | /** |
Kojto | 90:cb3d968589d8 | 327 | * @brief gets the type in the endpoint register(bits EP_TYPE[1:0]) |
Kojto | 90:cb3d968589d8 | 328 | * @param USBx: USB peripheral instance register address. |
Kojto | 90:cb3d968589d8 | 329 | * @param bEpNum: Endpoint Number. |
Kojto | 90:cb3d968589d8 | 330 | * @retval Endpoint Type |
Kojto | 90:cb3d968589d8 | 331 | */ |
Kojto | 90:cb3d968589d8 | 332 | #define PCD_GET_EPTYPE(USBx, bEpNum) (PCD_GET_ENDPOINT(USBx, bEpNum) & USB_EP_T_FIELD) |
Kojto | 90:cb3d968589d8 | 333 | |
Kojto | 90:cb3d968589d8 | 334 | |
Kojto | 90:cb3d968589d8 | 335 | /** |
Kojto | 90:cb3d968589d8 | 336 | * @brief free buffer used from the application realizing it to the line |
Kojto | 90:cb3d968589d8 | 337 | toggles bit SW_BUF in the double buffered endpoint register |
Kojto | 90:cb3d968589d8 | 338 | * @param USBx: USB peripheral instance register address. |
Kojto | 90:cb3d968589d8 | 339 | * @param bEpNum: Endpoint Number. |
Kojto | 90:cb3d968589d8 | 340 | * @param bDir: Direction |
Kojto | 90:cb3d968589d8 | 341 | * @retval None |
Kojto | 90:cb3d968589d8 | 342 | */ |
Kojto | 90:cb3d968589d8 | 343 | #define PCD_FreeUserBuffer(USBx, bEpNum, bDir)\ |
Kojto | 90:cb3d968589d8 | 344 | {\ |
Kojto | 90:cb3d968589d8 | 345 | if (bDir == PCD_EP_DBUF_OUT)\ |
Kojto | 90:cb3d968589d8 | 346 | { /* OUT double buffered endpoint */\ |
Kojto | 90:cb3d968589d8 | 347 | PCD_TX_DTOG(USBx, bEpNum);\ |
Kojto | 90:cb3d968589d8 | 348 | }\ |
Kojto | 90:cb3d968589d8 | 349 | else if (bDir == PCD_EP_DBUF_IN)\ |
Kojto | 90:cb3d968589d8 | 350 | { /* IN double buffered endpoint */\ |
Kojto | 90:cb3d968589d8 | 351 | PCD_RX_DTOG(USBx, bEpNum);\ |
Kojto | 90:cb3d968589d8 | 352 | }\ |
Kojto | 90:cb3d968589d8 | 353 | } |
Kojto | 90:cb3d968589d8 | 354 | |
Kojto | 90:cb3d968589d8 | 355 | /** |
Kojto | 90:cb3d968589d8 | 356 | * @brief gets direction of the double buffered endpoint |
Kojto | 90:cb3d968589d8 | 357 | * @param USBx: USB peripheral instance register address. |
Kojto | 90:cb3d968589d8 | 358 | * @param bEpNum: Endpoint Number. |
Kojto | 90:cb3d968589d8 | 359 | * @retval EP_DBUF_OUT, EP_DBUF_IN, |
Kojto | 90:cb3d968589d8 | 360 | * EP_DBUF_ERR if the endpoint counter not yet programmed. |
Kojto | 90:cb3d968589d8 | 361 | */ |
Kojto | 90:cb3d968589d8 | 362 | #define PCD_GET_DB_DIR(USBx, bEpNum)\ |
Kojto | 90:cb3d968589d8 | 363 | {\ |
Kojto | 90:cb3d968589d8 | 364 | if ((uint16_t)(*PCD_EP_RX_CNT(USBx, bEpNum) & 0xFC00) != 0)\ |
Kojto | 90:cb3d968589d8 | 365 | return(PCD_EP_DBUF_OUT);\ |
Kojto | 90:cb3d968589d8 | 366 | else if (((uint16_t)(*PCD_EP_TX_CNT(USBx, bEpNum)) & 0x03FF) != 0)\ |
Kojto | 90:cb3d968589d8 | 367 | return(PCD_EP_DBUF_IN);\ |
Kojto | 90:cb3d968589d8 | 368 | else\ |
Kojto | 90:cb3d968589d8 | 369 | return(PCD_EP_DBUF_ERR);\ |
Kojto | 90:cb3d968589d8 | 370 | } |
Kojto | 90:cb3d968589d8 | 371 | |
Kojto | 90:cb3d968589d8 | 372 | /** |
Kojto | 90:cb3d968589d8 | 373 | * @brief sets the status for tx transfer (bits STAT_TX[1:0]). |
Kojto | 90:cb3d968589d8 | 374 | * @param USBx: USB peripheral instance register address. |
Kojto | 90:cb3d968589d8 | 375 | * @param bEpNum: Endpoint Number. |
Kojto | 90:cb3d968589d8 | 376 | * @param wState: new state |
Kojto | 90:cb3d968589d8 | 377 | * @retval None |
Kojto | 90:cb3d968589d8 | 378 | */ |
Kojto | 90:cb3d968589d8 | 379 | #define PCD_SET_EP_TX_STATUS(USBx, bEpNum, wState) {\ |
Kojto | 90:cb3d968589d8 | 380 | register uint16_t _wRegVal; \ |
Kojto | 90:cb3d968589d8 | 381 | \ |
Kojto | 90:cb3d968589d8 | 382 | _wRegVal = PCD_GET_ENDPOINT(USBx, bEpNum) & USB_EPTX_DTOGMASK;\ |
Kojto | 90:cb3d968589d8 | 383 | /* toggle first bit ? */ \ |
Kojto | 90:cb3d968589d8 | 384 | if((USB_EPTX_DTOG1 & wState)!= 0) \ |
Kojto | 90:cb3d968589d8 | 385 | _wRegVal ^= USB_EPTX_DTOG1; \ |
Kojto | 90:cb3d968589d8 | 386 | /* toggle second bit ? */ \ |
Kojto | 90:cb3d968589d8 | 387 | if((USB_EPTX_DTOG2 & wState)!= 0) \ |
Kojto | 90:cb3d968589d8 | 388 | _wRegVal ^= USB_EPTX_DTOG2; \ |
Kojto | 90:cb3d968589d8 | 389 | PCD_SET_ENDPOINT(USBx, bEpNum, (_wRegVal | USB_EP_CTR_RX|USB_EP_CTR_TX)); \ |
Kojto | 90:cb3d968589d8 | 390 | } /* PCD_SET_EP_TX_STATUS */ |
Kojto | 90:cb3d968589d8 | 391 | |
Kojto | 90:cb3d968589d8 | 392 | /** |
Kojto | 90:cb3d968589d8 | 393 | * @brief sets the status for rx transfer (bits STAT_TX[1:0]) |
Kojto | 90:cb3d968589d8 | 394 | * @param USBx: USB peripheral instance register address. |
Kojto | 90:cb3d968589d8 | 395 | * @param bEpNum: Endpoint Number. |
Kojto | 90:cb3d968589d8 | 396 | * @param wState: new state |
Kojto | 90:cb3d968589d8 | 397 | * @retval None |
Kojto | 90:cb3d968589d8 | 398 | */ |
Kojto | 90:cb3d968589d8 | 399 | #define PCD_SET_EP_RX_STATUS(USBx, bEpNum,wState) {\ |
Kojto | 90:cb3d968589d8 | 400 | register uint16_t _wRegVal; \ |
Kojto | 90:cb3d968589d8 | 401 | \ |
Kojto | 90:cb3d968589d8 | 402 | _wRegVal = PCD_GET_ENDPOINT(USBx, bEpNum) & USB_EPRX_DTOGMASK;\ |
Kojto | 90:cb3d968589d8 | 403 | /* toggle first bit ? */ \ |
Kojto | 90:cb3d968589d8 | 404 | if((USB_EPRX_DTOG1 & wState)!= 0) \ |
Kojto | 90:cb3d968589d8 | 405 | _wRegVal ^= USB_EPRX_DTOG1; \ |
Kojto | 90:cb3d968589d8 | 406 | /* toggle second bit ? */ \ |
Kojto | 90:cb3d968589d8 | 407 | if((USB_EPRX_DTOG2 & wState)!= 0) \ |
Kojto | 90:cb3d968589d8 | 408 | _wRegVal ^= USB_EPRX_DTOG2; \ |
Kojto | 90:cb3d968589d8 | 409 | PCD_SET_ENDPOINT(USBx, bEpNum, (_wRegVal | USB_EP_CTR_RX|USB_EP_CTR_TX)); \ |
Kojto | 90:cb3d968589d8 | 410 | } /* PCD_SET_EP_RX_STATUS */ |
Kojto | 90:cb3d968589d8 | 411 | |
Kojto | 90:cb3d968589d8 | 412 | /** |
Kojto | 90:cb3d968589d8 | 413 | * @brief sets the status for rx & tx (bits STAT_TX[1:0] & STAT_RX[1:0]) |
Kojto | 90:cb3d968589d8 | 414 | * @param USBx: USB peripheral instance register address. |
Kojto | 90:cb3d968589d8 | 415 | * @param bEpNum: Endpoint Number. |
Kojto | 90:cb3d968589d8 | 416 | * @param wStaterx: new state. |
Kojto | 90:cb3d968589d8 | 417 | * @param wStatetx: new state. |
Kojto | 90:cb3d968589d8 | 418 | * @retval None |
Kojto | 90:cb3d968589d8 | 419 | */ |
Kojto | 90:cb3d968589d8 | 420 | #define PCD_SET_EP_TXRX_STATUS(USBx,bEpNum,wStaterx,wStatetx) {\ |
Kojto | 90:cb3d968589d8 | 421 | register uint32_t _wRegVal; \ |
Kojto | 90:cb3d968589d8 | 422 | \ |
Kojto | 90:cb3d968589d8 | 423 | _wRegVal = PCD_GET_ENDPOINT(USBx, bEpNum) & (USB_EPRX_DTOGMASK |USB_EPTX_STAT) ;\ |
Kojto | 90:cb3d968589d8 | 424 | /* toggle first bit ? */ \ |
Kojto | 90:cb3d968589d8 | 425 | if((USB_EPRX_DTOG1 & wStaterx)!= 0) \ |
Kojto | 90:cb3d968589d8 | 426 | _wRegVal ^= USB_EPRX_DTOG1; \ |
Kojto | 90:cb3d968589d8 | 427 | /* toggle second bit ? */ \ |
Kojto | 90:cb3d968589d8 | 428 | if((USB_EPRX_DTOG2 & wStaterx)!= 0) \ |
Kojto | 90:cb3d968589d8 | 429 | _wRegVal ^= USB_EPRX_DTOG2; \ |
Kojto | 90:cb3d968589d8 | 430 | /* toggle first bit ? */ \ |
Kojto | 90:cb3d968589d8 | 431 | if((USB_EPTX_DTOG1 & wStatetx)!= 0) \ |
Kojto | 90:cb3d968589d8 | 432 | _wRegVal ^= USB_EPTX_DTOG1; \ |
Kojto | 90:cb3d968589d8 | 433 | /* toggle second bit ? */ \ |
Kojto | 90:cb3d968589d8 | 434 | if((USB_EPTX_DTOG2 & wStatetx)!= 0) \ |
Kojto | 90:cb3d968589d8 | 435 | _wRegVal ^= USB_EPTX_DTOG2; \ |
Kojto | 90:cb3d968589d8 | 436 | PCD_SET_ENDPOINT(USBx, bEpNum, _wRegVal | USB_EP_CTR_RX|USB_EP_CTR_TX); \ |
Kojto | 90:cb3d968589d8 | 437 | } /* PCD_SET_EP_TXRX_STATUS */ |
Kojto | 90:cb3d968589d8 | 438 | |
Kojto | 90:cb3d968589d8 | 439 | /** |
Kojto | 90:cb3d968589d8 | 440 | * @brief gets the status for tx/rx transfer (bits STAT_TX[1:0] |
Kojto | 90:cb3d968589d8 | 441 | * /STAT_RX[1:0]) |
Kojto | 90:cb3d968589d8 | 442 | * @param USBx: USB peripheral instance register address. |
Kojto | 90:cb3d968589d8 | 443 | * @param bEpNum: Endpoint Number. |
Kojto | 90:cb3d968589d8 | 444 | * @retval status |
Kojto | 90:cb3d968589d8 | 445 | */ |
Kojto | 90:cb3d968589d8 | 446 | #define PCD_GET_EP_TX_STATUS(USBx, bEpNum) ((uint16_t)PCD_GET_ENDPOINT(USBx, bEpNum) & USB_EPTX_STAT) |
Kojto | 90:cb3d968589d8 | 447 | |
Kojto | 90:cb3d968589d8 | 448 | #define PCD_GET_EP_RX_STATUS(USBx, bEpNum) ((uint16_t)PCD_GET_ENDPOINT(USBx, bEpNum) & USB_EPRX_STAT) |
Kojto | 90:cb3d968589d8 | 449 | |
Kojto | 90:cb3d968589d8 | 450 | /** |
Kojto | 90:cb3d968589d8 | 451 | * @brief sets directly the VALID tx/rx-status into the endpoint register |
Kojto | 90:cb3d968589d8 | 452 | * @param USBx: USB peripheral instance register address. |
Kojto | 90:cb3d968589d8 | 453 | * @param bEpNum: Endpoint Number. |
Kojto | 90:cb3d968589d8 | 454 | * @retval None |
Kojto | 90:cb3d968589d8 | 455 | */ |
Kojto | 90:cb3d968589d8 | 456 | #define PCD_SET_EP_TX_VALID(USBx, bEpNum) (PCD_SET_EP_TX_STATUS(USBx, bEpNum, USB_EP_TX_VALID)) |
Kojto | 90:cb3d968589d8 | 457 | |
Kojto | 90:cb3d968589d8 | 458 | #define PCD_SET_EP_RX_VALID(USBx, bEpNum) (PCD_SET_EP_RX_STATUS(USBx, bEpNum, USB_EP_RX_VALID)) |
Kojto | 90:cb3d968589d8 | 459 | |
Kojto | 90:cb3d968589d8 | 460 | /** |
Kojto | 90:cb3d968589d8 | 461 | * @brief checks stall condition in an endpoint. |
Kojto | 90:cb3d968589d8 | 462 | * @param USBx: USB peripheral instance register address. |
Kojto | 90:cb3d968589d8 | 463 | * @param bEpNum: Endpoint Number. |
Kojto | 90:cb3d968589d8 | 464 | * @retval TRUE = endpoint in stall condition. |
Kojto | 90:cb3d968589d8 | 465 | */ |
Kojto | 90:cb3d968589d8 | 466 | #define PCD_GET_EP_TX_STALL_STATUS(USBx, bEpNum) (PCD_GET_EP_TX_STATUS(USBx, bEpNum) \ |
Kojto | 90:cb3d968589d8 | 467 | == USB_EP_TX_STALL) |
Kojto | 90:cb3d968589d8 | 468 | #define PCD_GET_EP_RX_STALL_STATUS(USBx, bEpNum) (PCD_GET_EP_RX_STATUS(USBx, bEpNum) \ |
Kojto | 90:cb3d968589d8 | 469 | == USB_EP_RX_STALL) |
Kojto | 90:cb3d968589d8 | 470 | |
Kojto | 90:cb3d968589d8 | 471 | /** |
Kojto | 90:cb3d968589d8 | 472 | * @brief set & clear EP_KIND bit. |
Kojto | 90:cb3d968589d8 | 473 | * @param USBx: USB peripheral instance register address. |
Kojto | 90:cb3d968589d8 | 474 | * @param bEpNum: Endpoint Number. |
Kojto | 90:cb3d968589d8 | 475 | * @retval None |
Kojto | 90:cb3d968589d8 | 476 | */ |
Kojto | 90:cb3d968589d8 | 477 | #define PCD_SET_EP_KIND(USBx, bEpNum) (PCD_SET_ENDPOINT(USBx, bEpNum, \ |
Kojto | 90:cb3d968589d8 | 478 | (USB_EP_CTR_RX|USB_EP_CTR_TX|((PCD_GET_ENDPOINT(USBx, bEpNum) | USB_EP_KIND) & USB_EPREG_MASK)))) |
Kojto | 90:cb3d968589d8 | 479 | #define PCD_CLEAR_EP_KIND(USBx, bEpNum) (PCD_SET_ENDPOINT(USBx, bEpNum, \ |
Kojto | 90:cb3d968589d8 | 480 | (USB_EP_CTR_RX|USB_EP_CTR_TX|(PCD_GET_ENDPOINT(USBx, bEpNum) & USB_EPKIND_MASK)))) |
Kojto | 90:cb3d968589d8 | 481 | |
Kojto | 90:cb3d968589d8 | 482 | /** |
Kojto | 90:cb3d968589d8 | 483 | * @brief Sets/clears directly STATUS_OUT bit in the endpoint register. |
Kojto | 90:cb3d968589d8 | 484 | * @param USBx: USB peripheral instance register address. |
Kojto | 90:cb3d968589d8 | 485 | * @param bEpNum: Endpoint Number. |
Kojto | 90:cb3d968589d8 | 486 | * @retval None |
Kojto | 90:cb3d968589d8 | 487 | */ |
Kojto | 90:cb3d968589d8 | 488 | #define PCD_SET_OUT_STATUS(USBx, bEpNum) PCD_SET_EP_KIND(USBx, bEpNum) |
Kojto | 90:cb3d968589d8 | 489 | #define PCD_CLEAR_OUT_STATUS(USBx, bEpNum) PCD_CLEAR_EP_KIND(USBx, bEpNum) |
Kojto | 90:cb3d968589d8 | 490 | |
Kojto | 90:cb3d968589d8 | 491 | /** |
Kojto | 90:cb3d968589d8 | 492 | * @brief Sets/clears directly EP_KIND bit in the endpoint register. |
Kojto | 90:cb3d968589d8 | 493 | * @param USBx: USB peripheral instance register address. |
Kojto | 90:cb3d968589d8 | 494 | * @param bEpNum: Endpoint Number. |
Kojto | 90:cb3d968589d8 | 495 | * @retval None |
Kojto | 90:cb3d968589d8 | 496 | */ |
Kojto | 90:cb3d968589d8 | 497 | #define PCD_SET_EP_DBUF(USBx, bEpNum) PCD_SET_EP_KIND(USBx, bEpNum) |
Kojto | 90:cb3d968589d8 | 498 | #define PCD_CLEAR_EP_DBUF(USBx, bEpNum) PCD_CLEAR_EP_KIND(USBx, bEpNum) |
Kojto | 90:cb3d968589d8 | 499 | |
Kojto | 90:cb3d968589d8 | 500 | /** |
Kojto | 90:cb3d968589d8 | 501 | * @brief Clears bit CTR_RX / CTR_TX in the endpoint register. |
Kojto | 90:cb3d968589d8 | 502 | * @param USBx: USB peripheral instance register address. |
Kojto | 90:cb3d968589d8 | 503 | * @param bEpNum: Endpoint Number. |
Kojto | 90:cb3d968589d8 | 504 | * @retval None |
Kojto | 90:cb3d968589d8 | 505 | */ |
Kojto | 90:cb3d968589d8 | 506 | #define PCD_CLEAR_RX_EP_CTR(USBx, bEpNum) (PCD_SET_ENDPOINT(USBx, bEpNum,\ |
Kojto | 90:cb3d968589d8 | 507 | PCD_GET_ENDPOINT(USBx, bEpNum) & 0x7FFF & USB_EPREG_MASK)) |
Kojto | 90:cb3d968589d8 | 508 | #define PCD_CLEAR_TX_EP_CTR(USBx, bEpNum) (PCD_SET_ENDPOINT(USBx, bEpNum,\ |
Kojto | 90:cb3d968589d8 | 509 | PCD_GET_ENDPOINT(USBx, bEpNum) & 0xFF7F & USB_EPREG_MASK)) |
Kojto | 90:cb3d968589d8 | 510 | |
Kojto | 90:cb3d968589d8 | 511 | /** |
Kojto | 90:cb3d968589d8 | 512 | * @brief Toggles DTOG_RX / DTOG_TX bit in the endpoint register. |
Kojto | 90:cb3d968589d8 | 513 | * @param USBx: USB peripheral instance register address. |
Kojto | 90:cb3d968589d8 | 514 | * @param bEpNum: Endpoint Number. |
Kojto | 90:cb3d968589d8 | 515 | * @retval None |
Kojto | 90:cb3d968589d8 | 516 | */ |
Kojto | 90:cb3d968589d8 | 517 | #define PCD_RX_DTOG(USBx, bEpNum) (PCD_SET_ENDPOINT(USBx, bEpNum, \ |
Kojto | 90:cb3d968589d8 | 518 | USB_EP_CTR_RX|USB_EP_CTR_TX|USB_EP_DTOG_RX | (PCD_GET_ENDPOINT(USBx, bEpNum) & USB_EPREG_MASK))) |
Kojto | 90:cb3d968589d8 | 519 | #define PCD_TX_DTOG(USBx, bEpNum) (PCD_SET_ENDPOINT(USBx, bEpNum, \ |
Kojto | 90:cb3d968589d8 | 520 | USB_EP_CTR_RX|USB_EP_CTR_TX|USB_EP_DTOG_TX | (PCD_GET_ENDPOINT(USBx, bEpNum) & USB_EPREG_MASK))) |
Kojto | 90:cb3d968589d8 | 521 | |
Kojto | 90:cb3d968589d8 | 522 | /** |
Kojto | 90:cb3d968589d8 | 523 | * @brief Clears DTOG_RX / DTOG_TX bit in the endpoint register. |
Kojto | 90:cb3d968589d8 | 524 | * @param USBx: USB peripheral instance register address. |
Kojto | 90:cb3d968589d8 | 525 | * @param bEpNum: Endpoint Number. |
Kojto | 90:cb3d968589d8 | 526 | * @retval None |
Kojto | 90:cb3d968589d8 | 527 | */ |
Kojto | 90:cb3d968589d8 | 528 | #define PCD_CLEAR_RX_DTOG(USBx, bEpNum) if((PCD_GET_ENDPOINT(USBx, bEpNum) & USB_EP_DTOG_RX) != 0)\ |
Kojto | 90:cb3d968589d8 | 529 | PCD_RX_DTOG(USBx, bEpNum) |
Kojto | 90:cb3d968589d8 | 530 | #define PCD_CLEAR_TX_DTOG(USBx, bEpNum) if((PCD_GET_ENDPOINT(USBx, bEpNum) & USB_EP_DTOG_TX) != 0)\ |
Kojto | 90:cb3d968589d8 | 531 | PCD_TX_DTOG(USBx, bEpNum) |
Kojto | 90:cb3d968589d8 | 532 | |
Kojto | 90:cb3d968589d8 | 533 | /** |
Kojto | 90:cb3d968589d8 | 534 | * @brief Sets address in an endpoint register. |
Kojto | 90:cb3d968589d8 | 535 | * @param USBx: USB peripheral instance register address. |
Kojto | 90:cb3d968589d8 | 536 | * @param bEpNum: Endpoint Number. |
Kojto | 90:cb3d968589d8 | 537 | * @param bAddr: Address. |
Kojto | 90:cb3d968589d8 | 538 | * @retval None |
Kojto | 90:cb3d968589d8 | 539 | */ |
Kojto | 90:cb3d968589d8 | 540 | #define PCD_SET_EP_ADDRESS(USBx, bEpNum,bAddr) PCD_SET_ENDPOINT(USBx, bEpNum,\ |
Kojto | 90:cb3d968589d8 | 541 | USB_EP_CTR_RX|USB_EP_CTR_TX|(PCD_GET_ENDPOINT(USBx, bEpNum) & USB_EPREG_MASK) | bAddr) |
Kojto | 90:cb3d968589d8 | 542 | |
Kojto | 90:cb3d968589d8 | 543 | #define PCD_GET_EP_ADDRESS(USBx, bEpNum) ((uint8_t)(PCD_GET_ENDPOINT(USBx, bEpNum) & USB_EPADDR_FIELD)) |
Kojto | 90:cb3d968589d8 | 544 | |
Kojto | 90:cb3d968589d8 | 545 | /** |
Kojto | 90:cb3d968589d8 | 546 | * @brief sets address of the tx/rx buffer. |
Kojto | 90:cb3d968589d8 | 547 | * @param USBx: USB peripheral instance register address. |
Kojto | 90:cb3d968589d8 | 548 | * @param bEpNum: Endpoint Number. |
Kojto | 90:cb3d968589d8 | 549 | * @param wAddr: address to be set (must be word aligned). |
Kojto | 90:cb3d968589d8 | 550 | * @retval None |
Kojto | 90:cb3d968589d8 | 551 | */ |
Kojto | 90:cb3d968589d8 | 552 | #define PCD_SET_EP_TX_ADDRESS(USBx, bEpNum,wAddr) (*PCD_EP_TX_ADDRESS(USBx, bEpNum) = ((wAddr >> 1) << 1)) |
Kojto | 90:cb3d968589d8 | 553 | #define PCD_SET_EP_RX_ADDRESS(USBx, bEpNum,wAddr) (*PCD_EP_RX_ADDRESS(USBx, bEpNum) = ((wAddr >> 1) << 1)) |
Kojto | 90:cb3d968589d8 | 554 | |
Kojto | 90:cb3d968589d8 | 555 | /** |
Kojto | 90:cb3d968589d8 | 556 | * @brief Gets address of the tx/rx buffer. |
Kojto | 90:cb3d968589d8 | 557 | * @param USBx: USB peripheral instance register address. |
Kojto | 90:cb3d968589d8 | 558 | * @param bEpNum: Endpoint Number. |
Kojto | 90:cb3d968589d8 | 559 | * @retval address of the buffer. |
Kojto | 90:cb3d968589d8 | 560 | */ |
Kojto | 90:cb3d968589d8 | 561 | #define PCD_GET_EP_TX_ADDRESS(USBx, bEpNum) ((uint16_t)*PCD_EP_TX_ADDRESS(USBx, bEpNum)) |
Kojto | 90:cb3d968589d8 | 562 | #define PCD_GET_EP_RX_ADDRESS(USBx, bEpNum) ((uint16_t)*PCD_EP_RX_ADDRESS(USBx, bEpNum)) |
Kojto | 90:cb3d968589d8 | 563 | |
Kojto | 90:cb3d968589d8 | 564 | /** |
Kojto | 90:cb3d968589d8 | 565 | * @brief Sets counter of rx buffer with no. of blocks. |
Kojto | 90:cb3d968589d8 | 566 | * @param dwReg: Register |
Kojto | 90:cb3d968589d8 | 567 | * @param wCount: Counter. |
Kojto | 90:cb3d968589d8 | 568 | * @param wNBlocks: no. of Blocks. |
Kojto | 90:cb3d968589d8 | 569 | * @retval None |
Kojto | 90:cb3d968589d8 | 570 | */ |
Kojto | 90:cb3d968589d8 | 571 | #define PCD_CALC_BLK32(dwReg,wCount,wNBlocks) {\ |
Kojto | 90:cb3d968589d8 | 572 | wNBlocks = wCount >> 5;\ |
Kojto | 90:cb3d968589d8 | 573 | if((wCount & 0x1f) == 0)\ |
Kojto | 90:cb3d968589d8 | 574 | wNBlocks--;\ |
Kojto | 90:cb3d968589d8 | 575 | *pdwReg = (uint16_t)((wNBlocks << 10) | 0x8000);\ |
Kojto | 90:cb3d968589d8 | 576 | }/* PCD_CALC_BLK32 */ |
Kojto | 90:cb3d968589d8 | 577 | |
Kojto | 90:cb3d968589d8 | 578 | #define PCD_CALC_BLK2(dwReg,wCount,wNBlocks) {\ |
Kojto | 90:cb3d968589d8 | 579 | wNBlocks = wCount >> 1;\ |
Kojto | 90:cb3d968589d8 | 580 | if((wCount & 0x1) != 0)\ |
Kojto | 90:cb3d968589d8 | 581 | wNBlocks++;\ |
Kojto | 90:cb3d968589d8 | 582 | *pdwReg = (uint16_t)(wNBlocks << 10);\ |
Kojto | 90:cb3d968589d8 | 583 | }/* PCD_CALC_BLK2 */ |
Kojto | 90:cb3d968589d8 | 584 | |
Kojto | 90:cb3d968589d8 | 585 | #define PCD_SET_EP_CNT_RX_REG(dwReg,wCount) {\ |
Kojto | 90:cb3d968589d8 | 586 | uint16_t wNBlocks;\ |
Kojto | 90:cb3d968589d8 | 587 | if(wCount > 62){PCD_CALC_BLK32(dwReg,wCount,wNBlocks);}\ |
Kojto | 90:cb3d968589d8 | 588 | else {PCD_CALC_BLK2(dwReg,wCount,wNBlocks);}\ |
Kojto | 90:cb3d968589d8 | 589 | }/* PCD_SET_EP_CNT_RX_REG */ |
Kojto | 90:cb3d968589d8 | 590 | |
Kojto | 90:cb3d968589d8 | 591 | #define PCD_SET_EP_RX_DBUF0_CNT(USBx, bEpNum,wCount) {\ |
Kojto | 90:cb3d968589d8 | 592 | uint16_t *pdwReg = PCD_EP_TX_CNT(USBx, bEpNum); \ |
Kojto | 90:cb3d968589d8 | 593 | PCD_SET_EP_CNT_RX_REG(pdwReg, wCount);\ |
Kojto | 90:cb3d968589d8 | 594 | } |
Kojto | 90:cb3d968589d8 | 595 | /** |
Kojto | 90:cb3d968589d8 | 596 | * @brief sets counter for the tx/rx buffer. |
Kojto | 90:cb3d968589d8 | 597 | * @param USBx: USB peripheral instance register address. |
Kojto | 90:cb3d968589d8 | 598 | * @param bEpNum: Endpoint Number. |
Kojto | 90:cb3d968589d8 | 599 | * @param wCount: Counter value. |
Kojto | 90:cb3d968589d8 | 600 | * @retval None |
Kojto | 90:cb3d968589d8 | 601 | */ |
Kojto | 90:cb3d968589d8 | 602 | #define PCD_SET_EP_TX_CNT(USBx, bEpNum,wCount) (*PCD_EP_TX_CNT(USBx, bEpNum) = wCount) |
Kojto | 90:cb3d968589d8 | 603 | |
Kojto | 90:cb3d968589d8 | 604 | |
Kojto | 90:cb3d968589d8 | 605 | /** |
Kojto | 90:cb3d968589d8 | 606 | * @brief gets counter of the tx buffer. |
Kojto | 90:cb3d968589d8 | 607 | * @param USBx: USB peripheral instance register address. |
Kojto | 90:cb3d968589d8 | 608 | * @param bEpNum: Endpoint Number. |
Kojto | 90:cb3d968589d8 | 609 | * @retval Counter value |
Kojto | 90:cb3d968589d8 | 610 | */ |
Kojto | 90:cb3d968589d8 | 611 | #define PCD_GET_EP_TX_CNT(USBx, bEpNum)((uint16_t)(*PCD_EP_TX_CNT(USBx, bEpNum)) & 0x3ff) |
Kojto | 90:cb3d968589d8 | 612 | #define PCD_GET_EP_RX_CNT(USBx, bEpNum)((uint16_t)(*PCD_EP_RX_CNT(USBx, bEpNum)) & 0x3ff) |
Kojto | 90:cb3d968589d8 | 613 | |
Kojto | 90:cb3d968589d8 | 614 | /** |
Kojto | 90:cb3d968589d8 | 615 | * @brief Sets buffer 0/1 address in a double buffer endpoint. |
Kojto | 90:cb3d968589d8 | 616 | * @param USBx: USB peripheral instance register address. |
Kojto | 90:cb3d968589d8 | 617 | * @param bEpNum: Endpoint Number. |
Kojto | 90:cb3d968589d8 | 618 | * @param wBuf0Addr: buffer 0 address. |
Kojto | 90:cb3d968589d8 | 619 | * @retval Counter value |
Kojto | 90:cb3d968589d8 | 620 | */ |
Kojto | 90:cb3d968589d8 | 621 | #define PCD_SET_EP_DBUF0_ADDR(USBx, bEpNum,wBuf0Addr) {PCD_SET_EP_TX_ADDRESS(USBx, bEpNum, wBuf0Addr);} |
Kojto | 90:cb3d968589d8 | 622 | #define PCD_SET_EP_DBUF1_ADDR(USBx, bEpNum,wBuf1Addr) {PCD_SET_EP_RX_ADDRESS(USBx, bEpNum, wBuf1Addr);} |
Kojto | 90:cb3d968589d8 | 623 | |
Kojto | 90:cb3d968589d8 | 624 | /** |
Kojto | 90:cb3d968589d8 | 625 | * @brief Sets addresses in a double buffer endpoint. |
Kojto | 90:cb3d968589d8 | 626 | * @param USBx: USB peripheral instance register address. |
Kojto | 90:cb3d968589d8 | 627 | * @param bEpNum: Endpoint Number. |
Kojto | 90:cb3d968589d8 | 628 | * @param wBuf0Addr: buffer 0 address. |
Kojto | 90:cb3d968589d8 | 629 | * @param wBuf1Addr = buffer 1 address. |
Kojto | 90:cb3d968589d8 | 630 | * @retval None |
Kojto | 90:cb3d968589d8 | 631 | */ |
Kojto | 90:cb3d968589d8 | 632 | #define PCD_SET_EP_DBUF_ADDR(USBx, bEpNum,wBuf0Addr,wBuf1Addr) { \ |
Kojto | 90:cb3d968589d8 | 633 | PCD_SET_EP_DBUF0_ADDR(USBx, bEpNum, wBuf0Addr);\ |
Kojto | 90:cb3d968589d8 | 634 | PCD_SET_EP_DBUF1_ADDR(USBx, bEpNum, wBuf1Addr);\ |
Kojto | 90:cb3d968589d8 | 635 | } /* PCD_SET_EP_DBUF_ADDR */ |
Kojto | 90:cb3d968589d8 | 636 | |
Kojto | 90:cb3d968589d8 | 637 | /** |
Kojto | 90:cb3d968589d8 | 638 | * @brief Gets buffer 0/1 address of a double buffer endpoint. |
Kojto | 90:cb3d968589d8 | 639 | * @param USBx: USB peripheral instance register address. |
Kojto | 90:cb3d968589d8 | 640 | * @param bEpNum: Endpoint Number. |
Kojto | 90:cb3d968589d8 | 641 | * @retval None |
Kojto | 90:cb3d968589d8 | 642 | */ |
Kojto | 90:cb3d968589d8 | 643 | #define PCD_GET_EP_DBUF0_ADDR(USBx, bEpNum) (PCD_GET_EP_TX_ADDRESS(USBx, bEpNum)) |
Kojto | 90:cb3d968589d8 | 644 | #define PCD_GET_EP_DBUF1_ADDR(USBx, bEpNum) (PCD_GET_EP_RX_ADDRESS(USBx, bEpNum)) |
Kojto | 90:cb3d968589d8 | 645 | |
Kojto | 90:cb3d968589d8 | 646 | /** |
Kojto | 90:cb3d968589d8 | 647 | * @brief Gets buffer 0/1 address of a double buffer endpoint. |
Kojto | 90:cb3d968589d8 | 648 | * @param USBx: USB peripheral instance register address. |
Kojto | 90:cb3d968589d8 | 649 | * @param bEpNum: Endpoint Number. |
Kojto | 90:cb3d968589d8 | 650 | * @param bDir: endpoint dir EP_DBUF_OUT = OUT |
Kojto | 90:cb3d968589d8 | 651 | * EP_DBUF_IN = IN |
Kojto | 90:cb3d968589d8 | 652 | * @param wCount: Counter value |
Kojto | 90:cb3d968589d8 | 653 | * @retval None |
Kojto | 90:cb3d968589d8 | 654 | */ |
Kojto | 90:cb3d968589d8 | 655 | #define PCD_SET_EP_DBUF0_CNT(USBx, bEpNum, bDir, wCount) { \ |
Kojto | 90:cb3d968589d8 | 656 | if(bDir == PCD_EP_DBUF_OUT)\ |
Kojto | 90:cb3d968589d8 | 657 | /* OUT endpoint */ \ |
Kojto | 90:cb3d968589d8 | 658 | {PCD_SET_EP_RX_DBUF0_CNT(USBx, bEpNum,wCount);} \ |
Kojto | 90:cb3d968589d8 | 659 | else if(bDir == PCD_EP_DBUF_IN)\ |
Kojto | 90:cb3d968589d8 | 660 | /* IN endpoint */ \ |
Kojto | 90:cb3d968589d8 | 661 | *PCD_EP_TX_CNT(USBx, bEpNum) = (uint32_t)wCount; \ |
Kojto | 90:cb3d968589d8 | 662 | } /* SetEPDblBuf0Count*/ |
Kojto | 90:cb3d968589d8 | 663 | |
Kojto | 90:cb3d968589d8 | 664 | #define PCD_SET_EP_DBUF1_CNT(USBx, bEpNum, bDir, wCount) { \ |
Kojto | 90:cb3d968589d8 | 665 | if(bDir == PCD_EP_DBUF_OUT)\ |
Kojto | 90:cb3d968589d8 | 666 | /* OUT endpoint */ \ |
Kojto | 90:cb3d968589d8 | 667 | {PCD_SET_EP_RX_CNT(USBx, bEpNum,wCount);}\ |
Kojto | 90:cb3d968589d8 | 668 | else if(bDir == PCD_EP_DBUF_IN)\ |
Kojto | 90:cb3d968589d8 | 669 | /* IN endpoint */\ |
Kojto | 90:cb3d968589d8 | 670 | *PCD_EP_RX_CNT(USBx, bEpNum) = (uint32_t)wCount; \ |
Kojto | 90:cb3d968589d8 | 671 | } /* SetEPDblBuf1Count */ |
Kojto | 90:cb3d968589d8 | 672 | |
Kojto | 90:cb3d968589d8 | 673 | #define PCD_SET_EP_DBUF_CNT(USBx, bEpNum, bDir, wCount) {\ |
Kojto | 90:cb3d968589d8 | 674 | PCD_SET_EP_DBUF0_CNT(USBx, bEpNum, bDir, wCount); \ |
Kojto | 90:cb3d968589d8 | 675 | PCD_SET_EP_DBUF1_CNT(USBx, bEpNum, bDir, wCount); \ |
Kojto | 90:cb3d968589d8 | 676 | } /* PCD_SET_EP_DBUF_CNT */ |
Kojto | 90:cb3d968589d8 | 677 | |
Kojto | 90:cb3d968589d8 | 678 | /** |
Kojto | 90:cb3d968589d8 | 679 | * @brief Gets buffer 0/1 rx/tx counter for double buffering. |
Kojto | 90:cb3d968589d8 | 680 | * @param USBx: USB peripheral instance register address. |
Kojto | 90:cb3d968589d8 | 681 | * @param bEpNum: Endpoint Number. |
Kojto | 90:cb3d968589d8 | 682 | * @retval None |
Kojto | 90:cb3d968589d8 | 683 | */ |
Kojto | 90:cb3d968589d8 | 684 | #define PCD_GET_EP_DBUF0_CNT(USBx, bEpNum) (PCD_GET_EP_TX_CNT(USBx, bEpNum)) |
Kojto | 90:cb3d968589d8 | 685 | #define PCD_GET_EP_DBUF1_CNT(USBx, bEpNum) (PCD_GET_EP_RX_CNT(USBx, bEpNum)) |
Kojto | 90:cb3d968589d8 | 686 | |
Kojto | 90:cb3d968589d8 | 687 | |
Kojto | 90:cb3d968589d8 | 688 | /** |
Kojto | 90:cb3d968589d8 | 689 | * @} |
Kojto | 90:cb3d968589d8 | 690 | */ |
Kojto | 90:cb3d968589d8 | 691 | |
Kojto | 90:cb3d968589d8 | 692 | /* Exported functions --------------------------------------------------------*/ |
Kojto | 90:cb3d968589d8 | 693 | |
Kojto | 90:cb3d968589d8 | 694 | /** @addtogroup PCD_Exported_Functions |
Kojto | 90:cb3d968589d8 | 695 | * @{ |
Kojto | 90:cb3d968589d8 | 696 | */ |
Kojto | 90:cb3d968589d8 | 697 | |
Kojto | 90:cb3d968589d8 | 698 | /** @addtogroup PCD_Exported_Functions_Group1 Initialization and de-initialization functions |
Kojto | 90:cb3d968589d8 | 699 | * @{ |
Kojto | 90:cb3d968589d8 | 700 | */ |
Kojto | 90:cb3d968589d8 | 701 | /* Initialization/de-initialization functions **********************************/ |
Kojto | 90:cb3d968589d8 | 702 | HAL_StatusTypeDef HAL_PCD_Init(PCD_HandleTypeDef *hpcd); |
Kojto | 90:cb3d968589d8 | 703 | HAL_StatusTypeDef HAL_PCD_DeInit (PCD_HandleTypeDef *hpcd); |
Kojto | 90:cb3d968589d8 | 704 | void HAL_PCD_MspInit(PCD_HandleTypeDef *hpcd); |
Kojto | 90:cb3d968589d8 | 705 | void HAL_PCD_MspDeInit(PCD_HandleTypeDef *hpcd); |
Kojto | 90:cb3d968589d8 | 706 | |
Kojto | 90:cb3d968589d8 | 707 | /** |
Kojto | 90:cb3d968589d8 | 708 | * @} |
Kojto | 90:cb3d968589d8 | 709 | */ |
Kojto | 90:cb3d968589d8 | 710 | |
Kojto | 90:cb3d968589d8 | 711 | /** @addtogroup PCD_Exported_Functions_Group2 Input and Output operation functions |
Kojto | 90:cb3d968589d8 | 712 | * @{ |
Kojto | 90:cb3d968589d8 | 713 | */ |
Kojto | 90:cb3d968589d8 | 714 | /* I/O operation functions *****************************************************/ |
Kojto | 90:cb3d968589d8 | 715 | /* Non-Blocking mode: Interrupt */ |
Kojto | 90:cb3d968589d8 | 716 | HAL_StatusTypeDef HAL_PCD_Start(PCD_HandleTypeDef *hpcd); |
Kojto | 90:cb3d968589d8 | 717 | HAL_StatusTypeDef HAL_PCD_Stop(PCD_HandleTypeDef *hpcd); |
Kojto | 90:cb3d968589d8 | 718 | void HAL_PCD_IRQHandler(PCD_HandleTypeDef *hpcd); |
Kojto | 90:cb3d968589d8 | 719 | |
Kojto | 90:cb3d968589d8 | 720 | void HAL_PCD_DataOutStageCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum); |
Kojto | 90:cb3d968589d8 | 721 | void HAL_PCD_DataInStageCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum); |
Kojto | 90:cb3d968589d8 | 722 | void HAL_PCD_SetupStageCallback(PCD_HandleTypeDef *hpcd); |
Kojto | 90:cb3d968589d8 | 723 | void HAL_PCD_SOFCallback(PCD_HandleTypeDef *hpcd); |
Kojto | 90:cb3d968589d8 | 724 | void HAL_PCD_ResetCallback(PCD_HandleTypeDef *hpcd); |
Kojto | 90:cb3d968589d8 | 725 | void HAL_PCD_SuspendCallback(PCD_HandleTypeDef *hpcd); |
Kojto | 90:cb3d968589d8 | 726 | void HAL_PCD_ResumeCallback(PCD_HandleTypeDef *hpcd); |
Kojto | 90:cb3d968589d8 | 727 | void HAL_PCD_ISOOUTIncompleteCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum); |
Kojto | 90:cb3d968589d8 | 728 | void HAL_PCD_ISOINIncompleteCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum); |
Kojto | 90:cb3d968589d8 | 729 | void HAL_PCD_ConnectCallback(PCD_HandleTypeDef *hpcd); |
Kojto | 90:cb3d968589d8 | 730 | void HAL_PCD_DisconnectCallback(PCD_HandleTypeDef *hpcd); |
Kojto | 90:cb3d968589d8 | 731 | |
Kojto | 90:cb3d968589d8 | 732 | /** |
Kojto | 90:cb3d968589d8 | 733 | * @} |
Kojto | 90:cb3d968589d8 | 734 | */ |
Kojto | 90:cb3d968589d8 | 735 | |
Kojto | 90:cb3d968589d8 | 736 | /** @addtogroup PCD_Exported_Functions_Group3 Peripheral Control functions |
Kojto | 90:cb3d968589d8 | 737 | * @{ |
Kojto | 90:cb3d968589d8 | 738 | */ |
Kojto | 90:cb3d968589d8 | 739 | /* Peripheral Control functions ************************************************/ |
Kojto | 90:cb3d968589d8 | 740 | HAL_StatusTypeDef HAL_PCD_DevConnect(PCD_HandleTypeDef *hpcd); |
Kojto | 90:cb3d968589d8 | 741 | HAL_StatusTypeDef HAL_PCD_DevDisconnect(PCD_HandleTypeDef *hpcd); |
Kojto | 90:cb3d968589d8 | 742 | HAL_StatusTypeDef HAL_PCD_SetAddress(PCD_HandleTypeDef *hpcd, uint8_t address); |
Kojto | 90:cb3d968589d8 | 743 | HAL_StatusTypeDef HAL_PCD_EP_Open(PCD_HandleTypeDef *hpcd, uint8_t ep_addr, uint16_t ep_mps, uint8_t ep_type); |
Kojto | 90:cb3d968589d8 | 744 | HAL_StatusTypeDef HAL_PCD_EP_Close(PCD_HandleTypeDef *hpcd, uint8_t ep_addr); |
Kojto | 90:cb3d968589d8 | 745 | HAL_StatusTypeDef HAL_PCD_EP_Receive(PCD_HandleTypeDef *hpcd, uint8_t ep_addr, uint8_t *pBuf, uint32_t len); |
Kojto | 90:cb3d968589d8 | 746 | HAL_StatusTypeDef HAL_PCD_EP_Transmit(PCD_HandleTypeDef *hpcd, uint8_t ep_addr, uint8_t *pBuf, uint32_t len); |
Kojto | 90:cb3d968589d8 | 747 | uint16_t HAL_PCD_EP_GetRxCount(PCD_HandleTypeDef *hpcd, uint8_t ep_addr); |
Kojto | 90:cb3d968589d8 | 748 | HAL_StatusTypeDef HAL_PCD_EP_SetStall(PCD_HandleTypeDef *hpcd, uint8_t ep_addr); |
Kojto | 90:cb3d968589d8 | 749 | HAL_StatusTypeDef HAL_PCD_EP_ClrStall(PCD_HandleTypeDef *hpcd, uint8_t ep_addr); |
Kojto | 90:cb3d968589d8 | 750 | HAL_StatusTypeDef HAL_PCD_EP_Flush(PCD_HandleTypeDef *hpcd, uint8_t ep_addr); |
Kojto | 90:cb3d968589d8 | 751 | HAL_StatusTypeDef HAL_PCD_ActiveRemoteWakeup(PCD_HandleTypeDef *hpcd); |
Kojto | 90:cb3d968589d8 | 752 | HAL_StatusTypeDef HAL_PCD_DeActiveRemoteWakeup(PCD_HandleTypeDef *hpcd); |
Kojto | 90:cb3d968589d8 | 753 | /** |
Kojto | 90:cb3d968589d8 | 754 | * @} |
Kojto | 90:cb3d968589d8 | 755 | */ |
Kojto | 90:cb3d968589d8 | 756 | |
Kojto | 90:cb3d968589d8 | 757 | /** @addtogroup PCD_Exported_Functions_Group4 Peripheral State functions |
Kojto | 90:cb3d968589d8 | 758 | * @{ |
Kojto | 90:cb3d968589d8 | 759 | */ |
Kojto | 90:cb3d968589d8 | 760 | /* Peripheral State functions **************************************************/ |
Kojto | 90:cb3d968589d8 | 761 | PCD_StateTypeDef HAL_PCD_GetState(PCD_HandleTypeDef *hpcd); |
Kojto | 90:cb3d968589d8 | 762 | /** |
Kojto | 90:cb3d968589d8 | 763 | * @} |
Kojto | 90:cb3d968589d8 | 764 | */ |
Kojto | 90:cb3d968589d8 | 765 | |
Kojto | 90:cb3d968589d8 | 766 | /** @addtogroup PCDEx_Private_Functions PCD Extended Private Functions |
Kojto | 90:cb3d968589d8 | 767 | * @{ |
Kojto | 90:cb3d968589d8 | 768 | */ |
Kojto | 90:cb3d968589d8 | 769 | void PCD_WritePMA(USB_TypeDef *USBx, uint8_t *pbUsrBuf, uint16_t wPMABufAddr, uint16_t wNBytes); |
Kojto | 90:cb3d968589d8 | 770 | void PCD_ReadPMA(USB_TypeDef *USBx, uint8_t *pbUsrBuf, uint16_t wPMABufAddr, uint16_t wNBytes); |
Kojto | 90:cb3d968589d8 | 771 | /** |
Kojto | 90:cb3d968589d8 | 772 | * @} |
Kojto | 90:cb3d968589d8 | 773 | */ |
Kojto | 90:cb3d968589d8 | 774 | |
Kojto | 90:cb3d968589d8 | 775 | /** |
Kojto | 90:cb3d968589d8 | 776 | * @} |
Kojto | 90:cb3d968589d8 | 777 | */ |
Kojto | 90:cb3d968589d8 | 778 | |
Kojto | 90:cb3d968589d8 | 779 | /** |
Kojto | 90:cb3d968589d8 | 780 | * @} |
Kojto | 90:cb3d968589d8 | 781 | */ |
Kojto | 90:cb3d968589d8 | 782 | |
Kojto | 90:cb3d968589d8 | 783 | /** |
Kojto | 90:cb3d968589d8 | 784 | * @} |
Kojto | 90:cb3d968589d8 | 785 | */ |
Kojto | 90:cb3d968589d8 | 786 | #endif /* STM32F302xE || STM32F303xE || */ |
Kojto | 90:cb3d968589d8 | 787 | /* STM32F302xC || STM32F303xC || */ |
Kojto | 90:cb3d968589d8 | 788 | /* STM32F302x8 || */ |
Kojto | 90:cb3d968589d8 | 789 | /* STM32F373xC */ |
Kojto | 90:cb3d968589d8 | 790 | |
Kojto | 90:cb3d968589d8 | 791 | #ifdef __cplusplus |
Kojto | 90:cb3d968589d8 | 792 | } |
Kojto | 90:cb3d968589d8 | 793 | #endif |
Kojto | 90:cb3d968589d8 | 794 | |
Kojto | 90:cb3d968589d8 | 795 | |
Kojto | 90:cb3d968589d8 | 796 | #endif /* __STM32F3xx_HAL_PCD_H */ |
Kojto | 90:cb3d968589d8 | 797 | |
Kojto | 90:cb3d968589d8 | 798 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |