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