Store devices as a hashtable

This commit is contained in:
2025-10-03 23:47:58 +02:00
parent 18d646ff8b
commit 04a4b1395c
11 changed files with 53 additions and 38 deletions

View File

@ -2,14 +2,26 @@
#define DEV_DEV_H_
#include <stdint.h>
#include "spinlock/spinlock.h"
#define DEV_FNS_MAX 32
typedef int32_t (*DevFn)(uint8_t *buffer, size_t len, void *extra);
typedef struct Dev {
struct Dev *next;
typedef struct {
int _hshtbstate;
char ident[0x100];
DevFn fns[DEV_FNS_MAX];
} Dev;
typedef struct {
SpinLock spinlock;
Dev devs[0x100];
} DevTable;
extern DevTable DEVTABLE;
void dev_init(void);
#endif // DEV_DEV_H_