Rev 2 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 2 | Rev 28 | ||
|---|---|---|---|
| Line 1... | Line 1... | ||
| 1 | /** |
1 | /** |
| 2 | ****************************************************************************** |
2 | ****************************************************************************** |
| 3 | * @file stm32l1xx_hal_cortex.h |
3 | * @file stm32l1xx_hal_cortex.h |
| 4 | * @author MCD Application Team |
4 | * @author MCD Application Team |
| 5 | * @version V1.2.0 |
- | |
| 6 | * @date 01-July-2016 |
- | |
| 7 | * @brief Header file of CORTEX HAL module. |
5 | * @brief Header file of CORTEX HAL module. |
| 8 | ****************************************************************************** |
6 | ****************************************************************************** |
| 9 | * @attention |
7 | * @attention |
| 10 | * |
8 | * |
| 11 | * <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2> |
9 | * <h2><center>© Copyright (c) 2017 STMicroelectronics. |
| - | 10 | * All rights reserved.</center></h2> |
|
| 12 | * |
11 | * |
| 13 | * Redistribution and use in source and binary forms, with or without modification, |
12 | * This software component is licensed by ST under BSD 3-Clause license, |
| 14 | * are permitted provided that the following conditions are met: |
13 | * the "License"; You may not use this file except in compliance with the |
| 15 | * 1. Redistributions of source code must retain the above copyright notice, |
- | |
| 16 | * this list of conditions and the following disclaimer. |
- | |
| 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
- | |
| 18 | * this list of conditions and the following disclaimer in the documentation |
- | |
| 19 | * and/or other materials provided with the distribution. |
14 | * License. You may obtain a copy of the License at: |
| 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
- | |
| 21 | * may be used to endorse or promote products derived from this software |
15 | * opensource.org/licenses/BSD-3-Clause |
| 22 | * without specific prior written permission. |
- | |
| 23 | * |
- | |
| 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
- | |
| 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
- | |
| 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
- | |
| 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
- | |
| 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
- | |
| 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
- | |
| 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
- | |
| 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
- | |
| 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
- | |
| 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
- | |
| 34 | * |
16 | * |
| 35 | ****************************************************************************** |
17 | ****************************************************************************** |
| 36 | */ |
18 | */ |
| 37 | 19 | ||
| 38 | /* Define to prevent recursive inclusion -------------------------------------*/ |
20 | /* Define to prevent recursive inclusion -------------------------------------*/ |
| Line 106... | Line 88... | ||
| 106 | 88 | ||
| 107 | /** @defgroup CORTEX_Preemption_Priority_Group CORTEX Preemption Priority Group |
89 | /** @defgroup CORTEX_Preemption_Priority_Group CORTEX Preemption Priority Group |
| 108 | * @{ |
90 | * @{ |
| 109 | */ |
91 | */ |
| 110 | 92 | ||
| 111 | #define NVIC_PRIORITYGROUP_0 ((uint32_t)0x00000007) /*!< 0 bits for pre-emption priority |
93 | #define NVIC_PRIORITYGROUP_0 (0x00000007U) /*!< 0 bits for pre-emption priority |
| 112 | 4 bits for subpriority */ |
94 | 4 bits for subpriority */ |
| 113 | #define NVIC_PRIORITYGROUP_1 ((uint32_t)0x00000006) /*!< 1 bits for pre-emption priority |
95 | #define NVIC_PRIORITYGROUP_1 (0x00000006U) /*!< 1 bits for pre-emption priority |
| 114 | 3 bits for subpriority */ |
96 | 3 bits for subpriority */ |
| 115 | #define NVIC_PRIORITYGROUP_2 ((uint32_t)0x00000005) /*!< 2 bits for pre-emption priority |
97 | #define NVIC_PRIORITYGROUP_2 (0x00000005U) /*!< 2 bits for pre-emption priority |
| 116 | 2 bits for subpriority */ |
98 | 2 bits for subpriority */ |
| 117 | #define NVIC_PRIORITYGROUP_3 ((uint32_t)0x00000004) /*!< 3 bits for pre-emption priority |
99 | #define NVIC_PRIORITYGROUP_3 (0x00000004U) /*!< 3 bits for pre-emption priority |
| 118 | 1 bits for subpriority */ |
100 | 1 bits for subpriority */ |
| 119 | #define NVIC_PRIORITYGROUP_4 ((uint32_t)0x00000003) /*!< 4 bits for pre-emption priority |
101 | #define NVIC_PRIORITYGROUP_4 (0x00000003U) /*!< 4 bits for pre-emption priority |
| 120 | 0 bits for subpriority */ |
102 | 0 bits for subpriority */ |
| 121 | /** |
103 | /** |
| 122 | * @} |
104 | * @} |
| 123 | */ |
105 | */ |
| 124 | 106 | ||
| 125 | /** @defgroup CORTEX_SysTick_clock_source CORTEX SysTick clock source |
107 | /** @defgroup CORTEX_SysTick_clock_source CORTEX SysTick clock source |
| 126 | * @{ |
108 | * @{ |
| 127 | */ |
109 | */ |
| 128 | #define SYSTICK_CLKSOURCE_HCLK_DIV8 ((uint32_t)0x00000000) |
110 | #define SYSTICK_CLKSOURCE_HCLK_DIV8 (0x00000000U) |
| 129 | #define SYSTICK_CLKSOURCE_HCLK ((uint32_t)0x00000004) |
111 | #define SYSTICK_CLKSOURCE_HCLK (0x00000004U) |
| 130 | 112 | ||
| 131 | /** |
113 | /** |
| 132 | * @} |
114 | * @} |
| 133 | */ |
115 | */ |
| 134 | 116 | ||
| 135 | #if (__MPU_PRESENT == 1) |
117 | #if (__MPU_PRESENT == 1) |
| 136 | /** @defgroup CORTEX_MPU_HFNMI_PRIVDEF_Control MPU HFNMI and PRIVILEGED Access control |
118 | /** @defgroup CORTEX_MPU_HFNMI_PRIVDEF_Control MPU HFNMI and PRIVILEGED Access control |
| 137 | * @{ |
119 | * @{ |
| 138 | */ |
120 | */ |
| 139 | #define MPU_HFNMI_PRIVDEF_NONE ((uint32_t)0x00000000) |
121 | #define MPU_HFNMI_PRIVDEF_NONE (0x00000000U) |
| 140 | #define MPU_HARDFAULT_NMI ((uint32_t)0x00000002) |
122 | #define MPU_HARDFAULT_NMI (MPU_CTRL_HFNMIENA_Msk) |
| 141 | #define MPU_PRIVILEGED_DEFAULT ((uint32_t)0x00000004) |
123 | #define MPU_PRIVILEGED_DEFAULT (MPU_CTRL_PRIVDEFENA_Msk) |
| 142 | #define MPU_HFNMI_PRIVDEF ((uint32_t)0x00000006) |
124 | #define MPU_HFNMI_PRIVDEF (MPU_CTRL_HFNMIENA_Msk | MPU_CTRL_PRIVDEFENA_Msk) |
| - | 125 | ||
| 143 | /** |
126 | /** |
| 144 | * @} |
127 | * @} |
| 145 | */ |
128 | */ |
| 146 | 129 | ||
| 147 | /** @defgroup CORTEX_MPU_Region_Enable CORTEX MPU Region Enable |
130 | /** @defgroup CORTEX_MPU_Region_Enable CORTEX MPU Region Enable |
| Line 384... | Line 367... | ||
| 384 | /** @defgroup CORTEX_Private_Functions CORTEX Private Functions |
367 | /** @defgroup CORTEX_Private_Functions CORTEX Private Functions |
| 385 | * @brief CORTEX private functions |
368 | * @brief CORTEX private functions |
| 386 | * @{ |
369 | * @{ |
| 387 | */ |
370 | */ |
| 388 | 371 | ||
| 389 | #if (__MPU_PRESENT == 1) |
- | |
| 390 | /** |
- | |
| 391 | * @brief Disables the MPU |
- | |
| 392 | * @retval None |
- | |
| 393 | */ |
- | |
| 394 | __STATIC_INLINE void HAL_MPU_Disable(void) |
- | |
| 395 | { |
- | |
| 396 | /* Disable fault exceptions */ |
- | |
| 397 | SCB->SHCSR &= ~SCB_SHCSR_MEMFAULTENA_Msk; |
- | |
| 398 | - | ||
| 399 | /* Disable the MPU */ |
- | |
| 400 | MPU->CTRL &= ~MPU_CTRL_ENABLE_Msk; |
- | |
| 401 | } |
- | |
| 402 | - | ||
| 403 | /** |
- | |
| 404 | * @brief Enables the MPU |
- | |
| 405 | * @param MPU_Control: Specifies the control mode of the MPU during hard fault, |
- | |
| 406 | * NMI, FAULTMASK and privileged accessto the default memory |
- | |
| 407 | * This parameter can be one of the following values: |
- | |
| 408 | * @arg MPU_HFNMI_PRIVDEF_NONE |
- | |
| 409 | * @arg MPU_HARDFAULT_NMI |
- | |
| 410 | * @arg MPU_PRIVILEGED_DEFAULT |
- | |
| 411 | * @arg MPU_HFNMI_PRIVDEF |
- | |
| 412 | * @retval None |
- | |
| 413 | */ |
- | |
| 414 | __STATIC_INLINE void HAL_MPU_Enable(uint32_t MPU_Control) |
- | |
| 415 | { |
- | |
| 416 | /* Enable the MPU */ |
- | |
| 417 | MPU->CTRL = MPU_Control | MPU_CTRL_ENABLE_Msk; |
- | |
| 418 | - | ||
| 419 | /* Enable fault exceptions */ |
- | |
| 420 | SCB->SHCSR |= SCB_SHCSR_MEMFAULTENA_Msk; |
- | |
| 421 | } |
- | |
| 422 | #endif /* __MPU_PRESENT */ |
- | |
| 423 | 372 | ||
| 424 | /** |
373 | /** |
| 425 | * @} |
374 | * @} |
| 426 | */ |
375 | */ |
| 427 | 376 | ||
| Line 447... | Line 396... | ||
| 447 | /** @addtogroup CORTEX_Exported_Functions_Group2 |
396 | /** @addtogroup CORTEX_Exported_Functions_Group2 |
| 448 | * @{ |
397 | * @{ |
| 449 | */ |
398 | */ |
| 450 | /* Peripheral Control functions ***********************************************/ |
399 | /* Peripheral Control functions ***********************************************/ |
| 451 | #if (__MPU_PRESENT == 1) |
400 | #if (__MPU_PRESENT == 1) |
| - | 401 | void HAL_MPU_Enable(uint32_t MPU_Control); |
|
| - | 402 | void HAL_MPU_Disable(void); |
|
| 452 | void HAL_MPU_ConfigRegion(MPU_Region_InitTypeDef *MPU_Init); |
403 | void HAL_MPU_ConfigRegion(MPU_Region_InitTypeDef *MPU_Init); |
| 453 | #endif /* __MPU_PRESENT */ |
404 | #endif /* __MPU_PRESENT */ |
| 454 | uint32_t HAL_NVIC_GetPriorityGrouping(void); |
405 | uint32_t HAL_NVIC_GetPriorityGrouping(void); |
| 455 | void HAL_NVIC_GetPriority(IRQn_Type IRQn, uint32_t PriorityGroup, uint32_t* pPreemptPriority, uint32_t* pSubPriority); |
406 | void HAL_NVIC_GetPriority(IRQn_Type IRQn, uint32_t PriorityGroup, uint32_t* pPreemptPriority, uint32_t* pSubPriority); |
| 456 | uint32_t HAL_NVIC_GetPendingIRQ(IRQn_Type IRQn); |
407 | uint32_t HAL_NVIC_GetPendingIRQ(IRQn_Type IRQn); |