xref: /netbsd/sys/arch/sun2/sun2/tod.h (revision 6550d01e)
1 /*	$NetBSD: tod.h,v 1.4 2005/12/11 12:19:16 christos Exp $	*/
2 
3 /*
4  * Structures and macros des accessing the National Semiconductor
5  * MM58167 time-of-day chip as wired in the Sun2.  See
6  * http://www.national.com/ds/MM/MM58167B.pdf for data sheets,
7  * and sys/dev/ic/mm58167var.h.
8  */
9 
10 #if __for_reference_only__
11 struct mm58167regs {
12 
13 	/* the various timers.  all of these values are in BCD: */
14 
15 	/* the most significant digit of this value is the milliseconds
16 	   unit; least significant digit of this value is undefined: */
17 	uint8_t mm58167_msec_xxx;
18 	uint8_t mm58167_unused0;
19 	/* both digits of this value make up centiseconds: */
20 	uint8_t mm58167_csec;
21 	uint8_t mm58167_unused1;
22 	uint8_t mm58167_sec;
23 	uint8_t mm58167_unused2;
24 	uint8_t mm58167_min;
25 	uint8_t mm58167_unused3;
26 	uint8_t mm58167_hour;
27 	uint8_t mm58167_unused4;
28 	uint8_t mm58167_wday;
29 	uint8_t mm58167_unused5;
30 	uint8_t mm58167_day;
31 	uint8_t mm58167_unused6;
32 	uint8_t mm58167_mon;
33 	uint8_t mm58167_unused7;
34 
35 	/* the compare latches.  these line up with the timers above, but
36 	   since we don't use them, we don't go through the trouble of
37 	   defining real members for them: */
38 	struct {
39 		uint8_t _mm58167_latch_val;
40 		uint8_t _mm58167_latch_unused;
41 	} _mm58167_latches[8];
42 
43 	uint8_t mm58167_isr;		/* interrupt status - not used */
44 	uint8_t _mm58167_unused8;
45 	uint8_t mm58167_icr;		/* interrupt control - not used */
46 	uint8_t _mm58167_unused9;
47 	uint8_t mm58167_creset;		/* counter reset mask */
48 	uint8_t _mm58167_unused10;
49 	uint8_t mm58167_lreset;		/* latch reset mask */
50 	uint8_t _mm58167_unused11;
51 	uint8_t mm58167_status;		/* bad counter read status */
52 	uint8_t _mm58167_unused12;
53 	uint8_t mm58167_go;		/* GO - start at integral seconds */
54 	uint8_t _mm58167_unused13;
55 	uint8_t mm58167_stby;		/* standby mode - not used */
56 	uint8_t _mm58167_unused14;
57 	uint8_t mm58167_test;		/* test mode - ??? */
58 	uint8_t _mm58167_unused15;
59 };
60 #endif
61 
62 /*
63  * Register offsets.
64  */
65 #define	MM58167REG_MSEC_XXX	0
66 #define	MM58167REG_CSEC		2
67 #define	MM58167REG_SEC		4
68 #define	MM58167REG_MIN		6
69 #define	MM58167REG_HOUR		8
70 #define	MM58167REG_WDAY		10
71 #define	MM58167REG_DAY		12
72 #define	MM58167REG_MON		14
73 #define	MM58167REG_STATUS	40
74 #define	MM58167REG_GO		42
75 #define	MM58167REG_BANK_SZ	48
76