diff options
Diffstat (limited to 'src/loader/inc/dev.h')
-rw-r--r-- | src/loader/inc/dev.h | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/loader/inc/dev.h b/src/loader/inc/dev.h new file mode 100644 index 0000000..930b35c --- /dev/null +++ b/src/loader/inc/dev.h @@ -0,0 +1,30 @@ +// MIT License, Copyright (c) 2021 Marvin Borner + +#ifndef DEV_H +#define DEV_H + +#include <def.h> + +enum dev_type { + DEV_DISK, + DEV_FB, +}; + +struct dev { + u8 id; + enum dev_type type; + char name[16]; + + s32 (*read)(void *, u32, u32, struct dev *); + s32 (*write)(const void *, u32, u32, struct dev *); + + u32 data; // Optional (device-specific) data/information + u8 exists : 1; +}; + +u32 dev_register(enum dev_type type, char *name, u32 data, + s32 (*read)(void *, u32, u32, struct dev *), + s32 (*write)(const void *, u32, u32, struct dev *)); +void dev_print(void); + +#endif |