CARME-M4 BSP  V1.5
misc.h
Go to the documentation of this file.
1 
29 /* Define to prevent recursive inclusion -------------------------------------*/
30 #ifndef __MISC_H
31 #define __MISC_H
32 
33 #ifdef __cplusplus
34  extern "C" {
35 #endif
36 
37 /* Includes ------------------------------------------------------------------*/
38 #include "stm32f4xx.h"
39 
48 /* Exported types ------------------------------------------------------------*/
49 
54 typedef struct
55 {
56  uint8_t NVIC_IRQChannel;
71  FunctionalState NVIC_IRQChannelCmd;
75 
76 /* Exported constants --------------------------------------------------------*/
77 
86 #define NVIC_VectTab_RAM ((uint32_t)0x20000000)
87 #define NVIC_VectTab_FLASH ((uint32_t)0x08000000)
88 #define IS_NVIC_VECTTAB(VECTTAB) (((VECTTAB) == NVIC_VectTab_RAM) || \
89  ((VECTTAB) == NVIC_VectTab_FLASH))
90 
98 #define NVIC_LP_SEVONPEND ((uint8_t)0x10)
99 #define NVIC_LP_SLEEPDEEP ((uint8_t)0x04)
100 #define NVIC_LP_SLEEPONEXIT ((uint8_t)0x02)
101 #define IS_NVIC_LP(LP) (((LP) == NVIC_LP_SEVONPEND) || \
102  ((LP) == NVIC_LP_SLEEPDEEP) || \
103  ((LP) == NVIC_LP_SLEEPONEXIT))
104 
112 #define NVIC_PriorityGroup_0 ((uint32_t)0x700)
114 #define NVIC_PriorityGroup_1 ((uint32_t)0x600)
116 #define NVIC_PriorityGroup_2 ((uint32_t)0x500)
118 #define NVIC_PriorityGroup_3 ((uint32_t)0x400)
120 #define NVIC_PriorityGroup_4 ((uint32_t)0x300)
123 #define IS_NVIC_PRIORITY_GROUP(GROUP) (((GROUP) == NVIC_PriorityGroup_0) || \
124  ((GROUP) == NVIC_PriorityGroup_1) || \
125  ((GROUP) == NVIC_PriorityGroup_2) || \
126  ((GROUP) == NVIC_PriorityGroup_3) || \
127  ((GROUP) == NVIC_PriorityGroup_4))
128 
129 #define IS_NVIC_PREEMPTION_PRIORITY(PRIORITY) ((PRIORITY) < 0x10)
130 
131 #define IS_NVIC_SUB_PRIORITY(PRIORITY) ((PRIORITY) < 0x10)
132 
133 #define IS_NVIC_OFFSET(OFFSET) ((OFFSET) < 0x000FFFFF)
134 
143 #define SysTick_CLKSource_HCLK_Div8 ((uint32_t)0xFFFFFFFB)
144 #define SysTick_CLKSource_HCLK ((uint32_t)0x00000004)
145 #define IS_SYSTICK_CLK_SOURCE(SOURCE) (((SOURCE) == SysTick_CLKSource_HCLK) || \
146  ((SOURCE) == SysTick_CLKSource_HCLK_Div8))
147 
155 /* Exported macro ------------------------------------------------------------*/
156 /* Exported functions --------------------------------------------------------*/
157 
158 void NVIC_PriorityGroupConfig(uint32_t NVIC_PriorityGroup);
159 void NVIC_Init(NVIC_InitTypeDef* NVIC_InitStruct);
160 void NVIC_SetVectorTable(uint32_t NVIC_VectTab, uint32_t Offset);
161 void NVIC_SystemLPConfig(uint8_t LowPowerMode, FunctionalState NewState);
162 void SysTick_CLKSourceConfig(uint32_t SysTick_CLKSource);
163 
164 #ifdef __cplusplus
165 }
166 #endif
167 
168 #endif /* __MISC_H */
169 
178 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
void NVIC_Init(NVIC_InitTypeDef *NVIC_InitStruct)
Initializes the NVIC peripheral according to the specified parameters in the NVIC_InitStruct.
Definition: misc.c:136
uint8_t NVIC_IRQChannelPreemptionPriority
Definition: misc.h:61
void NVIC_SetVectorTable(uint32_t NVIC_VectTab, uint32_t Offset)
Sets the vector table location and Offset.
Definition: misc.c:180
NVIC Init Structure definition.
Definition: misc.h:54
uint8_t NVIC_IRQChannel
Definition: misc.h:56
FunctionalState NVIC_IRQChannelCmd
Definition: misc.h:71
uint8_t NVIC_IRQChannelSubPriority
Definition: misc.h:66
void NVIC_PriorityGroupConfig(uint32_t NVIC_PriorityGroup)
Configures the priority grouping: pre-emption priority and subpriority.
Definition: misc.c:118
void NVIC_SystemLPConfig(uint8_t LowPowerMode, FunctionalState NewState)
Selects the condition for the system to enter low power mode.
Definition: misc.c:199
void SysTick_CLKSourceConfig(uint32_t SysTick_CLKSource)
Configures the SysTick clock source.
Definition: misc.c:223