fdcio.h (78856) | fdcio.h (87992) |
---|---|
1/* 2 * Copyright (C) 1992-1994,2001 by Joerg Wunsch, Dresden 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 10 unchanged lines hidden (view full) --- 19 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 20 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 21 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 22 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 24 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 25 * DAMAGE. 26 * | 1/* 2 * Copyright (C) 1992-1994,2001 by Joerg Wunsch, Dresden 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 10 unchanged lines hidden (view full) --- 19 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 20 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 21 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 22 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 24 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 25 * DAMAGE. 26 * |
27 * $FreeBSD: head/sys/sys/fdcio.h 78856 2001-06-26 22:16:30Z joerg $ | 27 * $FreeBSD: head/sys/sys/fdcio.h 87992 2001-12-15 19:09:04Z joerg $ |
28 */ 29 30#ifndef _MACHINE_IOCTL_FD_H_ 31#define _MACHINE_IOCTL_FD_H_ 32 33#ifndef _KERNEL 34#include <sys/types.h> 35#endif 36#include <sys/ioccom.h> 37 38#define FD_FORMAT_VERSION 110 /* used to validate before formatting */ 39#define FD_MAX_NSEC 36 /* highest known number of spt - allow for */ 40 /* 2.88 MB drives */ 41 42struct fd_formb { 43 int format_version; /* == FD_FORMAT_VERSION */ 44 int cyl, head; | 28 */ 29 30#ifndef _MACHINE_IOCTL_FD_H_ 31#define _MACHINE_IOCTL_FD_H_ 32 33#ifndef _KERNEL 34#include <sys/types.h> 35#endif 36#include <sys/ioccom.h> 37 38#define FD_FORMAT_VERSION 110 /* used to validate before formatting */ 39#define FD_MAX_NSEC 36 /* highest known number of spt - allow for */ 40 /* 2.88 MB drives */ 41 42struct fd_formb { 43 int format_version; /* == FD_FORMAT_VERSION */ 44 int cyl, head; |
45 int transfer_rate; /* fdreg.h: FDC_???KBPS */ | 45 int transfer_rate; /* FDC_???KBPS */ |
46 47 union { 48 struct fd_form_data { 49 /* 50 * DO NOT CHANGE THE LAYOUT OF THIS STRUCTS 51 * it is hardware-dependent since it exactly 52 * matches the byte sequence to write to FDC 53 * during its `format track' operation --- 29 unchanged lines hidden (view full) --- 83# define fd_formb_secno(i) format_info.structured.idfields[i].secno 84# define fd_formb_secsize(i) format_info.structured.idfields[i].secsize 85 86struct fd_type { 87 int sectrac; /* sectors per track */ 88 int secsize; /* size code for sectors */ 89 int datalen; /* data len when secsize = 0 */ 90 int gap; /* gap len between sectors */ | 46 47 union { 48 struct fd_form_data { 49 /* 50 * DO NOT CHANGE THE LAYOUT OF THIS STRUCTS 51 * it is hardware-dependent since it exactly 52 * matches the byte sequence to write to FDC 53 * during its `format track' operation --- 29 unchanged lines hidden (view full) --- 83# define fd_formb_secno(i) format_info.structured.idfields[i].secno 84# define fd_formb_secsize(i) format_info.structured.idfields[i].secsize 85 86struct fd_type { 87 int sectrac; /* sectors per track */ 88 int secsize; /* size code for sectors */ 89 int datalen; /* data len when secsize = 0 */ 90 int gap; /* gap len between sectors */ |
91 int tracks; /* total num of tracks */ | 91 int tracks; /* total number of cylinders */ |
92 int size; /* size of disk in sectors */ | 92 int size; /* size of disk in sectors */ |
93 int steptrac; /* steps per cylinder */ | |
94 int trans; /* transfer speed code */ 95 int heads; /* number of heads */ 96 int f_gap; /* format gap len */ 97 int f_inter; /* format interleave factor */ | 93 int trans; /* transfer speed code */ 94 int heads; /* number of heads */ 95 int f_gap; /* format gap len */ 96 int f_inter; /* format interleave factor */ |
97 int offset_side2; /* offset of sectors on side2 */ 98 int flags; /* misc. features */ 99#define FL_MFM 0x0001 /* MFM recording */ 100#define FL_2STEP 0x0002 /* 2 steps between cylinders */ 101#define FL_PERPND 0x0004 /* perpendicular recording */ |
|
98}; 99 100struct fdc_status { 101 u_int status[7]; 102}; 103 104/* 105 * cyl and head are being passed into ioctl(FD_READID) 106 * all four fields are being returned 107 */ 108struct fdc_readid { 109 u_char cyl; /* C - 0...79 */ 110 u_char head; /* H - 0...1 */ 111 u_char sec; /* R - 1...n */ 112 u_char secshift; /* N - log2(secsize / 128) */ 113}; 114 | 102}; 103 104struct fdc_status { 105 u_int status[7]; 106}; 107 108/* 109 * cyl and head are being passed into ioctl(FD_READID) 110 * all four fields are being returned 111 */ 112struct fdc_readid { 113 u_char cyl; /* C - 0...79 */ 114 u_char head; /* H - 0...1 */ 115 u_char sec; /* R - 1...n */ 116 u_char secshift; /* N - log2(secsize / 128) */ 117}; 118 |
119/* 120 * Diskette drive type, basically the same as stored in RTC on ISA 121 * machines (see /sys/isa/rtc.h), but right-shifted by four bits. 122 */ 123enum fd_drivetype { 124 FDT_NONE, FDT_360K, FDT_12M, FDT_720K, FDT_144M, FDT_288M_1, 125 FDT_288M 126}; 127 128 |
|
115#define FD_FORM _IOW('F', 61, struct fd_formb) /* format a track */ 116#define FD_GTYPE _IOR('F', 62, struct fd_type) /* get drive type */ 117#define FD_STYPE _IOW('F', 63, struct fd_type) /* set drive type */ 118 119#define FD_GOPTS _IOR('F', 64, int) /* drive options, see below */ 120#define FD_SOPTS _IOW('F', 65, int) 121 122#define FD_DEBUG _IOW('F', 66, int) 123 124#define FD_CLRERR _IO('F', 67) /* clear error counter */ 125 126#define FD_READID _IOWR('F', 68, struct fdc_readid) /* read ID field */ 127 128/* 129 * Obtain NE765 status registers. Only successful if there is 130 * a valid status stored in fdc->status[]. 131 */ | 129#define FD_FORM _IOW('F', 61, struct fd_formb) /* format a track */ 130#define FD_GTYPE _IOR('F', 62, struct fd_type) /* get drive type */ 131#define FD_STYPE _IOW('F', 63, struct fd_type) /* set drive type */ 132 133#define FD_GOPTS _IOR('F', 64, int) /* drive options, see below */ 134#define FD_SOPTS _IOW('F', 65, int) 135 136#define FD_DEBUG _IOW('F', 66, int) 137 138#define FD_CLRERR _IO('F', 67) /* clear error counter */ 139 140#define FD_READID _IOWR('F', 68, struct fdc_readid) /* read ID field */ 141 142/* 143 * Obtain NE765 status registers. Only successful if there is 144 * a valid status stored in fdc->status[]. 145 */ |
132#define FD_GSTAT _IOR('F', 68, struct fdc_status) | 146#define FD_GSTAT _IOR('F', 69, struct fdc_status) |
133 | 147 |
148#define FD_GDTYPE _IOR('F', 70, enum fd_drivetype) /* obtain drive type */ 149 |
|
134/* Options for FD_GOPTS/FD_SOPTS, cleared on device close */ 135#define FDOPT_NORETRY 0x0001 /* no retries on failure */ 136#define FDOPT_NOERRLOG 0x002 /* no "hard error" kernel log messages */ 137#define FDOPT_NOERROR 0x0004 /* do not indicate errors, caller will use 138 FD_GSTAT in order to obtain status */ | 150/* Options for FD_GOPTS/FD_SOPTS, cleared on device close */ 151#define FDOPT_NORETRY 0x0001 /* no retries on failure */ 152#define FDOPT_NOERRLOG 0x002 /* no "hard error" kernel log messages */ 153#define FDOPT_NOERROR 0x0004 /* do not indicate errors, caller will use 154 FD_GSTAT in order to obtain status */ |
155#define FDOPT_AUTOSEL 0x8000 /* read/only option: device performs media 156 * autoselection */ |
|
139 140/* | 157 158/* |
141 * The following definitions duplicate those in sys/i386/isa/fdreg.h 142 * They are here since their values are to be used in the above 143 * structure when formatting a floppy. For very obvious reasons, both 144 * definitions must match ;-) | 159 * Transfer rate definitions. Used in the structures above. They 160 * represent the hardware encoding of bits 0 and 1 of the FDC control 161 * register when writing to the register. 162 * Transfer rates for FM encoding are half the values listed here 163 * (but we currently don't support FM encoding). |
145 */ | 164 */ |
146#ifndef FDC_500KBPS | |
147#define FDC_500KBPS 0x00 /* 500KBPS MFM drive transfer rate */ 148#define FDC_300KBPS 0x01 /* 300KBPS MFM drive transfer rate */ 149#define FDC_250KBPS 0x02 /* 250KBPS MFM drive transfer rate */ | 165#define FDC_500KBPS 0x00 /* 500KBPS MFM drive transfer rate */ 166#define FDC_300KBPS 0x01 /* 300KBPS MFM drive transfer rate */ 167#define FDC_250KBPS 0x02 /* 250KBPS MFM drive transfer rate */ |
150#define FDC_125KBPS 0x03 /* 125KBPS FM drive transfer rate */ 151 /* for some controllers 1MPBS instead */ 152#endif /* FDC_500KBPS */ | 168#define FDC_1MBPS 0x03 /* 1MPBS MFM drive transfer rate */ |
153 154#endif /* !_MACHINE_IOCTL_FD_H_ */ | 169 170#endif /* !_MACHINE_IOCTL_FD_H_ */ |