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
|
|
|
|
#define DEVSLOTS 256
|
|
|
|
|
2019-06-05 22:11:45 +02:00
|
|
|
typedef long (*devfn_t)(ctx_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 *);
|
|
|
|
|
|
|
|
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 *);
|
|
|
|
|
|
|
|
extern dev_t cpudev;
|
|
|
|
|