mbed library sources

Dependents:   frdm_kl05z_gpio_test

Fork of mbed-src by mbed official

Committer:
shaoziyang
Date:
Sat Sep 13 14:25:46 2014 +0000
Revision:
323:9e901b0a5aa1
Parent:
218:44081b78fdc2
test with CLOCK_SETUP = 0

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 205:c41fc65bcfb4 1 /**
mbed_official 205:c41fc65bcfb4 2 ******************************************************************************
mbed_official 205:c41fc65bcfb4 3 * @file stm32f0xx_hal_cortex.c
mbed_official 205:c41fc65bcfb4 4 * @author MCD Application Team
mbed_official 205:c41fc65bcfb4 5 * @version V1.0.0
mbed_official 218:44081b78fdc2 6 * @date 28-May-2014
mbed_official 205:c41fc65bcfb4 7 * @brief CORTEX HAL module driver.
mbed_official 205:c41fc65bcfb4 8 * This file provides firmware functions to manage the following
mbed_official 205:c41fc65bcfb4 9 * functionalities of the CORTEX:
mbed_official 205:c41fc65bcfb4 10 * + Initialization and de-initialization functions
mbed_official 205:c41fc65bcfb4 11 * + Peripheral Control functions
mbed_official 205:c41fc65bcfb4 12 *
mbed_official 205:c41fc65bcfb4 13 * @verbatim
mbed_official 205:c41fc65bcfb4 14 ==============================================================================
mbed_official 205:c41fc65bcfb4 15 ##### How to use this driver #####
mbed_official 205:c41fc65bcfb4 16 ==============================================================================
mbed_official 205:c41fc65bcfb4 17
mbed_official 205:c41fc65bcfb4 18 [..]
mbed_official 205:c41fc65bcfb4 19 *** How to configure Interrupts using CORTEX HAL driver ***
mbed_official 205:c41fc65bcfb4 20 ===========================================================
mbed_official 205:c41fc65bcfb4 21 [..]
mbed_official 205:c41fc65bcfb4 22 This section provides functions allowing to configure the NVIC interrupts (IRQ).
mbed_official 205:c41fc65bcfb4 23 The Cortex-M0 exceptions are managed by CMSIS functions.
mbed_official 205:c41fc65bcfb4 24 (#) Enable and Configure the priority of the selected IRQ Channels.
mbed_official 205:c41fc65bcfb4 25 The priority can be 0..3.
mbed_official 205:c41fc65bcfb4 26
mbed_official 205:c41fc65bcfb4 27 -@- Lower priority values gives higher priority.
mbed_official 205:c41fc65bcfb4 28 -@- Priority Order:
mbed_official 205:c41fc65bcfb4 29 (#@) Lowest priority.
mbed_official 205:c41fc65bcfb4 30 (#@) Lowest hardware priority (IRQn position).
mbed_official 205:c41fc65bcfb4 31
mbed_official 205:c41fc65bcfb4 32 (#) Configure the priority of the selected IRQ Channels using HAL_NVIC_SetPriority()
mbed_official 205:c41fc65bcfb4 33
mbed_official 205:c41fc65bcfb4 34 (#) Enable the selected IRQ Channels using HAL_NVIC_EnableIRQ()
mbed_official 205:c41fc65bcfb4 35
mbed_official 205:c41fc65bcfb4 36
mbed_official 205:c41fc65bcfb4 37 [..]
mbed_official 205:c41fc65bcfb4 38 *** How to configure Systick using CORTEX HAL driver ***
mbed_official 205:c41fc65bcfb4 39 ========================================================
mbed_official 205:c41fc65bcfb4 40 [..]
mbed_official 205:c41fc65bcfb4 41 Setup SysTick Timer for time base
mbed_official 205:c41fc65bcfb4 42
mbed_official 205:c41fc65bcfb4 43 (+) The HAL_SYSTICK_Config()function calls the SysTick_Config() function which
mbed_official 205:c41fc65bcfb4 44 is a CMSIS function that:
mbed_official 205:c41fc65bcfb4 45 (++) Configures the SysTick Reload register with value passed as function parameter.
mbed_official 205:c41fc65bcfb4 46 (++) Configures the SysTick IRQ priority to the lowest value (0x03).
mbed_official 205:c41fc65bcfb4 47 (++) Resets the SysTick Counter register.
mbed_official 205:c41fc65bcfb4 48 (++) Configures the SysTick Counter clock source to be Core Clock Source (HCLK).
mbed_official 205:c41fc65bcfb4 49 (++) Enables the SysTick Interrupt.
mbed_official 205:c41fc65bcfb4 50 (++) Starts the SysTick Counter.
mbed_official 205:c41fc65bcfb4 51
mbed_official 205:c41fc65bcfb4 52 (+) You can change the SysTick Clock source to be HCLK_Div8 by calling the macro
mbed_official 205:c41fc65bcfb4 53 __HAL_CORTEX_SYSTICKCLK_CONFIG(SYSTICK_CLKSOURCE_HCLK_DIV8) just after the
mbed_official 205:c41fc65bcfb4 54 HAL_SYSTICK_Config() function call. The __HAL_CORTEX_SYSTICKCLK_CONFIG() macro is defined
mbed_official 205:c41fc65bcfb4 55 inside the stm32f0xx_hal_cortex.h file.
mbed_official 205:c41fc65bcfb4 56
mbed_official 205:c41fc65bcfb4 57 (+) You can change the SysTick IRQ priority by calling the
mbed_official 205:c41fc65bcfb4 58 HAL_NVIC_SetPriority(SysTick_IRQn,...) function just after the HAL_SYSTICK_Config() function
mbed_official 205:c41fc65bcfb4 59 call. The HAL_NVIC_SetPriority() call the NVIC_SetPriority() function which is a CMSIS function.
mbed_official 205:c41fc65bcfb4 60
mbed_official 205:c41fc65bcfb4 61 (+) To adjust the SysTick time base, use the following formula:
mbed_official 205:c41fc65bcfb4 62
mbed_official 205:c41fc65bcfb4 63 Reload Value = SysTick Counter Clock (Hz) x Desired Time base (s)
mbed_official 205:c41fc65bcfb4 64 (++) Reload Value is the parameter to be passed for HAL_SYSTICK_Config() function
mbed_official 205:c41fc65bcfb4 65 (++) Reload Value should not exceed 0xFFFFFF
mbed_official 205:c41fc65bcfb4 66
mbed_official 205:c41fc65bcfb4 67 @endverbatim
mbed_official 205:c41fc65bcfb4 68 ******************************************************************************
mbed_official 205:c41fc65bcfb4 69 * @attention
mbed_official 205:c41fc65bcfb4 70 *
mbed_official 205:c41fc65bcfb4 71 * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
mbed_official 205:c41fc65bcfb4 72 *
mbed_official 205:c41fc65bcfb4 73 * Redistribution and use in source and binary forms, with or without modification,
mbed_official 205:c41fc65bcfb4 74 * are permitted provided that the following conditions are met:
mbed_official 205:c41fc65bcfb4 75 * 1. Redistributions of source code must retain the above copyright notice,
mbed_official 205:c41fc65bcfb4 76 * this list of conditions and the following disclaimer.
mbed_official 205:c41fc65bcfb4 77 * 2. Redistributions in binary form must reproduce the above copyright notice,
mbed_official 205:c41fc65bcfb4 78 * this list of conditions and the following disclaimer in the documentation
mbed_official 205:c41fc65bcfb4 79 * and/or other materials provided with the distribution.
mbed_official 205:c41fc65bcfb4 80 * 3. Neither the name of STMicroelectronics nor the names of its contributors
mbed_official 205:c41fc65bcfb4 81 * may be used to endorse or promote products derived from this software
mbed_official 205:c41fc65bcfb4 82 * without specific prior written permission.
mbed_official 205:c41fc65bcfb4 83 *
mbed_official 205:c41fc65bcfb4 84 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
mbed_official 205:c41fc65bcfb4 85 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
mbed_official 205:c41fc65bcfb4 86 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
mbed_official 205:c41fc65bcfb4 87 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
mbed_official 205:c41fc65bcfb4 88 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
mbed_official 205:c41fc65bcfb4 89 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
mbed_official 205:c41fc65bcfb4 90 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
mbed_official 205:c41fc65bcfb4 91 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
mbed_official 205:c41fc65bcfb4 92 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
mbed_official 205:c41fc65bcfb4 93 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
mbed_official 205:c41fc65bcfb4 94 *
mbed_official 205:c41fc65bcfb4 95 ******************************************************************************
mbed_official 205:c41fc65bcfb4 96 */
mbed_official 205:c41fc65bcfb4 97
mbed_official 205:c41fc65bcfb4 98 /* Includes ------------------------------------------------------------------*/
mbed_official 205:c41fc65bcfb4 99 #include "stm32f0xx_hal.h"
mbed_official 205:c41fc65bcfb4 100
mbed_official 205:c41fc65bcfb4 101 /** @addtogroup STM32F0xx_HAL_Driver
mbed_official 205:c41fc65bcfb4 102 * @{
mbed_official 205:c41fc65bcfb4 103 */
mbed_official 205:c41fc65bcfb4 104
mbed_official 205:c41fc65bcfb4 105 /** @defgroup CORTEX
mbed_official 205:c41fc65bcfb4 106 * @brief CORTEX HAL module driver
mbed_official 205:c41fc65bcfb4 107 * @{
mbed_official 205:c41fc65bcfb4 108 */
mbed_official 205:c41fc65bcfb4 109
mbed_official 205:c41fc65bcfb4 110 #ifdef HAL_CORTEX_MODULE_ENABLED
mbed_official 205:c41fc65bcfb4 111
mbed_official 205:c41fc65bcfb4 112 /* Private typedef -----------------------------------------------------------*/
mbed_official 205:c41fc65bcfb4 113 /* Private define ------------------------------------------------------------*/
mbed_official 205:c41fc65bcfb4 114 /* Private macro -------------------------------------------------------------*/
mbed_official 205:c41fc65bcfb4 115 /* Private variables ---------------------------------------------------------*/
mbed_official 205:c41fc65bcfb4 116 /* Private function prototypes -----------------------------------------------*/
mbed_official 205:c41fc65bcfb4 117 /* Private functions ---------------------------------------------------------*/
mbed_official 205:c41fc65bcfb4 118
mbed_official 205:c41fc65bcfb4 119 /** @defgroup CORTEX_Private_Functions
mbed_official 205:c41fc65bcfb4 120 * @{
mbed_official 205:c41fc65bcfb4 121 */
mbed_official 205:c41fc65bcfb4 122
mbed_official 205:c41fc65bcfb4 123
mbed_official 205:c41fc65bcfb4 124 /** @defgroup CORTEX_Group1 Initialization and de-initialization functions
mbed_official 205:c41fc65bcfb4 125 * @brief Initialization and Configuration functions
mbed_official 205:c41fc65bcfb4 126 *
mbed_official 205:c41fc65bcfb4 127 @verbatim
mbed_official 205:c41fc65bcfb4 128 ==============================================================================
mbed_official 205:c41fc65bcfb4 129 ##### Initialization and de-initialization functions #####
mbed_official 205:c41fc65bcfb4 130 ==============================================================================
mbed_official 205:c41fc65bcfb4 131 [..]
mbed_official 205:c41fc65bcfb4 132 This section provides the CORTEX HAL driver functions allowing to configure Interrupts
mbed_official 205:c41fc65bcfb4 133 Systick functionalities
mbed_official 205:c41fc65bcfb4 134
mbed_official 205:c41fc65bcfb4 135 @endverbatim
mbed_official 205:c41fc65bcfb4 136 * @{
mbed_official 205:c41fc65bcfb4 137 */
mbed_official 205:c41fc65bcfb4 138
mbed_official 205:c41fc65bcfb4 139 /**
mbed_official 205:c41fc65bcfb4 140 * @brief Sets the priority of an interrupt.
mbed_official 205:c41fc65bcfb4 141 * @param IRQn: External interrupt number .
mbed_official 205:c41fc65bcfb4 142 * This parameter can be an enumerator of IRQn_Type enumeration
mbed_official 205:c41fc65bcfb4 143 * (For the complete STM32 Devices IRQ Channels list, please refer to stm32l0xx.h file)
mbed_official 205:c41fc65bcfb4 144 * @param PreemptPriority: The pre-emption priority for the IRQn channel.
mbed_official 205:c41fc65bcfb4 145 * This parameter can be a value between 0 and 3.
mbed_official 205:c41fc65bcfb4 146 * A lower priority value indicates a higher priority
mbed_official 205:c41fc65bcfb4 147 * @param SubPriority: The subpriority level for the IRQ channel.
mbed_official 205:c41fc65bcfb4 148 * with stm32f0xx devices, this parameter is a dummy value and it is ignored, because
mbed_official 205:c41fc65bcfb4 149 * no subpriority supported in Cortex M0 based products.
mbed_official 205:c41fc65bcfb4 150 * @retval None
mbed_official 205:c41fc65bcfb4 151 */
mbed_official 205:c41fc65bcfb4 152 void HAL_NVIC_SetPriority(IRQn_Type IRQn, uint32_t PreemptPriority, uint32_t SubPriority)
mbed_official 205:c41fc65bcfb4 153 {
mbed_official 205:c41fc65bcfb4 154 /* Check the parameters */
mbed_official 205:c41fc65bcfb4 155 assert_param(IS_NVIC_PREEMPTION_PRIORITY(PreemptPriority));
mbed_official 205:c41fc65bcfb4 156 NVIC_SetPriority(IRQn,PreemptPriority);
mbed_official 205:c41fc65bcfb4 157 }
mbed_official 205:c41fc65bcfb4 158
mbed_official 205:c41fc65bcfb4 159 /**
mbed_official 205:c41fc65bcfb4 160 * @brief Enables a device specific interrupt in the NVIC interrupt controller.
mbed_official 205:c41fc65bcfb4 161 * @note To configure interrupts priority correctly, the NVIC_PriorityGroupConfig()
mbed_official 205:c41fc65bcfb4 162 * function should be called before.
mbed_official 205:c41fc65bcfb4 163 * @param IRQn External interrupt number
mbed_official 205:c41fc65bcfb4 164 * This parameter can be an enumerator of IRQn_Type enumeration
mbed_official 205:c41fc65bcfb4 165 * (For the complete STM32 Devices IRQ Channels list, please refer to the appropriate CMSIS device file (stm32f0xxxx.h))
mbed_official 205:c41fc65bcfb4 166 * @retval None
mbed_official 205:c41fc65bcfb4 167 */
mbed_official 205:c41fc65bcfb4 168 void HAL_NVIC_EnableIRQ(IRQn_Type IRQn)
mbed_official 205:c41fc65bcfb4 169 {
mbed_official 205:c41fc65bcfb4 170 /* Enable interrupt */
mbed_official 205:c41fc65bcfb4 171 NVIC_EnableIRQ(IRQn);
mbed_official 205:c41fc65bcfb4 172 }
mbed_official 205:c41fc65bcfb4 173
mbed_official 205:c41fc65bcfb4 174 /**
mbed_official 205:c41fc65bcfb4 175 * @brief Disables a device specific interrupt in the NVIC interrupt controller.
mbed_official 205:c41fc65bcfb4 176 * @param IRQn External interrupt number
mbed_official 205:c41fc65bcfb4 177 * This parameter can be an enumerator of IRQn_Type enumeration
mbed_official 205:c41fc65bcfb4 178 * (For the complete STM32 Devices IRQ Channels list, please refer to the appropriate CMSIS device file (stm32f0xxxx.h))
mbed_official 205:c41fc65bcfb4 179 * @retval None
mbed_official 205:c41fc65bcfb4 180 */
mbed_official 205:c41fc65bcfb4 181 void HAL_NVIC_DisableIRQ(IRQn_Type IRQn)
mbed_official 205:c41fc65bcfb4 182 {
mbed_official 205:c41fc65bcfb4 183 /* Disable interrupt */
mbed_official 205:c41fc65bcfb4 184 NVIC_DisableIRQ(IRQn);
mbed_official 205:c41fc65bcfb4 185 }
mbed_official 205:c41fc65bcfb4 186
mbed_official 205:c41fc65bcfb4 187 /**
mbed_official 205:c41fc65bcfb4 188 * @brief Initiates a system reset request to reset the MCU.
mbed_official 205:c41fc65bcfb4 189 * @param None
mbed_official 205:c41fc65bcfb4 190 * @retval None
mbed_official 205:c41fc65bcfb4 191 */
mbed_official 205:c41fc65bcfb4 192 void HAL_NVIC_SystemReset(void)
mbed_official 205:c41fc65bcfb4 193 {
mbed_official 205:c41fc65bcfb4 194 /* System Reset */
mbed_official 205:c41fc65bcfb4 195 NVIC_SystemReset();
mbed_official 205:c41fc65bcfb4 196 }
mbed_official 205:c41fc65bcfb4 197
mbed_official 205:c41fc65bcfb4 198 /**
mbed_official 205:c41fc65bcfb4 199 * @brief Initializes the System Timer and its interrupt, and starts the System Tick Timer.
mbed_official 205:c41fc65bcfb4 200 * Counter is in free running mode to generate periodic interrupts.
mbed_official 205:c41fc65bcfb4 201 * @param TicksNumb: Specifies the ticks Number of ticks between two interrupts.
mbed_official 205:c41fc65bcfb4 202 * @retval status: - 0 Function succeeded.
mbed_official 205:c41fc65bcfb4 203 * - 1 Function failed.
mbed_official 205:c41fc65bcfb4 204 */
mbed_official 205:c41fc65bcfb4 205 uint32_t HAL_SYSTICK_Config(uint32_t TicksNumb)
mbed_official 205:c41fc65bcfb4 206 {
mbed_official 205:c41fc65bcfb4 207 return SysTick_Config(TicksNumb);
mbed_official 205:c41fc65bcfb4 208 }
mbed_official 205:c41fc65bcfb4 209 /**
mbed_official 205:c41fc65bcfb4 210 * @}
mbed_official 205:c41fc65bcfb4 211 */
mbed_official 205:c41fc65bcfb4 212
mbed_official 205:c41fc65bcfb4 213 /** @defgroup CORTEX_Group2 Peripheral Control functions
mbed_official 205:c41fc65bcfb4 214 * @brief Cortex control functions
mbed_official 205:c41fc65bcfb4 215 *
mbed_official 205:c41fc65bcfb4 216 @verbatim
mbed_official 205:c41fc65bcfb4 217 ==============================================================================
mbed_official 205:c41fc65bcfb4 218 ##### Peripheral Control functions #####
mbed_official 205:c41fc65bcfb4 219 ==============================================================================
mbed_official 205:c41fc65bcfb4 220 [..]
mbed_official 205:c41fc65bcfb4 221 This subsection provides a set of functions allowing to control the CORTEX
mbed_official 205:c41fc65bcfb4 222 (NVIC, SYSTICK) functionalities.
mbed_official 205:c41fc65bcfb4 223
mbed_official 205:c41fc65bcfb4 224
mbed_official 205:c41fc65bcfb4 225 @endverbatim
mbed_official 205:c41fc65bcfb4 226 * @{
mbed_official 205:c41fc65bcfb4 227 */
mbed_official 205:c41fc65bcfb4 228
mbed_official 205:c41fc65bcfb4 229
mbed_official 205:c41fc65bcfb4 230 /**
mbed_official 205:c41fc65bcfb4 231 * @brief Gets the priority of an interrupt.
mbed_official 205:c41fc65bcfb4 232 * @param IRQn: External interrupt number
mbed_official 205:c41fc65bcfb4 233 * This parameter can be an enumerator of IRQn_Type enumeration
mbed_official 205:c41fc65bcfb4 234 * (For the complete STM32 Devices IRQ Channels list, please refer to the appropriate CMSIS device file (stm32f0xxxx.h))
mbed_official 205:c41fc65bcfb4 235 * @retval None
mbed_official 205:c41fc65bcfb4 236 */
mbed_official 205:c41fc65bcfb4 237 uint32_t HAL_NVIC_GetPriority(IRQn_Type IRQn)
mbed_official 205:c41fc65bcfb4 238 {
mbed_official 205:c41fc65bcfb4 239 /* Get priority for Cortex-M system or device specific interrupts */
mbed_official 205:c41fc65bcfb4 240 return NVIC_GetPriority(IRQn);
mbed_official 205:c41fc65bcfb4 241 }
mbed_official 205:c41fc65bcfb4 242
mbed_official 205:c41fc65bcfb4 243 /**
mbed_official 205:c41fc65bcfb4 244 * @brief Sets Pending bit of an external interrupt.
mbed_official 205:c41fc65bcfb4 245 * @param IRQn External interrupt number
mbed_official 205:c41fc65bcfb4 246 * This parameter can be an enumerator of IRQn_Type enumeration
mbed_official 205:c41fc65bcfb4 247 * (For the complete STM32 Devices IRQ Channels list, please refer to the appropriate CMSIS device file (stm32f0xxxx.h))
mbed_official 205:c41fc65bcfb4 248 * @retval None
mbed_official 205:c41fc65bcfb4 249 */
mbed_official 205:c41fc65bcfb4 250 void HAL_NVIC_SetPendingIRQ(IRQn_Type IRQn)
mbed_official 205:c41fc65bcfb4 251 {
mbed_official 205:c41fc65bcfb4 252 /* Set interrupt pending */
mbed_official 205:c41fc65bcfb4 253 NVIC_SetPendingIRQ(IRQn);
mbed_official 205:c41fc65bcfb4 254 }
mbed_official 205:c41fc65bcfb4 255
mbed_official 205:c41fc65bcfb4 256 /**
mbed_official 205:c41fc65bcfb4 257 * @brief Gets Pending Interrupt (reads the pending register in the NVIC
mbed_official 205:c41fc65bcfb4 258 * and returns the pending bit for the specified interrupt).
mbed_official 205:c41fc65bcfb4 259 * @param IRQn External interrupt number
mbed_official 205:c41fc65bcfb4 260 * This parameter can be an enumerator of IRQn_Type enumeration
mbed_official 205:c41fc65bcfb4 261 * (For the complete STM32 Devices IRQ Channels list, please refer to the appropriate CMSIS device file (stm32f0xxxx.h))
mbed_official 205:c41fc65bcfb4 262 * @retval status: - 0 Interrupt status is not pending.
mbed_official 205:c41fc65bcfb4 263 * - 1 Interrupt status is pending.
mbed_official 205:c41fc65bcfb4 264 */
mbed_official 205:c41fc65bcfb4 265 uint32_t HAL_NVIC_GetPendingIRQ(IRQn_Type IRQn)
mbed_official 205:c41fc65bcfb4 266 {
mbed_official 205:c41fc65bcfb4 267 /* Return 1 if pending else 0 */
mbed_official 205:c41fc65bcfb4 268 return NVIC_GetPendingIRQ(IRQn);
mbed_official 205:c41fc65bcfb4 269 }
mbed_official 205:c41fc65bcfb4 270
mbed_official 205:c41fc65bcfb4 271 /**
mbed_official 205:c41fc65bcfb4 272 * @brief Clears the pending bit of an external interrupt.
mbed_official 205:c41fc65bcfb4 273 * @param IRQn External interrupt number
mbed_official 205:c41fc65bcfb4 274 * This parameter can be an enumerator of IRQn_Type enumeration
mbed_official 205:c41fc65bcfb4 275 * (For the complete STM32 Devices IRQ Channels list, please refer to the appropriate CMSIS device file (stm32f0xxxx.h))
mbed_official 205:c41fc65bcfb4 276 * @retval None
mbed_official 205:c41fc65bcfb4 277 */
mbed_official 205:c41fc65bcfb4 278 void HAL_NVIC_ClearPendingIRQ(IRQn_Type IRQn)
mbed_official 205:c41fc65bcfb4 279 {
mbed_official 205:c41fc65bcfb4 280 /* Clear pending interrupt */
mbed_official 205:c41fc65bcfb4 281 NVIC_ClearPendingIRQ(IRQn);
mbed_official 205:c41fc65bcfb4 282 }
mbed_official 205:c41fc65bcfb4 283
mbed_official 205:c41fc65bcfb4 284 /**
mbed_official 205:c41fc65bcfb4 285 * @brief Configures the SysTick clock source.
mbed_official 205:c41fc65bcfb4 286 * @param CLKSource: specifies the SysTick clock source.
mbed_official 205:c41fc65bcfb4 287 * This parameter can be one of the following values:
mbed_official 205:c41fc65bcfb4 288 * @arg SYSTICK_CLKSOURCE_HCLK_DIV8: AHB clock divided by 8 selected as SysTick clock source.
mbed_official 205:c41fc65bcfb4 289 * @arg SYSTICK_CLKSOURCE_HCLK: AHB clock selected as SysTick clock source.
mbed_official 205:c41fc65bcfb4 290 * @retval None
mbed_official 205:c41fc65bcfb4 291 */
mbed_official 205:c41fc65bcfb4 292 void HAL_SYSTICK_CLKSourceConfig(uint32_t CLKSource)
mbed_official 205:c41fc65bcfb4 293 {
mbed_official 205:c41fc65bcfb4 294 /* Check the parameters */
mbed_official 205:c41fc65bcfb4 295 assert_param(IS_SYSTICK_CLKSOURCE(CLKSource));
mbed_official 205:c41fc65bcfb4 296 if (CLKSource == SYSTICK_CLKSOURCE_HCLK)
mbed_official 205:c41fc65bcfb4 297 {
mbed_official 205:c41fc65bcfb4 298 SysTick->CTRL |= SYSTICK_CLKSOURCE_HCLK;
mbed_official 205:c41fc65bcfb4 299 }
mbed_official 205:c41fc65bcfb4 300 else
mbed_official 205:c41fc65bcfb4 301 {
mbed_official 205:c41fc65bcfb4 302 SysTick->CTRL &= ~SYSTICK_CLKSOURCE_HCLK;
mbed_official 205:c41fc65bcfb4 303 }
mbed_official 205:c41fc65bcfb4 304 }
mbed_official 205:c41fc65bcfb4 305
mbed_official 205:c41fc65bcfb4 306 /**
mbed_official 205:c41fc65bcfb4 307 * @brief This function handles SYSTICK interrupt request.
mbed_official 205:c41fc65bcfb4 308 * @param None
mbed_official 205:c41fc65bcfb4 309 * @retval None
mbed_official 205:c41fc65bcfb4 310 */
mbed_official 205:c41fc65bcfb4 311 void HAL_SYSTICK_IRQHandler(void)
mbed_official 205:c41fc65bcfb4 312 {
mbed_official 205:c41fc65bcfb4 313 HAL_SYSTICK_Callback();
mbed_official 205:c41fc65bcfb4 314 }
mbed_official 205:c41fc65bcfb4 315
mbed_official 205:c41fc65bcfb4 316 /**
mbed_official 205:c41fc65bcfb4 317 * @brief SYSTICK callback.
mbed_official 205:c41fc65bcfb4 318 * @param None
mbed_official 205:c41fc65bcfb4 319 * @retval None
mbed_official 205:c41fc65bcfb4 320 */
mbed_official 205:c41fc65bcfb4 321 __weak void HAL_SYSTICK_Callback(void)
mbed_official 205:c41fc65bcfb4 322 {
mbed_official 205:c41fc65bcfb4 323 /* NOTE : This function Should not be modified, when the callback is needed,
mbed_official 205:c41fc65bcfb4 324 the HAL_SYSTICK_Callback could be implemented in the user file
mbed_official 205:c41fc65bcfb4 325 */
mbed_official 205:c41fc65bcfb4 326 }
mbed_official 205:c41fc65bcfb4 327
mbed_official 205:c41fc65bcfb4 328 /**
mbed_official 205:c41fc65bcfb4 329 * @}
mbed_official 205:c41fc65bcfb4 330 */
mbed_official 205:c41fc65bcfb4 331
mbed_official 205:c41fc65bcfb4 332 /**
mbed_official 205:c41fc65bcfb4 333 * @}
mbed_official 205:c41fc65bcfb4 334 */
mbed_official 205:c41fc65bcfb4 335
mbed_official 205:c41fc65bcfb4 336 #endif /* HAL_CORTEX_MODULE_ENABLED */
mbed_official 205:c41fc65bcfb4 337 /**
mbed_official 205:c41fc65bcfb4 338 * @}
mbed_official 205:c41fc65bcfb4 339 */
mbed_official 205:c41fc65bcfb4 340
mbed_official 205:c41fc65bcfb4 341 /**
mbed_official 205:c41fc65bcfb4 342 * @}
mbed_official 205:c41fc65bcfb4 343 */
mbed_official 205:c41fc65bcfb4 344
mbed_official 205:c41fc65bcfb4 345 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/