Files
my-os-project2/kernel/dev/termdev.c

23 lines
537 B
C

#include <stdint.h>
#include <stddef.h>
#include "kprintf.h"
#include "hal/hal.h"
#include "termdev.h"
#include "dev.h"
#include "errors.h"
#include "util/util.h"
#include "hshtb.h"
#include "sysdefs/devctl.h"
int32_t termdev_putch(uint8_t *buffer, size_t len, void *extra) {
kprintf("%.*s", (int)len, (char *)buffer);
return E_OK;
}
void termdev_init(void) {
Dev *termdev = NULL;
HSHTB_ALLOC(DEVTABLE.devs, ident, "termdev", termdev);
termdev->fns[DEV_TERMDEV_PUTCH] = &termdev_putch;
spinlock_init(&termdev->spinlock);
}