home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / warphead.zip / H / VDSKPDD.H < prev    next >
C/C++ Source or Header  |  1997-04-10  |  7KB  |  201 lines

  1. /***************************************************************************
  2. *
  3. * Module Name: vdskpdd.h
  4. *
  5. * OS/2 public header file.
  6. *
  7. * Copyright (c) 1993  IBM Corporation
  8. *
  9. * Disk PDD/VDD shared structures/constants
  10. *
  11. */
  12.  
  13.  
  14. #pragma checkout( suspend )
  15.    #ifndef __CHKHDR__
  16.       #pragma checkout( suspend )
  17.    #endif
  18. #pragma checkout( resume )
  19.  
  20. #ifndef __VDSKPDD__
  21. #define __VDSKPDD__
  22.  
  23. #define DSK_NAME                "DSK$"
  24.  
  25.  
  26. /***    PDD function commands
  27.  *
  28.  *  Format:
  29.  *      (*fpfnPDSKVDDProc)(PDSKCMD_*, ul1, ul2);
  30.  *
  31.  *  PDSKCMD_REGISTER:
  32.  *      ENTRY
  33.  *          ul1 == segment of 16:32 VDD entry point
  34.  *          ul2 ==  offset of 16:32 VDD entry point
  35.  *      EXIT
  36.  *          returns TRUE
  37.  *
  38.  *  PDSKCMD_DEREGISTER:
  39.  *      ENTRY
  40.  *          ul1 == 0                    //not used
  41.  *          ul2 == 0                    //not used
  42.  *
  43.  *  PDSKCMD_QUERYDRVTYPE: (for removable media drive only)
  44.  *      ENTRY
  45.  *          ul1 == nDrive               //drive number (USHORT)
  46.  *          ul2 -> bDriveType           //16:16 pointer to BYTE
  47.  *      EXIT-SUCCESS
  48.  *          returns TRUE
  49.  *          usDriveType is set to the appropriate drive type
  50.  *              see DRVTYPE_* equates
  51.  *      EXIT-FAILURE
  52.  *          returns FALSE
  53.  *          usDriveType is set to DRVTYPE_NONE
  54.  *
  55.  *  PDSKCMD_QUERYCHANGE: (for removable media drive only)
  56.  *      ENTRY
  57.  *          ul1 == nDrive               //drive number (USHORT)
  58.  *          ul2 == 0                    //not used
  59.  *      EXIT-SUCCESS
  60.  *          returns TRUE (disk has changed)
  61.  *      EXIT_FAILURE
  62.  *          returns FALSE (disk has not changed)
  63.  *
  64.  *  PDSKCMD_QUERYMEDIA: (for removable media drive only)
  65.  *      ENTRY
  66.  *          ul1 == nDrive               //drive number (USHORT)
  67.  *          ul2 -> bMediaType           //16:16 pointer to BYTE
  68.  *      EXIT-SUCCESS
  69.  *          returns TRUE
  70.  *          usMediaType is set to appropriate media type
  71.  *              see MEDIATYPE_* equates
  72.  *      EXIT-FAILURE
  73.  *          returns FALSE (no media in drive etc.)
  74.  *          usMediaType is set to MEDIATYPE_NONE
  75.  *
  76.  *  PDSKCMD_DISKREQUEST:
  77.  *      ENTRY
  78.  *          ul1 -> DISKREQ packet       //16:16 pointer to disk request pkt.
  79.  *          ul2 -> REQSTATUS packet     //16:16 pointer to req. status pkt.
  80.  *      EXIT-SUCCESS
  81.  *          returns TRUE (the request is accepted)
  82.  *      EXIT-FAILURE
  83.  *          returns FALSE (the request is rejected)
  84.  *          REQSTATUS packet has the operation status
  85.  *      NOTE
  86.  *          The current supported disk requests for this function are:
  87.  *              DISKREQ_READSECTORS
  88.  *              DISKREQ_WRITESECTORS (for floppy only)
  89.  *              DISKREQ_VERIFYSECTORS
  90.  *              DISKREQ_FORMATTRACK  (for floppy only)
  91.  *          The function will return immediately whether the request is
  92.  *          accepted or not.  If the request is accepted, the status of
  93.  *          the operation will not be available until the request is
  94.  *          actually completed at which time VDSK will receive an asyn-
  95.  *          chronous notification.  If the request is rejected, the request
  96.  *          status packet will have the error status and no asynchronous
  97.  *          notification will be made.
  98.  */
  99.  
  100. #define PDSKCMD_REGISTER        PDDCMD_REGISTER      //register VDD
  101. #define PDSKCMD_DEREGISTER      (PDSKCMD_REGISTER+1) //de-register of VDD
  102. #define PDSKCMD_QUERYDRVTYPE    (PDSKCMD_REGISTER+2) //query drive type
  103. #define PDSKCMD_QUERYDRVPARMS   (PDSKCMD_REGISTER+3) //query drive parms ; pb 789010
  104. #define PDSKCMD_QUERYCHANGE     (PDSKCMD_REGISTER+4) //query disk changed
  105. #define PDSKCMD_QUERYMEDIA      (PDSKCMD_REGISTER+5) //query media type
  106. #define PDSKCMD_DISKREQUEST     (PDSKCMD_REGISTER+6) //disk request
  107.  
  108.  
  109. /***    VDD function commands
  110.  *
  111.  *  Format:
  112.  *      (*fpfnVDSKPDDProc)(VDSKCMD_*, ul1, ul2);
  113.  *
  114.  *  VDSKCMD_REQDONE:
  115.  *      ul1 == 0        //not used
  116.  *      ul2 == 0        //not used
  117.  */
  118.  
  119. #define VDSKCMD_REQDONE         0x01    //notify VDSK of disk request completion
  120.  
  121.  
  122. /***    VDSK-PDSK Communication Structures
  123.  *
  124.  *      Note that the structures are allocated as VDM fixed instance
  125.  *      data so that the packet may be accessed at interrupt time.
  126.  *      However, the user buffer (specified as a 16:16 pointer) is
  127.  *      always swappable.  In addition, the user buffer pointer is
  128.  *      specified in virtual address space.  Therefore, it is the
  129.  *      physical device driver's responsibility to translate the
  130.  *      address into physical address for DMA purpose and make sure
  131.  *      the user buffer is locked down before any DMA operation can
  132.  *      proceed.
  133.  *
  134.  *      Also note that the request status codes returned are made
  135.  *      the same as Int 13h status codes for VDSK implementation
  136.  *      efficiency, but additional status codes can also be added
  137.  *      if necessary (see INT13STATUS_* equates in vdmbios.h).
  138.  */
  139.  
  140. typedef struct diskreq_s {
  141.     BYTE        dr_bReqFunc;            //request function
  142.     BYTE        dr_bDrive;              //drive number
  143.     BYTE        dr_bHead;               //head number
  144.     WORD        dr_wCylinder;           //cylinder number
  145.     BYTE        dr_bSector;             //sector number
  146.     BYTE        dr_nSectors;            //number of sectors to process
  147.     USHORT      dr_usFormatTracks;      //number of tracks to format
  148.     USHORT      dr_usFormatSectors;     //number of sectors per track to format
  149.     F16PVOID    dr_f16pBuffer;          //16:16 pointer to buffer
  150.     F16PVOID    dr_f16pDiskParm;        //16:16 pointer to disk parameter table
  151. } DISKREQ;
  152.  
  153.  
  154. typedef struct reqstatus_s {
  155.     BYTE    rs_bReqStatus;              //disk request status of operation
  156.     BYTE    rs_nSectorsDone;            //number of sectors processed
  157. } REQSTATUS;
  158.  
  159.  
  160. /***    Drive Type Equates
  161.  *
  162.  *      Note that these equates are derived from the
  163.  *      Diskette Drive Type Byte in the CMOS RAM.
  164.  */
  165.  
  166. #define DRVTYPE_NONE    0               //no drive
  167. #define DRVTYPE_360K    1               //360K drive
  168. #define DRVTYPE_1200K   2               //1.2M high capacity drive
  169. #define DRVTYPE_720K    3               //3.5" drive (720K)
  170. #define DRVTYPE_1440K   4               //3.5" high capacity drive (1.44M)
  171.  
  172.  
  173. /***    Media Type Equates
  174.  *
  175.  *      Note that the equates must be tied with DRVTYPE_* equates
  176.  *      because VDSK component implementation assumes it so.
  177.  */
  178.  
  179. #define MEDIATYPE_NONE  DRVTYPE_NONE    //no media in drive
  180. #define MEDIATYPE_360K  DRVTYPE_360K    //360K double side double density disk
  181. #define MEDIATYPE_1200K DRVTYPE_1200K   //1.2M high capacity disk
  182. #define MEDIATYPE_720K  DRVTYPE_720K    //3.5" 720K disk
  183. #define MEDIATYPE_1440K DRVTYPE_1440K   //3.5" 1.4M disk
  184.  
  185.  
  186. /***    Disk Request Function Equates
  187.  */
  188.  
  189. #define DISKREQ_READSECTORS     0
  190. #define DISKREQ_WRITESECTORS    1
  191. #define DISKREQ_VERIFYSECTORS   2
  192. #define DISKREQ_FORMATTRACK     3
  193.  
  194. #endif /* __VDSKPDD__ */
  195.  
  196. #pragma checkout( suspend )
  197.    #ifndef __CHKHDR__
  198.       #pragma checkout( resume )
  199.    #endif
  200. #pragma checkout( resume )
  201.