|
|
1.1 root 1: /*
2: * Copyright (c) 1994 Shantanu Goel
3: * All Rights Reserved.
4: *
5: * Permission to use, copy, modify and distribute this software and its
6: * documentation is hereby granted, provided that both the copyright
7: * notice and this permission notice appear in all copies of the
8: * software, derivative works or modified versions, and any portions
9: * thereof, and that both notices appear in supporting documentation.
10: *
11: * THE AUTHOR ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
12: * CONDITION. THE AUTHOR DISCLAIMS ANY LIABILITY OF ANY KIND FOR
13: * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
14: */
15:
16: /*
17: * NEC 765/Intel 8272 floppy disk controller.
18: */
19:
20: /*
21: * Ports
22: */
23: #define FD_DOR(p) (p) /* digital output register */
24: #define FD_STATUS(p) ((p) + 2) /* status register */
25: #define FD_DATA(p) ((p) + 3) /* data register */
26: #define FD_RATE(p) ((p) + 5) /* transfer rate register */
27: #define FD_DIR(p) ((p) + 5) /* digital input register */
28:
29: /*
30: * Digital output register.
31: */
32: #define DOR_IENABLE 0x08 /* enable interrupts and DMA */
33: #define DOR_RSTCLR 0x04 /* clear reset */
34:
35: /*
36: * Status register.
37: */
38: #define ST_RQM 0x80 /* request for master */
39: #define ST_DIO 0x40 /* direction of data transfer
40: 1 = fdc to cpu, 0 = cpu to fdc */
41: #define ST_NDM 0x20 /* non DMA mode */
42: #define ST_CB 0x10 /* controller busy */
43:
44: /*
45: * Digital input register.
46: */
47: #define DIR_DSKCHG 0x80 /* diskette chnage has occured */
48:
49: /*
50: * ST0
51: */
52: #define ST0_IC 0xc0 /* interrupt code */
53: #define ST0_SE 0x20 /* seek end */
54: #define ST0_EC 0x10 /* equipment check */
55: #define ST0_NR 0x08 /* not ready */
56: #define ST0_HD 0x04 /* head address */
57: #define ST0_US 0x03 /* unit select */
58:
59: /*
60: * ST1
61: */
62: #define ST1_EC 0x80 /* end of cylinder */
63: #define ST1_DE 0x20 /* CRC data error */
64: #define ST1_OR 0x10 /* DMA overrun */
65: #define ST1_ND 0x04 /* sector not found */
66: #define ST1_NW 0x02 /* write-protected diskette */
67: #define ST1_MA 0x01 /* missing address mark */
68:
69: /*
70: * ST2
71: */
72: #define ST2_CM 0x40 /* control mark */
73: #define ST2_DD 0x20 /* data error */
74: #define ST2_WC 0x10 /* wrong cylinder */
75: #define ST2_SH 0x08 /* scan equal hit */
76: #define ST2_SN 0x04 /* scan not satisfied */
77: #define ST2_BC 0x02 /* bad cylinder */
78: #define ST2_MD 0x01 /* missing address mark */
79:
80: /*
81: * ST3
82: */
83: #define ST3_FT 0x80 /* fault */
84: #define ST3_WP 0x40 /* write protect */
85: #define ST3_RY 0x20 /* ready */
86: #define ST3_T0 0x10 /* track 0 */
87: #define ST3_TS 0x08 /* two side */
88: #define ST3_HD 0x04 /* head address */
89: #define ST3_US 0x03 /* unit select */
90:
91: /*
92: * Commands.
93: */
94: #define CMD_SPECIFY 0x03
95: #define CMD_RECAL 0x07
96: #define CMD_SENSEI 0x08
97: #define CMD_SEEK 0x0f
98: #define CMD_FORMAT 0x4d
99: #define CMD_WRITE 0xc5
100: #define CMD_READ 0xe6
101:
102: /*
103: * Information required by FDC when formatting a diskette.
104: */
105: struct format_info {
106: unsigned char cyl;
107: unsigned char head;
108: unsigned char sector;
109: unsigned char secsize;
110: };
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.