kernel/inc/drivers/driver.h

63 lines
1.8 KiB
C

// This file is part of noxos and licensed under the MIT open source license
#ifndef NOXOS_DRIVER_H
#define NOXOS_DRIVER_H
#include <utils/stdtypes.h>
#include <drivers/builtin/elf/elf.h>
typedef enum {
DRIVER_TRANSPORT_PCI,
DRIVER_TRANSPORT_USB,
DRIVER_TRANSPORT_FS
} __attribute__((packed)) driver_transport_protocol_E;
typedef struct {
driver_transport_protocol_E transport_protocol:8;
uint16_t length;
uint8_t specific_config[];
} __attribute__((packed)) driver_config_header_T;
typedef struct {
uint16_t vendor_id;
uint16_t device_id;
} __attribute__((packed)) driver_config_device_id_T;
typedef struct {
bool enable_progif;
uint8_t class;
uint8_t subclass;
uint8_t progif;
uint16_t num_device_ids;
driver_config_device_id_T device_ids;
} __attribute__((packed)) driver_config_pci_T;
typedef struct {
uint8_t min_version;
uint16_t num_device_ids;
driver_config_device_id_T device_ids;
} __attribute__((packed)) driver_config_usb_T;
typedef struct {
uint8_t gpt_guid[16];
uint8_t mbr_type;
} __attribute__((packed)) driver_config_fs_T;
typedef struct {
} driver_T;
typedef struct {
} driver_manager_T;
void driver_manager_init ();
driver_T* driver_register (driver_config_header_T* config, elf_executable_T* executable);
driver_T* driver_lookup_pci_device (uint16_t vendor_id, uint16_t device_id);
driver_T* driver_lookup_usb_device (uint16_t vendor_id, uint16_t device_id);
driver_T* driver_lookup_fs_gpt (uint8_t guid[16]);
driver_T* driver_lookup_fs_mbr (uint8_t type);
#endif //NOXOS_DRIVER_H