fdreg.h revision 1.1.1.1.24.1 1 1.1.1.1.24.1 minoura /* $NetBSD: fdreg.h,v 1.1.1.1.24.1 1999/02/02 23:47:12 minoura Exp $ */
2 1.1 oki
3 1.1 oki /*-
4 1.1 oki * Copyright (c) 1991 The Regents of the University of California.
5 1.1 oki * All rights reserved.
6 1.1 oki *
7 1.1 oki * Redistribution and use in source and binary forms, with or without
8 1.1 oki * modification, are permitted provided that the following conditions
9 1.1 oki * are met:
10 1.1 oki * 1. Redistributions of source code must retain the above copyright
11 1.1 oki * notice, this list of conditions and the following disclaimer.
12 1.1 oki * 2. Redistributions in binary form must reproduce the above copyright
13 1.1 oki * notice, this list of conditions and the following disclaimer in the
14 1.1 oki * documentation and/or other materials provided with the distribution.
15 1.1 oki * 3. All advertising materials mentioning features or use of this software
16 1.1 oki * must display the following acknowledgement:
17 1.1 oki * This product includes software developed by the University of
18 1.1 oki * California, Berkeley and its contributors.
19 1.1 oki * 4. Neither the name of the University nor the names of its contributors
20 1.1 oki * may be used to endorse or promote products derived from this software
21 1.1 oki * without specific prior written permission.
22 1.1 oki *
23 1.1 oki * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24 1.1 oki * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 1.1 oki * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 1.1 oki * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27 1.1 oki * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 1.1 oki * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 1.1 oki * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 1.1 oki * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 1.1 oki * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 1.1 oki * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 1.1 oki * SUCH DAMAGE.
34 1.1 oki *
35 1.1 oki * @(#)fdreg.h 7.1 (Berkeley) 5/9/91
36 1.1 oki */
37 1.1 oki
38 1.1 oki /*
39 1.1 oki * x680x0 floppy controller registers and bitfields
40 1.1 oki */
41 1.1 oki
42 1.1 oki /* uses NEC72065 controller */
43 1.1 oki #include <dev/ic/nec765reg.h>
44 1.1 oki
45 1.1 oki /* registers */
46 1.1.1.1.24.1 minoura #define FDC_ADDR 0xe94000 /* builtin fdc is here */
47 1.1.1.1.24.1 minoura #define fdstat 1 /* NEC 765 Main Status Register (R) */
48 1.1.1.1.24.1 minoura #define fddata 3 /* NEC 765 Data Register (R/W) */
49 1.1.1.1.24.1 minoura #define fddrvstat 5 /* drive status register */
50 1.1.1.1.24.1 minoura #define fdselect 7 /* Control Register (W) */
51 1.1 oki #define FDC_500KBPS 0x00 /* 500KBPS MFM drive transfer rate */
52 1.1 oki #define FDC_300KBPS 0x01 /* 300KBPS MFM drive transfer rate */
53 1.1 oki #define FDC_250KBPS 0x02 /* 250KBPS MFM drive transfer rate */
54 1.1 oki #define FDC_125KBPS 0x03 /* 125KBPS FM drive transfer rate */
55 1.1 oki
56 1.1 oki #define FDC_BSIZE 512
57 1.1.1.1.24.1 minoura #define FDC_MAXIOSIZE MAXBSIZE
58 1.1.1.1.24.1 minoura
59 1.1.1.1.24.1 minoura /*
60 1.1.1.1.24.1 minoura * Copyright (C) 1992-1994 by Joerg Wunsch, Dresden
61 1.1.1.1.24.1 minoura * All rights reserved.
62 1.1.1.1.24.1 minoura *
63 1.1.1.1.24.1 minoura * Redistribution and use in source and binary forms, with or without
64 1.1.1.1.24.1 minoura * modification, are permitted provided that the following conditions
65 1.1.1.1.24.1 minoura * are met:
66 1.1.1.1.24.1 minoura * 1. Redistributions of source code must retain the above copyright
67 1.1.1.1.24.1 minoura * notice, this list of conditions and the following disclaimer.
68 1.1.1.1.24.1 minoura * 2. Redistributions in binary form must reproduce the above copyright
69 1.1.1.1.24.1 minoura * notice, this list of conditions and the following disclaimer in the
70 1.1.1.1.24.1 minoura * documentation and/or other materials provided with the distribution.
71 1.1.1.1.24.1 minoura *
72 1.1.1.1.24.1 minoura * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY
73 1.1.1.1.24.1 minoura * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
74 1.1.1.1.24.1 minoura * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
75 1.1.1.1.24.1 minoura * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE
76 1.1.1.1.24.1 minoura * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
77 1.1.1.1.24.1 minoura * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
78 1.1.1.1.24.1 minoura * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
79 1.1.1.1.24.1 minoura * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
80 1.1.1.1.24.1 minoura * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
81 1.1.1.1.24.1 minoura * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
82 1.1.1.1.24.1 minoura * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
83 1.1.1.1.24.1 minoura * DAMAGE.
84 1.1.1.1.24.1 minoura *
85 1.1.1.1.24.1 minoura * From: FreeBSD: Id: ioctl_fd.h,v 1.7 1994/10/30 19:17:39 joerg Exp
86 1.1.1.1.24.1 minoura */
87 1.1.1.1.24.1 minoura
88 1.1.1.1.24.1 minoura #define FD_MAX_NSEC 36 /* highest known number of spt - allow for */
89 1.1.1.1.24.1 minoura /* 2.88 MB drives */
90 1.1.1.1.24.1 minoura
91 1.1.1.1.24.1 minoura struct ne7_fd_formb {
92 1.1.1.1.24.1 minoura int cyl, head;
93 1.1.1.1.24.1 minoura int transfer_rate; /* fdreg.h: FDC_???KBPS */
94 1.1.1.1.24.1 minoura
95 1.1.1.1.24.1 minoura union {
96 1.1.1.1.24.1 minoura struct fd_form_data {
97 1.1.1.1.24.1 minoura /*
98 1.1.1.1.24.1 minoura * DO NOT CHANGE THE LAYOUT OF THIS STRUCTS
99 1.1.1.1.24.1 minoura * it is hardware-dependant since it exactly
100 1.1.1.1.24.1 minoura * matches the byte sequence to write to FDC
101 1.1.1.1.24.1 minoura * during its `format track' operation
102 1.1.1.1.24.1 minoura */
103 1.1.1.1.24.1 minoura u_char secshift; /* 0 -> 128, ...; usually 2 -> 512 */
104 1.1.1.1.24.1 minoura u_char nsecs; /* must be <= FD_MAX_NSEC */
105 1.1.1.1.24.1 minoura u_char gaplen; /* GAP 3 length; usually 84 */
106 1.1.1.1.24.1 minoura u_char fillbyte; /* usually 0xf6 */
107 1.1.1.1.24.1 minoura struct fd_idfield_data {
108 1.1.1.1.24.1 minoura /*
109 1.1.1.1.24.1 minoura * data to write into id fields;
110 1.1.1.1.24.1 minoura * for obscure formats, they mustn't match
111 1.1.1.1.24.1 minoura * the real values (but mostly do)
112 1.1.1.1.24.1 minoura */
113 1.1.1.1.24.1 minoura u_char cylno; /* 0 thru 79 (or 39) */
114 1.1.1.1.24.1 minoura u_char headno; /* 0, or 1 */
115 1.1.1.1.24.1 minoura u_char secno; /* starting at 1! */
116 1.1.1.1.24.1 minoura u_char secsize; /* usually 2 */
117 1.1.1.1.24.1 minoura } idfields[FD_MAX_NSEC]; /* 0 <= idx < nsecs used */
118 1.1.1.1.24.1 minoura } structured;
119 1.1.1.1.24.1 minoura u_char raw[1]; /* to have continuous indexed access */
120 1.1.1.1.24.1 minoura } format_info;
121 1.1.1.1.24.1 minoura };
122 1.1.1.1.24.1 minoura
123 1.1.1.1.24.1 minoura /* make life easier */
124 1.1.1.1.24.1 minoura # define fd_formb_secshift format_info.structured.secshift
125 1.1.1.1.24.1 minoura # define fd_formb_nsecs format_info.structured.nsecs
126 1.1.1.1.24.1 minoura # define fd_formb_gaplen format_info.structured.gaplen
127 1.1.1.1.24.1 minoura # define fd_formb_fillbyte format_info.structured.fillbyte
128 1.1.1.1.24.1 minoura /* these data must be filled in for(i = 0; i < fd_formb_nsecs; i++) */
129 1.1.1.1.24.1 minoura # define fd_formb_cylno(i) format_info.structured.idfields[i].cylno
130 1.1.1.1.24.1 minoura # define fd_formb_headno(i) format_info.structured.idfields[i].headno
131 1.1.1.1.24.1 minoura # define fd_formb_secno(i) format_info.structured.idfields[i].secno
132 1.1.1.1.24.1 minoura # define fd_formb_secsize(i) format_info.structured.idfields[i].secsize
133 1.1.1.1.24.1 minoura
134 1.1.1.1.24.1 minoura
135 1.1.1.1.24.1 minoura /* Floppy disk controller command bytes. */
136 1.1.1.1.24.1 minoura #define NE7CMD_RESET 0x36 /* reset command for fdc */
137