]> git.donarmstrong.com Git - qmk_firmware.git/blob - tool/mbed/mbed-sdk/libraries/mbed/targets/cmsis/TARGET_STM/TARGET_STM32F3XX/stm32f30x_misc.h
Squashed 'tmk_core/' changes from 7967731..b9e0ea0
[qmk_firmware.git] / tool / mbed / mbed-sdk / libraries / mbed / targets / cmsis / TARGET_STM / TARGET_STM32F3XX / stm32f30x_misc.h
1 /**
2   ******************************************************************************
3   * @file    stm32f30x_misc.h
4   * @author  MCD Application Team
5   * @version V1.1.0
6   * @date    27-February-2014
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   * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
13   *
14   * Redistribution and use in source and binary forms, with or without modification,
15   * are permitted provided that the following conditions are met:
16   *   1. Redistributions of source code must retain the above copyright notice,
17   *      this list of conditions and the following disclaimer.
18   *   2. Redistributions in binary form must reproduce the above copyright notice,
19   *      this list of conditions and the following disclaimer in the documentation
20   *      and/or other materials provided with the distribution.
21   *   3. Neither the name of STMicroelectronics nor the names of its contributors
22   *      may be used to endorse or promote products derived from this software
23   *      without specific prior written permission.
24   *
25   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
26   * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27   * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
28   * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
29   * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30   * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
31   * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
32   * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
33   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
34   * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35   *
36   ******************************************************************************
37   */
38
39 /* Define to prevent recursive inclusion -------------------------------------*/
40 #ifndef __STM32F30x_MISC_H
41 #define __STM32F30x_MISC_H
42
43 #ifdef __cplusplus
44  extern "C" {
45 #endif
46
47 /* Includes ------------------------------------------------------------------*/
48 #include "stm32f30x.h"
49
50 /** @addtogroup STM32F30x_StdPeriph_Driver
51   * @{
52   */
53
54 /** @addtogroup MISC
55   * @{
56   */
57
58 /* Exported types ------------------------------------------------------------*/
59
60 /** 
61   * @brief  NVIC Init Structure definition  
62   */
63
64 typedef struct
65 {
66   uint8_t NVIC_IRQChannel;                    /*!< Specifies the IRQ channel to be enabled or disabled.
67                                                    This parameter can be a value of @ref IRQn_Type (For 
68                                                    the complete STM32 Devices IRQ Channels list, please
69                                                     refer to stm32f30x.h file) */
70
71   uint8_t NVIC_IRQChannelPreemptionPriority;  /*!< Specifies the pre-emption priority for the IRQ channel
72                                                    specified in NVIC_IRQChannel. This parameter can be a value
73                                                    between 0 and 15.
74                                                    A lower priority value indicates a higher priority */
75                                                    
76
77   uint8_t NVIC_IRQChannelSubPriority;         /*!< Specifies the subpriority level for the IRQ channel specified
78                                                    in NVIC_IRQChannel. This parameter can be a value 
79                                                    between 0 and 15.
80                                                    A lower priority value indicates a higher priority */
81
82   FunctionalState NVIC_IRQChannelCmd;         /*!< Specifies whether the IRQ channel defined in NVIC_IRQChannel
83                                                    will be enabled or disabled. 
84                                                    This parameter can be set either to ENABLE or DISABLE */   
85 } NVIC_InitTypeDef;
86
87 /**  
88   *
89 @verbatim   
90  The table below gives the allowed values of the pre-emption priority and subpriority according
91  to the Priority Grouping configuration performed by NVIC_PriorityGroupConfig function
92   ============================================================================================================================
93     NVIC_PriorityGroup   | NVIC_IRQChannelPreemptionPriority | NVIC_IRQChannelSubPriority  | Description
94   ============================================================================================================================
95    NVIC_PriorityGroup_0  |                0                  |            0-15             |   0 bits for pre-emption priority
96                          |                                   |                             |   4 bits for subpriority
97   ----------------------------------------------------------------------------------------------------------------------------
98    NVIC_PriorityGroup_1  |                0-1                |            0-7              |   1 bits for pre-emption priority
99                          |                                   |                             |   3 bits for subpriority
100   ----------------------------------------------------------------------------------------------------------------------------    
101    NVIC_PriorityGroup_2  |                0-3                |            0-3              |   2 bits for pre-emption priority
102                          |                                   |                             |   2 bits for subpriority
103   ----------------------------------------------------------------------------------------------------------------------------    
104    NVIC_PriorityGroup_3  |                0-7                |            0-1              |   3 bits for pre-emption priority
105                          |                                   |                             |   1 bits for subpriority
106   ----------------------------------------------------------------------------------------------------------------------------    
107    NVIC_PriorityGroup_4  |                0-15               |            0                |   4 bits for pre-emption priority
108                          |                                   |                             |   0 bits for subpriority                       
109   ============================================================================================================================
110 @endverbatim
111 */
112  
113 /* Exported constants --------------------------------------------------------*/
114
115 /** @defgroup MISC_Exported_Constants
116   * @{
117   */
118
119 /** @defgroup MISC_Vector_Table_Base 
120   * @{
121   */
122
123 #define NVIC_VectTab_RAM             ((uint32_t)0x20000000)
124 #define NVIC_VectTab_FLASH           ((uint32_t)0x08000000)
125 #define IS_NVIC_VECTTAB(VECTTAB) (((VECTTAB) == NVIC_VectTab_RAM) || \
126                                   ((VECTTAB) == NVIC_VectTab_FLASH))
127 /**
128   * @}
129   */
130
131 /** @defgroup MISC_System_Low_Power 
132   * @{
133   */
134
135 #define NVIC_LP_SEVONPEND            ((uint8_t)0x10)
136 #define NVIC_LP_SLEEPDEEP            ((uint8_t)0x04)
137 #define NVIC_LP_SLEEPONEXIT          ((uint8_t)0x02)
138 #define IS_NVIC_LP(LP) (((LP) == NVIC_LP_SEVONPEND) || \
139                         ((LP) == NVIC_LP_SLEEPDEEP) || \
140                         ((LP) == NVIC_LP_SLEEPONEXIT))
141 /**
142   * @}
143   */
144
145 /** @defgroup MISC_Preemption_Priority_Group 
146   * @{
147   */
148
149 #define NVIC_PriorityGroup_0         ((uint32_t)0x700) /*!< 0 bits for pre-emption priority
150                                                             4 bits for subpriority */
151 #define NVIC_PriorityGroup_1         ((uint32_t)0x600) /*!< 1 bits for pre-emption priority
152                                                             3 bits for subpriority */
153 #define NVIC_PriorityGroup_2         ((uint32_t)0x500) /*!< 2 bits for pre-emption priority
154                                                             2 bits for subpriority */
155 #define NVIC_PriorityGroup_3         ((uint32_t)0x400) /*!< 3 bits for pre-emption priority
156                                                             1 bits for subpriority */
157 #define NVIC_PriorityGroup_4         ((uint32_t)0x300) /*!< 4 bits for pre-emption priority
158                                                             0 bits for subpriority */
159
160 #define IS_NVIC_PRIORITY_GROUP(GROUP) (((GROUP) == NVIC_PriorityGroup_0) || \
161                                        ((GROUP) == NVIC_PriorityGroup_1) || \
162                                        ((GROUP) == NVIC_PriorityGroup_2) || \
163                                        ((GROUP) == NVIC_PriorityGroup_3) || \
164                                        ((GROUP) == NVIC_PriorityGroup_4))
165
166 #define IS_NVIC_PREEMPTION_PRIORITY(PRIORITY)  ((PRIORITY) < 0x10)
167
168 #define IS_NVIC_SUB_PRIORITY(PRIORITY)  ((PRIORITY) < 0x10)
169
170 #define IS_NVIC_OFFSET(OFFSET)  ((OFFSET) < 0x000FFFFF)
171
172 /**
173   * @}
174   */
175
176 /** @defgroup MISC_SysTick_clock_source 
177   */
178
179 #define SysTick_CLKSource_HCLK_Div8    ((uint32_t)0xFFFFFFFB)
180 #define SysTick_CLKSource_HCLK         ((uint32_t)0x00000004)
181 #define IS_SYSTICK_CLK_SOURCE(SOURCE) (((SOURCE) == SysTick_CLKSource_HCLK) || \
182                                        ((SOURCE) == SysTick_CLKSource_HCLK_Div8))
183 /**
184   * @}
185   */
186
187 /**
188   * @}
189   */
190
191 /* Exported macro ------------------------------------------------------------*/
192 /* Exported functions --------------------------------------------------------*/
193
194 void NVIC_PriorityGroupConfig(uint32_t NVIC_PriorityGroup);
195 void NVIC_Init(NVIC_InitTypeDef* NVIC_InitStruct);
196 void NVIC_SetVectorTable(uint32_t NVIC_VectTab, uint32_t Offset);
197 void NVIC_SystemLPConfig(uint8_t LowPowerMode, FunctionalState NewState);
198 void SysTick_CLKSourceConfig(uint32_t SysTick_CLKSource);
199
200 #ifdef __cplusplus
201 }
202 #endif
203
204 #endif /* __STM32F30x_MISC_H */
205
206 /**
207   * @}
208   */
209
210 /**
211   * @}
212   */
213
214 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/