HAL_misc.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. /**
  2. ******************************************************************************
  3. * @file HAL_misc.h
  4. * @author AE Team
  5. * @version V1.1.0
  6. * @date 28/08/2019
  7. * @brief This file contains all the functions prototypes for the
  8. * miscellaneous firmware library functions.
  9. ******************************************************************************
  10. * @copy
  11. *
  12. * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
  13. * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
  14. * TIME. AS A RESULT, MindMotion SHALL NOT BE HELD LIABLE FOR ANY
  15. * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
  16. * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
  17. * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
  18. *
  19. * <h2><center>&copy; COPYRIGHT 2019 MindMotion</center></h2>
  20. */
  21. /* Define to prevent recursive inclusion -------------------------------------*/
  22. #ifndef __MISC_H
  23. #define __MISC_H
  24. /* Includes ------------------------------------------------------------------*/
  25. #include "HAL_device.h"
  26. /** @addtogroup StdPeriph_Driver
  27. * @{
  28. */
  29. /** @addtogroup MISC
  30. * @{
  31. */
  32. /** @defgroup MISC_Exported_Types
  33. * @{
  34. */
  35. /**
  36. * @brief NVIC Init Structure definition
  37. */
  38. typedef struct
  39. {
  40. uint8_t NVIC_IRQChannel;
  41. uint8_t NVIC_IRQChannelPreemptionPriority;
  42. uint8_t NVIC_IRQChannelSubPriority;
  43. FunctionalState NVIC_IRQChannelCmd;
  44. } NVIC_InitTypeDef;
  45. /**
  46. * @}
  47. */
  48. /** @defgroup MISC_Exported_Constants
  49. * @{
  50. */
  51. /** @defgroup Vector_Table_Base
  52. * @{
  53. */
  54. #define NVIC_VectTab_RAM ((uint32_t)0x20000000)
  55. #define NVIC_VectTab_FLASH ((uint32_t)0x08000000)
  56. #define IS_NVIC_VECTTAB(VECTTAB) (((VECTTAB) == NVIC_VectTab_RAM) || \
  57. ((VECTTAB) == NVIC_VectTab_FLASH))
  58. /**
  59. * @}
  60. */
  61. /** @defgroup System_Low_Power
  62. * @{
  63. */
  64. #define NVIC_LP_SEVONPEND ((uint8_t)0x10)
  65. #define NVIC_LP_SLEEPDEEP ((uint8_t)0x04)
  66. #define NVIC_LP_SLEEPONEXIT ((uint8_t)0x02)
  67. #define IS_NVIC_LP(LP) (((LP) == NVIC_LP_SEVONPEND) || \
  68. ((LP) == NVIC_LP_SLEEPDEEP) || \
  69. ((LP) == NVIC_LP_SLEEPONEXIT))
  70. /**
  71. * @}
  72. */
  73. /** @defgroup Preemption_Priority_Group
  74. * @{
  75. */
  76. #define NVIC_PriorityGroup_0 ((uint32_t)0x700) /* 0 bits for pre-emption priority
  77. 4 bits for subpriority */
  78. #define NVIC_PriorityGroup_1 ((uint32_t)0x600) /* 1 bits for pre-emption priority
  79. 3 bits for subpriority */
  80. #define NVIC_PriorityGroup_2 ((uint32_t)0x500) /* 2 bits for pre-emption priority
  81. 2 bits for subpriority */
  82. #define NVIC_PriorityGroup_3 ((uint32_t)0x400) /* 3 bits for pre-emption priority
  83. 1 bits for subpriority */
  84. #define NVIC_PriorityGroup_4 ((uint32_t)0x300) /* 4 bits for pre-emption priority
  85. 0 bits for subpriority */
  86. #define IS_NVIC_PRIORITY_GROUP(GROUP) (((GROUP) == NVIC_PriorityGroup_0) || \
  87. ((GROUP) == NVIC_PriorityGroup_1) || \
  88. ((GROUP) == NVIC_PriorityGroup_2) || \
  89. ((GROUP) == NVIC_PriorityGroup_3) || \
  90. ((GROUP) == NVIC_PriorityGroup_4))
  91. #define IS_NVIC_PREEMPTION_PRIORITY(PRIORITY) ((PRIORITY) < 0x10)
  92. #define IS_NVIC_SUB_PRIORITY(PRIORITY) ((PRIORITY) < 0x10)
  93. #define IS_NVIC_OFFSET(OFFSET) ((OFFSET) < 0x0007FFFF)
  94. /**
  95. * @}
  96. */
  97. /** @defgroup SysTick_clock_source
  98. * @{
  99. */
  100. #define SysTick_CLKSource_HCLK_Div8 ((uint32_t)0xFFFFFFFB)
  101. #define SysTick_CLKSource_HCLK ((uint32_t)0x00000004)
  102. #define IS_SYSTICK_CLK_SOURCE(SOURCE) (((SOURCE) == SysTick_CLKSource_HCLK) || \
  103. ((SOURCE) == SysTick_CLKSource_HCLK_Div8))
  104. /**
  105. * @}
  106. */
  107. /**
  108. * @}
  109. */
  110. /** @defgroup MISC_Exported_Macros
  111. * @{
  112. */
  113. /**
  114. * @}
  115. */
  116. /** @defgroup MISC_Exported_Functions
  117. * @{
  118. */
  119. void NVIC_PriorityGroupConfig(uint32_t NVIC_PriorityGroup);
  120. void NVIC_Init(NVIC_InitTypeDef* NVIC_InitStruct);
  121. void NVIC_SetVectorTable(uint32_t NVIC_VectTab, uint32_t Offset);
  122. void NVIC_SystemLPConfig(uint8_t LowPowerMode, FunctionalState NewState);
  123. void SysTick_CLKSourceConfig(uint32_t SysTick_CLKSource);
  124. #endif /* __MISC_H */
  125. /**
  126. * @}
  127. */
  128. /**
  129. * @}
  130. */
  131. /**
  132. * @}
  133. */
  134. /*-------------------------(C) COPYRIGHT 2019 MindMotion ----------------------*/