fdreg.h revision 1.2
11.2Sthorpej/* $NetBSD: fdreg.h,v 1.2 2003/04/09 01:54:42 thorpej Exp $ */ 21.1Sreinoud 31.1Sreinoud/*- 41.1Sreinoud * Copyright (c) 1991 The Regents of the University of California. 51.1Sreinoud * All rights reserved. 61.1Sreinoud * 71.1Sreinoud * Redistribution and use in source and binary forms, with or without 81.1Sreinoud * modification, are permitted provided that the following conditions 91.1Sreinoud * are met: 101.1Sreinoud * 1. Redistributions of source code must retain the above copyright 111.1Sreinoud * notice, this list of conditions and the following disclaimer. 121.1Sreinoud * 2. Redistributions in binary form must reproduce the above copyright 131.1Sreinoud * notice, this list of conditions and the following disclaimer in the 141.1Sreinoud * documentation and/or other materials provided with the distribution. 151.1Sreinoud * 3. All advertising materials mentioning features or use of this software 161.1Sreinoud * must display the following acknowledgement: 171.1Sreinoud * This product includes software developed by the University of 181.1Sreinoud * California, Berkeley and its contributors. 191.1Sreinoud * 4. Neither the name of the University nor the names of its contributors 201.1Sreinoud * may be used to endorse or promote products derived from this software 211.1Sreinoud * without specific prior written permission. 221.1Sreinoud * 231.1Sreinoud * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 241.1Sreinoud * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 251.1Sreinoud * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 261.1Sreinoud * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 271.1Sreinoud * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 281.1Sreinoud * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 291.1Sreinoud * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 301.1Sreinoud * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 311.1Sreinoud * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 321.1Sreinoud * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 331.1Sreinoud * SUCH DAMAGE. 341.1Sreinoud * 351.1Sreinoud * @(#)fdreg.h 7.1 (Berkeley) 5/9/91 361.1Sreinoud * from: fdreg.h,v 1.9 1996/11/29 16:28:40 jtk 371.1Sreinoud */ 381.1Sreinoud 391.1Sreinoud/* 401.1Sreinoud * AT floppy controller registers and bitfields 411.1Sreinoud */ 421.1Sreinoud 431.1Sreinoud/* uses NEC765 controller */ 441.1Sreinoud#include <dev/ic/nec765reg.h> 451.1Sreinoud 461.1Sreinoud/* registers */ 471.1Sreinoud#define fdout 2 /* Digital Output Register (W) */ 481.1Sreinoud#define FDO_FDSEL 0x03 /* floppy device select */ 491.1Sreinoud#define FDO_FRST 0x04 /* floppy controller reset */ 501.1Sreinoud#define FDO_FDMAEN 0x08 /* enable floppy DMA and Interrupt */ 511.1Sreinoud#define FDO_MOEN(n) ((1 << n) * 0x10) /* motor enable */ 521.1Sreinoud 531.1Sreinoud#define fdsts 4 /* NEC 765 Main Status Register (R) */ 541.1Sreinoud#define fddata 5 /* NEC 765 Data Register (R/W) */ 551.1Sreinoud 561.1Sreinoud#define fdctl 7 /* Control Register (W) */ 571.1Sreinoud#define FDC_500KBPS 0x00 /* 500KBPS MFM drive transfer rate */ 581.1Sreinoud#define FDC_300KBPS 0x01 /* 300KBPS MFM drive transfer rate */ 591.1Sreinoud#define FDC_250KBPS 0x02 /* 250KBPS MFM drive transfer rate */ 601.1Sreinoud#define FDC_125KBPS 0x03 /* 125KBPS FM drive transfer rate */ 611.1Sreinoud 621.1Sreinoud#define fdin 7 /* Digital Input Register (R) */ 631.1Sreinoud#define FDI_DCHG 0x80 /* diskette has been changed */ 641.1Sreinoud 651.1Sreinoud#define FDC_BSIZE 512 661.1Sreinoud#define FDC_NPORT 8 671.2Sthorpej#define FDC_MAXIOSIZE PAGE_SIZE /* XXX should be MAXBSIZE */ 681.1Sreinoud 691.1Sreinoud/* 701.1Sreinoud * Copyright (C) 1992-1994 by Joerg Wunsch, Dresden 711.1Sreinoud * All rights reserved. 721.1Sreinoud * 731.1Sreinoud * Redistribution and use in source and binary forms, with or without 741.1Sreinoud * modification, are permitted provided that the following conditions 751.1Sreinoud * are met: 761.1Sreinoud * 1. Redistributions of source code must retain the above copyright 771.1Sreinoud * notice, this list of conditions and the following disclaimer. 781.1Sreinoud * 2. Redistributions in binary form must reproduce the above copyright 791.1Sreinoud * notice, this list of conditions and the following disclaimer in the 801.1Sreinoud * documentation and/or other materials provided with the distribution. 811.1Sreinoud * 821.1Sreinoud * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY 831.1Sreinoud * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 841.1Sreinoud * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 851.1Sreinoud * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE 861.1Sreinoud * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 871.1Sreinoud * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 881.1Sreinoud * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 891.1Sreinoud * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 901.1Sreinoud * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 911.1Sreinoud * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 921.1Sreinoud * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 931.1Sreinoud * DAMAGE. 941.1Sreinoud * 951.1Sreinoud * From: FreeBSD: Id: ioctl_fd.h,v 1.7 1994/10/30 19:17:39 joerg Exp 961.1Sreinoud */ 971.1Sreinoud 981.1Sreinoud#define FD_MAX_NSEC 36 /* highest known number of spt - allow for */ 991.1Sreinoud /* 2.88 MB drives */ 1001.1Sreinoud 1011.1Sreinoudstruct ne7_fd_formb { 1021.1Sreinoud int cyl, head; 1031.1Sreinoud int transfer_rate; /* fdreg.h: FDC_???KBPS */ 1041.1Sreinoud 1051.1Sreinoud union { 1061.1Sreinoud struct fd_form_data { 1071.1Sreinoud /* 1081.1Sreinoud * DO NOT CHANGE THE LAYOUT OF THIS STRUCTS 1091.1Sreinoud * it is hardware-dependant since it exactly 1101.1Sreinoud * matches the byte sequence to write to FDC 1111.1Sreinoud * during its `format track' operation 1121.1Sreinoud */ 1131.1Sreinoud u_char secshift; /* 0 -> 128, ...; usually 2 -> 512 */ 1141.1Sreinoud u_char nsecs; /* must be <= FD_MAX_NSEC */ 1151.1Sreinoud u_char gaplen; /* GAP 3 length; usually 84 */ 1161.1Sreinoud u_char fillbyte; /* usually 0xf6 */ 1171.1Sreinoud struct fd_idfield_data { 1181.1Sreinoud /* 1191.1Sreinoud * data to write into id fields; 1201.1Sreinoud * for obscure formats, they mustn't match 1211.1Sreinoud * the real values (but mostly do) 1221.1Sreinoud */ 1231.1Sreinoud u_char cylno; /* 0 thru 79 (or 39) */ 1241.1Sreinoud u_char headno; /* 0, or 1 */ 1251.1Sreinoud u_char secno; /* starting at 1! */ 1261.1Sreinoud u_char secsize; /* usually 2 */ 1271.1Sreinoud } idfields[FD_MAX_NSEC]; /* 0 <= idx < nsecs used */ 1281.1Sreinoud } structured; 1291.1Sreinoud u_char raw[1]; /* to have continuous indexed access */ 1301.1Sreinoud } format_info; 1311.1Sreinoud}; 1321.1Sreinoud 1331.1Sreinoud/* make life easier */ 1341.1Sreinoud# define fd_formb_secshift format_info.structured.secshift 1351.1Sreinoud# define fd_formb_nsecs format_info.structured.nsecs 1361.1Sreinoud# define fd_formb_gaplen format_info.structured.gaplen 1371.1Sreinoud# define fd_formb_fillbyte format_info.structured.fillbyte 1381.1Sreinoud/* these data must be filled in for(i = 0; i < fd_formb_nsecs; i++) */ 1391.1Sreinoud# define fd_formb_cylno(i) format_info.structured.idfields[i].cylno 1401.1Sreinoud# define fd_formb_headno(i) format_info.structured.idfields[i].headno 1411.1Sreinoud# define fd_formb_secno(i) format_info.structured.idfields[i].secno 1421.1Sreinoud# define fd_formb_secsize(i) format_info.structured.idfields[i].secsize 143