ARMEBS4  revision-26.06.2015
stm32f4xx_misc.h
1 /**
2  ******************************************************************************
3  * @file misc.h
4  * @author MCD Application Team
5  * @version V1.0.0
6  * @date 30-September-2011
7  * @brief This file contains all the functions prototypes for the miscellaneous
8  * firmware library functions (add-on to CMSIS functions).
9  ******************************************************************************
10  * @attention
11  *
12  * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
13  * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
14  * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
15  * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
16  * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
17  * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
18  *
19  * <h2><center>&copy; COPYRIGHT 2011 STMicroelectronics</center></h2>
20  ******************************************************************************
21  */
22 
23 /* Define to prevent recursive inclusion -------------------------------------*/
24 #ifndef __MISC_H
25 #define __MISC_H
26 
27 #ifdef __cplusplus
28  extern "C" {
29 #endif
30 
31 /* Includes ------------------------------------------------------------------*/
32 #include "stm32/stm32f4xx.h"
33 
34 /** @addtogroup STM32F4xx_StdPeriph_Driver
35  * @{
36  */
37 
38 /** @addtogroup MISC
39  * @{
40  */
41 
42 /* Exported types ------------------------------------------------------------*/
43 
44 /**
45  * @brief NVIC Init Structure definition
46  */
47 
48 typedef struct
49 {
50  uint8_t NVIC_IRQChannel; /*!< Specifies the IRQ channel to be enabled or disabled.
51  This parameter can be an enumerator of @ref IRQn_Type
52  enumeration (For the complete STM32 Devices IRQ Channels
53  list, please refer to stm32f4xx.h file) */
54 
55  uint8_t NVIC_IRQChannelPreemptionPriority; /*!< Specifies the pre-emption priority for the IRQ channel
56  specified in NVIC_IRQChannel. This parameter can be a value
57  between 0 and 15 as described in the table @ref MISC_NVIC_Priority_Table
58  A lower priority value indicates a higher priority */
59 
60  uint8_t NVIC_IRQChannelSubPriority; /*!< Specifies the subpriority level for the IRQ channel specified
61  in NVIC_IRQChannel. This parameter can be a value
62  between 0 and 15 as described in the table @ref MISC_NVIC_Priority_Table
63  A lower priority value indicates a higher priority */
64 
65  FunctionalState NVIC_IRQChannelCmd; /*!< Specifies whether the IRQ channel defined in NVIC_IRQChannel
66  will be enabled or disabled.
67  This parameter can be set either to ENABLE or DISABLE */
68 
69  void (*NVIC_Handler)(void); /*! Interrupt handler */
71 
72 /* Exported constants --------------------------------------------------------*/
73 
74 /** @defgroup MISC_Exported_Constants
75  * @{
76  */
77 
78 /** @defgroup MISC_Vector_Table_Base
79  * @{
80  */
81 
82 #define NVIC_VectTab_RAM ((uint32_t)0x20000000)
83 #define NVIC_VectTab_FLASH ((uint32_t)0x08000000)
84 #define IS_NVIC_VECTTAB(VECTTAB) (((VECTTAB) == NVIC_VectTab_RAM) || \
85  ((VECTTAB) == NVIC_VectTab_FLASH))
86 /**
87  * @}
88  */
89 
90 /** @defgroup MISC_System_Low_Power
91  * @{
92  */
93 
94 #define NVIC_LP_SEVONPEND ((uint8_t)0x10)
95 #define NVIC_LP_SLEEPDEEP ((uint8_t)0x04)
96 #define NVIC_LP_SLEEPONEXIT ((uint8_t)0x02)
97 #define IS_NVIC_LP(LP) (((LP) == NVIC_LP_SEVONPEND) || \
98  ((LP) == NVIC_LP_SLEEPDEEP) || \
99  ((LP) == NVIC_LP_SLEEPONEXIT))
100 /**
101  * @}
102  */
103 
104 /** @defgroup MISC_Preemption_Priority_Group
105  * @{
106  */
107 
108 #define NVIC_PriorityGroup_0 ((uint32_t)0x700) /*!< 0 bits for pre-emption priority
109  4 bits for subpriority */
110 #define NVIC_PriorityGroup_1 ((uint32_t)0x600) /*!< 1 bits for pre-emption priority
111  3 bits for subpriority */
112 #define NVIC_PriorityGroup_2 ((uint32_t)0x500) /*!< 2 bits for pre-emption priority
113  2 bits for subpriority */
114 #define NVIC_PriorityGroup_3 ((uint32_t)0x400) /*!< 3 bits for pre-emption priority
115  1 bits for subpriority */
116 #define NVIC_PriorityGroup_4 ((uint32_t)0x300) /*!< 4 bits for pre-emption priority
117  0 bits for subpriority */
118 
119 #define IS_NVIC_PRIORITY_GROUP(GROUP) (((GROUP) == NVIC_PriorityGroup_0) || \
120  ((GROUP) == NVIC_PriorityGroup_1) || \
121  ((GROUP) == NVIC_PriorityGroup_2) || \
122  ((GROUP) == NVIC_PriorityGroup_3) || \
123  ((GROUP) == NVIC_PriorityGroup_4))
124 
125 #define IS_NVIC_PREEMPTION_PRIORITY(PRIORITY) ((PRIORITY) < 0x10)
126 
127 #define IS_NVIC_SUB_PRIORITY(PRIORITY) ((PRIORITY) < 0x10)
128 
129 #define IS_NVIC_OFFSET(OFFSET) ((OFFSET) < 0x000FFFFF)
130 
131 /**
132  * @}
133  */
134 
135 /** @defgroup MISC_SysTick_clock_source
136  * @{
137  */
138 
139 #define SysTick_CLKSource_HCLK_Div8 ((uint32_t)0xFFFFFFFB)
140 #define SysTick_CLKSource_HCLK ((uint32_t)0x00000004)
141 #define IS_SYSTICK_CLK_SOURCE(SOURCE) (((SOURCE) == SysTick_CLKSource_HCLK) || \
142  ((SOURCE) == SysTick_CLKSource_HCLK_Div8))
143 /**
144  * @}
145  */
146 
147 /**
148  * @}
149  */
150 
151 /* Exported macro ------------------------------------------------------------*/
152 /* Exported functions --------------------------------------------------------*/
153 
154 void NVIC_PriorityGroupConfig(uint32_t NVIC_PriorityGroup);
155 void NVIC_Init(NVIC_InitTypeDef* NVIC_InitStruct);
156 void NVIC_SetVectorTable(uint32_t NVIC_VectTab, uint32_t Offset);
157 void NVIC_SystemLPConfig(uint8_t LowPowerMode, FunctionalState NewState);
158 void SysTick_CLKSourceConfig(uint32_t SysTick_CLKSource);
159 
160 #ifdef __cplusplus
161 }
162 #endif
163 
164 #endif /* __MISC_H */
165 
166 /**
167  * @}
168  */
169 
170 /**
171  * @}
172  */
173 
174 /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
uint8_t NVIC_IRQChannel
CMSIS Cortex-M4 Device Peripheral Access Layer Header File. This file contains all the peripheral reg...
uint8_t NVIC_IRQChannelSubPriority
NVIC Init Structure definition.
FunctionalState NVIC_IRQChannelCmd
uint8_t NVIC_IRQChannelPreemptionPriority