1 /**
2   ******************************************************************************
3   * @file    stm32wbaxx_hal.c
4   * @author  MCD Application Team
5   * @brief   HAL module driver.
6   *          This is the common part of the HAL initialization
7   *
8   ******************************************************************************
9   * @attention
10   *
11   * Copyright (c) 2022 STMicroelectronics.
12   * All rights reserved.
13   *
14   * This software is licensed under terms that can be found in the LICENSE file
15   * in the root directory of this software component.
16   * If no LICENSE file comes with this software, it is provided AS-IS.
17   *
18   ******************************************************************************
19   @verbatim
20   ==============================================================================
21                      ##### How to use this driver #####
22   ==============================================================================
23     [..]
24     The common HAL driver contains a set of generic and common APIs that can be
25     used by the PPP peripheral drivers and the user to start using the HAL.
26     [..]
27     The HAL contains two APIs' categories:
28          (+) Common HAL APIs
29          (+) Services HAL APIs
30 
31   @endverbatim
32   ******************************************************************************
33   */
34 
35 /* Includes ------------------------------------------------------------------*/
36 #include "stm32wbaxx_hal.h"
37 
38 /** @addtogroup STM32WBAxx_HAL_Driver
39   * @{
40   */
41 
42 /** @defgroup HAL HAL
43   * @brief HAL module driver
44   * @{
45   */
46 
47 #ifdef HAL_MODULE_ENABLED
48 
49 /* Private typedef -----------------------------------------------------------*/
50 /* Private define ------------------------------------------------------------*/
51 /* Private macros ------------------------------------------------------------*/
52 /* Private variables ---------------------------------------------------------*/
53 /* Exported variables --------------------------------------------------------*/
54 
55 /** @defgroup HAL_Exported_Variables HAL Exported Variables
56   * @{
57   */
58 __IO uint32_t uwTick;
59 uint32_t uwTickPrio   = (1UL << __NVIC_PRIO_BITS); /* Invalid PRIO */
60 HAL_TickFreqTypeDef uwTickFreq = HAL_TICK_FREQ_DEFAULT;  /* 1KHz */
61 /**
62   * @}
63   */
64 
65 /* Private function prototypes -----------------------------------------------*/
66 /* Exported functions --------------------------------------------------------*/
67 
68 /** @defgroup HAL_Exported_Functions HAL Exported Functions
69   * @{
70   */
71 
72 /** @defgroup HAL_Exported_Functions_Group1 Initialization and de-initialization Functions
73   *  @brief    Initialization and de-initialization functions
74   *
75 @verbatim
76  ===============================================================================
77               ##### Initialization and de-initialization functions #####
78  ===============================================================================
79     [..]  This section provides functions allowing to:
80       (+) Initializes the Flash interface the NVIC allocation and initial clock
81           configuration. It initializes the systick also when timeout is needed
82           and the backup domain when enabled.
83       (+) De-Initializes common part of the HAL.
84       (+) Configure The time base source to have 1ms time base with a dedicated
85           Tick interrupt priority.
86         (++) SysTick timer is used by default as source of time base, but user
87              can eventually implement his proper time base source (a general purpose
88              timer for example or other time source), keeping in mind that Time base
89              duration should be kept 1ms since PPP_TIMEOUT_VALUEs are defined and
90              handled in milliseconds basis.
91         (++) Time base configuration function (HAL_InitTick ()) is called automatically
92              at the beginning of the program after reset by HAL_Init() or at any time
93              when clock is configured, by HAL_RCC_ClockConfig().
94         (++) Source of time base is configured  to generate interrupts at regular
95              time intervals. Care must be taken if HAL_Delay() is called from a
96              peripheral ISR process, the Tick interrupt line must have higher priority
97             (numerically lower) than the peripheral interrupt. Otherwise the caller
98             ISR process will be blocked.
99        (++) functions affecting time base configurations are declared as __weak
100              to make  override possible  in case of other  implementations in user file.
101 @endverbatim
102   * @{
103   */
104 
105 /**
106   * @brief  Configure the Flash prefetch, the time base source, NVIC and any required global low
107   *         level hardware by calling the HAL_MspInit() callback function to be optionally defined
108   *         in user file stm32wbaxx_hal_msp.c.
109   *
110   * @note   HAL_Init() function is called at the beginning of program after reset and before
111   *         the clock configuration.
112   *
113   * @note   In the default implementation the System Timer (Systick) is used as source of time base.
114   *         The Systick configuration is based on HSI clock, as HSI is the clock
115   *         used after a system Reset and the NVIC configuration is set to Priority group 4.
116   *         Once done, time base tick starts incrementing: the tick variable counter is incremented
117   *         each 1ms in the SysTick_Handler() interrupt handler.
118   *
119   * @retval HAL status
120   */
HAL_Init(void)121 HAL_StatusTypeDef HAL_Init(void)
122 {
123   /* Configure Flash prefetch */
124 #if (PREFETCH_ENABLE != 0U)
125   __HAL_FLASH_PREFETCH_BUFFER_ENABLE();
126 #endif /* PREFETCH_ENABLE */
127 
128   /* Set Interrupt Group Priority */
129   HAL_NVIC_SetPriorityGrouping(NVIC_PRIORITYGROUP_4);
130 
131   /* Ensure time base clock coherency */
132   SystemCoreClockUpdate();
133 
134   /* Initialize 1ms tick time base (default SysTick based on HSI clock after Reset) */
135   if (HAL_InitTick(TICK_INT_PRIORITY) != HAL_OK)
136   {
137     return HAL_ERROR;
138   }
139 
140   /* Init the low level hardware */
141   HAL_MspInit();
142 
143   /* Return function status */
144   return HAL_OK;
145 }
146 
147 /**
148   * @brief  This function de-Initializes common part of the HAL and stops the systick.
149   *         This function is optional.
150   * @retval HAL status
151   */
HAL_DeInit(void)152 HAL_StatusTypeDef HAL_DeInit(void)
153 {
154   /* Reset of all peripherals */
155   __HAL_RCC_APB1_FORCE_RESET();
156   __HAL_RCC_APB1_RELEASE_RESET();
157 
158   __HAL_RCC_APB2_FORCE_RESET();
159   __HAL_RCC_APB2_RELEASE_RESET();
160 
161   __HAL_RCC_APB7_FORCE_RESET();
162   __HAL_RCC_APB7_RELEASE_RESET();
163 
164   __HAL_RCC_AHB1_FORCE_RESET();
165   __HAL_RCC_AHB1_RELEASE_RESET();
166 
167   __HAL_RCC_AHB2_FORCE_RESET();
168   __HAL_RCC_AHB2_RELEASE_RESET();
169 
170   __HAL_RCC_AHB4_FORCE_RESET();
171   __HAL_RCC_AHB4_RELEASE_RESET();
172 
173   __HAL_RCC_AHB5_FORCE_RESET();
174   __HAL_RCC_AHB5_RELEASE_RESET();
175 
176   /* De-Init the low level hardware */
177   HAL_MspDeInit();
178 
179   /* Return function status */
180   return HAL_OK;
181 }
182 
183 /**
184   * @brief  Initializes the MSP.
185   * @retval None
186   */
HAL_MspInit(void)187 __weak void HAL_MspInit(void)
188 {
189   /* NOTE : This function Should not be modified, when the callback is needed,
190             the HAL_MspInit could be implemented in the user file
191    */
192 }
193 
194 /**
195   * @brief  DeInitializes the MSP.
196   * @retval None
197   */
HAL_MspDeInit(void)198 __weak void HAL_MspDeInit(void)
199 {
200   /* NOTE : This function Should not be modified, when the callback is needed,
201             the HAL_MspDeInit could be implemented in the user file
202    */
203 }
204 
205 /**
206   * @brief This function configures the source of the time base.
207   *        The time source is configured to have 1ms time base with a dedicated
208   *        Tick interrupt priority.
209   * @note This function is called  automatically at the beginning of program after
210   *       reset by HAL_Init() or at any time when clock is reconfigured  by HAL_RCC_ClockConfig().
211   * @note In the default implementation, SysTick timer is the source of time base.
212   *       It is used to generate interrupts at regular time intervals.
213   *       Care must be taken if HAL_Delay() is called from a peripheral ISR process,
214   *       The SysTick interrupt must have higher priority (numerically lower)
215   *       than the peripheral interrupt. Otherwise the caller ISR process will be blocked.
216   *       The function is declared as __weak  to be overwritten  in case of other
217   *       implementation  in user file.
218   * @param TickPriority: Tick interrupt priority.
219   * @retval HAL status
220   */
HAL_InitTick(uint32_t TickPriority)221 __weak HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority)
222 {
223   /* Check uwTickFreq for MisraC 2012 (even if uwTickFreq is a enum type that don't take the value zero)*/
224   if ((uint32_t)uwTickFreq == 0UL)
225   {
226     return HAL_ERROR;
227   }
228 
229   /* Configure the SysTick to have interrupt in 1ms time basis*/
230   if (HAL_SYSTICK_Config(SystemCoreClock / (1000UL / (uint32_t)uwTickFreq)) > 0U)
231   {
232     return HAL_ERROR;
233   }
234 
235   /* Configure the SysTick IRQ priority */
236   if (TickPriority < (1UL << __NVIC_PRIO_BITS))
237   {
238     HAL_NVIC_SetPriority(SysTick_IRQn, TickPriority, 0U);
239     uwTickPrio = TickPriority;
240   }
241   else
242   {
243     return HAL_ERROR;
244   }
245 
246   /* Return function status */
247   return HAL_OK;
248 }
249 
250 /**
251   * @}
252   */
253 
254 /** @defgroup HAL_Group2 HAL Control functions
255   *  @brief    HAL Control functions
256   *
257 @verbatim
258  ===============================================================================
259                       ##### HAL Control functions #####
260  ===============================================================================
261     [..]  This section provides functions allowing to:
262       (+) Provide a tick value in millisecond
263       (+) Provide a blocking delay in millisecond
264       (+) Suspend the time base source interrupt
265       (+) Resume the time base source interrupt
266       (+) Get the HAL API driver version
267       (+) Get the device identifier
268       (+) Get the device revision identifier
269       (+) Enable/Disable Debug module during SLEEP mode
270       (+) Enable/Disable Debug module during STOP mode
271       (+) Enable/Disable Debug module during STANDBY mode
272 
273 @endverbatim
274   * @{
275   */
276 
277 /**
278   * @brief This function is called to increment a global variable "uwTick"
279   *        used as application time base.
280   * @note In the default implementation, this variable is incremented each 1ms
281   *       in Systick ISR.
282   * @note This function is declared as __weak to be overwritten in case of other
283   *      implementations in user file.
284   * @retval None
285   */
HAL_IncTick(void)286 __weak void HAL_IncTick(void)
287 {
288   uwTick += (uint32_t)uwTickFreq;
289 }
290 
291 /**
292   * @brief Provides a tick value in millisecond.
293   * @note This function is declared as __weak to be overwritten in case of other
294   *       implementations in user file.
295   * @retval tick value
296   */
HAL_GetTick(void)297 __weak uint32_t HAL_GetTick(void)
298 {
299   return uwTick;
300 }
301 
302 /**
303   * @brief This function returns a tick priority.
304   * @retval tick priority
305   */
HAL_GetTickPrio(void)306 uint32_t HAL_GetTickPrio(void)
307 {
308   return uwTickPrio;
309 }
310 
311 /**
312   * @brief Set new tick Freq.
313   * @retval Status
314   */
HAL_SetTickFreq(HAL_TickFreqTypeDef Freq)315 HAL_StatusTypeDef HAL_SetTickFreq(HAL_TickFreqTypeDef Freq)
316 {
317   HAL_StatusTypeDef status  = HAL_OK;
318   assert_param(IS_TICKFREQ(Freq));
319 
320   if (uwTickFreq != Freq)
321   {
322     /* Apply the new tick Freq  */
323     status = HAL_InitTick(uwTickPrio);
324 
325     if (status == HAL_OK)
326     {
327       uwTickFreq = Freq;
328     }
329   }
330 
331   return status;
332 }
333 
334 /**
335   * @brief Return tick frequency.
336   * @retval Tick frequency.
337   *         Value of @ref HAL_TickFreqTypeDef.
338   */
HAL_GetTickFreq(void)339 HAL_TickFreqTypeDef HAL_GetTickFreq(void)
340 {
341   return uwTickFreq;
342 }
343 
344 /**
345   * @brief This function provides minimum delay (in milliseconds) based
346   *        on variable incremented.
347   * @note In the default implementation , SysTick timer is the source of time base.
348   *       It is used to generate interrupts at regular time intervals where uwTick
349   *       is incremented.
350   * @note This function is declared as __weak to be overwritten in case of other
351   *       implementations in user file.
352   * @param Delay  specifies the delay time length, in milliseconds.
353   * @retval None
354   */
HAL_Delay(uint32_t Delay)355 __weak void HAL_Delay(uint32_t Delay)
356 {
357   uint32_t tickstart = HAL_GetTick();
358   uint32_t wait = Delay;
359 
360   /* Add a freq to guarantee minimum wait */
361   if (wait < HAL_MAX_DELAY)
362   {
363     wait += (uint32_t)(uwTickFreq);
364   }
365 
366   while ((HAL_GetTick() - tickstart) < wait)
367   {
368   }
369 }
370 
371 /**
372   * @brief Suspend Tick increment.
373   * @note In the default implementation , SysTick timer is the source of time base. It is
374   *       used to generate interrupts at regular time intervals. Once HAL_SuspendTick()
375   *       is called, the SysTick interrupt will be disabled and so Tick increment
376   *       is suspended.
377   * @note This function is declared as __weak to be overwritten in case of other
378   *       implementations in user file.
379   * @retval None
380   */
HAL_SuspendTick(void)381 __weak void HAL_SuspendTick(void)
382 {
383   /* Disable SysTick Interrupt */
384   SysTick->CTRL &= ~SysTick_CTRL_TICKINT_Msk;
385 }
386 
387 /**
388   * @brief Resume Tick increment.
389   * @note In the default implementation , SysTick timer is the source of time base. It is
390   *       used to generate interrupts at regular time intervals. Once HAL_ResumeTick()
391   *       is called, the SysTick interrupt will be enabled and so Tick increment
392   *       is resumed.
393   * @note This function is declared as __weak to be overwritten in case of other
394   *       implementations in user file.
395   * @retval None
396   */
HAL_ResumeTick(void)397 __weak void HAL_ResumeTick(void)
398 {
399   /* Enable SysTick Interrupt */
400   SysTick->CTRL  |= SysTick_CTRL_TICKINT_Msk;
401 }
402 
403 /**
404   * @brief  Returns the HAL revision
405   * @retval version : 0xXYZR (8bits for each decimal, R for RC)
406   */
HAL_GetHalVersion(void)407 uint32_t HAL_GetHalVersion(void)
408 {
409   return __STM32WBAxx_HAL_VERSION;
410 }
411 
412 /**
413   * @brief  Returns the device revision identifier.
414   * @retval Device revision identifier
415   */
HAL_GetREVID(void)416 uint32_t HAL_GetREVID(void)
417 {
418   return ((DBGMCU->IDCODE & DBGMCU_IDCODE_REV_ID) >> 16);
419 }
420 
421 /**
422   * @brief  Returns the device identifier.
423   * @retval Device identifier
424   */
HAL_GetDEVID(void)425 uint32_t HAL_GetDEVID(void)
426 {
427   return (DBGMCU->IDCODE & DBGMCU_IDCODE_DEV_ID);
428 }
429 
430 /**
431   * @brief  Return the first word of the unique device identifier (UID based on 96 bits)
432   * @retval Device identifier
433   */
HAL_GetUIDw0(void)434 uint32_t HAL_GetUIDw0(void)
435 {
436   return (READ_REG(*((uint32_t *)UID_BASE)));
437 }
438 
439 /**
440   * @brief  Return the second word of the unique device identifier (UID based on 96 bits)
441   * @retval Device identifier
442   */
HAL_GetUIDw1(void)443 uint32_t HAL_GetUIDw1(void)
444 {
445   return (READ_REG(*((uint32_t *)(UID_BASE + 4U))));
446 }
447 
448 /**
449   * @brief  Return the third word of the unique device identifier (UID based on 96 bits)
450   * @retval Device identifier
451   */
HAL_GetUIDw2(void)452 uint32_t HAL_GetUIDw2(void)
453 {
454   return (READ_REG(*((uint32_t *)(UID_BASE + 8U))));
455 }
456 /**
457   * @}
458   */
459 
460 
461 /** @defgroup HAL_Exported_Functions_Group3 HAL Debug functions
462   *  @brief    HAL Debug functions
463   *
464 @verbatim
465  ===============================================================================
466                       ##### HAL Debug functions #####
467  ===============================================================================
468     [..]  This section provides functions allowing to:
469       (+) Enable/Disable Debug module during STOP0/STOP1/STOP2 modes
470       (+) Enable/Disable Debug module during STANDBY mode
471 
472 @endverbatim
473   * @{
474   */
475 
476 /**
477   * @brief  Enable the Debug Module during STOP0/STOP1/STOP2 modes.
478   * @retval None
479   */
HAL_DBGMCU_EnableDBGStopMode(void)480 void HAL_DBGMCU_EnableDBGStopMode(void)
481 {
482   SET_BIT(DBGMCU->SCR, DBGMCU_SCR_DBG_STOP);
483 }
484 
485 /**
486   * @brief  Disable the Debug Module during STOP0/STOP1/STOP2 modes.
487   * @retval None
488   */
HAL_DBGMCU_DisableDBGStopMode(void)489 void HAL_DBGMCU_DisableDBGStopMode(void)
490 {
491   CLEAR_BIT(DBGMCU->SCR, DBGMCU_SCR_DBG_STOP);
492 }
493 
494 /**
495   * @brief  Enable the Debug Module during STANDBY mode.
496   * @retval None
497   */
HAL_DBGMCU_EnableDBGStandbyMode(void)498 void HAL_DBGMCU_EnableDBGStandbyMode(void)
499 {
500   SET_BIT(DBGMCU->SCR, DBGMCU_SCR_DBG_STANDBY);
501 }
502 
503 /**
504   * @brief  Disable the Debug Module during STANDBY mode.
505   * @retval None
506   */
HAL_DBGMCU_DisableDBGStandbyMode(void)507 void HAL_DBGMCU_DisableDBGStandbyMode(void)
508 {
509   CLEAR_BIT(DBGMCU->SCR, DBGMCU_SCR_DBG_STANDBY);
510 }
511 
512 /**
513   * @}
514   */
515 
516 /** @defgroup HAL_Exported_Functions_Group4 HAL SYSCFG configuration functions
517   *  @brief    HAL SYSCFG configuration functions
518   *
519 @verbatim
520  ===============================================================================
521                       ##### HAL SYSCFG configuration functions #####
522  ===============================================================================
523     [..]  This section provides functions allowing to:
524       (+) Enable/Disable the I/O analog switch voltage booster
525 
526 @endverbatim
527   * @{
528   */
529 
530 /**
531   * @brief  Enable the I/O analog switch voltage booster
532   *
533   * @retval None
534   */
HAL_SYSCFG_EnableIOAnalogSwitchBooster(void)535 void HAL_SYSCFG_EnableIOAnalogSwitchBooster(void)
536 {
537   SET_BIT(SYSCFG->CFGR1, SYSCFG_CFGR1_BOOSTEN);
538 }
539 
540 /**
541   * @brief  Disable the I/O analog switch voltage booster
542   *
543   * @retval None
544   */
HAL_SYSCFG_DisableIOAnalogSwitchBooster(void)545 void HAL_SYSCFG_DisableIOAnalogSwitchBooster(void)
546 {
547   CLEAR_BIT(SYSCFG->CFGR1, SYSCFG_CFGR1_BOOSTEN);
548 }
549 
550 /**
551   * @}
552   */
553 
554 /** @defgroup HAL_Exported_Functions_Group5 HAL SYSCFG lock management functions
555   *  @brief SYSCFG lock management functions.
556   *
557 @verbatim
558  ===============================================================================
559                        ##### SYSCFG lock functions #####
560  ===============================================================================
561 
562 @endverbatim
563   * @{
564   */
565 
566 /**
567   * @brief  Lock the SYSCFG item(s).
568   * @note   Setting lock(s) depends on privilege mode in secure/non-secure code
569   *         Lock(s) cleared only at system reset
570   * @param  Item Item(s) to set lock on.
571   *         This parameter can be a combination of @ref SYSCFG_Lock_items
572   * @retval None
573   */
HAL_SYSCFG_Lock(uint32_t Item)574 void HAL_SYSCFG_Lock(uint32_t Item)
575 {
576   /* Check the parameters */
577   assert_param(IS_SYSCFG_LOCK_ITEMS(Item));
578 
579   /* Privilege secure/non-secure locks */
580   SYSCFG->CNSLCKR = (0xFFFFU & Item);  /* non-secure lock item in 16 lowest bits */
581 
582 #if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
583   /* Privilege secure only locks */
584   SYSCFG->CSLCKR = ((0xFFFF0000U & Item) >> 16U);  /* Secure-only lock item in 16 highest bits */
585 #endif /* __ARM_FEATURE_CMSE */
586 }
587 
588 /**
589   * @brief  Get the lock state of SYSCFG item.
590   * @note   Getting lock(s) depends on privilege mode in secure/non-secure code
591   * @param  pItem pointer to return locked items
592   *         the return value can be a combination of @ref SYSCFG_Lock_items
593   * @retval HAL status
594   */
HAL_SYSCFG_GetLock(uint32_t * pItem)595 HAL_StatusTypeDef HAL_SYSCFG_GetLock(uint32_t *pItem)
596 {
597   uint32_t tmp_lock;
598 
599   /* Check null pointer */
600   if (pItem == NULL)
601   {
602     return HAL_ERROR;
603   }
604 
605   /* Get the non-secure lock state */
606   tmp_lock = SYSCFG->CNSLCKR;
607 
608   /* Get the secure lock state in secure code */
609 #if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
610   tmp_lock |= (SYSCFG->CSLCKR << 16U);
611 #endif /* __ARM_FEATURE_CMSE */
612 
613   /* Return overall lock status */
614   *pItem = tmp_lock;
615 
616   return HAL_OK;
617 }
618 
619 /**
620   * @}
621   */
622 
623 #if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
624 
625 
626 /** @defgroup HAL_Exported_Functions_Group6 HAL SYSCFG attributes management functions
627   *  @brief SYSCFG attributes management functions.
628   *
629 @verbatim
630  ===============================================================================
631                        ##### SYSCFG attributes functions #####
632  ===============================================================================
633 
634 @endverbatim
635   * @{
636   */
637 
638 /**
639   * @brief  Configure the SYSCFG item attribute(s).
640   * @note   Available attributes are to secure SYSCFG items, so this function is
641   *         only available in secure
642   * @param  Item Item(s) to set attributes on.
643   *         This parameter can be a one or a combination of @ref SYSCFG_Attributes_items
644   * @param  Attributes  specifies the secure/non-secure attributes.
645   * @retval None
646   */
HAL_SYSCFG_ConfigAttributes(uint32_t Item,uint32_t Attributes)647 void HAL_SYSCFG_ConfigAttributes(uint32_t Item, uint32_t Attributes)
648 {
649   uint32_t tmp;
650 
651   /* Check the parameters */
652   assert_param(IS_SYSCFG_ITEMS_ATTRIBUTES(Item));
653   assert_param(IS_SYSCFG_ATTRIBUTES(Attributes));
654 
655   tmp = SYSCFG_S->SECCFGR;
656 
657   /* Set or reset Item */
658   if ((Attributes & SYSCFG_SEC) != 0x00U)
659   {
660     tmp |= Item;
661   }
662   else
663   {
664     tmp &= ~Item;
665   }
666 
667   /* Set secure attributes */
668   SYSCFG_S->SECCFGR = tmp;
669 }
670 
671 /**
672   * @brief  Get the attribute of a SYSCFG item.
673   * @note   Available attributes are to secure SYSCFG items, so this function is
674   *         only available in secure
675   * @param  Item Single item to get secure/non-secure attribute from.
676   * @param  pAttributes pointer to return the attribute.
677   * @retval HAL status
678   */
HAL_SYSCFG_GetConfigAttributes(uint32_t Item,uint32_t * pAttributes)679 HAL_StatusTypeDef HAL_SYSCFG_GetConfigAttributes(uint32_t Item, uint32_t *pAttributes)
680 {
681   /* Check null pointer */
682   if (pAttributes == NULL)
683   {
684     return HAL_ERROR;
685   }
686 
687   /* Check the parameters */
688   assert_param(IS_SYSCFG_ITEMS_ATTRIBUTES(Item));
689 
690   /* Get the secure attribute state */
691   if ((SYSCFG_S->SECCFGR & Item) != 0U)
692   {
693     *pAttributes = SYSCFG_SEC;
694   }
695   else
696   {
697     *pAttributes = SYSCFG_NSEC;
698   }
699 
700   return HAL_OK;
701 }
702 
703 /**
704   * @}
705   */
706 
707 #endif /* __ARM_FEATURE_CMSE */
708 
709 /**
710   * @}
711   */
712 
713 #endif /* HAL_MODULE_ENABLED */
714 /**
715   * @}
716   */
717 
718 /**
719   * @}
720   */
721 
722