From bbf700a0c6b2f8ca9a73c2a334973286d5b8afcc Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Fri, 12 Mar 2021 19:11:26 +0100 Subject: Started basic ioctl fb interface --- kernel/drivers/fb.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 kernel/drivers/fb.c (limited to 'kernel/drivers') 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 +#include +#include +#include +#include +#include +#include + +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; +} -- cgit v1.2.3