kvisc/vm/pc/device.h

60 lines
1.0 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 4096
typedef long (*devfn_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(int);
void devattach(dev_t *);
void devdetach( dev_t *);
int devinit(dev_t *);
int devfini(dev_t *);
int devinitall(void);
int devfiniall(void);