123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178 |
- #ifndef __MISC_H
- #define __MISC_H
- #ifdef __cplusplus
- extern "C" {
- #endif
- #include "stm32f4xx.h"
- typedef struct
- {
- uint8_t NVIC_IRQChannel;
- uint8_t NVIC_IRQChannelPreemptionPriority;
- uint8_t NVIC_IRQChannelSubPriority;
- FunctionalState NVIC_IRQChannelCmd;
-
- } NVIC_InitTypeDef;
-
- #define NVIC_VectTab_RAM ((uint32_t)0x20000000)
- #define NVIC_VectTab_FLASH ((uint32_t)0x08000000)
- #define IS_NVIC_VECTTAB(VECTTAB) (((VECTTAB) == NVIC_VectTab_RAM) || \
- ((VECTTAB) == NVIC_VectTab_FLASH))
- #define NVIC_LP_SEVONPEND ((uint8_t)0x10)
- #define NVIC_LP_SLEEPDEEP ((uint8_t)0x04)
- #define NVIC_LP_SLEEPONEXIT ((uint8_t)0x02)
- #define IS_NVIC_LP(LP) (((LP) == NVIC_LP_SEVONPEND) || \
- ((LP) == NVIC_LP_SLEEPDEEP) || \
- ((LP) == NVIC_LP_SLEEPONEXIT))
- #define NVIC_PriorityGroup_0 ((uint32_t)0x700)
- #define NVIC_PriorityGroup_1 ((uint32_t)0x600)
- #define NVIC_PriorityGroup_2 ((uint32_t)0x500)
- #define NVIC_PriorityGroup_3 ((uint32_t)0x400)
- #define NVIC_PriorityGroup_4 ((uint32_t)0x300)
- #define IS_NVIC_PRIORITY_GROUP(GROUP) (((GROUP) == NVIC_PriorityGroup_0) || \
- ((GROUP) == NVIC_PriorityGroup_1) || \
- ((GROUP) == NVIC_PriorityGroup_2) || \
- ((GROUP) == NVIC_PriorityGroup_3) || \
- ((GROUP) == NVIC_PriorityGroup_4))
- #define IS_NVIC_PREEMPTION_PRIORITY(PRIORITY) ((PRIORITY) < 0x10)
- #define IS_NVIC_SUB_PRIORITY(PRIORITY) ((PRIORITY) < 0x10)
- #define IS_NVIC_OFFSET(OFFSET) ((OFFSET) < 0x000FFFFF)
- #define SysTick_CLKSource_HCLK_Div8 ((uint32_t)0xFFFFFFFB)
- #define SysTick_CLKSource_HCLK ((uint32_t)0x00000004)
- #define IS_SYSTICK_CLK_SOURCE(SOURCE) (((SOURCE) == SysTick_CLKSource_HCLK) || \
- ((SOURCE) == SysTick_CLKSource_HCLK_Div8))
- void NVIC_PriorityGroupConfig(uint32_t NVIC_PriorityGroup);
- void NVIC_Init(NVIC_InitTypeDef* NVIC_InitStruct);
- void NVIC_SetVectorTable(uint32_t NVIC_VectTab, uint32_t Offset);
- void NVIC_SystemLPConfig(uint8_t LowPowerMode, FunctionalState NewState);
- void SysTick_CLKSourceConfig(uint32_t SysTick_CLKSource);
- #ifdef __cplusplus
- }
- #endif
- #endif
|