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

VxWorks

开发平台:

C/C++

  1. /* nec765Fd.h - NEC 765 floppy disk controller header */
  2. /* Copyright 1984-1993 Wind River Systems, Inc. */
  3. /*
  4. modification history
  5. --------------------
  6. 01f,10dec97,ms   added prototype for usrFdConfig
  7. 01e,31aug95,hdn  added error code,
  8.  FD_UNFORMATED FD_WRITE_PROTECTED FD_DISK_NOT_PRESENT
  9. 01d,25oct94,hdn  added FD_RAW structure for fdRawio().
  10.  added fdRawio() function declarations.
  11. 01c,22apr94,hdn  moved FD_DMA_BUF, FD_DMA_BUF_SIZE to config.h.
  12. 01b,06apr94,hdn  changed the DMA address from 0x1000 to 0x2000.
  13. 01a,30sep93,hdn  written.
  14. */
  15. #ifndef __INCnec765Fdh
  16. #define __INCnec765Fdh
  17. #ifdef __cplusplus
  18. extern "C" {
  19. #endif
  20. #ifndef _ASMLANGUAGE
  21. #include "blkIo.h"
  22. typedef struct fdDev
  23.     {
  24.     BLK_DEV blkDev;
  25.     int fdType; /* floppy disk type */
  26.     int drive; /* drive no. 0 - 3 */
  27.     int blkOffset; /* sector offset */
  28.     } FD_DEV;
  29. typedef struct fdType
  30.     {
  31.     int sectors; /* no of sectors */
  32.     int sectorsTrack; /* sectors per track */
  33.     int heads; /* no of heads */
  34.     int cylinders; /* no of cylinders */
  35.     int secSize; /* bytes per sector, 128 << secSize */
  36.     char gap1; /* gap1 size for read, write */
  37.     char gap2; /* gap2 size for format */
  38.     char dataRate; /* data transfer rate */
  39.     char stepRate; /* stepping rate */
  40.     char headUnload; /* head unload time */
  41.     char headLoad; /* head load time */
  42.     char mfm; /* MFM bit for read, write, format */
  43.     char sk; /* SK bit for read */
  44.     char *name; /* name */
  45.     } FD_TYPE;
  46. typedef struct fdRaw
  47.     { /* this is for IDERAWACCESS ioctl */
  48.     UINT cylinder; /* cylinder (0 -> (cylindres-1)) */
  49.     UINT head; /* head (0 -> (heads-1)) */
  50.     UINT sector; /* sector (1 -> sectorsTrack) */
  51.     char *pBuf; /* pointer to buffer (bytesSector * nSecs) */
  52.     UINT nSecs; /* number of sectors (1 -> sectorsTrack) */
  53.     UINT direction; /* read=0, write=1 */
  54.     } FD_RAW;
  55. /* max number of FD drives */
  56. #define FD_MAX_DRIVES 4
  57. /* error code */
  58. #define FD_UNFORMATED -2 /* unformated diskette */
  59. #define FD_WRITE_PROTECTED -3 /* write protected diskette */
  60. #define FD_DISK_NOT_PRESENT -4 /* no diskette */
  61. /* FDC IO address */
  62. #define FD_REG_OUTPUT 0x3f2
  63. #define FD_REG_STATUS 0x3f4
  64. #define FD_REG_COMMAND 0x3f4
  65. #define FD_REG_DATA 0x3f5
  66. #define FD_REG_INPUT 0x3f7
  67. #define FD_REG_CONFIG 0x3f7
  68. /* FDC Digital Output Register */
  69. #define FD_DOR_DRIVE0_SEL 0x00
  70. #define FD_DOR_DRIVE1_SEL 0x01
  71. #define FD_DOR_DRIVE2_SEL 0x02
  72. #define FD_DOR_DRIVE3_SEL 0x03
  73. #define FD_DOR_RESET 0x00
  74. #define FD_DOR_CLEAR_RESET 0x04
  75. #define FD_DOR_DMA_DISABLE 0x00
  76. #define FD_DOR_DMA_ENABLE 0x08
  77. #define FD_DOR_DRIVE_ON 0x10
  78. /* FDC Main Status Register */
  79. #define FD_MSR_DRIVE0_SEEK 0x01
  80. #define FD_MSR_DRIVE1_SEEK 0x02
  81. #define FD_MSR_DRIVE2_SEEK 0x04
  82. #define FD_MSR_DRIVE3_SEEK 0x08
  83. #define FD_MSR_FD_BUSY 0x10
  84. #define FD_MSR_EXEC_MODE 0x20
  85. #define FD_MSR_DIRECTION 0x40
  86. #define FD_MSR_RQM 0x80
  87. /* FDC Commands */
  88. #define FD_CMD_SPECIFY 0x03
  89. #define FD_CMD_SENSEDRIVE 0x04
  90. #define FD_CMD_RECALIBRATE 0x07
  91. #define FD_CMD_SENSEINT 0x08
  92. #define FD_CMD_SEEK 0x0f
  93. #define FD_CMD_READ 0x06
  94. #define FD_CMD_WRITE 0x05
  95. #define FD_CMD_FORMAT 0x0d
  96. #define FD_CMD_LEN_SPECIFY 3
  97. #define FD_CMD_LEN_SENSEDRIVE 2
  98. #define FD_CMD_LEN_RECALIBRATE 2
  99. #define FD_CMD_LEN_SENSEINT 1
  100. #define FD_CMD_LEN_SEEK 3
  101. #define FD_CMD_LEN_RW 9
  102. #define FD_CMD_LEN_FORMAT 6
  103. /* FDC's DMA channel */
  104. #define FD_DMA_CHAN 2
  105. /* function declarations */
  106. #if defined(__STDC__) || defined(__cplusplus)
  107. STATUS fdDrv (int vector, int level);
  108. BLK_DEV *fdDevCreate (int fdType, int drive, int nBlks, int offset);
  109. STATUS fdRawio (int drive, int fdType, FD_RAW *pFdRaw);
  110. STATUS usrFdConfig (int type, int drive, char *fileName);
  111. #else
  112. STATUS fdDrv ();
  113. BLK_DEV *fdDevCreate ();
  114. STATUS fdRawio ();
  115. STATUS usrFdConfig ();
  116. #endif  /* __STDC__ */
  117. #endif  /* _ASMLANGUAGE */
  118. #ifdef __cplusplus
  119. }
  120. #endif
  121. #endif /* __INCnec765Fdh */