at32f415_misc.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. /**
  2. **************************************************************************
  3. * @file at32f415_misc.h
  4. * @version v2.0.5
  5. * @date 2022-05-20
  6. * @brief at32f415 misc header file
  7. **************************************************************************
  8. * Copyright notice & Disclaimer
  9. *
  10. * The software Board Support Package (BSP) that is made available to
  11. * download from Artery official website is the copyrighted work of Artery.
  12. * Artery authorizes customers to use, copy, and distribute the BSP
  13. * software and its related documentation for the purpose of design and
  14. * development in conjunction with Artery microcontrollers. Use of the
  15. * software is governed by this copyright notice and the following disclaimer.
  16. *
  17. * THIS SOFTWARE IS PROVIDED ON "AS IS" BASIS WITHOUT WARRANTIES,
  18. * GUARANTEES OR REPRESENTATIONS OF ANY KIND. ARTERY EXPRESSLY DISCLAIMS,
  19. * TO THE FULLEST EXTENT PERMITTED BY LAW, ALL EXPRESS, IMPLIED OR
  20. * STATUTORY OR OTHER WARRANTIES, GUARANTEES OR REPRESENTATIONS,
  21. * INCLUDING BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
  22. * FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
  23. *
  24. **************************************************************************
  25. */
  26. /* define to prevent recursive inclusion -------------------------------------*/
  27. #ifndef __AT32F415_MISC_H
  28. #define __AT32F415_MISC_H
  29. #ifdef __cplusplus
  30. extern "C" {
  31. #endif
  32. /* includes ------------------------------------------------------------------*/
  33. #include "at32f415.h"
  34. /** @addtogroup AT32F415_periph_driver
  35. * @{
  36. */
  37. /** @addtogroup MISC
  38. * @{
  39. */
  40. /** @defgroup MISC_vector_table_base_address
  41. * @{
  42. */
  43. #define NVIC_VECTTAB_RAM ((uint32_t)0x20000000) /*!< nvic vector table based ram address */
  44. #define NVIC_VECTTAB_FLASH ((uint32_t)0x08000000) /*!< nvic vector table based flash address */
  45. /**
  46. * @}
  47. */
  48. /** @defgroup MISC_exported_types
  49. * @{
  50. */
  51. /**
  52. * @brief nvic interrupt priority group
  53. */
  54. typedef enum
  55. {
  56. NVIC_PRIORITY_GROUP_0 = ((uint32_t)0x7), /*!< 0 bits for preemption priority, 4 bits for subpriority */
  57. NVIC_PRIORITY_GROUP_1 = ((uint32_t)0x6), /*!< 1 bits for preemption priority, 3 bits for subpriority */
  58. NVIC_PRIORITY_GROUP_2 = ((uint32_t)0x5), /*!< 2 bits for preemption priority, 2 bits for subpriority */
  59. NVIC_PRIORITY_GROUP_3 = ((uint32_t)0x4), /*!< 3 bits for preemption priority, 1 bits for subpriority */
  60. NVIC_PRIORITY_GROUP_4 = ((uint32_t)0x3) /*!< 4 bits for preemption priority, 0 bits for subpriority */
  61. } nvic_priority_group_type;
  62. /**
  63. * @brief nvic low power mode
  64. */
  65. typedef enum
  66. {
  67. NVIC_LP_SLEEPONEXIT = 0x02, /*!< send event on pending */
  68. NVIC_LP_SLEEPDEEP = 0x04, /*!< enable sleep-deep output signal when entering sleep mode */
  69. NVIC_LP_SEVONPEND = 0x10 /*!< enable sleep-on-exit feature */
  70. } nvic_lowpower_mode_type;
  71. /**
  72. * @brief systick clock source
  73. */
  74. typedef enum
  75. {
  76. SYSTICK_CLOCK_SOURCE_AHBCLK_DIV8 = ((uint32_t)0x00000000), /*!< systick clock source from core clock div8 */
  77. SYSTICK_CLOCK_SOURCE_AHBCLK_NODIV = ((uint32_t)0x00000004) /*!< systick clock source from core clock */
  78. } systick_clock_source_type;
  79. /**
  80. * @}
  81. */
  82. /** @defgroup MISC_exported_functions
  83. * @{
  84. */
  85. void nvic_system_reset(void);
  86. void nvic_irq_enable(IRQn_Type irqn, uint32_t preempt_priority, uint32_t sub_priority);
  87. void nvic_irq_disable(IRQn_Type irqn);
  88. void nvic_priority_group_config(nvic_priority_group_type priority_group);
  89. void nvic_vector_table_set(uint32_t base, uint32_t offset);
  90. void nvic_lowpower_mode_config(nvic_lowpower_mode_type lp_mode, confirm_state new_state);
  91. void systick_clock_source_config(systick_clock_source_type source);
  92. /**
  93. * @}
  94. */
  95. /**
  96. * @}
  97. */
  98. /**
  99. * @}
  100. */
  101. #ifdef __cplusplus
  102. }
  103. #endif
  104. #endif