mbed library sources

Fork of mbed-src by mbed official

Committer:
moirans2
Date:
Wed Jan 14 20:53:08 2015 +0000
Revision:
445:9a3ffe6cfa19
Parent:
441:d2c15dda23c1
internal clock stm32L051

Who changed what in which revision?

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