1 /**
2   ******************************************************************************
3   * @file    hk32f0xx_misc.h
4   *  @version V1.0.1
5   * @date    2019-08-15
6   ******************************************************************************
7   */
8 
9 /* Define to prevent recursive inclusion -------------------------------------*/
10 #ifndef __HK32F0XX_MISC_H
11 #define __HK32F0XX_MISC_H
12 
13 #ifdef __cplusplus
14  extern "C" {
15 #endif
16 
17 /* Includes ------------------------------------------------------------------*/
18 #include "hk32f0xx.h"
19 
20 /** @addtogroup HK32F0xx_StdPeriph_Driver
21   * @{
22   */
23 
24 /** @addtogroup MISC
25   * @{
26   */
27 
28 /* Exported types ------------------------------------------------------------*/
29 
30 /**
31   * @brief  NVIC Init Structure definition
32   */
33 
34 typedef struct
35 {
36   uint8_t NVIC_IRQChannel;             /*!< Specifies the IRQ channel to be enabled or disabled.
37                                             This parameter can be a value of @ref IRQn_Type
38                                             (For the complete HK32 Devices IRQ Channels list,
39                                             please refer to hk32f0xx.h file) */
40 
41   uint8_t NVIC_IRQChannelPriority;     /*!< Specifies the priority level for the IRQ channel specified
42                                             in NVIC_IRQChannel. This parameter can be a value
43                                             between 0 and 3.  */
44 
45   FunctionalState NVIC_IRQChannelCmd;  /*!< Specifies whether the IRQ channel defined in NVIC_IRQChannel
46                                             will be enabled or disabled.
47                                             This parameter can be set either to ENABLE or DISABLE */
48 } NVIC_InitTypeDef;
49 
50 /**
51   *
52 @verbatim
53 
54 @endverbatim
55 */
56 
57 /* Exported constants --------------------------------------------------------*/
58 
59 /** @defgroup MISC_Exported_Constants
60   * @{
61   */
62 
63 /** @defgroup MISC_System_Low_Power
64   * @{
65   */
66 
67 #define NVIC_LP_SEVONPEND            ((uint8_t)0x10)
68 #define NVIC_LP_SLEEPDEEP            ((uint8_t)0x04)
69 #define NVIC_LP_SLEEPONEXIT          ((uint8_t)0x02)
70 #define IS_NVIC_LP(LP) (((LP) == NVIC_LP_SEVONPEND) || \
71                         ((LP) == NVIC_LP_SLEEPDEEP) || \
72                         ((LP) == NVIC_LP_SLEEPONEXIT))
73 /**
74   * @}
75   */
76 
77 /** @defgroup MISC_Preemption_Priority_Group
78   * @{
79   */
80 #define IS_NVIC_PRIORITY(PRIORITY)  ((PRIORITY) < 0x04)
81 
82 /**
83   * @}
84   */
85 
86 /** @defgroup MISC_SysTick_clock_source
87   * @{
88   */
89 
90 #define SysTick_CLKSource_HCLK_Div8    ((uint32_t)0xFFFFFFFB)
91 #define SysTick_CLKSource_HCLK         ((uint32_t)0x00000004)
92 #define IS_SYSTICK_CLK_SOURCE(SOURCE) (((SOURCE) == SysTick_CLKSource_HCLK) || \
93                                        ((SOURCE) == SysTick_CLKSource_HCLK_Div8))
94 /**
95   * @}
96   */
97 
98 /**
99   * @}
100   */
101 
102 /* Exported macro ------------------------------------------------------------*/
103 /* Exported functions ------------------------------------------------------- */
104 
105 void NVIC_Init(NVIC_InitTypeDef* NVIC_InitStruct);
106 void NVIC_SystemLPConfig(uint8_t LowPowerMode, FunctionalState NewState);
107 void SysTick_CLKSourceConfig(uint32_t SysTick_CLKSource);
108 
109 #ifdef __cplusplus
110 }
111 #endif
112 
113 #endif /* __HK32F0XX_MISC_H */
114 
115 /**
116   * @}
117   */
118 
119 /**
120   * @}
121   */
122 
123