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

File: [local] / funnyos / arch / testarm / dev / tacons.c (download)

Revision 1.1, Tue Oct 16 08:41:04 2007 UTC (16 years, 8 months ago) by init
Branch: MAIN

Initial revision

/*
 * $Id: tacons.c,v 1.1 2007/10/16 08:41:04 init Exp $
 */
#include <sys/types.h>
#include <sys/device.h>
#include <sys/bus.h>
#include <arch/testarm/dev/taconsreg.h>
#include <dev/fcons/fconsvar.h>
#include <libkern/printf.h>

/*
 * testarm console support.
 */

#if 0
struct consoleops 	tacons_dd[NTACONS];

int 	tacons_attach(struct device *);
char 	tacons_getc(struct device *);
void 	tacons_putc(struct device *, char);
void 	tacons_early_putc(char);


int
tacons_attach(struct device *self)
{
	struct consoleops *aux = self->dv_aux;
	aux = kmalloc(sizeof(struct consoleops));

	aux->getc = tacons_getc;
	aux->putc = tacons_putc;

	printf("testarm simple console (non-blocking, halt)\n");

	/*
	 * XXX test putc() & getc()
	 * and TODO: think carefully about console abstraction layer and early printf's
	 * in particular printing root/0, obio and cpu at the fcons during attachment.
	 */

	return(0);
}


char
tacons_getc(struct device *devp)
{
	/*
	 * Get a character from the console.
	 * Remember that this console is non-blocking.
	 */

	return( bus_read_1(devp->dv_parent, devp->dv_locator ? devp->dv_locator + TACONS_OFF_IO : TACONS_REG_BASE + TACONS_OFF_IO) );

}


void
tacons_putc(struct device *devp, char ch)
{
	/*
	 * Write a character to the console.
	 */

	bus_write_1(devp->dv_parent, devp->dv_locator ? devp->dv_locator + TACONS_OFF_IO : TACONS_REG_BASE + TACONS_OFF_IO, ch);
	
	return;
}

#endif /* not 0 */
void
tacons_early_putc(char ch)
{
	/*
	 * put a character on the unconfigured console device.
	 * This will be used during devconfig until fcons/0 is configured.
	 */

	*(char *)(TACONS_REG_BASE + TACONS_OFF_IO) = ch;
}