[BACK]Return to bus.h CVS log [TXT][DIR] Up to [local] / funnyos / sys

File: [local] / funnyos / sys / bus.h (download)

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

Initial revision

/*
 * $Id: bus.h,v 1.1 2007/10/16 08:41:05 init Exp $
 */
#ifndef _SYS_BUS_H
#define _SYS_BUS_H

#include <sys/device.h>

/*
 * Bus operations.
 */
struct busops {
	uint8_t 	(*bus_read_1)(struct device *devp, uint32_t addr);
	uint16_t 	(*bus_read_2)(struct device *devp, uint32_t addr);
	uint32_t 	(*bus_read_4)(struct device *devp, uint32_t addr);
	int 		(*bus_write_1)(struct device *devp, uint32_t addr, uint8_t data);
	int 		(*bus_write_2)(struct device *devp, uint32_t addr, uint16_t data);
	int 		(*bus_write_4)(struct device *devp, uint32_t addr, uint32_t data);
	/* XXX DMA related stuff */
};

#define bus_read_1(dev, addr) ((struct busops *)dev->dv_devdata)->bus_read_1(dev, addr)

#define bus_write_1(dev, addr, data) ((struct busops *)dev->dv_devdata)->bus_write_1(dev, addr, data)

#endif /* _SYS_BUS_H */