STM32L4xx_HAL_Driver  1.14.0
stm32l4xx_hal_cortex.h
Go to the documentation of this file.
1 
20 /* Define to prevent recursive inclusion -------------------------------------*/
21 #ifndef __STM32L4xx_HAL_CORTEX_H
22 #define __STM32L4xx_HAL_CORTEX_H
23 
24 #ifdef __cplusplus
25  extern "C" {
26 #endif
27 
28 /* Includes ------------------------------------------------------------------*/
29 #include "stm32l4xx_hal_def.h"
30 
39 /* Exported types ------------------------------------------------------------*/
44 #if (__MPU_PRESENT == 1)
45 
48 typedef struct
49 {
50  uint8_t Enable;
52  uint8_t Number;
54  uint32_t BaseAddress;
55  uint8_t Size;
57  uint8_t SubRegionDisable;
59  uint8_t TypeExtField;
61  uint8_t AccessPermission;
63  uint8_t DisableExec;
65  uint8_t IsShareable;
67  uint8_t IsCacheable;
69  uint8_t IsBufferable;
71 }MPU_Region_InitTypeDef;
75 #endif /* __MPU_PRESENT */
76 
81 /* Exported constants --------------------------------------------------------*/
82 
90 #define NVIC_PRIORITYGROUP_0 ((uint32_t)0x00000007)
92 #define NVIC_PRIORITYGROUP_1 ((uint32_t)0x00000006)
94 #define NVIC_PRIORITYGROUP_2 ((uint32_t)0x00000005)
96 #define NVIC_PRIORITYGROUP_3 ((uint32_t)0x00000004)
98 #define NVIC_PRIORITYGROUP_4 ((uint32_t)0x00000003)
107 #define SYSTICK_CLKSOURCE_HCLK_DIV8 ((uint32_t)0x00000000)
108 #define SYSTICK_CLKSOURCE_HCLK ((uint32_t)0x00000004)
109 
113 #if (__MPU_PRESENT == 1)
114 
117 #define MPU_HFNMI_PRIVDEF_NONE ((uint32_t)0x00000000)
118 #define MPU_HARDFAULT_NMI ((uint32_t)0x00000002)
119 #define MPU_PRIVILEGED_DEFAULT ((uint32_t)0x00000004)
120 #define MPU_HFNMI_PRIVDEF ((uint32_t)0x00000006)
121 
128 #define MPU_REGION_ENABLE ((uint8_t)0x01)
129 #define MPU_REGION_DISABLE ((uint8_t)0x00)
130 
137 #define MPU_INSTRUCTION_ACCESS_ENABLE ((uint8_t)0x00)
138 #define MPU_INSTRUCTION_ACCESS_DISABLE ((uint8_t)0x01)
139 
146 #define MPU_ACCESS_SHAREABLE ((uint8_t)0x01)
147 #define MPU_ACCESS_NOT_SHAREABLE ((uint8_t)0x00)
148 
155 #define MPU_ACCESS_CACHEABLE ((uint8_t)0x01)
156 #define MPU_ACCESS_NOT_CACHEABLE ((uint8_t)0x00)
157 
164 #define MPU_ACCESS_BUFFERABLE ((uint8_t)0x01)
165 #define MPU_ACCESS_NOT_BUFFERABLE ((uint8_t)0x00)
166 
173 #define MPU_TEX_LEVEL0 ((uint8_t)0x00)
174 #define MPU_TEX_LEVEL1 ((uint8_t)0x01)
175 #define MPU_TEX_LEVEL2 ((uint8_t)0x02)
176 
183 #define MPU_REGION_SIZE_32B ((uint8_t)0x04)
184 #define MPU_REGION_SIZE_64B ((uint8_t)0x05)
185 #define MPU_REGION_SIZE_128B ((uint8_t)0x06)
186 #define MPU_REGION_SIZE_256B ((uint8_t)0x07)
187 #define MPU_REGION_SIZE_512B ((uint8_t)0x08)
188 #define MPU_REGION_SIZE_1KB ((uint8_t)0x09)
189 #define MPU_REGION_SIZE_2KB ((uint8_t)0x0A)
190 #define MPU_REGION_SIZE_4KB ((uint8_t)0x0B)
191 #define MPU_REGION_SIZE_8KB ((uint8_t)0x0C)
192 #define MPU_REGION_SIZE_16KB ((uint8_t)0x0D)
193 #define MPU_REGION_SIZE_32KB ((uint8_t)0x0E)
194 #define MPU_REGION_SIZE_64KB ((uint8_t)0x0F)
195 #define MPU_REGION_SIZE_128KB ((uint8_t)0x10)
196 #define MPU_REGION_SIZE_256KB ((uint8_t)0x11)
197 #define MPU_REGION_SIZE_512KB ((uint8_t)0x12)
198 #define MPU_REGION_SIZE_1MB ((uint8_t)0x13)
199 #define MPU_REGION_SIZE_2MB ((uint8_t)0x14)
200 #define MPU_REGION_SIZE_4MB ((uint8_t)0x15)
201 #define MPU_REGION_SIZE_8MB ((uint8_t)0x16)
202 #define MPU_REGION_SIZE_16MB ((uint8_t)0x17)
203 #define MPU_REGION_SIZE_32MB ((uint8_t)0x18)
204 #define MPU_REGION_SIZE_64MB ((uint8_t)0x19)
205 #define MPU_REGION_SIZE_128MB ((uint8_t)0x1A)
206 #define MPU_REGION_SIZE_256MB ((uint8_t)0x1B)
207 #define MPU_REGION_SIZE_512MB ((uint8_t)0x1C)
208 #define MPU_REGION_SIZE_1GB ((uint8_t)0x1D)
209 #define MPU_REGION_SIZE_2GB ((uint8_t)0x1E)
210 #define MPU_REGION_SIZE_4GB ((uint8_t)0x1F)
211 
218 #define MPU_REGION_NO_ACCESS ((uint8_t)0x00)
219 #define MPU_REGION_PRIV_RW ((uint8_t)0x01)
220 #define MPU_REGION_PRIV_RW_URO ((uint8_t)0x02)
221 #define MPU_REGION_FULL_ACCESS ((uint8_t)0x03)
222 #define MPU_REGION_PRIV_RO ((uint8_t)0x05)
223 #define MPU_REGION_PRIV_RO_URO ((uint8_t)0x06)
224 
231 #define MPU_REGION_NUMBER0 ((uint8_t)0x00)
232 #define MPU_REGION_NUMBER1 ((uint8_t)0x01)
233 #define MPU_REGION_NUMBER2 ((uint8_t)0x02)
234 #define MPU_REGION_NUMBER3 ((uint8_t)0x03)
235 #define MPU_REGION_NUMBER4 ((uint8_t)0x04)
236 #define MPU_REGION_NUMBER5 ((uint8_t)0x05)
237 #define MPU_REGION_NUMBER6 ((uint8_t)0x06)
238 #define MPU_REGION_NUMBER7 ((uint8_t)0x07)
239 
242 #endif /* __MPU_PRESENT */
243 
248 /* Exported macros -----------------------------------------------------------*/
257 /* Exported functions --------------------------------------------------------*/
266 /* Initialization and Configuration functions *****************************/
267 void HAL_NVIC_SetPriorityGrouping(uint32_t PriorityGroup);
268 void HAL_NVIC_SetPriority(IRQn_Type IRQn, uint32_t PreemptPriority, uint32_t SubPriority);
269 void HAL_NVIC_EnableIRQ(IRQn_Type IRQn);
270 void HAL_NVIC_DisableIRQ(IRQn_Type IRQn);
271 void HAL_NVIC_SystemReset(void);
272 uint32_t HAL_SYSTICK_Config(uint32_t TicksNumb);
273 
282 /* Peripheral Control functions ***********************************************/
283 uint32_t HAL_NVIC_GetPriorityGrouping(void);
284 void HAL_NVIC_GetPriority(IRQn_Type IRQn, uint32_t PriorityGroup, uint32_t* pPreemptPriority, uint32_t* pSubPriority);
285 uint32_t HAL_NVIC_GetPendingIRQ(IRQn_Type IRQn);
286 void HAL_NVIC_SetPendingIRQ(IRQn_Type IRQn);
287 void HAL_NVIC_ClearPendingIRQ(IRQn_Type IRQn);
288 uint32_t HAL_NVIC_GetActive(IRQn_Type IRQn);
289 void HAL_SYSTICK_CLKSourceConfig(uint32_t CLKSource);
290 void HAL_SYSTICK_IRQHandler(void);
291 void HAL_SYSTICK_Callback(void);
292 
293 #if (__MPU_PRESENT == 1)
294 void HAL_MPU_Enable(uint32_t MPU_Control);
295 void HAL_MPU_Disable(void);
296 void HAL_MPU_ConfigRegion(MPU_Region_InitTypeDef *MPU_Init);
297 #endif /* __MPU_PRESENT */
298 
306 /* Private types -------------------------------------------------------------*/
307 /* Private variables ---------------------------------------------------------*/
308 /* Private constants ---------------------------------------------------------*/
309 /* Private macros ------------------------------------------------------------*/
313 #define IS_NVIC_PRIORITY_GROUP(GROUP) (((GROUP) == NVIC_PRIORITYGROUP_0) || \
314  ((GROUP) == NVIC_PRIORITYGROUP_1) || \
315  ((GROUP) == NVIC_PRIORITYGROUP_2) || \
316  ((GROUP) == NVIC_PRIORITYGROUP_3) || \
317  ((GROUP) == NVIC_PRIORITYGROUP_4))
318 
319 #define IS_NVIC_PREEMPTION_PRIORITY(PRIORITY) ((PRIORITY) < 0x10)
320 
321 #define IS_NVIC_SUB_PRIORITY(PRIORITY) ((PRIORITY) < 0x10)
322 
323 #define IS_NVIC_DEVICE_IRQ(IRQ) ((IRQ) >= 0x00)
324 
325 #define IS_SYSTICK_CLK_SOURCE(SOURCE) (((SOURCE) == SYSTICK_CLKSOURCE_HCLK) || \
326  ((SOURCE) == SYSTICK_CLKSOURCE_HCLK_DIV8))
327 
328 #if (__MPU_PRESENT == 1)
329 #define IS_MPU_REGION_ENABLE(STATE) (((STATE) == MPU_REGION_ENABLE) || \
330  ((STATE) == MPU_REGION_DISABLE))
331 
332 #define IS_MPU_INSTRUCTION_ACCESS(STATE) (((STATE) == MPU_INSTRUCTION_ACCESS_ENABLE) || \
333  ((STATE) == MPU_INSTRUCTION_ACCESS_DISABLE))
334 
335 #define IS_MPU_ACCESS_SHAREABLE(STATE) (((STATE) == MPU_ACCESS_SHAREABLE) || \
336  ((STATE) == MPU_ACCESS_NOT_SHAREABLE))
337 
338 #define IS_MPU_ACCESS_CACHEABLE(STATE) (((STATE) == MPU_ACCESS_CACHEABLE) || \
339  ((STATE) == MPU_ACCESS_NOT_CACHEABLE))
340 
341 #define IS_MPU_ACCESS_BUFFERABLE(STATE) (((STATE) == MPU_ACCESS_BUFFERABLE) || \
342  ((STATE) == MPU_ACCESS_NOT_BUFFERABLE))
343 
344 #define IS_MPU_TEX_LEVEL(TYPE) (((TYPE) == MPU_TEX_LEVEL0) || \
345  ((TYPE) == MPU_TEX_LEVEL1) || \
346  ((TYPE) == MPU_TEX_LEVEL2))
347 
348 #define IS_MPU_REGION_PERMISSION_ATTRIBUTE(TYPE) (((TYPE) == MPU_REGION_NO_ACCESS) || \
349  ((TYPE) == MPU_REGION_PRIV_RW) || \
350  ((TYPE) == MPU_REGION_PRIV_RW_URO) || \
351  ((TYPE) == MPU_REGION_FULL_ACCESS) || \
352  ((TYPE) == MPU_REGION_PRIV_RO) || \
353  ((TYPE) == MPU_REGION_PRIV_RO_URO))
354 
355 #define IS_MPU_REGION_NUMBER(NUMBER) (((NUMBER) == MPU_REGION_NUMBER0) || \
356  ((NUMBER) == MPU_REGION_NUMBER1) || \
357  ((NUMBER) == MPU_REGION_NUMBER2) || \
358  ((NUMBER) == MPU_REGION_NUMBER3) || \
359  ((NUMBER) == MPU_REGION_NUMBER4) || \
360  ((NUMBER) == MPU_REGION_NUMBER5) || \
361  ((NUMBER) == MPU_REGION_NUMBER6) || \
362  ((NUMBER) == MPU_REGION_NUMBER7))
363 
364 #define IS_MPU_REGION_SIZE(SIZE) (((SIZE) == MPU_REGION_SIZE_32B) || \
365  ((SIZE) == MPU_REGION_SIZE_64B) || \
366  ((SIZE) == MPU_REGION_SIZE_128B) || \
367  ((SIZE) == MPU_REGION_SIZE_256B) || \
368  ((SIZE) == MPU_REGION_SIZE_512B) || \
369  ((SIZE) == MPU_REGION_SIZE_1KB) || \
370  ((SIZE) == MPU_REGION_SIZE_2KB) || \
371  ((SIZE) == MPU_REGION_SIZE_4KB) || \
372  ((SIZE) == MPU_REGION_SIZE_8KB) || \
373  ((SIZE) == MPU_REGION_SIZE_16KB) || \
374  ((SIZE) == MPU_REGION_SIZE_32KB) || \
375  ((SIZE) == MPU_REGION_SIZE_64KB) || \
376  ((SIZE) == MPU_REGION_SIZE_128KB) || \
377  ((SIZE) == MPU_REGION_SIZE_256KB) || \
378  ((SIZE) == MPU_REGION_SIZE_512KB) || \
379  ((SIZE) == MPU_REGION_SIZE_1MB) || \
380  ((SIZE) == MPU_REGION_SIZE_2MB) || \
381  ((SIZE) == MPU_REGION_SIZE_4MB) || \
382  ((SIZE) == MPU_REGION_SIZE_8MB) || \
383  ((SIZE) == MPU_REGION_SIZE_16MB) || \
384  ((SIZE) == MPU_REGION_SIZE_32MB) || \
385  ((SIZE) == MPU_REGION_SIZE_64MB) || \
386  ((SIZE) == MPU_REGION_SIZE_128MB) || \
387  ((SIZE) == MPU_REGION_SIZE_256MB) || \
388  ((SIZE) == MPU_REGION_SIZE_512MB) || \
389  ((SIZE) == MPU_REGION_SIZE_1GB) || \
390  ((SIZE) == MPU_REGION_SIZE_2GB) || \
391  ((SIZE) == MPU_REGION_SIZE_4GB))
392 
393 #define IS_MPU_SUB_REGION_DISABLE(SUBREGION) ((SUBREGION) < (uint16_t)0x00FF)
394 #endif /* __MPU_PRESENT */
395 
400 /* Private functions ---------------------------------------------------------*/
401 
410 #ifdef __cplusplus
411 }
412 #endif
413 
414 #endif /* __STM32L4xx_HAL_CORTEX_H */
415 
416 
417 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
void HAL_SYSTICK_IRQHandler(void)
Handle SYSTICK interrupt request.
void HAL_MPU_Disable(void)
Disable the MPU.
void HAL_MPU_ConfigRegion(MPU_Region_InitTypeDef *MPU_Init)
Initialize and configure the Region and the memory to be protected.
uint32_t HAL_SYSTICK_Config(uint32_t TicksNumb)
Initialize the System Timer with interrupt enabled and start the System Tick Timer (SysTick): Counter...
This file contains HAL common defines, enumeration, macros and structures definitions.
void HAL_NVIC_SystemReset(void)
Initiate a system reset request to reset the MCU.
void HAL_NVIC_SetPendingIRQ(IRQn_Type IRQn)
Set Pending bit of an external interrupt.
void HAL_SYSTICK_Callback(void)
SYSTICK callback.
void HAL_MPU_Enable(uint32_t MPU_Control)
Enable the MPU.
void HAL_NVIC_EnableIRQ(IRQn_Type IRQn)
Enable a device specific interrupt in the NVIC interrupt controller.
void HAL_NVIC_GetPriority(IRQn_Type IRQn, uint32_t PriorityGroup, uint32_t *pPreemptPriority, uint32_t *pSubPriority)
Get the priority of an interrupt.
void HAL_SYSTICK_CLKSourceConfig(uint32_t CLKSource)
Configure the SysTick clock source.
uint32_t HAL_NVIC_GetActive(IRQn_Type IRQn)
Get active interrupt (read the active register in NVIC and return the active bit).
void HAL_NVIC_SetPriority(IRQn_Type IRQn, uint32_t PreemptPriority, uint32_t SubPriority)
Set the priority of an interrupt.
void HAL_NVIC_DisableIRQ(IRQn_Type IRQn)
Disable a device specific interrupt in the NVIC interrupt controller.
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 speci...
uint32_t HAL_NVIC_GetPriorityGrouping(void)
Get the priority grouping field from the NVIC Interrupt Controller.
void HAL_NVIC_SetPriorityGrouping(uint32_t PriorityGroup)
Set the priority grouping field (pre-emption priority and subpriority) using the required unlock sequ...
void HAL_NVIC_ClearPendingIRQ(IRQn_Type IRQn)
Clear the pending bit of an external interrupt.