2 ******************************************************************************
\r
3 * @file stm32f4xx_hal_cortex.h
\r
4 * @author MCD Application Team
\r
6 * @date 18-February-2014
\r
7 * @brief Header file of CORTEX HAL module.
\r
8 ******************************************************************************
\r
11 * <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
\r
13 * Redistribution and use in source and binary forms, with or without modification,
\r
14 * are permitted provided that the following conditions are met:
\r
15 * 1. Redistributions of source code must retain the above copyright notice,
\r
16 * this list of conditions and the following disclaimer.
\r
17 * 2. Redistributions in binary form must reproduce the above copyright notice,
\r
18 * this list of conditions and the following disclaimer in the documentation
\r
19 * and/or other materials provided with the distribution.
\r
20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
\r
21 * may be used to endorse or promote products derived from this software
\r
22 * without specific prior written permission.
\r
24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
\r
25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
\r
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
\r
27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
\r
28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
\r
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
\r
30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
\r
31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
\r
32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
\r
33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\r
35 ******************************************************************************
\r
38 /* Define to prevent recursive inclusion -------------------------------------*/
\r
39 #ifndef __STM32F4xx_HAL_CORTEX_H
\r
40 #define __STM32F4xx_HAL_CORTEX_H
\r
46 /* Includes ------------------------------------------------------------------*/
\r
47 #include "stm32f4xx_hal_def.h"
\r
49 /** @addtogroup STM32F4xx_HAL_Driver
\r
53 /** @addtogroup CORTEX
\r
56 /* Exported types ------------------------------------------------------------*/
\r
57 /* Exported constants --------------------------------------------------------*/
\r
59 /** @defgroup CORTEX_Exported_Constants
\r
64 /** @defgroup CORTEX_Preemption_Priority_Group
\r
68 #define NVIC_PRIORITYGROUP_0 ((uint32_t)0x00000007) /*!< 0 bits for pre-emption priority
\r
69 4 bits for subpriority */
\r
70 #define NVIC_PRIORITYGROUP_1 ((uint32_t)0x00000006) /*!< 1 bits for pre-emption priority
\r
71 3 bits for subpriority */
\r
72 #define NVIC_PRIORITYGROUP_2 ((uint32_t)0x00000005) /*!< 2 bits for pre-emption priority
\r
73 2 bits for subpriority */
\r
74 #define NVIC_PRIORITYGROUP_3 ((uint32_t)0x00000004) /*!< 3 bits for pre-emption priority
\r
75 1 bits for subpriority */
\r
76 #define NVIC_PRIORITYGROUP_4 ((uint32_t)0x00000003) /*!< 4 bits for pre-emption priority
\r
77 0 bits for subpriority */
\r
79 #define IS_NVIC_PRIORITY_GROUP(GROUP) (((GROUP) == NVIC_PRIORITYGROUP_0) || \
\r
80 ((GROUP) == NVIC_PRIORITYGROUP_1) || \
\r
81 ((GROUP) == NVIC_PRIORITYGROUP_2) || \
\r
82 ((GROUP) == NVIC_PRIORITYGROUP_3) || \
\r
83 ((GROUP) == NVIC_PRIORITYGROUP_4))
\r
85 #define IS_NVIC_PREEMPTION_PRIORITY(PRIORITY) ((PRIORITY) < 0x10)
\r
87 #define IS_NVIC_SUB_PRIORITY(PRIORITY) ((PRIORITY) < 0x10)
\r
93 /** @defgroup CORTEX_SysTick_clock_source
\r
96 #define SYSTICK_CLKSOURCE_HCLK_DIV8 ((uint32_t)0x00000000)
\r
97 #define SYSTICK_CLKSOURCE_HCLK ((uint32_t)0x00000004)
\r
98 #define IS_SYSTICK_CLK_SOURCE(SOURCE) (((SOURCE) == SYSTICK_CLKSOURCE_HCLK) || \
\r
99 ((SOURCE) == SYSTICK_CLKSOURCE_HCLK_DIV8))
\r
104 /* Exported Macros -----------------------------------------------------------*/
\r
106 /** @brief Configures the SysTick clock source.
\r
107 * @param __CLKSRC__: specifies the SysTick clock source.
\r
108 * This parameter can be one of the following values:
\r
109 * @arg SYSTICK_CLKSOURCE_HCLK_DIV8: AHB clock divided by 8 selected as SysTick clock source.
\r
110 * @arg SYSTICK_CLKSOURCE_HCLK: AHB clock selected as SysTick clock source.
\r
113 #define __HAL_CORTEX_SYSTICKCLK_CONFIG(__CLKSRC__) \
\r
115 if ((__CLKSRC__) == SYSTICK_CLKSOURCE_HCLK) \
\r
117 SysTick->CTRL |= SYSTICK_CLKSOURCE_HCLK; \
\r
120 SysTick->CTRL &= ~SYSTICK_CLKSOURCE_HCLK; \
\r
127 /* Exported macro ------------------------------------------------------------*/
\r
128 /* Exported functions --------------------------------------------------------*/
\r
129 /* Initialization and de-initialization functions *******************************/
\r
130 void HAL_NVIC_SetPriorityGrouping(uint32_t PriorityGroup);
\r
131 void HAL_NVIC_SetPriority(IRQn_Type IRQn, uint32_t PreemptPriority, uint32_t SubPriority);
\r
132 void HAL_NVIC_EnableIRQ(IRQn_Type IRQn);
\r
133 void HAL_NVIC_DisableIRQ(IRQn_Type IRQn);
\r
134 void HAL_NVIC_SystemReset(void);
\r
135 uint32_t HAL_SYSTICK_Config(uint32_t TicksNumb);
\r
137 /* Peripheral Control functions *************************************************/
\r
138 uint32_t HAL_NVIC_GetPriorityGrouping(void);
\r
139 void HAL_NVIC_GetPriority(IRQn_Type IRQn, uint32_t PriorityGroup, uint32_t* pPreemptPriority, uint32_t* pSubPriority);
\r
140 uint32_t HAL_NVIC_GetPendingIRQ(IRQn_Type IRQn);
\r
141 void HAL_NVIC_SetPendingIRQ(IRQn_Type IRQn);
\r
142 void HAL_NVIC_ClearPendingIRQ(IRQn_Type IRQn);
\r
143 uint32_t HAL_NVIC_GetActive(IRQn_Type IRQn);
\r
144 void HAL_SYSTICK_CLKSourceConfig(uint32_t CLKSource);
\r
145 void HAL_SYSTICK_IRQHandler(void);
\r
146 void HAL_SYSTICK_Callback(void);
\r
160 #endif /* __STM32F4xx_HAL_CORTEX_H */
\r
163 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
\r