1 /**
2   ******************************************************************************
3   * @file    stm32n6xx_hal_gpio.h
4   * @author  GPM Application Team
5   * @brief   Header for gpio.c module.
6   ******************************************************************************
7   * @attention
8   *
9   * Copyright (c) 2023 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 STM32N6xx_HAL_GPIO_H
21 #define STM32N6xx_HAL_GPIO_H
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 /* Includes ------------------------------------------------------------------*/
28 #include "stm32n6xx_hal_def.h"
29 
30 /** @addtogroup STM32N6xx_HAL_Driver
31   * @{
32   */
33 
34 /** @defgroup GPIO GPIO
35   * @brief GPIO HAL module driver
36   * @{
37   */
38 
39 /* Exported types ------------------------------------------------------------*/
40 
41 /** @defgroup GPIO_Exported_Types GPIO Exported Types
42   * @{
43   */
44 /**
45   * @brief   GPIO Init structure definition
46   */
47 typedef struct
48 {
49   uint32_t Pin;        /*!< Specifies the GPIO pins to be configured.
50                            This parameter can be any value of @ref GPIO_pins */
51 
52   uint32_t Mode;       /*!< Specifies the operating mode for the selected pins.
53                            This parameter can be a value of @ref GPIO_mode */
54 
55   uint32_t Pull;       /*!< Specifies the Pull-up or Pull-Down activation for the selected pins.
56                            This parameter can be a value of @ref GPIO_pull */
57 
58   uint32_t Speed;      /*!< Specifies the speed for the selected pins.
59                            This parameter can be a value of @ref GPIO_speed */
60 
61   uint32_t Alternate;  /*!< Peripheral to be connected to the selected pins
62                            This parameter can be a value of @ref GPIOEx_Alternate_function_selection */
63 } GPIO_InitTypeDef;
64 
65 /**
66   * @brief   GPIO delay parameters structure definition
67   */
68 typedef struct
69 {
70   uint32_t Delay;      /*!< Specifies the delay to apply on signal of a pin.
71                            This parameter can be a value of @ref GPIO_delay */
72 
73   uint32_t Path;       /*!< Specifies the path of the delay.
74                            This parameter can be a value of @ref GPIO_path */
75 } GPIO_DelayTypeDef;
76 
77 /**
78   * @brief   GPIO retime parameters structure definition
79   */
80 typedef struct
81 {
82   uint32_t Retime;     /*!< Enable or disable the retime functionality on a pin
83                            This parameter can be any value of @ref GPIO_retime */
84 
85   uint32_t Edge;       /*!< Specifies the clock edge for retime functionality.
86                            This parameter can be a value of @ref GPIO_clock */
87 } GPIO_RetimeTypeDef;
88 
89 /**
90   * @brief  GPIO Bit SET and Bit RESET enumeration
91   */
92 typedef enum
93 {
94   GPIO_PIN_RESET = 0U,
95   GPIO_PIN_SET
96 } GPIO_PinState;
97 /**
98   * @}
99   */
100 
101 /* Exported constants --------------------------------------------------------*/
102 /** @defgroup GPIO_Exported_Constants GPIO Exported Constants
103   * @{
104   */
105 /** @defgroup GPIO_pins GPIO pins
106   * @{
107   */
108 #define GPIO_PIN_0                 ((uint16_t)0x0001)  /* Pin 0 selected    */
109 #define GPIO_PIN_1                 ((uint16_t)0x0002)  /* Pin 1 selected    */
110 #define GPIO_PIN_2                 ((uint16_t)0x0004)  /* Pin 2 selected    */
111 #define GPIO_PIN_3                 ((uint16_t)0x0008)  /* Pin 3 selected    */
112 #define GPIO_PIN_4                 ((uint16_t)0x0010)  /* Pin 4 selected    */
113 #define GPIO_PIN_5                 ((uint16_t)0x0020)  /* Pin 5 selected    */
114 #define GPIO_PIN_6                 ((uint16_t)0x0040)  /* Pin 6 selected    */
115 #define GPIO_PIN_7                 ((uint16_t)0x0080)  /* Pin 7 selected    */
116 #define GPIO_PIN_8                 ((uint16_t)0x0100)  /* Pin 8 selected    */
117 #define GPIO_PIN_9                 ((uint16_t)0x0200)  /* Pin 9 selected    */
118 #define GPIO_PIN_10                ((uint16_t)0x0400)  /* Pin 10 selected   */
119 #define GPIO_PIN_11                ((uint16_t)0x0800)  /* Pin 11 selected   */
120 #define GPIO_PIN_12                ((uint16_t)0x1000)  /* Pin 12 selected   */
121 #define GPIO_PIN_13                ((uint16_t)0x2000)  /* Pin 13 selected   */
122 #define GPIO_PIN_14                ((uint16_t)0x4000)  /* Pin 14 selected   */
123 #define GPIO_PIN_15                ((uint16_t)0x8000)  /* Pin 15 selected   */
124 #define GPIO_PIN_ALL               ((uint16_t)0xFFFF)  /* All pins selected */
125 
126 #define GPIO_PIN_MASK              (0x0000FFFFu) /* PIN mask for assert test */
127 /**
128   * @}
129   */
130 
131 /** @defgroup GPIO_mode GPIO mode
132   * @brief GPIO Configuration Mode
133   *        Elements values convention: 0x00WX00YZ
134   *           - W  : EXTI trigger detection on 3 bits
135   *           - X  : EXTI mode (IT or Event) on 2 bits
136   *           - Y  : Output type (Push Pull or Open Drain) on 1 bit
137   *           - Z  : GPIO mode (Input, Output, Alternate or Analog) on 2 bits
138   * @{
139   */
140 #define GPIO_MODE_INPUT                 MODE_INPUT                                                  /*!< Input Floating Mode                                                */
141 #define GPIO_MODE_OUTPUT_PP             (MODE_OUTPUT | OUTPUT_PP)                                   /*!< Output Push Pull Mode                                              */
142 #define GPIO_MODE_OUTPUT_OD             (MODE_OUTPUT | OUTPUT_OD)                                   /*!< Output Open Drain Mode                                             */
143 #define GPIO_MODE_AF_PP                 (MODE_AF | OUTPUT_PP)                                       /*!< Alternate Function Push Pull Mode                                  */
144 #define GPIO_MODE_AF_OD                 (MODE_AF | OUTPUT_OD)                                       /*!< Alternate Function Open Drain Mode                                 */
145 #define GPIO_MODE_ANALOG                MODE_ANALOG                                                 /*!< Analog Mode                                                        */
146 #define GPIO_MODE_IT_RISING             (MODE_INPUT | EXTI_IT | TRIGGER_RISING)                     /*!< External Interrupt Mode with Rising edge trigger detection         */
147 #define GPIO_MODE_IT_FALLING            (MODE_INPUT | EXTI_IT | TRIGGER_FALLING)                    /*!< External Interrupt Mode with Falling edge trigger detection        */
148 #define GPIO_MODE_IT_RISING_FALLING     (MODE_INPUT | EXTI_IT | TRIGGER_RISING | TRIGGER_FALLING)   /*!< External Interrupt Mode with Rising/Falling edge trigger detection */
149 #define GPIO_MODE_EVT_RISING            (MODE_INPUT | EXTI_EVT | TRIGGER_RISING)                    /*!< External Event Mode with Rising edge trigger detection             */
150 #define GPIO_MODE_EVT_FALLING           (MODE_INPUT | EXTI_EVT | TRIGGER_FALLING)                   /*!< External Event Mode with Falling edge trigger detection            */
151 #define GPIO_MODE_EVT_RISING_FALLING    (MODE_INPUT | EXTI_EVT | TRIGGER_RISING | TRIGGER_FALLING)  /*!< External Event Mode with Rising/Falling edge trigger detection     */
152 /**
153   * @}
154   */
155 
156 /** @defgroup GPIO_speed GPIO speed
157   * @brief GPIO Output Maximum frequency
158   * @{
159   */
160 #define GPIO_SPEED_FREQ_LOW             0x00000000u  /*!< Low speed       */
161 #define GPIO_SPEED_FREQ_MEDIUM          0x00000001u  /*!< Medium speed    */
162 #define GPIO_SPEED_FREQ_HIGH            0x00000002u  /*!< High speed      */
163 #define GPIO_SPEED_FREQ_VERY_HIGH       0x00000003u  /*!< Very high speed */
164 /**
165   * @}
166   */
167 
168 /** @defgroup GPIO_pull GPIO pull
169   * @brief GPIO Pull-Up or Pull-Down Activation
170   * @{
171   */
172 #define GPIO_NOPULL                     0x00000000u   /*!< No Pull-up or Pull-down activation  */
173 #define GPIO_PULLUP                     0x00000001u   /*!< Pull-up activation                  */
174 #define GPIO_PULLDOWN                   0x00000002u   /*!< Pull-down activation                */
175 /**
176   * @}
177   */
178 
179 /** @defgroup GPIO_retime GPIO retime control
180   * @brief GPIO data retime enable/disable
181   * @{
182   */
183 #define GPIO_RETIME_OFF                 0x00000000u                /*!< Retime disable at pad level  */
184 #define GPIO_RETIME_ON                  GPIO_ADVCFGRL_RET0         /*!< Retime enable at pad level   */
185 /**
186   * @}
187   */
188 
189 /** @defgroup GPIO_clock GPIO clock control
190   * @brief GPIO clock edge configuration for retime functionality
191   * @{
192   */
193 #define GPIO_CLOCK_RISING               0x00000000u               /*!< Retime on rising edge  */
194 #define GPIO_CLOCK_FALLING              GPIO_ADVCFGRL_INVCLK0     /*!< Retime on falling edge  */
195 #define GPIO_CLOCK_RISING_FALLING       GPIO_ADVCFGRL_DE0         /*!< Retime on both edge  */
196 /**
197   * @}
198   */
199 
200 /** @defgroup GPIO_path GPIO path control
201   * @brief GPIO path configuration for delay functionality
202   * @{
203   */
204 #define GPIO_PATH_OUT                   0x00000000u               /*!< Delay applied to output signal */
205 #define GPIO_PATH_IN                    GPIO_ADVCFGRL_DLYPATH0    /*!< Delay applied to input signal */
206 /**
207   * @}
208   */
209 
210 /** @defgroup GPIO_delay GPIO delay
211   * @brief GPIO delay in picosecond to apply on the input/output path depending the value of control GPIO_path
212   * @{
213   */
214 #define GPIO_DELAY_PS_0               (GPIO_DELAYRL_DLY0_Pos)
215 #define GPIO_DELAY_PS_300             (GPIO_DELAYRL_DLY0_0)
216 #define GPIO_DELAY_PS_500             (GPIO_DELAYRL_DLY0_1)
217 #define GPIO_DELAY_PS_750             (GPIO_DELAYRL_DLY0_1 | GPIO_DELAYRL_DLY0_0)
218 #define GPIO_DELAY_PS_1000            (GPIO_DELAYRL_DLY0_2)
219 #define GPIO_DELAY_PS_1250            (GPIO_DELAYRL_DLY0_2 | GPIO_DELAYRL_DLY0_0)
220 #define GPIO_DELAY_PS_1500            (GPIO_DELAYRL_DLY0_2 | GPIO_DELAYRL_DLY0_1)
221 #define GPIO_DELAY_PS_1750            (GPIO_DELAYRL_DLY0_2 | GPIO_DELAYRL_DLY0_1 | GPIO_DELAYRL_DLY0_0)
222 #define GPIO_DELAY_PS_2000            (GPIO_DELAYRL_DLY0_3)
223 #define GPIO_DELAY_PS_2250            (GPIO_DELAYRL_DLY0_3 | GPIO_DELAYRL_DLY0_0)
224 #define GPIO_DELAY_PS_2500            (GPIO_DELAYRL_DLY0_3 | GPIO_DELAYRL_DLY0_1)
225 #define GPIO_DELAY_PS_2750            (GPIO_DELAYRL_DLY0_3 | GPIO_DELAYRL_DLY0_1 | GPIO_DELAYRL_DLY0_0)
226 #define GPIO_DELAY_PS_3000            (GPIO_DELAYRL_DLY0_3 | GPIO_DELAYRL_DLY0_2)
227 #define GPIO_DELAY_PS_3250            (GPIO_DELAYRL_DLY0_3 | GPIO_DELAYRL_DLY0_2 | GPIO_DELAYRL_DLY0_0)
228 /**
229   * @}
230   */
231 
232 /** @defgroup GPIO_attributes GPIO attributes
233   * @brief GPIO pin secure/non-secure or/and privileged/non-privileged
234   * @{
235   */
236 #define  GPIO_PIN_SEC                  (GPIO_PIN_ATTR_SEC_MASK | 0x00000001U)    /*!< Secure pin attribute         */
237 #define  GPIO_PIN_NSEC                 (GPIO_PIN_ATTR_SEC_MASK | 0x00000000U)    /*!< Non-secure pin attribute     */
238 #define  GPIO_PIN_PRIV                 (GPIO_PIN_ATTR_PRIV_MASK | 0x00000002U)   /*!< Privileged pin attribute     */
239 #define  GPIO_PIN_NPRIV                (GPIO_PIN_ATTR_PRIV_MASK | 0x00000000U)   /*!< Non-privileged pin attribute */
240 /**
241   * @}
242   */
243 
244 /**
245   * @}
246   */
247 
248 /* Exported macro ------------------------------------------------------------*/
249 /** @defgroup GPIO_Exported_Macros GPIO Exported Macros
250   * @{
251   */
252 
253 /**
254   * @brief  Check whether the specified EXTI line is rising edge asserted or not.
255   * @param  __EXTI_LINE__ specifies the EXTI line to check.
256   *         This parameter can be GPIO_PIN_x where x can be(0..15)
257   * @retval The new state of __EXTI_LINE__ (SET or RESET).
258   */
259 #define __HAL_GPIO_EXTI_GET_RISING_IT(__EXTI_LINE__)         (EXTI->RPR1 & (__EXTI_LINE__))
260 
261 /**
262   * @brief  Clear the EXTI line rising pending bits.
263   * @param  __EXTI_LINE__ specifies the EXTI lines to clear.
264   *         This parameter can be any combination of GPIO_PIN_x where x can be (0..15)
265   * @retval None
266   */
267 #define __HAL_GPIO_EXTI_CLEAR_RISING_IT(__EXTI_LINE__)       (EXTI->RPR1 = (__EXTI_LINE__))
268 
269 /**
270   * @brief  Check whether the specified EXTI line is falling edge asserted or not.
271   * @param  __EXTI_LINE__ specifies the EXTI line to check.
272   *          This parameter can be GPIO_PIN_x where x can be(0..15)
273   * @retval The new state of __EXTI_LINE__ (SET or RESET).
274   */
275 #define __HAL_GPIO_EXTI_GET_FALLING_IT(__EXTI_LINE__)        (EXTI->FPR1 & (__EXTI_LINE__))
276 
277 /**
278   * @brief  Clear the EXTI line falling pending bits.
279   * @param  __EXTI_LINE__ specifies the EXTI lines to clear.
280   *          This parameter can be any combination of GPIO_PIN_x where x can be (0..15)
281   * @retval None
282   */
283 #define __HAL_GPIO_EXTI_CLEAR_FALLING_IT(__EXTI_LINE__)      (EXTI->FPR1 = (__EXTI_LINE__))
284 
285 /**
286   * @brief  Check whether the specified EXTI line is asserted or not.
287   * @param __EXTI_LINE__ specifies the EXTI line to check.
288   *          This parameter can be GPIO_PIN_x where x can be(0..15)
289   * @retval The new state of __EXTI_LINE__ (SET or RESET).
290   */
291 #define __HAL_GPIO_EXTI_GET_IT(__EXTI_LINE__)         (__HAL_GPIO_EXTI_GET_RISING_IT(__EXTI_LINE__) || \
292                                                        __HAL_GPIO_EXTI_GET_FALLING_IT(__EXTI_LINE__))
293 
294 /**
295   * @brief  Clear the EXTI's line pending bits.
296   * @param  __EXTI_LINE__ specifies the EXTI lines to clear.
297   *          This parameter can be any combination of GPIO_PIN_x where x can be (0..15)
298   * @retval None
299   */
300 #define __HAL_GPIO_EXTI_CLEAR_IT(__EXTI_LINE__)         \
301   do {                                                  \
302     __HAL_GPIO_EXTI_CLEAR_RISING_IT(__EXTI_LINE__);     \
303     __HAL_GPIO_EXTI_CLEAR_FALLING_IT(__EXTI_LINE__);    \
304   } while(0)
305 
306 
307 /**
308   * @brief  Generate a Software interrupt on selected EXTI line.
309   * @param __EXTI_LINE__ specifies the EXTI line to check.
310   *          This parameter can be GPIO_PIN_x where x can be(0..15)
311   * @retval None
312   */
313 #define __HAL_GPIO_EXTI_GENERATE_SWIT(__EXTI_LINE__)  (EXTI->SWIER1 |= (__EXTI_LINE__))
314 
315 /**
316   * @brief  Check whether the specified EXTI line flag is set or not.
317   * @param  __EXTI_LINE__ specifies the EXTI line flag to check.
318   *          This parameter can be GPIO_PIN_x where x can be(0..15)
319   * @retval The new state of __EXTI_LINE__ (SET or RESET).
320   */
321 #define __HAL_GPIO_EXTI_GET_FLAG(__EXTI_LINE__)       __HAL_GPIO_EXTI_GET_IT(__EXTI_LINE__)
322 
323 /**
324   * @brief  Clear the EXTI line pending flags.
325   * @param  __EXTI_LINE__ specifies the EXTI lines flags to clear.
326   *         This parameter can be any combination of GPIO_PIN_x where x can be (0..15)
327   * @retval None
328   */
329 #define __HAL_GPIO_EXTI_CLEAR_FLAG(__EXTI_LINE__)     __HAL_GPIO_EXTI_CLEAR_IT(__EXTI_LINE__)
330 
331 /**
332   * @}
333   */
334 
335 /* Private macros ------------------------------------------------------------*/
336 /** @defgroup GPIO_Private_Constants GPIO Private Constants
337   * @{
338   */
339 #define GPIO_MODE_Pos                           0u
340 #define GPIO_MODE                               (0x3uL << GPIO_MODE_Pos)
341 #define MODE_INPUT                              (0x0uL << GPIO_MODE_Pos)
342 #define MODE_OUTPUT                             (0x1uL << GPIO_MODE_Pos)
343 #define MODE_AF                                 (0x2uL << GPIO_MODE_Pos)
344 #define MODE_ANALOG                             (0x3uL << GPIO_MODE_Pos)
345 #define OUTPUT_TYPE_Pos                         4u
346 #define OUTPUT_TYPE                             (0x1uL << OUTPUT_TYPE_Pos)
347 #define OUTPUT_PP                               (0x0uL << OUTPUT_TYPE_Pos)
348 #define OUTPUT_OD                               (0x1uL << OUTPUT_TYPE_Pos)
349 #define EXTI_MODE_Pos                           16u
350 #define EXTI_MODE                               (0x3uL << EXTI_MODE_Pos)
351 #define EXTI_IT                                 (0x1uL << EXTI_MODE_Pos)
352 #define EXTI_EVT                                (0x2uL << EXTI_MODE_Pos)
353 #define TRIGGER_MODE_Pos                        20u
354 #define TRIGGER_MODE                            (0x7uL << TRIGGER_MODE_Pos)
355 #define TRIGGER_RISING                          (0x1uL << TRIGGER_MODE_Pos)
356 #define TRIGGER_FALLING                         (0x2uL << TRIGGER_MODE_Pos)
357 #define GPIO_PIN_ATTR_SEC_MASK                  0x100U
358 #define GPIO_PIN_ATTR_PRIV_MASK                 0x200U
359 /**
360   * @}
361   */
362 
363 /** @defgroup GPIO_Private_Macros GPIO Private Macros
364   * @{
365   */
366 #define IS_GPIO_PIN_ACTION(ACTION)  (((ACTION) == GPIO_PIN_RESET) || ((ACTION) == GPIO_PIN_SET))
367 
368 #define IS_GPIO_PIN(__PIN__)        ((((uint32_t)(__PIN__) & GPIO_PIN_MASK) != 0x00u) &&\
369                                      (((uint32_t)(__PIN__) & ~GPIO_PIN_MASK) == 0x00u))
370 
371 #define IS_GPIO_SINGLE_PIN(__PIN__) (((__PIN__) == GPIO_PIN_0)   ||\
372                                      ((__PIN__) == GPIO_PIN_1)   ||\
373                                      ((__PIN__) == GPIO_PIN_2)   ||\
374                                      ((__PIN__) == GPIO_PIN_3)   ||\
375                                      ((__PIN__) == GPIO_PIN_4)   ||\
376                                      ((__PIN__) == GPIO_PIN_5)   ||\
377                                      ((__PIN__) == GPIO_PIN_6)   ||\
378                                      ((__PIN__) == GPIO_PIN_7)   ||\
379                                      ((__PIN__) == GPIO_PIN_8)   ||\
380                                      ((__PIN__) == GPIO_PIN_9)   ||\
381                                      ((__PIN__) == GPIO_PIN_10)  ||\
382                                      ((__PIN__) == GPIO_PIN_11)  ||\
383                                      ((__PIN__) == GPIO_PIN_12)  ||\
384                                      ((__PIN__) == GPIO_PIN_13)  ||\
385                                      ((__PIN__) == GPIO_PIN_14)  ||\
386                                      ((__PIN__) == GPIO_PIN_15))
387 
388 #define IS_GPIO_COMMON_PIN(__RESETMASK__, __SETMASK__) (((uint32_t)(__RESETMASK__) & (uint32_t)(__SETMASK__)) == 0x00u)
389 
390 #define IS_GPIO_MODE(__MODE__)      (((__MODE__) == GPIO_MODE_INPUT)              ||\
391                                      ((__MODE__) == GPIO_MODE_OUTPUT_PP)          ||\
392                                      ((__MODE__) == GPIO_MODE_OUTPUT_OD)          ||\
393                                      ((__MODE__) == GPIO_MODE_AF_PP)              ||\
394                                      ((__MODE__) == GPIO_MODE_AF_OD)              ||\
395                                      ((__MODE__) == GPIO_MODE_IT_RISING)          ||\
396                                      ((__MODE__) == GPIO_MODE_IT_FALLING)         ||\
397                                      ((__MODE__) == GPIO_MODE_IT_RISING_FALLING)  ||\
398                                      ((__MODE__) == GPIO_MODE_EVT_RISING)         ||\
399                                      ((__MODE__) == GPIO_MODE_EVT_FALLING)        ||\
400                                      ((__MODE__) == GPIO_MODE_EVT_RISING_FALLING) ||\
401                                      ((__MODE__) == GPIO_MODE_ANALOG))
402 
403 #define IS_GPIO_SPEED(__SPEED__)    (((__SPEED__) == GPIO_SPEED_FREQ_LOW)       ||\
404                                      ((__SPEED__) == GPIO_SPEED_FREQ_MEDIUM)    ||\
405                                      ((__SPEED__) == GPIO_SPEED_FREQ_HIGH)      ||\
406                                      ((__SPEED__) == GPIO_SPEED_FREQ_VERY_HIGH))
407 
408 #define IS_GPIO_PULL(__PULL__)      (((__PULL__) == GPIO_NOPULL)   ||\
409                                      ((__PULL__) == GPIO_PULLUP)   || \
410                                      ((__PULL__) == GPIO_PULLDOWN))
411 
412 #define IS_GPIO_DELAY(__DELAY__)    (((__DELAY__) == GPIO_DELAY_PS_0)      ||\
413                                      ((__DELAY__) == GPIO_DELAY_PS_300)    ||\
414                                      ((__DELAY__) == GPIO_DELAY_PS_500)    ||\
415                                      ((__DELAY__) == GPIO_DELAY_PS_750)    ||\
416                                      ((__DELAY__) == GPIO_DELAY_PS_1000)   ||\
417                                      ((__DELAY__) == GPIO_DELAY_PS_1250)   ||\
418                                      ((__DELAY__) == GPIO_DELAY_PS_1500)   ||\
419                                      ((__DELAY__) == GPIO_DELAY_PS_1750)   ||\
420                                      ((__DELAY__) == GPIO_DELAY_PS_2000)   ||\
421                                      ((__DELAY__) == GPIO_DELAY_PS_2250)   ||\
422                                      ((__DELAY__) == GPIO_DELAY_PS_2500)   ||\
423                                      ((__DELAY__) == GPIO_DELAY_PS_2750)   ||\
424                                      ((__DELAY__) == GPIO_DELAY_PS_3000)   ||\
425                                      ((__DELAY__) == GPIO_DELAY_PS_3250))
426 
427 #define IS_GPIO_RETIME(__RETIME__)  (((__RETIME__) == GPIO_RETIME_ON)   ||\
428                                      ((__RETIME__) == GPIO_RETIME_OFF))
429 
430 #define IS_GPIO_CLOCK(__CLOCK__)    (((__CLOCK__) == GPIO_CLOCK_RISING)    ||\
431                                      ((__CLOCK__) == GPIO_CLOCK_FALLING)   || \
432                                      ((__CLOCK__) == GPIO_CLOCK_RISING_FALLING))
433 
434 #define IS_GPIO_PATH(__PATH__)      (((__PATH__) == GPIO_PATH_OUT)   ||\
435                                      ((__PATH__) == GPIO_PATH_IN))
436 
437 #if defined CPU_IN_SECURE_STATE
438 #define IS_GPIO_PIN_ATTRIBUTES(__ATTR__) (((((__ATTR__) & GPIO_PIN_SEC) == GPIO_PIN_SEC) || \
439                                            (((__ATTR__) & GPIO_PIN_NSEC) == GPIO_PIN_NSEC) || \
440                                            (((__ATTR__) & GPIO_PIN_PRIV) == GPIO_PIN_PRIV) || \
441                                            (((__ATTR__) & GPIO_PIN_NPRIV) == GPIO_PIN_NPRIV)) && \
442                                           (((__ATTR__) & ~(GPIO_PIN_SEC|GPIO_PIN_NSEC|GPIO_PIN_PRIV|GPIO_PIN_NPRIV)) == 0U))
443 #else
444 #define IS_GPIO_PIN_ATTRIBUTES(__ATTR__) (((((__ATTR__) & GPIO_PIN_PRIV) == GPIO_PIN_PRIV) || \
445                                            (((__ATTR__) & GPIO_PIN_NPRIV) == GPIO_PIN_NPRIV)) && \
446                                           (((__ATTR__) & ~(GPIO_PIN_PRIV | GPIO_PIN_NPRIV)) == 0U))
447 #endif /* CPU_IN_SECURE_STATE */
448 /**
449   * @}
450   */
451 
452 /* Include GPIO HAL Extended module */
453 #include "stm32n6xx_hal_gpio_ex.h"
454 
455 /* Exported functions --------------------------------------------------------*/
456 /** @defgroup GPIO_Exported_Functions GPIO Exported Functions
457   *  @brief    GPIO Exported Functions
458   * @{
459   */
460 
461 /** @defgroup GPIO_Exported_Functions_Group1 Initialization/de-initialization functions
462   *  @brief    Initialization and Configuration functions
463   * @{
464   */
465 
466 /* Initialization and de-initialization functions *****************************/
467 void              HAL_GPIO_Init(GPIO_TypeDef  *GPIOx, const GPIO_InitTypeDef *GPIO_Init);
468 void              HAL_GPIO_DeInit(GPIO_TypeDef  *GPIOx, uint32_t GPIO_Pin);
469 
470 /**
471   * @}
472   */
473 
474 /** @defgroup GPIO_Exported_Functions_Group2 IO operation functions
475   *  @brief    IO operation functions
476   * @{
477   */
478 
479 /* IO operation functions *****************************************************/
480 GPIO_PinState     HAL_GPIO_ReadPin(const GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin);
481 void              HAL_GPIO_WritePin(GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin, GPIO_PinState PinState);
482 void              HAL_GPIO_TogglePin(GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin);
483 void              HAL_GPIO_WriteMultipleStatePin(GPIO_TypeDef *GPIOx, uint16_t PinReset, uint16_t PinSet);
484 HAL_StatusTypeDef HAL_GPIO_LockPin(GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin);
485 void              HAL_GPIO_SetRetime(GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin, const GPIO_RetimeTypeDef *pRet_Init);
486 HAL_StatusTypeDef HAL_GPIO_GetRetime(const GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin, GPIO_RetimeTypeDef *pRet_Init);
487 void              HAL_GPIO_SetDelay(GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin, const GPIO_DelayTypeDef *pDly_Init);
488 HAL_StatusTypeDef HAL_GPIO_GetDelay(const GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin, GPIO_DelayTypeDef *pDly_Init);
489 void              HAL_GPIO_EXTI_IRQHandler(uint16_t GPIO_Pin);
490 void              HAL_GPIO_EXTI_Rising_Callback(uint16_t GPIO_Pin);
491 void              HAL_GPIO_EXTI_Falling_Callback(uint16_t GPIO_Pin);
492 
493 /**
494   * @}
495   */
496 
497 #if defined CPU_IN_SECURE_STATE
498 
499 /** @defgroup GPIO_Exported_Functions_Group3 IO attributes management functions
500   * @{
501   */
502 
503 /* IO attributes management functions *****************************************/
504 void              HAL_GPIO_LockPinAttributes(GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin);
505 uint32_t          HAL_GPIO_GetLockPinAttributes(const GPIO_TypeDef *GPIOx);
506 #endif /* CPU_IN_SECURE_STATE */
507 void              HAL_GPIO_ConfigPinAttributes(GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin, uint32_t PinAttributes);
508 HAL_StatusTypeDef HAL_GPIO_GetConfigPinAttributes(const GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin,
509                                                   uint32_t *pPinAttributes);
510 
511 /**
512   * @}
513   */
514 
515 
516 /**
517   * @}
518   */
519 
520 /**
521   * @}
522   */
523 
524 /**
525   * @}
526   */
527 
528 #ifdef __cplusplus
529 }
530 #endif
531 
532 #endif /* STM32N6xx_HAL_GPIO_H */
533 
534