home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / ddrivers.zip / MMAP / DRVLIB.H < prev    next >
Text File  |  1992-12-23  |  25KB  |  587 lines

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