Minimal device system, implement terminal device and libterminal
All checks were successful
Build documentation / build-and-deploy (push) Successful in 55s

This commit is contained in:
2026-02-12 15:49:04 +01:00
parent 4ad1519e06
commit f07e920270
40 changed files with 4664 additions and 7 deletions

28
libterminal/Makefile Normal file
View File

@@ -0,0 +1,28 @@
cc := clang
o :=
c :=
cflags := -isystem . -isystem ../libmsl
buildtype ?= release
include src.mk
include ../generic/flags.mk
include ../$(platform)/flags.mk
all: build/libterminal.a
build/libterminal.a: $(o)
llvm-ar rcs $@ $^
%.o: %.c
$(cc) -c -o $@ $(cflags) $<
%.o: %.S
$(cc) -c -o $@ $(cflags) $<
clean:
rm -f $(o) build/libterminal.a
format:
clang-format -i $$(git ls-files '*.c' '*.h')
.PHONY: all clean format

1
libterminal/src.mk Normal file
View File

@@ -0,0 +1 @@
include terminal/src.mk

1
libterminal/terminal/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
*.o

View File

@@ -0,0 +1,8 @@
#ifndef _LIBTERMINAL_TERMINAL_DEVICE_H
#define _LIBTERMINAL_TERMINAL_DEVICE_H
#define TERMINAL_DEVICE 1
#include <m/terminal_device.h>
#endif // _LIBTERMINAL_TERMINAL_DEVICE_H

View File

@@ -0,0 +1,3 @@
c += terminal/terminal.c
o += terminal/terminal.o

View File

@@ -0,0 +1,8 @@
#include <stddef.h>
#include <terminal/device.h>
#include <terminal/terminal.h>
#include <m/system.h>
void terminal_print (const char* string, size_t len) {
device_do (TERMINAL_DEVICE, TERMINAL_PUTSTR, (void*)string, &len, NULL, NULL);
}

View File

@@ -0,0 +1,8 @@
#ifndef _LIBTERMINAL_TERMINAL_TERMINAL_H
#define _LIBTERMINAL_TERMINAL_TERMINAL_H
#include <stddef.h>
void terminal_print (const char* string, size_t len);
#endif // _LIBTERMINAL_TERMINAL_TERMINAL_H