mbed library sources
Dependents: frdm_kl05z_gpio_test
Fork of mbed-src by
targets/cmsis/TARGET_STM/TARGET_NUCLEO_F103RB/misc.h@323:9e901b0a5aa1, 2014-09-13 (annotated)
- Committer:
- shaoziyang
- Date:
- Sat Sep 13 14:25:46 2014 +0000
- Revision:
- 323:9e901b0a5aa1
- Parent:
- 84:f54042cbc282
test with CLOCK_SETUP = 0
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 | 84:f54042cbc282 | 5 | * @version V3.6.1 |
mbed_official | 84:f54042cbc282 | 6 | * @date 05-March-2012 |
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 | 70:c1fbde68b492 | 9 | ******************************************************************************* |
mbed_official | 70:c1fbde68b492 | 10 | * Copyright (c) 2014, STMicroelectronics |
mbed_official | 70:c1fbde68b492 | 11 | * All rights reserved. |
mbed_official | 70:c1fbde68b492 | 12 | * |
mbed_official | 70:c1fbde68b492 | 13 | * Redistribution and use in source and binary forms, with or without |
mbed_official | 70:c1fbde68b492 | 14 | * modification, are permitted provided that the following conditions are met: |
mbed_official | 70:c1fbde68b492 | 15 | * |
mbed_official | 70:c1fbde68b492 | 16 | * 1. Redistributions of source code must retain the above copyright notice, |
mbed_official | 70:c1fbde68b492 | 17 | * this list of conditions and the following disclaimer. |
mbed_official | 70:c1fbde68b492 | 18 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
mbed_official | 70:c1fbde68b492 | 19 | * this list of conditions and the following disclaimer in the documentation |
mbed_official | 70:c1fbde68b492 | 20 | * and/or other materials provided with the distribution. |
mbed_official | 70:c1fbde68b492 | 21 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
mbed_official | 70:c1fbde68b492 | 22 | * may be used to endorse or promote products derived from this software |
mbed_official | 70:c1fbde68b492 | 23 | * without specific prior written permission. |
mbed_official | 70:c1fbde68b492 | 24 | * |
mbed_official | 70:c1fbde68b492 | 25 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
mbed_official | 70:c1fbde68b492 | 26 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
mbed_official | 70:c1fbde68b492 | 27 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
mbed_official | 70:c1fbde68b492 | 28 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
mbed_official | 70:c1fbde68b492 | 29 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
mbed_official | 70:c1fbde68b492 | 30 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
mbed_official | 70:c1fbde68b492 | 31 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
mbed_official | 70:c1fbde68b492 | 32 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
mbed_official | 70:c1fbde68b492 | 33 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
mbed_official | 70:c1fbde68b492 | 34 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
mbed_official | 70:c1fbde68b492 | 35 | ******************************************************************************* |
mbed_official | 70:c1fbde68b492 | 36 | */ |
mbed_official | 52:a51c77007319 | 37 | |
mbed_official | 52:a51c77007319 | 38 | /* Define to prevent recursive inclusion -------------------------------------*/ |
mbed_official | 52:a51c77007319 | 39 | #ifndef __MISC_H |
mbed_official | 52:a51c77007319 | 40 | #define __MISC_H |
mbed_official | 52:a51c77007319 | 41 | |
mbed_official | 52:a51c77007319 | 42 | #ifdef __cplusplus |
mbed_official | 52:a51c77007319 | 43 | extern "C" { |
mbed_official | 52:a51c77007319 | 44 | #endif |
mbed_official | 52:a51c77007319 | 45 | |
mbed_official | 52:a51c77007319 | 46 | /* Includes ------------------------------------------------------------------*/ |
mbed_official | 52:a51c77007319 | 47 | #include "stm32f10x.h" |
mbed_official | 52:a51c77007319 | 48 | |
mbed_official | 52:a51c77007319 | 49 | /** @addtogroup STM32F10x_StdPeriph_Driver |
mbed_official | 52:a51c77007319 | 50 | * @{ |
mbed_official | 52:a51c77007319 | 51 | */ |
mbed_official | 52:a51c77007319 | 52 | |
mbed_official | 52:a51c77007319 | 53 | /** @addtogroup MISC |
mbed_official | 52:a51c77007319 | 54 | * @{ |
mbed_official | 52:a51c77007319 | 55 | */ |
mbed_official | 52:a51c77007319 | 56 | |
mbed_official | 52:a51c77007319 | 57 | /** @defgroup MISC_Exported_Types |
mbed_official | 52:a51c77007319 | 58 | * @{ |
mbed_official | 52:a51c77007319 | 59 | */ |
mbed_official | 52:a51c77007319 | 60 | |
mbed_official | 52:a51c77007319 | 61 | /** |
mbed_official | 52:a51c77007319 | 62 | * @brief NVIC Init Structure definition |
mbed_official | 52:a51c77007319 | 63 | */ |
mbed_official | 52:a51c77007319 | 64 | |
mbed_official | 52:a51c77007319 | 65 | typedef struct |
mbed_official | 52:a51c77007319 | 66 | { |
mbed_official | 52:a51c77007319 | 67 | uint8_t NVIC_IRQChannel; /*!< Specifies the IRQ channel to be enabled or disabled. |
mbed_official | 52:a51c77007319 | 68 | This parameter can be a value of @ref IRQn_Type |
mbed_official | 52:a51c77007319 | 69 | (For the complete STM32 Devices IRQ Channels list, please |
mbed_official | 52:a51c77007319 | 70 | refer to stm32f10x.h file) */ |
mbed_official | 52:a51c77007319 | 71 | |
mbed_official | 52:a51c77007319 | 72 | uint8_t NVIC_IRQChannelPreemptionPriority; /*!< Specifies the pre-emption priority for the IRQ channel |
mbed_official | 52:a51c77007319 | 73 | specified in NVIC_IRQChannel. This parameter can be a value |
mbed_official | 52:a51c77007319 | 74 | between 0 and 15 as described in the table @ref NVIC_Priority_Table */ |
mbed_official | 52:a51c77007319 | 75 | |
mbed_official | 52:a51c77007319 | 76 | uint8_t NVIC_IRQChannelSubPriority; /*!< Specifies the subpriority level for the IRQ channel specified |
mbed_official | 52:a51c77007319 | 77 | in NVIC_IRQChannel. This parameter can be a value |
mbed_official | 52:a51c77007319 | 78 | between 0 and 15 as described in the table @ref NVIC_Priority_Table */ |
mbed_official | 52:a51c77007319 | 79 | |
mbed_official | 52:a51c77007319 | 80 | FunctionalState NVIC_IRQChannelCmd; /*!< Specifies whether the IRQ channel defined in NVIC_IRQChannel |
mbed_official | 52:a51c77007319 | 81 | will be enabled or disabled. |
mbed_official | 52:a51c77007319 | 82 | This parameter can be set either to ENABLE or DISABLE */ |
mbed_official | 52:a51c77007319 | 83 | } NVIC_InitTypeDef; |
mbed_official | 52:a51c77007319 | 84 | |
mbed_official | 52:a51c77007319 | 85 | /** |
mbed_official | 52:a51c77007319 | 86 | * @} |
mbed_official | 52:a51c77007319 | 87 | */ |
mbed_official | 52:a51c77007319 | 88 | |
mbed_official | 52:a51c77007319 | 89 | /** @defgroup NVIC_Priority_Table |
mbed_official | 52:a51c77007319 | 90 | * @{ |
mbed_official | 52:a51c77007319 | 91 | */ |
mbed_official | 52:a51c77007319 | 92 | |
mbed_official | 52:a51c77007319 | 93 | /** |
mbed_official | 52:a51c77007319 | 94 | @code |
mbed_official | 52:a51c77007319 | 95 | The table below gives the allowed values of the pre-emption priority and subpriority according |
mbed_official | 52:a51c77007319 | 96 | to the Priority Grouping configuration performed by NVIC_PriorityGroupConfig function |
mbed_official | 52:a51c77007319 | 97 | ============================================================================================================================ |
mbed_official | 52:a51c77007319 | 98 | NVIC_PriorityGroup | NVIC_IRQChannelPreemptionPriority | NVIC_IRQChannelSubPriority | Description |
mbed_official | 52:a51c77007319 | 99 | ============================================================================================================================ |
mbed_official | 52:a51c77007319 | 100 | NVIC_PriorityGroup_0 | 0 | 0-15 | 0 bits for pre-emption priority |
mbed_official | 52:a51c77007319 | 101 | | | | 4 bits for subpriority |
mbed_official | 52:a51c77007319 | 102 | ---------------------------------------------------------------------------------------------------------------------------- |
mbed_official | 52:a51c77007319 | 103 | NVIC_PriorityGroup_1 | 0-1 | 0-7 | 1 bits for pre-emption priority |
mbed_official | 52:a51c77007319 | 104 | | | | 3 bits for subpriority |
mbed_official | 52:a51c77007319 | 105 | ---------------------------------------------------------------------------------------------------------------------------- |
mbed_official | 52:a51c77007319 | 106 | NVIC_PriorityGroup_2 | 0-3 | 0-3 | 2 bits for pre-emption priority |
mbed_official | 52:a51c77007319 | 107 | | | | 2 bits for subpriority |
mbed_official | 52:a51c77007319 | 108 | ---------------------------------------------------------------------------------------------------------------------------- |
mbed_official | 52:a51c77007319 | 109 | NVIC_PriorityGroup_3 | 0-7 | 0-1 | 3 bits for pre-emption priority |
mbed_official | 52:a51c77007319 | 110 | | | | 1 bits for subpriority |
mbed_official | 52:a51c77007319 | 111 | ---------------------------------------------------------------------------------------------------------------------------- |
mbed_official | 52:a51c77007319 | 112 | NVIC_PriorityGroup_4 | 0-15 | 0 | 4 bits for pre-emption priority |
mbed_official | 52:a51c77007319 | 113 | | | | 0 bits for subpriority |
mbed_official | 52:a51c77007319 | 114 | ============================================================================================================================ |
mbed_official | 52:a51c77007319 | 115 | @endcode |
mbed_official | 52:a51c77007319 | 116 | */ |
mbed_official | 52:a51c77007319 | 117 | |
mbed_official | 52:a51c77007319 | 118 | /** |
mbed_official | 52:a51c77007319 | 119 | * @} |
mbed_official | 52:a51c77007319 | 120 | */ |
mbed_official | 52:a51c77007319 | 121 | |
mbed_official | 52:a51c77007319 | 122 | /** @defgroup MISC_Exported_Constants |
mbed_official | 52:a51c77007319 | 123 | * @{ |
mbed_official | 52:a51c77007319 | 124 | */ |
mbed_official | 52:a51c77007319 | 125 | |
mbed_official | 52:a51c77007319 | 126 | /** @defgroup Vector_Table_Base |
mbed_official | 52:a51c77007319 | 127 | * @{ |
mbed_official | 52:a51c77007319 | 128 | */ |
mbed_official | 52:a51c77007319 | 129 | |
mbed_official | 52:a51c77007319 | 130 | #define NVIC_VectTab_RAM ((uint32_t)0x20000000) |
mbed_official | 52:a51c77007319 | 131 | #define NVIC_VectTab_FLASH ((uint32_t)0x08000000) |
mbed_official | 52:a51c77007319 | 132 | #define IS_NVIC_VECTTAB(VECTTAB) (((VECTTAB) == NVIC_VectTab_RAM) || \ |
mbed_official | 52:a51c77007319 | 133 | ((VECTTAB) == NVIC_VectTab_FLASH)) |
mbed_official | 52:a51c77007319 | 134 | /** |
mbed_official | 52:a51c77007319 | 135 | * @} |
mbed_official | 52:a51c77007319 | 136 | */ |
mbed_official | 52:a51c77007319 | 137 | |
mbed_official | 52:a51c77007319 | 138 | /** @defgroup System_Low_Power |
mbed_official | 52:a51c77007319 | 139 | * @{ |
mbed_official | 52:a51c77007319 | 140 | */ |
mbed_official | 52:a51c77007319 | 141 | |
mbed_official | 52:a51c77007319 | 142 | #define NVIC_LP_SEVONPEND ((uint8_t)0x10) |
mbed_official | 52:a51c77007319 | 143 | #define NVIC_LP_SLEEPDEEP ((uint8_t)0x04) |
mbed_official | 52:a51c77007319 | 144 | #define NVIC_LP_SLEEPONEXIT ((uint8_t)0x02) |
mbed_official | 52:a51c77007319 | 145 | #define IS_NVIC_LP(LP) (((LP) == NVIC_LP_SEVONPEND) || \ |
mbed_official | 52:a51c77007319 | 146 | ((LP) == NVIC_LP_SLEEPDEEP) || \ |
mbed_official | 52:a51c77007319 | 147 | ((LP) == NVIC_LP_SLEEPONEXIT)) |
mbed_official | 52:a51c77007319 | 148 | /** |
mbed_official | 52:a51c77007319 | 149 | * @} |
mbed_official | 52:a51c77007319 | 150 | */ |
mbed_official | 52:a51c77007319 | 151 | |
mbed_official | 52:a51c77007319 | 152 | /** @defgroup Preemption_Priority_Group |
mbed_official | 52:a51c77007319 | 153 | * @{ |
mbed_official | 52:a51c77007319 | 154 | */ |
mbed_official | 52:a51c77007319 | 155 | |
mbed_official | 52:a51c77007319 | 156 | #define NVIC_PriorityGroup_0 ((uint32_t)0x700) /*!< 0 bits for pre-emption priority |
mbed_official | 52:a51c77007319 | 157 | 4 bits for subpriority */ |
mbed_official | 52:a51c77007319 | 158 | #define NVIC_PriorityGroup_1 ((uint32_t)0x600) /*!< 1 bits for pre-emption priority |
mbed_official | 52:a51c77007319 | 159 | 3 bits for subpriority */ |
mbed_official | 52:a51c77007319 | 160 | #define NVIC_PriorityGroup_2 ((uint32_t)0x500) /*!< 2 bits for pre-emption priority |
mbed_official | 52:a51c77007319 | 161 | 2 bits for subpriority */ |
mbed_official | 52:a51c77007319 | 162 | #define NVIC_PriorityGroup_3 ((uint32_t)0x400) /*!< 3 bits for pre-emption priority |
mbed_official | 52:a51c77007319 | 163 | 1 bits for subpriority */ |
mbed_official | 52:a51c77007319 | 164 | #define NVIC_PriorityGroup_4 ((uint32_t)0x300) /*!< 4 bits for pre-emption priority |
mbed_official | 52:a51c77007319 | 165 | 0 bits for subpriority */ |
mbed_official | 52:a51c77007319 | 166 | |
mbed_official | 52:a51c77007319 | 167 | #define IS_NVIC_PRIORITY_GROUP(GROUP) (((GROUP) == NVIC_PriorityGroup_0) || \ |
mbed_official | 52:a51c77007319 | 168 | ((GROUP) == NVIC_PriorityGroup_1) || \ |
mbed_official | 52:a51c77007319 | 169 | ((GROUP) == NVIC_PriorityGroup_2) || \ |
mbed_official | 52:a51c77007319 | 170 | ((GROUP) == NVIC_PriorityGroup_3) || \ |
mbed_official | 52:a51c77007319 | 171 | ((GROUP) == NVIC_PriorityGroup_4)) |
mbed_official | 52:a51c77007319 | 172 | |
mbed_official | 52:a51c77007319 | 173 | #define IS_NVIC_PREEMPTION_PRIORITY(PRIORITY) ((PRIORITY) < 0x10) |
mbed_official | 52:a51c77007319 | 174 | |
mbed_official | 52:a51c77007319 | 175 | #define IS_NVIC_SUB_PRIORITY(PRIORITY) ((PRIORITY) < 0x10) |
mbed_official | 52:a51c77007319 | 176 | |
mbed_official | 52:a51c77007319 | 177 | #define IS_NVIC_OFFSET(OFFSET) ((OFFSET) < 0x000FFFFF) |
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 | /** @defgroup SysTick_clock_source |
mbed_official | 52:a51c77007319 | 184 | * @{ |
mbed_official | 52:a51c77007319 | 185 | */ |
mbed_official | 52:a51c77007319 | 186 | |
mbed_official | 52:a51c77007319 | 187 | #define SysTick_CLKSource_HCLK_Div8 ((uint32_t)0xFFFFFFFB) |
mbed_official | 52:a51c77007319 | 188 | #define SysTick_CLKSource_HCLK ((uint32_t)0x00000004) |
mbed_official | 52:a51c77007319 | 189 | #define IS_SYSTICK_CLK_SOURCE(SOURCE) (((SOURCE) == SysTick_CLKSource_HCLK) || \ |
mbed_official | 52:a51c77007319 | 190 | ((SOURCE) == SysTick_CLKSource_HCLK_Div8)) |
mbed_official | 52:a51c77007319 | 191 | /** |
mbed_official | 52:a51c77007319 | 192 | * @} |
mbed_official | 52:a51c77007319 | 193 | */ |
mbed_official | 52:a51c77007319 | 194 | |
mbed_official | 52:a51c77007319 | 195 | /** |
mbed_official | 52:a51c77007319 | 196 | * @} |
mbed_official | 52:a51c77007319 | 197 | */ |
mbed_official | 52:a51c77007319 | 198 | |
mbed_official | 52:a51c77007319 | 199 | /** @defgroup MISC_Exported_Macros |
mbed_official | 52:a51c77007319 | 200 | * @{ |
mbed_official | 52:a51c77007319 | 201 | */ |
mbed_official | 52:a51c77007319 | 202 | |
mbed_official | 52:a51c77007319 | 203 | /** |
mbed_official | 52:a51c77007319 | 204 | * @} |
mbed_official | 52:a51c77007319 | 205 | */ |
mbed_official | 52:a51c77007319 | 206 | |
mbed_official | 52:a51c77007319 | 207 | /** @defgroup MISC_Exported_Functions |
mbed_official | 52:a51c77007319 | 208 | * @{ |
mbed_official | 52:a51c77007319 | 209 | */ |
mbed_official | 52:a51c77007319 | 210 | |
mbed_official | 52:a51c77007319 | 211 | void NVIC_PriorityGroupConfig(uint32_t NVIC_PriorityGroup); |
mbed_official | 52:a51c77007319 | 212 | void NVIC_Init(NVIC_InitTypeDef* NVIC_InitStruct); |
mbed_official | 52:a51c77007319 | 213 | void NVIC_SetVectorTable(uint32_t NVIC_VectTab, uint32_t Offset); |
mbed_official | 52:a51c77007319 | 214 | void NVIC_SystemLPConfig(uint8_t LowPowerMode, FunctionalState NewState); |
mbed_official | 52:a51c77007319 | 215 | void SysTick_CLKSourceConfig(uint32_t SysTick_CLKSource); |
mbed_official | 52:a51c77007319 | 216 | |
mbed_official | 52:a51c77007319 | 217 | #ifdef __cplusplus |
mbed_official | 52:a51c77007319 | 218 | } |
mbed_official | 52:a51c77007319 | 219 | #endif |
mbed_official | 52:a51c77007319 | 220 | |
mbed_official | 52:a51c77007319 | 221 | #endif /* __MISC_H */ |
mbed_official | 52:a51c77007319 | 222 | |
mbed_official | 52:a51c77007319 | 223 | /** |
mbed_official | 52:a51c77007319 | 224 | * @} |
mbed_official | 52:a51c77007319 | 225 | */ |
mbed_official | 52:a51c77007319 | 226 | |
mbed_official | 52:a51c77007319 | 227 | /** |
mbed_official | 52:a51c77007319 | 228 | * @} |
mbed_official | 52:a51c77007319 | 229 | */ |
mbed_official | 52:a51c77007319 | 230 | |
mbed_official | 52:a51c77007319 | 231 | /** |
mbed_official | 52:a51c77007319 | 232 | * @} |
mbed_official | 52:a51c77007319 | 233 | */ |
mbed_official | 52:a51c77007319 | 234 | |
mbed_official | 84:f54042cbc282 | 235 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |