1 /* $NetBSD: fdreg.h,v 1.1.50.4 2005/01/24 08:34:47 skrll Exp $ */
4 * Copyright (c) 1991 The Regents of the University of California.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. Neither the name of the University nor the names of its contributors
16 * may be used to endorse or promote products derived from this software
17 * without specific prior written permission.
19 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * @(#)fdreg.h 7.1 (Berkeley) 5/9/91
35 * AT floppy controller registers and bitfields
38 /* uses NEC765 controller */
39 #include <dev/ic/nec765reg.h>
45 uint8_t fd_dor
; /* Digital Output Register (R/W) */
46 uint8_t fd_tdr
; /* Tape Control Register (R/W) */
47 uint8_t fd_msr
; /* Main Status Register (R) */
48 #define fd_drs fd_msr /* Data Rate Select Register (W) */
49 uint8_t fd_fifo
; /* Data (FIFO) register (R/W) */
51 uint8_t fd_dir
; /* Digital Input Register (R) */
52 #define fd_ccr fd_dir /* Configuration Control (W) */
56 uint8_t fd_msr
; /* Main Status Register (R) */
58 #define fd_drs fd_msr /* Data Rate Select Register (W) */
60 uint8_t fd_fifo
; /* Data (FIFO) register (R/W) */
64 struct fdreg_72 fun72
;
65 struct fdreg_77 fun77
;
69 /* Data Select Register bits */
70 #define DRS_RESET 0x80
71 #define DRS_POWER 0x40
73 #define FDC_500KBPS 0x00 /* 500KBPS MFM drive transfer rate */
74 #define FDC_300KBPS 0x01 /* 300KBPS MFM drive transfer rate */
75 #define FDC_250KBPS 0x02 /* 250KBPS MFM drive transfer rate */
76 #define FDC_125KBPS 0x03 /* 125KBPS FM drive transfer rate */
78 /* Digital Output Register bits */
79 #define FDO_FDSEL 0x03 /* floppy device select */
80 #define FDO_FRST 0x04 /* floppy controller reset */
81 #define FDO_FDMAEN 0x08 /* enable floppy DMA and Interrupt */
82 #define FDO_MOEN(n) ((1 << n) * 0x10) /* motor enable */
84 #define FDI_DCHG 0x80 /* diskette has been changed */
86 /* XXX - find a place for these... */
87 #define NE7CMD_CFG 0x13
89 #define CFG_EFIFO 0x20
91 #define CFG_THRHLD_MASK 0x0f
93 #define NE7CMD_LOCK 0x14
96 #define NE7CMD_MOTOR 0x0b
99 #define NE7CMD_DUMPREG 0x0e
100 #define NE7CMD_VERSION 0x10
102 #define ST1_OVERRUN 0x10
104 /* sun3x - Floppy Control Register bits */
105 #define FCR_TC 0x01 /* terminal count reset */
106 #define FCR_EJECT 0x02 /* eject floppy */
107 #define FCR_MTRON 0x04 /* motor on */
108 #define FCR_DSEL1 0x08 /* select drive 1 */
109 #define FCR_DSEL0 0x10 /* select drive 0 */
110 #define FCR_DSEL(drive) ((drive) ? FCR_DSEL1 : FCR_DSEL0)
112 /* sun3x - Register offsets */
113 #define FDC_FCR_OFFSET 0x400
114 #define FDC_FVR_OFFSET 0x800