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