annotate Common/Drivers/STM32F4xx_HAL_DRIVER_v120/Src/stm32f4xx_hal_cortex.c @ 75:2b3f8ed4a0b8

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