feature (drivers): started work on a generic driver interface / driver manager
This commit is contained in:
parent
6ddd4587cf
commit
cd5737dba7
|
@ -0,0 +1,62 @@
|
|||
// 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
|
|
@ -20,6 +20,7 @@
|
|||
#include "drivers/builtin/pci.h"
|
||||
#include "drivers/builtin/ps2/controller.h"
|
||||
#include "drivers/builtin/tty.h"
|
||||
#include "drivers/driver.h"
|
||||
#include "proc/scheduler.h"
|
||||
#include "modules/loader.h"
|
||||
|
||||
|
@ -51,6 +52,8 @@ void kernel_init(boot_info_T* boot_info) {
|
|||
|
||||
scheduler_init(boot_info);
|
||||
|
||||
driver_manager_init();
|
||||
|
||||
acpi_init(boot_info);
|
||||
|
||||
module_manager_init();
|
||||
|
|
|
@ -0,0 +1,50 @@
|
|||
// This file is part of noxos and licensed under the MIT open source license
|
||||
|
||||
#include <drivers/driver.h>
|
||||
#include <utils/logger.h>
|
||||
|
||||
driver_manager_T g_driver_manager;
|
||||
|
||||
void driver_manager_init() {
|
||||
|
||||
}
|
||||
|
||||
driver_T* driver_find_pci_device(uint16_t vendor_id, uint16_t device_id) {
|
||||
log(LOG_WARNING, "driver manager -> driver lookup on disk is not implemented yet");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
driver_T* driver_find_usb_device(uint16_t vendor_id, uint16_t device_id) {
|
||||
log(LOG_WARNING, "driver manager -> driver lookup on disk is not implemented yet");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
driver_T* driver_find_fs_gpt(uint8_t guid[16]) {
|
||||
log(LOG_WARNING, "driver manager -> driver lookup on disk is not implemented yet");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
driver_T* driver_find_fs_mbr(uint8_t type) {
|
||||
log(LOG_WARNING, "driver manager -> driver lookup on disk is not implemented yet");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
driver_T* driver_register(driver_config_header_T* config, elf_executable_T* executable) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
driver_T* driver_lookup_pci_device(uint16_t vendor_id, uint16_t device_id) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
driver_T* driver_lookup_usb_device(uint16_t vendor_id, uint16_t device_id) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
driver_T* driver_lookup_fs_gpt(uint8_t guid[16]) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
driver_T* driver_lookup_fs_mbr(uint8_t type) {
|
||||
return NULL;
|
||||
}
|
Loading…
Reference in New Issue