|
STM32G474xx HAL 用户手册
|
00001 /** 00002 ****************************************************************************** 00003 * @file stm32g4xx_hal_cortex.h 00004 * @author MCD 应用团队 00005 * @brief CORTEX HAL 模块的头文件。 00006 ****************************************************************************** 00007 * @attention 00008 * 00009 * 版权所有 (c) 2019 STMicroelectronics。 00010 * 保留所有权利。 00011 * 00012 * 本软件根据可在 LICENSE 文件中找到的条款进行许可 00013 * 位于本软件组件的根目录中。 00014 * 如果本软件未附带 LICENSE 文件,则按“原样”提供。 00015 * 00016 ****************************************************************************** 00017 */ 00018 /* 定义以防止递归包含 -------------------------------------*/ 00019 #ifndef __STM32G4xx_HAL_CORTEX_H 00020 #define __STM32G4xx_HAL_CORTEX_H 00021 00022 #ifdef __cplusplus 00023 extern "C" { 00024 #endif 00025 00026 /* 包含文件 ------------------------------------------------------------------*/ 00027 #include "stm32g4xx_hal_def.h" 00028 00029 /** @addtogroup STM32G4xx_HAL_Driver 00030 * @{ 00031 */ 00032 00033 /** @defgroup CORTEX CORTEX 00034 * @brief CORTEX HAL 模块驱动程序 00035 * @{ 00036 */ 00037 00038 /* 导出类型 ------------------------------------------------------------*/ 00039 /** @defgroup CORTEX_Exported_Types CORTEX 导出类型 00040 * @{ 00041 */ 00042 00043 #if (__MPU_PRESENT == 1) 00044 /** @defgroup CORTEX_MPU_Region_Initialization_Structure_definition MPU 区域初始化结构定义 00045 * @brief MPU 区域初始化结构 00046 * @{ 00047 */ 00048 typedef struct 00049 { 00050 uint8_t Enable; /*!< 指定区域的状态。 00051 此参数可以是 @ref CORTEX_MPU_Region_Enable 的值 */ 00052 uint8_t Number; /*!< 指定要保护的区域编号。 00053 此参数可以是 @ref CORTEX_MPU_Region_Number 的值 */ 00054 uint32_t BaseAddress; /*!< 指定要保护区域的基地址。 */ 00055 uint8_t Size; /*!< 指定要保护区域的大小。 00056 此参数可以是 @ref CORTEX_MPU_Region_Size 的值 */ 00057 uint8_t SubRegionDisable; /*!< 指定要禁用的子区域保护的数量。 00058 此参数必须是介于 Min_Data = 0x00 和 Max_Data = 0xFF 之间的数字 */ 00059 uint8_t TypeExtField; /*!< 指定 TEX 字段级别。 00060 此参数可以是 @ref CORTEX_MPU_TEX_Levels 的值 */ 00061 uint8_t AccessPermission; /*!< 指定区域访问权限类型。 00062 此参数可以是 @ref CORTEX_MPU_Region_Permission_Attributes 的值 */ 00063 uint8_t DisableExec; /*!< 指定指令访问状态。 00064 此参数可以是 @ref CORTEX_MPU_Instruction_Access 的值 */ 00065 uint8_t IsShareable; /*!< 指定受保护区域的可共享性状态。 00066 此参数可以是 @ref CORTEX_MPU_Access_Shareable 的值 */ 00067 uint8_t IsCacheable; /*!< 指定受保护区域的可缓存性状态。 00068 此参数可以是 @ref CORTEX_MPU_Access_Cacheable 的值 */ 00069 uint8_t IsBufferable; /*!< 指定受保护区域的可缓冲性状态。 00070 此参数可以是 @ref CORTEX_MPU_Access_Bufferable 的值 */ 00071 }MPU_Region_InitTypeDef; 00072 /** 00073 * @} 00074 */ 00075 #endif /* __MPU_PRESENT */ 00076 00077 /** 00078 * @} 00079 */ 00080 00081 /* 导出常量 --------------------------------------------------------*/ 00082 00083 /** @defgroup CORTEX_Exported_Constants CORTEX 导出常量 00084 * @{ 00085 */ 00086 00087 /** @defgroup CORTEX_Preemption_Priority_Group CORTEX 抢占优先级组 00088 * @{ 00089 */ 00090 #define NVIC_PRIORITYGROUP_0 0x00000007U /*!< 0 位用于抢占优先级, 00091 4 位用于子优先级 */ 00092 #define NVIC_PRIORITYGROUP_1 0x00000006U /*!< 1 位用于抢占优先级, 00093 3 位用于子优先级 */ 00094 #define NVIC_PRIORITYGROUP_2 0x00000005U /*!< 2 位用于抢占优先级, 00095 2 位用于子优先级 */ 00096 #define NVIC_PRIORITYGROUP_3 0x00000004U /*!< 3 位用于抢占优先级, 00097 1 位用于子优先级 */ 00098 #define NVIC_PRIORITYGROUP_4 0x00000003U /*!< 4 位用于抢占优先级, 00099 0 位用于子优先级 */ 00100 /** 00101 * @} 00102 */ 00103 00104 /** @defgroup CORTEX_SysTick_clock_source CORTEX SysTick 时钟源 00105 * @{ 00106 */ 00107 #define SYSTICK_CLKSOURCE_HCLK_DIV8 0x00000000U 00108 #define SYSTICK_CLKSOURCE_HCLK 0x00000004U 00109 00110 /** 00111 * @} 00112 */ 00113 00114 #if (__MPU_PRESENT == 1) 00115 /** @defgroup CORTEX_MPU_HFNMI_PRIVDEF_Control CORTEX MPU HFNMI 和特权访问控制 00116 * @{ 00117 */ 00118 #define MPU_HFNMI_PRIVDEF_NONE 0x00000000U 00119 #define MPU_HARDFAULT_NMI (MPU_CTRL_HFNMIENA_Msk) 00120 #define MPU_PRIVILEGED_DEFAULT (MPU_CTRL_PRIVDEFENA_Msk) 00121 #define MPU_HFNMI_PRIVDEF (MPU_CTRL_HFNMIENA_Msk | MPU_CTRL_PRIVDEFENA_Msk) 00122 /** 00123 * @} 00124 */ 00125 00126 /** @defgroup CORTEX_MPU_Region_Enable CORTEX MPU 区域使能 00127 * @{ 00128 */ 00129 #define MPU_REGION_ENABLE ((uint8_t)0x01) 00130 #define MPU_REGION_DISABLE ((uint8_t)0x00) 00131 /** 00132 * @} 00133 */ 00134 00135 /** @defgroup CORTEX_MPU_Instruction_Access CORTEX MPU 指令访问 00136 * @{ 00137 */ 00138 #define MPU_INSTRUCTION_ACCESS_ENABLE ((uint8_t)0x00) 00139 #define MPU_INSTRUCTION_ACCESS_DISABLE ((uint8_t)0x01) 00140 /** 00141 * @} 00142 */ 00143 00144 /** @defgroup CORTEX_MPU_Access_Shareable CORTEX MPU 访问可共享 00145 * @{ 00146 */ 00147 #define MPU_ACCESS_SHAREABLE ((uint8_t)0x01) 00148 #define MPU_ACCESS_NOT_SHAREABLE ((uint8_t)0x00) 00149 /** 00150 * @} 00151 */ 00152 00153 /** @defgroup CORTEX_MPU_Access_Cacheable CORTEX MPU 访问可缓存 00154 * @{ 00155 */ 00156 #define MPU_ACCESS_CACHEABLE ((uint8_t)0x01) 00157 #define MPU_ACCESS_NOT_CACHEABLE ((uint8_t)0x00) 00158 /** 00159 * @} 00160 */ 00161 00162 /** @defgroup CORTEX_MPU_Access_Bufferable CORTEX MPU 访问可缓冲 00163 * @{ 00164 */ 00165 #define MPU_ACCESS_BUFFERABLE ((uint8_t)0x01) 00166 #define MPU_ACCESS_NOT_BUFFERABLE ((uint8_t)0x00) 00167 /** 00168 * @} 00169 */ 00170 00171 /** @defgroup CORTEX_MPU_TEX_Levels CORTEX MPU TEX 级别 00172 * @{ 00173 */ 00174 #define MPU_TEX_LEVEL0 ((uint8_t)0x00) 00175 #define MPU_TEX_LEVEL1 ((uint8_t)0x01) 00176