2 * @brief Self Wakeup Timer (WKT) registers and functions
\r
5 * Copyright(C) NXP Semiconductors, 2012
\r
6 * All rights reserved.
\r
9 * Software that is described herein is for illustrative purposes only
\r
10 * which provides customers with programming information regarding the
\r
11 * LPC products. This software is supplied "AS IS" without any warranties of
\r
12 * any kind, and NXP Semiconductors and its licensor disclaim any and
\r
13 * all warranties, express or implied, including all implied warranties of
\r
14 * merchantability, fitness for a particular purpose and non-infringement of
\r
15 * intellectual property rights. NXP Semiconductors assumes no responsibility
\r
16 * or liability for the use of the software, conveys no license or rights under any
\r
17 * patent, copyright, mask work right, or any other intellectual property rights in
\r
18 * or to any products. NXP Semiconductors reserves the right to make changes
\r
19 * in the software without notification. NXP Semiconductors also makes no
\r
20 * representation or warranty that such application will be suitable for the
\r
21 * specified use without further testing or modification.
\r
24 * Permission to use, copy, modify, and distribute this software and its
\r
25 * documentation is hereby granted, under NXP Semiconductors' and its
\r
26 * licensor's relevant copyrights in the software, without fee, provided that it
\r
27 * is used in conjunction with NXP Semiconductors microcontrollers. This
\r
28 * copyright, permission, and disclaimer notice must appear in all copies of
\r
32 #ifndef __WKT_001_H_
\r
33 #define __WKT_001_H_
\r
35 #include "sys_config.h"
\r
42 /** @defgroup IP_WKT_001 IP: Self Wakeup Timer (WKT) register block and driver
\r
43 * @ingroup IP_Drivers
\r
49 * @brief Self wake-up timer register block structure
\r
52 __IO uint32_t CTRL; /*!< Offset: 0x000 Alarm/Wakeup Timer Control register */
\r
53 uint32_t Reserved[2];
\r
54 __IO uint32_t COUNT; /*!< Offset: 0x000C Alarm/Wakeup Timer Counter register */
\r
58 * WKT Control register bit fields & masks
\r
60 #define WKT_CTRL_CLKSEL ((uint32_t) (1 << 0)) /*!< Select the self wake-up timer clock source */
\r
61 #define WKT_CTRL_ALARMFLAG ((uint32_t) (1 << 1)) /*!< Wake-up or alarm timer flag */
\r
62 #define WKT_CTRL_CLEARCTR ((uint32_t) (1 << 2)) /*!< Clears the self wake-up timer */
\r
65 * WKT Clock source values enum
\r
67 typedef enum IP_WKT_CLKSRC {
\r
68 IP_WKT_CLKSRC_DIVIRC = 0, /*!< Divided IRC clock - runs at 750kHz */
\r
69 IP_WKT_CLKSRC_10KHZ = 1 /*!< Low power clock - runs at 10kHz */
\r
73 * @brief Clear WKT interrupt status
\r
74 * @param pWKT : Pointer to WKT register block
\r
77 STATIC INLINE void IP_WKT_ClearIntStatus(IP_WKT_001_T *pWKT)
\r
79 if ( pWKT->CTRL & WKT_CTRL_ALARMFLAG ) {
\r
80 pWKT->CTRL |= WKT_CTRL_ALARMFLAG;
\r
85 * @brief Clear and stop WKT counter
\r
86 * @param pWKT : Pointer to WKT register block
\r
89 STATIC INLINE void IP_WKT_Stop(IP_WKT_001_T *pWKT)
\r
91 pWKT->CTRL |= WKT_CTRL_CLEARCTR;
\r
95 * @brief Set the WKT clock source
\r
96 * @param pWKT : Pointer to WKT register block
\r
97 * @param clkSrc : WKT Clock source(WKT_CLKSRC_10KHZ or WKT_CLKSRC_DIVIRC)
\r
100 STATIC INLINE void IP_WKT_SetClockSource(IP_WKT_001_T *pWKT, IP_WKT_CLKSRC_T clkSrc)
\r
102 if (clkSrc == IP_WKT_CLKSRC_10KHZ) {
\r
103 pWKT->CTRL |= WKT_CTRL_CLKSEL; /* using Low Power clock 10kHz */
\r
106 pWKT->CTRL &= ~WKT_CTRL_CLKSEL; /* using Divided IRC clock 750kHz */
\r
111 * @brief Set the WKT counter value & start the counter
\r
112 * @param pWKT : Pointer to WKT register block
\r
113 * @param cntVal : WKT Counter value
\r
116 STATIC INLINE void IP_WKT_Start(IP_WKT_001_T *pWKT, uint32_t cntVal)
\r
118 pWKT->COUNT = cntVal;
\r
129 #endif /* __WKT_001_H_ */
\r