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:
Kojto
Date:
Wed Nov 25 13:21:40 2015 +0000
Revision:
110:165afa46840b
Parent:
106:ba1f97679dad
Release 110  of the mbed library

Changes:
- new platforms - STM32F410R, DISCO_F429ZI, DISCO_F469NI
- Nucleo L476 - gcc and uvision template
- k22,k64f targets - ADC channels A addition
- EFM32 - bugfixes in sleep, serial and spi
- Delta DFCM NNN40 - pinnames update

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bogdanm 89:552587b429a1 1 /**
bogdanm 89:552587b429a1 2 ******************************************************************************
bogdanm 89:552587b429a1 3 * @file stm32f4xx_hal_cortex.h
bogdanm 89:552587b429a1 4 * @author MCD Application Team
Kojto 110:165afa46840b 5 * @version V1.4.1
Kojto 110:165afa46840b 6 * @date 09-October-2015
bogdanm 89:552587b429a1 7 * @brief Header file of CORTEX HAL module.
bogdanm 89:552587b429a1 8 ******************************************************************************
bogdanm 89:552587b429a1 9 * @attention
bogdanm 89:552587b429a1 10 *
Kojto 99:dbbf35b96557 11 * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
bogdanm 89:552587b429a1 12 *
bogdanm 89:552587b429a1 13 * Redistribution and use in source and binary forms, with or without modification,
bogdanm 89:552587b429a1 14 * are permitted provided that the following conditions are met:
bogdanm 89:552587b429a1 15 * 1. Redistributions of source code must retain the above copyright notice,
bogdanm 89:552587b429a1 16 * this list of conditions and the following disclaimer.
bogdanm 89:552587b429a1 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
bogdanm 89:552587b429a1 18 * this list of conditions and the following disclaimer in the documentation
bogdanm 89:552587b429a1 19 * and/or other materials provided with the distribution.
bogdanm 89:552587b429a1 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
bogdanm 89:552587b429a1 21 * may be used to endorse or promote products derived from this software
bogdanm 89:552587b429a1 22 * without specific prior written permission.
bogdanm 89:552587b429a1 23 *
bogdanm 89:552587b429a1 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
bogdanm 89:552587b429a1 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
bogdanm 89:552587b429a1 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
bogdanm 89:552587b429a1 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
bogdanm 89:552587b429a1 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
bogdanm 89:552587b429a1 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
bogdanm 89:552587b429a1 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
bogdanm 89:552587b429a1 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
bogdanm 89:552587b429a1 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
bogdanm 89:552587b429a1 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
bogdanm 89:552587b429a1 34 *
bogdanm 89:552587b429a1 35 ******************************************************************************
bogdanm 89:552587b429a1 36 */
bogdanm 89:552587b429a1 37
bogdanm 89:552587b429a1 38 /* Define to prevent recursive inclusion -------------------------------------*/
bogdanm 89:552587b429a1 39 #ifndef __STM32F4xx_HAL_CORTEX_H
bogdanm 89:552587b429a1 40 #define __STM32F4xx_HAL_CORTEX_H
bogdanm 89:552587b429a1 41
bogdanm 89:552587b429a1 42 #ifdef __cplusplus
bogdanm 89:552587b429a1 43 extern "C" {
bogdanm 89:552587b429a1 44 #endif
bogdanm 89:552587b429a1 45
bogdanm 89:552587b429a1 46 /* Includes ------------------------------------------------------------------*/
bogdanm 89:552587b429a1 47 #include "stm32f4xx_hal_def.h"
bogdanm 89:552587b429a1 48
bogdanm 89:552587b429a1 49 /** @addtogroup STM32F4xx_HAL_Driver
bogdanm 89:552587b429a1 50 * @{
bogdanm 89:552587b429a1 51 */
bogdanm 89:552587b429a1 52
bogdanm 89:552587b429a1 53 /** @addtogroup CORTEX
bogdanm 89:552587b429a1 54 * @{
bogdanm 89:552587b429a1 55 */
bogdanm 89:552587b429a1 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
bogdanm 89:552587b429a1 99 /* Exported constants --------------------------------------------------------*/
bogdanm 89:552587b429a1 100
Kojto 99:dbbf35b96557 101 /** @defgroup CORTEX_Exported_Constants CORTEX Exported Constants
bogdanm 89:552587b429a1 102 * @{
bogdanm 89:552587b429a1 103 */
bogdanm 89:552587b429a1 104
Kojto 99:dbbf35b96557 105 /** @defgroup CORTEX_Preemption_Priority_Group CORTEX Preemption Priority Group
bogdanm 89:552587b429a1 106 * @{
bogdanm 89:552587b429a1 107 */
bogdanm 89:552587b429a1 108 #define NVIC_PRIORITYGROUP_0 ((uint32_t)0x00000007) /*!< 0 bits for pre-emption priority
bogdanm 89:552587b429a1 109 4 bits for subpriority */
bogdanm 89:552587b429a1 110 #define NVIC_PRIORITYGROUP_1 ((uint32_t)0x00000006) /*!< 1 bits for pre-emption priority
bogdanm 89:552587b429a1 111 3 bits for subpriority */
bogdanm 89:552587b429a1 112 #define NVIC_PRIORITYGROUP_2 ((uint32_t)0x00000005) /*!< 2 bits for pre-emption priority
bogdanm 89:552587b429a1 113 2 bits for subpriority */
bogdanm 89:552587b429a1 114 #define NVIC_PRIORITYGROUP_3 ((uint32_t)0x00000004) /*!< 3 bits for pre-emption priority
bogdanm 89:552587b429a1 115 1 bits for subpriority */
bogdanm 89:552587b429a1 116 #define NVIC_PRIORITYGROUP_4 ((uint32_t)0x00000003) /*!< 4 bits for pre-emption priority
bogdanm 89:552587b429a1 117 0 bits for subpriority */
Kojto 99:dbbf35b96557 118 /**
Kojto 99:dbbf35b96557 119 * @}
Kojto 99:dbbf35b96557 120 */
bogdanm 89:552587b429a1 121
Kojto 99:dbbf35b96557 122 /** @defgroup CORTEX_SysTick_clock_source CORTEX _SysTick clock source
Kojto 99:dbbf35b96557 123 * @{
Kojto 99:dbbf35b96557 124 */
Kojto 99:dbbf35b96557 125 #define SYSTICK_CLKSOURCE_HCLK_DIV8 ((uint32_t)0x00000000)
Kojto 99:dbbf35b96557 126 #define SYSTICK_CLKSOURCE_HCLK ((uint32_t)0x00000004)
bogdanm 89:552587b429a1 127
bogdanm 89:552587b429a1 128 /**
bogdanm 89:552587b429a1 129 * @}
bogdanm 89:552587b429a1 130 */
bogdanm 89:552587b429a1 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
bogdanm 89:552587b429a1 263 /**
bogdanm 89:552587b429a1 264 * @}
bogdanm 89:552587b429a1 265 */
bogdanm 89:552587b429a1 266
Kojto 99:dbbf35b96557 267
bogdanm 89:552587b429a1 268 /* Exported Macros -----------------------------------------------------------*/
Kojto 99:dbbf35b96557 269 /** @defgroup CORTEX_Exported_Macros CORTEX Exported Macros
Kojto 99:dbbf35b96557 270 * @{
Kojto 99:dbbf35b96557 271 */
bogdanm 89:552587b429a1 272
bogdanm 89:552587b429a1 273 /** @brief Configures the SysTick clock source.
bogdanm 89:552587b429a1 274 * @param __CLKSRC__: specifies the SysTick clock source.
bogdanm 89:552587b429a1 275 * This parameter can be one of the following values:
bogdanm 89:552587b429a1 276 * @arg SYSTICK_CLKSOURCE_HCLK_DIV8: AHB clock divided by 8 selected as SysTick clock source.
bogdanm 89:552587b429a1 277 * @arg SYSTICK_CLKSOURCE_HCLK: AHB clock selected as SysTick clock source.
bogdanm 89:552587b429a1 278 * @retval None
bogdanm 89:552587b429a1 279 */
bogdanm 89:552587b429a1 280 #define __HAL_CORTEX_SYSTICKCLK_CONFIG(__CLKSRC__) \
bogdanm 89:552587b429a1 281 do { \
bogdanm 89:552587b429a1 282 if ((__CLKSRC__) == SYSTICK_CLKSOURCE_HCLK) \
bogdanm 89:552587b429a1 283 { \
bogdanm 89:552587b429a1 284 SysTick->CTRL |= SYSTICK_CLKSOURCE_HCLK; \
bogdanm 89:552587b429a1 285 } \
bogdanm 89:552587b429a1 286 else \
bogdanm 89:552587b429a1 287 SysTick->CTRL &= ~SYSTICK_CLKSOURCE_HCLK; \
bogdanm 89:552587b429a1 288 } while(0)
bogdanm 89:552587b429a1 289 /**
bogdanm 89:552587b429a1 290 * @}
bogdanm 89:552587b429a1 291 */
bogdanm 89:552587b429a1 292
bogdanm 89:552587b429a1 293 /* Exported functions --------------------------------------------------------*/
Kojto 99:dbbf35b96557 294 /** @addtogroup CORTEX_Exported_Functions
Kojto 99:dbbf35b96557 295 * @{
Kojto 99:dbbf35b96557 296 */
Kojto 99:dbbf35b96557 297
Kojto 99:dbbf35b96557 298 /** @addtogroup CORTEX_Exported_Functions_Group1
Kojto 99:dbbf35b96557 299 * @{
Kojto 99:dbbf35b96557 300 */
Kojto 99:dbbf35b96557 301 /* Initialization and de-initialization functions *****************************/
bogdanm 89:552587b429a1 302 void HAL_NVIC_SetPriorityGrouping(uint32_t PriorityGroup);
bogdanm 89:552587b429a1 303 void HAL_NVIC_SetPriority(IRQn_Type IRQn, uint32_t PreemptPriority, uint32_t SubPriority);
bogdanm 89:552587b429a1 304 void HAL_NVIC_EnableIRQ(IRQn_Type IRQn);
bogdanm 89:552587b429a1 305 void HAL_NVIC_DisableIRQ(IRQn_Type IRQn);
bogdanm 89:552587b429a1 306 void HAL_NVIC_SystemReset(void);
bogdanm 89:552587b429a1 307 uint32_t HAL_SYSTICK_Config(uint32_t TicksNumb);
Kojto 99:dbbf35b96557 308 /**
Kojto 99:dbbf35b96557 309 * @}
Kojto 99:dbbf35b96557 310 */
bogdanm 89:552587b429a1 311
Kojto 99:dbbf35b96557 312 /** @addtogroup CORTEX_Exported_Functions_Group2
Kojto 99:dbbf35b96557 313 * @{
Kojto 99:dbbf35b96557 314 */
Kojto 99:dbbf35b96557 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 */
bogdanm 89:552587b429a1 319 uint32_t HAL_NVIC_GetPriorityGrouping(void);
bogdanm 89:552587b429a1 320 void HAL_NVIC_GetPriority(IRQn_Type IRQn, uint32_t PriorityGroup, uint32_t* pPreemptPriority, uint32_t* pSubPriority);
bogdanm 89:552587b429a1 321 uint32_t HAL_NVIC_GetPendingIRQ(IRQn_Type IRQn);
bogdanm 89:552587b429a1 322 void HAL_NVIC_SetPendingIRQ(IRQn_Type IRQn);
bogdanm 89:552587b429a1 323 void HAL_NVIC_ClearPendingIRQ(IRQn_Type IRQn);
bogdanm 89:552587b429a1 324 uint32_t HAL_NVIC_GetActive(IRQn_Type IRQn);
bogdanm 89:552587b429a1 325 void HAL_SYSTICK_CLKSourceConfig(uint32_t CLKSource);
bogdanm 89:552587b429a1 326 void HAL_SYSTICK_IRQHandler(void);
bogdanm 89:552587b429a1 327 void HAL_SYSTICK_Callback(void);
Kojto 99:dbbf35b96557 328 /**
Kojto 99:dbbf35b96557 329 * @}
Kojto 99:dbbf35b96557 330 */
Kojto 99:dbbf35b96557 331
Kojto 99:dbbf35b96557 332 /**
Kojto 99:dbbf35b96557 333 * @}
Kojto 99:dbbf35b96557 334 */
Kojto 99:dbbf35b96557 335
Kojto 99:dbbf35b96557 336 /* Private types -------------------------------------------------------------*/
Kojto 99:dbbf35b96557 337 /* Private variables ---------------------------------------------------------*/
Kojto 99:dbbf35b96557 338 /* Private constants ---------------------------------------------------------*/
Kojto 99:dbbf35b96557 339 /* Private macros ------------------------------------------------------------*/
Kojto 99:dbbf35b96557 340 /** @defgroup CORTEX_Private_Macros CORTEX Private Macros
Kojto 99:dbbf35b96557 341 * @{
Kojto 99:dbbf35b96557 342 */
Kojto 99:dbbf35b96557 343 #define IS_NVIC_PRIORITY_GROUP(GROUP) (((GROUP) == NVIC_PRIORITYGROUP_0) || \
Kojto 99:dbbf35b96557 344 ((GROUP) == NVIC_PRIORITYGROUP_1) || \
Kojto 99:dbbf35b96557 345 ((GROUP) == NVIC_PRIORITYGROUP_2) || \
Kojto 99:dbbf35b96557 346 ((GROUP) == NVIC_PRIORITYGROUP_3) || \
Kojto 99:dbbf35b96557 347 ((GROUP) == NVIC_PRIORITYGROUP_4))
Kojto 99:dbbf35b96557 348
Kojto 99:dbbf35b96557 349 #define IS_NVIC_PREEMPTION_PRIORITY(PRIORITY) ((PRIORITY) < 0x10)
Kojto 99:dbbf35b96557 350
Kojto 99:dbbf35b96557 351 #define IS_NVIC_SUB_PRIORITY(PRIORITY) ((PRIORITY) < 0x10)
Kojto 99:dbbf35b96557 352
Kojto 99:dbbf35b96557 353 #define IS_NVIC_DEVICE_IRQ(IRQ) ((IRQ) >= 0x00)
Kojto 99:dbbf35b96557 354
Kojto 99:dbbf35b96557 355 #define IS_SYSTICK_CLK_SOURCE(SOURCE) (((SOURCE) == SYSTICK_CLKSOURCE_HCLK) || \
Kojto 99:dbbf35b96557 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 99:dbbf35b96557 471 /**
Kojto 99:dbbf35b96557 472 * @}
Kojto 110:165afa46840b 473 */
bogdanm 89:552587b429a1 474
bogdanm 89:552587b429a1 475 /**
bogdanm 89:552587b429a1 476 * @}
bogdanm 89:552587b429a1 477 */
bogdanm 89:552587b429a1 478
bogdanm 89:552587b429a1 479 /**
bogdanm 89:552587b429a1 480 * @}
bogdanm 89:552587b429a1 481 */
bogdanm 89:552587b429a1 482
bogdanm 89:552587b429a1 483 #ifdef __cplusplus
bogdanm 89:552587b429a1 484 }
bogdanm 89:552587b429a1 485 #endif
bogdanm 89:552587b429a1 486
bogdanm 89:552587b429a1 487 #endif /* __STM32F4xx_HAL_CORTEX_H */
bogdanm 89:552587b429a1 488
bogdanm 89:552587b429a1 489
bogdanm 89:552587b429a1 490 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/