MG32F10x Standard Peripherals Firmware Library
misc.h
Go to the documentation of this file.
1 
10 /* Define to prevent recursive inclusion -------------------------------------*/
11 #ifndef __MISC_H
12 #define __MISC_H
13 
14 #ifdef __cplusplus
15  extern "C" {
16 #endif
17 
18 /* Includes ------------------------------------------------------------------*/
19 #include "mg32f10x.h"
20 
37 typedef struct
38 {
39  uint8_t NVIC_IRQChannel;
52  FunctionalState NVIC_IRQChannelCmd;
56 
102 #define NVIC_VectTab_RAM ((uint32_t)0x20000000)
103 #define NVIC_VectTab_FLASH ((uint32_t)0x08000000)
104 #define IS_NVIC_VECTTAB(VECTTAB) (((VECTTAB) == NVIC_VectTab_RAM) || \
105  ((VECTTAB) == NVIC_VectTab_FLASH))
106 
114 #define NVIC_LP_SEVONPEND ((uint8_t)0x10)
115 #define NVIC_LP_SLEEPDEEP ((uint8_t)0x04)
116 #define NVIC_LP_SLEEPONEXIT ((uint8_t)0x02)
117 #define IS_NVIC_LP(LP) (((LP) == NVIC_LP_SEVONPEND) || \
118  ((LP) == NVIC_LP_SLEEPDEEP) || \
119  ((LP) == NVIC_LP_SLEEPONEXIT))
120 
128 #define NVIC_PriorityGroup_0 ((uint32_t)0x700)
130 #define NVIC_PriorityGroup_1 ((uint32_t)0x600)
132 #define NVIC_PriorityGroup_2 ((uint32_t)0x500)
134 #define NVIC_PriorityGroup_3 ((uint32_t)0x400)
136 #define NVIC_PriorityGroup_4 ((uint32_t)0x300)
139 #define IS_NVIC_PRIORITY_GROUP(GROUP) (((GROUP) == NVIC_PriorityGroup_0) || \
140  ((GROUP) == NVIC_PriorityGroup_1) || \
141  ((GROUP) == NVIC_PriorityGroup_2) || \
142  ((GROUP) == NVIC_PriorityGroup_3) || \
143  ((GROUP) == NVIC_PriorityGroup_4))
144 
145 #define IS_NVIC_PREEMPTION_PRIORITY(PRIORITY) ((PRIORITY) < 0x10)
146 
147 #define IS_NVIC_SUB_PRIORITY(PRIORITY) ((PRIORITY) < 0x10)
148 
149 #define IS_NVIC_OFFSET(OFFSET) ((OFFSET) < 0x000FFFFF)
150 
159 #define SysTick_CLKSource_HCLK_Div8 ((uint32_t)0xFFFFFFFB)
160 #define SysTick_CLKSource_HCLK ((uint32_t)0x00000004)
161 #define IS_SYSTICK_CLK_SOURCE(SOURCE) (((SOURCE) == SysTick_CLKSource_HCLK) || \
162  ((SOURCE) == SysTick_CLKSource_HCLK_Div8))
163 
183 void NVIC_PriorityGroupConfig(uint32_t NVIC_PriorityGroup);
184 void NVIC_Init(NVIC_InitTypeDef* NVIC_InitStruct);
185 void NVIC_SetVectorTable(uint32_t NVIC_VectTab, uint32_t Offset);
186 void NVIC_SystemLPConfig(uint8_t LowPowerMode, FunctionalState NewState);
187 void SysTick_CLKSourceConfig(uint32_t SysTick_CLKSource);
188 
189 #ifdef __cplusplus
190 }
191 #endif
192 
193 #endif /* __MISC_H */
194 
uint8_t NVIC_IRQChannelPreemptionPriority
Definition: misc.h:44
void NVIC_SystemLPConfig(uint8_t LowPowerMode, FunctionalState NewState)
Selects the condition for the system to enter low power mode.
Definition: misc.c:162
NVIC Init Structure definition.
Definition: misc.h:37
uint8_t NVIC_IRQChannel
Definition: misc.h:39
FunctionalState NVIC_IRQChannelCmd
Definition: misc.h:52
uint8_t NVIC_IRQChannelSubPriority
Definition: misc.h:48
void NVIC_PriorityGroupConfig(uint32_t NVIC_PriorityGroup)
Configures the priority grouping: pre-emption priority and subpriority.
Definition: misc.c:83
void SysTick_CLKSourceConfig(uint32_t SysTick_CLKSource)
Configures the SysTick clock source.
Definition: misc.c:186
void NVIC_SetVectorTable(uint32_t NVIC_VectTab, uint32_t Offset)
Sets the vector table location and Offset.
Definition: misc.c:143
void NVIC_Init(NVIC_InitTypeDef *NVIC_InitStruct)
Initializes the NVIC peripheral according to the specified parameters in the NVIC_InitStruct.
Definition: misc.c:99