Store devices as a hashtable
This commit is contained in:
@ -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_
|
||||
|
Reference in New Issue
Block a user