00001
00002
00003
00004
00005
00006 #ifndef __DEVDRVR_H_INCLUDED
00007
00008 #ifndef __TYPES_H_INCLUDED
00009 #include <sys/types.h>
00010 #endif
00011
00012 #ifndef _TERMIOS_H_INCLUDED
00013 #include <termios.h>
00014 #endif
00015
00016 #pragma pack(1);
00017
00018
00019
00020
00021
00022
00023 struct input_buffer {
00024 char __far *buffer;
00025 short unsigned length;
00026 char __far *head;
00027 char __far *tail;
00028 short unsigned size;
00029 short int tty;
00030 short unsigned handle;
00031 long unsigned action;
00032 long unsigned mode;
00033 short unsigned bcount;
00034 short unsigned timer;
00035 short unsigned timer_reset;
00036 char unsigned pkt_data;
00037 char unsigned pkt_flag;
00038 short unsigned zero[2];
00039 short unsigned hw_high_water;
00040 short unsigned hw_low_water;
00041 short unsigned sw_high_water;
00042 short unsigned sw_low_water;
00043 } ;
00044
00045 struct output_buffer {
00046 char __far *buffer;
00047 short unsigned length;
00048 char __far *head;
00049 char __far *tail;
00050 short unsigned size;
00051 short int tty;
00052 short unsigned handle;
00053 long unsigned action;
00054 long unsigned mode;
00055 short unsigned bcount;
00056 short unsigned timer;
00057 short unsigned timer_reset;
00058 short unsigned discard;
00059 short unsigned rows;
00060 short unsigned cols;
00061 short unsigned threshold;
00062 short unsigned zero[3];
00063 } ;
00064
00065 struct canon_buffer {
00066 char __far *buffer;
00067 short unsigned length;
00068 char __far *head;
00069 char __far *tail;
00070 short unsigned size;
00071 short int tty;
00072 short unsigned handle;
00073 long unsigned action;
00074 long unsigned mode;
00075 char __far *in;
00076 char __far *eol;
00077 short unsigned state;
00078 short unsigned pcount;
00079 short unsigned zero[4];
00080 } ;
00081
00082 struct driver_ctrl {
00083 short int base_tty;
00084 short int nttys;
00085 pid_t (__far *tti)(int c, int tty, unsigned ds);
00086 short unsigned tti_ds;
00087 pid_t hw_pid;
00088 short unsigned flags;
00089 short unsigned ttim_offset;
00090 #ifdef __386__
00091 short unsigned zero[6];
00092 #endif
00093 } ;
00094
00095
00096
00097
00098 #define DRVR_GETS_PIDS 0x0001
00099 #define DRVR_IS32 0x0002
00100 #define DRVR_SUPP_TTIM 0x0004
00101
00102 struct device_ctrl {
00103 short int tty;
00104 short unsigned isize;
00105 short unsigned osize;
00106 short unsigned csize;
00107 struct input_buffer __far *ibuf;
00108 struct output_buffer __far *obuf;
00109 struct canon_buffer __far *cbuf;
00110 struct termios __far *termios;
00111 struct stat __far *stat;
00112 short unsigned zero[2];
00113 } ;
00114
00115
00116
00117
00118
00119
00120
00121 #define RCV_BREAK 0x8000
00122 #define RCV_DATAERR 0x4000
00123 #define RCV_PARITY 0x4100
00124 #define RCV_FRAME 0x4200
00125 #define RCV_OVERRUN 0x4400
00126 #define RCV_HW 0x2000
00127 #define RCV_HW_OFF 0x2001
00128 #define RCV_HW_ON 0x2002
00129 #define RCV_HNGUP 0x2004
00130 #define RCV_CARRIER 0x2008
00131 #define RCV_EVENT 0x1000
00132 #define RCV_WINCH 0x1100
00133
00134
00135
00136
00137
00138 #define RCV_PKT 0x1000
00139 #define RCV_PKT_FLUSHREAD 0x1001
00140 #define RCV_PKT_FLUSHWRITE 0x1002
00141 #define RCV_PKT_STOP 0x1004
00142 #define RCV_PKT_START 0x1008
00143 #define RCV_PKT_NOSTOP 0x1010
00144 #define RCV_PKT_DOSTOP 0x1020
00145 #define RCV_PKT_IOCTL 0x1040
00146 #define RCV_PKT_SPECIAL 0x1080
00147
00148
00149
00150
00151 #define ACT_NOTHING 0x0000
00152 #define ACT_SIGINT 0x0001
00153 #define ACT_SIGQUIT 0x0002
00154 #define ACT_SIGTSTP 0x0004
00155 #define ACT_OSFLOW_CHG 0x0008
00156 #define ACT_ISFLOW_CHG 0x0010
00157 #define ACT_OSFLOW_STOP 0x0020
00158 #define ACT_ISFLOW_STOP 0x0040
00159 #define ACT_INPUT_READY 0x0080
00160 #define ACT_FLUSH_INPUT 0x0100
00161 #define ACT_FLUSH_OUTPUT 0x0200
00162 #define ACT_INPUT_TIMEOUT 0x0400
00163 #define ACT_IHFLOW_CHG 0x0800
00164 #define ACT_IHFLOW_STOP 0x1000
00165 #define ACT_OHFLOW_CHG 0x2000
00166 #define ACT_OHFLOW_STOP 0x4000
00167 #define ACT_SIGHUP 0x8000
00168 #define ACT_REQ_LOGIN 0x10000L
00169 #define ACT_PKT 0x20000L
00170 #define ACT_RX_READY 0x40000L
00171 #define ACT_SIGWINCH 0x80000L
00172
00173
00174
00175
00176 #define ACT_OUTPUT_READY 0x0001
00177
00178
00179
00180
00181 #define INPUT_STOPPED 0x0002
00182 #define INPUT_STOPPED_HW 0x0004
00183 #define INPUT_NOT_EMPTY 0x0008
00184 #define INPUT_OVERFLOW 0x0010
00185 #define INPUT_TIMER 0x0020
00186 #define INPUT_HW 0x0040
00187 #define INPUT_SFLOW_CHG 0x0080
00188 #define INPUT_HFLOW_CHG 0x0100
00189 #define INPUT_USED 0x0200
00190 #define INPUT_ARMED 0x0400
00191 #define INPUT_RX_TRIGGER 0x0800
00192
00193
00194
00195
00196 #define OUTPUT_STOPPED 0x0001
00197 #define OUTPUT_STOPPED_HW 0x0002
00198 #define OUTPUT_XOFF 0x0004
00199 #define OUTPUT_XON 0x0008
00200 #define OUTPUT_READY 0x0010
00201 #define OUTPUT_HW 0x0020
00202 #define OUTPUT_HFLOW_OFF 0x0040
00203 #define OUTPUT_HFLOW_ON 0x0080
00204 #define OUTPUT_XNL 0x0100
00205 #define OUTPUT_SFLOW_CHG 0x0200
00206 #define OUTPUT_HFLOW_CHG 0x0400
00207 #define OUTPUT_FLUSH 0x0800
00208
00209
00210
00211
00212 #define PARITY_NONE 0x0000
00213 #define PARITY_EVEN 0x0004
00214 #define PARITY_ODD 0x0005
00215 #define PARITY_SPACE 0x0006
00216 #define PARITY_MARK 0x0007
00217
00218
00219
00220
00221 #define DRVR_SCAN 0x0001
00222 #define DRVR_NOTTY 0x0002
00223 #define DRVR_LOCK_HFLOW 0x0004
00224 #define DRVR_SINGLE_OPEN 0x0008
00225 #define DRVR_HEX_SUFFIX 0x0010
00226 #define DRVR_STTY 0x0020
00227 #define DRVR_NO_SUFFIX 0x0040
00228 #define DRVR_EOFHUP 0x0080
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239 #define IOCTL_OPEN 0x0301
00240 #define IOCTL_CLOSE 0x0302
00241 #define IOCTL_CTL 0x0303
00242 #define IOCTL_STARTBREAK 0x0304
00243 #define IOCTL_STOPBREAK 0x0305
00244 #define IOCTL_STARTDROP 0x0306
00245 #define IOCTL_STOPDROP 0x0307
00246
00247
00248
00249
00250 #define IOCTL_ERROR (-1)
00251 #define IOCTL_OK 0
00252 #define IOCTL_BAD_UNIT 1
00253 #define IOCTL_NONE_FREE 2
00254
00255 union ioctl_entry {
00256 short int type;
00257 short int status;
00258 struct ioctl_open {
00259 short int type;
00260 short int unit;
00261
00262
00263
00264 short int mode;
00265 pid_t pid;
00266 short int fd;
00267 short unsigned euid;
00268 short unsigned egid;
00269 struct input_buffer __far *ibuf;
00270 struct output_buffer __far *obuf;
00271 struct canon_buffer __far *cbuf;
00272 struct termios __far *tios;
00273 struct stat __far *stat;
00274 unsigned zero[4];
00275 } open;
00276 struct ioctl_open_return {
00277 short int status;
00278 short int unit;
00279 } open_return;
00280 struct ioctl_close {
00281 short int type;
00282 short int unit;
00283
00284
00285
00286 pid_t pid;
00287 short int fd;
00288 struct input_buffer __far *ibuf;
00289 struct output_buffer __far *obuf;
00290 struct canon_buffer __far *cbuf;
00291 struct termios __far *tios;
00292 struct stat __far *stat;
00293 } close;
00294 struct ioctl_close_return {
00295 short int status;
00296 } close_return;
00297 struct ioctl_user {
00298 short int type;
00299 short int unit;
00300 short int zero;
00301 short int nbytes;
00302 unsigned char data[32];
00303 } user;
00304 struct ioctl_user_return {
00305 short int status;
00306 short int zero[2];
00307 short int nbytes;
00308 unsigned char data[32];
00309 } user_return;
00310 struct ioctl_startbreak {
00311 short int type;
00312 short int unit;
00313 } startbreak;
00314 struct ioctl_startbreak_return {
00315 short int status;
00316 } startbreak_return;
00317 struct ioctl_stopbreak {
00318 short int type;
00319 short int unit;
00320 } stopbreak;
00321 struct ioctl_stopbreak_return {
00322 short int status;
00323 } stopbreak_return;
00324 struct ioctl_startdrop {
00325 short int type;
00326 short int unit;
00327 } startdrop;
00328 struct ioctl_startdrop_return {
00329 short int status;
00330 } startdrop_return;
00331 struct ioctl_stopdrop {
00332 short int type;
00333 short int unit;
00334 } stopdrop;
00335 struct ioctl_stopdrop_return {
00336 short int status;
00337 } stopdrop_return;
00338 };
00339
00340
00341
00342
00343
00344 #ifdef __386__
00345
00346
00347
00348 #define _DEV_DRIVER_REGISTER 0x0305
00349 #define _DEV_DRIVER_MOUNT 0x0306
00350 #define _DEV_DRIVER_ARM 0x0307
00351 #define _DEV_DRIVER_SHUTDOWN 0x0308
00352 #else
00353
00354
00355
00356 #define _DEV_DRIVER_REGISTER 0x0301
00357 #define _DEV_DRIVER_MOUNT 0x0302
00358 #define _DEV_DRIVER_ARM 0x0303
00359 #define _DEV_DRIVER_SHUTDOWN 0x0304
00360 #endif
00361
00362 struct _driver_register {
00363 msg_t type;
00364 char name[8];
00365 char prefix[8];
00366 int nttys;
00367 unsigned ds;
00368 unsigned cs;
00369 unsigned kick_addr;
00370 unsigned stty_addr;
00371 unsigned ctrl_addr;
00372 unsigned flags;
00373 } ;
00374
00375 struct _driver_register_reply {
00376 msg_t status;
00377 int handle;
00378 struct driver_ctrl ctrl;
00379 } ;
00380
00381 struct _driver_mount {
00382 msg_t type;
00383 int handle;
00384 int tty;
00385 unsigned isize;
00386 unsigned osize;
00387 unsigned csize;
00388 unsigned seg;
00389 unsigned new;
00390 char *offset;
00391 unsigned zero[3];
00392 } ;
00393
00394 struct _driver_mount_reply {
00395 msg_t status;
00396 unsigned seg;
00397 struct device_ctrl ctrl;
00398 } ;
00399
00400 struct _driver_arm {
00401 msg_t type;
00402 int tty;
00403 } ;
00404
00405 struct _driver_arm_reply {
00406 msg_t status;
00407 } ;
00408
00409 struct _driver_shutdown {
00410 msg_t type;
00411 int handle;
00412 } ;
00413
00414 struct _driver_shutdown_reply {
00415 msg_t status;
00416 } ;
00417
00418
00419
00420
00421
00422
00423 #ifdef __386__
00424 #pragma aux _dev_call far parm [es edi] value [eax] modify [eax];
00425
00426 #else
00427 #pragma aux _dev_call far parm [es di] value [ax] modify [ax];
00428
00429 #endif
00430
00431
00432
00433
00434
00435
00436 extern short dev_drvr_register(const char *name, const char *prefix, int ntty,
00437 int (__far * kick) (struct output_buffer __far *),
00438 int (__far * stty) (struct termios __far *),
00439 int (__far * ioctl)(union ioctl_entry __far *),
00440 struct driver_ctrl *,
00441 unsigned);
00442
00443 extern unsigned short dev_drvr_mount(int ,int ,int ,struct device_ctrl *);
00444
00445 extern int dev_drvr_arm( int );
00446
00447 extern int dev_drvr_shutdown( int );
00448
00449
00450 #pragma pack();
00451
00452 #define __DEVDRVR_H_INCLUDED
00453 #endif