home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / cdisk.zip / INCLUDE / DRVLIB.H < prev   
Text File  |  1993-04-23  |  25KB  |  589 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. #define CBS_ADD    0x0010           // driver is an ADD
  128. #define CBS_INIT   010020           // driver receives InitComplete    
  129.  
  130. // SaveMessage structure 
  131.  
  132. typedef struct MessageTable {
  133.    USHORT      id;
  134.    USHORT      fill_in_item;
  135.    FARPOINTER  item1;
  136.    FARPOINTER  item2;
  137.    FARPOINTER  item_last;
  138.    } MESSAGETABLE;
  139.  
  140. // OS/2 circular character queues 
  141.  
  142. #define QUEUE_SIZE  512             //  size of queues                     
  143. typedef struct CharQueue {
  144.    USHORT   qsize;                  // number of bytes in queue            
  145.    USHORT   qchrout;                // index of next char to put out       
  146.    USHORT   qcount;                 // number of charactes in queue        
  147.    UCHAR    qbuf[QUEUE_SIZE]; 
  148.    } CHARQUEUE;
  149. typedef CHARQUEUE near *PCHARQUEUE;
  150.  
  151. // AttachDD inter device driver communication data area 
  152.  
  153. typedef struct AttachArea {
  154.    OFF realOFF;                     // real-mode offset of idc entry point 
  155.    SEG realCS;                      // real-mode CS of IDC entry point     
  156.    SEG realDS;                      // real-mode DS of IDC DD              
  157.    OFF protOFF;                     // protect-mode offset of entry point  
  158.    SEL protCS;                      // protect-mode CS of entry point      
  159.    SEL protDS;                      // protect-mode DS of other DD         
  160.    } ATTACHAREA;
  161. typedef ATTACHAREA near *PATTACHAREA;
  162.  
  163. // driver request packet 
  164.  
  165. typedef struct ReqPacket {
  166.    UCHAR RPlength;                  // request packet length               
  167.    UCHAR   RPunit;                  // unit code for block DD only         
  168.    UCHAR RPcommand;                 // command code                        
  169.    USHORT  RPstatus;                // status word                         
  170.    UCHAR   RPreserved[4];           // reserved bytes                      
  171.    ULONG RPqlink;                   // queue linkage                       
  172.    union {                          // command-specific data               
  173.    UCHAR   avail[19];               
  174.     struct {                        // init                                
  175.       UCHAR      units;             // number of units                     
  176.       FPFUNCTION DevHlp;            // &DevHlp                             
  177.       char far   *args;             // &args                               
  178.       UCHAR      drive;             // drive #                             
  179.       }Init;                        
  180.     struct { 
  181.       UCHAR     units;              // same as input                       
  182.       OFF       finalCS;            // final offset, 1st code segment      
  183.       OFF       finalDS;            // final offset, 1st data segment      
  184.       FARPOINTER BPBarray;          // &BPB                                
  185.       } InitExit;
  186.  
  187.     struct {                        // read, write, write w/verify         
  188.       UCHAR      media;             // media descriptor                    
  189.       PHYSADDR   buffer;            // transfer address                    
  190.       USHORT     count;             // bytes/sectors                       
  191.       ULONG      startsector;       // starting sector#                    
  192.       USHORT     reserved; 
  193.       } ReadWrite;                  
  194.  
  195.     struct {                        // cached read, write, write w/verify  
  196.       UCHAR      media;             // media descriptor                    
  197.       PHYSADDR   buffer;            // transfer address                    
  198.       USHORT     count;             // bytes/sectors                       
  199.       ULONG      startsector;       // starting sector#                    
  200.       USHORT     reserved; 
  201.       } CReadWrite;
  202.       
  203.     struct {                        // system shutdown                     
  204.       UCHAR      subcode;           // sub request code                    
  205.       ULONG      reserved;
  206.       } Shutdown;
  207.  
  208.     struct {                        // open/close                          
  209.       USHORT     sysfilenum;        // system file number                  
  210.       } OpenClose;
  211.  
  212.     struct {                        // IOCtl                               
  213.       UCHAR      category;          // category code                       
  214.       UCHAR      function;          // function code                       
  215.       FARPOINTER parameters;        // ¶meters                         
  216.       FARPOINTER buffer;            // &buffer                             
  217.       } IOCtl;                      
  218.  
  219.     struct {                        // read, no wait                       
  220.       UCHAR      char_returned;     // char to return                      
  221.       } ReadNoWait;                 
  222.  
  223.     struct {                        // media check                         
  224.       UCHAR      media;             // media descriptor                    
  225.       UCHAR      return_code;       // see #defines                        
  226.       FARPOINTER prev_volume;       // &previous volume ID                 
  227.       } MediaCheck;                 
  228.  
  229.     struct {                        // build BPB                           
  230.       UCHAR      media;             // media descriptor                    
  231.       FARPOINTER buffer;            // 1-sector buffer FAT                 
  232.       FARPOINTER BPBarray;          // &BPB array                          
  233.       UCHAR      drive;             // drive #                             
  234.       } BuildBPB;                   
  235.                                                                              
  236.     struct {                        // query partitionalble fixed disks    
  237.       UCHAR      count;             // # disks                             
  238.       ULONG      reserved;
  239.       } Partitionable;              
  240.      
  241.     struct {                        // fixed disk LU map                   
  242.       ULONG      units;             // units supported                     
  243.       ULONG      reserved;
  244.       } GetFixedMap;  
  245.  
  246.     struct {                        // get driver capabilities             
  247.       UCHAR      reserved[3];
  248.       FARPOINTER capstruct;         // 16:16 pointer to DCS                
  249.       FARPOINTER volcharstruct;     // 16:16 pointer to VCS                
  250.       } GetDriverCaps;
  251.               
  252.    } s;                             // command info                        
  253. } REQPACKET;
  254.  
  255. typedef REQPACKET far *PREQPACKET;
  256. typedef PREQPACKET far *PPREQPACKET;
  257. typedef PREQPACKET QHEAD;           // Queue Head is &ReqPacket            
  258. typedef QHEAD near *PQHEAD;
  259.  
  260. // Global Info Seg 
  261.  
  262. typedef struct _GINFOSEG {      
  263.     ULONG   time;
  264.     ULONG   msecs;
  265.     UCHAR   hour;
  266.     UCHAR   minutes;
  267.     UCHAR   seconds;
  268.     UCHAR   hundredths;
  269.     USHORT  timezone;
  270.     USHORT  cusecTimerInterval;
  271.     UCHAR   day;
  272.     UCHAR   month;
  273.     USHORT  year;
  274.     UCHAR   weekday;
  275.     UCHAR   uchMajorVersion;
  276.     UCHAR   uchMinorVersion;
  277.     UCHAR   chRevisionLetter;
  278.     UCHAR   sgCurrent;
  279.     UCHAR   sgMax;
  280.     UCHAR   cHugeShift;
  281.     UCHAR   fProtectModeOnly;
  282.     USHORT  pidForeground;
  283.     UCHAR   fDynamicSched;
  284.     UCHAR   csecMaxWait;
  285.     USHORT  cmsecMinSlice;
  286.     USHORT  cmsecMaxSlice;
  287.     USHORT  bootdrive;
  288.     UCHAR   amecRAS[32];
  289.     UCHAR   csgWindowableVioMax;
  290.     UCHAR   csgPMMax;
  291. } GINFOSEG;
  292. typedef GINFOSEG far *PGINFOSEG;
  293.  
  294. // local info seg 
  295.  
  296. typedef struct _LINFOSEG {      
  297.     PID     pidCurrent;
  298.     PID     pidParent;
  299.     USHORT  prtyCurrent;
  300.     TID     tidCurrent;
  301.     USHORT  sgCurrent;
  302.     UCHAR   rfProcStatus;
  303.     UCHAR   dummy1;
  304.     USHORT  fForeground;
  305.     UCHAR   typeProcess;
  306.     UCHAR   dummy2;
  307.     SEL     selEnvironment;
  308.     USHORT  offCmdLine;
  309.     USHORT  cbDataSegment;
  310.     USHORT  cbStack;
  311.     USHORT  cbHeap;
  312.     USHORT  hmod;
  313.     SEL     selDS;
  314. } LINFOSEG;
  315.  
  316. typedef LINFOSEG far *PLINFOSEG;
  317.  
  318. typedef struct _REGSTACK {          // stack usgae structure                    
  319.     USHORT  usStruct;                    // set to 14 before using              
  320.      USHORT  usFlags;                        // 0x01 means that the interrupt proc  
  321.                                      // enables interrupts. All others resvd
  322.      USHORT  usIRQ;                        // IRQ of interrupt handler            
  323.      USHORT  usStackCLI;             // # of stack bytes with interrupts off
  324.      USHORT  usStackSTI;             // # of stack bytes with interrupts on 
  325.      USHORT  usStackEOI;                    // number of bytes needed after EOI    
  326.      USHORT  usNest;                        // max number of nested levels         
  327.      } REGSTACK;
  328.  
  329. typedef REGSTACK near *PREGSTACK;
  330.  
  331. // page list struct 
  332.  
  333. typedef struct _PAGELIST {
  334.     ULONG pl_Physaddr;
  335.      ULONG pl_cb;
  336.      } PAGELIST;
  337. typedef PAGELIST far *PPAGELIST;
  338.  
  339. // RPstatus bit values 
  340.  
  341. #define RPERR   0x8000              //  error occurred, err in RPstatus    
  342. #define RPDEV   0x4000              //  error code defined by driver       
  343. #define RPBUSY  0x0200              //  device is busy                     
  344. #define RPDONE  0x0100              //  driver done with request packet    
  345.  
  346. // error codes returned in RPstatus 
  347.  
  348. #define ERROR_WRITE_PROTECT         0x0000
  349. #define ERROR_BAD_UNIT              0x0001
  350. #define ERROR_NOT_READY             0x0002
  351. #define ERROR_BAD_COMMAND           0x0003
  352. #define ERROR_CRC                   0x0004
  353. #define ERROR_BAD_LENGTH            0x0005    
  354. #define ERROR_SEEK                  0x0006
  355. #define ERROR_NOT_DOS_DISK          0x0007
  356. #define ERROR_SECTOR_NOT_FOUND      0x0008
  357. #define ERROR_OUT_OF_PAPER          0x0009
  358. #define ERROR_WRITE_FAULT           0x000A
  359. #define ERROR_READ_FAULT            0x000B
  360. #define ERROR_GEN_FAILURE           0x000C
  361. #define ERROR_DISK_CHANGE           0x000D
  362. #define ERROR_WRONG_DISK            0x000F
  363. #define ERROR_UNCERTAIN_MEDIA       0x0010
  364. #define ERROR_CHAR_CALL_INTERRUPTED 0x0011
  365. #define ERROR_NO_MONITOR_SUPPORT    0x0012
  366. #define ERROR_INVALID_PARAMETER     0x0013
  367. #define ERROR_DEVICE_IN_USE         0x0014
  368.  
  369. // driver request codes  B=block, C=character 
  370.  
  371. #define RPINIT          0x00        //  BC                                 
  372. #define RPMEDIA_CHECK   0x01        //  B                                  
  373. #define RPBUILD_BPB     0x02        //  B                                  
  374. #define RPREAD          0x04        //  BC                                 
  375. #define RPREAD_NO_WAIT  0x05        //   C                                 
  376. #define RPINPUT_STATUS  0x06        //   C                                 
  377. #define RPINPUT_FLUSH   0x07        //   C                                 
  378. #define RPWRITE         0x08        //  BC                                 
  379. #define RPWRITE_VERIFY  0x09        //  BC                                 
  380. #define RPOUTPUT_STATUS 0x0a        //   C                                 
  381. #define RPOUTPUT_FLUSH  0x0b        //   C                                 
  382. #define RPOPEN          0x0d        //  BC                                 
  383. #define RPCLOSE         0x0e        //  BC                                 
  384. #define RPREMOVABLE     0x0f        //  B                                  
  385. #define RPIOCTL         0x10        //  BC                                 
  386. #define RPRESET         0x11        //  B                                  
  387. #define RPGET_DRIVE_MAP 0x12        //  B                                  
  388. #define RPSET_DRIVE_MAP 0x13        //  B                                  
  389. #define RPDEINSTALL     0x14        //   C                                 
  390. #define RPPARTITIONABLE 0x16        //  B                                  
  391. #define RPGET_FIXED_MAP 0x17        //  B                                  
  392. #define RPSHUTDOWN      0x1c        //  BC                                 
  393. #define RPGET_DRIVER_CAPS 0x1d      //  B                                  
  394.  
  395. // check for monitor call in DosOpen/DosClose 
  396.  
  397. #define MON_OPEN_STATUS   0x08      // open from DosMonOpen                
  398. #define MON_CLOSE_STATUS  0x08      // close from DosMonClose              
  399.  
  400. // media descriptor byte 
  401.  
  402. #define MDB_REMOVABLE     0x04      //  1=removable                        
  403. #define MDB_EIGHT_SECTORS 0x02      //  1=8 sectors per track              
  404. #define MDB_DOUBLE_SIDED  0x01      //  1=double-sided media               
  405.  
  406. // return codes from MediaCheck 
  407.  
  408. #define MC_MEDIA_UNCHANGED 0x01
  409. #define MC_MEDIA_CHANGED   0xFF
  410. #define MC_MEDIA_UNSURE    0x00
  411.  
  412. // event numbers for SendEvent 
  413.  
  414. #define EVENT_SM_MOUSE   0x00       // session switch via mouse            
  415. #define EVENT_CTRLBRK    0x01       // control break                       
  416. #define EVENT_CTRLC      0x02       // control C                           
  417. #define EVENT_CTRLNUMLK  0x03       // control num lock                    
  418. #define EVENT_CTRLPRTSC  0x04       // control printscreen                 
  419. #define EVENT_SHFTPRTSC  0x05       // shift printscreen                   
  420. #define EVENT_SM_KBD     0x06       // session switch hot key              
  421.  
  422. // defines for 1.x movedata function 
  423.  
  424. #define   MOVE_PHYSTOPHYS   0       // move bytes from phys to phys memory 
  425. #define   MOVE_PHYSTOVIRT   1       // move bytes from phys to virt memory 
  426. #define   MOVE_VIRTTOPHYS   2       // move bytes from virt to phys memory 
  427. #define   MOVE_VIRTTOVIRT   3       // move bytes from virt to virt memory 
  428.  
  429. // Micro Channel specific 
  430.  
  431. int NP GetLIDEntry (USHORT, USHORT, USHORT, FPUSHORT);
  432. int NP FreeLIDEntry (USHORT);
  433. int NP ABIOSCall (USHORT, USHORT, FARPOINTER);
  434. int NP ABIOSComm (USHORT, FARPOINTER);
  435. int NP GetDeviceBlock(USHORT, FARPOINTER);
  436.  
  437. // special routines 
  438.  
  439. void NP INT3  (void);
  440. void NP Enable  (void);
  441. void NP Disable  (void);
  442. void NP Abort  (void);
  443. int  NP SegLimit (SEL, OFF far *);
  444. int  NP MoveBytes (FARPOINTER,FARPOINTER,FLAG);
  445. int  NP MoveData (FARPOINTER, FARPOINTER, USHORT, USHORT);
  446.  
  447. // system services and misc. 
  448.  
  449. int  NP GetDOSVar (USHORT, FPFARPOINTER);
  450. int  NP SendEvent (USHORT, USHORT);
  451. void NP SchedClockAddr (PFARPOINTER);
  452. int  NP AttachDD (PSTRING, PATTACHAREA);
  453. int  NP InternalError(PSTRING,USHORT);
  454. int  NP SaveMessage(FPSTRING);
  455. int  NP ProtToReal(void);
  456. int  NP RealToProt(void);
  457. int  NP SetROMVector(USHORT,PFUNCTION,PFUNCTION,FARPOINTER);
  458.  
  459. // process mgmt 
  460.  
  461. void NP Yield  (void);
  462. void NP TCYield  (void);
  463. int  NP Block  (ULONG, ULONG, USHORT, FARPOINTER);
  464. void NP Run  (ULONG);
  465. void NP DevDone  (PREQPACKET);
  466. int  NP VideoPause(USHORT);
  467.  
  468. // memory management 
  469.  
  470. int  NP AllocPhys (ULONG, USHORT, PPHYSADDR);
  471. int  NP FreePhys (PHYSADDR);
  472. int  NP VerifyAccess (SEL, OFF, USHORT, USHORT);
  473. int  NP LockSeg  (SEL, USHORT, USHORT, PLHANDLE);
  474. int  NP UnLockSeg (LHANDLE);
  475.  
  476. // address conversion 
  477.  
  478. int  NP AllocGDTSelector(USHORT, FARPOINTER);
  479. int  NP PhysToGDTSelector(PHYSADDR, USHORT, SEL, PERRCODE);
  480. int  NP VirtToPhys (FARPOINTER, PPHYSADDR);
  481. int  NP PhysToUVirt (PHYSADDR, USHORT, USHORT, FPFARPOINTER);
  482. int  NP PhysToVirt (PHYSADDR, USHORT, USHORT, FARPOINTER);
  483. int  NP UnPhysToVirt (void);
  484.  
  485. // request packet queue stuff 
  486.  
  487. int  NP AllocReqPacket (USHORT, PPREQPACKET);
  488. void NP FreeReqPacket (PREQPACKET);
  489. void NP PushReqPacket (PQHEAD, PREQPACKET);
  490. void NP SortReqPacket (PQHEAD, PREQPACKET);
  491. int  NP PullReqPacket (PQHEAD, PPREQPACKET);
  492. int  NP PullParticular  (PQHEAD, PREQPACKET);
  493.  
  494. // driver semaphores 
  495.  
  496. int  NP SemHandle (LHANDLE, FLAG, PLHANDLE);
  497. int  NP SemRequest (LHANDLE, ULONG, PERRCODE);
  498. void NP SemClear (LHANDLE);
  499.  
  500. // circular character queues 
  501.  
  502. void NP QueueInit (PCHARQUEUE);
  503. void NP QueueFlush (PCHARQUEUE);
  504. int  NP QueueWrite (PCHARQUEUE, UCHAR);
  505. int  NP QueueRead (PCHARQUEUE, FPUCHAR);
  506.  
  507. // interrupt stuff 
  508.  
  509. int  NP SetIRQ  (USHORT, PFUNCTION, USHORT);
  510. int  NP UnSetIRQ (USHORT);
  511. int  NP EOI  (USHORT);
  512. void NP ClaimInterrupt(void);
  513. void NP RefuseInterrupt(void);
  514. int  NP RegisterStackUsage(PREGSTACK);
  515.  
  516. // timer stuff 
  517.  
  518. int  NP SetTimer (PFUNCTION);
  519. int  NP ResetTimer (PFUNCTION);
  520. int  NP TickCount (PFUNCTION, USHORT);
  521.  
  522. // device monitors 
  523.  
  524. int  NP MonCreate (PSHANDLE, FARPOINTER, FARPOINTER, PERRCODE);
  525. int  NP Register (SHANDLE, USHORT, PID, FARPOINTER, OFF, PERRCODE);
  526. int  NP MonWrite (SHANDLE, POINTER, USHORT, USHORT, ULONG, PERRCODE);
  527. int  NP MonFlush (SHANDLE, PERRCODE);
  528. int  NP DeRegister (SHANDLE, PID, PERRCODE);
  529.  
  530. // 2.0  specfic 
  531.  
  532. int  NP RegisterPDD(FPUCHAR,FPFUNCTION);       
  533. int  NP RegisterBeep(FPFUNCTION);      
  534. int  NP Beep(USHORT,USHORT);              
  535. int  NP FreeGDTSelector(USHORT);   
  536. int  NP PhysToGDTSel(PHYSADDR,ULONG,SEL,USHORT,FPUSHORT);      
  537. int  NP VMLock(LINADDR,ULONG,LINADDR,LINADDR,ULONG,FPULONG);            
  538. int  NP VMUnlock(LHANDLE);          
  539. int  NP VMAlloc(PLINADDR,ULONG,ULONG,PLINADDR);           
  540. int  NP VMFree(PHYSADDR);            
  541. int  NP VMProcessToGlobal(LINADDR,ULONG,ULONG,PLINADDR); 
  542. int  NP VMGlobalToProcess(LINADDR,ULONG,ULONG,PLINADDR); 
  543. int  NP VirtToLin(FARPOINTER,PLINADDR);         
  544. int  NP LinToGDTSelector(SEL,LINADDR,ULONG);  
  545. int  NP GetDescInfo(SEL,FPUSHORT,FPULONG,FPULONG);       
  546. int  NP LinToPageList(LINADDR,ULONG,LINADDR,FPULONG);     
  547. int  NP PageListToLin(ULONG,LINADDR,PLINADDR);     
  548. int  NP PageListToGDTSelector(SEL,ULONG,LINADDR,USHORT,FPUSHORT);
  549. int  NP RegisterTmrDD(FPFUNCTION,FPFARPOINTER,FPFARPOINTER);     
  550. int  NP AllocateCtxHook(OFF,ULONG,PLHANDLE);   
  551. int  NP FreeCtxHook(LHANDLE);       
  552. int  NP ArmCtxHook(ULONG,LHANDLE,ULONG);        
  553. int  NP VMSetMem(LINADDR,ULONG,ULONG);          
  554. int  NP OpenEventSem(LHANDLE);      
  555. int  NP CloseEventSem(LHANDLE);     
  556. int  NP PostEventSem(LHANDLE);      
  557. int  NP ResetEventSem(LHANDLE,FPULONG);     
  558. int  NP DynamicAPI(FARPOINTER,USHORT,USHORT,FPUSHORT);
  559.  
  560. // these are the only API's available to the driver at Init time 
  561.  
  562. #define APIENTRY far pascal
  563.  
  564. USHORT APIENTRY DosBeep(USHORT, USHORT);
  565. USHORT APIENTRY DosCaseMap(USHORT, FARPOINTER, FARPOINTER);
  566. USHORT APIENTRY DosChgFilePtr(SHANDLE, long, USHORT, FARPOINTER);
  567. USHORT APIENTRY DosClose(SHANDLE);
  568. USHORT APIENTRY DosDelete(FARPOINTER, ULONG);
  569. USHORT APIENTRY DosDevConfig(FARPOINTER, USHORT, USHORT);
  570. USHORT APIENTRY DosDevIOCtl(FARPOINTER, FARPOINTER, USHORT, USHORT, USHORT);
  571. USHORT APIENTRY DosFindClose(SHANDLE);
  572. USHORT APIENTRY DosFindFirst(FARPOINTER, FARPOINTER, USHORT, FARPOINTER, 
  573.         USHORT, FARPOINTER, ULONG);
  574. USHORT APIENTRY DosFindNext(SHANDLE, FARPOINTER, USHORT, FARPOINTER);
  575. USHORT APIENTRY DosGetEnv(FARPOINTER, FARPOINTER);
  576. USHORT APIENTRY DosGetMessage(FARPOINTER, USHORT, FARPOINTER, USHORT, 
  577.          USHORT, FARPOINTER, FARPOINTER);
  578. USHORT APIENTRY DosOpen(FARPOINTER, FARPOINTER, FARPOINTER, ULONG, 
  579.    USHORT, USHORT, USHORT, ULONG);
  580. USHORT APIENTRY DosPutMessage(SHANDLE, USHORT, FARPOINTER);
  581. USHORT APIENTRY DosQCurDir(USHORT, FARPOINTER, FARPOINTER);
  582. USHORT APIENTRY DosQCurDisk(FARPOINTER, FARPOINTER);
  583. USHORT APIENTRY DosQFileInfo(SHANDLE, USHORT, FARPOINTER, USHORT);
  584. USHORT APIENTRY DosQFileMode(FARPOINTER, FARPOINTER, ULONG);
  585. USHORT APIENTRY DosRead(SHANDLE, FARPOINTER, USHORT, FARPOINTER);
  586. USHORT APIENTRY DosWrite(SHANDLE, FARPOINTER, USHORT, FARPOINTER);
  587.  
  588. // end of DRVLIB.H 
  589.