ideDrv.h
上传用户:luoyougen
上传日期:2008-05-12
资源大小:23136k
文件大小:5k
源码类别:

VxWorks

开发平台:

C/C++

  1. /* ideDrv.h - IDE disk controller header */
  2. /* Copyright 1984-2001 Wind River Systems, Inc. */
  3. /*
  4. modification history
  5. --------------------
  6. 01d,30oct01,dat  Adding warning about driver being obsolete
  7. 01c,25oct94,hdn  added ideRawio() function prototype.
  8. 01b,10oct94,hdn  added IDE_RAW structure for ideRawio().
  9. 01a,19oct93,hdn  written.
  10. */
  11. #ifndef __INCideDrvh
  12. #define __INCideDrvh
  13. #ifdef __cplusplus
  14. extern "C" {
  15. #endif
  16. #warning "The ideDrv is replaced by ataDrv. Please use ataDrv instead"
  17. #ifndef _ASMLANGUAGE
  18. #include "blkIo.h"
  19. typedef struct ideDev
  20.     {
  21.     BLK_DEV blkDev;
  22.     int drive; /* drive no. 0 - 1 */
  23.     int blkOffset; /* sector offset */
  24.     } IDE_DEV;
  25. typedef struct ideType
  26.     {
  27.     int cylinders; /* number of cylinders */
  28.     int heads; /* number of heads */
  29.     int sectorsTrack; /* number of sectors per track */
  30.     int bytesSector; /* number of bytes per sector */
  31.     int precomp; /* precompensation cylinder */
  32.     } IDE_TYPE;
  33. typedef struct ideParams 
  34.     {
  35.     short config; /* general configuration */
  36.     short cylinders; /* number of cylinders */
  37.     short removcyl; /* number of removable cylinders */
  38.     short heads; /* number of heads */
  39.     short bytesTrack; /* number of unformatted bytes/track */
  40.     short bytesSec; /* number of unformatted bytes/sector */
  41.     short sectorsTrack; /* number of sectors/track */
  42.     short bytesGap; /* minimum bytes in intersector gap */
  43.     short bytesSync; /* minimum bytes in sync field */
  44.     short vendstat; /* number of words of vendor status */
  45.     char serial[20]; /* controller serial number */
  46.     short type; /* controller type */
  47.     short size; /* sector buffer size, in sectors */
  48.     short bytesEcc; /* ecc bytes appended */
  49.     char rev[8]; /* firmware revision */
  50.     char model[40]; /* model name */
  51.     short nsecperint; /* sectors per interrupt */
  52.     short usedmovsd; /* can use double word read/write? */
  53.     short spare[207]; /* */
  54.     } IDE_PARAM;
  55. typedef struct ideRaw
  56.     { /* this is for IDERAWACCESS ioctl */
  57.     UINT cylinder; /* cylinder (0 -> (cylindres-1)) */
  58.     UINT head; /* head (0 -> (heads-1)) */
  59.     UINT sector; /* sector (1 -> sectorsTrack) */
  60.     char *pBuf; /* pointer to buffer (bytesSector * nSecs) */
  61.     UINT nSecs; /* number of sectors (1 -> sectorsTrack) */
  62.     UINT direction; /* read=0, write=1 */
  63.     } IDE_RAW;
  64. /* max number of IDE drives */
  65. #define IDE_MAX_DRIVES 2
  66. /* IDE registers */
  67. #define IDE_DATA 0x1f0 /* (RW) data register (16 bits) */
  68. #define IDE_ERROR 0x1f1 /* (R)  error register */
  69. #define IDE_PRECOMP 0x1f1 /* (W)  write precompensation */
  70. #define IDE_SECCNT 0x1f2 /* (RW) sector count */
  71. #define IDE_SECTOR 0x1f3 /* (RW) first sector number */
  72. #define IDE_CYL_LO 0x1f4 /* (RW) cylinder low byte */
  73. #define IDE_CYL_HI 0x1f5 /* (RW) cylinder high byte */
  74. #define IDE_SDH 0x1f6 /* (RW) sector size/drive/head */
  75. #define IDE_COMMAND 0x1f7 /* (W)  command register */
  76. #define IDE_STATUS  0x1f7 /* (R)  immediate status */
  77. #define IDE_A_STATUS 0x3f6   /* (R)  alternate status */
  78. #define IDE_D_CONTROL 0x3f6   /* (W)  disk controller control */
  79. #define IDE_D_ADDRESS 0x3f7   /* (R)  disk controller address */
  80. /* diagnostic code */
  81. #define DIAG_OK 0x01
  82. /* control register */
  83. #define  CTL_4BIT  0x8 /* use 4 head bits (wd1003) */
  84. #define  CTL_RST  0x4 /* reset controller */
  85. #define  CTL_IDS  0x2 /* disable interrupts */
  86. /* status register */
  87. #define STAT_BUSY 0x80 /* controller busy */
  88. #define STAT_READY 0x40 /* selected drive ready */
  89. #define STAT_WRTFLT 0x20 /* write fault */
  90. #define STAT_SEEKCMPLT 0x10 /* seek complete */
  91. #define STAT_DRQ 0x08 /* data request */
  92. #define STAT_ECCCOR 0x04 /* ECC correction made in data */
  93. #define STAT_INDEX 0x02 /* index pulse from selected drive */
  94. #define STAT_ERR 0x01 /* error detect */
  95. /* size/drive/head register */
  96. #define SDH_IBM 0xa0 /* 512 bytes sector, ecc */
  97. /* commands */
  98. #define CMD_RECALIB 0x10 /* recalibrate */
  99. #define CMD_SEEK 0x70 /* seek */
  100. #define CMD_READ 0x20 /* read sectors with retries */
  101. #define CMD_WRITE 0x30 /* write sectors with retries */
  102. #define CMD_FORMAT 0x50 /* format track */
  103. #define CMD_DIAGNOSE 0x90 /* execute controller diagnostic */
  104. #define CMD_INITP 0x91 /* initialize drive parameters */
  105. #define CMD_READP 0xEC /* identify */
  106. /* function declarations */
  107. #if defined(__STDC__) || defined(__cplusplus)
  108. STATUS ideDrv (int vector, int level, BOOL manualConfig);
  109. BLK_DEV *ideDevCreate (int drive, int nBlks, int offset);
  110. STATUS ideRawio (int drive, IDE_RAW *pIdeRaw);
  111. #else
  112. STATUS ideDrv ();
  113. BLK_DEV *ideDevCreate ();
  114. STATUS ideRawio ();
  115. #endif  /* __STDC__ */
  116. #endif  /* _ASMLANGUAGE */
  117. #ifdef __cplusplus
  118. }
  119. #endif
  120. #endif /* __INCideDrvh */