diff options
author | Marvin Borner | 2021-03-12 19:11:26 +0100 |
---|---|---|
committer | Marvin Borner | 2021-03-12 19:11:26 +0100 |
commit | bbf700a0c6b2f8ca9a73c2a334973286d5b8afcc (patch) | |
tree | c6d95e742da7b0ca0c95e5377840e888a579030f /kernel/drivers | |
parent | 0aef683b9d1e08555791426ba12223ed78051353 (diff) |
Started basic ioctl fb interface
Diffstat (limited to 'kernel/drivers')
-rw-r--r-- | kernel/drivers/fb.c | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/kernel/drivers/fb.c b/kernel/drivers/fb.c new file mode 100644 index 0000000..a1a7729 --- /dev/null +++ b/kernel/drivers/fb.c @@ -0,0 +1,45 @@ +// MIT License, Copyright (c) 2021 Marvin Borner + +#include <def.h> +#include <fb.h> +#include <fs.h> +#include <ioctl.h> +#include <mem.h> +#include <str.h> +#include <sys.h> + +static u32 dev_id = 0; +static struct vid_info *info = NULL; + +static s32 fb_ioctl(u32 request, void *arg1, void *arg2, void *arg3, struct device *dev) +{ + UNUSED(arg2); + UNUSED(arg3); + UNUSED(dev); + + switch (request) { + case IO_FB_GET: + memcpy(arg1, info->vbe, 256); + return 0; + default: + return -1; + } +} + +static u8 fb_ready(void) +{ + return 1; +} + +void fb_install(struct vid_info *boot) +{ + info = boot; + + struct device *dev = zalloc(sizeof(*dev)); + dev->name = strdup("fb"); + dev->type = DEV_CHAR; + dev->ioctl = fb_ioctl; + dev->ready = fb_ready; + device_add(dev); + dev_id = dev->id; +} |