Split framebuffer functions into library
This commit is contained in:
parent
576a32d92f
commit
6c36d3dd40
1
.gitignore
vendored
1
.gitignore
vendored
@ -6,3 +6,4 @@ external/
|
|||||||
*.o
|
*.o
|
||||||
|
|
||||||
src/kernel/kernel
|
src/kernel/kernel
|
||||||
|
src/libmittos/libmittos.a
|
18
Makefile
18
Makefile
@ -4,12 +4,13 @@ endif
|
|||||||
|
|
||||||
TARGET := x86_64-elf
|
TARGET := x86_64-elf
|
||||||
KERNELMAKE := TARGET=${TARGET} $(MAKE) -C src/kernel
|
KERNELMAKE := TARGET=${TARGET} $(MAKE) -C src/kernel
|
||||||
|
LIBMAKE := TARGET=${TARGET} $(MAKE) -C src/libmittos
|
||||||
|
|
||||||
DIST := $(BUILDROOT)/mittos.iso
|
DIST := $(BUILDROOT)/mittos.iso
|
||||||
SYSROOT := $(BUILDROOT)/sysroot
|
SYSROOT := $(BUILDROOT)/sysroot
|
||||||
SYS_ITEMS := $(SYSROOT)/kernel $(SYSROOT)/usr/lib/libc.a
|
SYS_ITEMS := $(SYSROOT)/kernel $(SYSROOT)/usr/lib/libc.a $(SYSROOT)/usr/lib/libmittos.a
|
||||||
|
|
||||||
all: $(SYSROOT)/kernel
|
all: $(SYSROOT)/kernel $(SYS_ITEMS)
|
||||||
|
|
||||||
dist: $(DIST)
|
dist: $(DIST)
|
||||||
|
|
||||||
@ -17,19 +18,28 @@ $(DIST): $(SYS_ITEMS)
|
|||||||
$(BUILDROOT)/toolchain/setup-grub.sh
|
$(BUILDROOT)/toolchain/setup-grub.sh
|
||||||
grub-mkrescue -o $@ $(SYSROOT)
|
grub-mkrescue -o $@ $(SYSROOT)
|
||||||
|
|
||||||
$(SYSROOT)/kernel: $(SYSROOT)/usr/lib/libc.a FORCE
|
kernel: $(SYSROOT)/kernel
|
||||||
ifeq ($(shell make -sqC src/kernel || echo 1), 1)
|
$(SYSROOT)/kernel: $(SYSROOT)/usr/lib/libc.a $(SYSROOT)/usr/lib/libmittos.a FORCE
|
||||||
|
ifeq ($(shell make -sqC src/kernel install || echo 1), 1)
|
||||||
$(KERNELMAKE) install
|
$(KERNELMAKE) install
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
musllib: $(SYSROOT)/usr/lib/libc.a
|
||||||
$(SYSROOT)/usr/lib/libc.a:
|
$(SYSROOT)/usr/lib/libc.a:
|
||||||
toolchain/build-musl.sh
|
toolchain/build-musl.sh
|
||||||
|
|
||||||
|
libmittos: $(SYSROOT)/usr/lib/libmittos.a
|
||||||
|
$(SYSROOT)/usr/lib/libmittos.a: FORCE
|
||||||
|
ifeq ($(shell make -sqC src/libmittos install || echo 1), 1)
|
||||||
|
$(LIBMAKE) install
|
||||||
|
endif
|
||||||
|
|
||||||
.PHONY: all dist sysroot FORCE
|
.PHONY: all dist sysroot FORCE
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf $(DIST)
|
rm -rf $(DIST)
|
||||||
$(KERNELMAKE) clean
|
$(KERNELMAKE) clean
|
||||||
|
$(LIBMAKE) clean
|
||||||
|
|
||||||
distclean:
|
distclean:
|
||||||
$(MAKE) clean
|
$(MAKE) clean
|
||||||
|
@ -10,9 +10,9 @@ OBJ := $(patsubst %, %.o, $(basename $(basename $(SRC))))
|
|||||||
CFLAGS := -Wall -Wextra -pedantic -ffreestanding -mcmodel=large -std=c2x
|
CFLAGS := -Wall -Wextra -pedantic -ffreestanding -mcmodel=large -std=c2x
|
||||||
CFLAGS += -ggdb -O0
|
CFLAGS += -ggdb -O0
|
||||||
ASFLAGS += -ggdb
|
ASFLAGS += -ggdb
|
||||||
CPPFLAGS += -I include
|
CPPFLAGS += -nostdinc -I include -I /opt/sysroot/usr/include
|
||||||
LDFLAGS := -n -T Link.ld
|
LDFLAGS := -n -T Link.ld
|
||||||
LDLIBS := -nostdlib -lgcc -L/opt/sysroot/usr/lib -lc
|
LDLIBS := -nostdlib -lgcc -L/opt/sysroot/usr/lib -lc -lmittos
|
||||||
|
|
||||||
kernel: $(OBJ)
|
kernel: $(OBJ)
|
||||||
$(LINK.c) $^ $(LOADLIBES) $(LDLIBS) -o $@
|
$(LINK.c) $^ $(LOADLIBES) $(LDLIBS) -o $@
|
||||||
@ -29,7 +29,7 @@ $(OBJ): CPPFLAGS += $(DEPFLAGS)
|
|||||||
DESTDIR ?= $(BUILDROOT)/sysroot
|
DESTDIR ?= $(BUILDROOT)/sysroot
|
||||||
|
|
||||||
$(DESTDIR)$(PREFIX)/kernel: kernel
|
$(DESTDIR)$(PREFIX)/kernel: kernel
|
||||||
install -D kernel $(DESTDIR)$(PREFIX)/kernel
|
install -D $< $@
|
||||||
|
|
||||||
install: $(DESTDIR)$(PREFIX)/kernel
|
install: $(DESTDIR)$(PREFIX)/kernel
|
||||||
|
|
||||||
|
@ -1,17 +1,14 @@
|
|||||||
#include <framebuffer.h>
|
|
||||||
#include <proc.h>
|
#include <proc.h>
|
||||||
#include <sched.h>
|
#include <sched.h>
|
||||||
|
#include <mittos/graphics.h>
|
||||||
|
|
||||||
extern gfx_context *term_fb;
|
extern gfx_context *term_fb;
|
||||||
void drawCharacter(gfx_context *ctx, uint64_t x, uint64_t y, uint32_t clr_fg, uint32_t clr_bg, char c);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void thread1()
|
void thread1()
|
||||||
{
|
{
|
||||||
int a = 0;
|
int a = 0;
|
||||||
while(1) {
|
while(1) {
|
||||||
drawCharacter(term_fb, 0, 0, RGB(255,0,0), RGB(0,0,0), '0'+(a++%10));
|
putCharacter(term_fb, 0, 0, RGB(255,255,0), RGB(0,0,0), '0'+(a++%10));
|
||||||
flip(term_fb);
|
flip(term_fb);
|
||||||
sched_yield();
|
sched_yield();
|
||||||
}
|
}
|
||||||
@ -21,7 +18,7 @@ void thread2()
|
|||||||
{
|
{
|
||||||
int a = 0;
|
int a = 0;
|
||||||
while(1) {
|
while(1) {
|
||||||
drawCharacter(term_fb, 10, 10, RGB(0,0,255), RGB(0,0,0), 'A'+(a++%10));
|
putCharacter(term_fb, 10, 10, RGB(0,255,255), RGB(0,0,0), 'A'+(a++%10));
|
||||||
flip(term_fb);
|
flip(term_fb);
|
||||||
sched_yield();
|
sched_yield();
|
||||||
}
|
}
|
||||||
|
@ -1,130 +1,12 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <terminal.h>
|
#include <terminal.h>
|
||||||
#include <framebuffer.h>
|
#include <mittos/graphics.h>
|
||||||
#include <memory.h>
|
#include <memory.h>
|
||||||
|
|
||||||
// Font from https://github.com/atextor/unifont
|
gfx_context kernel_fb;
|
||||||
char font[95][16] = {
|
|
||||||
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
|
||||||
{0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x08, 0x08, 0x00, 0x00},
|
|
||||||
{0x00, 0x00, 0x22, 0x22, 0x22, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
|
||||||
{0x00, 0x00, 0x00, 0x00, 0x12, 0x12, 0x12, 0x7E, 0x24, 0x24, 0x7E, 0x48, 0x48, 0x48, 0x00, 0x00},
|
|
||||||
{0x00, 0x00, 0x00, 0x00, 0x08, 0x3E, 0x49, 0x48, 0x38, 0x0E, 0x09, 0x49, 0x3E, 0x08, 0x00, 0x00},
|
|
||||||
{0x00, 0x00, 0x00, 0x00, 0x31, 0x4A, 0x4A, 0x34, 0x08, 0x08, 0x16, 0x29, 0x29, 0x46, 0x00, 0x00},
|
|
||||||
{0x00, 0x00, 0x00, 0x00, 0x1C, 0x22, 0x22, 0x22, 0x1C, 0x39, 0x45, 0x42, 0x46, 0x39, 0x00, 0x00},
|
|
||||||
{0x00, 0x00, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
|
||||||
{0x00, 0x00, 0x00, 0x04, 0x08, 0x08, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x08, 0x08, 0x04, 0x00},
|
|
||||||
{0x00, 0x00, 0x00, 0x20, 0x10, 0x10, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x10, 0x10, 0x20, 0x00},
|
|
||||||
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x49, 0x2A, 0x1C, 0x2A, 0x49, 0x08, 0x00, 0x00, 0x00},
|
|
||||||
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x08, 0x7F, 0x08, 0x08, 0x08, 0x00, 0x00, 0x00},
|
|
||||||
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x08, 0x08, 0x10},
|
|
||||||
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
|
||||||
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00},
|
|
||||||
{0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x04, 0x08, 0x08, 0x10, 0x10, 0x20, 0x40, 0x40, 0x00, 0x00},
|
|
||||||
{0x00, 0x00, 0x00, 0x00, 0x18, 0x24, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x24, 0x18, 0x00, 0x00},
|
|
||||||
{0x00, 0x00, 0x00, 0x00, 0x08, 0x18, 0x28, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x3E, 0x00, 0x00},
|
|
||||||
{0x00, 0x00, 0x00, 0x00, 0x3C, 0x42, 0x42, 0x02, 0x0C, 0x10, 0x20, 0x40, 0x40, 0x7E, 0x00, 0x00},
|
|
||||||
{0x00, 0x00, 0x00, 0x00, 0x3C, 0x42, 0x42, 0x02, 0x1C, 0x02, 0x02, 0x42, 0x42, 0x3C, 0x00, 0x00},
|
|
||||||
{0x00, 0x00, 0x00, 0x00, 0x04, 0x0C, 0x14, 0x24, 0x44, 0x44, 0x7E, 0x04, 0x04, 0x04, 0x00, 0x00},
|
|
||||||
{0x00, 0x00, 0x00, 0x00, 0x7E, 0x40, 0x40, 0x40, 0x7C, 0x02, 0x02, 0x02, 0x42, 0x3C, 0x00, 0x00},
|
|
||||||
{0x00, 0x00, 0x00, 0x00, 0x1C, 0x20, 0x40, 0x40, 0x7C, 0x42, 0x42, 0x42, 0x42, 0x3C, 0x00, 0x00},
|
|
||||||
{0x00, 0x00, 0x00, 0x00, 0x7E, 0x02, 0x02, 0x04, 0x04, 0x04, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00},
|
|
||||||
{0x00, 0x00, 0x00, 0x00, 0x3C, 0x42, 0x42, 0x42, 0x3C, 0x42, 0x42, 0x42, 0x42, 0x3C, 0x00, 0x00},
|
|
||||||
{0x00, 0x00, 0x00, 0x00, 0x3C, 0x42, 0x42, 0x42, 0x3E, 0x02, 0x02, 0x02, 0x04, 0x38, 0x00, 0x00},
|
|
||||||
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00},
|
|
||||||
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x18, 0x08, 0x08, 0x10, 0x00},
|
|
||||||
{0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x04, 0x08, 0x10, 0x20, 0x10, 0x08, 0x04, 0x02, 0x00, 0x00},
|
|
||||||
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7E, 0x00, 0x00, 0x00, 0x7E, 0x00, 0x00, 0x00, 0x00},
|
|
||||||
{0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x20, 0x10, 0x08, 0x04, 0x08, 0x10, 0x20, 0x40, 0x00, 0x00},
|
|
||||||
{0x00, 0x00, 0x00, 0x00, 0x3C, 0x42, 0x42, 0x02, 0x04, 0x08, 0x08, 0x00, 0x08, 0x08, 0x00, 0x00},
|
|
||||||
{0x00, 0x00, 0x00, 0x00, 0x1C, 0x22, 0x4A, 0x56, 0x52, 0x52, 0x52, 0x4E, 0x20, 0x1E, 0x00, 0x00},
|
|
||||||
{0x00, 0x00, 0x00, 0x00, 0x18, 0x24, 0x24, 0x42, 0x42, 0x7E, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00},
|
|
||||||
{0x00, 0x00, 0x00, 0x00, 0x7C, 0x42, 0x42, 0x42, 0x7C, 0x42, 0x42, 0x42, 0x42, 0x7C, 0x00, 0x00},
|
|
||||||
{0x00, 0x00, 0x00, 0x00, 0x3C, 0x42, 0x42, 0x40, 0x40, 0x40, 0x40, 0x42, 0x42, 0x3C, 0x00, 0x00},
|
|
||||||
{0x00, 0x00, 0x00, 0x00, 0x78, 0x44, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x44, 0x78, 0x00, 0x00},
|
|
||||||
{0x00, 0x00, 0x00, 0x00, 0x7E, 0x40, 0x40, 0x40, 0x7C, 0x40, 0x40, 0x40, 0x40, 0x7E, 0x00, 0x00},
|
|
||||||
{0x00, 0x00, 0x00, 0x00, 0x7E, 0x40, 0x40, 0x40, 0x7C, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00},
|
|
||||||
{0x00, 0x00, 0x00, 0x00, 0x3C, 0x42, 0x42, 0x40, 0x40, 0x4E, 0x42, 0x42, 0x46, 0x3A, 0x00, 0x00},
|
|
||||||
{0x00, 0x00, 0x00, 0x00, 0x42, 0x42, 0x42, 0x42, 0x7E, 0x42, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00},
|
|
||||||
{0x00, 0x00, 0x00, 0x00, 0x3E, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x3E, 0x00, 0x00},
|
|
||||||
{0x00, 0x00, 0x00, 0x00, 0x1F, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x44, 0x44, 0x38, 0x00, 0x00},
|
|
||||||
{0x00, 0x00, 0x00, 0x00, 0x42, 0x44, 0x48, 0x50, 0x60, 0x60, 0x50, 0x48, 0x44, 0x42, 0x00, 0x00},
|
|
||||||
{0x00, 0x00, 0x00, 0x00, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x7E, 0x00, 0x00},
|
|
||||||
{0x00, 0x00, 0x00, 0x00, 0x42, 0x42, 0x66, 0x66, 0x5A, 0x5A, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00},
|
|
||||||
{0x00, 0x00, 0x00, 0x00, 0x42, 0x62, 0x62, 0x52, 0x52, 0x4A, 0x4A, 0x46, 0x46, 0x42, 0x00, 0x00},
|
|
||||||
{0x00, 0x00, 0x00, 0x00, 0x3C, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3C, 0x00, 0x00},
|
|
||||||
{0x00, 0x00, 0x00, 0x00, 0x7C, 0x42, 0x42, 0x42, 0x7C, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00},
|
|
||||||
{0x00, 0x00, 0x00, 0x00, 0x3C, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x5A, 0x66, 0x3C, 0x03, 0x00},
|
|
||||||
{0x00, 0x00, 0x00, 0x00, 0x7C, 0x42, 0x42, 0x42, 0x7C, 0x48, 0x44, 0x44, 0x42, 0x42, 0x00, 0x00},
|
|
||||||
{0x00, 0x00, 0x00, 0x00, 0x3C, 0x42, 0x42, 0x40, 0x30, 0x0C, 0x02, 0x42, 0x42, 0x3C, 0x00, 0x00},
|
|
||||||
{0x00, 0x00, 0x00, 0x00, 0x7F, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00},
|
|
||||||
{0x00, 0x00, 0x00, 0x00, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3C, 0x00, 0x00},
|
|
||||||
{0x00, 0x00, 0x00, 0x00, 0x41, 0x41, 0x41, 0x22, 0x22, 0x22, 0x14, 0x14, 0x08, 0x08, 0x00, 0x00},
|
|
||||||
{0x00, 0x00, 0x00, 0x00, 0x42, 0x42, 0x42, 0x42, 0x5A, 0x5A, 0x66, 0x66, 0x42, 0x42, 0x00, 0x00},
|
|
||||||
{0x00, 0x00, 0x00, 0x00, 0x42, 0x42, 0x24, 0x24, 0x18, 0x18, 0x24, 0x24, 0x42, 0x42, 0x00, 0x00},
|
|
||||||
{0x00, 0x00, 0x00, 0x00, 0x41, 0x41, 0x22, 0x22, 0x14, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00},
|
|
||||||
{0x00, 0x00, 0x00, 0x00, 0x7E, 0x02, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x40, 0x7E, 0x00, 0x00},
|
|
||||||
{0x00, 0x00, 0x00, 0x0E, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x0E, 0x00},
|
|
||||||
{0x00, 0x00, 0x00, 0x00, 0x40, 0x40, 0x20, 0x10, 0x10, 0x08, 0x08, 0x04, 0x02, 0x02, 0x00, 0x00},
|
|
||||||
{0x00, 0x00, 0x00, 0x70, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x70, 0x00},
|
|
||||||
{0x00, 0x00, 0x18, 0x24, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
|
||||||
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x00},
|
|
||||||
{0x00, 0x20, 0x10, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
|
||||||
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x42, 0x02, 0x3E, 0x42, 0x42, 0x46, 0x3A, 0x00, 0x00},
|
|
||||||
{0x00, 0x00, 0x00, 0x40, 0x40, 0x40, 0x5C, 0x62, 0x42, 0x42, 0x42, 0x42, 0x62, 0x5C, 0x00, 0x00},
|
|
||||||
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x42, 0x40, 0x40, 0x40, 0x40, 0x42, 0x3C, 0x00, 0x00},
|
|
||||||
{0x00, 0x00, 0x00, 0x02, 0x02, 0x02, 0x3A, 0x46, 0x42, 0x42, 0x42, 0x42, 0x46, 0x3A, 0x00, 0x00},
|
|
||||||
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x42, 0x42, 0x7E, 0x40, 0x40, 0x42, 0x3C, 0x00, 0x00},
|
|
||||||
{0x00, 0x00, 0x00, 0x0C, 0x10, 0x10, 0x10, 0x7C, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00},
|
|
||||||
{0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x3A, 0x44, 0x44, 0x44, 0x38, 0x20, 0x3C, 0x42, 0x42, 0x3C},
|
|
||||||
{0x00, 0x00, 0x00, 0x40, 0x40, 0x40, 0x5C, 0x62, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00},
|
|
||||||
{0x00, 0x00, 0x00, 0x08, 0x08, 0x00, 0x18, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x3E, 0x00, 0x00},
|
|
||||||
{0x00, 0x00, 0x00, 0x04, 0x04, 0x00, 0x0C, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x48, 0x30},
|
|
||||||
{0x00, 0x00, 0x00, 0x00, 0x40, 0x40, 0x44, 0x48, 0x50, 0x60, 0x50, 0x48, 0x44, 0x42, 0x00, 0x00},
|
|
||||||
{0x00, 0x00, 0x00, 0x00, 0x18, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x3E, 0x00, 0x00},
|
|
||||||
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49, 0x00, 0x00},
|
|
||||||
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5C, 0x62, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00},
|
|
||||||
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3C, 0x00, 0x00},
|
|
||||||
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5C, 0x62, 0x42, 0x42, 0x42, 0x42, 0x62, 0x5C, 0x40, 0x40},
|
|
||||||
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3A, 0x46, 0x42, 0x42, 0x42, 0x42, 0x46, 0x3A, 0x02, 0x02},
|
|
||||||
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5C, 0x62, 0x42, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00},
|
|
||||||
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x42, 0x40, 0x30, 0x0C, 0x02, 0x42, 0x3C, 0x00, 0x00},
|
|
||||||
{0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x7C, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x0C, 0x00, 0x00},
|
|
||||||
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x46, 0x3A, 0x00, 0x00},
|
|
||||||
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x42, 0x42, 0x24, 0x24, 0x24, 0x18, 0x18, 0x00, 0x00},
|
|
||||||
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49, 0x36, 0x00, 0x00},
|
|
||||||
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x42, 0x24, 0x18, 0x18, 0x24, 0x42, 0x42, 0x00, 0x00},
|
|
||||||
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x42, 0x42, 0x42, 0x42, 0x26, 0x1A, 0x02, 0x02, 0x3C},
|
|
||||||
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7E, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x7E, 0x00, 0x00},
|
|
||||||
{0x00, 0x00, 0x00, 0x0C, 0x10, 0x10, 0x08, 0x08, 0x10, 0x10, 0x08, 0x08, 0x10, 0x10, 0x0C, 0x00},
|
|
||||||
{0x00, 0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08},
|
|
||||||
{0x00, 0x00, 0x00, 0x30, 0x08, 0x08, 0x10, 0x10, 0x08, 0x08, 0x10, 0x10, 0x08, 0x08, 0x30, 0x00},
|
|
||||||
{0x00, 0x00, 0x00, 0x31, 0x49, 0x46, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
|
||||||
};
|
|
||||||
|
|
||||||
gfx_context *term_fb;
|
gfx_context *term_fb;
|
||||||
static int setup = 0;
|
static int setup = 0;
|
||||||
|
|
||||||
void drawCharacter(gfx_context *ctx, uint64_t x, uint64_t y, uint32_t clr_fg, uint32_t clr_bg, char c)
|
|
||||||
{
|
|
||||||
|
|
||||||
char *chr = c ? font[(int)c-0x20]: font[0];
|
|
||||||
if(x >= ctx->width || y >= ctx->height) return;
|
|
||||||
uint64_t loc = \
|
|
||||||
y * ctx->pitch + \
|
|
||||||
x * ctx->bpp;
|
|
||||||
uint32_t *fb = incptr(ctx->buffer, loc);
|
|
||||||
for(int row = 0; row < 16; row++)
|
|
||||||
{
|
|
||||||
for(int col = 0; col < 8; col++)
|
|
||||||
{
|
|
||||||
fb[col] = ((chr[row]>>(7-col))&0x1) ? clr_fg : clr_bg;
|
|
||||||
}
|
|
||||||
fb = incptr(fb, ctx->pitch);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
static void draw_border(gfx_context *ctx, uint32_t clr)
|
static void draw_border(gfx_context *ctx, uint32_t clr)
|
||||||
{
|
{
|
||||||
for(uint64_t x = 0; x < ctx->width; x++)
|
for(uint64_t x = 0; x < ctx->width; x++)
|
||||||
@ -139,15 +21,6 @@ static void draw_border(gfx_context *ctx, uint32_t clr)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void fbterm_init(gfx_context *ctx)
|
|
||||||
{
|
|
||||||
term_fb = framebuffer_make_subcontext(ctx, 20, 20, 8*VGA_COLS+8, 16*VGA_ROWS+8);
|
|
||||||
draw_border(term_fb, RGB(255, 0, 0));
|
|
||||||
flip(term_fb);
|
|
||||||
term_fb = framebuffer_make_subcontext(ctx, 24, 24, 8*VGA_COLS, 16*VGA_ROWS);
|
|
||||||
setup = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
void fbterm_movecursor(unsigned int cursor)
|
void fbterm_movecursor(unsigned int cursor)
|
||||||
{
|
{
|
||||||
(void) cursor;
|
(void) cursor;
|
||||||
@ -161,8 +34,30 @@ void fbterm_flush(struct vga_cell *buffer)
|
|||||||
{
|
{
|
||||||
for(int col=0; col < VGA_COLS; col++)
|
for(int col=0; col < VGA_COLS; col++)
|
||||||
{
|
{
|
||||||
drawCharacter(term_fb, col*8, row*16, 0xFFFFFF, 0, (char)buffer[i++].c);
|
putCharacter(term_fb, col*8, row*16, 0xFFFFFF, 0, (char)buffer[i++].c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
flip(term_fb);
|
flip(term_fb);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void fbterm_init(struct fbinfo *fbinfo)
|
||||||
|
{
|
||||||
|
kernel_fb.width = fbinfo->framebuffer_width;
|
||||||
|
kernel_fb.height = fbinfo->framebuffer_height;
|
||||||
|
kernel_fb.bpp = fbinfo->framebuffer_bpp/8;
|
||||||
|
kernel_fb.pitch = fbinfo->framebuffer_pitch;
|
||||||
|
kernel_fb.addr = P2V(fbinfo->framebuffer_addr);
|
||||||
|
kernel_fb.size = kernel_fb.pitch * (kernel_fb.height);
|
||||||
|
kernel_fb.buffer = calloc(1, kernel_fb.size);
|
||||||
|
|
||||||
|
for(uintptr_t p = (uintptr_t)kernel_fb.addr; p < ((uintptr_t)kernel_fb.addr + kernel_fb.size); p += PAGE_SIZE)
|
||||||
|
{
|
||||||
|
vmm_set_page(kernel_P4, p, V2P(p), PAGE_WRITE | PAGE_PRESENT);
|
||||||
|
}
|
||||||
|
|
||||||
|
term_fb = framebuffer_make_subcontext(&kernel_fb, 20, 20, 8*VGA_COLS+8, 16*VGA_ROWS+8);
|
||||||
|
draw_border(term_fb, RGB(255, 0, 0));
|
||||||
|
flip(term_fb);
|
||||||
|
term_fb = framebuffer_make_subcontext(&kernel_fb, 24, 24, 8*VGA_COLS, 16*VGA_ROWS);
|
||||||
|
setup = 1;
|
||||||
|
}
|
@ -2,6 +2,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sys/uio.h>
|
#include <sys/uio.h>
|
||||||
#include <terminal.h>
|
#include <terminal.h>
|
||||||
|
#include <multiboot.h>
|
||||||
#include <musl-glue.h>
|
#include <musl-glue.h>
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
@ -105,8 +106,7 @@ void terminal_init(){
|
|||||||
switch(terminal_type)
|
switch(terminal_type)
|
||||||
{
|
{
|
||||||
case FRAMEBUFFER:
|
case FRAMEBUFFER:
|
||||||
framebuffer_init(fbinfo);
|
fbterm_init(fbinfo);
|
||||||
fbterm_init(&kernel_fb);
|
|
||||||
break;
|
break;
|
||||||
case EGA_TEXT:
|
case EGA_TEXT:
|
||||||
vga_init(fbinfo);
|
vga_init(fbinfo);
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <framebuffer.h>
|
#include <mittos/graphics.h>
|
||||||
|
#include <multiboot.h>
|
||||||
|
|
||||||
#define VGA_COLS 80
|
#define VGA_COLS 80
|
||||||
#define VGA_ROWS 24
|
#define VGA_ROWS 24
|
||||||
@ -21,6 +22,7 @@ void vga_movecursor(unsigned int cursor);
|
|||||||
void vga_flush(struct vga_cell *buffer);
|
void vga_flush(struct vga_cell *buffer);
|
||||||
|
|
||||||
// drivers/terminal/fbterm.c
|
// drivers/terminal/fbterm.c
|
||||||
void fbterm_init(gfx_context *ctx);
|
extern gfx_context kernel_fb;
|
||||||
|
void fbterm_init(struct fbinfo *fbinfo);
|
||||||
void fbterm_movecursor(unsigned int cursor);
|
void fbterm_movecursor(unsigned int cursor);
|
||||||
void fbterm_flush(struct vga_cell *buffer);
|
void fbterm_flush(struct vga_cell *buffer);
|
46
src/libmittos/Makefile
Normal file
46
src/libmittos/Makefile
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
ifeq ($(BUILDROOT),)
|
||||||
|
$(error BUILDROOT IS NOT SET!)
|
||||||
|
endif
|
||||||
|
|
||||||
|
CC := ${TARGET}-gcc
|
||||||
|
|
||||||
|
SRC := $(shell find -type f -name '*.[cS]*')
|
||||||
|
OBJ := $(patsubst %, %.o, $(basename $(basename $(SRC))))
|
||||||
|
|
||||||
|
HDR := $(shell find -type f -name '*.h')
|
||||||
|
|
||||||
|
CFLAGS := -Wall -Wextra -pedantic -ffreestanding -mcmodel=large -std=c2x
|
||||||
|
CFLAGS += -ggdb -O0
|
||||||
|
ASFLAGS += -ggdb
|
||||||
|
CPPFLAGS += -nostdinc -I include -I /opt/sysroot/usr/include
|
||||||
|
LDFLAGS := -nostdlib -r
|
||||||
|
|
||||||
|
libmittos.a: $(OBJ)
|
||||||
|
$(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@
|
||||||
|
|
||||||
|
# Automatic dependency tracking
|
||||||
|
DEP := $(OBJ:.o=.d)
|
||||||
|
DEPFLAGS = -MT $@ -MMD -MP -MF $*.d
|
||||||
|
$(OBJ): CPPFLAGS += $(DEPFLAGS)
|
||||||
|
%.d: ;
|
||||||
|
|
||||||
|
DESTDIR ?= $(BUILDROOT)/sysroot
|
||||||
|
LIBDIR := $(DESTDIR)/usr/lib
|
||||||
|
INCDIR := $(DESTDIR)/usr/include/mittos
|
||||||
|
$(LIBDIR)/libmittos.a: libmittos.a
|
||||||
|
install -D $< $@
|
||||||
|
|
||||||
|
$(INCDIR)/%: include/%
|
||||||
|
mkdir -p $(INCDIR)
|
||||||
|
install -D $< $@
|
||||||
|
|
||||||
|
install: install-headers $(LIBDIR)/libmittos.a
|
||||||
|
|
||||||
|
install-headers: $(HDR:./include/%=$(INCDIR)/%)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -rf $(OBJ) $(DEP) libmittos.a
|
||||||
|
|
||||||
|
.PHONY: install install-headers
|
||||||
|
# Include automatic dependency rules
|
||||||
|
include $(DEP)
|
@ -1,10 +1,11 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <memory.h>
|
#include <graphics.h>
|
||||||
#include <framebuffer.h>
|
|
||||||
|
|
||||||
gfx_context kernel_fb;
|
#define incptr(p, n) ((void *)(((uintptr_t)(p)) + (n)))
|
||||||
|
|
||||||
|
#include "termfont.inc"
|
||||||
|
|
||||||
void putpixel(gfx_context *ctx, uint64_t x, uint64_t y, uint32_t clr)
|
void putpixel(gfx_context *ctx, uint64_t x, uint64_t y, uint32_t clr)
|
||||||
{
|
{
|
||||||
@ -16,6 +17,25 @@ void putpixel(gfx_context *ctx, uint64_t x, uint64_t y, uint32_t clr)
|
|||||||
*fb = clr;
|
*fb = clr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void putCharacter(gfx_context *ctx, uint64_t x, uint64_t y, uint32_t clr_fg, uint32_t clr_bg, char c)
|
||||||
|
{
|
||||||
|
|
||||||
|
char *chr = c ? font[(int)c-0x20]: font[0];
|
||||||
|
if(x >= ctx->width || y >= ctx->height) return;
|
||||||
|
uint64_t loc = \
|
||||||
|
y * ctx->pitch + \
|
||||||
|
x * ctx->bpp;
|
||||||
|
uint32_t *fb = incptr(ctx->buffer, loc);
|
||||||
|
for(int row = 0; row < 16; row++)
|
||||||
|
{
|
||||||
|
for(int col = 0; col < 8; col++)
|
||||||
|
{
|
||||||
|
fb[col] = ((chr[row]>>(7-col))&0x1) ? clr_fg : clr_bg;
|
||||||
|
}
|
||||||
|
fb = incptr(fb, ctx->pitch);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void flip(gfx_context *ctx)
|
void flip(gfx_context *ctx)
|
||||||
{
|
{
|
||||||
for(uint64_t y = 0; y < ctx->height; y++)
|
for(uint64_t y = 0; y < ctx->height; y++)
|
||||||
@ -44,19 +64,3 @@ gfx_context *framebuffer_make_subcontext(gfx_context *ctx, uint64_t x, uint64_t
|
|||||||
|
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
void framebuffer_init(struct fbinfo *fbinfo)
|
|
||||||
{
|
|
||||||
kernel_fb.width = fbinfo->framebuffer_width;
|
|
||||||
kernel_fb.height = fbinfo->framebuffer_height;
|
|
||||||
kernel_fb.bpp = fbinfo->framebuffer_bpp/8;
|
|
||||||
kernel_fb.pitch = fbinfo->framebuffer_pitch;
|
|
||||||
kernel_fb.addr = P2V(fbinfo->framebuffer_addr);
|
|
||||||
kernel_fb.size = kernel_fb.pitch * (kernel_fb.height);
|
|
||||||
kernel_fb.buffer = calloc(1, kernel_fb.size);
|
|
||||||
|
|
||||||
for(uintptr_t p = (uintptr_t)kernel_fb.addr; p < ((uintptr_t)kernel_fb.addr + kernel_fb.size); p += PAGE_SIZE)
|
|
||||||
{
|
|
||||||
vmm_set_page(kernel_P4, p, V2P(p), PAGE_WRITE | PAGE_PRESENT);
|
|
||||||
}
|
|
||||||
}
|
|
98
src/libmittos/graphics/termfont.inc
Normal file
98
src/libmittos/graphics/termfont.inc
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
// Font from https://github.com/atextor/unifont
|
||||||
|
char font[95][16] = {
|
||||||
|
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x08, 0x08, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x22, 0x22, 0x22, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00, 0x00, 0x12, 0x12, 0x12, 0x7E, 0x24, 0x24, 0x7E, 0x48, 0x48, 0x48, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00, 0x00, 0x08, 0x3E, 0x49, 0x48, 0x38, 0x0E, 0x09, 0x49, 0x3E, 0x08, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00, 0x00, 0x31, 0x4A, 0x4A, 0x34, 0x08, 0x08, 0x16, 0x29, 0x29, 0x46, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00, 0x00, 0x1C, 0x22, 0x22, 0x22, 0x1C, 0x39, 0x45, 0x42, 0x46, 0x39, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00, 0x04, 0x08, 0x08, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x08, 0x08, 0x04, 0x00},
|
||||||
|
{0x00, 0x00, 0x00, 0x20, 0x10, 0x10, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x10, 0x10, 0x20, 0x00},
|
||||||
|
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x49, 0x2A, 0x1C, 0x2A, 0x49, 0x08, 0x00, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x08, 0x7F, 0x08, 0x08, 0x08, 0x00, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x08, 0x08, 0x10},
|
||||||
|
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x04, 0x08, 0x08, 0x10, 0x10, 0x20, 0x40, 0x40, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00, 0x00, 0x18, 0x24, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x24, 0x18, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00, 0x00, 0x08, 0x18, 0x28, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x3E, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00, 0x00, 0x3C, 0x42, 0x42, 0x02, 0x0C, 0x10, 0x20, 0x40, 0x40, 0x7E, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00, 0x00, 0x3C, 0x42, 0x42, 0x02, 0x1C, 0x02, 0x02, 0x42, 0x42, 0x3C, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00, 0x00, 0x04, 0x0C, 0x14, 0x24, 0x44, 0x44, 0x7E, 0x04, 0x04, 0x04, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00, 0x00, 0x7E, 0x40, 0x40, 0x40, 0x7C, 0x02, 0x02, 0x02, 0x42, 0x3C, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00, 0x00, 0x1C, 0x20, 0x40, 0x40, 0x7C, 0x42, 0x42, 0x42, 0x42, 0x3C, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00, 0x00, 0x7E, 0x02, 0x02, 0x04, 0x04, 0x04, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00, 0x00, 0x3C, 0x42, 0x42, 0x42, 0x3C, 0x42, 0x42, 0x42, 0x42, 0x3C, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00, 0x00, 0x3C, 0x42, 0x42, 0x42, 0x3E, 0x02, 0x02, 0x02, 0x04, 0x38, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x18, 0x08, 0x08, 0x10, 0x00},
|
||||||
|
{0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x04, 0x08, 0x10, 0x20, 0x10, 0x08, 0x04, 0x02, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7E, 0x00, 0x00, 0x00, 0x7E, 0x00, 0x00, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x20, 0x10, 0x08, 0x04, 0x08, 0x10, 0x20, 0x40, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00, 0x00, 0x3C, 0x42, 0x42, 0x02, 0x04, 0x08, 0x08, 0x00, 0x08, 0x08, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00, 0x00, 0x1C, 0x22, 0x4A, 0x56, 0x52, 0x52, 0x52, 0x4E, 0x20, 0x1E, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00, 0x00, 0x18, 0x24, 0x24, 0x42, 0x42, 0x7E, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00, 0x00, 0x7C, 0x42, 0x42, 0x42, 0x7C, 0x42, 0x42, 0x42, 0x42, 0x7C, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00, 0x00, 0x3C, 0x42, 0x42, 0x40, 0x40, 0x40, 0x40, 0x42, 0x42, 0x3C, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00, 0x00, 0x78, 0x44, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x44, 0x78, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00, 0x00, 0x7E, 0x40, 0x40, 0x40, 0x7C, 0x40, 0x40, 0x40, 0x40, 0x7E, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00, 0x00, 0x7E, 0x40, 0x40, 0x40, 0x7C, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00, 0x00, 0x3C, 0x42, 0x42, 0x40, 0x40, 0x4E, 0x42, 0x42, 0x46, 0x3A, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00, 0x00, 0x42, 0x42, 0x42, 0x42, 0x7E, 0x42, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00, 0x00, 0x3E, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x3E, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00, 0x00, 0x1F, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x44, 0x44, 0x38, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00, 0x00, 0x42, 0x44, 0x48, 0x50, 0x60, 0x60, 0x50, 0x48, 0x44, 0x42, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00, 0x00, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x7E, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00, 0x00, 0x42, 0x42, 0x66, 0x66, 0x5A, 0x5A, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00, 0x00, 0x42, 0x62, 0x62, 0x52, 0x52, 0x4A, 0x4A, 0x46, 0x46, 0x42, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00, 0x00, 0x3C, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3C, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00, 0x00, 0x7C, 0x42, 0x42, 0x42, 0x7C, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00, 0x00, 0x3C, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x5A, 0x66, 0x3C, 0x03, 0x00},
|
||||||
|
{0x00, 0x00, 0x00, 0x00, 0x7C, 0x42, 0x42, 0x42, 0x7C, 0x48, 0x44, 0x44, 0x42, 0x42, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00, 0x00, 0x3C, 0x42, 0x42, 0x40, 0x30, 0x0C, 0x02, 0x42, 0x42, 0x3C, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00, 0x00, 0x7F, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00, 0x00, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3C, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00, 0x00, 0x41, 0x41, 0x41, 0x22, 0x22, 0x22, 0x14, 0x14, 0x08, 0x08, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00, 0x00, 0x42, 0x42, 0x42, 0x42, 0x5A, 0x5A, 0x66, 0x66, 0x42, 0x42, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00, 0x00, 0x42, 0x42, 0x24, 0x24, 0x18, 0x18, 0x24, 0x24, 0x42, 0x42, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00, 0x00, 0x41, 0x41, 0x22, 0x22, 0x14, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00, 0x00, 0x7E, 0x02, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x40, 0x7E, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00, 0x0E, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x0E, 0x00},
|
||||||
|
{0x00, 0x00, 0x00, 0x00, 0x40, 0x40, 0x20, 0x10, 0x10, 0x08, 0x08, 0x04, 0x02, 0x02, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00, 0x70, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x70, 0x00},
|
||||||
|
{0x00, 0x00, 0x18, 0x24, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x00},
|
||||||
|
{0x00, 0x20, 0x10, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x42, 0x02, 0x3E, 0x42, 0x42, 0x46, 0x3A, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00, 0x40, 0x40, 0x40, 0x5C, 0x62, 0x42, 0x42, 0x42, 0x42, 0x62, 0x5C, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x42, 0x40, 0x40, 0x40, 0x40, 0x42, 0x3C, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00, 0x02, 0x02, 0x02, 0x3A, 0x46, 0x42, 0x42, 0x42, 0x42, 0x46, 0x3A, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x42, 0x42, 0x7E, 0x40, 0x40, 0x42, 0x3C, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00, 0x0C, 0x10, 0x10, 0x10, 0x7C, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x3A, 0x44, 0x44, 0x44, 0x38, 0x20, 0x3C, 0x42, 0x42, 0x3C},
|
||||||
|
{0x00, 0x00, 0x00, 0x40, 0x40, 0x40, 0x5C, 0x62, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00, 0x08, 0x08, 0x00, 0x18, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x3E, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00, 0x04, 0x04, 0x00, 0x0C, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x48, 0x30},
|
||||||
|
{0x00, 0x00, 0x00, 0x00, 0x40, 0x40, 0x44, 0x48, 0x50, 0x60, 0x50, 0x48, 0x44, 0x42, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00, 0x00, 0x18, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x3E, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5C, 0x62, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3C, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5C, 0x62, 0x42, 0x42, 0x42, 0x42, 0x62, 0x5C, 0x40, 0x40},
|
||||||
|
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3A, 0x46, 0x42, 0x42, 0x42, 0x42, 0x46, 0x3A, 0x02, 0x02},
|
||||||
|
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5C, 0x62, 0x42, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x42, 0x40, 0x30, 0x0C, 0x02, 0x42, 0x3C, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x7C, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x0C, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x46, 0x3A, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x42, 0x42, 0x24, 0x24, 0x24, 0x18, 0x18, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49, 0x36, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x42, 0x24, 0x18, 0x18, 0x24, 0x42, 0x42, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x42, 0x42, 0x42, 0x42, 0x26, 0x1A, 0x02, 0x02, 0x3C},
|
||||||
|
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7E, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x7E, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00, 0x0C, 0x10, 0x10, 0x08, 0x08, 0x10, 0x10, 0x08, 0x08, 0x10, 0x10, 0x0C, 0x00},
|
||||||
|
{0x00, 0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08},
|
||||||
|
{0x00, 0x00, 0x00, 0x30, 0x08, 0x08, 0x10, 0x10, 0x08, 0x08, 0x10, 0x10, 0x08, 0x08, 0x30, 0x00},
|
||||||
|
{0x00, 0x00, 0x00, 0x31, 0x49, 0x46, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||||
|
};
|
@ -1,7 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <stdint.h>
|
#include <stdlib.h>
|
||||||
#include <stddef.h>
|
|
||||||
#include <multiboot.h>
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint32_t width;
|
uint32_t width;
|
||||||
@ -13,13 +11,9 @@ typedef struct {
|
|||||||
size_t size;
|
size_t size;
|
||||||
} gfx_context;
|
} gfx_context;
|
||||||
|
|
||||||
// drivers/framebuffer.c
|
|
||||||
extern gfx_context kernel_fb;
|
|
||||||
|
|
||||||
#define RGB(r, g, b) (((uint32_t) (r<<16) + (g<<8) + (b)))
|
#define RGB(r, g, b) (((uint32_t) (r<<16) + (g<<8) + (b)))
|
||||||
|
|
||||||
// drivers/framebuffer.c
|
|
||||||
void putpixel(gfx_context *ctx, uint64_t x, uint64_t y, uint32_t clr);
|
void putpixel(gfx_context *ctx, uint64_t x, uint64_t y, uint32_t clr);
|
||||||
|
void putCharacter(gfx_context *ctx, uint64_t x, uint64_t y, uint32_t clr_fg, uint32_t clr_bg, char c);
|
||||||
void flip(gfx_context *ctx);
|
void flip(gfx_context *ctx);
|
||||||
gfx_context *framebuffer_make_subcontext(gfx_context *ctx, uint64_t x, uint64_t y, uint64_t width, uint64_t height);
|
gfx_context *framebuffer_make_subcontext(gfx_context *ctx, uint64_t x, uint64_t y, uint64_t width, uint64_t height);
|
||||||
void framebuffer_init(struct fbinfo *fbinfo);
|
|
Loading…
x
Reference in New Issue
Block a user