[BACK]Return to tartc.c CVS log [TXT][DIR] Up to [local] / funnyos / arch / testarm / dev

Diff for /funnyos/arch/testarm/dev/tartc.c between version 1.1 and 1.2

version 1.1, 2007/10/16 09:41:04 version 1.2, 2007/10/29 15:10:34
Line 3 
Line 3 
  */   */
 #include <sys/types.h>  #include <sys/types.h>
 #include <sys/device.h>  #include <sys/device.h>
   #include <sys/bus.h>
   
   #include <arch/testarm/dev/tartcvar.h>
   #include <arch/testarm/dev/tartcreg.h>
 #include <libkern/printf.h>  #include <libkern/printf.h>
   
 /*  /*
  * testarm Real Time Clock driver.   * testarm Real Time Clock driver.
  */   */
   int     tartc_attach(struct device *, uint32_t loc, uint8_t flags);
   
 /* TODO */  
   
   struct driver tartc_dr = {
           sizeof(struct tartc_dd),
           tartc_attach,
           NULL
   };
   
   
 int  int
 tartc_attach(struct device *self)  tartc_attach(struct device *self, uint32_t loc, uint8_t flags)
 {  {
           struct tartc_dd *ddp = self->dv_devdata;
           uint32_t seconds;
   
         printf("testarm Real Time Clock\n");          /* acquire bus_handle from parent */
           ddp->td_bushandlep = self->dv_parent->dv_aux;
   
           /* save our location on parent (or use default if loc == 0) */
           ddp->td_ioaddr = (loc != 0) ? loc : TARTC_REG_BASE;
   
           /*
            * Read seconds past Epoch.
            */
           /* trigger clock update on host */
           bus_write_1(ddp->td_bushandlep, ddp->td_ioaddr + TARTC_OFF_CLOCKUPDATE, 1);
   
           /* get seconds past Epoch */
           seconds = bus_read_4(ddp->td_bushandlep, ddp->td_ioaddr + TARTC_OFF_READSECONDS);
   
           printf("testarm Real Time Clock (%d seconds past Epoch)\n", seconds);
   
         return(0);          return(0);
   

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

CVSweb