MG32L003 Standard Peripherals Firmware Library

mg32l003_awk.h
浏览该文件的文档.
1
10 /* Define to prevent recursive inclusion -------------------------------------*/
11 #ifndef __MG32L003_AWK_H
12 #define __MG32L003_AWK_H
13
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
17
18 /* Includes ------------------------------------------------------------------*/
19 #include "mg32l003.h"
20
29 /* Exported types ------------------------------------------------------------*/
30
34 typedef struct
35 {
36 uint32_t AWK_CLK_SEL;
37 uint32_t AWK_HSE_PRSC;
38 uint32_t AWK_DIV_SEL;
39 uint32_t AWK_RLOAD_VAL;
40 } AWK_InitTypeDef;
41
42 /* Exported constants --------------------------------------------------------*/
43
51 #define AWK_CLK_SEL_STOP (0x00U << 5)
52 #define AWK_CLK_SEL_LSI (0x01U << 5)
53 #define AWK_CLK_SEL_HSE (0x02U << 5)
54 #define AWK_CLK_SEL_LSE (0x03U << 5)
56 #define IS_AWK_CLK_SEL(SEL) (((SEL) == AWK_CLK_SEL_STOP) || \
57 ((SEL) == AWK_CLK_SEL_LSI) || \
58 ((SEL) == AWK_CLK_SEL_HSE) || \
59 ((SEL) == AWK_CLK_SEL_LSE))
60
67 #define IS_AWK_HSE_PRSC(PRSC) (((PRSC) < 0xFFF))
68
75 #define IS_AWK_RLOAD_VAL(VAL) (((VAL) < 0xFF))
76
83 #define AWK_CLOCK_DIV_2 (0x00000000U)
84 #define AWK_CLOCK_DIV_4 (AWK_CR_DIVSEL_0)
85 #define AWK_CLOCK_DIV_8 (AWK_CR_DIVSEL_1)
86 #define AWK_CLOCK_DIV_16 (AWK_CR_DIVSEL_1 | AWK_CR_DIVSEL_0)
87 #define AWK_CLOCK_DIV_32 (AWK_CR_DIVSEL_2)
88 #define AWK_CLOCK_DIV_64 (AWK_CR_DIVSEL_2 | AWK_CR_DIVSEL_0)
89 #define AWK_CLOCK_DIV_128 (AWK_CR_DIVSEL_2 | AWK_CR_DIVSEL_1)
90 #define AWK_CLOCK_DIV_256 (AWK_CR_DIVSEL_2 | AWK_CR_DIVSEL_1 | AWK_CR_DIVSEL_0)
91 #define AWK_CLOCK_DIV_512 (AWK_CR_DIVSEL_3)
92 #define AWK_CLOCK_DIV_1024 (AWK_CR_DIVSEL_3 | AWK_CR_DIVSEL_0)
93 #define AWK_CLOCK_DIV_2048 (AWK_CR_DIVSEL_3 | AWK_CR_DIVSEL_1)
94 #define AWK_CLOCK_DIV_4096 (AWK_CR_DIVSEL_3 | AWK_CR_DIVSEL_1 | AWK_CR_DIVSEL_0)
95 #define AWK_CLOCK_DIV_8192 (AWK_CR_DIVSEL_3 | AWK_CR_DIVSEL_2)
96 #define AWK_CLOCK_DIV_16384 (AWK_CR_DIVSEL_3 | AWK_CR_DIVSEL_2 | AWK_CR_DIVSEL_0)
97 #define AWK_CLOCK_DIV_32768 (AWK_CR_DIVSEL_3 | AWK_CR_DIVSEL_2 | AWK_CR_DIVSEL_1)
98 #define AWK_CLOCK_DIV_65536 (AWK_CR_DIVSEL_3 | AWK_CR_DIVSEL_2 | AWK_CR_DIVSEL_1 | AWK_CR_DIVSEL_0)
99
100 #define IS_AWK_DIV_SEL(DIV) (((DIV) < 0xF))
101
110 /* Exported macro ------------------------------------------------------------*/
111 /* Exported functions --------------------------------------------------------*/
112
113 void AWK_DeInit(void);
114 void AWK_Init(AWK_InitTypeDef* AWK_InitStruct);
115 void AWK_StructInit(AWK_InitTypeDef* AWK_InitStruct);
116 void AWK_Cmd(FunctionalState NewState);
117 FlagStatus AWK_GetFlagStatus(void);
118 void AWK_ClearFlag(void);
119
128 #ifdef __cplusplus
129 }
130 #endif
131
132 #endif /*__MG32L003_AWK_H */
AWK_InitTypeDef::AWK_RLOAD_VAL
uint32_t AWK_RLOAD_VAL
Definition: mg32l003_awk.h:39
AWK_InitTypeDef::AWK_DIV_SEL
uint32_t AWK_DIV_SEL
Definition: mg32l003_awk.h:38
AWK_DeInit
void AWK_DeInit(void)
Deinitializes the AWK peripheral registers to their default reset values.
Definition: mg32l003_awk.c:36
AWK_InitTypeDef::AWK_HSE_PRSC
uint32_t AWK_HSE_PRSC
Definition: mg32l003_awk.h:37
AWK_ClearFlag
void AWK_ClearFlag(void)
Clears the AWK pending flag.
Definition: mg32l003_awk.c:115
AWK_InitTypeDef::AWK_CLK_SEL
uint32_t AWK_CLK_SEL
Definition: mg32l003_awk.h:36
AWK_Cmd
void AWK_Cmd(FunctionalState NewState)
Enables or disables the AWK peripheral.
Definition: mg32l003_awk.c:73
AWK_GetFlagStatus
FlagStatus AWK_GetFlagStatus(void)
Checks whether the specified AWK flag is set or not.
Definition: mg32l003_awk.c:93
AWK_Init
void AWK_Init(AWK_InitTypeDef *AWK_InitStruct)
Initializes the AWK peripheral according to the specified parameters in the AWK_InitStruct.
Definition: mg32l003_awk.c:49
AWK_InitTypeDef
AWK Init structure definition
Definition: mg32l003_awk.h:34