stm32l1xx_hal_cortex.h 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. /**
  2. ******************************************************************************
  3. * @file stm32l1xx_hal_cortex.h
  4. * @author MCD Application Team
  5. * @version V1.0.0
  6. * @date 5-September-2014
  7. * @brief Header file of CORTEX HAL module.
  8. ******************************************************************************
  9. * @attention
  10. *
  11. * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
  12. *
  13. * Redistribution and use in source and binary forms, with or without modification,
  14. * are permitted provided that the following conditions are met:
  15. * 1. Redistributions of source code must retain the above copyright notice,
  16. * this list of conditions and the following disclaimer.
  17. * 2. Redistributions in binary form must reproduce the above copyright notice,
  18. * this list of conditions and the following disclaimer in the documentation
  19. * and/or other materials provided with the distribution.
  20. * 3. Neither the name of STMicroelectronics nor the names of its contributors
  21. * may be used to endorse or promote products derived from this software
  22. * without specific prior written permission.
  23. *
  24. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  25. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  26. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  27. * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
  28. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  29. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  30. * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  31. * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  32. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  33. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  34. *
  35. ******************************************************************************
  36. */
  37. /* Define to prevent recursive inclusion -------------------------------------*/
  38. #ifndef __STM32L1xx_HAL_CORTEX_H
  39. #define __STM32L1xx_HAL_CORTEX_H
  40. #ifdef __cplusplus
  41. extern "C" {
  42. #endif
  43. /* Includes ------------------------------------------------------------------*/
  44. #include "stm32l1xx_hal_def.h"
  45. /** @addtogroup STM32L1xx_HAL_Driver
  46. * @{
  47. */
  48. /** @addtogroup CORTEX
  49. * @{
  50. */
  51. /* Exported types ------------------------------------------------------------*/
  52. /* Exported constants --------------------------------------------------------*/
  53. /** @defgroup CORTEX_Exported_Constants CORTEX Exported Constants
  54. * @{
  55. */
  56. /** @defgroup CORTEX_Preemption_Priority_Group CORTEX Preemption Priority Group
  57. * @{
  58. */
  59. #define NVIC_PRIORITYGROUP_0 ((uint32_t)0x00000007) /*!< 0 bits for pre-emption priority
  60. 4 bits for subpriority */
  61. #define NVIC_PRIORITYGROUP_1 ((uint32_t)0x00000006) /*!< 1 bits for pre-emption priority
  62. 3 bits for subpriority */
  63. #define NVIC_PRIORITYGROUP_2 ((uint32_t)0x00000005) /*!< 2 bits for pre-emption priority
  64. 2 bits for subpriority */
  65. #define NVIC_PRIORITYGROUP_3 ((uint32_t)0x00000004) /*!< 3 bits for pre-emption priority
  66. 1 bits for subpriority */
  67. #define NVIC_PRIORITYGROUP_4 ((uint32_t)0x00000003) /*!< 4 bits for pre-emption priority
  68. 0 bits for subpriority */
  69. /**
  70. * @}
  71. */
  72. /** @defgroup CORTEX_SysTick_clock_source CORTEX SysTick clock source
  73. * @{
  74. */
  75. #define SYSTICK_CLKSOURCE_HCLK_DIV8 ((uint32_t)0x00000000)
  76. #define SYSTICK_CLKSOURCE_HCLK ((uint32_t)0x00000004)
  77. /**
  78. * @}
  79. */
  80. /**
  81. * @}
  82. */
  83. /* Exported Macros -----------------------------------------------------------*/
  84. /** @defgroup CORTEX_Exported_Macros CORTEX Exported Macros
  85. * @{
  86. */
  87. /** @defgroup CORTEX_Preemption_Priority_Group_Macro CORTEX Preemption Priority Group
  88. * @{
  89. */
  90. #define IS_NVIC_PRIORITY_GROUP(GROUP) (((GROUP) == NVIC_PRIORITYGROUP_0) || \
  91. ((GROUP) == NVIC_PRIORITYGROUP_1) || \
  92. ((GROUP) == NVIC_PRIORITYGROUP_2) || \
  93. ((GROUP) == NVIC_PRIORITYGROUP_3) || \
  94. ((GROUP) == NVIC_PRIORITYGROUP_4))
  95. #define IS_NVIC_PREEMPTION_PRIORITY(PRIORITY) ((PRIORITY) < 0x10)
  96. #define IS_NVIC_SUB_PRIORITY(PRIORITY) ((PRIORITY) < 0x10)
  97. /**
  98. * @}
  99. */
  100. /** @defgroup CORTEX_SysTick_clock_source_Macro_Exported CORTEX SysTick clock source
  101. * @{
  102. */
  103. /** @brief Configures the SysTick clock source.
  104. * @param __CLKSRC__: specifies the SysTick clock source.
  105. * This parameter can be one of the following values:
  106. * @arg SYSTICK_CLKSOURCE_HCLK_DIV8: AHB clock divided by 8 selected as SysTick clock source.
  107. * @arg SYSTICK_CLKSOURCE_HCLK: AHB clock selected as SysTick clock source.
  108. * @retval None
  109. */
  110. #define __HAL_CORTEX_SYSTICKCLK_CONFIG(__CLKSRC__) \
  111. do { \
  112. if ((__CLKSRC__) == SYSTICK_CLKSOURCE_HCLK) \
  113. { \
  114. SysTick->CTRL |= SYSTICK_CLKSOURCE_HCLK; \
  115. } \
  116. else \
  117. SysTick->CTRL &= ~SYSTICK_CLKSOURCE_HCLK; \
  118. } while(0)
  119. /**
  120. * @}
  121. */
  122. /**
  123. * @}
  124. */
  125. /* Private macro -------------------------------------------------------------*/
  126. /** @defgroup CORTEX_Private_Macros CORTEX Private Macros
  127. * @{
  128. */
  129. /** @defgroup CORTEX_SysTick_clock_source_Macro_Private CORTEX SysTick clock source
  130. * @{
  131. */
  132. #define IS_SYSTICK_CLK_SOURCE(SOURCE) (((SOURCE) == SYSTICK_CLKSOURCE_HCLK) || \
  133. ((SOURCE) == SYSTICK_CLKSOURCE_HCLK_DIV8))
  134. /**
  135. * @}
  136. */
  137. /**
  138. * @}
  139. */
  140. /* Exported functions --------------------------------------------------------*/
  141. /** @addtogroup CORTEX_Exported_Functions
  142. * @{
  143. */
  144. /** @addtogroup CORTEX_Exported_Functions_Group1
  145. * @{
  146. */
  147. /* Initialization and de-initialization functions *****************************/
  148. void HAL_NVIC_SetPriorityGrouping(uint32_t PriorityGroup);
  149. void HAL_NVIC_SetPriority(IRQn_Type IRQn, uint32_t PreemptPriority, uint32_t SubPriority);
  150. void HAL_NVIC_EnableIRQ(IRQn_Type IRQn);
  151. void HAL_NVIC_DisableIRQ(IRQn_Type IRQn);
  152. void HAL_NVIC_SystemReset(void);
  153. uint32_t HAL_SYSTICK_Config(uint32_t TicksNumb);
  154. /**
  155. * @}
  156. */
  157. /** @addtogroup CORTEX_Exported_Functions_Group2
  158. * @{
  159. */
  160. /* Peripheral Control functions ***********************************************/
  161. uint32_t HAL_NVIC_GetPriorityGrouping(void);
  162. void HAL_NVIC_GetPriority(IRQn_Type IRQn, uint32_t PriorityGroup, uint32_t* pPreemptPriority, uint32_t* pSubPriority);
  163. uint32_t HAL_NVIC_GetPendingIRQ(IRQn_Type IRQn);
  164. void HAL_NVIC_SetPendingIRQ(IRQn_Type IRQn);
  165. void HAL_NVIC_ClearPendingIRQ(IRQn_Type IRQn);
  166. uint32_t HAL_NVIC_GetActive(IRQn_Type IRQn);
  167. void HAL_SYSTICK_CLKSourceConfig(uint32_t CLKSource);
  168. void HAL_SYSTICK_IRQHandler(void);
  169. void HAL_SYSTICK_Callback(void);
  170. /**
  171. * @}
  172. */
  173. /**
  174. * @}
  175. */
  176. /**
  177. * @}
  178. */
  179. /**
  180. * @}
  181. */
  182. #ifdef __cplusplus
  183. }
  184. #endif
  185. #endif /* __STM32L1xx_HAL_CORTEX_H */
  186. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/