1 /** 2 ****************************************************************************** 3 * @file stm32mp1xx_hal_gpio_ex.h 4 * @author MCD Application Team 5 * @brief Header file of GPIO HAL Extension module. 6 ****************************************************************************** 7 * @attention 8 * 9 * <h2><center>© Copyright (c) 2019 STMicroelectronics. 10 * All rights reserved.</center></h2> 11 * 12 * This software component is licensed by ST under BSD 3-Clause license, 13 * the "License"; You may not use this file except in compliance with the 14 * License. You may obtain a copy of the License at: 15 * opensource.org/licenses/BSD-3-Clause 16 * 17 ****************************************************************************** 18 */ 19 20 /* Define to prevent recursive inclusion -------------------------------------*/ 21 #ifndef __STM32MP1xx_HAL_GPIO_EX_H 22 #define __STM32MP1xx_HAL_GPIO_EX_H 23 24 #ifdef __cplusplus 25 extern "C" { 26 #endif 27 28 /* Includes ------------------------------------------------------------------*/ 29 30 /** @addtogroup STM32MP1xx_HAL_Driver 31 * @{ 32 */ 33 34 /** @addtogroup GPIOEx GPIOEx 35 * @{ 36 */ 37 38 /* Exported types ------------------------------------------------------------*/ 39 40 /* Exported constants --------------------------------------------------------*/ 41 /** @defgroup GPIOEx_Exported_Constants GPIO Exported Constants 42 * @{ 43 */ 44 45 /** @defgroup GPIO_Alternate_function_selection GPIO Alternate Function Selection 46 * @{ 47 */ 48 /** 49 * @brief AF 0 selection 50 */ 51 #define GPIO_AF0_RTC_50Hz ((uint8_t)0x00) /* RTC_50Hz Alternate Function mapping */ 52 #define GPIO_AF0_MCO1 ((uint8_t)0x00) /* MCO1 Alternate Function mapping */ 53 #define GPIO_AF0_SWJ ((uint8_t)0x00) /* SWJ (SWD and JTAG) Alternate Function mapping */ 54 #define GPIO_AF0_LCDBIAS ((uint8_t)0x00) /* LCDBIAS Alternate Function mapping */ 55 #define GPIO_AF0_TRACE ((uint8_t)0x00) /* TRACE Alternate Function mapping */ 56 #define GPIO_AF0_HDP ((uint8_t)0x00) /* HDP Alternate Function mapping */ 57 58 /** 59 * @brief AF 1 selection 60 */ 61 #define GPIO_AF1_TIM1 ((uint8_t)0x01) /* TIM1 Alternate Function mapping */ 62 #define GPIO_AF1_TIM2 ((uint8_t)0x01) /* TIM2 Alternate Function mapping */ 63 #define GPIO_AF1_TIM16 ((uint8_t)0x01) /* TIM16 Alternate Function mapping */ 64 #define GPIO_AF1_TIM17 ((uint8_t)0x01) /* TIM17 Alternate Function mapping */ 65 #define GPIO_AF1_LPTIM1 ((uint8_t)0x01) /* LPTIM1 Alternate Function mapping */ 66 #define GPIO_AF1_MCO2 ((uint8_t)0x01) /* MCO2 Alternate Function mapping */ 67 #define GPIO_AF1_RTC ((uint8_t)0x01) /* RTC Alternate Function mapping */ 68 69 /** 70 * @brief AF 2 selection 71 */ 72 #define GPIO_AF2_TIM3 ((uint8_t)0x02) /* TIM3 Alternate Function mapping */ 73 #define GPIO_AF2_TIM4 ((uint8_t)0x02) /* TIM4 Alternate Function mapping */ 74 #define GPIO_AF2_TIM5 ((uint8_t)0x02) /* TIM5 Alternate Function mapping */ 75 #define GPIO_AF2_TIM12 ((uint8_t)0x02) /* TIM12 Alternate Function mapping */ 76 #define GPIO_AF2_SAI1 ((uint8_t)0x02) /* SAI1 Alternate Function mapping */ 77 #define GPIO_AF2_SAI4 ((uint8_t)0x02) /* SAI4 Alternate Function mapping */ 78 #define GPIO_AF2_I2C6 ((uint8_t)0x02) /* I2C6 Alternate Function mapping */ 79 #define GPIO_AF2_MCO1 ((uint8_t)0x02) /* MCO1 Alternate Function mapping */ 80 #define GPIO_AF2_MCO2 ((uint8_t)0x02) /* MCO2 Alternate Function mapping */ 81 #define GPIO_AF2_HDP ((uint8_t)0x02) /* HDP Alternate Function mapping */ 82 /** 83 * @brief AF 3 selection 84 */ 85 #define GPIO_AF3_TIM8 ((uint8_t)0x03) /* TIM8 Alternate Function mapping */ 86 #define GPIO_AF3_LPTIM2 ((uint8_t)0x03) /* LPTIM2 Alternate Function mapping */ 87 #define GPIO_AF3_DFSDM1 ((uint8_t)0x03) /* DFSDM1 Alternate Function mapping */ 88 #define GPIO_AF3_I2C2 ((uint8_t)0x03) /* I2C6 Alternate Function mapping */ 89 #define GPIO_AF3_LPTIM3 ((uint8_t)0x03) /* LPTIM3 Alternate Function mapping */ 90 #define GPIO_AF3_LPTIM4 ((uint8_t)0x03) /* LPTIM4 Alternate Function mapping */ 91 #define GPIO_AF3_LPTIM5 ((uint8_t)0x03) /* LPTIM5 Alternate Function mapping */ 92 #define GPIO_AF3_SAI4 ((uint8_t)0x03) /* SAI4 Alternate Function mapping */ 93 #define GPIO_AF3_SDIO1 ((uint8_t)0x03) /* SDIO1 Alternate Function mapping */ 94 95 /** 96 * @brief AF 4 selection 97 */ 98 #define GPIO_AF4 ((uint8_t)0x04) 99 #define GPIO_AF4_I2C1 ((uint8_t)0x04) /* I2C1 Alternate Function mapping */ 100 #define GPIO_AF4_I2C2 ((uint8_t)0x04) /* I2C2 Alternate Function mapping */ 101 #define GPIO_AF4_I2C3 ((uint8_t)0x04) /* I2C3 Alternate Function mapping */ 102 #define GPIO_AF4_I2C4 ((uint8_t)0x04) /* I2C4 Alternate Function mapping */ 103 #define GPIO_AF4_I2C5 ((uint8_t)0x04) /* I2C5 Alternate Function mapping */ 104 #define GPIO_AF4_TIM15 ((uint8_t)0x04) /* TIM15 Alternate Function mapping */ 105 #define GPIO_AF4_CEC ((uint8_t)0x04) /* CEC Alternate Function mapping */ 106 #define GPIO_AF4_DFSDM1 ((uint8_t)0x04) /* DFSDM1 Alternate Function mapping */ 107 #define GPIO_AF4_LPTIM2 ((uint8_t)0x04) /* LPTIM2 Alternate Function mapping */ 108 #define GPIO_AF4_SAI4 ((uint8_t)0x04) /* SAI4 Alternate Function mapping */ 109 #define GPIO_AF4_USART1 ((uint8_t)0x04) /* USART1 Alternate Function mapping */ 110 111 /** 112 * @brief AF 5 selection 113 */ 114 #define GPIO_AF5 ((uint8_t)0x05) 115 #define GPIO_AF5_SPI1 ((uint8_t)0x05) /* SPI1 Alternate Function mapping */ 116 #define GPIO_AF5_SPI2 ((uint8_t)0x05) /* SPI2 Alternate Function mapping */ 117 #define GPIO_AF5_SPI3 ((uint8_t)0x05) /* SPI3 Alternate Function mapping */ 118 #define GPIO_AF5_SPI4 ((uint8_t)0x05) /* SPI4 Alternate Function mapping */ 119 #define GPIO_AF5_SPI5 ((uint8_t)0x05) /* SPI5 Alternate Function mapping */ 120 #define GPIO_AF5_SPI6 ((uint8_t)0x05) /* SPI6 Alternate Function mapping */ 121 #define GPIO_AF5_CEC ((uint8_t)0x05) /* CEC Alternate Function mapping */ 122 #define GPIO_AF5_I2C1 ((uint8_t)0x05) /* I2C1 Alternate Function mapping */ 123 #define GPIO_AF5_SDIO1 ((uint8_t)0x05) /* SDIO1 Alternate Function mapping */ 124 #define GPIO_AF5_SDIO3 ((uint8_t)0x05) /* SDIO3 Alternate Function mapping */ 125 126 /** 127 * @brief AF 6 selection 128 */ 129 #define GPIO_AF6_SPI3 ((uint8_t)0x06) /* SPI3 Alternate Function mapping */ 130 #define GPIO_AF6_SAI1 ((uint8_t)0x06) /* SAI1 Alternate Function mapping */ 131 #define GPIO_AF6_SAI3 ((uint8_t)0x06) /* SAI3 Alternate Function mapping */ 132 #define GPIO_AF6_SAI4 ((uint8_t)0x06) /* SAI4 Alternate Function mapping */ 133 #define GPIO_AF6_I2C4 ((uint8_t)0x06) /* I2C4 Alternate Function mapping */ 134 #define GPIO_AF6_DFSDM1 ((uint8_t)0x06) /* DFSDM1 Alternate Function mapping */ 135 #define GPIO_AF6_UART4 ((uint8_t)0x06) /* UART4 Alternate Function mapping */ 136 137 /** 138 * @brief AF 7 selection 139 */ 140 #define GPIO_AF7_SPI2 ((uint8_t)0x07) /* SPI2 Alternate Function mapping */ 141 #define GPIO_AF7_SPI3 ((uint8_t)0x07) /* SPI3 Alternate Function mapping */ 142 #define GPIO_AF7_SPI6 ((uint8_t)0x07) /* SPI6 Alternate Function mapping */ 143 #define GPIO_AF7_USART1 ((uint8_t)0x07) /* USART1 Alternate Function mapping */ 144 #define GPIO_AF7_USART2 ((uint8_t)0x07) /* USART2 Alternate Function mapping */ 145 #define GPIO_AF7_USART3 ((uint8_t)0x07) /* USART3 Alternate Function mapping */ 146 #define GPIO_AF7_USART6 ((uint8_t)0x07) /* USART6 Alternate Function mapping */ 147 #define GPIO_AF7_UART7 ((uint8_t)0x07) /* UART7 Alternate Function mapping */ 148 149 /** 150 * @brief AF 8 selection 151 */ 152 #define GPIO_AF8_SPI6 ((uint8_t)0x08) /* SPI6 Alternate Function mapping */ 153 #define GPIO_AF8_SAI2 ((uint8_t)0x08) /* SAI2 Alternate Function mapping */ 154 #define GPIO_AF8_USART3 ((uint8_t)0x08) /* USART3 Alternate Function mapping */ 155 #define GPIO_AF8_UART4 ((uint8_t)0x08) /* UART4 Alternate Function mapping */ 156 #define GPIO_AF8_UART5 ((uint8_t)0x08) /* UART5 Alternate Function mapping */ 157 #define GPIO_AF8_UART8 ((uint8_t)0x08) /* UART8 Alternate Function mapping */ 158 #define GPIO_AF8_SPDIF ((uint8_t)0x08) /* SPDIF Alternate Function mapping */ 159 #define GPIO_AF8_SDIO1 ((uint8_t)0x08) /* SDIO1 Alternate Function mapping */ 160 161 /** 162 * @brief AF 9 selection 163 */ 164 #define GPIO_AF9_QUADSPI ((uint8_t)0x09) /* QUADSPI Alternate Function mapping */ 165 #if defined (FDCAN1) 166 #define GPIO_AF9_FDCAN1 ((uint8_t)0x09) /* FDCAN1 Alternate Function mapping */ 167 #endif 168 #if defined (FDCAN2) 169 #define GPIO_AF9_FDCAN2 ((uint8_t)0x09) /* FDCAN2 Alternate Function mapping */ 170 #endif 171 #define GPIO_AF9_TIM13 ((uint8_t)0x09) /* TIM13 Alternate Function mapping */ 172 #define GPIO_AF9_TIM14 ((uint8_t)0x09) /* TIM14 Alternate Function mapping */ 173 #define GPIO_AF9_SDIO2 ((uint8_t)0x09) /* SDIO2 Alternate Function mapping */ 174 #define GPIO_AF9_LCD ((uint8_t)0x09) /* LCD Alternate Function mapping */ 175 #define GPIO_AF9_SPDIF ((uint8_t)0x09) /* SPDIF Alternate Function mapping */ 176 #define GPIO_AF9_SDIO3 ((uint8_t)0x09) /* SDIO3 Alternate Function mapping */ 177 #define GPIO_AF9_SDIO2 ((uint8_t)0x09) /* SDIO3 Alternate Function mapping */ 178 179 /** 180 * @brief AF 10 selection 181 */ 182 #define GPIO_AF10_QUADSPI ((uint8_t)0xA) /* QUADSPI Alternate Function mapping */ 183 #define GPIO_AF10_SAI2 ((uint8_t)0xA) /* SAI2 Alternate Function mapping */ 184 #define GPIO_AF10_SAI4 ((uint8_t)0xA) /* SAI4 Alternate Function mapping */ 185 #define GPIO_AF10_SDIO2 ((uint8_t)0xA) /* SDIO2 Alternate Function mapping */ 186 #define GPIO_AF10_SDIO3 ((uint8_t)0xA) /* SDIO3 Alternate Function mapping */ 187 #define GPIO_AF10_OTG2_HS ((uint8_t)0xA) /* OTG2_HS Alternate Function mapping */ 188 #define GPIO_AF10_OTG1_FS ((uint8_t)0xA) /* OTG1_FS Alternate Function mapping */ 189 190 /** 191 * @brief AF 11 selection 192 */ 193 #define GPIO_AF11_DFSDM1 ((uint8_t)0x0B) /* DFSDM1 Alternate Function mapping */ 194 #define GPIO_AF11_QUADSPI ((uint8_t)0x0B) /* QUADSPI Alternate Function mapping */ 195 #define GPIO_AF11_ETH ((uint8_t)0x0B) /* ETH Alternate Function mapping */ 196 #if defined (DSI) 197 #define GPIO_AF11_DSI ((uint8_t)0x0B) /* DSI Alternate Function mapping */ 198 #endif 199 #define GPIO_AF11_SDIO1 ((uint8_t)0x0B) /* SDIO1 Alternate Function mapping */ 200 201 /** 202 * @brief AF 12 selection 203 */ 204 #define GPIO_AF12_UART5 ((uint8_t)0xC) /* UART5 Alternate Function mapping */ 205 #define GPIO_AF12_FMC ((uint8_t)0xC) /* FMC Alternate Function mapping */ 206 #define GPIO_AF12_SDIO1 ((uint8_t)0xC) /* SDIO1 Alternate Function mapping */ 207 #define GPIO_AF12_MDIOS ((uint8_t)0xC) /* MDIOS Alternate Function mapping */ 208 #define GPIO_AF12_SAI4 ((uint8_t)0xC) /* SAI4 Alternate Function mapping */ 209 #define GPIO_AF12_SDIO1 ((uint8_t)0xC) /* SAI4 Alternate Function mapping */ 210 211 /** 212 * @brief AF 13 selection 213 */ 214 #define GPIO_AF13_UART7 ((uint8_t)0x0D) /* UART7 Alternate Function mapping */ 215 #define GPIO_AF13_DCMI ((uint8_t)0x0D) /* DCMI Alternate Function mapping */ 216 #define GPIO_AF13_LCD ((uint8_t)0x0D) /* LCD Alternate Function mapping */ 217 #if defined (DSI) 218 #define GPIO_AF13_DSI ((uint8_t)0x0D) /* DSI Alternate Function mapping */ 219 #endif 220 #define GPIO_AF13_RNG ((uint8_t)0x0D) /* RNG Alternate Function mapping */ 221 222 223 /** 224 * @brief AF 14 selection 225 */ 226 #define GPIO_AF14_UART5 ((uint8_t)0x0E) /* UART5 Alternate Function mapping */ 227 #define GPIO_AF14_LCD ((uint8_t)0x0E) /* LCD Alternate Function mapping */ 228 229 /** 230 * @brief AF 15 selection 231 */ 232 #define GPIO_AF15_EVENTOUT ((uint8_t)0x0F) /* EVENTOUT Alternate Function mapping */ 233 234 #define IS_GPIO_AF(AF) ((AF) <= (uint8_t)0x0F) 235 236 237 238 /** 239 * @} 240 */ 241 242 /** 243 * @} 244 */ 245 246 /* Exported macro ------------------------------------------------------------*/ 247 /* Exported functions --------------------------------------------------------*/ 248 /* Private types -------------------------------------------------------------*/ 249 /* Private variables ---------------------------------------------------------*/ 250 /* Private constants ---------------------------------------------------------*/ 251 /* Private macros ------------------------------------------------------------*/ 252 /** @defgroup GPIOEx_Private_Macros GPIO Private Macros 253 * @{ 254 */ 255 /** @defgroup GPIOEx_Get_Port_Index GPIO Get Port Index 256 * @{ 257 */ 258 #define GPIO_GET_INDEX(__GPIOx__) (uint8_t)(((__GPIOx__) == (GPIOA))? 0U :\ 259 ((__GPIOx__) == (GPIOB))? 1U :\ 260 ((__GPIOx__) == (GPIOC))? 2U :\ 261 ((__GPIOx__) == (GPIOD))? 3U :\ 262 ((__GPIOx__) == (GPIOE))? 4U :\ 263 ((__GPIOx__) == (GPIOF))? 5U :\ 264 ((__GPIOx__) == (GPIOG))? 6U :\ 265 ((__GPIOx__) == (GPIOH))? 7U :\ 266 ((__GPIOx__) == (GPIOI))? 8U :\ 267 ((__GPIOx__) == (GPIOJ))? 9U :\ 268 ((__GPIOx__) == (GPIOK))? 10U :\ 269 ((__GPIOx__) == (GPIOZ))? 11U : 25U) 270 /** 271 * @} 272 */ 273 274 /** 275 * @} 276 */ 277 278 /* Private functions ---------------------------------------------------------*/ 279 280 /* Exported functions --------------------------------------------------------*/ 281 /** @addtogroup GPIOEx_Exported_Functions GPIO Extended Exported Functions 282 * @{ 283 */ 284 285 /** @addtogroup GPIOEx_Exported_Functions_Group1 Extended Peripheral Control functions 286 * @{ 287 */ 288 289 void HAL_GPIOEx_SecurePin(GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin); 290 void HAL_GPIOEx_NonSecurePin(GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin); 291 292 293 GPIO_PinState HAL_GPIOEx_IsPinSecured(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin); 294 295 /** 296 * @} 297 */ 298 299 /** 300 * @} 301 */ 302 303 304 /** 305 * @} 306 */ 307 308 /** 309 * @} 310 */ 311 312 #ifdef __cplusplus 313 } 314 #endif 315 316 #endif /* __STM32MP1xx_HAL_GPIO_EX_H */ 317 318 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 319