The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

mbed 2

This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.

Committer:
<>
Date:
Mon Jan 16 12:05:23 2017 +0000
Revision:
134:ad3be0349dc5
Parent:
128:9bcdf88f62b0
Release 134 of the mbed library

Ports for Upcoming Targets


Fixes and Changes

3488: Dev stm i2c v2 unitary functions https://github.com/ARMmbed/mbed-os/pull/3488
3492: Fix #3463 CAN read() return value https://github.com/ARMmbed/mbed-os/pull/3492
3503: [LPC15xx] Ensure that PWM=1 is resolved correctly https://github.com/ARMmbed/mbed-os/pull/3503
3504: [LPC15xx] CAN implementation improvements https://github.com/ARMmbed/mbed-os/pull/3504
3539: NUCLEO_F412ZG - Add support of TRNG peripheral https://github.com/ARMmbed/mbed-os/pull/3539
3540: STM: SPI: Initialize Rx in spi_master_write https://github.com/ARMmbed/mbed-os/pull/3540
3438: K64F: Add support for SERIAL ASYNCH API https://github.com/ARMmbed/mbed-os/pull/3438
3519: MCUXpresso: Fix ENET driver to enable interrupts after interrupt handler is set https://github.com/ARMmbed/mbed-os/pull/3519
3544: STM32L4 deepsleep improvement https://github.com/ARMmbed/mbed-os/pull/3544
3546: NUCLEO-F412ZG - Add CAN peripheral https://github.com/ARMmbed/mbed-os/pull/3546
3551: Fix I2C driver for RZ/A1H https://github.com/ARMmbed/mbed-os/pull/3551
3558: K64F UART Asynch API: Fix synchronization issue https://github.com/ARMmbed/mbed-os/pull/3558
3563: LPC4088 - Fix vector checksum https://github.com/ARMmbed/mbed-os/pull/3563
3567: Dev stm32 F0 v1.7.0 https://github.com/ARMmbed/mbed-os/pull/3567
3577: Fixes linking errors when building with debug profile https://github.com/ARMmbed/mbed-os/pull/3577

Who changed what in which revision?

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