1 |
584 |
jeremybenn |
/* THIS SAMPLE CODE IS PROVIDED AS IS AND IS SUBJECT TO ALTERATIONS. FUJITSU */
|
2 |
|
|
/* MICROELECTRONICS ACCEPTS NO RESPONSIBILITY OR LIABILITY FOR ANY ERRORS OR */
|
3 |
|
|
/* ELIGIBILITY FOR ANY PURPOSES. */
|
4 |
|
|
/* (C) Fujitsu Microelectronics Europe GmbH */
|
5 |
|
|
/*------------------------------------------------------------------------
|
6 |
|
|
watchdog.h
|
7 |
|
|
- This file contains the defines and function declaration for hardware watchdog.
|
8 |
|
|
-------------------------------------------------------------------------*/
|
9 |
|
|
|
10 |
|
|
#ifndef WATCHDOG_H
|
11 |
|
|
#define WATCHDOG_H
|
12 |
|
|
|
13 |
|
|
/*
|
14 |
|
|
* Clear watchdog defines
|
15 |
|
|
*/
|
16 |
|
|
#define WTC_NONE 0 /* Don't initialize and clear watchdog */
|
17 |
|
|
#define WTC_IN_TASK 1 /* Clear Watchdog in dedicated task */
|
18 |
|
|
#define WTC_IN_TICK 2 /* Clear Watchdog in TICK Hook */
|
19 |
|
|
#define WTC_IN_IDLE 3 /* Clear Watchdog in Idle Hook */
|
20 |
|
|
|
21 |
|
|
#define WATCHDOG WTC_IN_TASK /* Clear Watchdog in vWatchdogTask() */
|
22 |
|
|
/*------------------------------------------------------------------------*/
|
23 |
|
|
/*
|
24 |
|
|
* Watchdog period defines
|
25 |
|
|
*/
|
26 |
|
|
#define WTC_PER_2_16 0 /* The watchdog period is 2^16 CLKRC cycles */
|
27 |
|
|
#define WTC_PER_2_17 1 /* The watchdog period is 2^17 CLKRC cycles */
|
28 |
|
|
#define WTC_PER_2_18 2 /* The watchdog period is 2^18 CLKRC cycles */
|
29 |
|
|
#define WTC_PER_2_19 3 /* The watchdog period is 2^19 CLKRC cycles */
|
30 |
|
|
/*------------------------------------------------------------------------*/
|
31 |
|
|
/*
|
32 |
|
|
* After every WTC_CLR_PER ticks the watchdog would be cleared in the prvWatchdogTask().
|
33 |
|
|
* This period needs to be chosen in accordance with the current CLKRC (100KHz or 2MHz)
|
34 |
|
|
* and the above setting WTC_PER_2_XX.
|
35 |
|
|
*/
|
36 |
|
|
#define WTC_CLR_PER 30 /* The watchdog clear period in RTOS ticks */
|
37 |
|
|
/*------------------------------------------------------------------------*/
|
38 |
|
|
/*
|
39 |
|
|
* Kick_watchdog Macro to clear watchdog
|
40 |
|
|
*/
|
41 |
|
|
#define Kick_Watchdog() \
|
42 |
|
|
{ HWWD = 0x10; \
|
43 |
|
|
}
|
44 |
|
|
/*------------------------------------------------------------------------*/
|
45 |
|
|
/*
|
46 |
|
|
* Watchdog function declarations
|
47 |
|
|
*/
|
48 |
|
|
void InitWatchdog (void);
|
49 |
|
|
void vStartWatchdogTask(unsigned short);
|
50 |
|
|
|
51 |
|
|
#endif
|
52 |
|
|
|