mbed library sources modified for open wear

Dependents:   openwear-lifelogger-example

Fork of mbed-src by mbed official

Committer:
janekm
Date:
Tue Sep 16 22:42:01 2014 +0000
Revision:
310:6188e0254baa
Parent:
226:b062af740e40
N/A

Who changed what in which revision?

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