#ifndef DEV_DEV_H_
#define DEV_DEV_H_

#include <stdint.h>
#include "spinlock/spinlock.h"

#define DEV_FNS_MAX 32

struct Dev;

typedef int32_t (*DevFn)(struct Dev *dev, uint8_t *buffer, size_t len, uint64_t pid);

typedef struct Dev {
  int _hshtbstate;
  char ident[0x100];
  DevFn fns[DEV_FNS_MAX];
  SpinLock spinlock;
  void *extra;
} Dev;


typedef struct {
  SpinLock spinlock;
  Dev devs[0x100];
} DevTable;

extern DevTable DEVTABLE;

void dev_init(void);

#endif // DEV_DEV_H_
