home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / listings / v_10_03 / 1003051a < prev    next >
Text File  |  1991-10-07  |  2KB  |  70 lines

  1. /*
  2.  *  LISTING 3, driver.h
  3.  *
  4.  *  MS-DOS device driver #defines and definitions
  5.  */
  6.  
  7. #ifndef __DRIVER_H
  8. #define __DRIVER_H
  9.  
  10. /* Format of generic request header block. Depending
  11.  * on the command code, data specific to the command is
  12.  * carried in data[] buffer ......... */
  13. typedef struct  request_block {
  14.     unsigned char length;       //length of REQHDR
  15.     unsigned char unit;         //unit # (block only)
  16.     unsigned char cmd;          //command code
  17.     unsigned int status;        //return status
  18.     unsigned char reserved[8];
  19.     unsigned char mtype;        //media type
  20.     unsigned int xfer_ofs;      //xfer buffer offset
  21.     unsigned int xfer_seg;      // "     "    segment
  22.     unsigned int xfer_cnt;      //bytes to xfer
  23.     unsigned char data[12];     //other command data
  24.     } REQHDR;
  25.  
  26. /* bit settings for upper byte of return
  27.  * status word in REQHDR .... */
  28. #define IS_ERROR        0x8000
  29. #define IM_BUSY         0x0200
  30. #define IM_DONE         0x0100
  31.  
  32. /* values returned in lower byte of REQHDR status
  33.  * word if ERROR bit (bit 15) is set ..... */
  34. #define WRITE_PROTECT   0x0000
  35. #define INVALID_UNIT    0x0001
  36. #define NOT_READY       0x0002
  37. #define INV_COMMAND     0x0003
  38. #define CRC_ERROR       0x0004
  39. #define BAD_REQ_LENGTH  0x0005
  40. #define SEEK_ERROR      0x0006
  41. #define UNKNOWN_MEDIA   0x0007
  42. #define INV_SECTOR      0x0008
  43. #define OUT_OF_PAPER    0x0009
  44. #define WRITE_FAULT     0x000A
  45. #define READ_FAULT      0x000B
  46. #define GENERAL_FAILURE 0x000C
  47. #define INV_DISK_CHANGE 0x000F    //DOS 3+ only
  48.  
  49. /* Bit settings for attribute word ........ */
  50. #define IS_NUL      0x0004  //current NUL device
  51. #define IS_CLOCK    0x0008  //current CLOCK device
  52. #define GEN_IOCTL   0x0040  //generic ioctl: DOS 3.2+
  53. #define OCR_MEDIA   0x0800  //open-close-remove media
  54. #define IOCTL_RW    0x4000  //ioctl r/w supported (2+)
  55.  
  56. /* Attribute bits for character devices only ...... */
  57. #define IS_STDIN    0x0001  //std input device
  58. #define IS_STDOUT   0x0002  //std output device
  59. #define USE_INT29H  0x0010  //CON device uses int 29h
  60. #define OUTPUT_BUSY 0x2000  //uses output until busy
  61. #define IS_CHAR     0x8000  //is character device
  62.  
  63. /* Attribute bits for block devices only .... */
  64. #define BIG_SECTOR  0x0002  //32-bit sectors (DOS 4)
  65. #define USE_BPB     0x2000  //use BPB for media info
  66.  
  67. #endif      //__DRIVER_H
  68.  
  69. /* ----- End of File ------------------------------- */
  70.