1 /**
2   ******************************************************************************
3   * @file    stm32h7rsxx_hal_gpio_ex.h
4   * @author  MCD Application Team
5   * @brief   Header file of GPIO HAL Extended module.
6   ******************************************************************************
7   * @attention
8   *
9   * Copyright (c) 2022 STMicroelectronics.
10   * All rights reserved.
11   *
12   * This software is licensed under terms that can be found in the LICENSE file
13   * in the root directory of this software component.
14   * If no LICENSE file comes with this software, it is provided AS-IS.
15   *
16   ******************************************************************************
17   */
18 
19 /* Define to prevent recursive inclusion -------------------------------------*/
20 #ifndef STM32H7RSxx_HAL_GPIO_EX_H
21 #define STM32H7RSxx_HAL_GPIO_EX_H
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 /* Includes ------------------------------------------------------------------*/
28 #include "stm32h7rsxx_hal_def.h"
29 
30 /** @addtogroup STM32H7RSxx_HAL_Driver
31   * @{
32   */
33 
34 /** @defgroup GPIOEx GPIOEx
35   * @brief GPIO Extended HAL module driver
36   * @{
37   */
38 
39 /* Exported types ------------------------------------------------------------*/
40 /* Exported constants --------------------------------------------------------*/
41 /* Private defines -----------------------------------------------------------*/
42 
43 /** @defgroup GPIOEx_Exported_Constants GPIOEx Exported Constants
44   * @{
45   */
46 
47 /** @defgroup GPIOEx_Alternate_function_selection GPIOEx Alternate function selection
48   * @{
49   */
50 
51 /**
52   * @brief   AF 0 selection
53   */
54 #define GPIO_AF0_MCO                        ((uint8_t)0x00)  /*!< MCO (MCO1 and MCO2) Alternate Function mapping */
55 #define GPIO_AF0_JTAG                       ((uint8_t)0x00)  /*!< JTAG Alternate Function mapping                */
56 #define GPIO_AF0_SWD                        ((uint8_t)0x00)  /*!< SWD Alternate Function mapping                 */
57 #define GPIO_AF0_RTC                        ((uint8_t)0x00)  /*!< RCT_OUT Alternate Function mapping             */
58 #define GPIO_AF0_TRACE                      ((uint8_t)0x00)  /*!< TRACE Alternate Function mapping               */
59 #define GPIO_AF0_PWR                        ((uint8_t)0x00)  /*!< PWR Alternate Function mapping                 */
60 
61 /**
62   * @brief   AF 1 selection
63   */
64 #define GPIO_AF1_ADF1                       ((uint8_t)0x01)  /*!< ADF1 Alternate Function mapping      */
65 #define GPIO_AF1_LPTIM1                     ((uint8_t)0x01)  /*!< LPTIM1 Alternate Function mapping    */
66 #define GPIO_AF1_TIM1                       ((uint8_t)0x01)  /*!< TIM1 Alternate Function mapping      */
67 #define GPIO_AF1_TIM2                       ((uint8_t)0x01)  /*!< TIM2 Alternate Function mapping      */
68 #define GPIO_AF1_TIM16                      ((uint8_t)0x01)  /*!< TIM16 Alternate Function mapping     */
69 #define GPIO_AF1_TIM17                      ((uint8_t)0x01)  /*!< TIM17 Alternate Function mapping     */
70 
71 /**
72   * @brief   AF 2 selection
73   */
74 #define GPIO_AF2_GFXTIM                     ((uint8_t)0x02)  /*!< GFXTIM Alternate Function mapping    */
75 #define GPIO_AF2_SAI1                       ((uint8_t)0x02)  /*!< SAI1 Alternate Function mapping      */
76 #define GPIO_AF2_TIM2                       ((uint8_t)0x02)  /*!< TIM2 Alternate Function mapping      */
77 #define GPIO_AF2_TIM3                       ((uint8_t)0x02)  /*!< TIM3 Alternate Function mapping      */
78 #define GPIO_AF2_TIM4                       ((uint8_t)0x02)  /*!< TIM4 Alternate Function mapping      */
79 #define GPIO_AF2_TIM5                       ((uint8_t)0x02)  /*!< TIM5 Alternate Function mapping      */
80 #define GPIO_AF2_TIM12                      ((uint8_t)0x02)  /*!< TIM12 Alternate Function mapping     */
81 #define GPIO_AF2_TIM15                      ((uint8_t)0x02)  /*!< TIM15 Alternate Function mapping     */
82 
83 /**
84   * @brief   AF 3 selection
85   */
86 #define GPIO_AF3_ADF1                       ((uint8_t)0x03)  /*!< ADF1 Alternate Function mapping      */
87 #define GPIO_AF3_LPTIM2                     ((uint8_t)0x03)  /*!< LPTIM2 Alternate Function mapping    */
88 #define GPIO_AF3_LPTIM3                     ((uint8_t)0x03)  /*!< LPTIM3 Alternate Function mapping    */
89 #define GPIO_AF3_LPTIM4                     ((uint8_t)0x03)  /*!< LPTIM4 Alternate Function mapping    */
90 #define GPIO_AF3_LPTIM5                     ((uint8_t)0x03)  /*!< LPTIM5 Alternate Function mapping    */
91 #define GPIO_AF3_LPUART1                    ((uint8_t)0x03)  /*!< LPUART1 Alternate Function mapping   */
92 #define GPIO_AF3_TIM9                       ((uint8_t)0x03)  /*!< TIM9 Alternate Function mapping      */
93 #define GPIO_AF3_USART3                     ((uint8_t)0x03)  /*!< USART3 Alternate Function mapping    */
94 
95 /**
96   * @brief   AF 4 selection
97   */
98 #define GPIO_AF4_CEC                        ((uint8_t)0x04)  /*!< CEC Alternate Function mapping       */
99 #define GPIO_AF4_DCMIPP                     ((uint8_t)0x04)  /*!< DCMIPP Alternate Function mapping    */
100 #define GPIO_AF4_ETH                        ((uint8_t)0x04)  /*!< ETH Alternate Function mapping       */
101 #define GPIO_AF4_I2C1                       ((uint8_t)0x04)  /*!< I2C1 Alternate Function mapping      */
102 #define GPIO_AF4_I2C2                       ((uint8_t)0x04)  /*!< I2C2 Alternate Function mapping      */
103 #define GPIO_AF4_I2C3                       ((uint8_t)0x04)  /*!< I2C3 Alternate Function mapping      */
104 #define GPIO_AF4_I3C1                       ((uint8_t)0x04)  /*!< I3C1 Alternate Function mapping      */
105 #define GPIO_AF4_TIM15                      ((uint8_t)0x04)  /*!< TIM15 Alternate Function mapping     */
106 #define GPIO_AF4_USART1                     ((uint8_t)0x04)  /*!< USART1 Alternate Function mapping    */
107 
108 /**
109   * @brief   AF 5 selection
110   */
111 #define GPIO_AF5_CEC                        ((uint8_t)0x05)  /*!< CEC Alternate Function mapping       */
112 #define GPIO_AF5_DCMIPP                     ((uint8_t)0x05)  /*!< DCMIPP Alternate Function mapping    */
113 #define GPIO_AF5_SPI1                       ((uint8_t)0x05)  /*!< SPI1/I2S1 Alternate Function mapping */
114 #define GPIO_AF5_SPI2                       ((uint8_t)0x05)  /*!< SPI2/I2S2 Alternate Function mapping */
115 #define GPIO_AF5_SPI3                       ((uint8_t)0x05)  /*!< SPI3/I2S3 Alternate Function mapping */
116 #define GPIO_AF5_SPI4                       ((uint8_t)0x05)  /*!< SPI4 Alternate Function mapping      */
117 #define GPIO_AF5_SPI5                       ((uint8_t)0x05)  /*!< SPI5 Alternate Function mapping      */
118 #define GPIO_AF5_SPI6                       ((uint8_t)0x05)  /*!< SPI6/I2S6 Alternate Function mapping */
119 
120 /**
121   * @brief   AF 6 selection
122   */
123 #define GPIO_AF6_PSSI                       ((uint8_t)0x06)  /*!< PSSI Alternate Function mapping      */
124 #define GPIO_AF6_SAI1                       ((uint8_t)0x06)  /*!< SAI1 Alternate Function mapping      */
125 #define GPIO_AF6_SDMMC1                     ((uint8_t)0x06)  /*!< SDMMC1 Alternate Function mapping    */
126 #define GPIO_AF6_SPI3                       ((uint8_t)0x06)  /*!< SPI3/I2S3 Alternate Function mapping */
127 #define GPIO_AF6_SPI4                       ((uint8_t)0x06)  /*!< SPI4 Alternate Function mapping      */
128 #define GPIO_AF6_UART4                      ((uint8_t)0x06)  /*!< UART4 Alternate Function mapping     */
129 #define GPIO_AF6_UCPD                       ((uint8_t)0x06)  /*!< UCPD Alternate Function mapping      */
130 
131 /**
132   * @brief  AF 7 selection
133   */
134 #define GPIO_AF7_FMC                        ((uint8_t)0x07)  /*!< FMC Alternate Function mapping       */
135 #define GPIO_AF7_SDMMC1                     ((uint8_t)0x07)  /*!< SDMMC1 Alternate Function mapping    */
136 #define GPIO_AF7_SPI2                       ((uint8_t)0x07)  /*!< SPI2/I2S2 Alternate Function mapping */
137 #define GPIO_AF7_SPI3                       ((uint8_t)0x07)  /*!< SPI3/I2S3 Alternate Function mapping */
138 #define GPIO_AF7_SPI6                       ((uint8_t)0x07)  /*!< SPI6/I2S6 Alternate Function mapping */
139 #define GPIO_AF7_USART1                     ((uint8_t)0x07)  /*!< USART1 Alternate Function mapping    */
140 #define GPIO_AF7_USART2                     ((uint8_t)0x07)  /*!< USART2 Alternate Function mapping    */
141 #define GPIO_AF7_USART3                     ((uint8_t)0x07)  /*!< USART3 Alternate Function mapping    */
142 #define GPIO_AF7_UART7                      ((uint8_t)0x07)  /*!< UART7 Alternate Function mapping     */
143 
144 /**
145   * @brief  AF 8 selection
146   */
147 #define GPIO_AF8_GFXTIM                     ((uint8_t)0x08)  /*!< GFXTIM Alternate Function mapping    */
148 #define GPIO_AF8_LPUART1                    ((uint8_t)0x08)  /*!< LPUART1 Alternate Function mapping   */
149 #define GPIO_AF8_PSSI                       ((uint8_t)0x08)  /*!< PSSI Alternate Function mapping      */
150 #define GPIO_AF8_SAI2                       ((uint8_t)0x08)  /*!< SAI2 Alternate Function mapping      */
151 #define GPIO_AF8_SDMMC1                     ((uint8_t)0x08)  /*!< SDMMC1 Alternate Function mapping    */
152 #define GPIO_AF8_SPDIFRX                    ((uint8_t)0x08)  /*!< SPDIFRX Alternate Function mapping   */
153 #define GPIO_AF8_SPI6                       ((uint8_t)0x08)  /*!< SPI6/I2S6 Alternate Function mapping */
154 #define GPIO_AF8_UART4                      ((uint8_t)0x08)  /*!< UART4 Alternate Function mapping     */
155 #define GPIO_AF8_UART5                      ((uint8_t)0x08)  /*!< UART5 Alternate Function mapping     */
156 #define GPIO_AF8_UART8                      ((uint8_t)0x08)  /*!< UART8 Alternate Function mapping     */
157 
158 /**
159   * @brief  AF 9 selection
160   */
161 #define GPIO_AF9_FDCAN1                     ((uint8_t)0x09)  /*!< FDCAN1 Alternate Function mapping                */
162 #define GPIO_AF9_FDCAN2                     ((uint8_t)0x09)  /*!< FDCAN2 Alternate Function mapping                */
163 #define GPIO_AF9_FMC                        ((uint8_t)0x09)  /*!< FMC Alternate Function mapping                   */
164 #define GPIO_AF9_XSPIM_P1                   ((uint8_t)0x09)  /*!< XSPIM Manager Port 1 Alternate Function mapping  */
165 #define GPIO_AF9_XSPIM_P2                   ((uint8_t)0x09)  /*!< XSPIM Manager Port 2 Alternate Function mapping  */
166 #define GPIO_AF9_PSSI                       ((uint8_t)0x09)  /*!< PSSI Alternate Function mapping                  */
167 #define GPIO_AF9_SDMMC2                     ((uint8_t)0x09)  /*!< SDMMC2 Alternate Function mapping                */
168 #define GPIO_AF9_SPDIFRX                    ((uint8_t)0x09)  /*!< SPDIFRX Alternate Function mapping               */
169 #define GPIO_AF9_SPI5                       ((uint8_t)0x09)  /*!< SPI5 Alternate Function mapping                  */
170 #define GPIO_AF9_TIM13                      ((uint8_t)0x09)  /*!< TIM13 Alternate Function mapping                 */
171 #define GPIO_AF9_TIM14                      ((uint8_t)0x09)  /*!< TIM14 Alternate Function mapping                 */
172 
173 /**
174   * @brief  AF 10 selection
175   */
176 #define GPIO_AF10_CRS                       ((uint8_t)0x0A)  /*!< CRS Alternate Function mapping       */
177 #define GPIO_AF10_FMC                       ((uint8_t)0x0A)  /*!< FMC Alternate Function mapping       */
178 #define GPIO_AF10_LTDC                      ((uint8_t)0x0A)  /*!< LTDC Alternate Function mapping      */
179 #define GPIO_AF10_OTG_FS                    ((uint8_t)0x0A)  /*!< OTG FS Alternate Function mapping    */
180 #define GPIO_AF10_OTG_HS                    ((uint8_t)0x0A)  /*!< OTG HS Alternate Function mapping    */
181 #define GPIO_AF10_SAI2                      ((uint8_t)0x0A)  /*!< SAI2 Alternate Function mapping      */
182 #define GPIO_AF10_SDMMC2                    ((uint8_t)0x0A)  /*!< SDMMC2 Alternate Function mapping    */
183 #define GPIO_AF10_SPI1                      ((uint8_t)0x0A)  /*!< SPI1/I2S1 Alternate Function mapping */
184 
185 /**
186   * @brief  AF 11 selection
187   */
188 #define GPIO_AF11_ETH                       ((uint8_t)0x0B)  /*!< ETH Alternate Function mapping       */
189 #define GPIO_AF11_LTDC                      ((uint8_t)0x0B)  /*!< LTDC Alternate Function mapping      */
190 #define GPIO_AF11_MDIOS                     ((uint8_t)0x0B)  /*!< MDIOS Alternate Function mapping     */
191 #define GPIO_AF11_SDMMC1                    ((uint8_t)0x0B)  /*!< SDMMC1 Alternate Function mapping    */
192 #define GPIO_AF11_SDMMC2                    ((uint8_t)0x0B)  /*!< SDMMC2 Alternate Function mapping    */
193 #define GPIO_AF11_UART7                     ((uint8_t)0x0B)  /*!< UART7 Alternate Function mapping     */
194 
195 /**
196   * @brief  AF 12 selection
197   */
198 #define GPIO_AF12_FMC                       ((uint8_t)0x0C)  /*!< FMC Alternate Function mapping       */
199 #define GPIO_AF12_GFXTIM                    ((uint8_t)0x0C)  /*!< GFXTIM Alternate Function mapping    */
200 #define GPIO_AF12_LTDC                      ((uint8_t)0x0C)  /*!< TIM1 Alternate Function mapping      */
201 #define GPIO_AF12_SDMMC1                    ((uint8_t)0x0C)  /*!< SDMMC1 Alternate Function mapping    */
202 
203 /**
204   * @brief  AF 13 selection
205   */
206 #define GPIO_AF13_DCMIPP                    ((uint8_t)0x0D)  /*!< DCMIPP Alternate Function mapping    */
207 #define GPIO_AF13_GFXTIM                    ((uint8_t)0x0D)  /*!< GFXTIM Alternate Function mapping    */
208 #define GPIO_AF13_LTDC                      ((uint8_t)0x0D)  /*!< TIM1 Alternate Function mapping      */
209 
210 /**
211   * @brief  AF 14 selection
212   */
213 #define GPIO_AF14_FMC                       ((uint8_t)0x0E)  /*!< FMC Alternate Function mapping       */
214 #define GPIO_AF14_LTDC                      ((uint8_t)0x0E)  /*!< LTDC Alternate Function mapping      */
215 #define GPIO_AF14_MDIOS                     ((uint8_t)0x0E)  /*!< MDIOS Alternate Function mapping     */
216 #define GPIO_AF14_PSSI                      ((uint8_t)0x0E)  /*!< PSSI Alternate Function mapping      */
217 #define GPIO_AF14_TIM1                      ((uint8_t)0x0E)  /*!< TIM1 Alternate Function mapping      */
218 #define GPIO_AF14_UART5                     ((uint8_t)0x0E)  /*!< UART5 Alternate Function mapping     */
219 
220 /**
221   * @brief  AF 15 selection
222   */
223 #define GPIO_AF15_EVENTOUT                  ((uint8_t)0x0F)  /*!< EVENTOUT Alternate Function mapping  */
224 
225 #define IS_GPIO_AF(AF)                      ((AF) <= (uint8_t)0x0F)
226 
227 /**
228   * @}
229   */
230 
231 /**
232   * @}
233   */
234 
235 /* Exported macro ------------------------------------------------------------*/
236 /** @defgroup GPIOEx_Exported_Macros GPIOEx Exported Macros
237   * @{
238   */
239 
240 /** @defgroup GPIOEx_Get_Port_Index GPIOEx Get Port Index
241   * @{
242   */
243 #define GPIO_GET_INDEX(__GPIOx__)           (((uint32_t )(__GPIOx__) & (~GPIOA_BASE)) >> 10)
244 /**
245   * @}
246   */
247 
248 /**
249   * @}
250   */
251 
252 /* Exported functions --------------------------------------------------------*/
253 /**
254   * @}
255   */
256 
257 /**
258   * @}
259   */
260 
261 #ifdef __cplusplus
262 }
263 #endif
264 
265 #endif /* STM32H7RSxx_HAL_GPIO_EX_H */
266