2 ******************************************************************************
\r
3 * @file stm32f7xx_hal_cortex.h
\r
4 * @author MCD Application Team
\r
5 * @brief Header file of CORTEX HAL module.
\r
6 ******************************************************************************
\r
9 * <h2><center>© Copyright (c) 2017 STMicroelectronics.
\r
10 * All rights reserved.</center></h2>
\r
12 * This software component is licensed by ST under BSD 3-Clause license,
\r
13 * the "License"; You may not use this file except in compliance with the
\r
14 * License. You may obtain a copy of the License at:
\r
15 * opensource.org/licenses/BSD-3-Clause
\r
17 ******************************************************************************
\r
20 /* Define to prevent recursive inclusion -------------------------------------*/
\r
21 #ifndef __STM32F7xx_HAL_CORTEX_H
\r
22 #define __STM32F7xx_HAL_CORTEX_H
\r
28 /* Includes ------------------------------------------------------------------*/
\r
29 #include "stm32f7xx_hal_def.h"
\r
31 /** @addtogroup STM32F7xx_HAL_Driver
\r
35 /** @addtogroup CORTEX
\r
38 /* Exported types ------------------------------------------------------------*/
\r
39 /** @defgroup CORTEX_Exported_Types Cortex Exported Types
\r
43 #if (__MPU_PRESENT == 1)
\r
44 /** @defgroup CORTEX_MPU_Region_Initialization_Structure_definition MPU Region Initialization Structure Definition
\r
45 * @brief MPU Region initialization structure
\r
50 uint8_t Enable; /*!< Specifies the status of the region.
\r
51 This parameter can be a value of @ref CORTEX_MPU_Region_Enable */
\r
52 uint8_t Number; /*!< Specifies the number of the region to protect.
\r
53 This parameter can be a value of @ref CORTEX_MPU_Region_Number */
\r
54 uint32_t BaseAddress; /*!< Specifies the base address of the region to protect. */
\r
55 uint8_t Size; /*!< Specifies the size of the region to protect.
\r
56 This parameter can be a value of @ref CORTEX_MPU_Region_Size */
\r
57 uint8_t SubRegionDisable; /*!< Specifies the number of the subregion protection to disable.
\r
58 This parameter must be a number between Min_Data = 0x00 and Max_Data = 0xFF */
\r
59 uint8_t TypeExtField; /*!< Specifies the TEX field level.
\r
60 This parameter can be a value of @ref CORTEX_MPU_TEX_Levels */
\r
61 uint8_t AccessPermission; /*!< Specifies the region access permission type.
\r
62 This parameter can be a value of @ref CORTEX_MPU_Region_Permission_Attributes */
\r
63 uint8_t DisableExec; /*!< Specifies the instruction access status.
\r
64 This parameter can be a value of @ref CORTEX_MPU_Instruction_Access */
\r
65 uint8_t IsShareable; /*!< Specifies the shareability status of the protected region.
\r
66 This parameter can be a value of @ref CORTEX_MPU_Access_Shareable */
\r
67 uint8_t IsCacheable; /*!< Specifies the cacheable status of the region protected.
\r
68 This parameter can be a value of @ref CORTEX_MPU_Access_Cacheable */
\r
69 uint8_t IsBufferable; /*!< Specifies the bufferable status of the protected region.
\r
70 This parameter can be a value of @ref CORTEX_MPU_Access_Bufferable */
\r
71 }MPU_Region_InitTypeDef;
\r
75 #endif /* __MPU_PRESENT */
\r
81 /* Exported constants --------------------------------------------------------*/
\r
83 /** @defgroup CORTEX_Exported_Constants CORTEX Exported Constants
\r
87 /** @defgroup CORTEX_Preemption_Priority_Group CORTEX Preemption Priority Group
\r
90 #define NVIC_PRIORITYGROUP_0 ((uint32_t)0x00000007U) /*!< 0 bits for pre-emption priority
\r
91 4 bits for subpriority */
\r
92 #define NVIC_PRIORITYGROUP_1 ((uint32_t)0x00000006U) /*!< 1 bits for pre-emption priority
\r
93 3 bits for subpriority */
\r
94 #define NVIC_PRIORITYGROUP_2 ((uint32_t)0x00000005U) /*!< 2 bits for pre-emption priority
\r
95 2 bits for subpriority */
\r
96 #define NVIC_PRIORITYGROUP_3 ((uint32_t)0x00000004U) /*!< 3 bits for pre-emption priority
\r
97 1 bits for subpriority */
\r
98 #define NVIC_PRIORITYGROUP_4 ((uint32_t)0x00000003U) /*!< 4 bits for pre-emption priority
\r
99 0 bits for subpriority */
\r
104 /** @defgroup CORTEX_SysTick_clock_source CORTEX _SysTick clock source
\r
107 #define SYSTICK_CLKSOURCE_HCLK_DIV8 ((uint32_t)0x00000000U)
\r
108 #define SYSTICK_CLKSOURCE_HCLK ((uint32_t)0x00000004U)
\r
114 #if (__MPU_PRESENT == 1)
\r
115 /** @defgroup CORTEX_MPU_HFNMI_PRIVDEF_Control MPU HFNMI and PRIVILEGED Access control
\r
118 #define MPU_HFNMI_PRIVDEF_NONE ((uint32_t)0x00000000U)
\r
119 #define MPU_HARDFAULT_NMI ((uint32_t)0x00000002U)
\r
120 #define MPU_PRIVILEGED_DEFAULT ((uint32_t)0x00000004U)
\r
121 #define MPU_HFNMI_PRIVDEF ((uint32_t)0x00000006U)
\r
126 /** @defgroup CORTEX_MPU_Region_Enable CORTEX MPU Region Enable
\r
129 #define MPU_REGION_ENABLE ((uint8_t)0x01U)
\r
130 #define MPU_REGION_DISABLE ((uint8_t)0x00U)
\r
135 /** @defgroup CORTEX_MPU_Instruction_Access CORTEX MPU Instruction Access
\r
138 #define MPU_INSTRUCTION_ACCESS_ENABLE ((uint8_t)0x00U)
\r
139 #define MPU_INSTRUCTION_ACCESS_DISABLE ((uint8_t)0x01U)
\r
144 /** @defgroup CORTEX_MPU_Access_Shareable CORTEX MPU Instruction Access Shareable
\r
147 #define MPU_ACCESS_SHAREABLE ((uint8_t)0x01U)
\r
148 #define MPU_ACCESS_NOT_SHAREABLE ((uint8_t)0x00U)
\r
153 /** @defgroup CORTEX_MPU_Access_Cacheable CORTEX MPU Instruction Access Cacheable
\r
156 #define MPU_ACCESS_CACHEABLE ((uint8_t)0x01U)
\r
157 #define MPU_ACCESS_NOT_CACHEABLE ((uint8_t)0x00U)
\r
162 /** @defgroup CORTEX_MPU_Access_Bufferable CORTEX MPU Instruction Access Bufferable
\r
165 #define MPU_ACCESS_BUFFERABLE ((uint8_t)0x01U)
\r
166 #define MPU_ACCESS_NOT_BUFFERABLE ((uint8_t)0x00U)
\r
171 /** @defgroup CORTEX_MPU_TEX_Levels MPU TEX Levels
\r
174 #define MPU_TEX_LEVEL0 ((uint8_t)0x00U)
\r
175 #define MPU_TEX_LEVEL1 ((uint8_t)0x01U)
\r
176 #define MPU_TEX_LEVEL2 ((uint8_t)0x02U)
\r
181 /** @defgroup CORTEX_MPU_Region_Size CORTEX MPU Region Size
\r
184 #define MPU_REGION_SIZE_32B ((uint8_t)0x04U)
\r
185 #define MPU_REGION_SIZE_64B ((uint8_t)0x05U)
\r
186 #define MPU_REGION_SIZE_128B ((uint8_t)0x06U)
\r
187 #define MPU_REGION_SIZE_256B ((uint8_t)0x07U)
\r
188 #define MPU_REGION_SIZE_512B ((uint8_t)0x08U)
\r
189 #define MPU_REGION_SIZE_1KB ((uint8_t)0x09U)
\r
190 #define MPU_REGION_SIZE_2KB ((uint8_t)0x0AU)
\r
191 #define MPU_REGION_SIZE_4KB ((uint8_t)0x0BU)
\r
192 #define MPU_REGION_SIZE_8KB ((uint8_t)0x0CU)
\r
193 #define MPU_REGION_SIZE_16KB ((uint8_t)0x0DU)
\r
194 #define MPU_REGION_SIZE_32KB ((uint8_t)0x0EU)
\r
195 #define MPU_REGION_SIZE_64KB ((uint8_t)0x0FU)
\r
196 #define MPU_REGION_SIZE_128KB ((uint8_t)0x10U)
\r
197 #define MPU_REGION_SIZE_256KB ((uint8_t)0x11U)
\r
198 #define MPU_REGION_SIZE_512KB ((uint8_t)0x12U)
\r
199 #define MPU_REGION_SIZE_1MB ((uint8_t)0x13U)
\r
200 #define MPU_REGION_SIZE_2MB ((uint8_t)0x14U)
\r
201 #define MPU_REGION_SIZE_4MB ((uint8_t)0x15U)
\r
202 #define MPU_REGION_SIZE_8MB ((uint8_t)0x16U)
\r
203 #define MPU_REGION_SIZE_16MB ((uint8_t)0x17U)
\r
204 #define MPU_REGION_SIZE_32MB ((uint8_t)0x18U)
\r
205 #define MPU_REGION_SIZE_64MB ((uint8_t)0x19U)
\r
206 #define MPU_REGION_SIZE_128MB ((uint8_t)0x1AU)
\r
207 #define MPU_REGION_SIZE_256MB ((uint8_t)0x1BU)
\r
208 #define MPU_REGION_SIZE_512MB ((uint8_t)0x1CU)
\r
209 #define MPU_REGION_SIZE_1GB ((uint8_t)0x1DU)
\r
210 #define MPU_REGION_SIZE_2GB ((uint8_t)0x1EU)
\r
211 #define MPU_REGION_SIZE_4GB ((uint8_t)0x1FU)
\r
216 /** @defgroup CORTEX_MPU_Region_Permission_Attributes CORTEX MPU Region Permission Attributes
\r
219 #define MPU_REGION_NO_ACCESS ((uint8_t)0x00U)
\r
220 #define MPU_REGION_PRIV_RW ((uint8_t)0x01U)
\r
221 #define MPU_REGION_PRIV_RW_URO ((uint8_t)0x02U)
\r
222 #define MPU_REGION_FULL_ACCESS ((uint8_t)0x03U)
\r
223 #define MPU_REGION_PRIV_RO ((uint8_t)0x05U)
\r
224 #define MPU_REGION_PRIV_RO_URO ((uint8_t)0x06U)
\r
229 /** @defgroup CORTEX_MPU_Region_Number CORTEX MPU Region Number
\r
232 #define MPU_REGION_NUMBER0 ((uint8_t)0x00U)
\r
233 #define MPU_REGION_NUMBER1 ((uint8_t)0x01U)
\r
234 #define MPU_REGION_NUMBER2 ((uint8_t)0x02U)
\r
235 #define MPU_REGION_NUMBER3 ((uint8_t)0x03U)
\r
236 #define MPU_REGION_NUMBER4 ((uint8_t)0x04U)
\r
237 #define MPU_REGION_NUMBER5 ((uint8_t)0x05U)
\r
238 #define MPU_REGION_NUMBER6 ((uint8_t)0x06U)
\r
239 #define MPU_REGION_NUMBER7 ((uint8_t)0x07U)
\r
243 #endif /* __MPU_PRESENT */
\r
250 /* Exported Macros -----------------------------------------------------------*/
\r
252 /* Exported functions --------------------------------------------------------*/
\r
253 /** @addtogroup CORTEX_Exported_Functions
\r
257 /** @addtogroup CORTEX_Exported_Functions_Group1
\r
260 /* Initialization and de-initialization functions *****************************/
\r
261 void HAL_NVIC_SetPriorityGrouping(uint32_t PriorityGroup);
\r
262 void HAL_NVIC_SetPriority(IRQn_Type IRQn, uint32_t PreemptPriority, uint32_t SubPriority);
\r
263 void HAL_NVIC_EnableIRQ(IRQn_Type IRQn);
\r
264 void HAL_NVIC_DisableIRQ(IRQn_Type IRQn);
\r
265 void HAL_NVIC_SystemReset(void);
\r
266 uint32_t HAL_SYSTICK_Config(uint32_t TicksNumb);
\r
271 /** @addtogroup CORTEX_Exported_Functions_Group2
\r
274 /* Peripheral Control functions ***********************************************/
\r
275 #if (__MPU_PRESENT == 1)
\r
276 void HAL_MPU_Enable(uint32_t MPU_Control);
\r
277 void HAL_MPU_Disable(void);
\r
278 void HAL_MPU_ConfigRegion(MPU_Region_InitTypeDef *MPU_Init);
\r
279 #endif /* __MPU_PRESENT */
\r
280 uint32_t HAL_NVIC_GetPriorityGrouping(void);
\r
281 void HAL_NVIC_GetPriority(IRQn_Type IRQn, uint32_t PriorityGroup, uint32_t* pPreemptPriority, uint32_t* pSubPriority);
\r
282 uint32_t HAL_NVIC_GetPendingIRQ(IRQn_Type IRQn);
\r
283 void HAL_NVIC_SetPendingIRQ(IRQn_Type IRQn);
\r
284 void HAL_NVIC_ClearPendingIRQ(IRQn_Type IRQn);
\r
285 uint32_t HAL_NVIC_GetActive(IRQn_Type IRQn);
\r
286 void HAL_SYSTICK_CLKSourceConfig(uint32_t CLKSource);
\r
287 void HAL_SYSTICK_IRQHandler(void);
\r
288 void HAL_SYSTICK_Callback(void);
\r
297 /* Private types -------------------------------------------------------------*/
\r
298 /* Private variables ---------------------------------------------------------*/
\r
299 /* Private constants ---------------------------------------------------------*/
\r
300 /* Private macros ------------------------------------------------------------*/
\r
301 /** @defgroup CORTEX_Private_Macros CORTEX Private Macros
\r
304 #define IS_NVIC_PRIORITY_GROUP(GROUP) (((GROUP) == NVIC_PRIORITYGROUP_0) || \
\r
305 ((GROUP) == NVIC_PRIORITYGROUP_1) || \
\r
306 ((GROUP) == NVIC_PRIORITYGROUP_2) || \
\r
307 ((GROUP) == NVIC_PRIORITYGROUP_3) || \
\r
308 ((GROUP) == NVIC_PRIORITYGROUP_4))
\r
310 #define IS_NVIC_PREEMPTION_PRIORITY(PRIORITY) ((PRIORITY) < 0x10U)
\r
312 #define IS_NVIC_SUB_PRIORITY(PRIORITY) ((PRIORITY) < 0x10U)
\r
314 #define IS_NVIC_DEVICE_IRQ(IRQ) ((IRQ) >= 0x00)
\r
316 #define IS_SYSTICK_CLK_SOURCE(SOURCE) (((SOURCE) == SYSTICK_CLKSOURCE_HCLK) || \
\r
317 ((SOURCE) == SYSTICK_CLKSOURCE_HCLK_DIV8))
\r
319 #if (__MPU_PRESENT == 1)
\r
320 #define IS_MPU_REGION_ENABLE(STATE) (((STATE) == MPU_REGION_ENABLE) || \
\r
321 ((STATE) == MPU_REGION_DISABLE))
\r
323 #define IS_MPU_INSTRUCTION_ACCESS(STATE) (((STATE) == MPU_INSTRUCTION_ACCESS_ENABLE) || \
\r
324 ((STATE) == MPU_INSTRUCTION_ACCESS_DISABLE))
\r
326 #define IS_MPU_ACCESS_SHAREABLE(STATE) (((STATE) == MPU_ACCESS_SHAREABLE) || \
\r
327 ((STATE) == MPU_ACCESS_NOT_SHAREABLE))
\r
329 #define IS_MPU_ACCESS_CACHEABLE(STATE) (((STATE) == MPU_ACCESS_CACHEABLE) || \
\r
330 ((STATE) == MPU_ACCESS_NOT_CACHEABLE))
\r
332 #define IS_MPU_ACCESS_BUFFERABLE(STATE) (((STATE) == MPU_ACCESS_BUFFERABLE) || \
\r
333 ((STATE) == MPU_ACCESS_NOT_BUFFERABLE))
\r
335 #define IS_MPU_TEX_LEVEL(TYPE) (((TYPE) == MPU_TEX_LEVEL0) || \
\r
336 ((TYPE) == MPU_TEX_LEVEL1) || \
\r
337 ((TYPE) == MPU_TEX_LEVEL2))
\r
339 #define IS_MPU_REGION_PERMISSION_ATTRIBUTE(TYPE) (((TYPE) == MPU_REGION_NO_ACCESS) || \
\r
340 ((TYPE) == MPU_REGION_PRIV_RW) || \
\r
341 ((TYPE) == MPU_REGION_PRIV_RW_URO) || \
\r
342 ((TYPE) == MPU_REGION_FULL_ACCESS) || \
\r
343 ((TYPE) == MPU_REGION_PRIV_RO) || \
\r
344 ((TYPE) == MPU_REGION_PRIV_RO_URO))
\r
346 #define IS_MPU_REGION_NUMBER(NUMBER) (((NUMBER) == MPU_REGION_NUMBER0) || \
\r
347 ((NUMBER) == MPU_REGION_NUMBER1) || \
\r
348 ((NUMBER) == MPU_REGION_NUMBER2) || \
\r
349 ((NUMBER) == MPU_REGION_NUMBER3) || \
\r
350 ((NUMBER) == MPU_REGION_NUMBER4) || \
\r
351 ((NUMBER) == MPU_REGION_NUMBER5) || \
\r
352 ((NUMBER) == MPU_REGION_NUMBER6) || \
\r
353 ((NUMBER) == MPU_REGION_NUMBER7))
\r
355 #define IS_MPU_REGION_SIZE(SIZE) (((SIZE) == MPU_REGION_SIZE_32B) || \
\r
356 ((SIZE) == MPU_REGION_SIZE_64B) || \
\r
357 ((SIZE) == MPU_REGION_SIZE_128B) || \
\r
358 ((SIZE) == MPU_REGION_SIZE_256B) || \
\r
359 ((SIZE) == MPU_REGION_SIZE_512B) || \
\r
360 ((SIZE) == MPU_REGION_SIZE_1KB) || \
\r
361 ((SIZE) == MPU_REGION_SIZE_2KB) || \
\r
362 ((SIZE) == MPU_REGION_SIZE_4KB) || \
\r
363 ((SIZE) == MPU_REGION_SIZE_8KB) || \
\r
364 ((SIZE) == MPU_REGION_SIZE_16KB) || \
\r
365 ((SIZE) == MPU_REGION_SIZE_32KB) || \
\r
366 ((SIZE) == MPU_REGION_SIZE_64KB) || \
\r
367 ((SIZE) == MPU_REGION_SIZE_128KB) || \
\r
368 ((SIZE) == MPU_REGION_SIZE_256KB) || \
\r
369 ((SIZE) == MPU_REGION_SIZE_512KB) || \
\r
370 ((SIZE) == MPU_REGION_SIZE_1MB) || \
\r
371 ((SIZE) == MPU_REGION_SIZE_2MB) || \
\r
372 ((SIZE) == MPU_REGION_SIZE_4MB) || \
\r
373 ((SIZE) == MPU_REGION_SIZE_8MB) || \
\r
374 ((SIZE) == MPU_REGION_SIZE_16MB) || \
\r
375 ((SIZE) == MPU_REGION_SIZE_32MB) || \
\r
376 ((SIZE) == MPU_REGION_SIZE_64MB) || \
\r
377 ((SIZE) == MPU_REGION_SIZE_128MB) || \
\r
378 ((SIZE) == MPU_REGION_SIZE_256MB) || \
\r
379 ((SIZE) == MPU_REGION_SIZE_512MB) || \
\r
380 ((SIZE) == MPU_REGION_SIZE_1GB) || \
\r
381 ((SIZE) == MPU_REGION_SIZE_2GB) || \
\r
382 ((SIZE) == MPU_REGION_SIZE_4GB))
\r
384 #define IS_MPU_SUB_REGION_DISABLE(SUBREGION) ((SUBREGION) < (uint16_t)0x00FFU)
\r
385 #endif /* __MPU_PRESENT */
\r
403 #endif /* __STM32F7xx_HAL_CORTEX_H */
\r
406 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
\r