kernel/inc/drivers/device_manager.h

80 lines
1.8 KiB
C
Raw Normal View History

2023-05-29 13:42:56 +00:00
#ifndef NOXOS_DEVICE_H
#define NOXOS_DEVICE_H
#include <utils/stdtypes.h>
#include <drivers/driver_manager.h>
typedef enum {
DEVICE_PCI = 1,
DEVICE_USB = 2,
DEVICE_VIRTUAL = 255
} device_category_E;
typedef enum {
DEVICE_CAPABILITY_TRANSMISSION,
DEVICE_CAPABILITY_STORAGE,
DEVICE_CAPABILITY_GRAPHICS,
DEVICE_CAPABILITY_AUDIO
} device_top_level_capability_E;
typedef struct device_capabilities_t {
device_top_level_capability_E *top_level;
struct device_transmission_capability_t {
// TODO
} transmission;
struct device_storage_capability_t {
char uuid[32];
uint64_t size;
} storage;
struct device_graphics_capability_t {
uint32_t fb_width;
uint32_t fb_height;
uint16_t bits_per_pixel;
} graphics;
struct device_audio_capability_t {
// TODO
} audio;
} device_capabilities_T;
typedef struct device_t {
uint32_t id;
device_category_E category;
void *specific;
driver_T *driver;
} device_T;
typedef struct device_manager_t {
uint32_t num_devices;
device_T *devices;
} device_manager_T;
extern device_manager_T g_device_manager;
void device_manager_init ();
void device_remove (device_T *device);
device_T * device_find (device_capabilities_T capabilities, uint32_t index, uint32_t *out_count);
#endif