apm32f10x_misc.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. /*!
  2. * @file apm32f10x_misc.h
  3. *
  4. * @brief This file provides all the miscellaneous firmware functions.
  5. * Include NVIC,SystemTick and Power management.
  6. *
  7. * @version V1.0.4
  8. *
  9. * @date 2022-12-01
  10. *
  11. * @attention
  12. *
  13. * Copyright (C) 2020-2022 Geehy Semiconductor
  14. *
  15. * You may not use this file except in compliance with the
  16. * GEEHY COPYRIGHT NOTICE (GEEHY SOFTWARE PACKAGE LICENSE).
  17. *
  18. * The program is only for reference, which is distributed in the hope
  19. * that it will be useful and instructional for customers to develop
  20. * their software. Unless required by applicable law or agreed to in
  21. * writing, the program is distributed on an "AS IS" BASIS, WITHOUT
  22. * ANY WARRANTY OR CONDITIONS OF ANY KIND, either express or implied.
  23. * See the GEEHY SOFTWARE PACKAGE LICENSE for the governing permissions
  24. * and limitations under the License.
  25. */
  26. /* Define to prevent recursive inclusion */
  27. #ifndef __APM32F10X_MISC_H
  28. #define __APM32F10X_MISC_H
  29. /* Includes */
  30. #include "apm32f10x.h"
  31. #ifdef __cplusplus
  32. extern "C" {
  33. #endif
  34. /** @addtogroup APM32F10x_StdPeriphDriver
  35. @{
  36. */
  37. /** @addtogroup MISC_Driver MISC Driver
  38. @{
  39. */
  40. /** @defgroup MISC_Enumerations Enumerations
  41. @{
  42. */
  43. /**
  44. * @brief NVIC Vect table
  45. */
  46. typedef enum
  47. {
  48. NVIC_VECT_TAB_RAM = 0x20000000,
  49. NVIC_VECT_TAB_FLASH = 0x08000000,
  50. } NVIC_VECT_TAB_T;
  51. /**
  52. * @brief system low power mode
  53. */
  54. typedef enum
  55. {
  56. NVIC_LOWPOWER_SEVONPEND = 0x10,
  57. NVIC_LOWPOWER_SLEEPDEEP = 0x04,
  58. NVIC_LOWPOWER_SLEEPONEXIT = 0x02
  59. } NVIC_LOWPOWER_T;
  60. /**
  61. * @brief nvic priority group
  62. */
  63. typedef enum
  64. {
  65. NVIC_PRIORITY_GROUP_0 = 0x700, /*!< 0 bits for pre-emption priority,4 bits for subpriority */
  66. NVIC_PRIORITY_GROUP_1 = 0x600, /*!< 1 bits for pre-emption priority,3 bits for subpriority */
  67. NVIC_PRIORITY_GROUP_2 = 0x500, /*!< 2 bits for pre-emption priority,2 bits for subpriority */
  68. NVIC_PRIORITY_GROUP_3 = 0x400, /*!< 3 bits for pre-emption priority,1 bits for subpriority */
  69. NVIC_PRIORITY_GROUP_4 = 0x300 /*!< 4 bits for pre-emption priority,0 bits for subpriority */
  70. } NVIC_PRIORITY_GROUP_T;
  71. /**
  72. * @brief SysTick Clock source
  73. */
  74. typedef enum
  75. {
  76. SYSTICK_CLK_SOURCE_HCLK_DIV8 = 0x00,
  77. SYSTICK_CLK_SOURCE_HCLK = 0x01
  78. } SYSTICK_CLK_SOURCE_T;
  79. /**@} end of group MISC_Enumerations*/
  80. /** @defgroup MISC_Functions Functions
  81. @{
  82. */
  83. /* NVIC */
  84. void NVIC_ConfigPriorityGroup(NVIC_PRIORITY_GROUP_T priorityGroup);
  85. void NVIC_EnableIRQRequest(IRQn_Type irq, uint8_t preemptionPriority, uint8_t subPriority);
  86. void NVIC_DisableIRQRequest(IRQn_Type irq);
  87. /* Vector Table */
  88. void NVIC_ConfigVectorTable(NVIC_VECT_TAB_T vectTab, uint32_t offset);
  89. /* Power */
  90. void NVIC_SetSystemLowPower(NVIC_LOWPOWER_T lowPowerMode);
  91. void NVIC_ResetystemLowPower(NVIC_LOWPOWER_T lowPowerMode);
  92. /* Systick */
  93. void SysTick_ConfigCLKSource(SYSTICK_CLK_SOURCE_T clkSource);
  94. /**@} end of group MISC_Functions*/
  95. /**@} end of group MISC_Driver*/
  96. /**@} end of group APM32F10x_StdPeriphDriver*/
  97. #ifdef __cplusplus
  98. }
  99. #endif
  100. #endif /* __APM32F10X_MISC_H */