]> git.gir.st - tmk_keyboard.git/blob - tool/mbed/mbed-sdk/libraries/mbed/targets/cmsis/TARGET_STM/TARGET_STM32F4/stm32f4xx_hal_cortex.h
Squashed 'tmk_core/' changes from 7967731..b9e0ea0
[tmk_keyboard.git] / tool / mbed / mbed-sdk / libraries / mbed / targets / cmsis / TARGET_STM / TARGET_STM32F4 / stm32f4xx_hal_cortex.h
1 /**
2 ******************************************************************************
3 * @file stm32f4xx_hal_cortex.h
4 * @author MCD Application Team
5 * @version V1.1.0
6 * @date 19-June-2014
7 * @brief Header file of CORTEX HAL module.
8 ******************************************************************************
9 * @attention
10 *
11 * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
12 *
13 * Redistribution and use in source and binary forms, with or without modification,
14 * are permitted provided that the following conditions are met:
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.
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
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 *
35 ******************************************************************************
36 */
37
38 /* Define to prevent recursive inclusion -------------------------------------*/
39 #ifndef __STM32F4xx_HAL_CORTEX_H
40 #define __STM32F4xx_HAL_CORTEX_H
41
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
45
46 /* Includes ------------------------------------------------------------------*/
47 #include "stm32f4xx_hal_def.h"
48
49 /** @addtogroup STM32F4xx_HAL_Driver
50 * @{
51 */
52
53 /** @addtogroup CORTEX
54 * @{
55 */
56 /* Exported types ------------------------------------------------------------*/
57 /* Exported constants --------------------------------------------------------*/
58
59 /** @defgroup CORTEX_Exported_Constants
60 * @{
61 */
62
63
64 /** @defgroup CORTEX_Preemption_Priority_Group
65 * @{
66 */
67
68 #define NVIC_PRIORITYGROUP_0 ((uint32_t)0x00000007) /*!< 0 bits for pre-emption priority
69 4 bits for subpriority */
70 #define NVIC_PRIORITYGROUP_1 ((uint32_t)0x00000006) /*!< 1 bits for pre-emption priority
71 3 bits for subpriority */
72 #define NVIC_PRIORITYGROUP_2 ((uint32_t)0x00000005) /*!< 2 bits for pre-emption priority
73 2 bits for subpriority */
74 #define NVIC_PRIORITYGROUP_3 ((uint32_t)0x00000004) /*!< 3 bits for pre-emption priority
75 1 bits for subpriority */
76 #define NVIC_PRIORITYGROUP_4 ((uint32_t)0x00000003) /*!< 4 bits for pre-emption priority
77 0 bits for subpriority */
78
79 #define IS_NVIC_PRIORITY_GROUP(GROUP) (((GROUP) == NVIC_PRIORITYGROUP_0) || \
80 ((GROUP) == NVIC_PRIORITYGROUP_1) || \
81 ((GROUP) == NVIC_PRIORITYGROUP_2) || \
82 ((GROUP) == NVIC_PRIORITYGROUP_3) || \
83 ((GROUP) == NVIC_PRIORITYGROUP_4))
84
85 #define IS_NVIC_PREEMPTION_PRIORITY(PRIORITY) ((PRIORITY) < 0x10)
86
87 #define IS_NVIC_SUB_PRIORITY(PRIORITY) ((PRIORITY) < 0x10)
88
89 /**
90 * @}
91 */
92
93 /** @defgroup CORTEX_SysTick_clock_source
94 * @{
95 */
96 #define SYSTICK_CLKSOURCE_HCLK_DIV8 ((uint32_t)0x00000000)
97 #define SYSTICK_CLKSOURCE_HCLK ((uint32_t)0x00000004)
98 #define IS_SYSTICK_CLK_SOURCE(SOURCE) (((SOURCE) == SYSTICK_CLKSOURCE_HCLK) || \
99 ((SOURCE) == SYSTICK_CLKSOURCE_HCLK_DIV8))
100 /**
101 * @}
102 */
103
104 /* Exported Macros -----------------------------------------------------------*/
105
106 /** @brief Configures the SysTick clock source.
107 * @param __CLKSRC__: specifies the SysTick clock source.
108 * This parameter can be one of the following values:
109 * @arg SYSTICK_CLKSOURCE_HCLK_DIV8: AHB clock divided by 8 selected as SysTick clock source.
110 * @arg SYSTICK_CLKSOURCE_HCLK: AHB clock selected as SysTick clock source.
111 * @retval None
112 */
113 #define __HAL_CORTEX_SYSTICKCLK_CONFIG(__CLKSRC__) \
114 do { \
115 if ((__CLKSRC__) == SYSTICK_CLKSOURCE_HCLK) \
116 { \
117 SysTick->CTRL |= SYSTICK_CLKSOURCE_HCLK; \
118 } \
119 else \
120 SysTick->CTRL &= ~SYSTICK_CLKSOURCE_HCLK; \
121 } while(0)
122
123 /**
124 * @}
125 */
126
127 /* Exported macro ------------------------------------------------------------*/
128 /* Exported functions --------------------------------------------------------*/
129 /* Initialization and de-initialization functions *******************************/
130 void HAL_NVIC_SetPriorityGrouping(uint32_t PriorityGroup);
131 void HAL_NVIC_SetPriority(IRQn_Type IRQn, uint32_t PreemptPriority, uint32_t SubPriority);
132 void HAL_NVIC_EnableIRQ(IRQn_Type IRQn);
133 void HAL_NVIC_DisableIRQ(IRQn_Type IRQn);
134 void HAL_NVIC_SystemReset(void);
135 uint32_t HAL_SYSTICK_Config(uint32_t TicksNumb);
136
137 /* Peripheral Control functions *************************************************/
138 uint32_t HAL_NVIC_GetPriorityGrouping(void);
139 void HAL_NVIC_GetPriority(IRQn_Type IRQn, uint32_t PriorityGroup, uint32_t* pPreemptPriority, uint32_t* pSubPriority);
140 uint32_t HAL_NVIC_GetPendingIRQ(IRQn_Type IRQn);
141 void HAL_NVIC_SetPendingIRQ(IRQn_Type IRQn);
142 void HAL_NVIC_ClearPendingIRQ(IRQn_Type IRQn);
143 uint32_t HAL_NVIC_GetActive(IRQn_Type IRQn);
144 void HAL_SYSTICK_CLKSourceConfig(uint32_t CLKSource);
145 void HAL_SYSTICK_IRQHandler(void);
146 void HAL_SYSTICK_Callback(void);
147
148 /**
149 * @}
150 */
151
152 /**
153 * @}
154 */
155
156 #ifdef __cplusplus
157 }
158 #endif
159
160 #endif /* __STM32F4xx_HAL_CORTEX_H */
161
162
163 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
Imprint / Impressum