MAX32655 Peripheral Driver API
Peripheral Driver API for the MAX32655
wut.h
1 
6 /* ****************************************************************************
7  * Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved.
8  *
9  * Permission is hereby granted, free of charge, to any person obtaining a
10  * copy of this software and associated documentation files (the "Software"),
11  * to deal in the Software without restriction, including without limitation
12  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
13  * and/or sell copies of the Software, and to permit persons to whom the
14  * Software is furnished to do so, subject to the following conditions:
15  *
16  * The above copyright notice and this permission notice shall be included
17  * in all copies or substantial portions of the Software.
18  *
19  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
22  * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
23  * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
24  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25  * OTHER DEALINGS IN THE SOFTWARE.
26  *
27  * Except as contained in this notice, the name of Maxim Integrated
28  * Products, Inc. shall not be used except as stated in the Maxim Integrated
29  * Products, Inc. Branding Policy.
30  *
31  * The mere transfer of this software does not imply any licenses
32  * of trade secrets, proprietary technology, copyrights, patents,
33  * trademarks, maskwork rights, or any other form of intellectual
34  * property whatsoever. Maxim Integrated Products, Inc. retains all
35  * ownership rights.
36  *
37  * $Date: 2019-10-25 14:21:06 -0500 (Fri, 25 Oct 2019) $
38  * $Revision: 48094 $
39  *
40  *************************************************************************** */
41 
42 /* Define to prevent redundant inclusion */
43 #ifndef _WUT_H_
44 #define _WUT_H_
45 
46 /* **** Includes **** */
47 #include "mxc_device.h"
48 #include "wut_regs.h"
49 
50 #ifdef __cplusplus
51 extern "C" {
52 #endif
53 
63 typedef enum {
64  MXC_WUT_PRES_1 = MXC_S_WUT_CN_PRES_DIV1,
78 
82 typedef enum {
83  MXC_WUT_MODE_ONESHOT = MXC_V_WUT_CN_TMODE_ONESHOT,
92 
96 typedef enum {
102 
106 typedef struct {
107  mxc_wut_mode_t mode;
108  uint32_t cmp_cnt;
109 } mxc_wut_cfg_t;
110 
111 /* **** Definitions **** */
112 
113 /* **** Function Prototypes **** */
114 
120 void MXC_WUT_Init(mxc_wut_pres_t pres);
121 
127 void MXC_WUT_Shutdown(void);
128 
133 void MXC_WUT_Enable(void);
134 
138 void MXC_WUT_Disable(void);
139 
145 void MXC_WUT_Config(const mxc_wut_cfg_t *cfg);
146 
151 uint32_t MXC_WUT_GetCompare(void);
152 
157 uint32_t MXC_WUT_GetCapture(void);
158 
163 uint32_t MXC_WUT_GetCount(void);
164 
168 void MXC_WUT_IntClear(void);
169 
174 uint32_t MXC_WUT_IntStatus(void);
175 
182 void MXC_WUT_SetCompare(uint32_t cmp_cnt);
183 
188 void MXC_WUT_SetCount(uint32_t cnt);
189 
198 int MXC_WUT_GetTicks(uint32_t time, mxc_wut_unit_t units, uint32_t *ticks);
199 
208 int MXC_WUT_GetTime(uint32_t ticks, uint32_t *time, mxc_wut_unit_t *units);
209 
213 void MXC_WUT_Edge(void);
214 
218 void MXC_WUT_Store(void);
219 
224 void MXC_WUT_RestoreBBClock(uint32_t dbbFreq);
225 
232 uint32_t MXC_WUT_GetSleepTicks(void);
233 
238 void MXC_WUT_Delay_MS(uint32_t waitMs);
239 
242 #ifdef __cplusplus
243 }
244 #endif
245 
246 #endif /* _WUT_H_ */
#define MXC_S_WUT_CN_PRES_DIV64
Definition: wut_regs.h:170
void MXC_WUT_Enable(void)
Enable the timer.
uint32_t MXC_WUT_GetCount(void)
Get the timer count.
Divide input clock by 256.
Definition: wut.h:73
#define MXC_V_WUT_CN_TMODE_COUNTER
Definition: wut_regs.h:142
void MXC_WUT_RestoreBBClock(uint32_t dbbFreq)
Restore the DBB clock with the stored count and snapshot values.
Divide input clock by 32.
Definition: wut.h:70
Wakeup Timer Mode CAPTURE.
Definition: wut.h:88
Divide input clock by 1.
Definition: wut.h:65
#define MXC_V_WUT_CN_TMODE_PWM
Definition: wut_regs.h:144
int MXC_WUT_GetTicks(uint32_t time, mxc_wut_unit_t units, uint32_t *ticks)
Convert real time to timer ticks.
Wakeup Timer Mode ONESHOT.
Definition: wut.h:84
void MXC_WUT_Store(void)
Store the count and snapshot values.
void MXC_WUT_SetCount(uint32_t cnt)
Set the timer count.
Divide input clock by 512.
Definition: wut.h:74
#define MXC_S_WUT_CN_PRES_DIV4
Definition: wut_regs.h:162
void MXC_WUT_SetCompare(uint32_t cmp_cnt)
Set the timer compare count.
uint32_t MXC_WUT_GetCapture(void)
Get the timer capture count.
Definition: wut.h:100
Divide input clock by 8.
Definition: wut.h:68
uint32_t MXC_WUT_GetSleepTicks(void)
Get the difference between the stored counter value and the current counter value.
#define MXC_V_WUT_CN_TMODE_CAPTURECOMPARE
Definition: wut_regs.h:152
Wakeup Timer Mode GATED.
Definition: wut.h:90
void MXC_WUT_Edge(void)
Wait for an edge of the WUT count register.
mxc_wut_unit_t
Wakeup Timer units of time enumeration.
Definition: wut.h:96
Divide input clock by 2.
Definition: wut.h:66
#define MXC_S_WUT_CN_PRES_DIV128
Definition: wut_regs.h:172
mxc_wut_mode_t
Wakeup Timer modes.
Definition: wut.h:82
Definition: wut.h:99
#define MXC_V_WUT_CN_TMODE_CAPTURE
Definition: wut_regs.h:146
#define MXC_V_WUT_CN_TMODE_GATED
Definition: wut_regs.h:150
#define MXC_V_WUT_CN_TMODE_ONESHOT
Definition: wut_regs.h:138
#define MXC_S_WUT_CN_PRES_DIV1
Definition: wut_regs.h:158
uint32_t MXC_WUT_GetCompare(void)
Get the timer compare count.
Wakeup Timer Configuration.
Definition: wut.h:106
void MXC_WUT_Config(const mxc_wut_cfg_t *cfg)
Configure the timer.
#define MXC_S_WUT_CN_PRES_DIV16
Definition: wut_regs.h:166
Definition: wut.h:98
void MXC_WUT_IntClear(void)
Clear the timer interrupt.
void MXC_WUT_Init(mxc_wut_pres_t pres)
Initialize timer module clock.
Divide input clock by 64.
Definition: wut.h:71
Wakeup Timer Mode COMPARE.
Definition: wut.h:89
Wakeup Timer Mode COUNTER.
Definition: wut.h:86
Wakeup Timer Mode CONTINUOUS.
Definition: wut.h:85
uint32_t cmp_cnt
Desired timer mode.
Definition: wut.h:108
Divide input clock by 1024.
Definition: wut.h:75
mxc_wut_pres_t
Wakeup Timer prescaler values.
Definition: wut.h:63
Definition: wut.h:97
Divide input clock by 16.
Definition: wut.h:69
void MXC_WUT_Shutdown(void)
Shutdown timer module clock.
Wakeup Timer Mode PWM.
Definition: wut.h:87
int MXC_WUT_GetTime(uint32_t ticks, uint32_t *time, mxc_wut_unit_t *units)
Convert timer ticks to real time.
#define MXC_V_WUT_CN_TMODE_COMPARE
Definition: wut_regs.h:148
#define MXC_F_WUT_CN_PRES3
Definition: wut_regs.h:181
#define MXC_S_WUT_CN_PRES_DIV32
Definition: wut_regs.h:168
Divide input clock by 4.
Definition: wut.h:67
void MXC_WUT_Disable(void)
Disable the timer.
void MXC_WUT_Delay_MS(uint32_t waitMs)
Delays for the given number of milliseconds.
#define MXC_S_WUT_CN_PRES_DIV8
Definition: wut_regs.h:164
Divide input clock by 2048.
Definition: wut.h:76
#define MXC_V_WUT_CN_TMODE_CONTINUOUS
Definition: wut_regs.h:140
uint32_t MXC_WUT_IntStatus(void)
Get the timer interrupt status.
Divide input clock by 128.
Definition: wut.h:72
#define MXC_S_WUT_CN_PRES_DIV2
Definition: wut_regs.h:160