Main Page   Packages   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Search  

C:/temp/src/j2k/QNX4/driver/_devdrvr.h

Go to the documentation of this file.
00001 /*
00002  *  _devdrvr.h   Device Driver Definitions
00003  *
00004  *  Copyright (C) by Quantum Software Systems 1990.  All rights reserved.
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  * Queue header formats
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; /* (__far *ttim)(int tty, int len, char far *data, unsigned ds) */
00090 #ifdef __386__
00091     short unsigned  zero[6];
00092 #endif
00093     } ;
00094 
00095 /*
00096  * driver_ctrl 'flag' bits
00097  */
00098 #define DRVR_GETS_PIDS  0x0001      /* IOCTL_OPEN passes down pid, fd, etc. */
00099 #define DRVR_IS32    0x0002      /* Uses 32 bit interface */
00100 #define DRVR_SUPP_TTIM  0x0004      /* Supports tti multiple call */
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  * Input character "control" bits
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  * Packet-mode receive events (PTYS only)
00136  * these help implement out-of-band data
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  * Actions to be performed as a result of input
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  * Actions to be performed as a result of output
00175  */
00176 #define ACT_OUTPUT_READY    0x0001
00177 
00178 /*
00179  * Modes of controlling Input
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  * Modes of controlling Output
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  * Input/Output parity definitions
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  * Driver registration flags
00220  */
00221 #define DRVR_SCAN           0x0001 /* open() with no suffix causes scan for unused unit */
00222 #define DRVR_NOTTY          0x0002 /* Not a terminal device. eg: /dev/null */
00223 #define DRVR_LOCK_HFLOW     0x0004 /* IHFLOW/OHFLOW in c_cflag cannot be changed */
00224 #define DRVR_SINGLE_OPEN    0x0008 /* open() will fail if already opened (pty) */
00225 #define DRVR_HEX_SUFFIX     0x0010 /* suffixes are 00 based hex rather than 01 based decimal (pty) */
00226 #define DRVR_STTY           0x0020 /* Driver gets ALL stty() calls */
00227 #define DRVR_NO_SUFFIX      0x0040 /* Suppress numeric suffix if only 1 device */
00228 #define DRVR_EOFHUP        0x0080 /* Force oneshot end-of-file after receiving HUP (pty) */
00229 
00230 /*
00231  * Define a set of IOCTL commands structures
00232  * which can be passed between DEV and the Driver
00233  * via the Ioctl() far-call function
00234  */
00235 
00236 /*
00237  * IOCTL 'type'
00238  */
00239 #define IOCTL_OPEN          0x0301 /* I/O channel open -   first open() */
00240 #define IOCTL_CLOSE         0x0302 /* I/O channel closed - last close() */
00241 #define IOCTL_CTL           0x0303 /* qnx_ioctl() */
00242 #define IOCTL_STARTBREAK    0x0304 /* Assert break condition (if possible) */
00243 #define IOCTL_STOPBREAK     0x0305 /* Remove the break condition */
00244 #define IOCTL_STARTDROP     0x0306 /* Lower modem control - drop communications line */
00245 #define IOCTL_STOPDROP      0x0307 /* return modem control to normal */
00246 
00247 /*
00248  * IOCTL 'status'
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;   /* IOCTL_OPEN: called before first open */
00260         short int unit;
00261       /*
00262        * The following are also available since 4.10 (DRVR_GETS_PID)
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;      /* addressable from Dev's context */
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; /* IOCTL_OPEN */
00278         short int unit;
00279         } open_return;
00280     struct ioctl_close {
00281         short int type;   /* IOCTL_CLOSE: called on last close */
00282         short int unit;
00283       /*
00284        * The following are also available since 4.10
00285        */
00286         pid_t     pid;
00287       short int fd;
00288       struct input_buffer  __far *ibuf;      /* addressable from Dev's context */
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; /* IOCTL_CLOSE */
00296         } close_return;
00297     struct ioctl_user {
00298         short int type;   /* User IOCTL */
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; /* User IOCTL */
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;   /* IOCTL_STARTBREAK */
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;   /* IOCTL_STOPBREAK */
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;   /* IOCTL_STARTDROP */
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;   /* IOCTL_STOPDROP */
00333         short int unit;
00334         } stopdrop;
00335     struct ioctl_stopdrop_return {
00336         short int status;
00337         } stopdrop_return;
00338     };
00339 
00340 /*
00341  * Message definitions solely for use by drivers
00342  */
00343 
00344 #ifdef __386__
00345 /*
00346  * 32 bit versions of Dev Support a differeent set of registration messages
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  * 16 bit versions of Dev Support the standard set of registration messages
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  * Calls made from Dev into entry points within driver
00421  */
00422 
00423 #ifdef __386__
00424 #pragma aux _dev_call far parm [es edi] value [eax] modify [eax];
00425     /*   ds is pre-loaded by dev before making the call.  */    
00426 #else
00427 #pragma aux _dev_call far parm [es di] value [ax] modify [ax];
00428     /*   ds is pre-loaded by dev before making the call.  */    
00429 #endif
00430 
00431 
00432 /*
00433  * Function prototypes
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

Generated on Sun Oct 14 18:46:40 2001 for Standard J2K Library by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001