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

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

Revision 1.2, Tue Oct 16 17:58:43 2007 UTC (16 years, 6 months ago) by init
Branch: MAIN
Changes since 1.1: +4 -3 lines

remove busops into bus_handler and describe it in comment abit

/*
 * $Id: bus.h,v 1.2 2007/10/16 17:58:43 init Exp $
 */
#ifndef _SYS_BUS_H
#define _SYS_BUS_H

#include <sys/device.h>

/*
 * Each bus (bus driver instance) has its own bus_handle.
 * Device drivers attached to bus aquire bus_handle to perform all bus i/o.
 */
struct bus_handle {
	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 */