1
0
mirror of https://gitlab.os-k.eu/os-k-team/kvisc.git synced 2023-08-25 14:05:46 +02:00
kvisc/vm/pc/dev.h
julianb0 d13da7b480
vm
2019-06-14 16:47:01 +02:00

60 lines
1.1 KiB
C

// The OS/K Team licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#include <pc/arch.h>
#define DEVLEN 32
#define DEVSLOTS 256
typedef long (*devfn_t)(ctx_t *, dev_t *);
enum
{
DEVPWOF, // Power off
DEVPLUG, // Unplugged or plugging
DEVGOOD, // Plugged and working
DEVFERR, // Fatal error
};
struct dev_t
{
dev_t *next;
char type[DEVLEN];
char name[DEVLEN];
char modl[DEVLEN];
char vend[DEVLEN];
int major;
int minor;
int revis;
ulong feats;
long id;
uint state;
void *data;
devfn_t fpwon;
devfn_t fpwoff;
devfn_t fplug;
devfn_t funplug;
devfn_t fslots[DEVSLOTS];
};
dev_t *devalloc(void);
void devfree(dev_t *);
dev_t *devget(ctx_t *, int);
void devattach(ctx_t *, dev_t *);
void devdetach(ctx_t *, dev_t *);
int devinit(ctx_t *, dev_t *);
int devfini(ctx_t *, dev_t *);
int devinitall(ctx_t *);
int devfiniall(ctx_t *);