[BACK]Return to com.c CVS log [TXT][DIR] Up to [local] / prex-old / dev / ic

File: [local] / prex-old / dev / ic / com.c (download)

Revision 1.1, Fri Aug 8 13:18:16 2008 UTC (15 years, 9 months ago) by nbrk
Branch: MAIN
CVS Tags: HEAD

Start implementing basic hardware support for CATS, based on new autoconfiguration
mechanism. This effectively uses bus_space to abstract children of parents.
Some info about these drivers:
hostio is a host memory-mapped i/o - one and only child of 'root';
footbridge is just a proxy for now;
fuart is a DC21285 UART driver which fills uart_attach_args and attaches
com, which is machine independent driver;

This all is not finished yet (just quick hacks), but commit it so i could work at home.

/*
 * $Id: com.c,v 1.1 2008/08/08 13:18:16 nbrk Exp $
 */
#include <driver.h>

#include <dev/ic/comvar.h>

/*
 * Autoconf glue.
 */
int	com_match(struct device *parent, void *aux);
int	com_attach(struct device *parent, struct device *self, void *aux);

struct driver com_drv = {
	"com",					/* name */
	sizeof(struct com_softc),/* datasize */
	com_match,				/* match */
	com_attach,				/* attach */
	NULL,						/* detach */
	-1							/* nunits XXX */
};


int
com_match(struct device *parent, void *aux)
{
	return(1);
}


int
com_attach(struct device *parent, struct device *self, void *aux)
{
	struct com_softc *sc = self->dv_data;
	const char *str = "Hello, everyone!\n";

	sc->sc_uaap = aux;

	printk("\n");

	while (*str != 0) {
		sc->sc_uaap->ua_putc(sc->sc_uaap->ua_cookie, 0, *str);

		str++;
	}

	return(0);
}