Annotation of funnyos/arch/testarm/dev/tacons.c, Revision 1.2
1.1 init 1: /*
1.2 ! init 2: * $Id: tacons.c,v 1.1.1.1 2007/10/16 08:41:04 init Exp $
1.1 init 3: */
4: #include <sys/types.h>
5: #include <sys/device.h>
6: #include <sys/bus.h>
1.2 ! init 7:
1.1 init 8: #include <arch/testarm/dev/taconsreg.h>
9: #include <dev/fcons/fconsvar.h>
10: #include <libkern/printf.h>
11:
12: /*
13: * testarm console support.
14: */
15:
1.2 ! init 16: int tacons_attach(struct device *, uint32_t, uint8_t);
! 17: char tacons_getc(void *);
! 18: void tacons_putc(void *, char);
! 19: void tacons_early_putc(char);
1.1 init 20:
1.2 ! init 21: struct driver tacons_dr = {
! 22: sizeof(struct tacons_dd),
! 23: tacons_attach,
! 24: NULL
! 25: };
1.1 init 26:
27:
28: int
1.2 ! init 29: tacons_attach(struct device *self, uint32_t loc, uint8_t flags)
1.1 init 30: {
1.2 ! init 31: struct tacons_dd *ddp = self->dv_devdata;
! 32: struct consoleops *cop = &ddp->td_consops;
! 33:
! 34: /* aquire bus handle from parent */
! 35: ddp->td_bhp = self->dv_parent->dv_aux;
1.1 init 36:
1.2 ! init 37: /* all reads/writes will use this addr; in testarm cons this is the same addr for getc/putc */
! 38: ddp->td_ioaddr = loc;
! 39:
! 40: /* we export struct consoleops */
! 41: cop->getc = tacons_getc;
! 42: cop->putc = tacons_putc;
! 43:
! 44: self->dv_aux = cop;
1.1 init 45:
46: printf("testarm simple console (non-blocking, halt)\n");
47:
48: return(0);
49: }
50:
51:
52: char
1.2 ! init 53: tacons_getc(void *ddp)
1.1 init 54: {
55: /*
56: * Get a character from the console.
57: * Remember that this console is non-blocking.
58: */
1.2 ! init 59: struct tacons_dd *tdp = ddp;
! 60:
! 61: return( bus_read_1(tdp->td_bhp, tdp->td_ioaddr) );
1.1 init 62: }
63:
64:
65: void
1.2 ! init 66: tacons_putc(void *ddp, char ch)
1.1 init 67: {
68: /*
69: * Write a character to the console.
70: */
1.2 ! init 71: struct tacons_dd *tdp = ddp;
1.1 init 72:
1.2 ! init 73: return( bus_write_1(tdp->td_dhp, tdp->td_ioaddr, ch) );
1.1 init 74: }
75:
1.2 ! init 76:
1.1 init 77: void
78: tacons_early_putc(char ch)
79: {
80: /*
81: * put a character on the unconfigured console device.
82: * This will be used during devconfig until fcons/0 is configured.
83: */
84:
85: *(char *)(TACONS_REG_BASE + TACONS_OFF_IO) = ch;
86: }
87:
CVSweb