at32f413_misc.h 4.0 KB

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