| 1 | /***********************************************************************/ |
|---|
| 2 | /* */ |
|---|
| 3 | /* MODULE: bcmtimer.h */ |
|---|
| 4 | /* DATE: 96/12/19 */ |
|---|
| 5 | /* PURPOSE: Definitions for Timer block */ |
|---|
| 6 | /* */ |
|---|
| 7 | /***********************************************************************/ |
|---|
| 8 | #ifndef BCMTIMER_H |
|---|
| 9 | #define BCMTIMER_H |
|---|
| 10 | |
|---|
| 11 | #include "bcmmips.h" |
|---|
| 12 | #include "bchp_common.h" |
|---|
| 13 | #include "bchp_timer.h" |
|---|
| 14 | |
|---|
| 15 | |
|---|
| 16 | #if !defined _ASMLANGUAGE |
|---|
| 17 | #if __cplusplus |
|---|
| 18 | extern "C" { |
|---|
| 19 | #endif |
|---|
| 20 | #endif |
|---|
| 21 | |
|---|
| 22 | #define TIMR_ADR_BASE BCM_PHYS_TO_K1(BCHP_PHYSICAL_OFFSET+BCHP_TIMER_TIMER_IS) |
|---|
| 23 | |
|---|
| 24 | #define TIMER_TIMER_IS 0x00 |
|---|
| 25 | #define TIMER_TIMER_IE0 0x04 |
|---|
| 26 | #define TIMER_TIMER0_CTRL 0x08 |
|---|
| 27 | #define TIMER_TIMER1_CTRL 0x0c |
|---|
| 28 | #define TIMER_TIMER2_CTRL 0x10 |
|---|
| 29 | #define TIMER_TIMER3_CTRL 0x14 |
|---|
| 30 | #define TIMER_TIMER0_STAT 0x18 |
|---|
| 31 | #define TIMER_TIMER1_STAT 0x1c |
|---|
| 32 | #define TIMER_TIMER2_STAT 0x20 |
|---|
| 33 | #define TIMER_TIMER3_STAT 0x24 |
|---|
| 34 | #define TIMER_WDTIMEOUT 0x28 |
|---|
| 35 | #define TIMER_WDCMD 0x2c |
|---|
| 36 | #define TIMER_WDCHIPRST_CNT 0x30 |
|---|
| 37 | #define TIMER_WDCRS 0x34 |
|---|
| 38 | #define TIMER_TIMER_IE1 0x38 |
|---|
| 39 | |
|---|
| 40 | /* Timer interrupt register */ |
|---|
| 41 | #define TIMER_INT_TIMER0 0x01 |
|---|
| 42 | #define TIMER_INT_TIMER1 0x02 |
|---|
| 43 | #define TIMER_INT_TIMER2 0x04 |
|---|
| 44 | #define TIMER_INT_TIMER3 0x08 |
|---|
| 45 | #define TIMER_INT_WDINT 0x10 |
|---|
| 46 | |
|---|
| 47 | /* Timer control register */ |
|---|
| 48 | #define TIMER_CTL_ENA 0x80000000 |
|---|
| 49 | #define TIMER_CTL_MODE 0x40000000 |
|---|
| 50 | #define TIMER_CTL_TIMEOUT_MASK 0x3FFFFFFF |
|---|
| 51 | |
|---|
| 52 | /* Timer status register */ |
|---|
| 53 | #define TIMER_STS_COUNTER_MASK 0x3FFFFFFF |
|---|
| 54 | |
|---|
| 55 | #if !defined _ASMLANGUAGE |
|---|
| 56 | |
|---|
| 57 | |
|---|
| 58 | |
|---|
| 59 | typedef struct Timer { |
|---|
| 60 | unsigned long TimerInts; /* 0x00 */ |
|---|
| 61 | #define TIMER0 0x01 |
|---|
| 62 | #define TIMER1 0x02 |
|---|
| 63 | #define TIMER2 0x04 |
|---|
| 64 | #define TIMER3 0x08 |
|---|
| 65 | #define WATCHDOG 0x10 |
|---|
| 66 | unsigned long TimerMask; /* 0x04 */ |
|---|
| 67 | #define TIMER0EN 0x01 |
|---|
| 68 | #define TIMER1EN 0x02 |
|---|
| 69 | #define TIMER2EN 0x04 |
|---|
| 70 | #define TIMER3EN 0x08 |
|---|
| 71 | unsigned long TimerCtl0; /* 0x08 */ |
|---|
| 72 | unsigned long TimerCtl1; /* 0x0c */ |
|---|
| 73 | unsigned long TimerCtl2; /* 0x10 */ |
|---|
| 74 | unsigned long TimerCtl3; /* 0x14 */ |
|---|
| 75 | #define TIMERENABLE 0x80000000 |
|---|
| 76 | #define RSTCNTCLR 0x40000000 |
|---|
| 77 | unsigned long TimerCnt0; /* 0x18 */ |
|---|
| 78 | unsigned long TimerCnt1; /* 0x1c */ |
|---|
| 79 | unsigned long TimerCnt2; /* 0x20 */ |
|---|
| 80 | unsigned long TimerCnt3; /* 0x24 */ |
|---|
| 81 | unsigned long WatchDogDefCount; /* 0x28 */ |
|---|
| 82 | |
|---|
| 83 | /* Write 0xff00 0x00ff to Start timer |
|---|
| 84 | * Write 0xee00 0x00ee to Stop and re-load default count |
|---|
| 85 | * Read from this register returns current watch dog count |
|---|
| 86 | */ |
|---|
| 87 | unsigned long WatchDogCtl; /* 0x2c */ |
|---|
| 88 | |
|---|
| 89 | /* Number of 40-MHz ticks for WD Reset pulse to last */ |
|---|
| 90 | unsigned long WDResetCount; /* 0x30 */ |
|---|
| 91 | unsigned long WDResetStatus; /* 0x34 */ |
|---|
| 92 | } Timer; |
|---|
| 93 | |
|---|
| 94 | #define TIMER ((volatile Timer * const)(TIMR_ADR_BASE)) |
|---|
| 95 | |
|---|
| 96 | |
|---|
| 97 | |
|---|
| 98 | |
|---|
| 99 | #if __cplusplus |
|---|
| 100 | } |
|---|
| 101 | #endif |
|---|
| 102 | #endif |
|---|
| 103 | |
|---|
| 104 | #endif |
|---|