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