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

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

version 1.1, 2007/10/16 09:41:04 version 1.2, 2007/10/16 21:28:24
Line 4 
Line 4 
 #include <sys/types.h>  #include <sys/types.h>
 #include <sys/device.h>  #include <sys/device.h>
 #include <sys/bus.h>  #include <sys/bus.h>
   
 #include <arch/testarm/dev/taconsreg.h>  #include <arch/testarm/dev/taconsreg.h>
 #include <dev/fcons/fconsvar.h>  #include <dev/fcons/fconsvar.h>
 #include <libkern/printf.h>  #include <libkern/printf.h>
Line 12 
Line 13 
  * testarm console support.   * testarm console support.
  */   */
   
 #if 0  int     tacons_attach(struct device *, uint32_t, uint8_t);
 struct consoleops       tacons_dd[NTACONS];  char    tacons_getc(void *);
   void    tacons_putc(void *, char);
 int     tacons_attach(struct device *);  
 char    tacons_getc(struct device *);  
 void    tacons_putc(struct device *, char);  
 void    tacons_early_putc(char);  void    tacons_early_putc(char);
   
   struct driver tacons_dr = {
           sizeof(struct tacons_dd),
           tacons_attach,
           NULL
   };
   
   
 int  int
 tacons_attach(struct device *self)  tacons_attach(struct device *self, uint32_t loc, uint8_t flags)
 {  {
         struct consoleops *aux = self->dv_aux;          struct tacons_dd *ddp = self->dv_devdata;
         aux = kmalloc(sizeof(struct consoleops));          struct consoleops *cop = &ddp->td_consops;
   
         aux->getc = tacons_getc;          /* aquire bus handle from parent */
         aux->putc = tacons_putc;          ddp->td_bhp = self->dv_parent->dv_aux;
   
         printf("testarm simple console (non-blocking, halt)\n");          /* all reads/writes will use this addr; in testarm cons this is the same addr for getc/putc */
           ddp->td_ioaddr = loc;
   
         /*          /* we export struct consoleops */
          * XXX test putc() & getc()          cop->getc = tacons_getc;
          * and TODO: think carefully about console abstraction layer and early printf's          cop->putc = tacons_putc;
          * in particular printing root/0, obio and cpu at the fcons during attachment.  
          */  
   
           self->dv_aux = cop;
   
           printf("testarm simple console (non-blocking, halt)\n");
   
         return(0);          return(0);
 }  }
   
   
 char  char
 tacons_getc(struct device *devp)  tacons_getc(void *ddp)
 {  {
         /*          /*
          * Get a character from the console.           * Get a character from the console.
          * Remember that this console is non-blocking.           * Remember that this console is non-blocking.
          */           */
           struct tacons_dd *tdp = ddp;
         return( bus_read_1(devp->dv_parent, devp->dv_locator ? devp->dv_locator + TACONS_OFF_IO : TACONS_REG_BASE + TACONS_OFF_IO) );  
           return( bus_read_1(tdp->td_bhp, tdp->td_ioaddr) );
 }  }
   
   
 void  void
 tacons_putc(struct device *devp, char ch)  tacons_putc(void *ddp, char ch)
 {  {
         /*          /*
          * Write a character to the console.           * Write a character to the console.
          */           */
           struct tacons_dd *tdp = ddp;
   
         bus_write_1(devp->dv_parent, devp->dv_locator ? devp->dv_locator + TACONS_OFF_IO : TACONS_REG_BASE + TACONS_OFF_IO, ch);          return( bus_write_1(tdp->td_dhp, tdp->td_ioaddr, ch) );
   
         return;  
 }  }
   
 #endif /* not 0 */  
 void  void
 tacons_early_putc(char ch)  tacons_early_putc(char ch)
 {  {

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

CVSweb