Minimal device system, implement terminal device and libterminal
All checks were successful
Build documentation / build-and-deploy (push) Successful in 55s
All checks were successful
Build documentation / build-and-deploy (push) Successful in 55s
This commit is contained in:
24
kernel/device/device.h
Normal file
24
kernel/device/device.h
Normal 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
|
||||
Reference in New Issue
Block a user