kvisc/vm/pc/device.h

60 lines
1.0 KiB
C
Raw Normal View History

2019-06-05 19:31:48 +02:00
// 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
2019-06-20 18:13:06 +02:00
#define DEVSLOTS 4096
2019-06-05 19:31:48 +02:00
2019-08-03 19:01:12 +02:00
typedef long (*devfn_t)(dev_t *);
2019-06-05 19:31:48 +02:00
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 *);
2019-08-03 19:01:12 +02:00
dev_t *devget(int);
2019-06-05 19:31:48 +02:00
2019-08-03 19:01:12 +02:00
void devattach(dev_t *);
void devdetach( dev_t *);
2019-06-05 19:31:48 +02:00
2019-08-03 19:01:12 +02:00
int devinit(dev_t *);
int devfini(dev_t *);
2019-06-05 19:31:48 +02:00
2019-08-03 19:01:12 +02:00
int devinitall(void);
int devfiniall(void);
2019-06-05 19:31:48 +02:00