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