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

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

Revision 1.7, Thu Oct 25 19:58:47 2007 UTC (16 years, 5 months ago) by init
Branch: MAIN
CVS Tags: HEAD
Changes since 1.6: +2 -2 lines

no need to include sys/device.h> here; include sys/types.h instead

/*
 * $Id: bus.h,v 1.7 2007/10/25 19:58:47 init Exp $
 */
#ifndef _SYS_BUS_H
#define _SYS_BUS_H

#include <sys/types.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 {
	void *bh_ownerdd;	/* devdata of device that owns this handler XXX kill that it is ugly */
	uint8_t 	(*bus_read_1)(void *ddp, uint32_t addr);
	uint16_t 	(*bus_read_2)(void *ddp, uint32_t addr);
	uint32_t 	(*bus_read_4)(void *ddp, uint32_t addr);
	int 		(*bus_write_1)(void *ddp, uint32_t addr, uint8_t data);
	int 		(*bus_write_2)(void *ddp, uint32_t addr, uint16_t data);
	int 		(*bus_write_4)(void *ddp, uint32_t addr, uint32_t data);
	/* XXX DMA related stuff */
};


uint8_t bus_read_1(struct bus_handle *bhp, uint32_t addr);
uint16_t bus_read_2(struct bus_handle *bhp, uint32_t addr);
uint32_t bus_read_4(struct bus_handle *bhp, uint32_t addr);
int bus_write_1(struct bus_handle *bhp, uint32_t addr, uint8_t data);
int bus_write_2(struct bus_handle *bhp, uint32_t addr, uint16_t data);
int bus_write_4(struct bus_handle *bhp, uint32_t addr, uint32_t data);

#endif /* _SYS_BUS_H */