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

File: [local] / funnyos / dev / bus.c (download)

Revision 1.1, Tue Oct 16 20:18:13 2007 UTC (16 years, 6 months ago) by init
Branch: MAIN

we need these bus_{write|read}_{1|2|4| functions because we need to call actual xxx_write_1 with xxx_dd
CV: Enter Log.  Lines beginning wite bus_{read|write `CVS:' are removed automatically

/*
 * $Id: bus.c,v 1.1 2007/10/16 20:18:13 init Exp $
 */
#include <sys/types.h>
#include <sys/device.h>
#include <sys/bus.h>

#include <libkern/printf.h>

/*
 * Bus abstraction wrapper functions.
 */

uint8_t
bus_read_1(struct bus_handle *bhp, uint32_t addr)
{
	/* XXX we may use bus locking here */

	return(bhp->bus_read_1(bhp->bh_ownerdevp, addr));
}


uint16_t
bus_read_2(struct bus_handle *bhp, uint32_t addr)
{
	return(bhp->bus_read_2(bhp->bh_ownerdevp, addr));
}


uint32_t
bus_read_4(struct bus_handle *bhp, uint32_t addr)
{
	return(bhp->bus_read_4(bhp->bh_ownerdevp, addr));
}


int
bus_write_1(struct bus_handle *bhp, uint32_t addr, uint8_t data)
{
	return(bhp->bus_write_1(bhp->bh_ownerdevp, addr, data));
}

int
bus_write_2(struct bus_handle *bhp, uint32_t addr, uint16_t data)
{
	return(bhp->bus_write_2(bhp->bh_ownerdevp, addr, data));
}

int
bus_write_4(struct bus_handle *bhp, uint32_t addr, uint32_t data)
{
	return(bhp->bus_write_4(bhp->bh_ownerdevp, addr, data));
}