STM32L4xx_HAL_Driver  1.14.0
stm32l4xx_hal_cortex.c File Reference

CORTEX HAL module driver. This file provides firmware functions to manage the following functionalities of the CORTEX: More...

Go to the source code of this file.

Functions

void HAL_NVIC_SetPriorityGrouping (uint32_t PriorityGroup)
 Set the priority grouping field (pre-emption priority and subpriority) using the required unlock sequence. More...
 
void HAL_NVIC_SetPriority (IRQn_Type IRQn, uint32_t PreemptPriority, uint32_t SubPriority)
 Set the priority of an interrupt. More...
 
void HAL_NVIC_EnableIRQ (IRQn_Type IRQn)
 Enable a device specific interrupt in the NVIC interrupt controller. More...
 
void HAL_NVIC_DisableIRQ (IRQn_Type IRQn)
 Disable a device specific interrupt in the NVIC interrupt controller. More...
 
void HAL_NVIC_SystemReset (void)
 Initiate a system reset request to reset the MCU. More...
 
uint32_t HAL_SYSTICK_Config (uint32_t TicksNumb)
 Initialize the System Timer with interrupt enabled and start the System Tick Timer (SysTick): Counter is in free running mode to generate periodic interrupts. More...
 
uint32_t HAL_NVIC_GetPriorityGrouping (void)
 Get the priority grouping field from the NVIC Interrupt Controller. More...
 
void HAL_NVIC_GetPriority (IRQn_Type IRQn, uint32_t PriorityGroup, uint32_t *pPreemptPriority, uint32_t *pSubPriority)
 Get the priority of an interrupt. More...
 
void HAL_NVIC_SetPendingIRQ (IRQn_Type IRQn)
 Set Pending bit of an external interrupt. More...
 
uint32_t HAL_NVIC_GetPendingIRQ (IRQn_Type IRQn)
 Get Pending Interrupt (read the pending register in the NVIC and return the pending bit for the specified interrupt). More...
 
void HAL_NVIC_ClearPendingIRQ (IRQn_Type IRQn)
 Clear the pending bit of an external interrupt. More...
 
uint32_t HAL_NVIC_GetActive (IRQn_Type IRQn)
 Get active interrupt (read the active register in NVIC and return the active bit). More...
 
void HAL_SYSTICK_CLKSourceConfig (uint32_t CLKSource)
 Configure the SysTick clock source. More...
 
void HAL_SYSTICK_IRQHandler (void)
 Handle SYSTICK interrupt request. More...
 
void HAL_SYSTICK_Callback (void)
 SYSTICK callback. More...
 
void HAL_MPU_Disable (void)
 Disable the MPU. More...
 
void HAL_MPU_Enable (uint32_t MPU_Control)
 Enable the MPU. More...
 
void HAL_MPU_ConfigRegion (MPU_Region_InitTypeDef *MPU_Init)
 Initialize and configure the Region and the memory to be protected. More...
 

Detailed Description

CORTEX HAL module driver. This file provides firmware functions to manage the following functionalities of the CORTEX:

Author
MCD Application Team
  • Initialization and Configuration functions
  • Peripheral Control functions
==============================================================================
                      ##### How to use this driver #####
==============================================================================

  [..]
  *** How to configure Interrupts using CORTEX HAL driver ***
  ===========================================================
  [..]
  This section provides functions allowing to configure the NVIC interrupts (IRQ).
  The Cortex-M4 exceptions are managed by CMSIS functions.

  (#) Configure the NVIC Priority Grouping using HAL_NVIC_SetPriorityGrouping() function.
  (#) Configure the priority of the selected IRQ Channels using HAL_NVIC_SetPriority().
  (#) Enable the selected IRQ Channels using HAL_NVIC_EnableIRQ().

   -@- When the NVIC_PRIORITYGROUP_0 is selected, IRQ pre-emption is no more possible.
       The pending IRQ priority will be managed only by the sub priority.

   -@- IRQ priority order (sorted by highest to lowest priority):
      (+@) Lowest pre-emption priority
      (+@) Lowest sub priority
      (+@) Lowest hardware priority (IRQ number)

  [..]
  *** How to configure SysTick using CORTEX HAL driver ***
  ========================================================
  [..]
  Setup SysTick Timer for time base.

 (+) The HAL_SYSTICK_Config() function calls the SysTick_Config() function which
     is a CMSIS function that:
      (++) Configures the SysTick Reload register with value passed as function parameter.
      (++) Configures the SysTick IRQ priority to the lowest value (0x0F).
      (++) Resets the SysTick Counter register.
      (++) Configures the SysTick Counter clock source to be Core Clock Source (HCLK).
      (++) Enables the SysTick Interrupt.
      (++) Starts the SysTick Counter.

 (+) You can change the SysTick Clock source to be HCLK_Div8 by calling the macro
     __HAL_CORTEX_SYSTICKCLK_CONFIG(SYSTICK_CLKSOURCE_HCLK_DIV8) just after the
     HAL_SYSTICK_Config() function call. The __HAL_CORTEX_SYSTICKCLK_CONFIG() macro is defined
     inside the stm32l4xx_hal_cortex.h file.

 (+) You can change the SysTick IRQ priority by calling the
     HAL_NVIC_SetPriority(SysTick_IRQn,...) function just after the HAL_SYSTICK_Config() function
     call. The HAL_NVIC_SetPriority() call the NVIC_SetPriority() function which is a CMSIS function.

 (+) To adjust the SysTick time base, use the following formula:

     Reload Value = SysTick Counter Clock (Hz) x  Desired Time base (s)
     (++) Reload Value is the parameter to be passed for HAL_SYSTICK_Config() function
     (++) Reload Value should not exceed 0xFFFFFF

The table below gives the allowed values of the pre-emption priority and subpriority according to the Priority Grouping configuration performed by HAL_NVIC_SetPriorityGrouping() function.


NVIC_PriorityGroup | NVIC_IRQChannelPreemptionPriority | NVIC_IRQChannelSubPriority | Description

NVIC_PRIORITYGROUP_0 | 0 | 0-15 | 0 bit for pre-emption priority

| | | 4 bits for subpriority

NVIC_PRIORITYGROUP_1 | 0-1 | 0-7 | 1 bit for pre-emption priority

| | | 3 bits for subpriority

NVIC_PRIORITYGROUP_2 | 0-3 | 0-3 | 2 bits for pre-emption priority

| | | 2 bits for subpriority

NVIC_PRIORITYGROUP_3 | 0-7 | 0-1 | 3 bits for pre-emption priority

| | | 1 bit for subpriority

NVIC_PRIORITYGROUP_4 | 0-15 | 0 | 4 bits for pre-emption priority

| | | 0 bit for subpriority

Attention

© Copyright (c) 2017 STMicroelectronics. All rights reserved.

This software component is licensed by ST under BSD 3-Clause license, the "License"; You may not use this file except in compliance with the License. You may obtain a copy of the License at: opensource.org/licenses/BSD-3-Clause

Definition in file stm32l4xx_hal_cortex.c.