A31R71x F/W Packages  1.5.0
ABOV Cortex-M0+ Core based MCUs Integrated Driver
A31R71x_hal_wt.h
Go to the documentation of this file.
1 /***************************************************************************//****************************************************************************/
34 
35 #ifndef _WT_H_
36 #define _WT_H_
37 
38 #include "A31R71x.h"
39 #include "A31R71x_hal_aa_types.h"
40 
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
44 
45 //******************************************************************************
46 // Constant
47 //******************************************************************************
48 
49 //========== WT_CR ========================================
50 
51 //---------- WT Interval Selection ----------
52 #define WT_DIV2E7 (0x0uL << 4)
53 #define WT_DIV2E13 (0x1uL << 4)
54 #define WT_DIV2E14 (0x2uL << 4)
55 #define WT_DIV2E14DR (0x3uL << 4)
56 
57 //---------- WT Interrupt En/Disable ----------
58 #define WT_INTDIS (0x0uL << 3)
59 #define WT_INTEN (0x1uL << 3)
60 
62 #define WT_CR_WTIEN ((uint32_t)(1 << 3)) // WT Interrupt Enable bit
63 #define WT_INTERRUPT_BITMASK 0x0008
64 
66 #define WT_CR_WTIFLAG ((uint32_t)(1 << 1)) // WT Interrupt Flag bit
67 #define WT_STATUS_BITMASK 0x0002
68 
69 #define WT_CR_WTCLR ((uint32_t)(1 << 0)) // WT counter and divider clear bit
70 
71 //******************************************************************************
72 // Type
73 //******************************************************************************
74 
75 //==============================================================================
76 // Enumeration
77 //==============================================================================
78 
79 enum
80 {
85 };
86 
87 //==============================================================================
88 // Structure
89 //==============================================================================
90 
91 typedef struct
92 {
93  uint32_t wtClkDiv;
94  uint32_t wtTmrConst;
95 } WT_CFG_Type;
96 
97 //******************************************************************************
98 // Macro
99 //******************************************************************************
100 
101 /*-------------------------------------------------------------------------*//*-------------------------------------------------------------------------*/
105 #define WT_EN() (WT->CR_b.WTEN = 1)
106 #define WT_DIS() (WT->CR_b.WTEN = 0)
107 
108 /*-------------------------------------------------------------------------*//*-------------------------------------------------------------------------*/
112 #define WT_GetCnt() (WT->CNT)
113 
114 /*-------------------------------------------------------------------------*//*-------------------------------------------------------------------------*/
120 #define WT_SetWT_DR( u32WTData ) (WT->DR = u32WTData)
121 
122 /*-------------------------------------------------------------------------*//*-------------------------------------------------------------------------*/
126 #define WTInt_GetFg() (WT->CR_b.WTIFLAG)
127 
128 /*-------------------------------------------------------------------------*//*-------------------------------------------------------------------------*/
132 #define WTInt_ClrFg() (WT->CR_b.WTIFLAG = 1)
133 
134 //******************************************************************************
135 // Function
136 //******************************************************************************
137 
140 
143 HAL_Status_Type HAL_WT_SetRegister( uint32_t u32WTSet );
145 uint32_t HAL_WT_GetStatus( void );
146 
147 uint32_t HAL_WT_GetCurrentCount( void );
148 
149 #ifdef __cplusplus
150 }
151 #endif
152 
153 #endif /*_WT_H_ */
154 
HAL_Status_Type
HAL_Status_Type HAL_WT_Init(WT_CFG_Type *WT_Config)
Initialize the WT peripheral with the specified parameters.
FunctionalState
HAL_Status_Type HAL_WT_Start(FunctionalState ctrl)
Enable WT activity.
uint32_t HAL_WT_GetStatus(void)
Get the timer status register of WT.
HAL_Status_Type HAL_WT_ConfigInterrupt(FunctionalState NewState)
Configure the peripheral interrupt.
uint32_t HAL_WT_GetCurrentCount(void)
Get the current value of WT.
HAL_Status_Type HAL_WT_ClearStatus(void)
Clear the timer status register of WT.
Contains the ABOV typedefs for C standard types. It is intended to be used in ISO C conforming develo...
uint32_t wtTmrConst
HAL_Status_Type HAL_WT_SetRegister(uint32_t u32WTSet)
Set WT CR Register.
uint32_t wtClkDiv
HAL_Status_Type HAL_WT_DeInit(void)
deinit for Watch Timer function