my fork
Fork of mbed by
TARGET_NUCLEO_F072RB/stm32f0xx_hal_pcd.h@97:4298809c7c9e, 2015-04-08 (annotated)
- Committer:
- filartrix
- Date:
- Wed Apr 08 14:12:53 2015 +0000
- Revision:
- 97:4298809c7c9e
- Parent:
- 93:e188a91d3eaa
First reale BlueNRG module for nucleo 401 board
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 |
Kojto | 93:e188a91d3eaa | 5 | * @version V1.2.0 |
Kojto | 93:e188a91d3eaa | 6 | * @date 11-December-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 | |
Kojto | 93:e188a91d3eaa | 46 | #if defined(STM32F042x6) || defined(STM32F048xx) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F070xB)|| defined(STM32F070x6) |
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 | 92:4fc01daae5a5 | 60 | /** @defgroup PCD_Exported_Types PCD Exported Types |
bogdanm | 92:4fc01daae5a5 | 61 | * @{ |
bogdanm | 92:4fc01daae5a5 | 62 | */ |
bogdanm | 85:024bf7f99721 | 63 | |
bogdanm | 92:4fc01daae5a5 | 64 | /** |
bogdanm | 85:024bf7f99721 | 65 | * @brief PCD State structures definition |
bogdanm | 85:024bf7f99721 | 66 | */ |
bogdanm | 85:024bf7f99721 | 67 | typedef enum |
bogdanm | 85:024bf7f99721 | 68 | { |
bogdanm | 85:024bf7f99721 | 69 | PCD_READY = 0x00, |
bogdanm | 85:024bf7f99721 | 70 | PCD_ERROR = 0x01, |
bogdanm | 85:024bf7f99721 | 71 | PCD_BUSY = 0x02, |
bogdanm | 85:024bf7f99721 | 72 | PCD_TIMEOUT = 0x03 |
bogdanm | 85:024bf7f99721 | 73 | } PCD_StateTypeDef; |
bogdanm | 85:024bf7f99721 | 74 | |
bogdanm | 85:024bf7f99721 | 75 | typedef enum |
bogdanm | 85:024bf7f99721 | 76 | { |
bogdanm | 85:024bf7f99721 | 77 | /* double buffered endpoint direction */ |
bogdanm | 85:024bf7f99721 | 78 | PCD_EP_DBUF_OUT, |
bogdanm | 85:024bf7f99721 | 79 | PCD_EP_DBUF_IN, |
bogdanm | 85:024bf7f99721 | 80 | PCD_EP_DBUF_ERR, |
bogdanm | 85:024bf7f99721 | 81 | }PCD_EP_DBUF_DIR; |
bogdanm | 85:024bf7f99721 | 82 | |
bogdanm | 85:024bf7f99721 | 83 | /* endpoint buffer number */ |
bogdanm | 85:024bf7f99721 | 84 | typedef enum |
bogdanm | 85:024bf7f99721 | 85 | { |
bogdanm | 85:024bf7f99721 | 86 | PCD_EP_NOBUF, |
bogdanm | 85:024bf7f99721 | 87 | PCD_EP_BUF0, |
bogdanm | 85:024bf7f99721 | 88 | PCD_EP_BUF1 |
bogdanm | 85:024bf7f99721 | 89 | }PCD_EP_BUF_NUM; |
bogdanm | 85:024bf7f99721 | 90 | |
bogdanm | 85:024bf7f99721 | 91 | /** |
bogdanm | 85:024bf7f99721 | 92 | * @brief PCD Initialization Structure definition |
bogdanm | 85:024bf7f99721 | 93 | */ |
bogdanm | 85:024bf7f99721 | 94 | typedef struct |
bogdanm | 85:024bf7f99721 | 95 | { |
bogdanm | 85:024bf7f99721 | 96 | uint32_t dev_endpoints; /*!< Device Endpoints number. |
bogdanm | 85:024bf7f99721 | 97 | This parameter depends on the used USB core. |
bogdanm | 85:024bf7f99721 | 98 | This parameter must be a number between Min_Data = 1 and Max_Data = 15 */ |
bogdanm | 85:024bf7f99721 | 99 | |
bogdanm | 85:024bf7f99721 | 100 | uint32_t speed; /*!< USB Core speed. |
Kojto | 93:e188a91d3eaa | 101 | This parameter can be any value of @ref PCD_Core_Speed */ |
bogdanm | 85:024bf7f99721 | 102 | |
bogdanm | 85:024bf7f99721 | 103 | uint32_t ep0_mps; /*!< Set the Endpoint 0 Max Packet size. |
Kojto | 93:e188a91d3eaa | 104 | This parameter can be any value of @ref PCD_EP0_MPS */ |
bogdanm | 85:024bf7f99721 | 105 | |
bogdanm | 85:024bf7f99721 | 106 | uint32_t phy_itface; /*!< Select the used PHY interface. |
Kojto | 93:e188a91d3eaa | 107 | This parameter can be any value of @ref PCD_Core_PHY */ |
bogdanm | 85:024bf7f99721 | 108 | |
bogdanm | 85:024bf7f99721 | 109 | uint32_t Sof_enable; /*!< Enable or disable the output of the SOF signal. |
bogdanm | 85:024bf7f99721 | 110 | This parameter can be set to ENABLE or DISABLE */ |
bogdanm | 85:024bf7f99721 | 111 | |
bogdanm | 85:024bf7f99721 | 112 | uint32_t low_power_enable; /*!< Enable or disable Low Power mode |
bogdanm | 85:024bf7f99721 | 113 | This parameter can be set to ENABLE or DISABLE */ |
bogdanm | 85:024bf7f99721 | 114 | |
bogdanm | 85:024bf7f99721 | 115 | uint32_t lpm_enable; /*!< Enable or disable the Link Power Management . |
bogdanm | 85:024bf7f99721 | 116 | This parameter can be set to ENABLE or DISABLE */ |
bogdanm | 85:024bf7f99721 | 117 | |
bogdanm | 85:024bf7f99721 | 118 | uint32_t battery_charging_enable; /*!< Enable or disable Battery charging. |
bogdanm | 85:024bf7f99721 | 119 | This parameter can be set to ENABLE or DISABLE */ |
bogdanm | 85:024bf7f99721 | 120 | |
bogdanm | 85:024bf7f99721 | 121 | }PCD_InitTypeDef; |
bogdanm | 85:024bf7f99721 | 122 | |
bogdanm | 85:024bf7f99721 | 123 | typedef struct |
bogdanm | 85:024bf7f99721 | 124 | { |
bogdanm | 85:024bf7f99721 | 125 | uint8_t num; /*!< Endpoint number |
bogdanm | 85:024bf7f99721 | 126 | This parameter must be a number between Min_Data = 1 and Max_Data = 15 */ |
bogdanm | 85:024bf7f99721 | 127 | |
bogdanm | 85:024bf7f99721 | 128 | uint8_t is_in; /*!< Endpoint direction |
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 is_stall; /*!< Endpoint stall condition |
bogdanm | 85:024bf7f99721 | 132 | This parameter must be a number between Min_Data = 0 and Max_Data = 1 */ |
bogdanm | 85:024bf7f99721 | 133 | |
bogdanm | 85:024bf7f99721 | 134 | uint8_t type; /*!< Endpoint type |
Kojto | 93:e188a91d3eaa | 135 | This parameter can be any value of @ref PCD_EP_Type */ |
bogdanm | 85:024bf7f99721 | 136 | |
bogdanm | 85:024bf7f99721 | 137 | uint16_t pmaadress; /*!< PMA Address |
bogdanm | 85:024bf7f99721 | 138 | This parameter can be any value between Min_addr = 0 and Max_addr = 1K */ |
bogdanm | 85:024bf7f99721 | 139 | |
bogdanm | 85:024bf7f99721 | 140 | |
bogdanm | 85:024bf7f99721 | 141 | uint16_t pmaaddr0; /*!< PMA Address0 |
bogdanm | 85:024bf7f99721 | 142 | This parameter can be any value between Min_addr = 0 and Max_addr = 1K */ |
bogdanm | 85:024bf7f99721 | 143 | |
bogdanm | 85:024bf7f99721 | 144 | |
bogdanm | 85:024bf7f99721 | 145 | uint16_t pmaaddr1; /*!< PMA Address1 |
bogdanm | 85:024bf7f99721 | 146 | This parameter can be any value between Min_addr = 0 and Max_addr = 1K */ |
bogdanm | 85:024bf7f99721 | 147 | |
bogdanm | 85:024bf7f99721 | 148 | |
bogdanm | 85:024bf7f99721 | 149 | uint8_t doublebuffer; /*!< Double buffer enable |
bogdanm | 85:024bf7f99721 | 150 | This parameter can be 0 or 1 */ |
bogdanm | 85:024bf7f99721 | 151 | |
bogdanm | 85:024bf7f99721 | 152 | uint32_t maxpacket; /*!< Endpoint Max packet size |
bogdanm | 85:024bf7f99721 | 153 | This parameter must be a number between Min_Data = 0 and Max_Data = 64KB */ |
bogdanm | 85:024bf7f99721 | 154 | |
bogdanm | 85:024bf7f99721 | 155 | uint8_t *xfer_buff; /*!< Pointer to transfer buffer */ |
bogdanm | 85:024bf7f99721 | 156 | |
bogdanm | 85:024bf7f99721 | 157 | |
bogdanm | 85:024bf7f99721 | 158 | uint32_t xfer_len; /*!< Current transfer length */ |
bogdanm | 85:024bf7f99721 | 159 | |
bogdanm | 85:024bf7f99721 | 160 | uint32_t xfer_count; /*!< Partial transfer length in case of multi packet transfer */ |
bogdanm | 85:024bf7f99721 | 161 | |
bogdanm | 85:024bf7f99721 | 162 | }PCD_EPTypeDef; |
bogdanm | 85:024bf7f99721 | 163 | |
bogdanm | 85:024bf7f99721 | 164 | typedef USB_TypeDef PCD_TypeDef; |
bogdanm | 85:024bf7f99721 | 165 | |
bogdanm | 85:024bf7f99721 | 166 | /** |
bogdanm | 85:024bf7f99721 | 167 | * @brief PCD Handle Structure definition |
bogdanm | 85:024bf7f99721 | 168 | */ |
bogdanm | 85:024bf7f99721 | 169 | typedef struct |
bogdanm | 85:024bf7f99721 | 170 | { |
bogdanm | 85:024bf7f99721 | 171 | PCD_TypeDef *Instance; /*!< Register base address */ |
bogdanm | 85:024bf7f99721 | 172 | PCD_InitTypeDef Init; /*!< PCD required parameters */ |
bogdanm | 85:024bf7f99721 | 173 | __IO uint8_t USB_Address; /*!< USB Address */ |
bogdanm | 92:4fc01daae5a5 | 174 | PCD_EPTypeDef IN_ep[8]; /*!< IN endpoint parameters */ |
bogdanm | 92:4fc01daae5a5 | 175 | PCD_EPTypeDef OUT_ep[8]; /*!< OUT endpoint parameters */ |
bogdanm | 85:024bf7f99721 | 176 | HAL_LockTypeDef Lock; /*!< PCD peripheral status */ |
bogdanm | 85:024bf7f99721 | 177 | __IO PCD_StateTypeDef State; /*!< PCD communication state */ |
bogdanm | 85:024bf7f99721 | 178 | uint32_t Setup[12]; /*!< Setup packet buffer */ |
bogdanm | 85:024bf7f99721 | 179 | void *pData; /*!< Pointer to upper stack Handler */ |
bogdanm | 85:024bf7f99721 | 180 | |
bogdanm | 85:024bf7f99721 | 181 | } PCD_HandleTypeDef; |
bogdanm | 92:4fc01daae5a5 | 182 | |
bogdanm | 92:4fc01daae5a5 | 183 | /** |
bogdanm | 92:4fc01daae5a5 | 184 | * @} |
bogdanm | 92:4fc01daae5a5 | 185 | */ |
bogdanm | 85:024bf7f99721 | 186 | |
bogdanm | 85:024bf7f99721 | 187 | #include "stm32f0xx_hal_pcd_ex.h" |
bogdanm | 85:024bf7f99721 | 188 | /* Exported constants --------------------------------------------------------*/ |
bogdanm | 92:4fc01daae5a5 | 189 | /** @defgroup PCD_Exported_Constants PCD Exported Constants |
bogdanm | 85:024bf7f99721 | 190 | * @{ |
bogdanm | 85:024bf7f99721 | 191 | */ |
bogdanm | 85:024bf7f99721 | 192 | |
Kojto | 93:e188a91d3eaa | 193 | /** @defgroup PCD_Core_Speed PCD Core Speed |
bogdanm | 85:024bf7f99721 | 194 | * @{ |
bogdanm | 85:024bf7f99721 | 195 | */ |
bogdanm | 85:024bf7f99721 | 196 | #define PCD_SPEED_HIGH 0 /* Not Supported */ |
bogdanm | 85:024bf7f99721 | 197 | #define PCD_SPEED_FULL 2 |
bogdanm | 85:024bf7f99721 | 198 | /** |
bogdanm | 85:024bf7f99721 | 199 | * @} |
bogdanm | 85:024bf7f99721 | 200 | */ |
bogdanm | 85:024bf7f99721 | 201 | |
Kojto | 93:e188a91d3eaa | 202 | /** @defgroup PCD_Core_PHY PCD Core PHY |
bogdanm | 85:024bf7f99721 | 203 | * @{ |
bogdanm | 85:024bf7f99721 | 204 | */ |
bogdanm | 85:024bf7f99721 | 205 | #define PCD_PHY_EMBEDDED 2 |
bogdanm | 85:024bf7f99721 | 206 | /** |
bogdanm | 85:024bf7f99721 | 207 | * @} |
bogdanm | 85:024bf7f99721 | 208 | */ |
bogdanm | 85:024bf7f99721 | 209 | |
Kojto | 93:e188a91d3eaa | 210 | /** @defgroup PCD_EP0_MPS PCD EP0 MPS |
bogdanm | 85:024bf7f99721 | 211 | * @{ |
bogdanm | 85:024bf7f99721 | 212 | */ |
bogdanm | 85:024bf7f99721 | 213 | #define DEP0CTL_MPS_64 0 |
bogdanm | 85:024bf7f99721 | 214 | #define DEP0CTL_MPS_32 1 |
bogdanm | 85:024bf7f99721 | 215 | #define DEP0CTL_MPS_16 2 |
bogdanm | 85:024bf7f99721 | 216 | #define DEP0CTL_MPS_8 3 |
bogdanm | 85:024bf7f99721 | 217 | |
bogdanm | 85:024bf7f99721 | 218 | #define PCD_EP0MPS_64 DEP0CTL_MPS_64 |
bogdanm | 85:024bf7f99721 | 219 | #define PCD_EP0MPS_32 DEP0CTL_MPS_32 |
bogdanm | 85:024bf7f99721 | 220 | #define PCD_EP0MPS_16 DEP0CTL_MPS_16 |
bogdanm | 85:024bf7f99721 | 221 | #define PCD_EP0MPS_08 DEP0CTL_MPS_8 |
bogdanm | 85:024bf7f99721 | 222 | /** |
bogdanm | 85:024bf7f99721 | 223 | * @} |
bogdanm | 85:024bf7f99721 | 224 | */ |
bogdanm | 85:024bf7f99721 | 225 | |
Kojto | 93:e188a91d3eaa | 226 | /** @defgroup PCD_EP_Type PCD EP Type |
bogdanm | 85:024bf7f99721 | 227 | * @{ |
bogdanm | 85:024bf7f99721 | 228 | */ |
bogdanm | 85:024bf7f99721 | 229 | #define PCD_EP_TYPE_CTRL 0 |
bogdanm | 85:024bf7f99721 | 230 | #define PCD_EP_TYPE_ISOC 1 |
bogdanm | 85:024bf7f99721 | 231 | #define PCD_EP_TYPE_BULK 2 |
bogdanm | 85:024bf7f99721 | 232 | #define PCD_EP_TYPE_INTR 3 |
bogdanm | 85:024bf7f99721 | 233 | /** |
bogdanm | 85:024bf7f99721 | 234 | * @} |
bogdanm | 85:024bf7f99721 | 235 | */ |
bogdanm | 85:024bf7f99721 | 236 | |
Kojto | 93:e188a91d3eaa | 237 | /** @defgroup PCD_ENDP_Type PCD_ENDP_Type |
bogdanm | 92:4fc01daae5a5 | 238 | * @{ |
bogdanm | 92:4fc01daae5a5 | 239 | */ |
bogdanm | 92:4fc01daae5a5 | 240 | |
bogdanm | 85:024bf7f99721 | 241 | #define PCD_ENDP0 ((uint8_t)0) |
bogdanm | 85:024bf7f99721 | 242 | #define PCD_ENDP1 ((uint8_t)1) |
bogdanm | 85:024bf7f99721 | 243 | #define PCD_ENDP2 ((uint8_t)2) |
bogdanm | 85:024bf7f99721 | 244 | #define PCD_ENDP3 ((uint8_t)3) |
bogdanm | 85:024bf7f99721 | 245 | #define PCD_ENDP4 ((uint8_t)4) |
bogdanm | 85:024bf7f99721 | 246 | #define PCD_ENDP5 ((uint8_t)5) |
bogdanm | 85:024bf7f99721 | 247 | #define PCD_ENDP6 ((uint8_t)6) |
bogdanm | 85:024bf7f99721 | 248 | #define PCD_ENDP7 ((uint8_t)7) |
bogdanm | 85:024bf7f99721 | 249 | |
bogdanm | 85:024bf7f99721 | 250 | /* Endpoint Kind */ |
bogdanm | 85:024bf7f99721 | 251 | #define PCD_SNG_BUF 0 |
bogdanm | 85:024bf7f99721 | 252 | #define PCD_DBL_BUF 1 |
bogdanm | 85:024bf7f99721 | 253 | |
bogdanm | 92:4fc01daae5a5 | 254 | #define IS_PCD_ALL_INSTANCE IS_USB_ALL_INSTANCE |
bogdanm | 85:024bf7f99721 | 255 | /** |
bogdanm | 85:024bf7f99721 | 256 | * @} |
bogdanm | 85:024bf7f99721 | 257 | */ |
bogdanm | 92:4fc01daae5a5 | 258 | |
bogdanm | 92:4fc01daae5a5 | 259 | /** |
bogdanm | 92:4fc01daae5a5 | 260 | * @} |
bogdanm | 92:4fc01daae5a5 | 261 | */ |
bogdanm | 92:4fc01daae5a5 | 262 | |
bogdanm | 85:024bf7f99721 | 263 | /* Exported macros -----------------------------------------------------------*/ |
bogdanm | 85:024bf7f99721 | 264 | |
bogdanm | 92:4fc01daae5a5 | 265 | /** @defgroup PCD_Exported_Macros PCD Exported Macros |
bogdanm | 85:024bf7f99721 | 266 | * @brief macros to handle interrupts and specific clock configurations |
bogdanm | 92:4fc01daae5a5 | 267 | * @{ |
bogdanm | 92:4fc01daae5a5 | 268 | */ |
bogdanm | 85:024bf7f99721 | 269 | #define __HAL_PCD_GET_FLAG(__HANDLE__, __INTERRUPT__) ((((__HANDLE__)->Instance->ISTR) & (__INTERRUPT__)) == (__INTERRUPT__)) |
Kojto | 93:e188a91d3eaa | 270 | #define __HAL_PCD_CLEAR_FLAG(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->ISTR) &= ~(__INTERRUPT__)) |
bogdanm | 85:024bf7f99721 | 271 | |
bogdanm | 85:024bf7f99721 | 272 | #define USB_EXTI_LINE_WAKEUP ((uint32_t)0x00040000) /*!< External interrupt line 18 Connected to the USB FS EXTI Line */ |
bogdanm | 85:024bf7f99721 | 273 | |
bogdanm | 92:4fc01daae5a5 | 274 | #define __HAL_USB_EXTI_ENABLE_IT() EXTI->IMR |= USB_EXTI_LINE_WAKEUP |
bogdanm | 92:4fc01daae5a5 | 275 | #define __HAL_USB_EXTI_DISABLE_IT() EXTI->IMR &= ~(USB_EXTI_LINE_WAKEUP) |
bogdanm | 92:4fc01daae5a5 | 276 | #define __HAL_USB_EXTI_GENERATE_SWIT(__EXTILINE__) (EXTI->SWIER |= (__EXTILINE__)) |
bogdanm | 92:4fc01daae5a5 | 277 | |
bogdanm | 92:4fc01daae5a5 | 278 | /** |
bogdanm | 92:4fc01daae5a5 | 279 | * @} |
bogdanm | 92:4fc01daae5a5 | 280 | */ |
bogdanm | 92:4fc01daae5a5 | 281 | |
bogdanm | 85:024bf7f99721 | 282 | /* Internal macros -----------------------------------------------------------*/ |
bogdanm | 85:024bf7f99721 | 283 | |
bogdanm | 92:4fc01daae5a5 | 284 | /** @defgroup PCD_Private_Macros PCD Private Macros |
bogdanm | 92:4fc01daae5a5 | 285 | * @brief macros to handle interrupts and specific clock configurations |
bogdanm | 92:4fc01daae5a5 | 286 | * @{ |
bogdanm | 92:4fc01daae5a5 | 287 | */ |
bogdanm | 92:4fc01daae5a5 | 288 | |
bogdanm | 85:024bf7f99721 | 289 | /* SetENDPOINT */ |
bogdanm | 92:4fc01daae5a5 | 290 | #define PCD_SET_ENDPOINT(USBx, bEpNum,wRegValue) (*(&(USBx)->EP0R + (bEpNum) * 2)= (uint16_t)(wRegValue)) |
bogdanm | 85:024bf7f99721 | 291 | |
bogdanm | 85:024bf7f99721 | 292 | /* GetENDPOINT */ |
bogdanm | 92:4fc01daae5a5 | 293 | #define PCD_GET_ENDPOINT(USBx, bEpNum) (*(&(USBx)->EP0R + (bEpNum) * 2)) |
bogdanm | 85:024bf7f99721 | 294 | |
bogdanm | 85:024bf7f99721 | 295 | |
bogdanm | 85:024bf7f99721 | 296 | |
bogdanm | 85:024bf7f99721 | 297 | /** |
bogdanm | 85:024bf7f99721 | 298 | * @brief sets the type in the endpoint register(bits EP_TYPE[1:0]) |
bogdanm | 85:024bf7f99721 | 299 | * @param USBx: USB peripheral instance register address. |
bogdanm | 85:024bf7f99721 | 300 | * @param bEpNum: Endpoint Number. |
bogdanm | 85:024bf7f99721 | 301 | * @param wType: Endpoint Type. |
bogdanm | 85:024bf7f99721 | 302 | * @retval None |
bogdanm | 85:024bf7f99721 | 303 | */ |
bogdanm | 92:4fc01daae5a5 | 304 | #define PCD_SET_EPTYPE(USBx, bEpNum,wType) (PCD_SET_ENDPOINT((USBx), (bEpNum),\ |
bogdanm | 92:4fc01daae5a5 | 305 | ((PCD_GET_ENDPOINT((USBx), (bEpNum)) & USB_EP_T_MASK) | (wType) ))) |
bogdanm | 85:024bf7f99721 | 306 | |
bogdanm | 85:024bf7f99721 | 307 | /** |
bogdanm | 85:024bf7f99721 | 308 | * @brief gets the type in the endpoint register(bits EP_TYPE[1:0]) |
bogdanm | 85:024bf7f99721 | 309 | * @param USBx: USB peripheral instance register address. |
bogdanm | 85:024bf7f99721 | 310 | * @param bEpNum: Endpoint Number. |
bogdanm | 85:024bf7f99721 | 311 | * @retval Endpoint Type |
bogdanm | 85:024bf7f99721 | 312 | */ |
bogdanm | 92:4fc01daae5a5 | 313 | #define PCD_GET_EPTYPE(USBx, bEpNum) (PCD_GET_ENDPOINT((USBx), (bEpNum)) & USB_EP_T_FIELD) |
bogdanm | 85:024bf7f99721 | 314 | |
bogdanm | 85:024bf7f99721 | 315 | |
bogdanm | 85:024bf7f99721 | 316 | /** |
bogdanm | 85:024bf7f99721 | 317 | * @brief free buffer used from the application realizing it to the line |
bogdanm | 85:024bf7f99721 | 318 | toggles bit SW_BUF in the double buffered endpoint register |
bogdanm | 85:024bf7f99721 | 319 | * @param USBx: USB peripheral instance register address. |
bogdanm | 85:024bf7f99721 | 320 | * @param bEpNum: Endpoint Number. |
bogdanm | 85:024bf7f99721 | 321 | * @param bDir: Direction |
bogdanm | 85:024bf7f99721 | 322 | * @retval None |
bogdanm | 85:024bf7f99721 | 323 | */ |
bogdanm | 85:024bf7f99721 | 324 | #define PCD_FreeUserBuffer(USBx, bEpNum, bDir)\ |
bogdanm | 85:024bf7f99721 | 325 | {\ |
bogdanm | 92:4fc01daae5a5 | 326 | if ((bDir) == PCD_EP_DBUF_OUT)\ |
bogdanm | 85:024bf7f99721 | 327 | { /* OUT double buffered endpoint */\ |
bogdanm | 92:4fc01daae5a5 | 328 | PCD_TX_DTOG((USBx), (bEpNum));\ |
bogdanm | 85:024bf7f99721 | 329 | }\ |
bogdanm | 92:4fc01daae5a5 | 330 | else if ((bDir) == PCD_EP_DBUF_IN)\ |
bogdanm | 85:024bf7f99721 | 331 | { /* IN double buffered endpoint */\ |
bogdanm | 92:4fc01daae5a5 | 332 | PCD_RX_DTOG((USBx), (bEpNum));\ |
bogdanm | 85:024bf7f99721 | 333 | }\ |
bogdanm | 85:024bf7f99721 | 334 | } |
bogdanm | 85:024bf7f99721 | 335 | |
bogdanm | 85:024bf7f99721 | 336 | /** |
bogdanm | 85:024bf7f99721 | 337 | * @brief gets direction of the double buffered endpoint |
bogdanm | 85:024bf7f99721 | 338 | * @param USBx: USB peripheral instance register address. |
bogdanm | 85:024bf7f99721 | 339 | * @param bEpNum: Endpoint Number. |
bogdanm | 85:024bf7f99721 | 340 | * @retval EP_DBUF_OUT, EP_DBUF_IN, |
bogdanm | 85:024bf7f99721 | 341 | * EP_DBUF_ERR if the endpoint counter not yet programmed. |
bogdanm | 85:024bf7f99721 | 342 | */ |
bogdanm | 85:024bf7f99721 | 343 | #define PCD_GET_DB_DIR(USBx, bEpNum)\ |
bogdanm | 85:024bf7f99721 | 344 | {\ |
bogdanm | 92:4fc01daae5a5 | 345 | if ((uint16_t)(*PCD_EP_RX_CNT((USBx), (bEpNum)) & 0xFC00) != 0)\ |
bogdanm | 85:024bf7f99721 | 346 | return(PCD_EP_DBUF_OUT);\ |
bogdanm | 92:4fc01daae5a5 | 347 | else if (((uint16_t)(*PCD_EP_TX_CNT((USBx), (bEpNum))) & 0x03FF) != 0)\ |
bogdanm | 85:024bf7f99721 | 348 | return(PCD_EP_DBUF_IN);\ |
bogdanm | 85:024bf7f99721 | 349 | else\ |
bogdanm | 85:024bf7f99721 | 350 | return(PCD_EP_DBUF_ERR);\ |
bogdanm | 85:024bf7f99721 | 351 | } |
bogdanm | 85:024bf7f99721 | 352 | |
bogdanm | 85:024bf7f99721 | 353 | /** |
bogdanm | 85:024bf7f99721 | 354 | * @brief sets the status for tx transfer (bits STAT_TX[1:0]). |
bogdanm | 85:024bf7f99721 | 355 | * @param USBx: USB peripheral instance register address. |
bogdanm | 85:024bf7f99721 | 356 | * @param bEpNum: Endpoint Number. |
bogdanm | 85:024bf7f99721 | 357 | * @param wState: new state |
bogdanm | 85:024bf7f99721 | 358 | * @retval None |
bogdanm | 85:024bf7f99721 | 359 | */ |
bogdanm | 85:024bf7f99721 | 360 | #define PCD_SET_EP_TX_STATUS(USBx, bEpNum, wState) {\ |
bogdanm | 85:024bf7f99721 | 361 | register uint16_t _wRegVal; \ |
bogdanm | 85:024bf7f99721 | 362 | \ |
bogdanm | 92:4fc01daae5a5 | 363 | _wRegVal = PCD_GET_ENDPOINT((USBx), (bEpNum)) & USB_EPTX_DTOGMASK;\ |
bogdanm | 85:024bf7f99721 | 364 | /* toggle first bit ? */ \ |
bogdanm | 92:4fc01daae5a5 | 365 | if((USB_EPTX_DTOG1 & (wState))!= 0) \ |
bogdanm | 85:024bf7f99721 | 366 | _wRegVal ^= USB_EPTX_DTOG1; \ |
bogdanm | 85:024bf7f99721 | 367 | /* toggle second bit ? */ \ |
bogdanm | 92:4fc01daae5a5 | 368 | if((USB_EPTX_DTOG2 & (wState))!= 0) \ |
bogdanm | 85:024bf7f99721 | 369 | _wRegVal ^= USB_EPTX_DTOG2; \ |
bogdanm | 92:4fc01daae5a5 | 370 | PCD_SET_ENDPOINT((USBx), (bEpNum), (_wRegVal | USB_EP_CTR_RX|USB_EP_CTR_TX)); \ |
bogdanm | 85:024bf7f99721 | 371 | } /* PCD_SET_EP_TX_STATUS */ |
bogdanm | 85:024bf7f99721 | 372 | |
bogdanm | 85:024bf7f99721 | 373 | /** |
bogdanm | 85:024bf7f99721 | 374 | * @brief sets the status for rx transfer (bits STAT_TX[1:0]) |
bogdanm | 85:024bf7f99721 | 375 | * @param USBx: USB peripheral instance register address. |
bogdanm | 85:024bf7f99721 | 376 | * @param bEpNum: Endpoint Number. |
bogdanm | 85:024bf7f99721 | 377 | * @param wState: new state |
bogdanm | 85:024bf7f99721 | 378 | * @retval None |
bogdanm | 85:024bf7f99721 | 379 | */ |
bogdanm | 85:024bf7f99721 | 380 | #define PCD_SET_EP_RX_STATUS(USBx, bEpNum,wState) {\ |
bogdanm | 85:024bf7f99721 | 381 | register uint16_t _wRegVal; \ |
bogdanm | 85:024bf7f99721 | 382 | \ |
bogdanm | 92:4fc01daae5a5 | 383 | _wRegVal = PCD_GET_ENDPOINT((USBx), (bEpNum)) & USB_EPRX_DTOGMASK;\ |
bogdanm | 85:024bf7f99721 | 384 | /* toggle first bit ? */ \ |
bogdanm | 92:4fc01daae5a5 | 385 | if((USB_EPRX_DTOG1 & (wState))!= 0) \ |
bogdanm | 85:024bf7f99721 | 386 | _wRegVal ^= USB_EPRX_DTOG1; \ |
bogdanm | 85:024bf7f99721 | 387 | /* toggle second bit ? */ \ |
bogdanm | 92:4fc01daae5a5 | 388 | if((USB_EPRX_DTOG2 & (wState))!= 0) \ |
bogdanm | 85:024bf7f99721 | 389 | _wRegVal ^= USB_EPRX_DTOG2; \ |
bogdanm | 92:4fc01daae5a5 | 390 | PCD_SET_ENDPOINT((USBx), (bEpNum), (_wRegVal | USB_EP_CTR_RX|USB_EP_CTR_TX)); \ |
bogdanm | 85:024bf7f99721 | 391 | } /* PCD_SET_EP_RX_STATUS */ |
bogdanm | 85:024bf7f99721 | 392 | |
bogdanm | 85:024bf7f99721 | 393 | /** |
bogdanm | 85:024bf7f99721 | 394 | * @brief sets the status for rx & tx (bits STAT_TX[1:0] & STAT_RX[1:0]) |
bogdanm | 85:024bf7f99721 | 395 | * @param USBx: USB peripheral instance register address. |
bogdanm | 85:024bf7f99721 | 396 | * @param bEpNum: Endpoint Number. |
bogdanm | 85:024bf7f99721 | 397 | * @param wStaterx: new state. |
bogdanm | 85:024bf7f99721 | 398 | * @param wStatetx: new state. |
bogdanm | 85:024bf7f99721 | 399 | * @retval None |
bogdanm | 85:024bf7f99721 | 400 | */ |
bogdanm | 85:024bf7f99721 | 401 | #define PCD_SET_EP_TXRX_STATUS(USBx,bEpNum,wStaterx,wStatetx) {\ |
bogdanm | 85:024bf7f99721 | 402 | register uint32_t _wRegVal; \ |
bogdanm | 85:024bf7f99721 | 403 | \ |
bogdanm | 92:4fc01daae5a5 | 404 | _wRegVal = PCD_GET_ENDPOINT((USBx), (bEpNum)) & (USB_EPRX_DTOGMASK |USB_EPTX_STAT) ;\ |
bogdanm | 85:024bf7f99721 | 405 | /* toggle first bit ? */ \ |
bogdanm | 92:4fc01daae5a5 | 406 | if((USB_EPRX_DTOG1 & ((wStaterx)))!= 0) \ |
bogdanm | 85:024bf7f99721 | 407 | _wRegVal ^= USB_EPRX_DTOG1; \ |
bogdanm | 85:024bf7f99721 | 408 | /* toggle second bit ? */ \ |
bogdanm | 92:4fc01daae5a5 | 409 | if((USB_EPRX_DTOG2 & (wStaterx))!= 0) \ |
bogdanm | 85:024bf7f99721 | 410 | _wRegVal ^= USB_EPRX_DTOG2; \ |
bogdanm | 85:024bf7f99721 | 411 | /* toggle first bit ? */ \ |
bogdanm | 92:4fc01daae5a5 | 412 | if((USB_EPTX_DTOG1 & (wStatetx))!= 0) \ |
bogdanm | 85:024bf7f99721 | 413 | _wRegVal ^= USB_EPTX_DTOG1; \ |
bogdanm | 85:024bf7f99721 | 414 | /* toggle second bit ? */ \ |
bogdanm | 92:4fc01daae5a5 | 415 | if((USB_EPTX_DTOG2 & (wStatetx))!= 0) \ |
bogdanm | 85:024bf7f99721 | 416 | _wRegVal ^= USB_EPTX_DTOG2; \ |
bogdanm | 92:4fc01daae5a5 | 417 | PCD_SET_ENDPOINT((USBx), (bEpNum), _wRegVal | USB_EP_CTR_RX|USB_EP_CTR_TX); \ |
bogdanm | 85:024bf7f99721 | 418 | } /* PCD_SET_EP_TXRX_STATUS */ |
bogdanm | 85:024bf7f99721 | 419 | |
bogdanm | 85:024bf7f99721 | 420 | /** |
bogdanm | 85:024bf7f99721 | 421 | * @brief gets the status for tx/rx transfer (bits STAT_TX[1:0] |
bogdanm | 85:024bf7f99721 | 422 | * /STAT_RX[1:0]) |
bogdanm | 85:024bf7f99721 | 423 | * @param USBx: USB peripheral instance register address. |
bogdanm | 85:024bf7f99721 | 424 | * @param bEpNum: Endpoint Number. |
bogdanm | 85:024bf7f99721 | 425 | * @retval status |
bogdanm | 85:024bf7f99721 | 426 | */ |
bogdanm | 92:4fc01daae5a5 | 427 | #define PCD_GET_EP_TX_STATUS(USBx, bEpNum) ((uint16_t)PCD_GET_ENDPOINT((USBx), (bEpNum)) & USB_EPTX_STAT) |
bogdanm | 85:024bf7f99721 | 428 | |
bogdanm | 92:4fc01daae5a5 | 429 | #define PCD_GET_EP_RX_STATUS(USBx, bEpNum) ((uint16_t)PCD_GET_ENDPOINT((USBx), (bEpNum)) & USB_EPRX_STAT) |
bogdanm | 85:024bf7f99721 | 430 | |
bogdanm | 85:024bf7f99721 | 431 | /** |
bogdanm | 85:024bf7f99721 | 432 | * @brief sets directly the VALID tx/rx-status into the endpoint register |
bogdanm | 85:024bf7f99721 | 433 | * @param USBx: USB peripheral instance register address. |
bogdanm | 85:024bf7f99721 | 434 | * @param bEpNum: Endpoint Number. |
bogdanm | 85:024bf7f99721 | 435 | * @retval None |
bogdanm | 85:024bf7f99721 | 436 | */ |
bogdanm | 92:4fc01daae5a5 | 437 | #define PCD_SET_EP_TX_VALID(USBx, bEpNum) (PCD_SET_EP_TX_STATUS((USBx), (bEpNum), USB_EP_TX_VALID)) |
bogdanm | 85:024bf7f99721 | 438 | |
bogdanm | 92:4fc01daae5a5 | 439 | #define PCD_SET_EP_RX_VALID(USBx, bEpNum) (PCD_SET_EP_RX_STATUS((USBx), (bEpNum), USB_EP_RX_VALID)) |
bogdanm | 85:024bf7f99721 | 440 | |
bogdanm | 85:024bf7f99721 | 441 | /** |
bogdanm | 85:024bf7f99721 | 442 | * @brief checks stall condition in an endpoint. |
bogdanm | 85:024bf7f99721 | 443 | * @param USBx: USB peripheral instance register address. |
bogdanm | 85:024bf7f99721 | 444 | * @param bEpNum: Endpoint Number. |
bogdanm | 85:024bf7f99721 | 445 | * @retval TRUE = endpoint in stall condition. |
bogdanm | 85:024bf7f99721 | 446 | */ |
bogdanm | 92:4fc01daae5a5 | 447 | #define PCD_GET_EP_TX_STALL_STATUS(USBx, bEpNum) (PCD_GET_EP_TX_STATUS((USBx), (bEpNum)) \ |
bogdanm | 85:024bf7f99721 | 448 | == USB_EP_TX_STALL) |
bogdanm | 92:4fc01daae5a5 | 449 | #define PCD_GET_EP_RX_STALL_STATUS(USBx, bEpNum) (PCD_GET_EP_RX_STATUS((USBx), (bEpNum)) \ |
bogdanm | 85:024bf7f99721 | 450 | == USB_EP_RX_STALL) |
bogdanm | 85:024bf7f99721 | 451 | |
bogdanm | 85:024bf7f99721 | 452 | /** |
bogdanm | 85:024bf7f99721 | 453 | * @brief set & clear EP_KIND bit. |
bogdanm | 85:024bf7f99721 | 454 | * @param USBx: USB peripheral instance register address. |
bogdanm | 85:024bf7f99721 | 455 | * @param bEpNum: Endpoint Number. |
bogdanm | 85:024bf7f99721 | 456 | * @retval None |
bogdanm | 85:024bf7f99721 | 457 | */ |
bogdanm | 92:4fc01daae5a5 | 458 | #define PCD_SET_EP_KIND(USBx, bEpNum) (PCD_SET_ENDPOINT((USBx), (bEpNum), \ |
bogdanm | 92:4fc01daae5a5 | 459 | (USB_EP_CTR_RX|USB_EP_CTR_TX|((PCD_GET_ENDPOINT((USBx), (bEpNum)) | USB_EP_KIND) & USB_EPREG_MASK)))) |
bogdanm | 92:4fc01daae5a5 | 460 | #define PCD_CLEAR_EP_KIND(USBx, bEpNum) (PCD_SET_ENDPOINT((USBx), (bEpNum), \ |
bogdanm | 92:4fc01daae5a5 | 461 | (USB_EP_CTR_RX|USB_EP_CTR_TX|(PCD_GET_ENDPOINT((USBx), (bEpNum)) & USB_EPKIND_MASK)))) |
bogdanm | 85:024bf7f99721 | 462 | |
bogdanm | 85:024bf7f99721 | 463 | /** |
bogdanm | 85:024bf7f99721 | 464 | * @brief Sets/clears directly STATUS_OUT bit in the endpoint register. |
bogdanm | 85:024bf7f99721 | 465 | * @param USBx: USB peripheral instance register address. |
bogdanm | 85:024bf7f99721 | 466 | * @param bEpNum: Endpoint Number. |
bogdanm | 85:024bf7f99721 | 467 | * @retval None |
bogdanm | 85:024bf7f99721 | 468 | */ |
bogdanm | 92:4fc01daae5a5 | 469 | #define PCD_SET_OUT_STATUS(USBx, bEpNum) PCD_SET_EP_KIND((USBx), (bEpNum)) |
bogdanm | 92:4fc01daae5a5 | 470 | #define PCD_CLEAR_OUT_STATUS(USBx, bEpNum) PCD_CLEAR_EP_KIND((USBx), (bEpNum)) |
bogdanm | 85:024bf7f99721 | 471 | |
bogdanm | 85:024bf7f99721 | 472 | /** |
bogdanm | 85:024bf7f99721 | 473 | * @brief Sets/clears directly EP_KIND bit in the endpoint register. |
bogdanm | 85:024bf7f99721 | 474 | * @param USBx: USB peripheral instance register address. |
bogdanm | 85:024bf7f99721 | 475 | * @param bEpNum: Endpoint Number. |
bogdanm | 85:024bf7f99721 | 476 | * @retval None |
bogdanm | 85:024bf7f99721 | 477 | */ |
bogdanm | 92:4fc01daae5a5 | 478 | #define PCD_SET_EP_DBUF(USBx, bEpNum) PCD_SET_EP_KIND((USBx), (bEpNum)) |
bogdanm | 92:4fc01daae5a5 | 479 | #define PCD_CLEAR_EP_DBUF(USBx, bEpNum) PCD_CLEAR_EP_KIND((USBx), (bEpNum)) |
bogdanm | 85:024bf7f99721 | 480 | |
bogdanm | 85:024bf7f99721 | 481 | /** |
bogdanm | 85:024bf7f99721 | 482 | * @brief Clears bit CTR_RX / CTR_TX in the endpoint register. |
bogdanm | 85:024bf7f99721 | 483 | * @param USBx: USB peripheral instance register address. |
bogdanm | 85:024bf7f99721 | 484 | * @param bEpNum: Endpoint Number. |
bogdanm | 85:024bf7f99721 | 485 | * @retval None |
bogdanm | 85:024bf7f99721 | 486 | */ |
bogdanm | 92:4fc01daae5a5 | 487 | #define PCD_CLEAR_RX_EP_CTR(USBx, bEpNum) (PCD_SET_ENDPOINT((USBx), (bEpNum),\ |
bogdanm | 92:4fc01daae5a5 | 488 | PCD_GET_ENDPOINT((USBx), (bEpNum)) & 0x7FFF & USB_EPREG_MASK)) |
bogdanm | 92:4fc01daae5a5 | 489 | #define PCD_CLEAR_TX_EP_CTR(USBx, bEpNum) (PCD_SET_ENDPOINT((USBx), (bEpNum),\ |
bogdanm | 92:4fc01daae5a5 | 490 | PCD_GET_ENDPOINT((USBx), (bEpNum)) & 0xFF7F & USB_EPREG_MASK)) |
bogdanm | 85:024bf7f99721 | 491 | |
bogdanm | 85:024bf7f99721 | 492 | /** |
bogdanm | 85:024bf7f99721 | 493 | * @brief Toggles DTOG_RX / DTOG_TX bit in the endpoint register. |
bogdanm | 85:024bf7f99721 | 494 | * @param USBx: USB peripheral instance register address. |
bogdanm | 85:024bf7f99721 | 495 | * @param bEpNum: Endpoint Number. |
bogdanm | 85:024bf7f99721 | 496 | * @retval None |
bogdanm | 85:024bf7f99721 | 497 | */ |
bogdanm | 92:4fc01daae5a5 | 498 | #define PCD_RX_DTOG(USBx, bEpNum) (PCD_SET_ENDPOINT((USBx), (bEpNum), \ |
bogdanm | 92:4fc01daae5a5 | 499 | USB_EP_CTR_RX|USB_EP_CTR_TX|USB_EP_DTOG_RX | (PCD_GET_ENDPOINT((USBx), (bEpNum)) & USB_EPREG_MASK))) |
bogdanm | 92:4fc01daae5a5 | 500 | #define PCD_TX_DTOG(USBx, bEpNum) (PCD_SET_ENDPOINT((USBx), (bEpNum), \ |
bogdanm | 92:4fc01daae5a5 | 501 | USB_EP_CTR_RX|USB_EP_CTR_TX|USB_EP_DTOG_TX | (PCD_GET_ENDPOINT((USBx), (bEpNum)) & USB_EPREG_MASK))) |
bogdanm | 85:024bf7f99721 | 502 | |
bogdanm | 85:024bf7f99721 | 503 | /** |
bogdanm | 85:024bf7f99721 | 504 | * @brief Clears DTOG_RX / DTOG_TX bit in the endpoint register. |
bogdanm | 85:024bf7f99721 | 505 | * @param USBx: USB peripheral instance register address. |
bogdanm | 85:024bf7f99721 | 506 | * @param bEpNum: Endpoint Number. |
bogdanm | 85:024bf7f99721 | 507 | * @retval None |
bogdanm | 85:024bf7f99721 | 508 | */ |
bogdanm | 92:4fc01daae5a5 | 509 | #define PCD_CLEAR_RX_DTOG(USBx, bEpNum) if((PCD_GET_ENDPOINT((USBx), (bEpNum)) & USB_EP_DTOG_RX) != 0)\ |
bogdanm | 92:4fc01daae5a5 | 510 | PCD_RX_DTOG((USBx), (bEpNum)) |
bogdanm | 92:4fc01daae5a5 | 511 | #define PCD_CLEAR_TX_DTOG(USBx, bEpNum) if((PCD_GET_ENDPOINT((USBx), (bEpNum)) & USB_EP_DTOG_TX) != 0)\ |
bogdanm | 92:4fc01daae5a5 | 512 | PCD_TX_DTOG((USBx), (bEpNum)) |
bogdanm | 85:024bf7f99721 | 513 | |
bogdanm | 85:024bf7f99721 | 514 | /** |
bogdanm | 85:024bf7f99721 | 515 | * @brief Sets address in an endpoint register. |
bogdanm | 85:024bf7f99721 | 516 | * @param USBx: USB peripheral instance register address. |
bogdanm | 85:024bf7f99721 | 517 | * @param bEpNum: Endpoint Number. |
bogdanm | 85:024bf7f99721 | 518 | * @param bAddr: Address. |
bogdanm | 85:024bf7f99721 | 519 | * @retval None |
bogdanm | 85:024bf7f99721 | 520 | */ |
bogdanm | 92:4fc01daae5a5 | 521 | #define PCD_SET_EP_ADDRESS(USBx, bEpNum,bAddr) PCD_SET_ENDPOINT((USBx), (bEpNum),\ |
bogdanm | 92:4fc01daae5a5 | 522 | USB_EP_CTR_RX|USB_EP_CTR_TX|(PCD_GET_ENDPOINT((USBx), (bEpNum)) & USB_EPREG_MASK) | (bAddr)) |
bogdanm | 85:024bf7f99721 | 523 | |
bogdanm | 85:024bf7f99721 | 524 | /** |
bogdanm | 85:024bf7f99721 | 525 | * @brief Gets address in an endpoint register. |
bogdanm | 85:024bf7f99721 | 526 | * @param USBx: USB peripheral instance register address. |
bogdanm | 85:024bf7f99721 | 527 | * @param bEpNum: Endpoint Number. |
bogdanm | 85:024bf7f99721 | 528 | * @retval None |
bogdanm | 85:024bf7f99721 | 529 | */ |
bogdanm | 92:4fc01daae5a5 | 530 | #define PCD_GET_EP_ADDRESS(USBx, bEpNum) ((uint8_t)(PCD_GET_ENDPOINT((USBx), (bEpNum)) & USB_EPADDR_FIELD)) |
bogdanm | 85:024bf7f99721 | 531 | |
bogdanm | 92:4fc01daae5a5 | 532 | #define PCD_EP_TX_ADDRESS(USBx, bEpNum) ((uint16_t *)(((USBx)->BTABLE+(bEpNum)*8)+ ((uint32_t)(USBx) + 0x400))) |
bogdanm | 92:4fc01daae5a5 | 533 | #define PCD_EP_TX_CNT(USBx, bEpNum) ((uint16_t *)(((USBx)->BTABLE+(bEpNum)*8+2)+ ((uint32_t)(USBx) + 0x400))) |
bogdanm | 92:4fc01daae5a5 | 534 | #define PCD_EP_RX_ADDRESS(USBx, bEpNum) ((uint16_t *)(((USBx)->BTABLE+(bEpNum)*8+4)+ ((uint32_t)(USBx) + 0x400))) |
bogdanm | 92:4fc01daae5a5 | 535 | #define PCD_EP_RX_CNT(USBx, bEpNum) ((uint16_t *)(((USBx)->BTABLE+(bEpNum)*8+6)+ ((uint32_t)(USBx) + 0x400))) |
bogdanm | 85:024bf7f99721 | 536 | |
bogdanm | 85:024bf7f99721 | 537 | /** |
bogdanm | 85:024bf7f99721 | 538 | * @brief sets address of the tx/rx buffer. |
bogdanm | 85:024bf7f99721 | 539 | * @param USBx: USB peripheral instance register address. |
bogdanm | 85:024bf7f99721 | 540 | * @param bEpNum: Endpoint Number. |
bogdanm | 85:024bf7f99721 | 541 | * @param wAddr: address to be set (must be word aligned). |
bogdanm | 85:024bf7f99721 | 542 | * @retval None |
bogdanm | 85:024bf7f99721 | 543 | */ |
bogdanm | 92:4fc01daae5a5 | 544 | #define PCD_SET_EP_TX_ADDRESS(USBx, bEpNum,wAddr) (*PCD_EP_TX_ADDRESS((USBx), (bEpNum)) = (((wAddr) >> 1) << 1)) |
bogdanm | 92:4fc01daae5a5 | 545 | #define PCD_SET_EP_RX_ADDRESS(USBx, bEpNum,wAddr) (*PCD_EP_RX_ADDRESS((USBx), (bEpNum)) = (((wAddr) >> 1) << 1)) |
bogdanm | 85:024bf7f99721 | 546 | |
bogdanm | 85:024bf7f99721 | 547 | /** |
bogdanm | 85:024bf7f99721 | 548 | * @brief Gets address of the tx/rx buffer. |
bogdanm | 85:024bf7f99721 | 549 | * @param USBx: USB peripheral instance register address. |
bogdanm | 85:024bf7f99721 | 550 | * @param bEpNum: Endpoint Number. |
bogdanm | 85:024bf7f99721 | 551 | * @retval address of the buffer. |
bogdanm | 85:024bf7f99721 | 552 | */ |
bogdanm | 92:4fc01daae5a5 | 553 | #define PCD_GET_EP_TX_ADDRESS(USBx, bEpNum) ((uint16_t)*PCD_EP_TX_ADDRESS((USBx), (bEpNum))) |
bogdanm | 92:4fc01daae5a5 | 554 | #define PCD_GET_EP_RX_ADDRESS(USBx, bEpNum) ((uint16_t)*PCD_EP_RX_ADDRESS((USBx), (bEpNum))) |
bogdanm | 85:024bf7f99721 | 555 | |
bogdanm | 85:024bf7f99721 | 556 | /** |
bogdanm | 85:024bf7f99721 | 557 | * @brief Sets counter of rx buffer with no. of blocks. |
bogdanm | 85:024bf7f99721 | 558 | * @param dwReg: Register |
bogdanm | 85:024bf7f99721 | 559 | * @param wCount: Counter. |
bogdanm | 85:024bf7f99721 | 560 | * @param wNBlocks: no. of Blocks. |
bogdanm | 85:024bf7f99721 | 561 | * @retval None |
bogdanm | 85:024bf7f99721 | 562 | */ |
bogdanm | 85:024bf7f99721 | 563 | #define PCD_CALC_BLK32(dwReg,wCount,wNBlocks) {\ |
bogdanm | 92:4fc01daae5a5 | 564 | (wNBlocks) = (wCount) >> 5;\ |
bogdanm | 92:4fc01daae5a5 | 565 | if(((wCount) & 0x1f) == 0)\ |
bogdanm | 92:4fc01daae5a5 | 566 | (wNBlocks)--;\ |
bogdanm | 92:4fc01daae5a5 | 567 | *pdwReg = (uint16_t)(((wNBlocks) << 10) | 0x8000);\ |
bogdanm | 85:024bf7f99721 | 568 | }/* PCD_CALC_BLK32 */ |
bogdanm | 85:024bf7f99721 | 569 | |
bogdanm | 85:024bf7f99721 | 570 | #define PCD_CALC_BLK2(dwReg,wCount,wNBlocks) {\ |
bogdanm | 92:4fc01daae5a5 | 571 | (wNBlocks) = (wCount) >> 1;\ |
bogdanm | 92:4fc01daae5a5 | 572 | if(((wCount) & 0x1) != 0)\ |
bogdanm | 92:4fc01daae5a5 | 573 | (wNBlocks)++;\ |
bogdanm | 92:4fc01daae5a5 | 574 | *pdwReg = (uint16_t)((wNBlocks) << 10);\ |
bogdanm | 85:024bf7f99721 | 575 | }/* PCD_CALC_BLK2 */ |
bogdanm | 85:024bf7f99721 | 576 | |
bogdanm | 85:024bf7f99721 | 577 | #define PCD_SET_EP_CNT_RX_REG(dwReg,wCount) {\ |
bogdanm | 85:024bf7f99721 | 578 | uint16_t wNBlocks;\ |
bogdanm | 92:4fc01daae5a5 | 579 | if((wCount) > 62){PCD_CALC_BLK32((dwReg),(wCount),wNBlocks);}\ |
bogdanm | 92:4fc01daae5a5 | 580 | else {PCD_CALC_BLK2((dwReg),(wCount),wNBlocks);}\ |
bogdanm | 85:024bf7f99721 | 581 | }/* PCD_SET_EP_CNT_RX_REG */ |
bogdanm | 85:024bf7f99721 | 582 | |
bogdanm | 85:024bf7f99721 | 583 | #define PCD_SET_EP_RX_DBUF0_CNT(USBx, bEpNum,wCount) {\ |
bogdanm | 92:4fc01daae5a5 | 584 | uint16_t *pdwReg = PCD_EP_TX_CNT((USBx), (bEpNum)); \ |
bogdanm | 92:4fc01daae5a5 | 585 | PCD_SET_EP_CNT_RX_REG(pdwReg, (wCount));\ |
bogdanm | 85:024bf7f99721 | 586 | } |
bogdanm | 85:024bf7f99721 | 587 | /** |
bogdanm | 85:024bf7f99721 | 588 | * @brief sets counter for the tx/rx buffer. |
bogdanm | 85:024bf7f99721 | 589 | * @param USBx: USB peripheral instance register address. |
bogdanm | 85:024bf7f99721 | 590 | * @param bEpNum: Endpoint Number. |
bogdanm | 85:024bf7f99721 | 591 | * @param wCount: Counter value. |
bogdanm | 85:024bf7f99721 | 592 | * @retval None |
bogdanm | 85:024bf7f99721 | 593 | */ |
bogdanm | 92:4fc01daae5a5 | 594 | #define PCD_SET_EP_TX_CNT(USBx, bEpNum,wCount) (*PCD_EP_TX_CNT((USBx), (bEpNum)) = (wCount)) |
bogdanm | 85:024bf7f99721 | 595 | #define PCD_SET_EP_RX_CNT(USBx, bEpNum,wCount) {\ |
bogdanm | 85:024bf7f99721 | 596 | uint16_t *pdwReg = PCD_EP_RX_CNT(USBx, bEpNum); \ |
bogdanm | 85:024bf7f99721 | 597 | PCD_SET_EP_CNT_RX_REG(pdwReg, wCount);\ |
bogdanm | 85:024bf7f99721 | 598 | } |
bogdanm | 85:024bf7f99721 | 599 | |
bogdanm | 85:024bf7f99721 | 600 | /** |
bogdanm | 85:024bf7f99721 | 601 | * @brief gets counter of the tx buffer. |
bogdanm | 85:024bf7f99721 | 602 | * @param USBx: USB peripheral instance register address. |
bogdanm | 85:024bf7f99721 | 603 | * @param bEpNum: Endpoint Number. |
bogdanm | 85:024bf7f99721 | 604 | * @retval Counter value |
bogdanm | 85:024bf7f99721 | 605 | */ |
bogdanm | 92:4fc01daae5a5 | 606 | #define PCD_GET_EP_TX_CNT(USBx, bEpNum)((uint16_t)(*PCD_EP_TX_CNT((USBx), (bEpNum))) & 0x3ff) |
bogdanm | 92:4fc01daae5a5 | 607 | #define PCD_GET_EP_RX_CNT(USBx, bEpNum)((uint16_t)(*PCD_EP_RX_CNT((USBx), (bEpNum))) & 0x3ff) |
bogdanm | 85:024bf7f99721 | 608 | |
bogdanm | 85:024bf7f99721 | 609 | /** |
bogdanm | 85:024bf7f99721 | 610 | * @brief Sets buffer 0/1 address in a double buffer endpoint. |
bogdanm | 85:024bf7f99721 | 611 | * @param USBx: USB peripheral instance register address. |
bogdanm | 85:024bf7f99721 | 612 | * @param bEpNum: Endpoint Number. |
bogdanm | 85:024bf7f99721 | 613 | * @param wBuf0Addr: buffer 0 address. |
bogdanm | 85:024bf7f99721 | 614 | * @retval Counter value |
bogdanm | 85:024bf7f99721 | 615 | */ |
bogdanm | 92:4fc01daae5a5 | 616 | #define PCD_SET_EP_DBUF0_ADDR(USBx, bEpNum,wBuf0Addr) {PCD_SET_EP_TX_ADDRESS((USBx), (bEpNum), (wBuf0Addr));} |
bogdanm | 92:4fc01daae5a5 | 617 | #define PCD_SET_EP_DBUF1_ADDR(USBx, bEpNum,wBuf1Addr) {PCD_SET_EP_RX_ADDRESS((USBx), (bEpNum), (wBuf1Addr));} |
bogdanm | 85:024bf7f99721 | 618 | |
bogdanm | 85:024bf7f99721 | 619 | /** |
bogdanm | 85:024bf7f99721 | 620 | * @brief Sets addresses in a double buffer endpoint. |
bogdanm | 85:024bf7f99721 | 621 | * @param USBx: USB peripheral instance register address. |
bogdanm | 85:024bf7f99721 | 622 | * @param bEpNum: Endpoint Number. |
bogdanm | 85:024bf7f99721 | 623 | * @param wBuf0Addr: buffer 0 address. |
bogdanm | 85:024bf7f99721 | 624 | * @param wBuf1Addr = buffer 1 address. |
bogdanm | 85:024bf7f99721 | 625 | * @retval None |
bogdanm | 85:024bf7f99721 | 626 | */ |
bogdanm | 85:024bf7f99721 | 627 | #define PCD_SET_EP_DBUF_ADDR(USBx, bEpNum,wBuf0Addr,wBuf1Addr) { \ |
bogdanm | 92:4fc01daae5a5 | 628 | PCD_SET_EP_DBUF0_ADDR((USBx), (bEpNum), (wBuf0Addr));\ |
bogdanm | 92:4fc01daae5a5 | 629 | PCD_SET_EP_DBUF1_ADDR((USBx), (bEpNum), (wBuf1Addr));\ |
bogdanm | 85:024bf7f99721 | 630 | } /* PCD_SET_EP_DBUF_ADDR */ |
bogdanm | 85:024bf7f99721 | 631 | |
bogdanm | 85:024bf7f99721 | 632 | /** |
bogdanm | 85:024bf7f99721 | 633 | * @brief Gets buffer 0/1 address of a double buffer endpoint. |
bogdanm | 85:024bf7f99721 | 634 | * @param USBx: USB peripheral instance register address. |
bogdanm | 85:024bf7f99721 | 635 | * @param bEpNum: Endpoint Number. |
bogdanm | 85:024bf7f99721 | 636 | * @retval None |
bogdanm | 85:024bf7f99721 | 637 | */ |
bogdanm | 92:4fc01daae5a5 | 638 | #define PCD_GET_EP_DBUF0_ADDR(USBx, bEpNum) (PCD_GET_EP_TX_ADDRESS((USBx), (bEpNum))) |
bogdanm | 92:4fc01daae5a5 | 639 | #define PCD_GET_EP_DBUF1_ADDR(USBx, bEpNum) (PCD_GET_EP_RX_ADDRESS((USBx), (bEpNum))) |
bogdanm | 85:024bf7f99721 | 640 | |
bogdanm | 85:024bf7f99721 | 641 | /** |
bogdanm | 85:024bf7f99721 | 642 | * @brief Gets buffer 0/1 address of a double buffer endpoint. |
bogdanm | 85:024bf7f99721 | 643 | * @param USBx: USB peripheral instance register address. |
bogdanm | 85:024bf7f99721 | 644 | * @param bEpNum: Endpoint Number. |
bogdanm | 85:024bf7f99721 | 645 | * @param bDir: endpoint dir EP_DBUF_OUT = OUT |
bogdanm | 85:024bf7f99721 | 646 | * EP_DBUF_IN = IN |
bogdanm | 85:024bf7f99721 | 647 | * @param wCount: Counter value |
bogdanm | 85:024bf7f99721 | 648 | * @retval None |
bogdanm | 85:024bf7f99721 | 649 | */ |
bogdanm | 85:024bf7f99721 | 650 | #define PCD_SET_EP_DBUF0_CNT(USBx, bEpNum, bDir, wCount) { \ |
bogdanm | 92:4fc01daae5a5 | 651 | if((bDir) == PCD_EP_DBUF_OUT)\ |
bogdanm | 85:024bf7f99721 | 652 | /* OUT endpoint */ \ |
bogdanm | 92:4fc01daae5a5 | 653 | {PCD_SET_EP_RX_DBUF0_CNT((USBx), (bEpNum),(wCount));} \ |
bogdanm | 92:4fc01daae5a5 | 654 | else if((bDir) == PCD_EP_DBUF_IN)\ |
bogdanm | 85:024bf7f99721 | 655 | /* IN endpoint */ \ |
bogdanm | 92:4fc01daae5a5 | 656 | *PCD_EP_TX_CNT((USBx), (bEpNum)) = (uint32_t)(wCount); \ |
bogdanm | 85:024bf7f99721 | 657 | } /* SetEPDblBuf0Count*/ |
bogdanm | 85:024bf7f99721 | 658 | |
bogdanm | 85:024bf7f99721 | 659 | #define PCD_SET_EP_DBUF1_CNT(USBx, bEpNum, bDir, wCount) { \ |
bogdanm | 92:4fc01daae5a5 | 660 | if((bDir) == PCD_EP_DBUF_OUT)\ |
bogdanm | 85:024bf7f99721 | 661 | /* OUT endpoint */ \ |
bogdanm | 92:4fc01daae5a5 | 662 | {PCD_SET_EP_RX_CNT((USBx), (bEpNum),(wCount));}\ |
bogdanm | 92:4fc01daae5a5 | 663 | else if((bDir) == PCD_EP_DBUF_IN)\ |
bogdanm | 85:024bf7f99721 | 664 | /* IN endpoint */\ |
bogdanm | 92:4fc01daae5a5 | 665 | *PCD_EP_RX_CNT((USBx), (bEpNum)) = (uint32_t)(wCount); \ |
bogdanm | 85:024bf7f99721 | 666 | } /* SetEPDblBuf1Count */ |
bogdanm | 85:024bf7f99721 | 667 | |
bogdanm | 85:024bf7f99721 | 668 | #define PCD_SET_EP_DBUF_CNT(USBx, bEpNum, bDir, wCount) {\ |
bogdanm | 92:4fc01daae5a5 | 669 | PCD_SET_EP_DBUF0_CNT((USBx), (bEpNum), (bDir), (wCount)); \ |
bogdanm | 92:4fc01daae5a5 | 670 | PCD_SET_EP_DBUF1_CNT((USBx), (bEpNum), (bDir), (wCount)); \ |
bogdanm | 85:024bf7f99721 | 671 | } /* PCD_SET_EP_DBUF_CNT */ |
bogdanm | 85:024bf7f99721 | 672 | |
bogdanm | 85:024bf7f99721 | 673 | /** |
bogdanm | 85:024bf7f99721 | 674 | * @brief Gets buffer 0/1 rx/tx counter for double buffering. |
bogdanm | 85:024bf7f99721 | 675 | * @param USBx: USB peripheral instance register address. |
bogdanm | 85:024bf7f99721 | 676 | * @param bEpNum: Endpoint Number. |
bogdanm | 85:024bf7f99721 | 677 | * @retval None |
bogdanm | 85:024bf7f99721 | 678 | */ |
bogdanm | 92:4fc01daae5a5 | 679 | #define PCD_GET_EP_DBUF0_CNT(USBx, bEpNum) (PCD_GET_EP_TX_CNT((USBx), (bEpNum))) |
bogdanm | 92:4fc01daae5a5 | 680 | #define PCD_GET_EP_DBUF1_CNT(USBx, bEpNum) (PCD_GET_EP_RX_CNT((USBx), (bEpNum))) |
bogdanm | 85:024bf7f99721 | 681 | |
bogdanm | 85:024bf7f99721 | 682 | |
bogdanm | 85:024bf7f99721 | 683 | /** |
bogdanm | 85:024bf7f99721 | 684 | * @} |
bogdanm | 85:024bf7f99721 | 685 | */ |
bogdanm | 85:024bf7f99721 | 686 | |
bogdanm | 85:024bf7f99721 | 687 | /* Exported functions --------------------------------------------------------*/ |
bogdanm | 85:024bf7f99721 | 688 | |
bogdanm | 92:4fc01daae5a5 | 689 | /** @addtogroup PCD_Exported_Functions |
bogdanm | 92:4fc01daae5a5 | 690 | * @{ |
bogdanm | 92:4fc01daae5a5 | 691 | */ |
bogdanm | 92:4fc01daae5a5 | 692 | |
bogdanm | 92:4fc01daae5a5 | 693 | /** @addtogroup PCD_Exported_Functions_Group1 |
bogdanm | 92:4fc01daae5a5 | 694 | * @{ |
bogdanm | 92:4fc01daae5a5 | 695 | */ |
bogdanm | 92:4fc01daae5a5 | 696 | /* Initialization and de-initialization functions **********************************/ |
bogdanm | 85:024bf7f99721 | 697 | HAL_StatusTypeDef HAL_PCD_Init(PCD_HandleTypeDef *hpcd); |
bogdanm | 85:024bf7f99721 | 698 | HAL_StatusTypeDef HAL_PCD_DeInit (PCD_HandleTypeDef *hpcd); |
bogdanm | 85:024bf7f99721 | 699 | void HAL_PCD_MspInit(PCD_HandleTypeDef *hpcd); |
bogdanm | 85:024bf7f99721 | 700 | void HAL_PCD_MspDeInit(PCD_HandleTypeDef *hpcd); |
bogdanm | 85:024bf7f99721 | 701 | |
bogdanm | 92:4fc01daae5a5 | 702 | /** |
bogdanm | 92:4fc01daae5a5 | 703 | * @} |
bogdanm | 92:4fc01daae5a5 | 704 | */ |
bogdanm | 92:4fc01daae5a5 | 705 | |
bogdanm | 92:4fc01daae5a5 | 706 | /** @addtogroup PCD_Exported_Functions_Group2 |
bogdanm | 92:4fc01daae5a5 | 707 | * @{ |
bogdanm | 92:4fc01daae5a5 | 708 | */ |
bogdanm | 92:4fc01daae5a5 | 709 | /* IO operation functions *****************************************************/ |
bogdanm | 92:4fc01daae5a5 | 710 | /* Non Blocking mode: Interrupt */ |
bogdanm | 85:024bf7f99721 | 711 | HAL_StatusTypeDef HAL_PCD_Start(PCD_HandleTypeDef *hpcd); |
bogdanm | 85:024bf7f99721 | 712 | HAL_StatusTypeDef HAL_PCD_Stop(PCD_HandleTypeDef *hpcd); |
bogdanm | 85:024bf7f99721 | 713 | void HAL_PCD_IRQHandler(PCD_HandleTypeDef *hpcd); |
bogdanm | 85:024bf7f99721 | 714 | |
bogdanm | 85:024bf7f99721 | 715 | void HAL_PCD_DataOutStageCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum); |
bogdanm | 85:024bf7f99721 | 716 | void HAL_PCD_DataInStageCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum); |
bogdanm | 85:024bf7f99721 | 717 | void HAL_PCD_SetupStageCallback(PCD_HandleTypeDef *hpcd); |
bogdanm | 85:024bf7f99721 | 718 | void HAL_PCD_SOFCallback(PCD_HandleTypeDef *hpcd); |
bogdanm | 85:024bf7f99721 | 719 | void HAL_PCD_ResetCallback(PCD_HandleTypeDef *hpcd); |
bogdanm | 85:024bf7f99721 | 720 | void HAL_PCD_SuspendCallback(PCD_HandleTypeDef *hpcd); |
bogdanm | 85:024bf7f99721 | 721 | void HAL_PCD_ResumeCallback(PCD_HandleTypeDef *hpcd); |
bogdanm | 85:024bf7f99721 | 722 | void HAL_PCD_ISOOUTIncompleteCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum); |
bogdanm | 85:024bf7f99721 | 723 | void HAL_PCD_ISOINIncompleteCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum); |
bogdanm | 85:024bf7f99721 | 724 | void HAL_PCD_ConnectCallback(PCD_HandleTypeDef *hpcd); |
bogdanm | 85:024bf7f99721 | 725 | void HAL_PCD_DisconnectCallback(PCD_HandleTypeDef *hpcd); |
bogdanm | 85:024bf7f99721 | 726 | |
bogdanm | 92:4fc01daae5a5 | 727 | /** |
bogdanm | 92:4fc01daae5a5 | 728 | * @} |
bogdanm | 92:4fc01daae5a5 | 729 | */ |
bogdanm | 92:4fc01daae5a5 | 730 | |
bogdanm | 92:4fc01daae5a5 | 731 | /** @addtogroup PCD_Exported_Functions_Group3 |
bogdanm | 92:4fc01daae5a5 | 732 | * @{ |
bogdanm | 92:4fc01daae5a5 | 733 | */ |
bogdanm | 85:024bf7f99721 | 734 | /* Peripheral Control functions ************************************************/ |
bogdanm | 85:024bf7f99721 | 735 | HAL_StatusTypeDef HAL_PCD_DevConnect(PCD_HandleTypeDef *hpcd); |
bogdanm | 85:024bf7f99721 | 736 | HAL_StatusTypeDef HAL_PCD_DevDisconnect(PCD_HandleTypeDef *hpcd); |
bogdanm | 85:024bf7f99721 | 737 | HAL_StatusTypeDef HAL_PCD_SetAddress(PCD_HandleTypeDef *hpcd, uint8_t address); |
bogdanm | 85:024bf7f99721 | 738 | HAL_StatusTypeDef HAL_PCD_EP_Open(PCD_HandleTypeDef *hpcd, uint8_t ep_addr, uint16_t ep_mps, uint8_t ep_type); |
bogdanm | 85:024bf7f99721 | 739 | HAL_StatusTypeDef HAL_PCD_EP_Close(PCD_HandleTypeDef *hpcd, uint8_t ep_addr); |
bogdanm | 85:024bf7f99721 | 740 | HAL_StatusTypeDef HAL_PCD_EP_Receive(PCD_HandleTypeDef *hpcd, uint8_t ep_addr, uint8_t *pBuf, uint32_t len); |
bogdanm | 85:024bf7f99721 | 741 | HAL_StatusTypeDef HAL_PCD_EP_Transmit(PCD_HandleTypeDef *hpcd, uint8_t ep_addr, uint8_t *pBuf, uint32_t len); |
bogdanm | 85:024bf7f99721 | 742 | uint16_t HAL_PCD_EP_GetRxCount(PCD_HandleTypeDef *hpcd, uint8_t ep_addr); |
bogdanm | 85:024bf7f99721 | 743 | HAL_StatusTypeDef HAL_PCD_EP_SetStall(PCD_HandleTypeDef *hpcd, uint8_t ep_addr); |
bogdanm | 85:024bf7f99721 | 744 | HAL_StatusTypeDef HAL_PCD_EP_ClrStall(PCD_HandleTypeDef *hpcd, uint8_t ep_addr); |
bogdanm | 85:024bf7f99721 | 745 | HAL_StatusTypeDef HAL_PCD_EP_Flush(PCD_HandleTypeDef *hpcd, uint8_t ep_addr); |
bogdanm | 85:024bf7f99721 | 746 | HAL_StatusTypeDef HAL_PCD_ActiveRemoteWakeup(PCD_HandleTypeDef *hpcd); |
bogdanm | 85:024bf7f99721 | 747 | HAL_StatusTypeDef HAL_PCD_DeActiveRemoteWakeup(PCD_HandleTypeDef *hpcd); |
bogdanm | 92:4fc01daae5a5 | 748 | /** |
bogdanm | 92:4fc01daae5a5 | 749 | * @} |
bogdanm | 92:4fc01daae5a5 | 750 | */ |
bogdanm | 92:4fc01daae5a5 | 751 | |
bogdanm | 92:4fc01daae5a5 | 752 | /** @addtogroup PCD_Exported_Functions_Group4 |
bogdanm | 92:4fc01daae5a5 | 753 | * @{ |
bogdanm | 92:4fc01daae5a5 | 754 | */ |
bogdanm | 85:024bf7f99721 | 755 | /* Peripheral State functions **************************************************/ |
bogdanm | 85:024bf7f99721 | 756 | PCD_StateTypeDef HAL_PCD_GetState(PCD_HandleTypeDef *hpcd); |
bogdanm | 92:4fc01daae5a5 | 757 | /** |
bogdanm | 92:4fc01daae5a5 | 758 | * @} |
bogdanm | 92:4fc01daae5a5 | 759 | */ |
bogdanm | 92:4fc01daae5a5 | 760 | |
bogdanm | 92:4fc01daae5a5 | 761 | /** |
bogdanm | 92:4fc01daae5a5 | 762 | * @} |
bogdanm | 92:4fc01daae5a5 | 763 | */ |
bogdanm | 85:024bf7f99721 | 764 | |
bogdanm | 85:024bf7f99721 | 765 | /** |
bogdanm | 85:024bf7f99721 | 766 | * @} |
bogdanm | 85:024bf7f99721 | 767 | */ |
bogdanm | 85:024bf7f99721 | 768 | |
bogdanm | 85:024bf7f99721 | 769 | /** |
bogdanm | 85:024bf7f99721 | 770 | * @} |
bogdanm | 85:024bf7f99721 | 771 | */ |
bogdanm | 85:024bf7f99721 | 772 | |
Kojto | 93:e188a91d3eaa | 773 | #endif /* STM32F042x6 || STM32F072xB || STM32F078xx || STM32F070xB || STM32F070x6 */ |
bogdanm | 85:024bf7f99721 | 774 | |
bogdanm | 85:024bf7f99721 | 775 | #ifdef __cplusplus |
bogdanm | 85:024bf7f99721 | 776 | } |
bogdanm | 85:024bf7f99721 | 777 | #endif |
bogdanm | 85:024bf7f99721 | 778 | |
bogdanm | 85:024bf7f99721 | 779 | |
bogdanm | 85:024bf7f99721 | 780 | #endif /* __STM32F0xx_HAL_PCD_H */ |
bogdanm | 85:024bf7f99721 | 781 | |
bogdanm | 85:024bf7f99721 | 782 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |
bogdanm | 92:4fc01daae5a5 | 783 |