Add fbdev for getting framebuffer information
This commit is contained in:
@ -7,6 +7,7 @@
|
|||||||
#include "termdev.h"
|
#include "termdev.h"
|
||||||
#include "ps2kbdev.h"
|
#include "ps2kbdev.h"
|
||||||
#include "serialdev.h"
|
#include "serialdev.h"
|
||||||
|
#include "fbdev.h"
|
||||||
|
|
||||||
DevTable DEVTABLE;
|
DevTable DEVTABLE;
|
||||||
|
|
||||||
@ -17,4 +18,5 @@ void dev_init(void) {
|
|||||||
termdev_init();
|
termdev_init();
|
||||||
ps2kbdev_init();
|
ps2kbdev_init();
|
||||||
serialdev_init();
|
serialdev_init();
|
||||||
|
fbdev_init();
|
||||||
}
|
}
|
||||||
|
29
kernel/dev/fbdev.c
Normal file
29
kernel/dev/fbdev.c
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
#include <stdint.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
#include "fbdev.h"
|
||||||
|
#include "dev.h"
|
||||||
|
#include "sysdefs/devctl.h"
|
||||||
|
#include "hshtb.h"
|
||||||
|
#include "spinlock/spinlock.h"
|
||||||
|
#include "util/util.h"
|
||||||
|
#include "hal/hal.h"
|
||||||
|
#include "bootinfo/bootinfo.h"
|
||||||
|
#include "errors.h"
|
||||||
|
|
||||||
|
int32_t fbdev_getinfo(uint8_t *buffer, size_t len, void *extra) {
|
||||||
|
FbDevGetInfo info = {
|
||||||
|
.w = BOOT_INFO.fb->width,
|
||||||
|
.h = BOOT_INFO.fb->height,
|
||||||
|
.margin = 20,
|
||||||
|
.fontw = 8,
|
||||||
|
.fonth = 16,
|
||||||
|
};
|
||||||
|
hal_memcpy(buffer, &info, sizeof(info));
|
||||||
|
return E_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
void fbdev_init(void) {
|
||||||
|
Dev *fbdev;
|
||||||
|
HSHTB_ALLOC(DEVTABLE.devs, ident, "fbdev", fbdev);
|
||||||
|
fbdev->fns[DEV_FBDEV_GETINFO] = &fbdev_getinfo;
|
||||||
|
}
|
7
kernel/dev/fbdev.h
Normal file
7
kernel/dev/fbdev.h
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
#ifndef DEV_FBDEV_H_
|
||||||
|
#define DEV_FBDEV_H_
|
||||||
|
|
||||||
|
int32_t fbdev_getinfo(uint8_t *buffer, size_t len, void *extra);
|
||||||
|
void fbdev_init(void);
|
||||||
|
|
||||||
|
#endif // DEV_FBDEV_H_
|
@ -12,10 +12,18 @@
|
|||||||
#define DEV_SERIALDEV_RECVB 2
|
#define DEV_SERIALDEV_RECVB 2
|
||||||
#define DEV_SERIALDEV_RECVREADY 3
|
#define DEV_SERIALDEV_RECVREADY 3
|
||||||
|
|
||||||
|
#define DEV_FBDEV_GETINFO 0
|
||||||
|
|
||||||
#if !defined(__ASSEMBLER__)
|
#if !defined(__ASSEMBLER__)
|
||||||
|
|
||||||
typedef uint64_t Dev_t;
|
typedef uint64_t Dev_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
uint16_t w, h;
|
||||||
|
uint16_t margin;
|
||||||
|
uint8_t fontw, fonth;
|
||||||
|
} FbDevGetInfo;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // SHARE_SYSDEFS_DEVCTL_H_
|
#endif // SHARE_SYSDEFS_DEVCTL_H_
|
||||||
|
Reference in New Issue
Block a user