gd32f10x_misc.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. /**
  2. ******************************************************************************
  3. * @brief MISC header file of the firmware library.
  4. ******************************************************************************
  5. */
  6. /* Define to prevent recursive inclusion -------------------------------------*/
  7. #ifndef __GD32F10X_MISC_H
  8. #define __GD32F10X_MISC_H
  9. #ifdef __cplusplus
  10. extern "C" {
  11. #endif
  12. /* Includes ------------------------------------------------------------------*/
  13. #include "gd32f10x.h"
  14. /** @addtogroup GD32F10x_Firmware
  15. * @{
  16. */
  17. /** @addtogroup MISC
  18. * @{
  19. */
  20. /** @defgroup MISC_Exported_Types
  21. * @{
  22. */
  23. /**
  24. * @brief MISC Initial Parameters
  25. */
  26. typedef struct {
  27. uint8_t NVIC_IRQ; /*!< The IRQ type,detailed in @ref IRQn_Type */
  28. uint8_t NVIC_IRQPreemptPriority; /*!< The pre-emption priority of NVIC_IRQ, detailed in @ref NVIC_Priority_Table */
  29. uint8_t NVIC_IRQSubPriority; /*!< The SubPriority of NVIC_IRQ, detailed in @ref NVIC_Priority_Table */
  30. TypeState NVIC_IRQEnable; /*!< Enable or disable the IRQ,this parameter can be ENABLE or DISABLE */
  31. } NVIC_InitPara;
  32. /**
  33. * @}
  34. */
  35. /** @defgroup MISC_Exported_Constants
  36. * @{
  37. */
  38. /** @defgroup MISC_System_Low_Power
  39. * @{
  40. */
  41. #define NVIC_VECTTAB_RAM ((uint32_t)0x20000000)
  42. #define NVIC_VECTTAB_FLASH ((uint32_t)0x08000000)
  43. #define NVIC_LOWPOWER_SEVONPEND ((uint8_t)0x10)
  44. #define NVIC_LOWPOWER_SLEEPDEEP ((uint8_t)0x04)
  45. #define NVIC_LOWPOWER_SLEEPONEXIT ((uint8_t)0x02)
  46. /**
  47. * @}
  48. */
  49. /** @defgroup MISC_Preemption_Priority_Group
  50. * @{
  51. */
  52. /* Preemption Priority Group -------------------------------------------------*/
  53. #define NVIC_PRIGROUP_0 ((uint32_t)0x700) /*!< 0 bits for pre-emption priority 4 bits for subpriority */
  54. #define NVIC_PRIGROUP_1 ((uint32_t)0x600) /*!< 1 bits for pre-emption priority 3 bits for subpriority */
  55. #define NVIC_PRIGROUP_2 ((uint32_t)0x500) /*!< 2 bits for pre-emption priority 2 bits for subpriority */
  56. #define NVIC_PRIGROUP_3 ((uint32_t)0x400) /*!< 3 bits for pre-emption priority 1 bits for subpriority */
  57. #define NVIC_PRIGROUP_4 ((uint32_t)0x300) /*!< 4 bits for pre-emption priority 0 bits for subpriority */
  58. /**
  59. * @}
  60. */
  61. /** @defgroup MISC_SysTick_clock_source
  62. * @{
  63. */
  64. #define SYSTICK_CKSOURCE_HCLK_DIV8 ((uint32_t)0xFFFFFFFB)
  65. #define SYSTICK_CKSOURCE_HCLK ((uint32_t)0x00000004)
  66. /**
  67. * @}
  68. */
  69. /**
  70. * @}
  71. */
  72. /** @defgroup MISC_Exported_Functions
  73. * @{
  74. */
  75. void NVIC_Init(NVIC_InitPara *NVIC_InitStruct);
  76. void NVIC_SystemLowPowerConfig(uint8_t LowPowerMode, TypeState NewValue);
  77. void SysTick_CKSource_Enable(uint32_t SysTick_CKSource);
  78. void NVIC_VectTableSet(uint32_t NVIC_VectTab, uint32_t Offset);
  79. void NVIC_PRIGroup_Enable(uint32_t NVIC_PRIGroup);
  80. #ifdef __cplusplus
  81. }
  82. #endif
  83. #endif /*__GD32F10X_MISC_H */
  84. /**
  85. * @}
  86. */
  87. /**
  88. * @}
  89. */
  90. /**
  91. * @}
  92. */