xref: /netbsd-src/sys/dev/dec/mcclock_pad32.c (revision 3b01aba77a7a698587faaae455bbfe740923c1f5)
1 /*	$NetBSD: mcclock_pad32.c,v 1.9 1998/04/19 07:50:25 jonathan Exp $	*/
2 
3 /*
4  * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
5  * All rights reserved.
6  *
7  * Author: Chris G. Demetriou
8  *
9  * Permission to use, copy, modify and distribute this software and
10  * its documentation is hereby granted, provided that both the copyright
11  * notice and this permission notice appear in all copies of the
12  * software, derivative works or modified versions, and any portions
13  * thereof, and that both notices appear in supporting documentation.
14  *
15  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
16  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
17  * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
18  *
19  * Carnegie Mellon requests users of this software to return to
20  *
21  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
22  *  School of Computer Science
23  *  Carnegie Mellon University
24  *  Pittsburgh PA 15213-3890
25  *
26  * any improvements or extensions that they make and grant Carnegie the
27  * rights to redistribute these changes.
28  */
29 
30 #include <sys/cdefs.h>			/* RCS ID & Copyright macro defns */
31 
32 __KERNEL_RCSID(0, "$NetBSD: mcclock_pad32.c,v 1.9 1998/04/19 07:50:25 jonathan Exp $");
33 
34 
35 /*
36  * mc1461818 (or compatible) clock chip driver,  for machines where each
37  * byte-wide mcclock chip register is  mapped
38  * into the low-order byte of a little-endian 32-bit word.
39  *
40  *  DECstation 2100/3100
41  *  DECstation 5100
42  *  DECstation 5000/200 baseboard
43  *  IOCTL asic machines (Alpha  3000 series, Decstation 5000 series)
44  *
45  * bus-specific frontends should just declare an attach and match
46  * entry, and set up a initializea switch to call the functions below.
47  */
48 
49 #include <sys/param.h>
50 #include <sys/kernel.h>
51 #include <sys/systm.h>
52 #include <sys/device.h>
53 
54 #include <machine/autoconf.h>
55 #include <dev/dec/clockvar.h>
56 #include <dev/dec/mcclockvar.h>
57 #include <dev/ic/mc146818reg.h>
58 
59 #include <dev/dec/mcclock_pad32.h>
60 
61 
62 void	mcclock_pad32_write __P((struct mcclock_softc *, u_int, u_int));
63 u_int	mcclock_pad32_read __P((struct mcclock_softc *, u_int));
64 
65 const struct mcclock_busfns mcclock_pad32_busfns = {
66 	mcclock_pad32_write, mcclock_pad32_read,
67 };
68 
69 void
70 mcclock_pad32_write(dev, reg, datum)
71 	struct mcclock_softc *dev;
72 	u_int reg, datum;
73 {
74 	struct mcclock_pad32_softc *sc = (struct mcclock_pad32_softc *)dev;
75 
76 	sc->sc_dp[reg].datum = datum;
77 }
78 
79 u_int
80 mcclock_pad32_read(dev, reg)
81 	struct mcclock_softc *dev;
82 	u_int reg;
83 {
84 	struct mcclock_pad32_softc *sc = (struct mcclock_pad32_softc *)dev;
85 
86 	return (sc->sc_dp[reg].datum);
87 }
88