File: [local] / funnyos / sys / bus.h (download)
Revision 1.3, Tue Oct 16 18:31:07 2007 UTC (16 years, 6 months ago) by init
Branch: MAIN
Changes since 1.2: +7 -7 lines
make read/write functions in bus_handle take struct xxx_dd * instead of struct device *
|
/*
* $Id: bus.h,v 1.3 2007/10/16 18:31:07 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)(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 */
};
#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 */