]> git.sur5r.net Git - freertos/blob - FreeRTOS-Plus/Demo/FreeRTOS_Plus_UDP_and_CLI_LPC1830_GCC/ThirdParty/CMSISv2p10_LPC18xx_DriverLib/inc/lpc18xx_wwdt.h
Slight modification to license blub text in header comments.
[freertos] / FreeRTOS-Plus / Demo / FreeRTOS_Plus_UDP_and_CLI_LPC1830_GCC / ThirdParty / CMSISv2p10_LPC18xx_DriverLib / inc / lpc18xx_wwdt.h
1 /**********************************************************************\r
2 * $Id$          lpc18xx_wwdt.h          2011-06-02\r
3 *//**\r
4 * @file         lpc18xx_wwdt.h\r
5 * @brief        Contains all macro definitions and function prototypes\r
6 *                       support for WWDT firmware library on LPC18xx\r
7 * @version      1.0\r
8 * @date         02. June. 2011\r
9 * @author       NXP MCU SW Application Team\r
10 *\r
11 * Copyright(C) 2011, NXP Semiconductor\r
12 * All rights reserved.\r
13 *\r
14 ***********************************************************************\r
15 * Software that is described herein is for illustrative purposes only\r
16 * which provides customers with programming information regarding the\r
17 * products. This software is supplied "AS IS" without any warranties.\r
18 * NXP Semiconductors assumes no responsibility or liability for the\r
19 * use of the software, conveys no license or title under any patent,\r
20 * copyright, or mask work right to the product. NXP Semiconductors\r
21 * reserves the right to make changes in the software without\r
22 * notification. NXP Semiconductors also make no representation or\r
23 * warranty that such application will be suitable for the specified\r
24 * use without further testing or modification.\r
25 **********************************************************************/\r
26 \r
27 /* Peripheral group ----------------------------------------------------------- */\r
28 /** @defgroup WWDT      WWDT (Windowed WatchDog Timer)\r
29  * @ingroup LPC1800CMSIS_FwLib_Drivers\r
30  * @{\r
31  */\r
32 \r
33 \r
34 #ifndef LPC18XX_WWDT_H_\r
35 #define LPC18XX_WWDT_H_\r
36 \r
37 /* Includes ------------------------------------------------------------------- */\r
38 #include "LPC18xx.h"\r
39 #include "lpc_types.h"\r
40 \r
41 \r
42 #ifdef __cplusplus\r
43 extern "C"\r
44 {\r
45 #endif\r
46 \r
47 /* Public Macros -------------------------------------------------------------- */\r
48 /** @defgroup WWDT_Public_Macros  WWDT Public Macros\r
49  * @{\r
50  */\r
51 /** WDT oscillator frequency value */\r
52 #define WDT_OSC         (12000000UL)            /* WWDT uses IRC clock */\r
53 \r
54 /**\r
55  * @}\r
56  */\r
57 \r
58 \r
59 /* Private Macros ------------------------------------------------------------- */\r
60 /** @defgroup WWDT_Private_Macros WWDT Private Macros\r
61  * @{\r
62  */\r
63 // time is calculated by usec\r
64 #define WDT_GET_FROM_USEC(time)         ((time*10)/((WWDT_US_INDEX *10 * 4)/WDT_OSC))\r
65 #define WDT_GET_USEC(counter)           ((counter * ((WWDT_US_INDEX *10 * 4)/WDT_OSC))/10)\r
66 \r
67 \r
68 /* --------------------- BIT DEFINITIONS -------------------------------------- */\r
69 /** WWDT interrupt enable bit */\r
70 #define WWDT_WDMOD_WDEN                     ((uint32_t)(1<<0))\r
71 /** WWDT interrupt enable bit */\r
72 #define WWDT_WDMOD_WDRESET                      ((uint32_t)(1<<1))\r
73 /** WWDT time out flag bit */\r
74 #define WWDT_WDMOD_WDTOF                        ((uint32_t)(1<<2))\r
75 /** WDT Time Out flag bit */\r
76 #define WWDT_WDMOD_WDINT                        ((uint32_t)(1<<3))\r
77 /** WWDT Protect flag bit */\r
78 #define WWDT_WDMOD_WDPROTECT            ((uint32_t)(1<<4))\r
79 \r
80 /** Define divider index for microsecond ( us ) */\r
81 #define WWDT_US_INDEX           ((uint32_t)(1000000))\r
82 \r
83 /** WWDT Time out minimum value */\r
84 #define WWDT_TIMEOUT_MIN        ((uint32_t)(0xFF))\r
85 /** WWDT Time out maximum value */\r
86 #define WWDT_TIMEOUT_MAX        ((uint32_t)(0x00FFFFFF))\r
87 \r
88 /** WWDT Warning minimum value */\r
89 #define WWDT_WARNINT_MIN        ((uint32_t)(0xFF))\r
90 /** WWDT Warning maximum value */\r
91 #define WWDT_WARNINT_MAX        ((uint32_t)(0x000003FF))\r
92 \r
93 /** WWDT Windowed minimum value */\r
94 #define WWDT_WINDOW_MIN         ((uint32_t)(0xFF))\r
95 /** WWDT Windowed minimum value */\r
96 #define WWDT_WINDOW_MAX         ((uint32_t)(0x00FFFFFF))\r
97 \r
98 /** WWDT timer constant register mask */\r
99 #define WWDT_WDTC_MASK                  ((uint32_t)(0x00FFFFFF))\r
100 /** WWDT warning value register mask */\r
101 #define WWDT_WDWARNINT_MASK             ((uint32_t)(0x000003FF))\r
102 /** WWDT feed sequence register mask */\r
103 #define WWDT_WDFEED_MASK                ((uint32_t)(0x000000FF))\r
104 \r
105 /** WWDT flag */\r
106 #define WWDT_WARNINT_FLAG               ((uint8_t)(0))\r
107 #define WWDT_TIMEOUT_FLAG               ((uint8_t)(1))\r
108 \r
109 /** WWDT mode definitions */\r
110 #define WWDT_PROTECT_MODE               ((uint8_t)(0))\r
111 #define WWDT_RESET_MODE                 ((uint8_t)(1))\r
112 \r
113 \r
114 /* WWDT Timer value definition (us) */\r
115 #define WWDT_TIMEOUT_USEC_MIN                   ((uint32_t)(WDT_GET_USEC(WWDT_TIMEOUT_MIN)))//microseconds\r
116 #define WWDT_TIMEOUT_USEC_MAX                   ((uint32_t)(WDT_GET_USEC(WWDT_TIMEOUT_MAX)))\r
117 \r
118 #define WWDT_TIMEWARN_USEC_MIN                  ((uint32_t)(WDT_GET_USEC(WWDT_WARNINT_MIN)))\r
119 #define WWDT_TIMEWARN_USEC_MAX                  ((uint32_t)(WDT_GET_USEC(WWDT_WARNINT_MAX)))\r
120 \r
121 #define WWDT_TIMEWINDOWED_USEC_MIN              ((uint32_t)(WDT_GET_USEC(WWDT_WINDOW_MIN)))\r
122 #define WWDT_TIMEWINDOWED_USEC_MAX              ((uint32_t)(WDT_GET_USEC(WWDT_WINDOW_MAX)))\r
123 \r
124 \r
125 /**\r
126  * @}\r
127  */\r
128 \r
129 /* Public Types --------------------------------------------------------------- */\r
130 /** @defgroup WWDT_Public_Types WWDT Public Types\r
131  * @{\r
132  */\r
133 /********************************************************************//**\r
134  * @brief WWDT structure definitions\r
135  **********************************************************************/\r
136 typedef struct Wdt_Config\r
137 {\r
138         uint8_t wdtReset;                       /**< if ENABLE -> the Reset bit is enabled                              */\r
139         uint8_t wdtProtect;                     /**< if ENABLE -> the Protect bit is enabled                    */\r
140         uint32_t wdtTmrConst;           /**< Set the constant value to timeout the WDT (us)             */\r
141         uint32_t wdtWarningVal;         /**< Set the value to warn the WDT with interrupt (us)  */\r
142         uint32_t wdtWindowVal;          /**< Set a window vaule for WDT (us)                                    */\r
143 }st_Wdt_Config;\r
144 \r
145 /**\r
146  * @}\r
147  */\r
148 \r
149 /* Public Functions ----------------------------------------------------------- */\r
150 /** @defgroup WWDT_Public_Functions WWDT Public Functions\r
151  * @{\r
152  */\r
153 \r
154 void WWDT_Init(void);\r
155 void WWDT_UpdateTimeOut(uint32_t TimeOut);\r
156 void WWDT_Feed (void);\r
157 void WWDT_SetWarning(uint32_t WarnTime);\r
158 void WWDT_SetWindow(uint32_t WindowedTime);\r
159 void WWDT_Configure(st_Wdt_Config wdtCfg);\r
160 void WWDT_Start(void);\r
161 FlagStatus WWDT_GetStatus (uint8_t Status);\r
162 void WWDT_ClearStatusFlag (uint8_t flag);\r
163 uint32_t WWDT_GetCurrentCount(void);\r
164 /**\r
165  * @}\r
166  */\r
167 \r
168 #ifdef __cplusplus\r
169 }\r
170 #endif\r
171 \r
172 #endif /* LPC18XX_WWDT_H_ */\r
173 \r
174 /**\r
175  * @}\r
176  */\r
177 /* --------------------------------- End Of File ------------------------------ */\r