stm32f7xx_hal_cortex.c
Go to the documentation of this file.
1 
82 /* Includes ------------------------------------------------------------------*/
83 #include "stm32f7xx_hal.h"
84 
94 #ifdef HAL_CORTEX_MODULE_ENABLED
95 
96 /* Private types -------------------------------------------------------------*/
97 /* Private variables ---------------------------------------------------------*/
98 /* Private constants ---------------------------------------------------------*/
99 /* Private macros ------------------------------------------------------------*/
100 /* Private functions ---------------------------------------------------------*/
101 /* Exported functions --------------------------------------------------------*/
102 
143 void HAL_NVIC_SetPriorityGrouping(uint32_t PriorityGroup)
144 {
145  /* Check the parameters */
146  assert_param(IS_NVIC_PRIORITY_GROUP(PriorityGroup));
147 
148  /* Set the PRIGROUP[10:8] bits according to the PriorityGroup parameter value */
149  NVIC_SetPriorityGrouping(PriorityGroup);
150 }
151 
165 void HAL_NVIC_SetPriority(IRQn_Type IRQn, uint32_t PreemptPriority, uint32_t SubPriority)
166 {
167  uint32_t prioritygroup = 0x00;
168 
169  /* Check the parameters */
170  assert_param(IS_NVIC_SUB_PRIORITY(SubPriority));
171  assert_param(IS_NVIC_PREEMPTION_PRIORITY(PreemptPriority));
172 
173  prioritygroup = NVIC_GetPriorityGrouping();
174 
175  NVIC_SetPriority(IRQn, NVIC_EncodePriority(prioritygroup, PreemptPriority, SubPriority));
176 }
177 
188 {
189  /* Check the parameters */
191 
192  /* Enable interrupt */
194 }
195 
204 {
205  /* Check the parameters */
207 
208  /* Disable interrupt */
210 }
211 
216 void HAL_NVIC_SystemReset(void)
217 {
218  /* System Reset */
220 }
221 
229 uint32_t HAL_SYSTICK_Config(uint32_t TicksNumb)
230 {
231  return SysTick_Config(TicksNumb);
232 }
253 #if (__MPU_PRESENT == 1)
254 
258 void HAL_MPU_Disable(void)
259 {
260  /* Make sure outstanding transfers are done */
261  __DMB();
262 
263  /* Disable fault exceptions */
264  SCB->SHCSR &= ~SCB_SHCSR_MEMFAULTENA_Msk;
265 
266  /* Disable the MPU and clear the control register*/
267  MPU->CTRL = 0;
268 }
269 
281 void HAL_MPU_Enable(uint32_t MPU_Control)
282 {
283  /* Enable the MPU */
284  MPU->CTRL = MPU_Control | MPU_CTRL_ENABLE_Msk;
285 
286  /* Enable fault exceptions */
287  SCB->SHCSR |= SCB_SHCSR_MEMFAULTENA_Msk;
288 
289  /* Ensure MPU setting take effects */
290  __DSB();
291  __ISB();
292 }
293 
300 void HAL_MPU_ConfigRegion(MPU_Region_InitTypeDef *MPU_Init)
301 {
302  /* Check the parameters */
303  assert_param(IS_MPU_REGION_NUMBER(MPU_Init->Number));
304  assert_param(IS_MPU_REGION_ENABLE(MPU_Init->Enable));
305 
306  /* Set the Region number */
307  MPU->RNR = MPU_Init->Number;
308 
309  if ((MPU_Init->Enable) != RESET)
310  {
311  /* Check the parameters */
312  assert_param(IS_MPU_INSTRUCTION_ACCESS(MPU_Init->DisableExec));
313  assert_param(IS_MPU_REGION_PERMISSION_ATTRIBUTE(MPU_Init->AccessPermission));
314  assert_param(IS_MPU_TEX_LEVEL(MPU_Init->TypeExtField));
315  assert_param(IS_MPU_ACCESS_SHAREABLE(MPU_Init->IsShareable));
316  assert_param(IS_MPU_ACCESS_CACHEABLE(MPU_Init->IsCacheable));
317  assert_param(IS_MPU_ACCESS_BUFFERABLE(MPU_Init->IsBufferable));
318  assert_param(IS_MPU_SUB_REGION_DISABLE(MPU_Init->SubRegionDisable));
319  assert_param(IS_MPU_REGION_SIZE(MPU_Init->Size));
320 
321  MPU->RBAR = MPU_Init->BaseAddress;
322  MPU->RASR = ((uint32_t)MPU_Init->DisableExec << MPU_RASR_XN_Pos) |
323  ((uint32_t)MPU_Init->AccessPermission << MPU_RASR_AP_Pos) |
324  ((uint32_t)MPU_Init->TypeExtField << MPU_RASR_TEX_Pos) |
325  ((uint32_t)MPU_Init->IsShareable << MPU_RASR_S_Pos) |
326  ((uint32_t)MPU_Init->IsCacheable << MPU_RASR_C_Pos) |
327  ((uint32_t)MPU_Init->IsBufferable << MPU_RASR_B_Pos) |
328  ((uint32_t)MPU_Init->SubRegionDisable << MPU_RASR_SRD_Pos) |
329  ((uint32_t)MPU_Init->Size << MPU_RASR_SIZE_Pos) |
330  ((uint32_t)MPU_Init->Enable << MPU_RASR_ENABLE_Pos);
331  }
332  else
333  {
334  MPU->RBAR = 0x00;
335  MPU->RASR = 0x00;
336  }
337 }
338 #endif /* __MPU_PRESENT */
339 
344 uint32_t HAL_NVIC_GetPriorityGrouping(void)
345 {
346  /* Get the PRIGROUP[10:8] field value */
347  return NVIC_GetPriorityGrouping();
348 }
349 
371 void HAL_NVIC_GetPriority(IRQn_Type IRQn, uint32_t PriorityGroup, uint32_t *pPreemptPriority, uint32_t *pSubPriority)
372 {
373  /* Check the parameters */
374  assert_param(IS_NVIC_PRIORITY_GROUP(PriorityGroup));
375  /* Get priority for Cortex-M system or device specific interrupts */
376  NVIC_DecodePriority(NVIC_GetPriority(IRQn), PriorityGroup, pPreemptPriority, pSubPriority);
377 }
378 
387 {
388  /* Check the parameters */
390 
391  /* Set interrupt pending */
393 }
394 
405 {
406  /* Check the parameters */
408 
409  /* Return 1 if pending else 0 */
410  return NVIC_GetPendingIRQ(IRQn);
411 }
412 
421 {
422  /* Check the parameters */
424 
425  /* Clear pending interrupt */
427 }
428 
438 {
439  /* Check the parameters */
441 
442  /* Return 1 if active else 0 */
443  return NVIC_GetActive(IRQn);
444 }
445 
454 void HAL_SYSTICK_CLKSourceConfig(uint32_t CLKSource)
455 {
456  /* Check the parameters */
458  if (CLKSource == SYSTICK_CLKSOURCE_HCLK)
459  {
461  }
462  else
463  {
465  }
466 }
467 
472 void HAL_SYSTICK_IRQHandler(void)
473 {
475 }
476 
481 __weak void HAL_SYSTICK_Callback(void)
482 {
483  /* NOTE : This function Should not be modified, when the callback is needed,
484  the HAL_SYSTICK_Callback could be implemented in the user file
485  */
486 }
487 
496 #endif /* HAL_CORTEX_MODULE_ENABLED */
497 
505 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
SCB
#define SCB
Definition: imxrt1050/imxrt1050-evkb/CMSIS/core_cm7.h:1778
assert_param
#define assert_param(expr)
Include module's header file.
Definition: stm32f407/stm32f407g-disc1/Inc/stm32f4xx_hal_conf.h:353
NVIC_SetPriorityGrouping
#define NVIC_SetPriorityGrouping
Definition: imxrt1050/imxrt1050-evkb/CMSIS/core_cm7.h:1826
NVIC_GetPriorityGrouping
#define NVIC_GetPriorityGrouping
Definition: imxrt1050/imxrt1050-evkb/CMSIS/core_cm7.h:1827
NVIC_GetPendingIRQ
#define NVIC_GetPendingIRQ
Definition: imxrt1050/imxrt1050-evkb/CMSIS/core_cm7.h:1831
HAL_NVIC_EnableIRQ
void HAL_NVIC_EnableIRQ(IRQn_Type IRQn)
IRQn
IRQn
Definition: MIMXRT1052.h:78
NVIC_DecodePriority
__STATIC_INLINE void NVIC_DecodePriority(uint32_t Priority, uint32_t PriorityGroup, uint32_t *const pPreemptPriority, uint32_t *const pSubPriority)
Decode Priority.
Definition: imxrt1050/imxrt1050-evkb/CMSIS/core_cm7.h:2106
NVIC_GetPriority
#define NVIC_GetPriority
Definition: imxrt1050/imxrt1050-evkb/CMSIS/core_cm7.h:1836
__DSB
__STATIC_FORCEINLINE void __DSB(void)
Data Synchronization Barrier.
Definition: imxrt1050/imxrt1050-evkb/CMSIS/cmsis_gcc.h:944
HAL_NVIC_SystemReset
void HAL_NVIC_SystemReset(void)
__ISB
__STATIC_FORCEINLINE void __ISB(void)
Instruction Synchronization Barrier.
Definition: imxrt1050/imxrt1050-evkb/CMSIS/cmsis_gcc.h:933
IS_NVIC_SUB_PRIORITY
#define IS_NVIC_SUB_PRIORITY(PRIORITY)
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_cortex.h:314
HAL_NVIC_DisableIRQ
void HAL_NVIC_DisableIRQ(IRQn_Type IRQn)
NVIC_ClearPendingIRQ
#define NVIC_ClearPendingIRQ
Definition: imxrt1050/imxrt1050-evkb/CMSIS/core_cm7.h:1833
SYSTICK_CLKSOURCE_HCLK
#define SYSTICK_CLKSOURCE_HCLK
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_cortex.h:108
IS_NVIC_PREEMPTION_PRIORITY
#define IS_NVIC_PREEMPTION_PRIORITY(PRIORITY)
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_cortex.h:312
NVIC_EncodePriority
__STATIC_INLINE uint32_t NVIC_EncodePriority(uint32_t PriorityGroup, uint32_t PreemptPriority, uint32_t SubPriority)
Encode Priority.
Definition: imxrt1050/imxrt1050-evkb/CMSIS/core_cm7.h:2079
HAL_NVIC_GetActive
uint32_t HAL_NVIC_GetActive(IRQn_Type IRQn)
HAL_NVIC_SetPriorityGrouping
void HAL_NVIC_SetPriorityGrouping(uint32_t PriorityGroup)
HAL_SYSTICK_IRQHandler
void HAL_SYSTICK_IRQHandler(void)
HAL_SYSTICK_Config
uint32_t HAL_SYSTICK_Config(uint32_t TicksNumb)
HAL_NVIC_ClearPendingIRQ
void HAL_NVIC_ClearPendingIRQ(IRQn_Type IRQn)
NVIC_SystemReset
#define NVIC_SystemReset
Definition: imxrt1050/imxrt1050-evkb/CMSIS/core_cm7.h:1837
IS_SYSTICK_CLK_SOURCE
#define IS_SYSTICK_CLK_SOURCE(SOURCE)
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_cortex.h:318
IRQn_Type
IRQn_Type
STM32F4XX Interrupt Number Definition, according to the selected device in Library_configuration_sect...
Definition: stm32f407xx.h:66
RESET
@ RESET
Definition: stm32f407/stm32f407g-disc1/Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f4xx.h:187
HAL_SYSTICK_CLKSourceConfig
void HAL_SYSTICK_CLKSourceConfig(uint32_t CLKSource)
SCB_SHCSR_MEMFAULTENA_Msk
#define SCB_SHCSR_MEMFAULTENA_Msk
Definition: imxrt1050/imxrt1050-evkb/CMSIS/core_cm7.h:628
HAL_NVIC_GetPendingIRQ
uint32_t HAL_NVIC_GetPendingIRQ(IRQn_Type IRQn)
HAL_NVIC_SetPendingIRQ
void HAL_NVIC_SetPendingIRQ(IRQn_Type IRQn)
NVIC_DisableIRQ
#define NVIC_DisableIRQ
Definition: imxrt1050/imxrt1050-evkb/CMSIS/core_cm7.h:1830
IS_NVIC_PRIORITY_GROUP
#define IS_NVIC_PRIORITY_GROUP(GROUP)
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_cortex.h:306
HAL_NVIC_GetPriority
void HAL_NVIC_GetPriority(IRQn_Type IRQn, uint32_t PriorityGroup, uint32_t *pPreemptPriority, uint32_t *pSubPriority)
NVIC_SetPendingIRQ
#define NVIC_SetPendingIRQ
Definition: imxrt1050/imxrt1050-evkb/CMSIS/core_cm7.h:1832
NVIC_SetPriority
#define NVIC_SetPriority
Definition: imxrt1050/imxrt1050-evkb/CMSIS/core_cm7.h:1835
__DMB
__STATIC_FORCEINLINE void __DMB(void)
Data Memory Barrier.
Definition: imxrt1050/imxrt1050-evkb/CMSIS/cmsis_gcc.h:955
NVIC_GetActive
#define NVIC_GetActive
Definition: imxrt1050/imxrt1050-evkb/CMSIS/core_cm7.h:1834
NVIC_EnableIRQ
#define NVIC_EnableIRQ
Definition: imxrt1050/imxrt1050-evkb/CMSIS/core_cm7.h:1828
SysTick
#define SysTick
Definition: imxrt1050/imxrt1050-evkb/CMSIS/core_cm7.h:1779
HAL_NVIC_SetPriority
void HAL_NVIC_SetPriority(IRQn_Type IRQn, uint32_t PreemptPriority, uint32_t SubPriority)
HAL_NVIC_GetPriorityGrouping
uint32_t HAL_NVIC_GetPriorityGrouping(void)
IS_NVIC_DEVICE_IRQ
#define IS_NVIC_DEVICE_IRQ(IRQ)
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_cortex.h:316
HAL_SYSTICK_Callback
void HAL_SYSTICK_Callback(void)
stm32f7xx_hal.h
This file contains all the functions prototypes for the HAL module driver.


picovoice_driver
Author(s):
autogenerated on Fri Apr 1 2022 02:14:53