diff options
author | Marvin Borner | 2021-07-12 18:14:44 +0200 |
---|---|---|
committer | Marvin Borner | 2021-07-12 18:15:29 +0200 |
commit | 1b429c0fc28e5cd8b474ad5a1de1fa6f3d7c2e2a (patch) | |
tree | 593af3e3ec78795bb47553f492db07fb7e87e373 /src/loader/inc/device.h | |
parent | d414d2f6f46bd425d727af5baae3e2658d6e1384 (diff) |
Renamed files to match presentation
Diffstat (limited to 'src/loader/inc/device.h')
-rw-r--r-- | src/loader/inc/device.h | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/loader/inc/device.h b/src/loader/inc/device.h new file mode 100644 index 0000000..5081cb7 --- /dev/null +++ b/src/loader/inc/device.h @@ -0,0 +1,41 @@ +// MIT License, Copyright (c) 2021 Marvin Borner + +#ifndef DEVICE_H +#define DEVICE_H + +#include <def.h> +#include <disk.h> + +enum device_type { + DEVICE_NONE, + DEVICE_DISK, + DEVICE_FB, +}; + +struct dev { + u8 id; + enum device_type type; + char name[16]; + + s32 (*read)(void *, u32, u32, struct dev *); + s32 (*write)(const void *, u32, u32, struct dev *); + + union { + struct { + struct fs fs; + } disk; + // TODO: Other (framebuffer?) + } p; // Prototype union + + u32 data; // Optional (device-specific) data/information +}; + +struct dev *device_get_by_id(u8 id); +struct dev *device_get_by_name(const char *name, u32 len); +void device_foreach(enum device_type type, u8 (*cb)(struct dev *)); // cb=1 => break +u8 device_register(enum device_type type, char *name, u32 data, + s32 (*read)(void *, u32, u32, struct dev *), + s32 (*write)(const void *, u32, u32, struct dev *)); +void device_print(void); + +#endif |