Fork of the official mbed C/C SDK provides the software platform and libraries to build your applications for RenBED.

Dependents:   1-RenBuggyTimed RenBED_RGB RenBED_RGB_PWM RenBED_RGB

Fork of mbed by mbed official

Committer:
elijahorr
Date:
Thu Apr 14 07:28:54 2016 +0000
Revision:
121:672067c3ada4
Parent:
110:165afa46840b
.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Kojto 110:165afa46840b 1 /**
Kojto 110:165afa46840b 2 ******************************************************************************
Kojto 110:165afa46840b 3 * @file stm32f4xx_hal_cortex.h
Kojto 110:165afa46840b 4 * @author MCD Application Team
Kojto 110:165afa46840b 5 * @version V1.4.1
Kojto 110:165afa46840b 6 * @date 09-October-2015
Kojto 110:165afa46840b 7 * @brief Header file of CORTEX HAL module.
Kojto 110:165afa46840b 8 ******************************************************************************
Kojto 110:165afa46840b 9 * @attention
Kojto 110:165afa46840b 10 *
Kojto 110:165afa46840b 11 * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
Kojto 110:165afa46840b 12 *
Kojto 110:165afa46840b 13 * Redistribution and use in source and binary forms, with or without modification,
Kojto 110:165afa46840b 14 * are permitted provided that the following conditions are met:
Kojto 110:165afa46840b 15 * 1. Redistributions of source code must retain the above copyright notice,
Kojto 110:165afa46840b 16 * this list of conditions and the following disclaimer.
Kojto 110:165afa46840b 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
Kojto 110:165afa46840b 18 * this list of conditions and the following disclaimer in the documentation
Kojto 110:165afa46840b 19 * and/or other materials provided with the distribution.
Kojto 110:165afa46840b 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
Kojto 110:165afa46840b 21 * may be used to endorse or promote products derived from this software
Kojto 110:165afa46840b 22 * without specific prior written permission.
Kojto 110:165afa46840b 23 *
Kojto 110:165afa46840b 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
Kojto 110:165afa46840b 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Kojto 110:165afa46840b 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
Kojto 110:165afa46840b 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
Kojto 110:165afa46840b 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
Kojto 110:165afa46840b 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
Kojto 110:165afa46840b 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
Kojto 110:165afa46840b 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
Kojto 110:165afa46840b 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Kojto 110:165afa46840b 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Kojto 110:165afa46840b 34 *
Kojto 110:165afa46840b 35 ******************************************************************************
Kojto 110:165afa46840b 36 */
Kojto 110:165afa46840b 37
Kojto 110:165afa46840b 38 /* Define to prevent recursive inclusion -------------------------------------*/
Kojto 110:165afa46840b 39 #ifndef __STM32F4xx_HAL_CORTEX_H
Kojto 110:165afa46840b 40 #define __STM32F4xx_HAL_CORTEX_H
Kojto 110:165afa46840b 41
Kojto 110:165afa46840b 42 #ifdef __cplusplus
Kojto 110:165afa46840b 43 extern "C" {
Kojto 110:165afa46840b 44 #endif
Kojto 110:165afa46840b 45
Kojto 110:165afa46840b 46 /* Includes ------------------------------------------------------------------*/
Kojto 110:165afa46840b 47 #include "stm32f4xx_hal_def.h"
Kojto 110:165afa46840b 48
Kojto 110:165afa46840b 49 /** @addtogroup STM32F4xx_HAL_Driver
Kojto 110:165afa46840b 50 * @{
Kojto 110:165afa46840b 51 */
Kojto 110:165afa46840b 52
Kojto 110:165afa46840b 53 /** @addtogroup CORTEX
Kojto 110:165afa46840b 54 * @{
Kojto 110:165afa46840b 55 */
Kojto 110:165afa46840b 56 /* Exported types ------------------------------------------------------------*/
Kojto 110:165afa46840b 57 /** @defgroup CORTEX_Exported_Types Cortex Exported Types
Kojto 110:165afa46840b 58 * @{
Kojto 110:165afa46840b 59 */
Kojto 110:165afa46840b 60
Kojto 110:165afa46840b 61 #if (__MPU_PRESENT == 1)
Kojto 110:165afa46840b 62 /** @defgroup CORTEX_MPU_Region_Initialization_Structure_definition MPU Region Initialization Structure Definition
Kojto 110:165afa46840b 63 * @brief MPU Region initialization structure
Kojto 110:165afa46840b 64 * @{
Kojto 110:165afa46840b 65 */
Kojto 110:165afa46840b 66 typedef struct
Kojto 110:165afa46840b 67 {
Kojto 110:165afa46840b 68 uint8_t Enable; /*!< Specifies the status of the region.
Kojto 110:165afa46840b 69 This parameter can be a value of @ref CORTEX_MPU_Region_Enable */
Kojto 110:165afa46840b 70 uint8_t Number; /*!< Specifies the number of the region to protect.
Kojto 110:165afa46840b 71 This parameter can be a value of @ref CORTEX_MPU_Region_Number */
Kojto 110:165afa46840b 72 uint32_t BaseAddress; /*!< Specifies the base address of the region to protect. */
Kojto 110:165afa46840b 73 uint8_t Size; /*!< Specifies the size of the region to protect.
Kojto 110:165afa46840b 74 This parameter can be a value of @ref CORTEX_MPU_Region_Size */
Kojto 110:165afa46840b 75 uint8_t SubRegionDisable; /*!< Specifies the number of the subregion protection to disable.
Kojto 110:165afa46840b 76 This parameter must be a number between Min_Data = 0x00 and Max_Data = 0xFF */
Kojto 110:165afa46840b 77 uint8_t TypeExtField; /*!< Specifies the TEX field level.
Kojto 110:165afa46840b 78 This parameter can be a value of @ref CORTEX_MPU_TEX_Levels */
Kojto 110:165afa46840b 79 uint8_t AccessPermission; /*!< Specifies the region access permission type.
Kojto 110:165afa46840b 80 This parameter can be a value of @ref CORTEX_MPU_Region_Permission_Attributes */
Kojto 110:165afa46840b 81 uint8_t DisableExec; /*!< Specifies the instruction access status.
Kojto 110:165afa46840b 82 This parameter can be a value of @ref CORTEX_MPU_Instruction_Access */
Kojto 110:165afa46840b 83 uint8_t IsShareable; /*!< Specifies the shareability status of the protected region.
Kojto 110:165afa46840b 84 This parameter can be a value of @ref CORTEX_MPU_Access_Shareable */
Kojto 110:165afa46840b 85 uint8_t IsCacheable; /*!< Specifies the cacheable status of the region protected.
Kojto 110:165afa46840b 86 This parameter can be a value of @ref CORTEX_MPU_Access_Cacheable */
Kojto 110:165afa46840b 87 uint8_t IsBufferable; /*!< Specifies the bufferable status of the protected region.
Kojto 110:165afa46840b 88 This parameter can be a value of @ref CORTEX_MPU_Access_Bufferable */
Kojto 110:165afa46840b 89 }MPU_Region_InitTypeDef;
Kojto 110:165afa46840b 90 /**
Kojto 110:165afa46840b 91 * @}
Kojto 110:165afa46840b 92 */
Kojto 110:165afa46840b 93 #endif /* __MPU_PRESENT */
Kojto 110:165afa46840b 94
Kojto 110:165afa46840b 95 /**
Kojto 110:165afa46840b 96 * @}
Kojto 110:165afa46840b 97 */
Kojto 110:165afa46840b 98
Kojto 110:165afa46840b 99 /* Exported constants --------------------------------------------------------*/
Kojto 110:165afa46840b 100
Kojto 110:165afa46840b 101 /** @defgroup CORTEX_Exported_Constants CORTEX Exported Constants
Kojto 110:165afa46840b 102 * @{
Kojto 110:165afa46840b 103 */
Kojto 110:165afa46840b 104
Kojto 110:165afa46840b 105 /** @defgroup CORTEX_Preemption_Priority_Group CORTEX Preemption Priority Group
Kojto 110:165afa46840b 106 * @{
Kojto 110:165afa46840b 107 */
Kojto 110:165afa46840b 108 #define NVIC_PRIORITYGROUP_0 ((uint32_t)0x00000007) /*!< 0 bits for pre-emption priority
Kojto 110:165afa46840b 109 4 bits for subpriority */
Kojto 110:165afa46840b 110 #define NVIC_PRIORITYGROUP_1 ((uint32_t)0x00000006) /*!< 1 bits for pre-emption priority
Kojto 110:165afa46840b 111 3 bits for subpriority */
Kojto 110:165afa46840b 112 #define NVIC_PRIORITYGROUP_2 ((uint32_t)0x00000005) /*!< 2 bits for pre-emption priority
Kojto 110:165afa46840b 113 2 bits for subpriority */
Kojto 110:165afa46840b 114 #define NVIC_PRIORITYGROUP_3 ((uint32_t)0x00000004) /*!< 3 bits for pre-emption priority
Kojto 110:165afa46840b 115 1 bits for subpriority */
Kojto 110:165afa46840b 116 #define NVIC_PRIORITYGROUP_4 ((uint32_t)0x00000003) /*!< 4 bits for pre-emption priority
Kojto 110:165afa46840b 117 0 bits for subpriority */
Kojto 110:165afa46840b 118 /**
Kojto 110:165afa46840b 119 * @}
Kojto 110:165afa46840b 120 */
Kojto 110:165afa46840b 121
Kojto 110:165afa46840b 122 /** @defgroup CORTEX_SysTick_clock_source CORTEX _SysTick clock source
Kojto 110:165afa46840b 123 * @{
Kojto 110:165afa46840b 124 */
Kojto 110:165afa46840b 125 #define SYSTICK_CLKSOURCE_HCLK_DIV8 ((uint32_t)0x00000000)
Kojto 110:165afa46840b 126 #define SYSTICK_CLKSOURCE_HCLK ((uint32_t)0x00000004)
Kojto 110:165afa46840b 127
Kojto 110:165afa46840b 128 /**
Kojto 110:165afa46840b 129 * @}
Kojto 110:165afa46840b 130 */
Kojto 110:165afa46840b 131
Kojto 110:165afa46840b 132 #if (__MPU_PRESENT == 1)
Kojto 110:165afa46840b 133 /** @defgroup CORTEX_MPU_HFNMI_PRIVDEF_Control MPU HFNMI and PRIVILEGED Access control
Kojto 110:165afa46840b 134 * @{
Kojto 110:165afa46840b 135 */
Kojto 110:165afa46840b 136 #define MPU_HFNMI_PRIVDEF_NONE ((uint32_t)0x00000000)
Kojto 110:165afa46840b 137 #define MPU_HARDFAULT_NMI ((uint32_t)0x00000002)
Kojto 110:165afa46840b 138 #define MPU_PRIVILEGED_DEFAULT ((uint32_t)0x00000004)
Kojto 110:165afa46840b 139 #define MPU_HFNMI_PRIVDEF ((uint32_t)0x00000006)
Kojto 110:165afa46840b 140 /**
Kojto 110:165afa46840b 141 * @}
Kojto 110:165afa46840b 142 */
Kojto 110:165afa46840b 143
Kojto 110:165afa46840b 144 /** @defgroup CORTEX_MPU_Region_Enable CORTEX MPU Region Enable
Kojto 110:165afa46840b 145 * @{
Kojto 110:165afa46840b 146 */
Kojto 110:165afa46840b 147 #define MPU_REGION_ENABLE ((uint8_t)0x01)
Kojto 110:165afa46840b 148 #define MPU_REGION_DISABLE ((uint8_t)0x00)
Kojto 110:165afa46840b 149 /**
Kojto 110:165afa46840b 150 * @}
Kojto 110:165afa46840b 151 */
Kojto 110:165afa46840b 152
Kojto 110:165afa46840b 153 /** @defgroup CORTEX_MPU_Instruction_Access CORTEX MPU Instruction Access
Kojto 110:165afa46840b 154 * @{
Kojto 110:165afa46840b 155 */
Kojto 110:165afa46840b 156 #define MPU_INSTRUCTION_ACCESS_ENABLE ((uint8_t)0x00)
Kojto 110:165afa46840b 157 #define MPU_INSTRUCTION_ACCESS_DISABLE ((uint8_t)0x01)
Kojto 110:165afa46840b 158 /**
Kojto 110:165afa46840b 159 * @}
Kojto 110:165afa46840b 160 */
Kojto 110:165afa46840b 161
Kojto 110:165afa46840b 162 /** @defgroup CORTEX_MPU_Access_Shareable CORTEX MPU Instruction Access Shareable
Kojto 110:165afa46840b 163 * @{
Kojto 110:165afa46840b 164 */
Kojto 110:165afa46840b 165 #define MPU_ACCESS_SHAREABLE ((uint8_t)0x01)
Kojto 110:165afa46840b 166 #define MPU_ACCESS_NOT_SHAREABLE ((uint8_t)0x00)
Kojto 110:165afa46840b 167 /**
Kojto 110:165afa46840b 168 * @}
Kojto 110:165afa46840b 169 */
Kojto 110:165afa46840b 170
Kojto 110:165afa46840b 171 /** @defgroup CORTEX_MPU_Access_Cacheable CORTEX MPU Instruction Access Cacheable
Kojto 110:165afa46840b 172 * @{
Kojto 110:165afa46840b 173 */
Kojto 110:165afa46840b 174 #define MPU_ACCESS_CACHEABLE ((uint8_t)0x01)
Kojto 110:165afa46840b 175 #define MPU_ACCESS_NOT_CACHEABLE ((uint8_t)0x00)
Kojto 110:165afa46840b 176 /**
Kojto 110:165afa46840b 177 * @}
Kojto 110:165afa46840b 178 */
Kojto 110:165afa46840b 179
Kojto 110:165afa46840b 180 /** @defgroup CORTEX_MPU_Access_Bufferable CORTEX MPU Instruction Access Bufferable
Kojto 110:165afa46840b 181 * @{
Kojto 110:165afa46840b 182 */
Kojto 110:165afa46840b 183 #define MPU_ACCESS_BUFFERABLE ((uint8_t)0x01)
Kojto 110:165afa46840b 184 #define MPU_ACCESS_NOT_BUFFERABLE ((uint8_t)0x00)
Kojto 110:165afa46840b 185 /**
Kojto 110:165afa46840b 186 * @}
Kojto 110:165afa46840b 187 */
Kojto 110:165afa46840b 188
Kojto 110:165afa46840b 189 /** @defgroup CORTEX_MPU_TEX_Levels MPU TEX Levels
Kojto 110:165afa46840b 190 * @{
Kojto 110:165afa46840b 191 */
Kojto 110:165afa46840b 192 #define MPU_TEX_LEVEL0 ((uint8_t)0x00)
Kojto 110:165afa46840b 193 #define MPU_TEX_LEVEL1 ((uint8_t)0x01)
Kojto 110:165afa46840b 194 #define MPU_TEX_LEVEL2 ((uint8_t)0x02)
Kojto 110:165afa46840b 195 /**
Kojto 110:165afa46840b 196 * @}
Kojto 110:165afa46840b 197 */
Kojto 110:165afa46840b 198
Kojto 110:165afa46840b 199 /** @defgroup CORTEX_MPU_Region_Size CORTEX MPU Region Size
Kojto 110:165afa46840b 200 * @{
Kojto 110:165afa46840b 201 */
Kojto 110:165afa46840b 202 #define MPU_REGION_SIZE_32B ((uint8_t)0x04)
Kojto 110:165afa46840b 203 #define MPU_REGION_SIZE_64B ((uint8_t)0x05)
Kojto 110:165afa46840b 204 #define MPU_REGION_SIZE_128B ((uint8_t)0x06)
Kojto 110:165afa46840b 205 #define MPU_REGION_SIZE_256B ((uint8_t)0x07)
Kojto 110:165afa46840b 206 #define MPU_REGION_SIZE_512B ((uint8_t)0x08)
Kojto 110:165afa46840b 207 #define MPU_REGION_SIZE_1KB ((uint8_t)0x09)
Kojto 110:165afa46840b 208 #define MPU_REGION_SIZE_2KB ((uint8_t)0x0A)
Kojto 110:165afa46840b 209 #define MPU_REGION_SIZE_4KB ((uint8_t)0x0B)
Kojto 110:165afa46840b 210 #define MPU_REGION_SIZE_8KB ((uint8_t)0x0C)
Kojto 110:165afa46840b 211 #define MPU_REGION_SIZE_16KB ((uint8_t)0x0D)
Kojto 110:165afa46840b 212 #define MPU_REGION_SIZE_32KB ((uint8_t)0x0E)
Kojto 110:165afa46840b 213 #define MPU_REGION_SIZE_64KB ((uint8_t)0x0F)
Kojto 110:165afa46840b 214 #define MPU_REGION_SIZE_128KB ((uint8_t)0x10)
Kojto 110:165afa46840b 215 #define MPU_REGION_SIZE_256KB ((uint8_t)0x11)
Kojto 110:165afa46840b 216 #define MPU_REGION_SIZE_512KB ((uint8_t)0x12)
Kojto 110:165afa46840b 217 #define MPU_REGION_SIZE_1MB ((uint8_t)0x13)
Kojto 110:165afa46840b 218 #define MPU_REGION_SIZE_2MB ((uint8_t)0x14)
Kojto 110:165afa46840b 219 #define MPU_REGION_SIZE_4MB ((uint8_t)0x15)
Kojto 110:165afa46840b 220 #define MPU_REGION_SIZE_8MB ((uint8_t)0x16)
Kojto 110:165afa46840b 221 #define MPU_REGION_SIZE_16MB ((uint8_t)0x17)
Kojto 110:165afa46840b 222 #define MPU_REGION_SIZE_32MB ((uint8_t)0x18)
Kojto 110:165afa46840b 223 #define MPU_REGION_SIZE_64MB ((uint8_t)0x19)
Kojto 110:165afa46840b 224 #define MPU_REGION_SIZE_128MB ((uint8_t)0x1A)
Kojto 110:165afa46840b 225 #define MPU_REGION_SIZE_256MB ((uint8_t)0x1B)
Kojto 110:165afa46840b 226 #define MPU_REGION_SIZE_512MB ((uint8_t)0x1C)
Kojto 110:165afa46840b 227 #define MPU_REGION_SIZE_1GB ((uint8_t)0x1D)
Kojto 110:165afa46840b 228 #define MPU_REGION_SIZE_2GB ((uint8_t)0x1E)
Kojto 110:165afa46840b 229 #define MPU_REGION_SIZE_4GB ((uint8_t)0x1F)
Kojto 110:165afa46840b 230 /**
Kojto 110:165afa46840b 231 * @}
Kojto 110:165afa46840b 232 */
Kojto 110:165afa46840b 233
Kojto 110:165afa46840b 234 /** @defgroup CORTEX_MPU_Region_Permission_Attributes CORTEX MPU Region Permission Attributes
Kojto 110:165afa46840b 235 * @{
Kojto 110:165afa46840b 236 */
Kojto 110:165afa46840b 237 #define MPU_REGION_NO_ACCESS ((uint8_t)0x00)
Kojto 110:165afa46840b 238 #define MPU_REGION_PRIV_RW ((uint8_t)0x01)
Kojto 110:165afa46840b 239 #define MPU_REGION_PRIV_RW_URO ((uint8_t)0x02)
Kojto 110:165afa46840b 240 #define MPU_REGION_FULL_ACCESS ((uint8_t)0x03)
Kojto 110:165afa46840b 241 #define MPU_REGION_PRIV_RO ((uint8_t)0x05)
Kojto 110:165afa46840b 242 #define MPU_REGION_PRIV_RO_URO ((uint8_t)0x06)
Kojto 110:165afa46840b 243 /**
Kojto 110:165afa46840b 244 * @}
Kojto 110:165afa46840b 245 */
Kojto 110:165afa46840b 246
Kojto 110:165afa46840b 247 /** @defgroup CORTEX_MPU_Region_Number CORTEX MPU Region Number
Kojto 110:165afa46840b 248 * @{
Kojto 110:165afa46840b 249 */
Kojto 110:165afa46840b 250 #define MPU_REGION_NUMBER0 ((uint8_t)0x00)
Kojto 110:165afa46840b 251 #define MPU_REGION_NUMBER1 ((uint8_t)0x01)
Kojto 110:165afa46840b 252 #define MPU_REGION_NUMBER2 ((uint8_t)0x02)
Kojto 110:165afa46840b 253 #define MPU_REGION_NUMBER3 ((uint8_t)0x03)
Kojto 110:165afa46840b 254 #define MPU_REGION_NUMBER4 ((uint8_t)0x04)
Kojto 110:165afa46840b 255 #define MPU_REGION_NUMBER5 ((uint8_t)0x05)
Kojto 110:165afa46840b 256 #define MPU_REGION_NUMBER6 ((uint8_t)0x06)
Kojto 110:165afa46840b 257 #define MPU_REGION_NUMBER7 ((uint8_t)0x07)
Kojto 110:165afa46840b 258 /**
Kojto 110:165afa46840b 259 * @}
Kojto 110:165afa46840b 260 */
Kojto 110:165afa46840b 261 #endif /* __MPU_PRESENT */
Kojto 110:165afa46840b 262
Kojto 110:165afa46840b 263 /**
Kojto 110:165afa46840b 264 * @}
Kojto 110:165afa46840b 265 */
Kojto 110:165afa46840b 266
Kojto 110:165afa46840b 267
Kojto 110:165afa46840b 268 /* Exported Macros -----------------------------------------------------------*/
Kojto 110:165afa46840b 269 /** @defgroup CORTEX_Exported_Macros CORTEX Exported Macros
Kojto 110:165afa46840b 270 * @{
Kojto 110:165afa46840b 271 */
Kojto 110:165afa46840b 272
Kojto 110:165afa46840b 273 /** @brief Configures the SysTick clock source.
Kojto 110:165afa46840b 274 * @param __CLKSRC__: specifies the SysTick clock source.
Kojto 110:165afa46840b 275 * This parameter can be one of the following values:
Kojto 110:165afa46840b 276 * @arg SYSTICK_CLKSOURCE_HCLK_DIV8: AHB clock divided by 8 selected as SysTick clock source.
Kojto 110:165afa46840b 277 * @arg SYSTICK_CLKSOURCE_HCLK: AHB clock selected as SysTick clock source.
Kojto 110:165afa46840b 278 * @retval None
Kojto 110:165afa46840b 279 */
Kojto 110:165afa46840b 280 #define __HAL_CORTEX_SYSTICKCLK_CONFIG(__CLKSRC__) \
Kojto 110:165afa46840b 281 do { \
Kojto 110:165afa46840b 282 if ((__CLKSRC__) == SYSTICK_CLKSOURCE_HCLK) \
Kojto 110:165afa46840b 283 { \
Kojto 110:165afa46840b 284 SysTick->CTRL |= SYSTICK_CLKSOURCE_HCLK; \
Kojto 110:165afa46840b 285 } \
Kojto 110:165afa46840b 286 else \
Kojto 110:165afa46840b 287 SysTick->CTRL &= ~SYSTICK_CLKSOURCE_HCLK; \
Kojto 110:165afa46840b 288 } while(0)
Kojto 110:165afa46840b 289 /**
Kojto 110:165afa46840b 290 * @}
Kojto 110:165afa46840b 291 */
Kojto 110:165afa46840b 292
Kojto 110:165afa46840b 293 /* Exported functions --------------------------------------------------------*/
Kojto 110:165afa46840b 294 /** @addtogroup CORTEX_Exported_Functions
Kojto 110:165afa46840b 295 * @{
Kojto 110:165afa46840b 296 */
Kojto 110:165afa46840b 297
Kojto 110:165afa46840b 298 /** @addtogroup CORTEX_Exported_Functions_Group1
Kojto 110:165afa46840b 299 * @{
Kojto 110:165afa46840b 300 */
Kojto 110:165afa46840b 301 /* Initialization and de-initialization functions *****************************/
Kojto 110:165afa46840b 302 void HAL_NVIC_SetPriorityGrouping(uint32_t PriorityGroup);
Kojto 110:165afa46840b 303 void HAL_NVIC_SetPriority(IRQn_Type IRQn, uint32_t PreemptPriority, uint32_t SubPriority);
Kojto 110:165afa46840b 304 void HAL_NVIC_EnableIRQ(IRQn_Type IRQn);
Kojto 110:165afa46840b 305 void HAL_NVIC_DisableIRQ(IRQn_Type IRQn);
Kojto 110:165afa46840b 306 void HAL_NVIC_SystemReset(void);
Kojto 110:165afa46840b 307 uint32_t HAL_SYSTICK_Config(uint32_t TicksNumb);
Kojto 110:165afa46840b 308 /**
Kojto 110:165afa46840b 309 * @}
Kojto 110:165afa46840b 310 */
Kojto 110:165afa46840b 311
Kojto 110:165afa46840b 312 /** @addtogroup CORTEX_Exported_Functions_Group2
Kojto 110:165afa46840b 313 * @{
Kojto 110:165afa46840b 314 */
Kojto 110:165afa46840b 315 /* Peripheral Control functions ***********************************************/
Kojto 110:165afa46840b 316 #if (__MPU_PRESENT == 1)
Kojto 110:165afa46840b 317 void HAL_MPU_ConfigRegion(MPU_Region_InitTypeDef *MPU_Init);
Kojto 110:165afa46840b 318 #endif /* __MPU_PRESENT */
Kojto 110:165afa46840b 319 uint32_t HAL_NVIC_GetPriorityGrouping(void);
Kojto 110:165afa46840b 320 void HAL_NVIC_GetPriority(IRQn_Type IRQn, uint32_t PriorityGroup, uint32_t* pPreemptPriority, uint32_t* pSubPriority);
Kojto 110:165afa46840b 321 uint32_t HAL_NVIC_GetPendingIRQ(IRQn_Type IRQn);
Kojto 110:165afa46840b 322 void HAL_NVIC_SetPendingIRQ(IRQn_Type IRQn);
Kojto 110:165afa46840b 323 void HAL_NVIC_ClearPendingIRQ(IRQn_Type IRQn);
Kojto 110:165afa46840b 324 uint32_t HAL_NVIC_GetActive(IRQn_Type IRQn);
Kojto 110:165afa46840b 325 void HAL_SYSTICK_CLKSourceConfig(uint32_t CLKSource);
Kojto 110:165afa46840b 326 void HAL_SYSTICK_IRQHandler(void);
Kojto 110:165afa46840b 327 void HAL_SYSTICK_Callback(void);
Kojto 110:165afa46840b 328 /**
Kojto 110:165afa46840b 329 * @}
Kojto 110:165afa46840b 330 */
Kojto 110:165afa46840b 331
Kojto 110:165afa46840b 332 /**
Kojto 110:165afa46840b 333 * @}
Kojto 110:165afa46840b 334 */
Kojto 110:165afa46840b 335
Kojto 110:165afa46840b 336 /* Private types -------------------------------------------------------------*/
Kojto 110:165afa46840b 337 /* Private variables ---------------------------------------------------------*/
Kojto 110:165afa46840b 338 /* Private constants ---------------------------------------------------------*/
Kojto 110:165afa46840b 339 /* Private macros ------------------------------------------------------------*/
Kojto 110:165afa46840b 340 /** @defgroup CORTEX_Private_Macros CORTEX Private Macros
Kojto 110:165afa46840b 341 * @{
Kojto 110:165afa46840b 342 */
Kojto 110:165afa46840b 343 #define IS_NVIC_PRIORITY_GROUP(GROUP) (((GROUP) == NVIC_PRIORITYGROUP_0) || \
Kojto 110:165afa46840b 344 ((GROUP) == NVIC_PRIORITYGROUP_1) || \
Kojto 110:165afa46840b 345 ((GROUP) == NVIC_PRIORITYGROUP_2) || \
Kojto 110:165afa46840b 346 ((GROUP) == NVIC_PRIORITYGROUP_3) || \
Kojto 110:165afa46840b 347 ((GROUP) == NVIC_PRIORITYGROUP_4))
Kojto 110:165afa46840b 348
Kojto 110:165afa46840b 349 #define IS_NVIC_PREEMPTION_PRIORITY(PRIORITY) ((PRIORITY) < 0x10)
Kojto 110:165afa46840b 350
Kojto 110:165afa46840b 351 #define IS_NVIC_SUB_PRIORITY(PRIORITY) ((PRIORITY) < 0x10)
Kojto 110:165afa46840b 352
Kojto 110:165afa46840b 353 #define IS_NVIC_DEVICE_IRQ(IRQ) ((IRQ) >= 0x00)
Kojto 110:165afa46840b 354
Kojto 110:165afa46840b 355 #define IS_SYSTICK_CLK_SOURCE(SOURCE) (((SOURCE) == SYSTICK_CLKSOURCE_HCLK) || \
Kojto 110:165afa46840b 356 ((SOURCE) == SYSTICK_CLKSOURCE_HCLK_DIV8))
Kojto 110:165afa46840b 357
Kojto 110:165afa46840b 358 #if (__MPU_PRESENT == 1)
Kojto 110:165afa46840b 359 #define IS_MPU_REGION_ENABLE(STATE) (((STATE) == MPU_REGION_ENABLE) || \
Kojto 110:165afa46840b 360 ((STATE) == MPU_REGION_DISABLE))
Kojto 110:165afa46840b 361
Kojto 110:165afa46840b 362 #define IS_MPU_INSTRUCTION_ACCESS(STATE) (((STATE) == MPU_INSTRUCTION_ACCESS_ENABLE) || \
Kojto 110:165afa46840b 363 ((STATE) == MPU_INSTRUCTION_ACCESS_DISABLE))
Kojto 110:165afa46840b 364
Kojto 110:165afa46840b 365 #define IS_MPU_ACCESS_SHAREABLE(STATE) (((STATE) == MPU_ACCESS_SHAREABLE) || \
Kojto 110:165afa46840b 366 ((STATE) == MPU_ACCESS_NOT_SHAREABLE))
Kojto 110:165afa46840b 367
Kojto 110:165afa46840b 368 #define IS_MPU_ACCESS_CACHEABLE(STATE) (((STATE) == MPU_ACCESS_CACHEABLE) || \
Kojto 110:165afa46840b 369 ((STATE) == MPU_ACCESS_NOT_CACHEABLE))
Kojto 110:165afa46840b 370
Kojto 110:165afa46840b 371 #define IS_MPU_ACCESS_BUFFERABLE(STATE) (((STATE) == MPU_ACCESS_BUFFERABLE) || \
Kojto 110:165afa46840b 372 ((STATE) == MPU_ACCESS_NOT_BUFFERABLE))
Kojto 110:165afa46840b 373
Kojto 110:165afa46840b 374 #define IS_MPU_TEX_LEVEL(TYPE) (((TYPE) == MPU_TEX_LEVEL0) || \
Kojto 110:165afa46840b 375 ((TYPE) == MPU_TEX_LEVEL1) || \
Kojto 110:165afa46840b 376 ((TYPE) == MPU_TEX_LEVEL2))
Kojto 110:165afa46840b 377
Kojto 110:165afa46840b 378 #define IS_MPU_REGION_PERMISSION_ATTRIBUTE(TYPE) (((TYPE) == MPU_REGION_NO_ACCESS) || \
Kojto 110:165afa46840b 379 ((TYPE) == MPU_REGION_PRIV_RW) || \
Kojto 110:165afa46840b 380 ((TYPE) == MPU_REGION_PRIV_RW_URO) || \
Kojto 110:165afa46840b 381 ((TYPE) == MPU_REGION_FULL_ACCESS) || \
Kojto 110:165afa46840b 382 ((TYPE) == MPU_REGION_PRIV_RO) || \
Kojto 110:165afa46840b 383 ((TYPE) == MPU_REGION_PRIV_RO_URO))
Kojto 110:165afa46840b 384
Kojto 110:165afa46840b 385 #define IS_MPU_REGION_NUMBER(NUMBER) (((NUMBER) == MPU_REGION_NUMBER0) || \
Kojto 110:165afa46840b 386 ((NUMBER) == MPU_REGION_NUMBER1) || \
Kojto 110:165afa46840b 387 ((NUMBER) == MPU_REGION_NUMBER2) || \
Kojto 110:165afa46840b 388 ((NUMBER) == MPU_REGION_NUMBER3) || \
Kojto 110:165afa46840b 389 ((NUMBER) == MPU_REGION_NUMBER4) || \
Kojto 110:165afa46840b 390 ((NUMBER) == MPU_REGION_NUMBER5) || \
Kojto 110:165afa46840b 391 ((NUMBER) == MPU_REGION_NUMBER6) || \
Kojto 110:165afa46840b 392 ((NUMBER) == MPU_REGION_NUMBER7))
Kojto 110:165afa46840b 393
Kojto 110:165afa46840b 394 #define IS_MPU_REGION_SIZE(SIZE) (((SIZE) == MPU_REGION_SIZE_32B) || \
Kojto 110:165afa46840b 395 ((SIZE) == MPU_REGION_SIZE_64B) || \
Kojto 110:165afa46840b 396 ((SIZE) == MPU_REGION_SIZE_128B) || \
Kojto 110:165afa46840b 397 ((SIZE) == MPU_REGION_SIZE_256B) || \
Kojto 110:165afa46840b 398 ((SIZE) == MPU_REGION_SIZE_512B) || \
Kojto 110:165afa46840b 399 ((SIZE) == MPU_REGION_SIZE_1KB) || \
Kojto 110:165afa46840b 400 ((SIZE) == MPU_REGION_SIZE_2KB) || \
Kojto 110:165afa46840b 401 ((SIZE) == MPU_REGION_SIZE_4KB) || \
Kojto 110:165afa46840b 402 ((SIZE) == MPU_REGION_SIZE_8KB) || \
Kojto 110:165afa46840b 403 ((SIZE) == MPU_REGION_SIZE_16KB) || \
Kojto 110:165afa46840b 404 ((SIZE) == MPU_REGION_SIZE_32KB) || \
Kojto 110:165afa46840b 405 ((SIZE) == MPU_REGION_SIZE_64KB) || \
Kojto 110:165afa46840b 406 ((SIZE) == MPU_REGION_SIZE_128KB) || \
Kojto 110:165afa46840b 407 ((SIZE) == MPU_REGION_SIZE_256KB) || \
Kojto 110:165afa46840b 408 ((SIZE) == MPU_REGION_SIZE_512KB) || \
Kojto 110:165afa46840b 409 ((SIZE) == MPU_REGION_SIZE_1MB) || \
Kojto 110:165afa46840b 410 ((SIZE) == MPU_REGION_SIZE_2MB) || \
Kojto 110:165afa46840b 411 ((SIZE) == MPU_REGION_SIZE_4MB) || \
Kojto 110:165afa46840b 412 ((SIZE) == MPU_REGION_SIZE_8MB) || \
Kojto 110:165afa46840b 413 ((SIZE) == MPU_REGION_SIZE_16MB) || \
Kojto 110:165afa46840b 414 ((SIZE) == MPU_REGION_SIZE_32MB) || \
Kojto 110:165afa46840b 415 ((SIZE) == MPU_REGION_SIZE_64MB) || \
Kojto 110:165afa46840b 416 ((SIZE) == MPU_REGION_SIZE_128MB) || \
Kojto 110:165afa46840b 417 ((SIZE) == MPU_REGION_SIZE_256MB) || \
Kojto 110:165afa46840b 418 ((SIZE) == MPU_REGION_SIZE_512MB) || \
Kojto 110:165afa46840b 419 ((SIZE) == MPU_REGION_SIZE_1GB) || \
Kojto 110:165afa46840b 420 ((SIZE) == MPU_REGION_SIZE_2GB) || \
Kojto 110:165afa46840b 421 ((SIZE) == MPU_REGION_SIZE_4GB))
Kojto 110:165afa46840b 422
Kojto 110:165afa46840b 423 #define IS_MPU_SUB_REGION_DISABLE(SUBREGION) ((SUBREGION) < (uint16_t)0x00FF)
Kojto 110:165afa46840b 424 #endif /* __MPU_PRESENT */
Kojto 110:165afa46840b 425
Kojto 110:165afa46840b 426 /**
Kojto 110:165afa46840b 427 * @}
Kojto 110:165afa46840b 428 */
Kojto 110:165afa46840b 429
Kojto 110:165afa46840b 430 /* Private functions ---------------------------------------------------------*/
Kojto 110:165afa46840b 431 /** @defgroup CORTEX_Private_Functions CORTEX Private Functions
Kojto 110:165afa46840b 432 * @brief CORTEX private functions
Kojto 110:165afa46840b 433 * @{
Kojto 110:165afa46840b 434 */
Kojto 110:165afa46840b 435
Kojto 110:165afa46840b 436 #if (__MPU_PRESENT == 1)
Kojto 110:165afa46840b 437 /**
Kojto 110:165afa46840b 438 * @brief Disables the MPU
Kojto 110:165afa46840b 439 * @retval None
Kojto 110:165afa46840b 440 */
Kojto 110:165afa46840b 441 __STATIC_INLINE void HAL_MPU_Disable(void)
Kojto 110:165afa46840b 442 {
Kojto 110:165afa46840b 443 /* Disable fault exceptions */
Kojto 110:165afa46840b 444 SCB->SHCSR &= ~SCB_SHCSR_MEMFAULTENA_Msk;
Kojto 110:165afa46840b 445
Kojto 110:165afa46840b 446 /* Disable the MPU */
Kojto 110:165afa46840b 447 MPU->CTRL &= ~MPU_CTRL_ENABLE_Msk;
Kojto 110:165afa46840b 448 }
Kojto 110:165afa46840b 449
Kojto 110:165afa46840b 450 /**
Kojto 110:165afa46840b 451 * @brief Enables the MPU
Kojto 110:165afa46840b 452 * @param MPU_Control: Specifies the control mode of the MPU during hard fault,
Kojto 110:165afa46840b 453 * NMI, FAULTMASK and privileged access to the default memory
Kojto 110:165afa46840b 454 * This parameter can be one of the following values:
Kojto 110:165afa46840b 455 * @arg MPU_HFNMI_PRIVDEF_NONE
Kojto 110:165afa46840b 456 * @arg MPU_HARDFAULT_NMI
Kojto 110:165afa46840b 457 * @arg MPU_PRIVILEGED_DEFAULT
Kojto 110:165afa46840b 458 * @arg MPU_HFNMI_PRIVDEF
Kojto 110:165afa46840b 459 * @retval None
Kojto 110:165afa46840b 460 */
Kojto 110:165afa46840b 461 __STATIC_INLINE void HAL_MPU_Enable(uint32_t MPU_Control)
Kojto 110:165afa46840b 462 {
Kojto 110:165afa46840b 463 /* Enable the MPU */
Kojto 110:165afa46840b 464 MPU->CTRL = MPU_Control | MPU_CTRL_ENABLE_Msk;
Kojto 110:165afa46840b 465
Kojto 110:165afa46840b 466 /* Enable fault exceptions */
Kojto 110:165afa46840b 467 SCB->SHCSR |= SCB_SHCSR_MEMFAULTENA_Msk;
Kojto 110:165afa46840b 468 }
Kojto 110:165afa46840b 469 #endif /* __MPU_PRESENT */
Kojto 110:165afa46840b 470
Kojto 110:165afa46840b 471 /**
Kojto 110:165afa46840b 472 * @}
Kojto 110:165afa46840b 473 */
Kojto 110:165afa46840b 474
Kojto 110:165afa46840b 475 /**
Kojto 110:165afa46840b 476 * @}
Kojto 110:165afa46840b 477 */
Kojto 110:165afa46840b 478
Kojto 110:165afa46840b 479 /**
Kojto 110:165afa46840b 480 * @}
Kojto 110:165afa46840b 481 */
Kojto 110:165afa46840b 482
Kojto 110:165afa46840b 483 #ifdef __cplusplus
Kojto 110:165afa46840b 484 }
Kojto 110:165afa46840b 485 #endif
Kojto 110:165afa46840b 486
Kojto 110:165afa46840b 487 #endif /* __STM32F4xx_HAL_CORTEX_H */
Kojto 110:165afa46840b 488
Kojto 110:165afa46840b 489
Kojto 110:165afa46840b 490 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/