proposed driver interface compiles

This commit is contained in:
Markus Fröschle
2013-10-24 15:17:42 +00:00
parent c2d2947d22
commit cd02365300
2 changed files with 26 additions and 11 deletions

View File

@@ -38,10 +38,10 @@ enum driver_type
struct generic_driver_interface struct generic_driver_interface
{ {
uint32_t (*init)(); uint32_t (*init)(void);
uint32_t (*read)(); uint32_t (*read)(void *buf, size_t count);
uint32_t (*write)(); uint32_t (*write)(const void *buf, size_t count);
uint32_t (*ioctl)(); uint32_t (*ioctl)(uint32_t request, ...);
}; };
struct xhdi_driver_interface struct xhdi_driver_interface
@@ -49,20 +49,26 @@ struct xhdi_driver_interface
uint32_t (*xhdivec)(); uint32_t (*xhdivec)();
}; };
union driver_interface union interface
{ {
struct generic_driver_interface gdi; struct generic_driver_interface gdi;
struct xhdi_driver_interface xhdi; struct xhdi_driver_interface xhdi;
}; };
struct interface struct generic_interface
{ {
enum driver_type type; enum driver_type type;
char name[16]; char name[16];
char description[64]; char description[64];
int version; int version;
int revision; 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[];
}; };

View File

@@ -28,7 +28,7 @@
#include "driver_vec.h" #include "driver_vec.h"
#include "xhdi_sd.h" #include "xhdi_sd.h"
static struct interface interfaces[] = static struct generic_interface interfaces[] =
{ {
{ {
/* BaS SD-card driver interface */ /* BaS SD-card driver interface */
@@ -36,13 +36,22 @@ static struct interface interfaces[] =
.type = XHDI_DRIVER, .type = XHDI_DRIVER,
.name = "SDCARD", .name = "SDCARD",
.description = "BaS SD Card driver", .description = "BaS SD Card driver",
.version = 1, .version = 0,
.revision = 0, .revision = 1,
.interface.xhdi = { xhdi_call } .interface.xhdi = { xhdi_call }
}, },
/* extend list here if drivers need to be added */ /* insert new drivers here */
{ {
.type = END_OF_DRIVERS .type = END_OF_DRIVERS
} }
}; };
/*
* this is the driver table we expose to the OS
*/
static struct driver_table drivers =
{
.remove_handler = NULL,
.interfaces = { interfaces }
};