Rev Author Line No. Line
2067 kakl 1 /**
2 ******************************************************************************
3 * @file misc.h
4 * @author MCD Application Team
5 * @version V3.4.0
6 * @date 10/15/2010
7 * @brief This file contains all the functions prototypes for the miscellaneous
8 * firmware library functions (add-on to CMSIS functions).
9 ******************************************************************************
10 * @copy
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 2010 STMicroelectronics</center></h2>
20 */
21  
22 /* Define to prevent recursive inclusion -------------------------------------*/
23 #ifndef __MISC_H
24 #define __MISC_H
25  
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29  
30 /* Includes ------------------------------------------------------------------*/
31 #include "stm32f10x.h"
32  
33 /** @addtogroup STM32F10x_StdPeriph_Driver
34 * @{
35 */
36  
37 /** @addtogroup MISC
38 * @{
39 */
40  
41 /** @defgroup MISC_Exported_Types
42 * @{
43 */
44  
45 /**
46 * @brief NVIC Init Structure definition
47 */
48  
49 typedef struct
50 {
51 uint8_t NVIC_IRQChannel; /*!< Specifies the IRQ channel to be enabled or disabled.
52 This parameter can be a value of @ref IRQn_Type
53 (For the complete STM32 Devices IRQ Channels list, please
54 refer to stm32f10x.h file) */
55  
56 uint8_t NVIC_IRQChannelPreemptionPriority; /*!< Specifies the pre-emption priority for the IRQ channel
57 specified in NVIC_IRQChannel. This parameter can be a value
58 between 0 and 15 as described in the table @ref NVIC_Priority_Table */
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 NVIC_Priority_Table */
63  
64 FunctionalState NVIC_IRQChannelCmd; /*!< Specifies whether the IRQ channel defined in NVIC_IRQChannel
65 will be enabled or disabled.
66 This parameter can be set either to ENABLE or DISABLE */
67 } NVIC_InitTypeDef;
68  
69 /**
70 * @}
71 */
72  
73 /** @defgroup NVIC_Priority_Table
74 * @{
75 */
76  
77 /**
78 @code
79 The table below gives the allowed values of the pre-emption priority and subpriority according
80 to the Priority Grouping configuration performed by NVIC_PriorityGroupConfig function
81 ============================================================================================================================
82 NVIC_PriorityGroup | NVIC_IRQChannelPreemptionPriority | NVIC_IRQChannelSubPriority | Description
83 ============================================================================================================================
84 NVIC_PriorityGroup_0 | 0 | 0-15 | 0 bits for pre-emption priority
85 | | | 4 bits for subpriority
86 ----------------------------------------------------------------------------------------------------------------------------
87 NVIC_PriorityGroup_1 | 0-1 | 0-7 | 1 bits for pre-emption priority
88 | | | 3 bits for subpriority
89 ----------------------------------------------------------------------------------------------------------------------------
90 NVIC_PriorityGroup_2 | 0-3 | 0-3 | 2 bits for pre-emption priority
91 | | | 2 bits for subpriority
92 ----------------------------------------------------------------------------------------------------------------------------
93 NVIC_PriorityGroup_3 | 0-7 | 0-1 | 3 bits for pre-emption priority
94 | | | 1 bits for subpriority
95 ----------------------------------------------------------------------------------------------------------------------------
96 NVIC_PriorityGroup_4 | 0-15 | 0 | 4 bits for pre-emption priority
97 | | | 0 bits for subpriority
98 ============================================================================================================================
99 @endcode
100 */
101  
102 /**
103 * @}
104 */
105  
106 /** @defgroup MISC_Exported_Constants
107 * @{
108 */
109  
110 /** @defgroup Vector_Table_Base
111 * @{
112 */
113  
114 #define NVIC_VectTab_RAM ((uint32_t)0x20000000)
115 #define NVIC_VectTab_FLASH ((uint32_t)0x08000000)
116 #define IS_NVIC_VECTTAB(VECTTAB) (((VECTTAB) == NVIC_VectTab_RAM) || \
117 ((VECTTAB) == NVIC_VectTab_FLASH))
118 /**
119 * @}
120 */
121  
122 /** @defgroup System_Low_Power
123 * @{
124 */
125  
126 #define NVIC_LP_SEVONPEND ((uint8_t)0x10)
127 #define NVIC_LP_SLEEPDEEP ((uint8_t)0x04)
128 #define NVIC_LP_SLEEPONEXIT ((uint8_t)0x02)
129 #define IS_NVIC_LP(LP) (((LP) == NVIC_LP_SEVONPEND) || \
130 ((LP) == NVIC_LP_SLEEPDEEP) || \
131 ((LP) == NVIC_LP_SLEEPONEXIT))
132 /**
133 * @}
134 */
135  
136 /** @defgroup Preemption_Priority_Group
137 * @{
138 */
139  
140 #define NVIC_PriorityGroup_0 ((uint32_t)0x700) /*!< 0 bits for pre-emption priority
141 4 bits for subpriority */
142 #define NVIC_PriorityGroup_1 ((uint32_t)0x600) /*!< 1 bits for pre-emption priority
143 3 bits for subpriority */
144 #define NVIC_PriorityGroup_2 ((uint32_t)0x500) /*!< 2 bits for pre-emption priority
145 2 bits for subpriority */
146 #define NVIC_PriorityGroup_3 ((uint32_t)0x400) /*!< 3 bits for pre-emption priority
147 1 bits for subpriority */
148 #define NVIC_PriorityGroup_4 ((uint32_t)0x300) /*!< 4 bits for pre-emption priority
149  
150  
151 #define IS_NVIC_PRIORITY_GROUP(GROUP) (((GROUP) == NVIC_PriorityGroup_0) || \
152 ((GROUP) == NVIC_PriorityGroup_1) || \
153 ((GROUP) == NVIC_PriorityGroup_2) || \
154 ((GROUP) == NVIC_PriorityGroup_3) || \
155 ((GROUP) == NVIC_PriorityGroup_4))
156  
157 #define IS_NVIC_PREEMPTION_PRIORITY(PRIORITY) ((PRIORITY) < 0x10)
158  
159 #define IS_NVIC_SUB_PRIORITY(PRIORITY) ((PRIORITY) < 0x10)
160  
161 #define IS_NVIC_OFFSET(OFFSET) ((OFFSET) < 0x000FFFFF)
162  
163 /**
164 * @}
165 */
166  
167 /** @defgroup SysTick_clock_source
168 * @{
169 */
170  
171 #define SysTick_CLKSource_HCLK_Div8 ((uint32_t)0xFFFFFFFB)
172 #define SysTick_CLKSource_HCLK ((uint32_t)0x00000004)
173 #define IS_SYSTICK_CLK_SOURCE(SOURCE) (((SOURCE) == SysTick_CLKSource_HCLK) || \
174 ((SOURCE) == SysTick_CLKSource_HCLK_Div8))
175 /**
176 * @}
177 */
178  
179 /**
180 * @}
181 */
182  
183 /** @defgroup MISC_Exported_Macros
184 * @{
185 */
186  
187 /**
188 * @}
189 */
190  
191 /** @defgroup MISC_Exported_Functions
192 * @{
193 */
194  
195 void NVIC_PriorityGroupConfig(uint32_t NVIC_PriorityGroup);
196 void NVIC_Init(NVIC_InitTypeDef* NVIC_InitStruct);
197 void NVIC_SetVectorTable(uint32_t NVIC_VectTab, uint32_t Offset);
198 void NVIC_SystemLPConfig(uint8_t LowPowerMode, FunctionalState NewState);
199 void SysTick_CLKSourceConfig(uint32_t SysTick_CLKSource);
200  
201 #ifdef __cplusplus
202 }
203 #endif
204  
205 #endif /* __MISC_H */
206  
207 /**
208 * @}
209 */
210  
211 /**
212 * @}
213 */
214  
215 /**
216 * @}
217 */
218  
219 /******************* (C) COPYRIGHT 2010 STMicroelectronics *****END OF FILE****/