home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / ddkx86v5.zip / DDKX86 / SRC / DEV / DASD / OS2DASD / DSKIOCTL.H < prev    next >
Encoding:
C/C++ Source or Header  |  1995-04-14  |  13.2 KB  |  357 lines

  1. /*DDK*************************************************************************/
  2. /*                                                                           */
  3. /* COPYRIGHT    Copyright (C) 1995 IBM Corporation                           */
  4. /*                                                                           */
  5. /*    The following IBM OS/2 WARP source code is provided to you solely for  */
  6. /*    the purpose of assisting you in your development of OS/2 WARP device   */
  7. /*    drivers. You may use this code in accordance with the IBM License      */
  8. /*    Agreement provided in the IBM Device Driver Source Kit for OS/2. This  */
  9. /*    Copyright statement may not be removed.                                */
  10. /*                                                                           */
  11. /*****************************************************************************/
  12. /*static char *SCCSID = "src/dev/dasd/os2dasd/dskioctl.h, dsdm, ddk_subset, b_bdd.032 93/10/08";*/
  13. /*      SCCSID = src/dev/dasd/os2dasd/dskioctl.h, dsdm, ddk_subset, b_bdd.032 93/10/08 */
  14. /**************************************************************************
  15.  *
  16.  * SOURCE FILE NAME = DSKIOCTL.H
  17.  *
  18.  * DESCRIPTIVE NAME = OS2DASD.DMD - OS/2 DASD Device Manager
  19.  *
  20.  *
  21.  *
  22.  * VERSION = V2.0
  23.  *
  24.  * DATE
  25.  *
  26.  * DESCRIPTION : IOCTL data structures
  27.  *
  28.  *
  29.  *
  30. */
  31.  
  32. /***    DSKIOCTL.H
  33. ;
  34. ;       These are all the important structures and equates for
  35. ;       the disk ioctl.
  36. */
  37.  
  38. /* IOC_DC sub-functions - DOS 3.2 codes   */
  39.  
  40. #define SET_DEVICE_PARAMETERS   0x40
  41. #define WRITE_TRACK             0x41
  42. #define FORMAT_TRACK            0x42
  43. #define GET_DEVICE_PARAMETERS   0x60
  44. #define READ_TRACK              0x61
  45. #define VERIFY_TRACK            0x62
  46.  
  47. /* Special function for Get Device Parameters */
  48.  
  49. #define BUILD_DEVICE_BPB        0x01
  50.  
  51. /* Special Functions for Set Device Parameters - 3.20 version */
  52.  
  53. #define INSTALL_FAKE_BPB        0x01
  54. #define ONLY_SET_TRACKLAYOUT    0x02
  55. #define TRACKLAYOUT_IS_GOOD     0x04
  56.  
  57. /* Special function for Format Track - 3.20 version */
  58.  
  59. #define STATUS_FOR_FORMAT       0x01
  60.  
  61. /*  Codes returned from Format Status Call */
  62.  
  63. #define FORMAT_NO_ROM_SUPPORT       0x01
  64. #define FORMAT_COMB_NOT_SUPPORTED   0x02
  65.  
  66. /* DeviceType values */
  67.  
  68. #define MAX_SECTORS_IN_TRACK    40      /* Maximum sectors on a disk */
  69. #define DEV_5INCH               0
  70. #define DEV_5INCH96TPI          1
  71. #define DEV_3INCH720KB          2
  72. #define DEV_8INCHSS             3
  73. #define DEV_8INCHDS             4
  74. #define DEV_HARDDISK            5
  75. #define DEV_OTHER               7
  76.  
  77. #define MAX_DEV_TYPE            7       /* max device type currently supported*/
  78.  
  79. typedef struct _a_SectorTable
  80. {
  81.   USHORT        SectorNumber;
  82.   USHORT        SectorSize;
  83. } a_SectorTable, TLT;
  84.  
  85. typedef struct a_SectorTable2
  86. {
  87.   UCHAR         Cylinder;
  88.   UCHAR         Head;
  89.   UCHAR         Sector;
  90.   UCHAR         BytesPerSectorIndex;
  91.  
  92. } a_SectorTable2, FTT;
  93.  
  94. /* Structure definitions for structures used for the Int 21H Generic IOCTL */
  95. /* function calls.                                                         */
  96.  
  97. #define DP_SECTOR_TABLE_SIZE    MAX_SECTORS_IN_TRACK * sizeof(a_SectorTable)
  98.  
  99. typedef struct _a_DeviceParameters
  100. {
  101.   UCHAR         SpecialFunctions;
  102.   UCHAR         DeviceType;
  103.   USHORT        DeviceAttributes;
  104.   USHORT        Cylinders;
  105.   UCHAR         MediaType;
  106.   BPB           bpb;
  107.   USHORT        TrackTableEntries;
  108.   a_SectorTable SectorTable[MAX_SECTORS_IN_TRACK];
  109.  
  110. } a_DeviceParameters;
  111.  
  112.  
  113. typedef struct _a_TrackReadWritePacket
  114. {
  115.   UCHAR         SpecialFunctions;
  116.   USHORT        Head;
  117.   USHORT        Cylinder;
  118.   USHORT        FirstSector;
  119.   USHORT        SectorsToReadWrite;
  120.   ULONG         TransferAddress;
  121. } a_TrackReadWritePacket;
  122.  
  123.  
  124. typedef struct _a_FormatPacket
  125. {
  126.   UCHAR         SpecialFunctions;
  127.   USHORT        Head;
  128.   USHORT        Cylinder;
  129. } a_FormatPacket;
  130.  
  131.  
  132. typedef struct _a_VerifyPacket
  133. {
  134.   UCHAR         SpecialFunctions;
  135.   USHORT        Head;
  136.   USHORT        Cylinder;
  137. } a_VerifyPacket;
  138.  
  139.  
  140. /*----------------------------------------------------------*/
  141. /* Category 8, functions 43H and 63H                        */
  142. /*   - Set and Get Device Parameters                        */
  143. /*----------------------------------------------------------*/
  144.  
  145. typedef struct _DDI_DeviceParameters_param
  146. {
  147.    UCHAR        Command;
  148. } DDI_DeviceParameters_param, FAR *PDDI_DeviceParameters_param;
  149.  
  150. typedef struct DDI_DeviceParameters_data
  151. {
  152.   BPB           bpb;
  153.   USHORT        NumCylinders;
  154.   UCHAR         DeviceType;
  155.   USHORT        DeviceAttr;
  156.  
  157. } DDI_DeviceParameters_data, FAR *PDDI_DeviceParameters_data;
  158.  
  159. /* Command equates for Set Device Parameters function */
  160.  
  161. #define SET_DEVICE_BPB  0x01;           /*  Set BPB for physical device */
  162. #define SET_MEDIA_BPB   0x02;           /*  Set BPB for medium          */
  163.  
  164. /*----------------------------------------------------------*/
  165. /* Category 8, function 45H, Format and Verify a Track      */
  166. /*----------------------------------------------------------*/
  167.  
  168. typedef struct _DDI_FormatPacket_param
  169. {
  170.   UCHAR         Command;
  171.   USHORT        Head;
  172.   USHORT        Cylinder;
  173.   USHORT        NumTracks;
  174.   USHORT        NumSectors;
  175.   FTT           FmtTrackTable[1];
  176. } DDI_FormatPacket_param, FAR *PDDI_FormatPacket_param;
  177.  
  178. typedef struct _DDI_FormatPacket_data
  179. {
  180. UCHAR           StartSector;            /* Starting sector              */
  181. } DDI_FormatPacket_data, FAR *PDDI_FormatPacket_data;
  182.  
  183. /*----------------------------------------------------------*/
  184. /* Category 8 and 9 functions 44H, 64H, 65H                 */
  185. /*  - Write Track, Read Track, Verify Track                 */
  186. /*----------------------------------------------------------*/
  187.  
  188. typedef struct _DDI_RWVPacket_param
  189. {
  190.   UCHAR         Command;
  191.   USHORT        Head;
  192.   USHORT        Cylinder;
  193.   USHORT        FirstSector;
  194.   USHORT        NumSectors;
  195.   TLT           TrackTable[1];
  196. } DDI_RWVPacket_param, FAR *PDDI_RWVPacket_param;
  197.  
  198. /*----------------------------------------------------------*/
  199. /* Category 8, function 60H, get media sense                */
  200. /*----------------------------------------------------------*/
  201.  
  202. typedef struct _DDI_MediaSense_param
  203. {
  204.   UCHAR        Command;
  205. } DDI_MediaSense_param, FAR *PDDI_MediaSense_param;
  206.  
  207. typedef struct _DDI_MediaSense_data
  208. {
  209.   UCHAR        MediaSense;
  210. } DDI_MediaSense_data, FAR *PDDI_MediaSense_data;
  211.  
  212. /*----------------------------------------------------------*/
  213. /* Category 9, function 22H, Install Drive Alias            */
  214. /*----------------------------------------------------------*/
  215. typedef struct _DDI_DriveAlias_param
  216. {
  217.   UCHAR         PhysDriveNum;
  218.   SHORT         cCyln;
  219.   BPB           rbpb;
  220. } DDI_DriveAlias_param, FAR *PDDI_DriveAlias_param;
  221.  
  222. /*----------------------------------------------------------*/       /*@V74404*/
  223. /* Category 8/9, function 47H, DASD Mgr Parameters          */       /*@V74404*/
  224. /*----------------------------------------------------------*/       /*@V74404*/
  225.                                                                      /*@V74404*/
  226. /* Parameter Packet Commands */                                      /*@V74404*/
  227.                                                                      /*@V74404*/
  228. #define SET_QUEUING_CONTROL     1                                    /*@V74404*/
  229.                                                                      /*@V74404*/
  230. typedef struct _DDI_QueueControl_param                               /*@V74404*/
  231. {                                                                    /*@V74404*/
  232.   UCHAR         Command;                                             /*@V74404*/
  233.   UCHAR         Reserved_1;                                          /*@V74404*/
  234.   USHORT        SortMethod;                                          /*@V74404*/
  235.   USHORT        QueueMethod;                                         /*@V74404*/
  236.   USHORT        QueueDepth;                                          /*@V74404*/
  237.   USHORT        Reserved[16-4];                                      /*@V74404*/
  238. } DDI_QueueControl_param, FAR *PDDI_QueueControl_param;              /*@V74404*/
  239.                                                                      /*@V74404*/
  240. typedef struct _DDI_QueueControl_data                                /*@V74404*/
  241. {                                                                    /*@V74404*/
  242.   UCHAR         Reserved;                                            /*@V74404*/
  243. } DDI_QueueControl_data, FAR *PDDI_QueueControl_data;                /*@V74404*/
  244.                                                                      /*@V74404*/
  245. /* SortMethod Values */                                              /*@V74404*/
  246. #define SORT_METHOD_DEFAULT               0xFFFF                     /*@V74404*/
  247. #define SORT_METHOD_CURRENT               0x0000                     /*@V74404*/
  248. #define SORT_METHOD_FIFO                  0x0001                     /*@V74404*/
  249. #define SORT_METHOD_ELEVATOR              0x0002                     /*@V74404*/
  250.                                                                      /*@V74404*/
  251. /* QueueMethod Values */                                             /*@V74404*/
  252. #define QUEUE_METHOD_DEFAULT              0xFFFF                     /*@V74404*/
  253. #define QUEUE_METHOD_CURRENT              0x0000                     /*@V74404*/
  254. #define QUEUE_METHOD_NOPRIORITY           0x0001                     /*@V74404*/
  255. #define QUEUE_METHOD_PRIORITY             0x0002                     /*@V74404*/
  256.                                                                      /*@V74404*/
  257. /* QueueDepth Values */                                              /*@V74404*/
  258. #define QUEUE_DEPTH_DEFAULT               0xFFFF                     /*@V74404*/
  259. #define QUEUE_DEPTH_CURRENT               0x0000                     /*@V74404*/
  260. #define QUEUE_DEPTH_MAXIMUM               0x00FF                     /*@V74404*/
  261.  
  262. /*----------------------------------------------------------*/
  263. /* Category 9, function 5EH, ReadBack                       */
  264. /*----------------------------------------------------------*/
  265. typedef struct _DDI_ReadBack_param
  266. {
  267.   UCHAR         Command;
  268. } DDI_ReadBack_param, FAR *PDDI_ReadBack_param;
  269.  
  270. typedef struct _DDI_ReadBack_data
  271. {
  272.   UCHAR         Action;
  273.   USHORT        DmaOverrunCount;
  274.   USHORT        Count;
  275.   USHORT        Miscompares;
  276. } DDI_ReadBack_data, FAR *PDDI_ReadBack_data;
  277.  
  278. /*----------------------------------------------------------*/
  279. /* Category 9, function 63H, get physical device parameters */
  280. /*----------------------------------------------------------*/
  281.  
  282. typedef struct _DDI_PhysDeviceParameters_data
  283. {
  284.   USHORT        Reserved_1;
  285.   USHORT        NumCylinders;
  286.   USHORT        NumHeads;
  287.   USHORT        SectorsPerTrack;
  288.   USHORT        Reserved_2[4];
  289. } DDI_PhysDeviceParameters_data, FAR *PDDI_PhysDeviceParameters_data;
  290.  
  291.  
  292. /*----------------------------------------------------------*/
  293. /* Category 9, function 6CH, Change Partition Type          */
  294. /*----------------------------------------------------------*/
  295.  
  296. typedef struct _DDI_ChangePart_param
  297. {
  298. UCHAR          DDI_PartType_flag;       /* Partition Type flag             */
  299. } DDI_ChangePart_param, FAR *PDDI_ChangePart_param;
  300.  
  301. #define CP_HPFS         0x01            /* change partition type to HPFS   */
  302.  
  303. /*----------------------------------------------------------*/
  304. /* Category 8, function 5DH, Diskette Control               */
  305. /*----------------------------------------------------------*/
  306.  
  307. typedef struct _DDI_DsktControl_param
  308. {
  309.   UCHAR         Command;
  310. } DDI_DsktControl_param, FAR *PDDI_DsktControl_param;
  311.  
  312.  
  313. /*----------------------------------------------------------*/
  314. /* Category ?, function ??H, Map Packet                     */
  315. /*----------------------------------------------------------*/
  316.  
  317. typedef struct _DDI_MapPacket
  318. {
  319.   UCHAR         Drive;
  320. } DDI_MapPacket;
  321.  
  322.                  /* F26083 */
  323. /*----------------------------------------------------------*/
  324. /* Category 8, function 40H,66H Removable Media Security    */
  325. /*----------------------------------------------------------*/
  326.  
  327. /* parameter packet commands */
  328. #define UNLOCK_MEDIA 0                                               /*@V51531*/
  329. #define LOCK_MEDIA   1                                               /*@V51531*/
  330. #define EJECT_MEDIA  2                                               /*@V51531*/
  331.  
  332. typedef struct _DDI_RemovMediaCtl_param
  333. {
  334.   UCHAR         Command;
  335. } DDI_DsktRemovMediaCtl_param, FAR *PDDI_DsktRemovMediaCtl_param;
  336.  
  337. /* data packet values returned by driver */
  338. #define NOT_SUPPORTED        0                                       /*@V51531*/
  339. #define DRIVE_LOCKED         1                                       /*@V51531*/
  340. #define DRIVE_UNLOCKED       2                                       /*@V51531*/
  341. #define STATUS_NOT_SUPPORTED 3                                       /*@v51531*/
  342. #define MEDIA_IN_DRIVE       4                                       /*@V51531*/
  343.  
  344. typedef struct _DDI_RemovMediaCtl_data
  345. {
  346.   ULONG Status;
  347.   UCHAR Reserved;
  348. } DDI_DsktRemovMediaCtl_data, FAR *PDDI_DsktRemovMediaCtl_data;
  349.  
  350.  
  351. #define GEN_IOCTL_FN_TST        0x20        /* Used to differentiate between */
  352.                                             /* reads and writes.             */
  353.  
  354.  
  355.  
  356.  
  357.