X-Git-Url: https://scm.lunaixsky.com/lunaix-os.git/blobdiff_plain/6123a1b5c5c97d90224ffa0dc6706dd7af2ebb9e..6942ebae59c3904674dce6b67cd07c43a3bbe00d:/lunaix-os/hal/char/uart/16x50_dev.c diff --git a/lunaix-os/hal/char/uart/16x50_dev.c b/lunaix-os/hal/char/uart/16x50_dev.c new file mode 100644 index 0000000..326fede --- /dev/null +++ b/lunaix-os/hal/char/uart/16x50_dev.c @@ -0,0 +1,44 @@ +#include + +#include + +#include "16x50.h" + +extern_hook_load(isa16x50_create_once); +extern_hook_create(pci16650_pci_create); +extern_hook_register(pci16x50_pci_register); + +static int +uart_16x50_load(struct device_def* def) +{ + isa16x50_create_once(def); + return 0; +} + +static int +uart_16x50_create(struct device_def* def, morph_t* morphed) +{ + if (morph_type_of(morphed, pci_probe_morpher)) { + pci16650_pci_create(def, morphed); + } + + return 0; +} + +static int +uart_16x50_register(struct device_def* def) +{ + pci16x50_pci_register(def); + + return 0; +} + +static struct device_def uart_dev = { + def_device_class(GENERIC, CHAR, UART16550), + def_device_name("16550 UART"), + + def_on_register(uart_16x50_register), + def_on_load(uart_16x50_load), + def_on_create(uart_16x50_create) +}; +EXPORT_DEVICE(uart16550_pmio, &uart_dev, load_onboot); \ No newline at end of file