1 /*!
2  * @file        apm32f0xx_misc.h
3  *
4  * @brief       This file contains all the functions prototypes for the miscellaneous
5  *              firmware library functions (add-on to CMSIS functions).
6  *
7  * @version     V1.0.3
8  *
9  * @date        2022-09-20
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 
27 /* Define to prevent recursive inclusion */
28 #ifndef __APM32F0XX_MISC_H
29 #define __APM32F0XX_MISC_H
30 
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34 
35 /* Includes */
36 #include "apm32f0xx.h"
37 
38 /** @addtogroup APM32F0xx_StdPeriphDriver
39   @{
40 */
41 
42 /** @addtogroup MISC_Driver
43   @{
44 */
45 
46 /** @defgroup MISC_Macros Macros
47   @{
48 */
49 
50 /* MISC SysTick clock source */
51 #define SysTick_CLKSource_HCLK_Div8 ((uint32_t)0xFFFFFFFB)
52 #define SysTick_CLKSource_HCLK      ((uint32_t)0x00000004)
53 
54 /**@} end of group MISC_Macros */
55 
56 /** @defgroup MISC_Enumerations Enumerations
57   @{
58 */
59 
60 /**
61  * @brief    System low power mode
62  */
63 typedef enum
64 {
65     NVIC_LOWPOER_SEVONPEND   = 0x10, /*!< Wake up according to pending request */
66     NVIC_LOWPOER_SLEEPDEEP   = 0x04, /*!< Enable sleep deep */
67     NVIC_LOWPOER_SLEEPONEXIT = 0x02  /*!< Sleep after exit ISR */
68 } NVIC_LOWPOER_T;
69 
70 /**@} end of group MISC_Enumerations */
71 
72 /** @defgroup MISC_Structures Structures
73   @{
74 */
75 
76 /**@} end of group MISC_Structures */
77 
78 /** @defgroup MISC_Variables Variables
79   @{
80 */
81 
82 /**@} end of group MISC_Variables*/
83 
84 /** @defgroup MISC_Functions Functions
85   @{
86 */
87 
88 /* NVIC */
89 void NVIC_EnableIRQRequest(IRQn_Type irq, uint8_t priority);
90 void NVIC_DisableIRQRequest(IRQn_Type irq);
91 
92 /* Low Power */
93 void NVIC_EnableSystemLowPower(uint8_t lowPowerMode);
94 void NVIC_DisableSystemLowPower(uint8_t lowPowerMode);
95 
96 /* SysTick */
97 void SysTick_ConfigCLKSource(uint32_t sysTickCLKSource);
98 
99 /* PMU */
100 void PMU_EnterWaitMode(void);
101 void PMU_EnterHaltModeWFI(void);
102 void PMU_EnterHaltModeWFE(void);
103 
104 #ifdef __cplusplus
105 }
106 #endif
107 
108 #endif /* __APM32F0XX_MISC_H */
109 
110 /**@} end of group MISC_Functions */
111 /**@} end of group MISC_Driver */
112 /**@} end of group APM32F0xx_StdPeriphDriver */
113