Home | History | Annotate | Line # | Download | only in dec
mcclock_pad32.c revision 1.1
      1  1.1  cgd /*	XXX	*/
      2  1.1  cgd 
      3  1.1  cgd #include <sys/param.h>
      4  1.1  cgd #include <sys/kernel.h>
      5  1.1  cgd #include <sys/systm.h>
      6  1.1  cgd #include <sys/device.h>
      7  1.1  cgd 
      8  1.1  cgd #include <alpha/alpha/clockvar.h>
      9  1.1  cgd #include <alpha/alpha/mcclockvar.h>
     10  1.1  cgd #include <dev/ic/mc146818reg.h>
     11  1.1  cgd #include <dev/tc/tcreg.h>
     12  1.1  cgd #include <dev/tc/tcvar.h>
     13  1.1  cgd #include <dev/tc/ioasicvar.h>                   /* XXX */
     14  1.1  cgd 
     15  1.1  cgd struct mcclock_ioasic_clockdatum {
     16  1.1  cgd 	u_char	datum;
     17  1.1  cgd 	char	pad[3];
     18  1.1  cgd };
     19  1.1  cgd 
     20  1.1  cgd struct mcclock_ioasic_softc {
     21  1.1  cgd 	struct mcclock_softc	sc_mcclock;
     22  1.1  cgd 
     23  1.1  cgd 	struct mcclock_ioasic_clockdatum *sc_dp;
     24  1.1  cgd };
     25  1.1  cgd 
     26  1.1  cgd int	mcclock_ioasic_match __P((struct device *, void *, void *));
     27  1.1  cgd void	mcclock_ioasic_attach __P((struct device *, struct device *, void *));
     28  1.1  cgd 
     29  1.1  cgd struct cfattach mcclock_ioasic_ca = {
     30  1.1  cgd 	sizeof (struct mcclock_ioasic_softc), mcclock_ioasic_match,
     31  1.1  cgd 	    mcclock_ioasic_attach,
     32  1.1  cgd };
     33  1.1  cgd 
     34  1.1  cgd void	mcclock_ioasic_write __P((struct mcclock_softc *, u_int, u_int));
     35  1.1  cgd u_int	mcclock_ioasic_read __P((struct mcclock_softc *, u_int));
     36  1.1  cgd 
     37  1.1  cgd const struct mcclock_busfns mcclock_ioasic_busfns = {
     38  1.1  cgd 	mcclock_ioasic_write, mcclock_ioasic_read,
     39  1.1  cgd };
     40  1.1  cgd 
     41  1.1  cgd int
     42  1.1  cgd mcclock_ioasic_match(parent, match, aux)
     43  1.1  cgd 	struct device *parent;
     44  1.1  cgd 	void *match, *aux;
     45  1.1  cgd {
     46  1.1  cgd 	struct ioasicdev_attach_args *d = aux;
     47  1.1  cgd 
     48  1.1  cgd 	if (strncmp("TOY_RTC ", d->iada_modname, TC_ROM_LLEN))
     49  1.1  cgd 		return (0);
     50  1.1  cgd 
     51  1.1  cgd 	return (1);
     52  1.1  cgd }
     53  1.1  cgd 
     54  1.1  cgd void
     55  1.1  cgd mcclock_ioasic_attach(parent, self, aux)
     56  1.1  cgd 	struct device *parent, *self;
     57  1.1  cgd 	void *aux;
     58  1.1  cgd {
     59  1.1  cgd 	struct ioasicdev_attach_args *ioasicdev = aux;
     60  1.1  cgd 	struct mcclock_ioasic_softc *sc = (struct mcclock_ioasic_softc *)self;
     61  1.1  cgd 
     62  1.1  cgd 	sc->sc_dp = (struct mcclock_ioasic_clockdatum *)ioasicdev->iada_addr;
     63  1.1  cgd 
     64  1.1  cgd 	mcclock_attach(&sc->sc_mcclock, &mcclock_ioasic_busfns);
     65  1.1  cgd }
     66  1.1  cgd 
     67  1.1  cgd void
     68  1.1  cgd mcclock_ioasic_write(dev, reg, datum)
     69  1.1  cgd 	struct mcclock_softc *dev;
     70  1.1  cgd 	u_int reg, datum;
     71  1.1  cgd {
     72  1.1  cgd 	struct mcclock_ioasic_softc *sc = (struct mcclock_ioasic_softc *)dev;
     73  1.1  cgd 
     74  1.1  cgd 	sc->sc_dp[reg].datum = datum;
     75  1.1  cgd }
     76  1.1  cgd 
     77  1.1  cgd u_int
     78  1.1  cgd mcclock_ioasic_read(dev, reg)
     79  1.1  cgd 	struct mcclock_softc *dev;
     80  1.1  cgd 	u_int reg;
     81  1.1  cgd {
     82  1.1  cgd 	struct mcclock_ioasic_softc *sc = (struct mcclock_ioasic_softc *)dev;
     83  1.1  cgd 
     84  1.1  cgd 	return (sc->sc_dp[reg].datum);
     85  1.1  cgd }
     86