]> git.sur5r.net Git - freertos/blob - Demo/CORTEX_STM32L152_IAR/system_and_ST_code/STM32L1xx_StdPeriph_Driver/inc/misc.h
Start to re-arrange files to include FreeRTOS+ in main download.
[freertos] / Demo / CORTEX_STM32L152_IAR / system_and_ST_code / STM32L1xx_StdPeriph_Driver / inc / misc.h
1 /**\r
2   ******************************************************************************\r
3   * @file    misc.h\r
4   * @author  MCD Application Team\r
5   * @version V1.0.0RC1\r
6   * @date    07/02/2010\r
7   * @brief   This file contains all the functions prototypes for the miscellaneous\r
8   *          firmware library functions (add-on to CMSIS functions).\r
9   ******************************************************************************\r
10   * @copy\r
11   *\r
12   * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS\r
13   * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE\r
14   * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY\r
15   * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING\r
16   * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE\r
17   * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.\r
18   *\r
19   * <h2><center>&copy; COPYRIGHT 2010 STMicroelectronics</center></h2>\r
20   */ \r
21 \r
22 /* Define to prevent recursive inclusion -------------------------------------*/\r
23 #ifndef __MISC_H\r
24 #define __MISC_H\r
25 \r
26 #ifdef __cplusplus\r
27  extern "C" {\r
28 #endif\r
29 \r
30 /* Includes ------------------------------------------------------------------*/\r
31 #include "stm32l1xx.h"\r
32 \r
33 /** @addtogroup STM32L1xx_StdPeriph_Driver\r
34   * @{\r
35   */\r
36 \r
37 /** @addtogroup MISC\r
38   * @{\r
39   */\r
40 \r
41 /** @defgroup MISC_Exported_Types\r
42   * @{\r
43   */\r
44 \r
45 /** \r
46   * @brief  NVIC Init Structure definition  \r
47   */\r
48 \r
49 typedef struct\r
50 {\r
51   uint8_t NVIC_IRQChannel;                    /*!< Specifies the IRQ channel to be enabled or disabled.\r
52                                                    This parameter can be a value of @ref IRQn_Type \r
53                                                    (For the complete STM32 Devices IRQ Channels list, please\r
54                                                     refer to stm32l1xx.h file) */\r
55 \r
56   uint8_t NVIC_IRQChannelPreemptionPriority;  /*!< Specifies the pre-emption priority for the IRQ channel\r
57                                                    specified in NVIC_IRQChannel. This parameter can be a value\r
58                                                    between 0 and 15 as described in the table @ref NVIC_Priority_Table */\r
59 \r
60   uint8_t NVIC_IRQChannelSubPriority;         /*!< Specifies the subpriority level for the IRQ channel specified\r
61                                                    in NVIC_IRQChannel. This parameter can be a value\r
62                                                    between 0 and 15 as described in the table @ref NVIC_Priority_Table */\r
63 \r
64   FunctionalState NVIC_IRQChannelCmd;         /*!< Specifies whether the IRQ channel defined in NVIC_IRQChannel\r
65                                                    will be enabled or disabled. \r
66                                                    This parameter can be set either to ENABLE or DISABLE */   \r
67 } NVIC_InitTypeDef;\r
68  \r
69 /**\r
70   * @}\r
71   */\r
72 \r
73 /** @defgroup NVIC_Priority_Table \r
74   * @{\r
75   */\r
76 \r
77 /**\r
78 @code  \r
79  The table below gives the allowed values of the pre-emption priority and subpriority according\r
80  to the Priority Grouping configuration performed by NVIC_PriorityGroupConfig function\r
81   ============================================================================================================================\r
82     NVIC_PriorityGroup   | NVIC_IRQChannelPreemptionPriority | NVIC_IRQChannelSubPriority  | Description\r
83   ============================================================================================================================\r
84    NVIC_PriorityGroup_0  |                0                  |            0-15             |   0 bits for pre-emption priority\r
85                          |                                   |                             |   4 bits for subpriority\r
86   ----------------------------------------------------------------------------------------------------------------------------\r
87    NVIC_PriorityGroup_1  |                0-1                |            0-7              |   1 bits for pre-emption priority\r
88                          |                                   |                             |   3 bits for subpriority\r
89   ----------------------------------------------------------------------------------------------------------------------------    \r
90    NVIC_PriorityGroup_2  |                0-3                |            0-3              |   2 bits for pre-emption priority\r
91                          |                                   |                             |   2 bits for subpriority\r
92   ----------------------------------------------------------------------------------------------------------------------------    \r
93    NVIC_PriorityGroup_3  |                0-7                |            0-1              |   3 bits for pre-emption priority\r
94                          |                                   |                             |   1 bits for subpriority\r
95   ----------------------------------------------------------------------------------------------------------------------------    \r
96    NVIC_PriorityGroup_4  |                0-15               |            0                |   4 bits for pre-emption priority\r
97                          |                                   |                             |   0 bits for subpriority                       \r
98   ============================================================================================================================\r
99 @endcode\r
100 */\r
101 \r
102 /**\r
103   * @}\r
104   */\r
105 \r
106 /** @defgroup MISC_Exported_Constants\r
107   * @{\r
108   */\r
109 \r
110 /** @defgroup Vector_Table_Base \r
111   * @{\r
112   */\r
113 \r
114 #define NVIC_VectTab_RAM             ((uint32_t)0x20000000)\r
115 #define NVIC_VectTab_FLASH           ((uint32_t)0x08000000)\r
116 #define IS_NVIC_VECTTAB(VECTTAB) (((VECTTAB) == NVIC_VectTab_RAM) || \\r
117                                   ((VECTTAB) == NVIC_VectTab_FLASH))\r
118 /**\r
119   * @}\r
120   */\r
121 \r
122 /** @defgroup System_Low_Power \r
123   * @{\r
124   */\r
125 \r
126 #define NVIC_LP_SEVONPEND            ((uint8_t)0x10)\r
127 #define NVIC_LP_SLEEPDEEP            ((uint8_t)0x04)\r
128 #define NVIC_LP_SLEEPONEXIT          ((uint8_t)0x02)\r
129 #define IS_NVIC_LP(LP) (((LP) == NVIC_LP_SEVONPEND) || \\r
130                         ((LP) == NVIC_LP_SLEEPDEEP) || \\r
131                         ((LP) == NVIC_LP_SLEEPONEXIT))\r
132 /**\r
133   * @}\r
134   */\r
135 \r
136 /** @defgroup Preemption_Priority_Group \r
137   * @{\r
138   */\r
139 \r
140 #define NVIC_PriorityGroup_0         ((uint32_t)0x700) /*!< 0 bits for pre-emption priority\r
141                                                             4 bits for subpriority */\r
142 #define NVIC_PriorityGroup_1         ((uint32_t)0x600) /*!< 1 bits for pre-emption priority\r
143                                                             3 bits for subpriority */\r
144 #define NVIC_PriorityGroup_2         ((uint32_t)0x500) /*!< 2 bits for pre-emption priority\r
145                                                             2 bits for subpriority */\r
146 #define NVIC_PriorityGroup_3         ((uint32_t)0x400) /*!< 3 bits for pre-emption priority\r
147                                                             1 bits for subpriority */\r
148 #define NVIC_PriorityGroup_4         ((uint32_t)0x300) /*!< 4 bits for pre-emption priority\r
149                                                             0 bits for subpriority */\r
150 \r
151 #define IS_NVIC_PRIORITY_GROUP(GROUP) (((GROUP) == NVIC_PriorityGroup_0) || \\r
152                                        ((GROUP) == NVIC_PriorityGroup_1) || \\r
153                                        ((GROUP) == NVIC_PriorityGroup_2) || \\r
154                                        ((GROUP) == NVIC_PriorityGroup_3) || \\r
155                                        ((GROUP) == NVIC_PriorityGroup_4))\r
156 \r
157 #define IS_NVIC_PREEMPTION_PRIORITY(PRIORITY)  ((PRIORITY) < 0x10)\r
158 \r
159 #define IS_NVIC_SUB_PRIORITY(PRIORITY)  ((PRIORITY) < 0x10)\r
160 \r
161 #define IS_NVIC_OFFSET(OFFSET)  ((OFFSET) < 0x0001FFFF)\r
162 \r
163 /**\r
164   * @}\r
165   */\r
166 \r
167 /** @defgroup SysTick_clock_source \r
168   * @{\r
169   */\r
170 \r
171 #define SysTick_CLKSource_HCLK_Div8    ((uint32_t)0xFFFFFFFB)\r
172 #define SysTick_CLKSource_HCLK         ((uint32_t)0x00000004)\r
173 #define IS_SYSTICK_CLK_SOURCE(SOURCE) (((SOURCE) == SysTick_CLKSource_HCLK) || \\r
174                                        ((SOURCE) == SysTick_CLKSource_HCLK_Div8))\r
175 /**\r
176   * @}\r
177   */\r
178 \r
179 /**\r
180   * @}\r
181   */\r
182 \r
183 /** @defgroup MISC_Exported_Macros\r
184   * @{\r
185   */\r
186 \r
187 /**\r
188   * @}\r
189   */\r
190 \r
191 /** @defgroup MISC_Exported_Functions\r
192   * @{\r
193   */\r
194 \r
195 void NVIC_PriorityGroupConfig(uint32_t NVIC_PriorityGroup);\r
196 void NVIC_Init(NVIC_InitTypeDef* NVIC_InitStruct);\r
197 void NVIC_SetVectorTable(uint32_t NVIC_VectTab, uint32_t Offset);\r
198 void NVIC_SystemLPConfig(uint8_t LowPowerMode, FunctionalState NewState);\r
199 void SysTick_CLKSourceConfig(uint32_t SysTick_CLKSource);\r
200 \r
201 #ifdef __cplusplus\r
202 }\r
203 #endif\r
204 \r
205 #endif /* __MISC_H */\r
206 \r
207 /**\r
208   * @}\r
209   */\r
210 \r
211 /**\r
212   * @}\r
213   */\r
214 \r
215 /**\r
216   * @}\r
217   */\r
218 \r
219 /******************* (C) COPYRIGHT 2010 STMicroelectronics *****END OF FILE****/\r