L4 HAL Drivers

Committer:
EricLew
Date:
Mon Nov 02 19:37:23 2015 +0000
Revision:
0:80ee8f3b695e
Errors are with definitions of LCD and QSPI functions. I believe all .h and .c files are  uploaded, but there may need to be certain functions called.

Who changed what in which revision?

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