mbed library sources

Dependents:   Encrypted my_mbed lklk CyaSSL_DTLS_Cellular ... more

Superseded

This library was superseded by mbed-dev - https://os.mbed.com/users/mbed_official/code/mbed-dev/.

Development branch of the mbed library sources. This library is kept in synch with the latest changes from the mbed SDK and it is not guaranteed to work.

If you are looking for a stable and tested release, please import one of the official mbed library releases:

Import librarymbed

The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Committer:
mbed_official
Date:
Sat Feb 08 19:45:06 2014 +0000
Revision:
87:085cde657901
Child:
106:ced8cbb51063
Synchronized with git revision 9272cdeb45ec7e6077641536509413da8fd2ebc2

Full URL: https://github.com/mbedmicro/mbed/commit/9272cdeb45ec7e6077641536509413da8fd2ebc2/

Add NUCLEO_F401RE, improvements

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