diff options
Diffstat (limited to 'emu/device.h')
-rw-r--r-- | emu/device.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/emu/device.h b/emu/device.h new file mode 100644 index 0000000..ce2abad --- /dev/null +++ b/emu/device.h @@ -0,0 +1,24 @@ +#ifndef DEVICE_H +#define DEVICE_H + +#include <stdint.h> + +struct device_t; + +typedef struct device_vtable_t { + uint8_t (*read)( void *obj, uint16_t addr ); + void (*write)( void *obj, uint16_t addr, uint8_t data ); + void (*deinit)( void *obj ); +} device_vtable_t; + +typedef struct device_t { + device_vtable_t const *vtable; + char *name; +} device_t; + +void device_init( device_t *device, const char *name ); +uint8_t device_read( void *obj, uint16_t addr ); +void device_write( void *obj, uint16_t addr, uint8_t data ); +void device_deinit( void *obj ); + +#endif |