From 3c5ccb40ec83e8de7f06f20adbc3f00765298332 Mon Sep 17 00:00:00 2001 From: Marcel Telka Date: Fri, 5 Sep 2003 14:42:22 +0000 Subject: [PATCH] 2003-09-05 Marcel Telka * brux/bus.h (bus_t, bus_driver_t): Separated bus_driver_t from bus_t. git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@557 b68d4a1b-bc3d-0410-92ed-d4ac073336b7 --- include/ChangeLog | 4 ++++ include/NEWS | 1 + include/brux/bus.h | 33 ++++++++++++++++++++------------- 3 files changed, 25 insertions(+), 13 deletions(-) diff --git a/include/ChangeLog b/include/ChangeLog index 85fb54d7..a833593a 100644 --- a/include/ChangeLog +++ b/include/ChangeLog @@ -1,3 +1,7 @@ +2003-09-05 Marcel Telka + + * brux/bus.h (bus_t, bus_driver_t): Separated bus_driver_t from bus_t. + 2003-08-28 Marcel Telka * brux/bus.h (bus_area_t): New structure. diff --git a/include/NEWS b/include/NEWS index 2ad08fb7..d96b6be4 100644 --- a/include/NEWS +++ b/include/NEWS @@ -3,6 +3,7 @@ $Id$ * Changes in brux common headers: - Added FLASH_ERROR_* macros - Modified bus_t structure + - Added bus_area_t and bus_driver_t structures include-0.3.1 (2003-08-20): diff --git a/include/brux/bus.h b/include/brux/bus.h index 6a9fed07..68224181 100644 --- a/include/brux/bus.h +++ b/include/brux/bus.h @@ -46,9 +46,12 @@ typedef struct { typedef struct bus bus_t; -struct bus { - void *params; - void (*printinfo)( void ); +typedef struct bus_driver { + const char *name; + const char *description; + bus_t *(*new_bus)( void ); + void (*free_bus)( bus_t *bus ); + void (*printinfo)( bus_t *bus ); void (*prepare)( bus_t *bus ); int (*area)( bus_t *bus, uint32_t adr, bus_area_t *area ); void (*read_start)( bus_t *bus, uint32_t adr ); @@ -56,19 +59,23 @@ struct bus { uint32_t (*read_end)( bus_t *bus ); uint32_t (*read)( bus_t *bus, uint32_t adr ); void (*write)( bus_t *bus, uint32_t adr, uint32_t data ); - void (*free)( bus_t *bus ); +} bus_driver_t; + +struct bus { + void *params; + const bus_driver_t *driver; }; extern bus_t *bus; -#define bus_printinfo(bus) bus->printinfo() -#define bus_prepare(bus) bus->prepare(bus) -#define bus_area(bus,adr,a) bus->area(bus,adr,a) -#define bus_read_start(bus,adr) bus->read_start(bus,adr) -#define bus_read_next(bus,adr) bus->read_next(bus,adr) -#define bus_read_end(bus) bus->read_end(bus) -#define bus_read(bus,adr) bus->read(bus,adr) -#define bus_write(bus,adr,data) bus->write(bus,adr,data) -#define bus_free(bus) bus->free(bus) +#define bus_printinfo(bus) bus->driver->printinfo(bus) +#define bus_prepare(bus) bus->driver->prepare(bus) +#define bus_area(bus,adr,a) bus->driver->area(bus,adr,a) +#define bus_read_start(bus,adr) bus->driver->read_start(bus,adr) +#define bus_read_next(bus,adr) bus->driver->read_next(bus,adr) +#define bus_read_end(bus) bus->driver->read_end(bus) +#define bus_read(bus,adr) bus->driver->read(bus,adr) +#define bus_write(bus,adr,data) bus->driver->write(bus,adr,data) +#define bus_free(bus) bus->driver->free_bus(bus) #endif /* BRUX_BUS_H */