00001
00009
00010
00011
00012 #ifndef _DEVICE_H_
00013 #define _DEVICE_H_
00014
00015 #include <kernel.h>
00016
00017
00018 typedef struct dentry
00019 {
00020 ushort num;
00021 char *name;
00022 devcall (*init) (struct dentry *, ...);
00023 devcall (*open) (struct dentry *, ...);
00024 devcall (*close) (struct dentry *, ...);
00025 devcall (*read) (struct dentry *, ...);
00026 devcall (*write) (struct dentry *, ...);
00027 devcall (*seek) (struct dentry *, ...);
00028 devcall (*getc) (struct dentry *, ...);
00029 devcall (*putc) (struct dentry *, ...);
00030 devcall (*control)(struct dentry *, ...);
00031 void *csr;
00032 uchar inmask;
00033 uchar outmask;
00034 void (*inintr)(void);
00035 void (*outintr)(void);
00036 void *controlblk;
00037 ushort minor;
00038 } device;
00039
00040 extern struct dentry devtab[];
00041
00042
00043 #define SERIAL0 0
00044 #define SERIAL1 1
00045 #define CONSOLE 2
00046 #define TTY0 2
00047 #define TTY1 3
00049
00050 #define NUART 2
00051 #define NTTY 2
00052 #define NWIN 0
00053 #define NFRAMBUF 0
00055
00056 #define NDEVS ( NUART + NTTY + NFRAMBUF + NWIN )
00057
00064 #define isbaddev(f) ( (ushort)(f)>=NDEVS )
00065
00066
00067 devcall close(ushort);
00068 devcall control(ushort, ushort, long, long);
00069 devcall getc(ushort);
00070 devcall open(ushort, ...);
00071 devcall putc(ushort, char);
00072 devcall read(ushort, void *, long);
00073 devcall write(ushort, void *, long);
00074 devcall seek(ushort, long);
00075
00076 #endif