MAX32665 Peripheral Driver API
Peripheral Driver API for the MAX32665
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 "wut_regs.h"
48 
49 #ifdef __cplusplus
50 extern "C" {
51 #endif
52 
62 typedef enum {
63  MXC_WUT_PRES_1 = MXC_S_WUT_CTRL_PRES_DIV1,
77 
81 typedef enum {
82  MXC_WUT_MODE_ONESHOT = MXC_V_WUT_CTRL_TMODE_ONESHOT,
85 
89 typedef enum {
95 
99 typedef struct {
100  mxc_wut_mode_t mode;
101  uint32_t cmp_cnt;
102 } mxc_wut_cfg_t;
103 
104 /* **** Definitions **** */
105 
106 /* **** Function Prototypes **** */
107 
113 
117 void MXC_WUT_Shutdown(void);
118 
122 void MXC_WUT_Enable(void);
123 
127 void MXC_WUT_Disable(void);
128 
133 void MXC_WUT_Config(const mxc_wut_cfg_t *cfg);
134 
139 uint32_t MXC_WUT_GetCompare(void);
140 
145 uint32_t MXC_WUT_GetCapture(void);
146 
151 uint32_t MXC_WUT_GetCount(void);
152 
156 void MXC_WUT_IntClear(void);
157 
162 uint32_t MXC_WUT_IntStatus(void);
163 
170 void MXC_WUT_SetCompare(uint32_t cmp_cnt);
171 
176 void MXC_WUT_SetCount(uint32_t cnt);
177 
186 int MXC_WUT_GetTicks(uint32_t time, mxc_wut_unit_t units, uint32_t *ticks);
187 
196 int MXC_WUT_GetTime(uint32_t ticks, uint32_t *time, mxc_wut_unit_t *units);
197 
201 void MXC_WUT_Edge(void);
202 
206 void MXC_WUT_Store(void);
207 
212 void MXC_WUT_RestoreBBClock(uint32_t dbbFreq);
213 
219 uint32_t MXC_WUT_GetSleepTicks(void);
220 
225 void MXC_WUT_Delay_MS(uint32_t waitMs);
226 
229 #ifdef __cplusplus
230 }
231 #endif
232 
233 #endif /* _WUT_H_ */
MXC_S_WUT_CTRL_PRES_DIV32
#define MXC_S_WUT_CTRL_PRES_DIV32
Definition: wut_regs.h:182
MXC_WUT_RestoreBBClock
void MXC_WUT_RestoreBBClock(uint32_t dbbFreq)
Restore the DBB clock with the stored count and snapshot values.
MXC_S_WUT_CTRL_PRES_DIV64
#define MXC_S_WUT_CTRL_PRES_DIV64
Definition: wut_regs.h:184
MXC_V_WUT_CTRL_TMODE_CONTINUOUS
#define MXC_V_WUT_CTRL_TMODE_CONTINUOUS
Definition: wut_regs.h:166
MXC_S_WUT_CTRL_PRES_DIV1
#define MXC_S_WUT_CTRL_PRES_DIV1
Definition: wut_regs.h:172
MXC_S_WUT_CTRL_PRES_DIV4
#define MXC_S_WUT_CTRL_PRES_DIV4
Definition: wut_regs.h:176
MXC_WUT_UNIT_NANOSEC
@ MXC_WUT_UNIT_NANOSEC
Definition: wut.h:90
mxc_wut_mode_t
mxc_wut_mode_t
Wakeup Timer modes.
Definition: wut.h:81
MXC_WUT_GetCapture
uint32_t MXC_WUT_GetCapture(void)
Get the timer capture count.
MXC_WUT_SetCount
void MXC_WUT_SetCount(uint32_t cnt)
Set the timer count.
MXC_WUT_Store
void MXC_WUT_Store(void)
Store the count and snapshot values.
MXC_WUT_PRES_128
@ MXC_WUT_PRES_128
Divide input clock by 64.
Definition: wut.h:70
MXC_WUT_PRES_32
@ MXC_WUT_PRES_32
Divide input clock by 16.
Definition: wut.h:68
MXC_WUT_GetCompare
uint32_t MXC_WUT_GetCompare(void)
Get the timer compare count.
MXC_WUT_SetCompare
void MXC_WUT_SetCompare(uint32_t cmp_cnt)
Set the timer compare count.
MXC_WUT_GetTicks
int MXC_WUT_GetTicks(uint32_t time, mxc_wut_unit_t units, uint32_t *ticks)
Convert real time to timer ticks.
MXC_WUT_UNIT_SEC
@ MXC_WUT_UNIT_SEC
Definition: wut.h:93
MXC_WUT_PRES_64
@ MXC_WUT_PRES_64
Divide input clock by 32.
Definition: wut.h:69
MXC_WUT_GetSleepTicks
uint32_t MXC_WUT_GetSleepTicks(void)
Get the difference between the stored counter value and the current counter value.
MXC_WUT_PRES_256
@ MXC_WUT_PRES_256
Divide input clock by 128.
Definition: wut.h:71
MXC_WUT_PRES_1024
@ MXC_WUT_PRES_1024
Divide input clock by 512.
Definition: wut.h:73
MXC_WUT_PRES_4
@ MXC_WUT_PRES_4
Divide input clock by 2.
Definition: wut.h:65
mxc_wut_pres_t
mxc_wut_pres_t
Wakeup Timer prescaler values.
Definition: wut.h:62
MXC_WUT_UNIT_MILLISEC
@ MXC_WUT_UNIT_MILLISEC
Definition: wut.h:92
MXC_F_WUT_CTRL_PRES3
#define MXC_F_WUT_CTRL_PRES3
Definition: wut_regs.h:205
mxc_wut_cfg_t
Wakeup Timer Configuration.
Definition: wut.h:99
MXC_WUT_Delay_MS
void MXC_WUT_Delay_MS(uint32_t waitMs)
Delays for the given number of milliseconds.
MXC_WUT_Config
void MXC_WUT_Config(const mxc_wut_cfg_t *cfg)
Configure the timer.
mxc_wut_unit_t
mxc_wut_unit_t
Wakeup Timer units of time enumeration.
Definition: wut.h:89
MXC_S_WUT_CTRL_PRES_DIV128
#define MXC_S_WUT_CTRL_PRES_DIV128
Definition: wut_regs.h:186
MXC_S_WUT_CTRL_PRES_DIV16
#define MXC_S_WUT_CTRL_PRES_DIV16
Definition: wut_regs.h:180
MXC_WUT_Disable
void MXC_WUT_Disable(void)
Disable the timer.
MXC_WUT_IntStatus
uint32_t MXC_WUT_IntStatus(void)
Get the timer interrupt status.
mxc_wut_cfg_t::cmp_cnt
uint32_t cmp_cnt
Desired timer mode.
Definition: wut.h:101
MXC_WUT_Init
void MXC_WUT_Init(mxc_wut_pres_t pres)
Initialize timer module clock.
MXC_WUT_Edge
void MXC_WUT_Edge(void)
Wait for an edge of the WUT count register.
MXC_WUT_PRES_2
@ MXC_WUT_PRES_2
Divide input clock by 1.
Definition: wut.h:64
MXC_WUT_PRES_8
@ MXC_WUT_PRES_8
Divide input clock by 4.
Definition: wut.h:66
MXC_V_WUT_CTRL_TMODE_ONESHOT
#define MXC_V_WUT_CTRL_TMODE_ONESHOT
Definition: wut_regs.h:164
MXC_WUT_Enable
void MXC_WUT_Enable(void)
Enable the timer.
MXC_S_WUT_CTRL_PRES_DIV8
#define MXC_S_WUT_CTRL_PRES_DIV8
Definition: wut_regs.h:178
MXC_WUT_Shutdown
void MXC_WUT_Shutdown(void)
Shutdown timer module clock.
MXC_WUT_PRES_4096
@ MXC_WUT_PRES_4096
Divide input clock by 2048.
Definition: wut.h:75
MXC_WUT_GetTime
int MXC_WUT_GetTime(uint32_t ticks, uint32_t *time, mxc_wut_unit_t *units)
Convert timer ticks to real time.
MXC_WUT_PRES_512
@ MXC_WUT_PRES_512
Divide input clock by 256.
Definition: wut.h:72
MXC_WUT_MODE_CONTINUOUS
@ MXC_WUT_MODE_CONTINUOUS
Wakeup Timer Mode ONESHOT.
Definition: wut.h:83
MXC_S_WUT_CTRL_PRES_DIV2
#define MXC_S_WUT_CTRL_PRES_DIV2
Definition: wut_regs.h:174
MXC_WUT_PRES_2048
@ MXC_WUT_PRES_2048
Divide input clock by 1024.
Definition: wut.h:74
MXC_WUT_GetCount
uint32_t MXC_WUT_GetCount(void)
Get the timer count.
MXC_WUT_UNIT_MICROSEC
@ MXC_WUT_UNIT_MICROSEC
Definition: wut.h:91
MXC_WUT_PRES_16
@ MXC_WUT_PRES_16
Divide input clock by 8.
Definition: wut.h:67
MXC_WUT_IntClear
void MXC_WUT_IntClear(void)
Clear the timer interrupt.