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