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