home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Professional / OS2PRO194.ISO / os2 / prgramer / info / driver.txt < prev    next >
Text File  |  1992-06-03  |  24KB  |  577 lines

  1. The following is errata for Writing OS/2 2.0 Device Drivers in C as
  2. of 29 May, 1992.
  3.  
  4.  
  5. Page 9, last paragraph, line 2, replace "Figure 3-2" with "Figure
  6. 2-3"
  7.  
  8. Page 16, first paragraph, replace entire paragraph with:
  9.  
  10. "Processors are generally referred to by the size of the data which
  11.  can be handled at any one given time. The 8088 is referred to as a
  12.  16-bit processor, although technically it can only handle 8 bits at
  13.  a time (The 8088 performs 16-bit operations by transparently
  14.  multiplexing two 8-bit operations). The 80286, for example, is
  15.  called a 16-bit processor because it can handle data 16 bits at a
  16.  time. The 80386 and 80486 are referred to as 32-bit processors
  17.  because they can directly manipulate data 32 bits at a time."
  18.  
  19. Page 17, first paragraph, line 2, replace "eight-bit" with "16-bit"
  20.  
  21. Page 18, last paragraph, first sentence, replace "30" with "25".
  22.  
  23. Page 19, first paragraph, line 2, replace "25" with "33".
  24.  
  25. Page 19, last paragraph, third sentence which begins "The processor
  26. speed", delete entire sentence.
  27.  
  28. Page 49, last paragraph, second sentence, replace "Figure 5-3" with
  29. "Figure 5-5".
  30.  
  31. Page 308, Delete last paragraph, beginning with "Note", in its
  32. entirety.
  33.  
  34. Page 399, Listings, change "#define WRITE_POS_REG_CARD 0x0D" with
  35. "#define WRITE_POS_REG_CARD 0x0E"
  36.  
  37. Replace the listing for the standard driver include file in the
  38. LISTINGS section with the following listing:
  39.  
  40. /*  file drvlib.h
  41.     standard driver include file
  42. */
  43. typedef unsigned char   UCHAR;
  44. typedef unsigned short  USHORT;
  45. typedef unsigned short  BOOLEAN;
  46. typedef unsigned long   ULONG;
  47. typedef UCHAR near      *PUCHAR;
  48. typedef UCHAR far       *FPUCHAR;
  49. typedef USHORT near     *PUSHORT;
  50. typedef ULONG near      *PULONG;
  51. typedef char near       *PCHAR;
  52. typedef short near      *PSHORT;
  53. typedef long near       *PLONG; 
  54. typedef void near       *POINTER;
  55. typedef POINTER near    *PPOINTER;
  56. typedef void far        *FARPOINTER;  
  57. typedef FARPOINTER near *PFARPOINTER;
  58. typedef FARPOINTER far  *FPFARPOINTER;
  59.  
  60. typedef USHORT          ERRCODE;    /* error code returned                 */
  61. typedef ERRCODE far     *PERRCODE;  /* pointer to an error code            */
  62. typedef UCHAR           FLAG;       /* 8-bit flag                          */
  63. typedef FLAG far        *PFLAG;     /* pointer to 8-bit flag               */
  64. typedef USHORT          SEL;        /* 16-bit selector                     */
  65. typedef SEL near        *PSEL;      /* pointer to a selector               */
  66. typedef USHORT          SEG;        /* 16-bit segment                      */
  67. typedef USHORT          OFF;        /* 16-bit offset                       */
  68. typedef USHORT          PID;        /* Process ID                          */
  69. typedef USHORT          TID;        /* Task ID                             */
  70. typedef ULONG           PHYSADDR;   /* 32-bit physical address             */
  71. typedef PHYSADDR far    *PPHYSADDR; /* pointer to 32-bit physical address  */
  72. typedef char near       *PSTRING;   /* pointer to character string         */
  73. typedef USHORT          SHANDLE;    /* short (16-bit) handle               */
  74. typedef SHANDLE far     *PSHANDLE;  /* pointer to a short handle           */
  75. typedef ULONG           LHANDLE;    /* long  (32-bit) handle               */
  76. typedef LHANDLE far     *PLHANDLE;  /* pointer to a long handle            */
  77.  
  78. /*  pointers to functions */
  79.  
  80. typedef int (pascal near          *PFUNCTION) ();
  81. typedef int (pascal near * near  *PPFUNCTION) ();
  82. typedef int (pascal far          *FPFUNCTION) ();
  83. typedef int (pascal far  * near *PFPFUNCTION) ();
  84.  
  85. /* macros */
  86.  
  87. #define FALSE   0
  88. #define TRUE    1
  89.  
  90. #define NP near pascal
  91.  
  92. /* far pointer from selector-offset */
  93.  
  94. #define MAKEP(sel, off)     ( (void far *) MAKEULONG(off, sel) )
  95.  
  96. /* get selector or offset from far pointer */
  97.  
  98. #define SELECTOROF(p)       ( ((USHORT far *) &(p)) [1])
  99. #define OFFSETOF(p)         ( ((USHORT far *) &(p)) [0])
  100.  
  101. /* Combine l(ow) & h(igh) to form a 32 bit quantity. */
  102.  
  103. #define MAKEULONG(l, h)  ((ULONG)(((USHORT)(l)) | ((ULONG)((USHORT)(h))) << 16))
  104. #define MAKELONG(l, h)   ((LONG)MAKEULONG(l, h))
  105.  
  106. /* Combine l(ow) & h(igh) to form a 16 bit quantity. */
  107.  
  108. #define MAKEUSHORT(l, h) (((USHORT)(l)) | ((USHORT)(h)) << 8)
  109. #define MAKESHORT(l, h)  ((SHORT)MAKEUSHORT(l, h))
  110.  
  111. /* get high and low order parts of a 16 and 32 bit quantity */
  112.  
  113. #define LOBYTE(w)       LOUCHAR(w)
  114. #define HIBYTE(w)       HIUCHAR(w)
  115. #define LOUCHAR(w)      ((UCHAR)(w))
  116. #define HIUCHAR(w)      (((USHORT)(w) >> 8) & 0xff)
  117. #define LOUSHORT(l)     ((USHORT)(l))
  118. #define HIUSHORT(l)     ((USHORT)(((ULONG)(l) >> 16) & 0xffff))
  119.  
  120. /*  the driver device header */
  121.  
  122. typedef struct DeviceHdr {
  123.    struct DeviceHdr far *DHnext;    /* pointer to next header, or FFFF     */
  124.    USHORT DHattribute;              /* device attribute word               */
  125.    OFF    DHstrategy;               /* offset of strategy routine          */
  126.    OFF    DHidc;                    /* offset of IDC routine               */
  127.    UCHAR  DHname[8];                /* dev name (char) or #units (blk)     */
  128.    char   reserved[8];
  129.    ULONG  bit_strip;                /* bit 0 DevIOCtl2, bit 1 32 bit addr  */
  130.    } DEVICEHDR;
  131. typedef DEVICEHDR near *PDEVICEHDR;
  132.  
  133. /*  driver device attributes word */
  134.  
  135. #define DAW_CHR    0x8000           /* 1=char, 0=block                     */
  136. #define DAW_IDC    0x4000           /* 1=IDC available in this DD          */
  137. #define DAW_IBM    0x2000           /* 1=non-IBM block format              */
  138. #define DAW_SHR    0x1000           /* 1=supports shared device access     */
  139. #define DAW_OPN    0x0800           /* 1=open/close, or removable media    */
  140. #define DAW_LEVEL1 0x0080           /* level 1                             */
  141. #define DAW_LEVEL2 0x0100           /* level 2 DosDevIOCtl2                */
  142. #define DAW_LEVEL3 0x0180           /* level 3 bit strip                   */
  143. #define DAW_GIO    0x0040           /* 1=generic IOCtl supported           */
  144. #define DAW_CLK    0x0008           /* 1=CLOCK device                      */
  145. #define DAW_NUL    0x0004           /* 1=NUL device                        */
  146. #define DAW_SCR    0x0002           /* 1=STDOUT (screen)                   */
  147. #define DAW_KBD    0x0001           /* 1=STDIN  (keyboard)                 */
  148.  
  149. /* capabilities bit strip */
  150.  
  151. #define CBS_SHD    0x0001           /* 1=shutdown/DevIOCtl2                */
  152. #define CBS_HMEM   0x0002           /* hign memory map for adapters        */
  153. #define CBS_PP     0x0004           /* supports parallel ports             */
  154.  
  155. /* DispMsg structure */
  156.  
  157. typedef struct MessageTable {
  158.    USHORT      id;
  159.    USHORT      fill_in_item;
  160.    FARPOINTER  item1;
  161.    FARPOINTER  item2;
  162.    FARPOINTER  item_last;
  163.    } MESSAGETABLE;
  164.  
  165. /* OS/2 circular character queues */
  166.  
  167. #define QUEUE_SIZE  512             /*  size of queues                     */
  168. typedef struct CharQueue {
  169.    USHORT   qsize;                  /* number of bytes in queue            */
  170.    USHORT   qchrout;                /* index of next char to put out       */
  171.    USHORT   qcount;                 /* number of charactes in queue        */
  172.    UCHAR    qbuf[QUEUE_SIZE]; 
  173.    } CHARQUEUE;
  174. typedef CHARQUEUE near *PCHARQUEUE;
  175.  
  176. /* AttachDD inter device driver communication data area */
  177.  
  178. typedef struct AttachArea {
  179.    OFF realOFF;                     /* real-mode offset of idc entry point */
  180.    SEG realCS;                      /* real-mode CS of IDC entry point     */
  181.    SEG realDS;                      /* real-mode DS of IDC DD              */
  182.    OFF protOFF;                     /* protect-mode offset of entry point  */
  183.    SEL protCS;                      /* protect-mode CS of entry point      */
  184.    SEL protDS;                      /* protect-mode DS of other DD         */
  185.    } ATTACHAREA;
  186. typedef ATTACHAREA near *PATTACHAREA;
  187.  
  188. /* driver request packet */
  189.  
  190. typedef struct ReqPacket {
  191.    UCHAR RPlength;                  /* request packet length               */
  192.    UCHAR   RPunit;                  /* unit code for block DD only         */
  193.    UCHAR RPcommand;                 /* command code                        */
  194.    USHORT  RPstatus;                /* status word                         */
  195.    UCHAR   RPreserved[4];           /* reserved bytes                      */
  196.    ULONG RPqlink;                   /* queue linkage                       */
  197.    union {                          /* command-specific data               */
  198.    UCHAR   avail[19];               
  199.     struct {                        /* init                                */
  200.       UCHAR      units;             /* number of units                     */
  201.       FPFUNCTION DevHlp;            /* &DevHlp                             */
  202.       char far   *args;             /* &args                               */
  203.       UCHAR      drive;             /* drive #                             */
  204.       }Init;                        
  205.     struct { 
  206.       UCHAR     units;              /* same as input                       */
  207.       OFF       finalCS;            /* final offset, 1st code segment      */
  208.       OFF       finalDS;            /* final offset, 1st data segment      */
  209.       FARPOINTER BPBarray;          /* &BPB                                */
  210.       } InitExit;
  211.  
  212.     struct {                        /* read, write, write w/verify         */
  213.       UCHAR      media;             /* media descriptor                    */
  214.       PHYSADDR   buffer;            /* transfer address                    */
  215.       USHORT     count;             /* bytes/sectors                       */
  216.       ULONG      startsector;       /* starting sector#                    */
  217.       USHORT     reserved; 
  218.       } ReadWrite;                  
  219.  
  220.     struct {                        /* cached read, write, write w/verify  */
  221.       UCHAR      media;             /* media descriptor                    */
  222.       PHYSADDR   buffer;            /* transfer address                    */
  223.       USHORT     count;             /* bytes/sectors                       */
  224.       ULONG      startsector;       /* starting sector#                    */
  225.       USHORT     reserved; 
  226.       } CReadWrite;
  227.       
  228.     struct {                        /* system shutdown                     */
  229.       UCHAR      subcode;           /* sub request code                    */
  230.       ULONG      reserved;
  231.       } Shutdown;
  232.  
  233.     struct {                        /* open/close                          */
  234.       USHORT     sysfilenum;        /* system file number                  */
  235.       } OpenClose;
  236.  
  237.     struct {                        /* IOCtl                               */
  238.       UCHAR      category;          /* category code                       */
  239.       UCHAR      function;          /* function code                       */
  240.       FARPOINTER parameters;        /* ¶meters                         */
  241.       FARPOINTER buffer;            /* &buffer                             */
  242.       } IOCtl;                      
  243.  
  244.     struct {                        /* read, no wait                       */
  245.       UCHAR      char_returned;     /* char to return                      */
  246.       } ReadNoWait;                 
  247.  
  248.     struct {                        /* media check                         */
  249.       UCHAR      media;             /* media descriptor                    */
  250.       UCHAR      return_code;       /* see #defines                        */
  251.       FARPOINTER prev_volume;       /* &previous volume ID                 */
  252.       } MediaCheck;                 
  253.  
  254.     struct {                        /* build BPB                           */
  255.       UCHAR      media;             /* media descriptor                    */
  256.       FARPOINTER buffer;            /* 1-sector buffer FAT                 */
  257.       FARPOINTER BPBarray;          /* &BPB array                          */
  258.       UCHAR      drive;             /* drive #                             */
  259.       } BuildBPB;                   
  260.                                                                              
  261.     struct {                        /* query partitionalble fixed disks    */
  262.       UCHAR      count;             /* # disks                             */
  263.       ULONG      reserved;
  264.       } Partitionable;              
  265.      
  266.     struct {                        /* fixed disk LU map                   */
  267.       ULONG      units;             /* units supported                     */
  268.       ULONG      reserved;
  269.       } GetFixedMap;  
  270.  
  271.     struct {                        /* get driver capabilities             */
  272.       UCHAR      reserved[3];
  273.       FARPOINTER capstruct;         /* 16:16 pointer to DCS                */
  274.       FARPOINTER volcharstruct;     /* 16:16 pointer to VCS                */
  275.       } GetDriverCaps;
  276.               
  277.    } s;                             /* command info                        */
  278. } REQPACKET;
  279.  
  280. typedef REQPACKET far *PREQPACKET;
  281. typedef PREQPACKET far *PPREQPACKET;
  282. typedef PREQPACKET QHEAD;           /* Queue Head is &ReqPacket            */
  283. typedef QHEAD near *PQHEAD;
  284.  
  285. /* Global Info Seg */
  286.  
  287. typedef struct _GINFOSEG {      
  288.     ULONG   time;
  289.     ULONG   msecs;
  290.     UCHAR   hour;
  291.     UCHAR   minutes;
  292.     UCHAR   seconds;
  293.     UCHAR   hundredths;
  294.     USHORT  timezone;
  295.     USHORT  cusecTimerInterval;
  296.     UCHAR   day;
  297.     UCHAR   month;
  298.     USHORT  year;
  299.     UCHAR   weekday;
  300.     UCHAR   uchMajorVersion;
  301.     UCHAR   uchMinorVersion;
  302.     UCHAR   chRevisionLetter;
  303.     UCHAR   sgCurrent;
  304.     UCHAR   sgMax;
  305.     UCHAR   cHugeShift;
  306.     UCHAR   fProtectModeOnly;
  307.     USHORT  pidForeground;
  308.     UCHAR   fDynamicSched;
  309.     UCHAR   csecMaxWait;
  310.     USHORT  cmsecMinSlice;
  311.     USHORT  cmsecMaxSlice;
  312.     USHORT  bootdrive;
  313.     UCHAR   amecRAS[32];
  314.     UCHAR   csgWindowableVioMax;
  315.     UCHAR   csgPMMax;
  316. } GINFOSEG;
  317. typedef GINFOSEG far *PGINFOSEG;
  318.  
  319. /* local info seg */
  320.  
  321. typedef struct _LINFOSEG {      
  322.     PID     pidCurrent;
  323.     PID     pidParent;
  324.     USHORT  prtyCurrent;
  325.     TID     tidCurrent;
  326.     USHORT  sgCurrent;
  327.     UCHAR   rfProcStatus;
  328.     UCHAR   dummy1;
  329.     USHORT  fForeground;
  330.     UCHAR   typeProcess;
  331.     UCHAR   dummy2;
  332.     SEL     selEnvironment;
  333.     USHORT  offCmdLine;
  334.     USHORT  cbDataSegment;
  335.     USHORT  cbStack;
  336.     USHORT  cbHeap;
  337.     USHORT  hmod;
  338.     SEL     selDS;
  339. } LINFOSEG;
  340. typedef LINFOSEG far *PLINFOSEG;
  341.  
  342. /* mainifest constants */
  343.  
  344. /* RPstatus bit values */
  345.  
  346. #define RPERR   0x8000              /*  error occurred, err in RPstatus    */
  347. #define RPDEV   0x4000              /*  error code defined by driver       */
  348. #define RPBUSY  0x0200              /*  device is busy                     */
  349. #define RPDONE  0x0100              /*  driver done with request packet    */
  350.  
  351. /* error codes returned in RPstatus */
  352.  
  353. #define ERROR_WRITE_PROTECT         0x0000
  354. #define ERROR_BAD_UNIT              0x0001
  355. #define ERROR_NOT_READY             0x0002
  356. #define ERROR_BAD_COMMAND           0x0003
  357. #define ERROR_CRC                   0x0004
  358. #define ERROR_BAD_LENGTH            0x0005    
  359. #define ERROR_SEEK                  0x0006
  360. #define ERROR_NOT_DOS_DISK          0x0007
  361. #define ERROR_SECTOR_NOT_FOUND      0x0008
  362. #define ERROR_OUT_OF_PAPER          0x0009
  363. #define ERROR_WRITE_FAULT           0x000A
  364. #define ERROR_READ_FAULT            0x000B
  365. #define ERROR_GEN_FAILURE           0x000C
  366. #define ERROR_DISK_CHANGE           0x000D
  367. #define ERROR_WRONG_DISK            0x000F
  368. #define ERROR_UNCERTAIN_MEDIA       0x0010
  369. #define ERROR_CHAR_CALL_INTERRUPTED 0x0011
  370. #define ERROR_NO_MONITOR_SUPPORT    0x0012
  371. #define ERROR_INVALID_PARAMETER     0x0013
  372. #define ERROR_DEVICE_IN_USE         0x0014
  373.  
  374. /* driver request codes  B=block, C=character */
  375.  
  376. #define RPINIT          0x00        /*  BC                                 */
  377. #define RPMEDIA_CHECK   0x01        /*  B                                  */
  378. #define RPBUILD_BPB     0x02        /*  B                                  */
  379. #define RPREAD          0x04        /*  BC                                 */
  380. #define RPREAD_NO_WAIT  0x05        /*   C                                 */
  381. #define RPINPUT_STATUS  0x06        /*   C                                 */
  382. #define RPINPUT_FLUSH   0x07        /*   C                                 */
  383. #define RPWRITE         0x08        /*  BC                                 */
  384. #define RPWRITE_VERIFY  0x09        /*  BC                                 */
  385. #define RPOUTPUT_STATUS 0x0a        /*   C                                 */
  386. #define RPOUTPUT_FLUSH  0x0b        /*   C                                 */
  387. #define RPOPEN          0x0d        /*  BC                                 */
  388. #define RPCLOSE         0x0e        /*  BC                                 */
  389. #define RPREMOVABLE     0x0f        /*  B                                  */
  390. #define RPIOCTL         0x10        /*  BC                                 */
  391. #define RPRESET         0x11        /*  B                                  */
  392. #define RPGET_DRIVE_MAP 0x12        /*  B                                  */
  393. #define RPSET_DRIVE_MAP 0x13        /*  B                                  */
  394. #define RPDEINSTALL     0x14        /*   C                                 */
  395. #define RPPARTITIONABLE 0x16        /*  B                                  */
  396. #define RPGET_FIXED_MAP 0x17        /*  B                                  */
  397. #define RPSHUTDOWN      0x1c        /*  BC                                 */
  398. #define RPGET_DRIVER_CAPS 0x1d      /*  B                                  */
  399.  
  400. /* check for monitor call in DosOpen/DosClose */
  401.  
  402. #define MON_OPEN_STATUS   0x08      /* open from DosMonOpen                */
  403. #define MON_CLOSE_STATUS  0x08      /* close from DosMonClose              */
  404.  
  405. /* media descriptor byte */
  406.  
  407. #define MDB_REMOVABLE     0x04      /*  1=removable                        */
  408. #define MDB_EIGHT_SECTORS 0x02      /*  1=8 sectors per track              */
  409. #define MDB_DOUBLE_SIDED  0x01      /*  1=double-sided media               */
  410.  
  411. /* return codes from MediaCheck */
  412.  
  413. #define MC_MEDIA_UNCHANGED 0x01
  414. #define MC_MEDIA_CHANGED   0xFF
  415. #define MC_MEDIA_UNSURE    0x01
  416.  
  417. /* event numbers for SendEvent */
  418.  
  419. #define EVENT_SM_MOUSE   0x00       /* session switch via mouse            */
  420. #define EVENT_CTRLBRK    0x01       /* control break                       */
  421. #define EVENT_CTRLC      0x02       /* control C                           */
  422. #define EVENT_CTRLNUMLK  0x03       /* control num lock                    */
  423. #define EVENT_CTRLPRTSC  0x04       /* control printscreen                 */
  424. #define EVENT_SHFTPRTSC  0x05       /* shift printscreen                   */
  425. #define EVENT_SM_KBD     0x06       /* session switch hot key              */
  426.  
  427. /* MCA specific */
  428.  
  429. int NP GetLIDEntry (USHORT, USHORT, USHORT, FARPOINTER);
  430. int NP FreeLIDEntry (USHORT);
  431. int NP ABIOSCall (USHORT, USHORT, FARPOINTER);
  432. int NP ABIOSComm (USHORT, FARPOINTER);
  433.  
  434. /* special routines */
  435.  
  436. void NP INT3  (void);
  437. void NP Enable  (void);
  438. void NP Disable  (void);
  439. void NP Abort  (void);
  440. int  NP SegLimit (SEL, OFF far *);
  441. int  NP MoveBytes (FARPOINTER,FARPOINTER,USHORT);
  442.  
  443. /* system services and misc. */
  444.  
  445. int  NP GetDOSVar (UCHAR, FPFARPOINTER);
  446. int  NP SendEvent (UCHAR, USHORT);
  447. void NP SchedClockAddr (PFARPOINTER);
  448. int  NP AttachDD (PSTRING, PATTACHAREA);
  449.  
  450. /* process mgmt */
  451.  
  452. void NP Yield  (void);
  453. void NP TCYield  (void);
  454. int  NP Block  (ULONG, ULONG, FLAG, PERRCODE);
  455. void NP Run  (ULONG);
  456. void NP DevDone  (ULONG);
  457.  
  458. /* memory management */
  459.  
  460. int  NP AllocPhys (ULONG, FLAG, PPHYSADDR);
  461. int  NP FreePhys (PHYSADDR);
  462. int  NP VerifyAccess (SEL, OFF, USHORT, FLAG);
  463. int  NP LockSeg  (SEL, FLAG, FLAG, PLHANDLE);
  464. int  NP UnLockSeg (LHANDLE);
  465.  
  466. /* address conversion */
  467.  
  468. int  NP AllocGDTSelector(USHORT, FARPOINTER);
  469. int  NP PhysToGDTSelector(PHYSADDR, USHORT, SEL, PERRCODE);
  470. int  NP VirtToPhys (FARPOINTER, PPHYSADDR);
  471. int  NP PhysToUVirt (PHYSADDR, USHORT, FLAG, FPFARPOINTER);
  472. int  NP PhysToVirt (PHYSADDR, USHORT, USHORT, FARPOINTER);
  473. int  NP UnPhysToVirt (void);
  474.  
  475. /* request packet queue stuff */
  476.  
  477. int  NP AllocReqPacket (FLAG, PPREQPACKET);
  478. void NP FreeReqPacket (PREQPACKET);
  479. void NP PushReqPacket (PQHEAD, PREQPACKET);
  480. void NP SortReqPacket (PQHEAD, PREQPACKET);
  481. int  NP PullReqPacket (PQHEAD, PPREQPACKET);
  482. int  NP PullParticular  (PQHEAD, PREQPACKET);
  483.  
  484. /* driver semaphores */
  485.  
  486. int  NP SemHandle (LHANDLE, FLAG, PLHANDLE);
  487. int  NP SemRequest (LHANDLE, ULONG, PERRCODE);
  488. void NP SemClear (LHANDLE);
  489.  
  490. /* circular character queues */
  491.  
  492. void NP QueueInit (PCHARQUEUE);
  493. void NP QueueFlush (PCHARQUEUE);
  494. int  NP QueueWrite (PCHARQUEUE, UCHAR);
  495. int  NP QueueRead (PCHARQUEUE, FPUCHAR);
  496.  
  497. /* interrupt stuff */
  498.  
  499. int  NP SetIRQ  (UCHAR, PFUNCTION, FLAG);
  500. int  NP UnSetIRQ (UCHAR);
  501. int  NP EOI  (UCHAR);
  502.  
  503. /* timer stuff */
  504.  
  505. int  NP SetTimer (PFUNCTION);
  506. int  NP ResetTimer (PFUNCTION);
  507. int  NP TickCount (PFUNCTION, USHORT);
  508.  
  509. /* device monitors */
  510.  
  511. int  NP MonCreate (PSHANDLE, FARPOINTER, FARPOINTER, PERRCODE);
  512. int  NP Register (SHANDLE, FLAG, PID, FARPOINTER, OFF, PERRCODE);
  513. int  NP MonWrite (SHANDLE, POINTER, USHORT, FLAG, PERRCODE);
  514. int  NP MonFlush (SHANDLE, PERRCODE);
  515. int  NP DeRegister (SHANDLE, PID, PERRCODE);
  516.  
  517. /* 2.0  specfic */
  518.  
  519. int  NP RegisterPDD(FPUCHAR,FPFUNCTION);       
  520. int  NP RegisterBeep(FPFUNCTION);      
  521. int  NP Beep(USHORT,USHORT);              
  522. int  NP FreeGDTSelector(USHORT);   
  523. int  NP PhysToGDTSel(PHYSADDR,USHORT,USHORT,PERRCODE);      
  524. int  NP VMLock(PHYSADDR,ULONG,FARPOINTER,PLHANDLE,ULONG,PULONG);            
  525. int  NP VMUnlock(LHANDLE);          
  526. int  NP VMAlloc(PHYSADDR,ULONG,ULONG,PFARPOINTER);           
  527. int  NP VMFree(PHYSADDR);            
  528. int  NP VMProcessToGlobal(PHYSADDR,ULONG,ULONG,PFARPOINTER); 
  529. int  NP VMGlobalToProcess(PHYSADDR,ULONG,ULONG,FPFARPOINTER); 
  530. int  NP VirtToLin(SEL,ULONG,PFARPOINTER);         
  531. int  NP LinToGDTSelector(SEL,PHYSADDR,ULONG);  
  532. int  NP GetDescInfo(SEL,PUSHORT,PULONG,PULONG);       
  533. int  NP LinToPageList(PHYSADDR,ULONG,FPFARPOINTER,PULONG);     
  534. int  NP PageListToLin(ULONG,FPFARPOINTER,PULONG);     
  535. int  NP PageListToGDTSelector(SEL,ULONG,FPFARPOINTER,USHORT,PSEL);
  536. int  NP RegisterTmrDD(FARPOINTER,FARPOINTER,FARPOINTER);     
  537. int  NP AllocateCtxHook(OFF,ULONG,PULONG);   
  538. int  NP FreeCtxHook(LHANDLE);       
  539. int  NP ArmCtxHook(ULONG,LHANDLE,ULONG);        
  540. int  NP VMSetMem(PHYSADDR,ULONG,ULONG);          
  541. int  NP OpenEventSem(LHANDLE);      
  542. int  NP CloseEventSem(LHANDLE);     
  543. int  NP PostEventSem(LHANDLE);      
  544. int  NP ResetEventSem(LHANDLE,ULONG);     
  545. int  NP DynamicAPI(FARPOINTER,USHORT,USHORT);
  546.  
  547. /* these are the only API's available to the driver at Init time */
  548.  
  549. #define APIENTRY far pascal
  550.  
  551. USHORT APIENTRY DosBeep(USHORT, USHORT);
  552. USHORT APIENTRY DosCaseMap(USHORT, FARPOINTER, FARPOINTER);
  553. USHORT APIENTRY DosChgFilePtr(SHANDLE, long, USHORT, FARPOINTER);
  554. USHORT APIENTRY DosClose(SHANDLE);
  555. USHORT APIENTRY DosDelete(FARPOINTER, ULONG);
  556. USHORT APIENTRY DosDevConfig(FARPOINTER, USHORT, USHORT);
  557. USHORT APIENTRY DosDevIOCtl(FARPOINTER, FARPOINTER, USHORT, USHORT, USHORT);
  558. USHORT APIENTRY DosFindClose(SHANDLE);
  559. USHORT APIENTRY DosFindFirst(FARPOINTER, FARPOINTER, USHORT, FARPOINTER, 
  560.         USHORT, FARPOINTER, ULONG);
  561. USHORT APIENTRY DosFindNext(SHANDLE, FARPOINTER, USHORT, FARPOINTER);
  562. USHORT APIENTRY DosGetEnv(FARPOINTER, FARPOINTER);
  563. USHORT APIENTRY DosGetMessage(FARPOINTER, USHORT, FARPOINTER, USHORT, 
  564.          USHORT, FARPOINTER, FARPOINTER);
  565. USHORT APIENTRY DosOpen(FARPOINTER, FARPOINTER, FARPOINTER, ULONG, 
  566.    USHORT, USHORT, USHORT, ULONG);
  567. USHORT APIENTRY DosPutMessage(SHANDLE, USHORT, FARPOINTER);
  568. USHORT APIENTRY DosQCurDir(USHORT, FARPOINTER, FARPOINTER);
  569. USHORT APIENTRY DosQCurDisk(FARPOINTER, FARPOINTER);
  570. USHORT APIENTRY DosQFileInfo(SHANDLE, USHORT, FARPOINTER, USHORT);
  571. USHORT APIENTRY DosQFileMode(FARPOINTER, FARPOINTER, ULONG);
  572. USHORT APIENTRY DosRead(SHANDLE, FARPOINTER, USHORT, FARPOINTER);
  573. USHORT APIENTRY DosWrite(SHANDLE, FARPOINTER, USHORT, FARPOINTER);
  574.  
  575. /* end of DRVLIB.H */
  576.  
  577.