1 |
584 |
jeremybenn |
/* THIS SAMPLE CODE IS PROVIDED AS IS AND IS SUBJECT TO ALTERATIONS. FUJITSU */
|
2 |
|
|
|
3 |
|
|
/* MICROELECTRONICS ACCEPTS NO RESPONSIBILITY OR LIABILITY FOR ANY ERRORS OR */
|
4 |
|
|
|
5 |
|
|
/* ELIGIBILITY FOR ANY PURPOSES. */
|
6 |
|
|
|
7 |
|
|
/* (C) Fujitsu Microelectronics Europe GmbH */
|
8 |
|
|
|
9 |
|
|
/*------------------------------------------------------------------------
|
10 |
|
|
watchdog.h
|
11 |
|
|
- This file contains the defines and function declaration for hardware watchdog.
|
12 |
|
|
-------------------------------------------------------------------------*/
|
13 |
|
|
|
14 |
|
|
/*
|
15 |
|
|
* Clear watchdog defines
|
16 |
|
|
*/
|
17 |
|
|
#define WTC_NONE 0 /* Don't initialize and clear watchdog */
|
18 |
|
|
#define WTC_IN_TASK 1 /* Clear Watchdog in dedicated task */
|
19 |
|
|
#define WTC_IN_TICK 2 /* Clear Watchdog in TICK Hook */
|
20 |
|
|
#define WTC_IN_IDLE 3 /* Clear Watchdog in Idle Hook */
|
21 |
|
|
|
22 |
|
|
#define WATCHDOG WTC_NONE /* Clear Watchdog in vWatchdogTask() */
|
23 |
|
|
|
24 |
|
|
/*------------------------------------------------------------------------*/
|
25 |
|
|
|
26 |
|
|
/*
|
27 |
|
|
* Watchdog period defines
|
28 |
|
|
*/
|
29 |
|
|
#define WTC_PER_2_9 0 /* The watchdog period is 2^9/CLKWT */
|
30 |
|
|
#define WTC_PER_2_10 1 /* The watchdog period is 2^10/CLKWT */
|
31 |
|
|
#define WTC_PER_2_11 2 /* The watchdog period is 2^11/CLKWT */
|
32 |
|
|
#define WTC_PER_2_12 3 /* The watchdog period is 2^12/CLKWT */
|
33 |
|
|
#define WTC_PER_2_13 4 /* The watchdog period is 2^13/CLKWT */
|
34 |
|
|
#define WTC_PER_2_14 5 /* The watchdog period is 2^14/CLKWT */
|
35 |
|
|
#define WTC_PER_2_15 6 /* The watchdog period is 2^15/CLKWT */
|
36 |
|
|
#define WTC_PER_2_16 7 /* The watchdog period is 2^16/CLKWT */
|
37 |
|
|
#define WTC_PER_2_17 8 /* The watchdog period is 2^17/CLKWT */
|
38 |
|
|
#define WTC_PER_2_18 9 /* The watchdog period is 2^18/CLKWT */
|
39 |
|
|
#define WTC_PER_2_19 10 /* The watchdog period is 2^19/CLKWT */
|
40 |
|
|
#define WTC_PER_2_20 11 /* The watchdog period is 2^20/CLKWT */
|
41 |
|
|
#define WTC_PER_2_21 12 /* The watchdog period is 2^21/CLKWT */
|
42 |
|
|
#define WTC_PER_2_22 13 /* The watchdog period is 2^22/CLKWT */
|
43 |
|
|
#define WTC_PER_2_23 14 /* The watchdog period is 2^23/CLKWT */
|
44 |
|
|
#define WTC_PER_2_24 15 /* The watchdog period is 2^24/CLKWT */
|
45 |
|
|
|
46 |
|
|
/*------------------------------------------------------------------------*/
|
47 |
|
|
|
48 |
|
|
/*
|
49 |
|
|
* Watchdog Clock source defines
|
50 |
|
|
*/
|
51 |
|
|
#define WTC_CLKRC0 0 /* The watchdog clock is CLKRC */
|
52 |
|
|
#define WTC_CLKRC1 1 /* The watchdog clock is CLKRC,
|
53 |
|
|
changing RC clock while watchdog opeation causes reset */
|
54 |
|
|
#define WTC_CLKMC 2 /* The watchdog clock is CLKMC */
|
55 |
|
|
#define WTC_CLKSC 3 /* The watchdog clock is CLKSC */
|
56 |
|
|
|
57 |
|
|
/*------------------------------------------------------------------------*/
|
58 |
|
|
|
59 |
|
|
/*
|
60 |
|
|
* Watchdog Reset at transition to Stop mode defines
|
61 |
|
|
*/
|
62 |
|
|
#define WTC_RSTP_0 0 /* No watchdog reset at transition to Stop mode */
|
63 |
|
|
#define WTC_RSTP_1 1 /* watchdog reset at transition to Stop mode */
|
64 |
|
|
|
65 |
|
|
/*------------------------------------------------------------------------*/
|
66 |
|
|
|
67 |
|
|
/*
|
68 |
|
|
* After every WTC_CLR_PER ticks the watchdog would be cleared in the prvWatchdogTask().
|
69 |
|
|
* This period needs to be chosed in accordance with the current CLKWT and the above
|
70 |
|
|
* setting WTC_PER_2_XX.
|
71 |
|
|
*/
|
72 |
|
|
#define WTC_CLR_PER 100 /* The watchdog clear period in RTOS ticks */
|
73 |
|
|
|
74 |
|
|
/*------------------------------------------------------------------------*/
|
75 |
|
|
|
76 |
|
|
/*
|
77 |
|
|
* Kick_watchdog Macro to clear watchdog
|
78 |
|
|
*/
|
79 |
|
|
#define Kick_Watchdog() \
|
80 |
|
|
{ \
|
81 |
|
|
WDTCP = 0x00; \
|
82 |
|
|
}
|
83 |
|
|
|
84 |
|
|
/*------------------------------------------------------------------------*/
|
85 |
|
|
|
86 |
|
|
/*
|
87 |
|
|
* Watchdog function declarations
|
88 |
|
|
*/
|
89 |
|
|
void InitWatchdog( void );
|
90 |
|
|
void vStartWatchdogTask( unsigned portBASE_TYPE uxPriority );
|