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

24
kernel/device/device.h Normal file
View File

@@ -0,0 +1,24 @@
#ifndef _KERNEL_DEVICE_DEVICE_H
#define _KERNEL_DEVICE_DEVICE_H
#include <libk/rbtree.h>
#include <sync/spin_lock.h>
typedef int (*device_op_func_t) (void* a1, void* a2, void* a3, void* a4);
struct device {
int id;
device_op_func_t ops[32];
spin_lock_t lock;
struct rb_node_link device_tree_link;
bool (*init) (void* arg);
void (*fini) (void);
};
struct device* device_create (int id, device_op_func_t* ops, size_t ops_len,
bool (*init) (void* arg), void (*fini) (void), void* arg);
struct device* device_find (int id);
void device_delete (struct device* device);
void devices_init (void);
#endif // _KERNEL_DEVICE_DEVICE_H