home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / ddrivers.zip / VDD / PIOIN.C < prev    next >
C/C++ Source or Header  |  1993-02-24  |  952b  |  48 lines

  1. /*  pioin.c */
  2.  
  3. #include "mvdm.h"                       /* VDH services, etc.   */
  4. #include "pio.h"      
  5. #include "basemid.h"
  6.    
  7. /* PIO specific         */
  8.  
  9. #pragma alloc_text(CSWAP_TEXT,PIODataIn,RequestDirect)
  10.  
  11. extern IOH Ioh;
  12.  
  13. /* entry from data input trap in VDM */
  14.  
  15. BYTE HOOKENTRY PIODataIn(ULONG portaddr, PCRF pcrf)
  16. {
  17.     BYTE dataread;                     /* set up byte to return */
  18.  
  19.      VdhInt3();
  20.  
  21.      RequestDirect();
  22.  
  23.      /* disable I/O trap */
  24.  
  25.      VDHSetIOHookState(current_VDM,DIGIO_BASE,3,&Ioh,0);
  26.  
  27.     dataread = inp(portaddr);    
  28.     return(dataread);                  /* return data read      */
  29. }
  30.  
  31. BOOL HOOKENTRY RequestDirect(void)
  32. {
  33.     if (owner_VDM != current_VDM)
  34.     {
  35.       if (owner_VDM !=0)
  36.       {
  37.          VDHPopup(0,0,MSG_DEVICE_IN_USE,&Resp,ABORT,0);
  38.           if (Resp != ABORT)
  39.           {
  40.              VDHKillVDM(current_VDM);
  41.               owner_VDM = current_VDM;
  42.           }
  43.       }
  44.       else
  45.       owner_VDM = current_VDM;
  46.     }
  47. }
  48.