Annotation of funnyos/arch/testarm/dev/tartc.c, Revision 1.3
1.1 init 1: /*
1.3 ! init 2: * $Id: tartc.c,v 1.2 2007/10/29 15:10:34 init Exp $
1.1 init 3: */
4: #include <sys/types.h>
5: #include <sys/device.h>
1.2 init 6: #include <sys/bus.h>
7:
8: #include <arch/testarm/dev/tartcvar.h>
9: #include <arch/testarm/dev/tartcreg.h>
1.1 init 10: #include <libkern/printf.h>
11:
12: /*
13: * testarm Real Time Clock driver.
14: */
1.2 init 15: int tartc_attach(struct device *, uint32_t loc, uint8_t flags);
1.3 ! init 16: void tartc_interrupt(struct device *);
1.2 init 17:
18:
19: struct driver tartc_dr = {
20: sizeof(struct tartc_dd),
21: tartc_attach,
1.3 ! init 22: NULL,
! 23: tartc_interrupt
1.2 init 24: };
1.1 init 25:
26:
27: int
1.2 init 28: tartc_attach(struct device *self, uint32_t loc, uint8_t flags)
1.1 init 29: {
1.2 init 30: struct tartc_dd *ddp = self->dv_devdata;
31: uint32_t seconds;
1.1 init 32:
1.2 init 33: /* acquire bus_handle from parent */
34: ddp->td_bushandlep = self->dv_parent->dv_aux;
35:
36: /* save our location on parent (or use default if loc == 0) */
37: ddp->td_ioaddr = (loc != 0) ? loc : TARTC_REG_BASE;
38:
39: /*
40: * Read seconds past Epoch.
41: */
42: /* trigger clock update on host */
43: bus_write_1(ddp->td_bushandlep, ddp->td_ioaddr + TARTC_OFF_CLOCKUPDATE, 1);
44:
45: /* get seconds past Epoch */
46: seconds = bus_read_4(ddp->td_bushandlep, ddp->td_ioaddr + TARTC_OFF_READSECONDS);
47:
48: printf("testarm Real Time Clock (%d seconds past Epoch)\n", seconds);
1.1 init 49:
50: return(0);
1.3 ! init 51:
! 52: }
! 53:
! 54:
! 55: void
! 56: tartc_interrupt(struct device *self)
! 57: {
! 58: /* TODO */
1.1 init 59:
60: }
61:
CVSweb