2 * @brief LPC18xx/43xx WWDT chip driver
\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 __WWDT_18XX_43XX_H_
\r
33 #define __WWDT_18XX_43XX_H_
\r
39 /** @defgroup WWDT_18XX_43XX CHIP: LPC18xx/43xx WWDT driver
\r
40 * @ingroup CHIP_18XX_43XX_Drivers
\r
44 /** WDT oscillator frequency value */
\r
45 #define WDT_OSC (CGU_IRC_FREQ)
\r
47 /** Minimum tick count for timer value and window value */
\r
48 #define WWDT_TICKS_MIN 0xFF
\r
50 /** Maximum tick count for timer value and window value */
\r
51 #define WWDT_TICKS_MAX 0xFFFFFF
\r
54 * @brief Initialize the Watchdog timer
\r
55 * @param pWWDT : The base of WatchDog Timer peripheral on the chip
\r
58 void Chip_WWDT_Init(LPC_WWDT_T *pWWDT);
\r
61 * @brief Shutdown the Watchdog timer
\r
62 * @param pWWDT : The base of WatchDog Timer peripheral on the chip
\r
65 STATIC INLINE void Chip_WWDT_DeInit(LPC_WWDT_T *pWWDT)
\r
67 IP_WWDT_DeInit(pWWDT);
\r
71 * @brief Set WDT timeout constant value used for feed
\r
72 * @param pWWDT : The base of WatchDog Timer peripheral on the chip
\r
73 * @param timeout : WDT timeout in ticks, between WWDT_TICKS_MIN and WWDT_TICKS_MAX
\r
76 STATIC INLINE void Chip_WWDT_SetTimeOut(LPC_WWDT_T *pWWDT, uint32_t timeout)
\r
78 IP_WWDT_SetTimeOut(pWWDT, timeout);
\r
82 * @brief Feed watchdog timer
\r
83 * @param pWWDT : The base of WatchDog Timer peripheral on the chip
\r
85 * @note If this function isn't called, a watchdog timer warning will occur.
\r
86 * After the warning, a timeout will occur if a feed has happened.
\r
88 STATIC INLINE void Chip_WWDT_Feed(LPC_WWDT_T *pWWDT)
\r
90 IP_WWDT_Feed(pWWDT);
\r
94 * @brief Set WWDT warning interrupt
\r
95 * @param pWWDT : The base of WatchDog Timer peripheral on the chip
\r
96 * @param timeout : WDT warning in ticks, between 0 and 1023
\r
98 * @note This is the number of ticks after the watchdog interrupt that the
\r
99 * warning interrupt will be generated.
\r
101 STATIC INLINE void Chip_WWDT_SetWarning(LPC_WWDT_T *pWWDT, uint32_t timeout)
\r
103 IP_WWDT_SetWarning(pWWDT, timeout);
\r
107 * @brief Set WWDT window time
\r
108 * @param pWWDT : The base of WatchDog Timer peripheral on the chip
\r
109 * @param timeout : WDT window in ticks, between WWDT_TICKS_MIN and WWDT_TICKS_MAX
\r
111 * @note The watchdog timer must be fed between the timeout from the Chip_WWDT_SetTimeOut()
\r
112 * function and this function, with this function defining the last tick before the
\r
113 * watchdog window interrupt occurs.
\r
115 STATIC INLINE void Chip_WWDT_SetWindow(LPC_WWDT_T *pWWDT, uint32_t timeout)
\r
117 IP_WWDT_SetWindow(pWWDT, timeout);
\r
121 * @brief Enable watchdog timer options
\r
122 * @param pWWDT : The base of WatchDog Timer peripheral on the chip
\r
123 * @param options : An or'ed set of options of values
\r
124 * WWDT_WDMOD_WDEN, WWDT_WDMOD_WDRESET, and WWDT_WDMOD_WDPROTECT
\r
126 * @note You can enable more than one option at once (ie, WWDT_WDMOD_WDRESET |
\r
127 * WWDT_WDMOD_WDPROTECT), but use the WWDT_WDMOD_WDEN after all other options
\r
128 * are set (or unset) with no other options.
\r
130 STATIC INLINE void Chip_WWDT_SetOption(LPC_WWDT_T *pWWDT, uint32_t options)
\r
132 IP_WWDT_SetOption(pWWDT, options);
\r
136 * @brief Disable/clear watchdog timer options
\r
137 * @param pWWDT : The base of WatchDog Timer peripheral on the chip
\r
138 * @param options : An or'ed set of options of values
\r
139 * WWDT_WDMOD_WDEN, WWDT_WDMOD_WDRESET, and WWDT_WDMOD_WDPROTECT
\r
141 * @note You can disable more than one option at once (ie, WWDT_WDMOD_WDRESET |
\r
142 * WWDT_WDMOD_WDTOF).
\r
144 STATIC INLINE void Chip_WWDT_UnsetOption(LPC_WWDT_T *pWWDT, uint32_t options)
\r
146 IP_WWDT_UnsetOption(pWWDT, options);
\r
150 * @brief Enable WWDT activity
\r
151 * @param pWWDT : The base of WatchDog Timer peripheral on the chip
\r
154 STATIC INLINE void Chip_WWDT_Start(LPC_WWDT_T *pWWDT)
\r
156 IP_WWDT_Start(pWWDT);
\r
160 * @brief Read WWDT status flag
\r
161 * @param pWWDT : The base of WatchDog Timer peripheral on the chip
\r
162 * @return Watchdog status, an Or'ed value of WWDT_WDMOD_*
\r
164 STATIC INLINE uint32_t Chip_WWDT_GetStatus(LPC_WWDT_T *pWWDT)
\r
166 return IP_WWDT_GetStatus(pWWDT);
\r
170 * @brief Clear WWDT interrupt status flags
\r
171 * @param pWWDT : The base of WatchDog Timer peripheral on the chip
\r
172 * @param status : Or'ed value of status flag(s) that you want to clear, should be:
\r
173 * - WWDT_WDMOD_WDTOF: Clear watchdog timeout flag
\r
174 * - WWDT_WDMOD_WDINT: Clear watchdog warning flag
\r
177 STATIC INLINE void Chip_WWDT_ClearStatusFlag(LPC_WWDT_T *pWWDT, uint32_t status)
\r
179 IP_WWDT_ClearStatusFlag(pWWDT, status);
\r
183 * @brief Get the current value of WDT
\r
184 * @param pWWDT : The base of WatchDog Timer peripheral on the chip
\r
185 * @return current value of WDT
\r
187 STATIC INLINE uint32_t Chip_WWDT_GetCurrentCount(LPC_WWDT_T *pWWDT)
\r
189 return IP_WWDT_GetCurrentCount(pWWDT);
\r
200 #endif /* __WWDT_18XX_43XX_H_ */
\r