xref: /original-bsd/sys/sparc/sparc/clockreg.h (revision 304a8d6d)
1 /*
2  * Copyright (c) 1992, 1993
3  *	The Regents of the University of California.  All rights reserved.
4  *
5  * This software was developed by the Computer Systems Engineering group
6  * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
7  * contributed to Berkeley.
8  *
9  * All advertising materials mentioning features or use of this software
10  * must display the following acknowledgement:
11  *	This product includes software developed by the University of
12  *	California, Lawrence Berkeley Laboratory.
13  *
14  * %sccs.include.redist.c%
15  *
16  *	@(#)clockreg.h	8.1 (Berkeley) 06/11/93
17  *
18  * from: $Header: clockreg.h,v 1.6 92/11/26 03:04:48 torek Exp $ (LBL)
19  */
20 
21 /*
22  * Sun-4c clock Mostek TOD clock.  This includes the ``id prom''.
23  */
24 
25 /*
26  * ID prom format.  The ``host id'' is set up by taking the machine
27  * ID as the top byte and the hostid field as the remaining three.
28  * The id_xxx0 field appears to contain some other number.  The id_xxx1
29  * contains a bunch of 00's and a5's on my machines, suggesting it is
30  * not actually used.  The checksum seems to include them, however.
31  */
32 struct sun4c_idprom {
33 	u_char	id_format;		/* format identifier (= 1) */
34 	u_char	id_machine;		/* machine type (see cpu.h) */
35 	u_char	id_ether[6];		/* ethernet address */
36 	long	id_xxx0;		/* ??? */
37 	u_char	id_hostid[3];		/* ``host id'' bytes */
38 	u_char	id_checksum;		/* xor of everything else */
39 	char	id_xxx1[16];		/* ??? */
40 };
41 
42 /*
43  * Mostek MK48T02 clock.
44  *
45  * The clock includes 2040 bytes of RAM, the last 32 of which serve to
46  * identify the kind of Sun 4c this is.
47  */
48 struct clockreg {
49 	char	cl_nvram[2008];		/* `free' nonvolatile memory */
50 	struct	sun4c_idprom cl_idprom;	/* `id prom' */
51 	volatile u_char	cl_csr;		/* control register */
52 	volatile u_char	cl_sec;		/* seconds (0..59; BCD) */
53 	volatile u_char	cl_min;		/* minutes (0..59; BCD) */
54 	volatile u_char	cl_hour;	/* hour (0..23; BCD) */
55 	volatile u_char	cl_wday;	/* weekday (1..7) */
56 	volatile u_char	cl_mday;	/* day in month (1..31; BCD) */
57 	volatile u_char	cl_month;	/* month (1..12; BCD) */
58 	volatile u_char	cl_year;	/* year (0..99; BCD) */
59 };
60 
61 /* bits in cl_csr */
62 #define	CLK_WRITE	0x80		/* want to write */
63 #define	CLK_READ	0x40		/* want to read (freeze clock) */
64 
65 struct clockreg *clockreg;
66 
67 /*
68  * Sun chose the year `68' as their base count, so that
69  * cl_year==0 means 1968.
70  */
71 #define	YEAR0	68
72