diff --git a/BaS_gcc/include/driver_vec.h b/BaS_gcc/include/driver_vec.h index be9f1df..5c031bb 100644 --- a/BaS_gcc/include/driver_vec.h +++ b/BaS_gcc/include/driver_vec.h @@ -38,10 +38,10 @@ enum driver_type struct generic_driver_interface { - uint32_t (*init)(); - uint32_t (*read)(); - uint32_t (*write)(); - uint32_t (*ioctl)(); + uint32_t (*init)(void); + uint32_t (*read)(void *buf, size_t count); + uint32_t (*write)(const void *buf, size_t count); + uint32_t (*ioctl)(uint32_t request, ...); }; struct xhdi_driver_interface @@ -49,20 +49,26 @@ struct xhdi_driver_interface uint32_t (*xhdivec)(); }; -union driver_interface +union interface { struct generic_driver_interface gdi; struct xhdi_driver_interface xhdi; }; -struct interface +struct generic_interface { enum driver_type type; char name[16]; char description[64]; int version; int revision; - union driver_interface interface; + union interface interface; +}; + +struct driver_table +{ + uint32_t (*remove_handler)(); /* calling this will disable the BaS' hook into trap #0 */ + struct generic_interface *interfaces[]; }; diff --git a/BaS_gcc/sources/driver_vec.c b/BaS_gcc/sources/driver_vec.c index 856b84a..62aadc7 100644 --- a/BaS_gcc/sources/driver_vec.c +++ b/BaS_gcc/sources/driver_vec.c @@ -28,7 +28,7 @@ #include "driver_vec.h" #include "xhdi_sd.h" -static struct interface interfaces[] = +static struct generic_interface interfaces[] = { { /* BaS SD-card driver interface */ @@ -36,13 +36,22 @@ static struct interface interfaces[] = .type = XHDI_DRIVER, .name = "SDCARD", .description = "BaS SD Card driver", - .version = 1, - .revision = 0, + .version = 0, + .revision = 1, .interface.xhdi = { xhdi_call } }, - /* extend list here if drivers need to be added */ + /* insert new drivers here */ { .type = END_OF_DRIVERS } }; +/* + * this is the driver table we expose to the OS + */ +static struct driver_table drivers = +{ + .remove_handler = NULL, + .interfaces = { interfaces } +}; +