00001
00029
00030 #ifndef __MISC_H
00031 #define __MISC_H
00032
00033 #ifdef __cplusplus
00034 extern "C" {
00035 #endif
00036
00037
00038 #include "stm32f4xx.h"
00039
00048
00049
00054 typedef struct
00055 {
00056 uint8_t NVIC_IRQChannel;
00061 uint8_t NVIC_IRQChannelPreemptionPriority;
00066 uint8_t NVIC_IRQChannelSubPriority;
00071 FunctionalState NVIC_IRQChannelCmd;
00074 } NVIC_InitTypeDef;
00075
00076
00077
00086 #define NVIC_VectTab_RAM ((uint32_t)0x20000000)
00087 #define NVIC_VectTab_FLASH ((uint32_t)0x08000000)
00088 #define IS_NVIC_VECTTAB(VECTTAB) (((VECTTAB) == NVIC_VectTab_RAM) || \
00089 ((VECTTAB) == NVIC_VectTab_FLASH))
00090
00098 #define NVIC_LP_SEVONPEND ((uint8_t)0x10)
00099 #define NVIC_LP_SLEEPDEEP ((uint8_t)0x04)
00100 #define NVIC_LP_SLEEPONEXIT ((uint8_t)0x02)
00101 #define IS_NVIC_LP(LP) (((LP) == NVIC_LP_SEVONPEND) || \
00102 ((LP) == NVIC_LP_SLEEPDEEP) || \
00103 ((LP) == NVIC_LP_SLEEPONEXIT))
00104
00112 #define NVIC_PriorityGroup_0 ((uint32_t)0x700)
00114 #define NVIC_PriorityGroup_1 ((uint32_t)0x600)
00116 #define NVIC_PriorityGroup_2 ((uint32_t)0x500)
00118 #define NVIC_PriorityGroup_3 ((uint32_t)0x400)
00120 #define NVIC_PriorityGroup_4 ((uint32_t)0x300)
00123 #define IS_NVIC_PRIORITY_GROUP(GROUP) (((GROUP) == NVIC_PriorityGroup_0) || \
00124 ((GROUP) == NVIC_PriorityGroup_1) || \
00125 ((GROUP) == NVIC_PriorityGroup_2) || \
00126 ((GROUP) == NVIC_PriorityGroup_3) || \
00127 ((GROUP) == NVIC_PriorityGroup_4))
00128
00129 #define IS_NVIC_PREEMPTION_PRIORITY(PRIORITY) ((PRIORITY) < 0x10)
00130
00131 #define IS_NVIC_SUB_PRIORITY(PRIORITY) ((PRIORITY) < 0x10)
00132
00133 #define IS_NVIC_OFFSET(OFFSET) ((OFFSET) < 0x000FFFFF)
00134
00143 #define SysTick_CLKSource_HCLK_Div8 ((uint32_t)0xFFFFFFFB)
00144 #define SysTick_CLKSource_HCLK ((uint32_t)0x00000004)
00145 #define IS_SYSTICK_CLK_SOURCE(SOURCE) (((SOURCE) == SysTick_CLKSource_HCLK) || \
00146 ((SOURCE) == SysTick_CLKSource_HCLK_Div8))
00147
00155
00156
00157
00158 void NVIC_PriorityGroupConfig(uint32_t NVIC_PriorityGroup);
00159 void NVIC_Init(NVIC_InitTypeDef* NVIC_InitStruct);
00160 void NVIC_SetVectorTable(uint32_t NVIC_VectTab, uint32_t Offset);
00161 void NVIC_SystemLPConfig(uint8_t LowPowerMode, FunctionalState NewState);
00162 void SysTick_CLKSourceConfig(uint32_t SysTick_CLKSource);
00163
00164 #ifdef __cplusplus
00165 }
00166 #endif
00167
00168 #endif
00169
00178