meh
Fork of mbed by
TARGET_MTS_MDOT_F405RG/stm32f4xx_hal_pcd.h@110:165afa46840b, 2015-11-25 (annotated)
- Committer:
- Kojto
- Date:
- Wed Nov 25 13:21:40 2015 +0000
- Revision:
- 110:165afa46840b
- Parent:
- 106:ba1f97679dad
Release 110 of the mbed library
Changes:
- new platforms - STM32F410R, DISCO_F429ZI, DISCO_F469NI
- Nucleo L476 - gcc and uvision template
- k22,k64f targets - ADC channels A addition
- EFM32 - bugfixes in sleep, serial and spi
- Delta DFCM NNN40 - pinnames update
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
bogdanm | 92:4fc01daae5a5 | 1 | /** |
bogdanm | 92:4fc01daae5a5 | 2 | ****************************************************************************** |
bogdanm | 92:4fc01daae5a5 | 3 | * @file stm32f4xx_hal_pcd.h |
bogdanm | 92:4fc01daae5a5 | 4 | * @author MCD Application Team |
Kojto | 110:165afa46840b | 5 | * @version V1.4.1 |
Kojto | 110:165afa46840b | 6 | * @date 09-October-2015 |
bogdanm | 92:4fc01daae5a5 | 7 | * @brief Header file of PCD HAL module. |
bogdanm | 92:4fc01daae5a5 | 8 | ****************************************************************************** |
bogdanm | 92:4fc01daae5a5 | 9 | * @attention |
bogdanm | 92:4fc01daae5a5 | 10 | * |
Kojto | 99:dbbf35b96557 | 11 | * <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2> |
bogdanm | 92:4fc01daae5a5 | 12 | * |
bogdanm | 92:4fc01daae5a5 | 13 | * Redistribution and use in source and binary forms, with or without modification, |
bogdanm | 92:4fc01daae5a5 | 14 | * are permitted provided that the following conditions are met: |
bogdanm | 92:4fc01daae5a5 | 15 | * 1. Redistributions of source code must retain the above copyright notice, |
bogdanm | 92:4fc01daae5a5 | 16 | * this list of conditions and the following disclaimer. |
bogdanm | 92:4fc01daae5a5 | 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
bogdanm | 92:4fc01daae5a5 | 18 | * this list of conditions and the following disclaimer in the documentation |
bogdanm | 92:4fc01daae5a5 | 19 | * and/or other materials provided with the distribution. |
bogdanm | 92:4fc01daae5a5 | 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
bogdanm | 92:4fc01daae5a5 | 21 | * may be used to endorse or promote products derived from this software |
bogdanm | 92:4fc01daae5a5 | 22 | * without specific prior written permission. |
bogdanm | 92:4fc01daae5a5 | 23 | * |
bogdanm | 92:4fc01daae5a5 | 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
bogdanm | 92:4fc01daae5a5 | 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
bogdanm | 92:4fc01daae5a5 | 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
bogdanm | 92:4fc01daae5a5 | 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
bogdanm | 92:4fc01daae5a5 | 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
bogdanm | 92:4fc01daae5a5 | 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
bogdanm | 92:4fc01daae5a5 | 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
bogdanm | 92:4fc01daae5a5 | 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
bogdanm | 92:4fc01daae5a5 | 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
bogdanm | 92:4fc01daae5a5 | 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
bogdanm | 92:4fc01daae5a5 | 34 | * |
bogdanm | 92:4fc01daae5a5 | 35 | ****************************************************************************** |
bogdanm | 92:4fc01daae5a5 | 36 | */ |
bogdanm | 92:4fc01daae5a5 | 37 | |
bogdanm | 92:4fc01daae5a5 | 38 | /* Define to prevent recursive inclusion -------------------------------------*/ |
bogdanm | 92:4fc01daae5a5 | 39 | #ifndef __STM32F4xx_HAL_PCD_H |
bogdanm | 92:4fc01daae5a5 | 40 | #define __STM32F4xx_HAL_PCD_H |
bogdanm | 92:4fc01daae5a5 | 41 | |
bogdanm | 92:4fc01daae5a5 | 42 | #ifdef __cplusplus |
bogdanm | 92:4fc01daae5a5 | 43 | extern "C" { |
bogdanm | 92:4fc01daae5a5 | 44 | #endif |
Kojto | 110:165afa46840b | 45 | #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) || \ |
Kojto | 110:165afa46840b | 46 | defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || \ |
Kojto | 110:165afa46840b | 47 | defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F411xE) || defined(STM32F446xx) || \ |
Kojto | 110:165afa46840b | 48 | defined(STM32F469xx) || defined(STM32F479xx) |
bogdanm | 92:4fc01daae5a5 | 49 | /* Includes ------------------------------------------------------------------*/ |
bogdanm | 92:4fc01daae5a5 | 50 | #include "stm32f4xx_ll_usb.h" |
bogdanm | 92:4fc01daae5a5 | 51 | |
bogdanm | 92:4fc01daae5a5 | 52 | /** @addtogroup STM32F4xx_HAL_Driver |
bogdanm | 92:4fc01daae5a5 | 53 | * @{ |
bogdanm | 92:4fc01daae5a5 | 54 | */ |
bogdanm | 92:4fc01daae5a5 | 55 | |
bogdanm | 92:4fc01daae5a5 | 56 | /** @addtogroup PCD |
bogdanm | 92:4fc01daae5a5 | 57 | * @{ |
bogdanm | 92:4fc01daae5a5 | 58 | */ |
bogdanm | 92:4fc01daae5a5 | 59 | |
bogdanm | 92:4fc01daae5a5 | 60 | /* Exported types ------------------------------------------------------------*/ |
Kojto | 99:dbbf35b96557 | 61 | /** @defgroup PCD_Exported_Types PCD Exported Types |
Kojto | 99:dbbf35b96557 | 62 | * @{ |
Kojto | 99:dbbf35b96557 | 63 | */ |
Kojto | 99:dbbf35b96557 | 64 | |
Kojto | 99:dbbf35b96557 | 65 | /** |
Kojto | 99:dbbf35b96557 | 66 | * @brief PCD State structure definition |
Kojto | 99:dbbf35b96557 | 67 | */ |
bogdanm | 92:4fc01daae5a5 | 68 | typedef enum |
bogdanm | 92:4fc01daae5a5 | 69 | { |
bogdanm | 92:4fc01daae5a5 | 70 | HAL_PCD_STATE_RESET = 0x00, |
bogdanm | 92:4fc01daae5a5 | 71 | HAL_PCD_STATE_READY = 0x01, |
bogdanm | 92:4fc01daae5a5 | 72 | HAL_PCD_STATE_ERROR = 0x02, |
bogdanm | 92:4fc01daae5a5 | 73 | HAL_PCD_STATE_BUSY = 0x03, |
bogdanm | 92:4fc01daae5a5 | 74 | HAL_PCD_STATE_TIMEOUT = 0x04 |
bogdanm | 92:4fc01daae5a5 | 75 | } PCD_StateTypeDef; |
bogdanm | 92:4fc01daae5a5 | 76 | |
Kojto | 99:dbbf35b96557 | 77 | #ifdef USB_OTG_GLPMCFG_LPMEN |
Kojto | 99:dbbf35b96557 | 78 | /* Device LPM suspend state */ |
Kojto | 99:dbbf35b96557 | 79 | typedef enum |
Kojto | 99:dbbf35b96557 | 80 | { |
Kojto | 99:dbbf35b96557 | 81 | LPM_L0 = 0x00, /* on */ |
Kojto | 99:dbbf35b96557 | 82 | LPM_L1 = 0x01, /* LPM L1 sleep */ |
Kojto | 99:dbbf35b96557 | 83 | LPM_L2 = 0x02, /* suspend */ |
Kojto | 99:dbbf35b96557 | 84 | LPM_L3 = 0x03, /* off */ |
Kojto | 99:dbbf35b96557 | 85 | }PCD_LPM_StateTypeDef; |
Kojto | 99:dbbf35b96557 | 86 | #endif /* USB_OTG_GLPMCFG_LPMEN */ |
bogdanm | 92:4fc01daae5a5 | 87 | |
bogdanm | 92:4fc01daae5a5 | 88 | typedef USB_OTG_GlobalTypeDef PCD_TypeDef; |
bogdanm | 92:4fc01daae5a5 | 89 | typedef USB_OTG_CfgTypeDef PCD_InitTypeDef; |
bogdanm | 92:4fc01daae5a5 | 90 | typedef USB_OTG_EPTypeDef PCD_EPTypeDef ; |
bogdanm | 92:4fc01daae5a5 | 91 | |
bogdanm | 92:4fc01daae5a5 | 92 | /** |
bogdanm | 92:4fc01daae5a5 | 93 | * @brief PCD Handle Structure definition |
bogdanm | 92:4fc01daae5a5 | 94 | */ |
bogdanm | 92:4fc01daae5a5 | 95 | typedef struct |
bogdanm | 92:4fc01daae5a5 | 96 | { |
Kojto | 99:dbbf35b96557 | 97 | PCD_TypeDef *Instance; /*!< Register base address */ |
Kojto | 99:dbbf35b96557 | 98 | PCD_InitTypeDef Init; /*!< PCD required parameters */ |
Kojto | 99:dbbf35b96557 | 99 | PCD_EPTypeDef IN_ep[15]; /*!< IN endpoint parameters */ |
Kojto | 99:dbbf35b96557 | 100 | PCD_EPTypeDef OUT_ep[15]; /*!< OUT endpoint parameters */ |
Kojto | 99:dbbf35b96557 | 101 | HAL_LockTypeDef Lock; /*!< PCD peripheral status */ |
Kojto | 99:dbbf35b96557 | 102 | __IO PCD_StateTypeDef State; /*!< PCD communication state */ |
Kojto | 99:dbbf35b96557 | 103 | uint32_t Setup[12]; /*!< Setup packet buffer */ |
Kojto | 99:dbbf35b96557 | 104 | #ifdef USB_OTG_GLPMCFG_LPMEN |
Kojto | 99:dbbf35b96557 | 105 | PCD_LPM_StateTypeDef LPM_State; /*!< LPM State */ |
Kojto | 99:dbbf35b96557 | 106 | uint32_t BESL; |
Kojto | 99:dbbf35b96557 | 107 | uint32_t lpm_active; /*!< Enable or disable the Link Power Management . |
Kojto | 99:dbbf35b96557 | 108 | This parameter can be set to ENABLE or DISABLE */ |
Kojto | 99:dbbf35b96557 | 109 | #endif /* USB_OTG_GLPMCFG_LPMEN */ |
Kojto | 110:165afa46840b | 110 | #ifdef USB_OTG_GCCFG_BCDEN |
Kojto | 110:165afa46840b | 111 | uint32_t battery_charging_active; /*!< Enable or disable Battery charging. |
Kojto | 110:165afa46840b | 112 | This parameter can be set to ENABLE or DISABLE */ |
Kojto | 110:165afa46840b | 113 | #endif /* USB_OTG_GCCFG_BCDEN */ |
Kojto | 99:dbbf35b96557 | 114 | void *pData; /*!< Pointer to upper stack Handler */ |
bogdanm | 92:4fc01daae5a5 | 115 | } PCD_HandleTypeDef; |
Kojto | 99:dbbf35b96557 | 116 | |
Kojto | 99:dbbf35b96557 | 117 | /** |
Kojto | 99:dbbf35b96557 | 118 | * @} |
Kojto | 99:dbbf35b96557 | 119 | */ |
Kojto | 99:dbbf35b96557 | 120 | |
Kojto | 99:dbbf35b96557 | 121 | /* Include PCD HAL Extension module */ |
Kojto | 99:dbbf35b96557 | 122 | #include "stm32f4xx_hal_pcd_ex.h" |
Kojto | 99:dbbf35b96557 | 123 | |
bogdanm | 92:4fc01daae5a5 | 124 | /* Exported constants --------------------------------------------------------*/ |
Kojto | 99:dbbf35b96557 | 125 | /** @defgroup PCD_Exported_Constants PCD Exported Constants |
bogdanm | 92:4fc01daae5a5 | 126 | * @{ |
bogdanm | 92:4fc01daae5a5 | 127 | */ |
bogdanm | 92:4fc01daae5a5 | 128 | |
Kojto | 99:dbbf35b96557 | 129 | /** @defgroup PCD_Speed PCD Speed |
bogdanm | 92:4fc01daae5a5 | 130 | * @{ |
bogdanm | 92:4fc01daae5a5 | 131 | */ |
bogdanm | 92:4fc01daae5a5 | 132 | #define PCD_SPEED_HIGH 0 |
bogdanm | 92:4fc01daae5a5 | 133 | #define PCD_SPEED_HIGH_IN_FULL 1 |
bogdanm | 92:4fc01daae5a5 | 134 | #define PCD_SPEED_FULL 2 |
bogdanm | 92:4fc01daae5a5 | 135 | /** |
bogdanm | 92:4fc01daae5a5 | 136 | * @} |
bogdanm | 92:4fc01daae5a5 | 137 | */ |
bogdanm | 92:4fc01daae5a5 | 138 | |
Kojto | 99:dbbf35b96557 | 139 | /** @defgroup PCD_PHY_Module PCD PHY Module |
bogdanm | 92:4fc01daae5a5 | 140 | * @{ |
bogdanm | 92:4fc01daae5a5 | 141 | */ |
bogdanm | 92:4fc01daae5a5 | 142 | #define PCD_PHY_ULPI 1 |
bogdanm | 92:4fc01daae5a5 | 143 | #define PCD_PHY_EMBEDDED 2 |
bogdanm | 92:4fc01daae5a5 | 144 | /** |
bogdanm | 92:4fc01daae5a5 | 145 | * @} |
bogdanm | 92:4fc01daae5a5 | 146 | */ |
Kojto | 110:165afa46840b | 147 | |
Kojto | 106:ba1f97679dad | 148 | /** @defgroup PCD_Turnaround_Timeout Turnaround Timeout Value |
Kojto | 106:ba1f97679dad | 149 | * @{ |
Kojto | 106:ba1f97679dad | 150 | */ |
Kojto | 106:ba1f97679dad | 151 | #ifndef USBD_HS_TRDT_VALUE |
Kojto | 106:ba1f97679dad | 152 | #define USBD_HS_TRDT_VALUE 9 |
Kojto | 106:ba1f97679dad | 153 | #endif /* USBD_HS_TRDT_VALUE */ |
Kojto | 106:ba1f97679dad | 154 | #ifndef USBD_FS_TRDT_VALUE |
Kojto | 106:ba1f97679dad | 155 | #define USBD_FS_TRDT_VALUE 5 |
Kojto | 106:ba1f97679dad | 156 | #endif /* USBD_FS_TRDT_VALUE */ |
Kojto | 106:ba1f97679dad | 157 | /** |
Kojto | 106:ba1f97679dad | 158 | * @} |
Kojto | 106:ba1f97679dad | 159 | */ |
Kojto | 106:ba1f97679dad | 160 | |
bogdanm | 92:4fc01daae5a5 | 161 | /** |
bogdanm | 92:4fc01daae5a5 | 162 | * @} |
bogdanm | 92:4fc01daae5a5 | 163 | */ |
bogdanm | 92:4fc01daae5a5 | 164 | |
Kojto | 99:dbbf35b96557 | 165 | /* Exported macros -----------------------------------------------------------*/ |
Kojto | 99:dbbf35b96557 | 166 | /** @defgroup PCD_Exported_Macros PCD Exported Macros |
bogdanm | 92:4fc01daae5a5 | 167 | * @brief macros to handle interrupts and specific clock configurations |
bogdanm | 92:4fc01daae5a5 | 168 | * @{ |
bogdanm | 92:4fc01daae5a5 | 169 | */ |
bogdanm | 92:4fc01daae5a5 | 170 | #define __HAL_PCD_ENABLE(__HANDLE__) USB_EnableGlobalInt ((__HANDLE__)->Instance) |
bogdanm | 92:4fc01daae5a5 | 171 | #define __HAL_PCD_DISABLE(__HANDLE__) USB_DisableGlobalInt ((__HANDLE__)->Instance) |
bogdanm | 92:4fc01daae5a5 | 172 | |
bogdanm | 92:4fc01daae5a5 | 173 | #define __HAL_PCD_GET_FLAG(__HANDLE__, __INTERRUPT__) ((USB_ReadInterrupts((__HANDLE__)->Instance) & (__INTERRUPT__)) == (__INTERRUPT__)) |
Kojto | 110:165afa46840b | 174 | #define __HAL_PCD_CLEAR_FLAG(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->GINTSTS) &= (__INTERRUPT__)) |
bogdanm | 92:4fc01daae5a5 | 175 | #define __HAL_PCD_IS_INVALID_INTERRUPT(__HANDLE__) (USB_ReadInterrupts((__HANDLE__)->Instance) == 0) |
bogdanm | 92:4fc01daae5a5 | 176 | |
bogdanm | 92:4fc01daae5a5 | 177 | |
bogdanm | 92:4fc01daae5a5 | 178 | #define __HAL_PCD_UNGATE_PHYCLOCK(__HANDLE__) *(__IO uint32_t *)((uint32_t)((__HANDLE__)->Instance) + USB_OTG_PCGCCTL_BASE) &= \ |
Kojto | 99:dbbf35b96557 | 179 | ~(USB_OTG_PCGCCTL_STOPCLK) |
bogdanm | 92:4fc01daae5a5 | 180 | |
bogdanm | 92:4fc01daae5a5 | 181 | #define __HAL_PCD_GATE_PHYCLOCK(__HANDLE__) *(__IO uint32_t *)((uint32_t)((__HANDLE__)->Instance) + USB_OTG_PCGCCTL_BASE) |= USB_OTG_PCGCCTL_STOPCLK |
bogdanm | 92:4fc01daae5a5 | 182 | |
bogdanm | 92:4fc01daae5a5 | 183 | #define __HAL_PCD_IS_PHY_SUSPENDED(__HANDLE__) ((*(__IO uint32_t *)((uint32_t)((__HANDLE__)->Instance) + USB_OTG_PCGCCTL_BASE))&0x10) |
bogdanm | 92:4fc01daae5a5 | 184 | |
Kojto | 99:dbbf35b96557 | 185 | #define USB_OTG_FS_WAKEUP_EXTI_RISING_EDGE ((uint32_t)0x08) |
Kojto | 99:dbbf35b96557 | 186 | #define USB_OTG_FS_WAKEUP_EXTI_FALLING_EDGE ((uint32_t)0x0C) |
Kojto | 99:dbbf35b96557 | 187 | #define USB_OTG_FS_WAKEUP_EXTI_RISING_FALLING_EDGE ((uint32_t)0x10) |
Kojto | 99:dbbf35b96557 | 188 | |
Kojto | 99:dbbf35b96557 | 189 | #define USB_OTG_HS_WAKEUP_EXTI_RISING_EDGE ((uint32_t)0x08) |
Kojto | 99:dbbf35b96557 | 190 | #define USB_OTG_HS_WAKEUP_EXTI_FALLING_EDGE ((uint32_t)0x0C) |
Kojto | 99:dbbf35b96557 | 191 | #define USB_OTG_HS_WAKEUP_EXTI_RISING_FALLING_EDGE ((uint32_t)0x10) |
bogdanm | 92:4fc01daae5a5 | 192 | |
Kojto | 99:dbbf35b96557 | 193 | #define USB_OTG_HS_WAKEUP_EXTI_LINE ((uint32_t)0x00100000) /*!< External interrupt line 20 Connected to the USB HS EXTI Line */ |
Kojto | 99:dbbf35b96557 | 194 | #define USB_OTG_FS_WAKEUP_EXTI_LINE ((uint32_t)0x00040000) /*!< External interrupt line 18 Connected to the USB FS EXTI Line */ |
bogdanm | 92:4fc01daae5a5 | 195 | |
Kojto | 99:dbbf35b96557 | 196 | #define __HAL_USB_OTG_HS_WAKEUP_EXTI_ENABLE_IT() EXTI->IMR |= (USB_OTG_HS_WAKEUP_EXTI_LINE) |
Kojto | 99:dbbf35b96557 | 197 | #define __HAL_USB_OTG_HS_WAKEUP_EXTI_DISABLE_IT() EXTI->IMR &= ~(USB_OTG_HS_WAKEUP_EXTI_LINE) |
Kojto | 99:dbbf35b96557 | 198 | #define __HAL_USB_OTG_HS_WAKEUP_EXTI_GET_FLAG() EXTI->PR & (USB_OTG_HS_WAKEUP_EXTI_LINE) |
Kojto | 99:dbbf35b96557 | 199 | #define __HAL_USB_OTG_HS_WAKEUP_EXTI_CLEAR_FLAG() EXTI->PR = (USB_OTG_HS_WAKEUP_EXTI_LINE) |
bogdanm | 92:4fc01daae5a5 | 200 | |
Kojto | 99:dbbf35b96557 | 201 | #define __HAL_USB_OTG_HS_WAKEUP_EXTI_ENABLE_RISING_EDGE() EXTI->FTSR &= ~(USB_OTG_HS_WAKEUP_EXTI_LINE);\ |
Kojto | 99:dbbf35b96557 | 202 | EXTI->RTSR |= USB_OTG_HS_WAKEUP_EXTI_LINE |
Kojto | 99:dbbf35b96557 | 203 | |
Kojto | 99:dbbf35b96557 | 204 | #define __HAL_USB_OTG_HS_WAKEUP_EXTI_ENABLE_FALLING_EDGE() EXTI->FTSR |= (USB_OTG_HS_WAKEUP_EXTI_LINE);\ |
Kojto | 99:dbbf35b96557 | 205 | EXTI->RTSR &= ~(USB_OTG_HS_WAKEUP_EXTI_LINE) |
bogdanm | 92:4fc01daae5a5 | 206 | |
Kojto | 99:dbbf35b96557 | 207 | #define __HAL_USB_OTG_HS_WAKEUP_EXTI_ENABLE_RISING_FALLING_EDGE() EXTI->RTSR &= ~(USB_OTG_HS_WAKEUP_EXTI_LINE);\ |
Kojto | 99:dbbf35b96557 | 208 | EXTI->FTSR &= ~(USB_OTG_HS_WAKEUP_EXTI_LINE;)\ |
Kojto | 99:dbbf35b96557 | 209 | EXTI->RTSR |= USB_OTG_HS_WAKEUP_EXTI_LINE;\ |
Kojto | 99:dbbf35b96557 | 210 | EXTI->FTSR |= USB_OTG_HS_WAKEUP_EXTI_LINE |
bogdanm | 92:4fc01daae5a5 | 211 | |
Kojto | 99:dbbf35b96557 | 212 | #define __HAL_USB_OTG_HS_WAKEUP_EXTI_GENERATE_SWIT() (EXTI->SWIER |= USB_OTG_FS_WAKEUP_EXTI_LINE) |
Kojto | 99:dbbf35b96557 | 213 | |
Kojto | 99:dbbf35b96557 | 214 | #define __HAL_USB_OTG_FS_WAKEUP_EXTI_ENABLE_IT() EXTI->IMR |= USB_OTG_FS_WAKEUP_EXTI_LINE |
Kojto | 99:dbbf35b96557 | 215 | #define __HAL_USB_OTG_FS_WAKEUP_EXTI_DISABLE_IT() EXTI->IMR &= ~(USB_OTG_FS_WAKEUP_EXTI_LINE) |
Kojto | 99:dbbf35b96557 | 216 | #define __HAL_USB_OTG_FS_WAKEUP_EXTI_GET_FLAG() EXTI->PR & (USB_OTG_FS_WAKEUP_EXTI_LINE) |
Kojto | 99:dbbf35b96557 | 217 | #define __HAL_USB_OTG_FS_WAKEUP_EXTI_CLEAR_FLAG() EXTI->PR = USB_OTG_FS_WAKEUP_EXTI_LINE |
Kojto | 99:dbbf35b96557 | 218 | |
Kojto | 99:dbbf35b96557 | 219 | #define __HAL_USB_OTG_FS_WAKEUP_EXTI_ENABLE_RISING_EDGE() EXTI->FTSR &= ~(USB_OTG_FS_WAKEUP_EXTI_LINE);\ |
Kojto | 99:dbbf35b96557 | 220 | EXTI->RTSR |= USB_OTG_FS_WAKEUP_EXTI_LINE |
bogdanm | 92:4fc01daae5a5 | 221 | |
bogdanm | 92:4fc01daae5a5 | 222 | |
Kojto | 99:dbbf35b96557 | 223 | #define __HAL_USB_OTG_FS_WAKEUP_EXTI_ENABLE_FALLING_EDGE() EXTI->FTSR |= (USB_OTG_FS_WAKEUP_EXTI_LINE);\ |
Kojto | 99:dbbf35b96557 | 224 | EXTI->RTSR &= ~(USB_OTG_FS_WAKEUP_EXTI_LINE) |
bogdanm | 92:4fc01daae5a5 | 225 | |
Kojto | 99:dbbf35b96557 | 226 | #define __HAL_USB_OTG_FS_WAKEUP_EXTI_ENABLE_RISING_FALLING_EDGE() EXTI->RTSR &= ~(USB_OTG_FS_WAKEUP_EXTI_LINE);\ |
Kojto | 99:dbbf35b96557 | 227 | EXTI->FTSR &= ~(USB_OTG_FS_WAKEUP_EXTI_LINE);\ |
Kojto | 99:dbbf35b96557 | 228 | EXTI->RTSR |= USB_OTG_FS_WAKEUP_EXTI_LINE;\ |
Kojto | 99:dbbf35b96557 | 229 | EXTI->FTSR |= USB_OTG_FS_WAKEUP_EXTI_LINE |
Kojto | 99:dbbf35b96557 | 230 | |
Kojto | 110:165afa46840b | 231 | #define __HAL_USB_OTG_FS_WAKEUP_EXTI_GENERATE_SWIT() (EXTI->SWIER |= USB_OTG_FS_WAKEUP_EXTI_LINE) |
Kojto | 106:ba1f97679dad | 232 | /** |
Kojto | 106:ba1f97679dad | 233 | * @} |
Kojto | 110:165afa46840b | 234 | */ |
bogdanm | 92:4fc01daae5a5 | 235 | |
Kojto | 99:dbbf35b96557 | 236 | /* Exported functions --------------------------------------------------------*/ |
Kojto | 99:dbbf35b96557 | 237 | /** @addtogroup PCD_Exported_Functions PCD Exported Functions |
Kojto | 99:dbbf35b96557 | 238 | * @{ |
Kojto | 99:dbbf35b96557 | 239 | */ |
bogdanm | 92:4fc01daae5a5 | 240 | |
Kojto | 99:dbbf35b96557 | 241 | /* Initialization/de-initialization functions ********************************/ |
Kojto | 99:dbbf35b96557 | 242 | /** @addtogroup PCD_Exported_Functions_Group1 Initialization and de-initialization functions |
Kojto | 99:dbbf35b96557 | 243 | * @{ |
Kojto | 99:dbbf35b96557 | 244 | */ |
Kojto | 99:dbbf35b96557 | 245 | HAL_StatusTypeDef HAL_PCD_Init(PCD_HandleTypeDef *hpcd); |
Kojto | 99:dbbf35b96557 | 246 | HAL_StatusTypeDef HAL_PCD_DeInit(PCD_HandleTypeDef *hpcd); |
Kojto | 99:dbbf35b96557 | 247 | void HAL_PCD_MspInit(PCD_HandleTypeDef *hpcd); |
Kojto | 99:dbbf35b96557 | 248 | void HAL_PCD_MspDeInit(PCD_HandleTypeDef *hpcd); |
bogdanm | 92:4fc01daae5a5 | 249 | /** |
bogdanm | 92:4fc01daae5a5 | 250 | * @} |
bogdanm | 92:4fc01daae5a5 | 251 | */ |
bogdanm | 92:4fc01daae5a5 | 252 | |
Kojto | 99:dbbf35b96557 | 253 | /* I/O operation functions ***************************************************/ |
Kojto | 99:dbbf35b96557 | 254 | /* Non-Blocking mode: Interrupt */ |
Kojto | 110:165afa46840b | 255 | /** @addtogroup PCD_Exported_Functions_Group2 Input and Output operation functions |
Kojto | 99:dbbf35b96557 | 256 | * @{ |
Kojto | 99:dbbf35b96557 | 257 | */ |
Kojto | 99:dbbf35b96557 | 258 | /* Non-Blocking mode: Interrupt */ |
bogdanm | 92:4fc01daae5a5 | 259 | HAL_StatusTypeDef HAL_PCD_Start(PCD_HandleTypeDef *hpcd); |
bogdanm | 92:4fc01daae5a5 | 260 | HAL_StatusTypeDef HAL_PCD_Stop(PCD_HandleTypeDef *hpcd); |
bogdanm | 92:4fc01daae5a5 | 261 | void HAL_PCD_IRQHandler(PCD_HandleTypeDef *hpcd); |
bogdanm | 92:4fc01daae5a5 | 262 | |
bogdanm | 92:4fc01daae5a5 | 263 | void HAL_PCD_DataOutStageCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum); |
bogdanm | 92:4fc01daae5a5 | 264 | void HAL_PCD_DataInStageCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum); |
bogdanm | 92:4fc01daae5a5 | 265 | void HAL_PCD_SetupStageCallback(PCD_HandleTypeDef *hpcd); |
bogdanm | 92:4fc01daae5a5 | 266 | void HAL_PCD_SOFCallback(PCD_HandleTypeDef *hpcd); |
bogdanm | 92:4fc01daae5a5 | 267 | void HAL_PCD_ResetCallback(PCD_HandleTypeDef *hpcd); |
bogdanm | 92:4fc01daae5a5 | 268 | void HAL_PCD_SuspendCallback(PCD_HandleTypeDef *hpcd); |
bogdanm | 92:4fc01daae5a5 | 269 | void HAL_PCD_ResumeCallback(PCD_HandleTypeDef *hpcd); |
bogdanm | 92:4fc01daae5a5 | 270 | void HAL_PCD_ISOOUTIncompleteCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum); |
bogdanm | 92:4fc01daae5a5 | 271 | void HAL_PCD_ISOINIncompleteCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum); |
bogdanm | 92:4fc01daae5a5 | 272 | void HAL_PCD_ConnectCallback(PCD_HandleTypeDef *hpcd); |
bogdanm | 92:4fc01daae5a5 | 273 | void HAL_PCD_DisconnectCallback(PCD_HandleTypeDef *hpcd); |
Kojto | 99:dbbf35b96557 | 274 | /** |
Kojto | 99:dbbf35b96557 | 275 | * @} |
Kojto | 99:dbbf35b96557 | 276 | */ |
bogdanm | 92:4fc01daae5a5 | 277 | |
Kojto | 99:dbbf35b96557 | 278 | /* Peripheral Control functions **********************************************/ |
Kojto | 99:dbbf35b96557 | 279 | /** @addtogroup PCD_Exported_Functions_Group3 Peripheral Control functions |
Kojto | 99:dbbf35b96557 | 280 | * @{ |
Kojto | 99:dbbf35b96557 | 281 | */ |
bogdanm | 92:4fc01daae5a5 | 282 | HAL_StatusTypeDef HAL_PCD_DevConnect(PCD_HandleTypeDef *hpcd); |
bogdanm | 92:4fc01daae5a5 | 283 | HAL_StatusTypeDef HAL_PCD_DevDisconnect(PCD_HandleTypeDef *hpcd); |
bogdanm | 92:4fc01daae5a5 | 284 | HAL_StatusTypeDef HAL_PCD_SetAddress(PCD_HandleTypeDef *hpcd, uint8_t address); |
bogdanm | 92:4fc01daae5a5 | 285 | HAL_StatusTypeDef HAL_PCD_EP_Open(PCD_HandleTypeDef *hpcd, uint8_t ep_addr, uint16_t ep_mps, uint8_t ep_type); |
bogdanm | 92:4fc01daae5a5 | 286 | HAL_StatusTypeDef HAL_PCD_EP_Close(PCD_HandleTypeDef *hpcd, uint8_t ep_addr); |
bogdanm | 92:4fc01daae5a5 | 287 | HAL_StatusTypeDef HAL_PCD_EP_Receive(PCD_HandleTypeDef *hpcd, uint8_t ep_addr, uint8_t *pBuf, uint32_t len); |
bogdanm | 92:4fc01daae5a5 | 288 | HAL_StatusTypeDef HAL_PCD_EP_Transmit(PCD_HandleTypeDef *hpcd, uint8_t ep_addr, uint8_t *pBuf, uint32_t len); |
bogdanm | 92:4fc01daae5a5 | 289 | uint16_t HAL_PCD_EP_GetRxCount(PCD_HandleTypeDef *hpcd, uint8_t ep_addr); |
bogdanm | 92:4fc01daae5a5 | 290 | HAL_StatusTypeDef HAL_PCD_EP_SetStall(PCD_HandleTypeDef *hpcd, uint8_t ep_addr); |
bogdanm | 92:4fc01daae5a5 | 291 | HAL_StatusTypeDef HAL_PCD_EP_ClrStall(PCD_HandleTypeDef *hpcd, uint8_t ep_addr); |
bogdanm | 92:4fc01daae5a5 | 292 | HAL_StatusTypeDef HAL_PCD_EP_Flush(PCD_HandleTypeDef *hpcd, uint8_t ep_addr); |
Kojto | 99:dbbf35b96557 | 293 | HAL_StatusTypeDef HAL_PCD_ActivateRemoteWakeup(PCD_HandleTypeDef *hpcd); |
Kojto | 99:dbbf35b96557 | 294 | HAL_StatusTypeDef HAL_PCD_DeActivateRemoteWakeup(PCD_HandleTypeDef *hpcd); |
Kojto | 99:dbbf35b96557 | 295 | /** |
Kojto | 99:dbbf35b96557 | 296 | * @} |
Kojto | 99:dbbf35b96557 | 297 | */ |
Kojto | 99:dbbf35b96557 | 298 | |
Kojto | 99:dbbf35b96557 | 299 | /* Peripheral State functions ************************************************/ |
Kojto | 99:dbbf35b96557 | 300 | /** @addtogroup PCD_Exported_Functions_Group4 Peripheral State functions |
Kojto | 99:dbbf35b96557 | 301 | * @{ |
Kojto | 99:dbbf35b96557 | 302 | */ |
Kojto | 99:dbbf35b96557 | 303 | PCD_StateTypeDef HAL_PCD_GetState(PCD_HandleTypeDef *hpcd); |
Kojto | 99:dbbf35b96557 | 304 | /** |
Kojto | 99:dbbf35b96557 | 305 | * @} |
Kojto | 99:dbbf35b96557 | 306 | */ |
bogdanm | 92:4fc01daae5a5 | 307 | |
Kojto | 99:dbbf35b96557 | 308 | /** |
Kojto | 99:dbbf35b96557 | 309 | * @} |
Kojto | 106:ba1f97679dad | 310 | */ |
Kojto | 106:ba1f97679dad | 311 | |
Kojto | 106:ba1f97679dad | 312 | /* Private macros ------------------------------------------------------------*/ |
Kojto | 106:ba1f97679dad | 313 | /** @defgroup PCD_Private_Macros PCD Private Macros |
Kojto | 106:ba1f97679dad | 314 | * @{ |
Kojto | 106:ba1f97679dad | 315 | */ |
Kojto | 99:dbbf35b96557 | 316 | /** @defgroup PCD_Instance_definition PCD Instance definition |
Kojto | 99:dbbf35b96557 | 317 | * @{ |
Kojto | 99:dbbf35b96557 | 318 | */ |
Kojto | 99:dbbf35b96557 | 319 | #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) || defined(STM32F427xx) || defined(STM32F437xx) ||\ |
Kojto | 110:165afa46840b | 320 | defined(STM32F429xx) || defined(STM32F439xx) || defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx) |
Kojto | 99:dbbf35b96557 | 321 | #define IS_PCD_ALL_INSTANCE(INSTANCE) (((INSTANCE) == USB_OTG_FS) || \ |
Kojto | 99:dbbf35b96557 | 322 | ((INSTANCE) == USB_OTG_HS)) |
Kojto | 110:165afa46840b | 323 | #elif defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F411xE) |
Kojto | 99:dbbf35b96557 | 324 | #define IS_PCD_ALL_INSTANCE(INSTANCE) (((INSTANCE) == USB_OTG_FS)) |
Kojto | 99:dbbf35b96557 | 325 | #endif |
Kojto | 99:dbbf35b96557 | 326 | /** |
Kojto | 99:dbbf35b96557 | 327 | * @} |
Kojto | 99:dbbf35b96557 | 328 | */ |
bogdanm | 92:4fc01daae5a5 | 329 | |
bogdanm | 92:4fc01daae5a5 | 330 | /** |
bogdanm | 92:4fc01daae5a5 | 331 | * @} |
bogdanm | 92:4fc01daae5a5 | 332 | */ |
bogdanm | 92:4fc01daae5a5 | 333 | |
bogdanm | 92:4fc01daae5a5 | 334 | /** |
bogdanm | 92:4fc01daae5a5 | 335 | * @} |
bogdanm | 92:4fc01daae5a5 | 336 | */ |
bogdanm | 92:4fc01daae5a5 | 337 | |
Kojto | 110:165afa46840b | 338 | /** |
Kojto | 110:165afa46840b | 339 | * @} |
Kojto | 110:165afa46840b | 340 | */ |
Kojto | 110:165afa46840b | 341 | #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || |
Kojto | 110:165afa46840b | 342 | STM32F401xC || STM32F401xE || STM32F411xE || STM32F446xx || STM32F469xx || STM32F479xx */ |
bogdanm | 92:4fc01daae5a5 | 343 | #ifdef __cplusplus |
bogdanm | 92:4fc01daae5a5 | 344 | } |
bogdanm | 92:4fc01daae5a5 | 345 | #endif |
bogdanm | 92:4fc01daae5a5 | 346 | |
bogdanm | 92:4fc01daae5a5 | 347 | |
bogdanm | 92:4fc01daae5a5 | 348 | #endif /* __STM32F4xx_HAL_PCD_H */ |
bogdanm | 92:4fc01daae5a5 | 349 | |
bogdanm | 92:4fc01daae5a5 | 350 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |