fdcio.h revision 1817
11573Srgrimes/* 219029Speter * Copyright (C) 1992-1993 by Joerg Wunsch, Dresden 31573Srgrimes * All rights reserved. 41573Srgrimes * 51573Srgrimes * Redistribution and use in source and binary forms, with or without 61573Srgrimes * modification, are permitted provided that the following conditions 71573Srgrimes * are met: 81573Srgrimes * 1. Redistributions of source code must retain the above copyright 91573Srgrimes * notice, this list of conditions and the following disclaimer. 101573Srgrimes * 2. Redistributions in binary form must reproduce the above copyright 111573Srgrimes * notice, this list of conditions and the following disclaimer in the 121573Srgrimes * documentation and/or other materials provided with the distribution. 131573Srgrimes * 141573Srgrimes * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND 151573Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 161573Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 171573Srgrimes * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 181573Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 191573Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 201573Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 211573Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 221573Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 231573Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 241573Srgrimes * SUCH DAMAGE. 251573Srgrimes * 261573Srgrimes * $Id$ 271573Srgrimes */ 281573Srgrimes 291573Srgrimes#ifndef _IOCTL_FD_H 301573Srgrimes#define _IOCTL_FD_H 311573Srgrimes 321573Srgrimes#include <sys/types.h> 331573Srgrimes#include <sys/ioctl.h> 3419029Speter 351573Srgrimes#define FD_FORMAT_VERSION 110 /* used to validate before formatting */ 3692889Sobrien#define FD_MAX_NSEC 36 /* highest known number of spt - allow for */ 3792889Sobrien /* 2.88 MB drives */ 381573Srgrimes 391573Srgrimesstruct fd_formb { 401573Srgrimes int format_version; /* == FD_FORMAT_VERSION */ 411573Srgrimes int cyl, head; 421573Srgrimes int transfer_rate; /* fdreg.h: FDC_???KBPS */ 431573Srgrimes 441573Srgrimes union { 451573Srgrimes struct fd_form_data { 461573Srgrimes /* 471573Srgrimes * DO NOT CHANGE THE LAYOUT OF THIS STRUCTS 481573Srgrimes * it is hardware-dependant since it exactly 491573Srgrimes * matches the byte sequence to write to FDC 501573Srgrimes * during its `format track' operation 511573Srgrimes */ 521573Srgrimes u_char secshift; /* 0 -> 128, ...; usually 2 -> 512 */ 531573Srgrimes u_char nsecs; /* must be <= FD_MAX_NSEC */ 541573Srgrimes u_char gaplen; /* GAP 3 length; usually 84 */ 551573Srgrimes u_char fillbyte; /* usually 0xf6 */ 561573Srgrimes struct fd_idfield_data { 5719029Speter /* 581573Srgrimes * data to write into id fields; 591573Srgrimes * for obscure formats, they mustn't match 6019029Speter * the real values (but mostly do) 611573Srgrimes */ 621573Srgrimes u_char cylno; /* 0 thru 79 (or 39) */ 631573Srgrimes u_char headno; /* 0, or 1 */ 641573Srgrimes u_char secno; /* starting at 1! */ 651573Srgrimes u_char secsize; /* usually 2 */ 661573Srgrimes } idfields[FD_MAX_NSEC]; /* 0 <= idx < nsecs used */ 671573Srgrimes } structured; 681573Srgrimes u_char raw[1]; /* to have continuous indexed access */ 691573Srgrimes } format_info; 7092905Sobrien}; 711573Srgrimes 721573Srgrimes/* make life easier */ 731573Srgrimes# define fd_formb_secshift format_info.structured.secshift 741573Srgrimes# define fd_formb_nsecs format_info.structured.nsecs 751573Srgrimes# define fd_formb_gaplen format_info.structured.gaplen 761573Srgrimes# define fd_formb_fillbyte format_info.structured.fillbyte 771573Srgrimes/* these data must be filled in for(i = 0; i < fd_formb_nsecs; i++) */ 781573Srgrimes# define fd_formb_cylno(i) format_info.structured.idfields[i].cylno 791573Srgrimes# define fd_formb_headno(i) format_info.structured.idfields[i].headno 801573Srgrimes# define fd_formb_secno(i) format_info.structured.idfields[i].secno 811573Srgrimes# define fd_formb_secsize(i) format_info.structured.idfields[i].secsize 821573Srgrimes 831573Srgrimesstruct fd_type { 841573Srgrimes int sectrac; /* sectors per track */ 851573Srgrimes int secsize; /* size code for sectors */ 861573Srgrimes int datalen; /* data len when secsize = 0 */ 871573Srgrimes int gap; /* gap len between sectors */ 881573Srgrimes int tracks; /* total num of tracks */ 891573Srgrimes int size; /* size of disk in sectors */ 901573Srgrimes int steptrac; /* steps per cylinder */ 911573Srgrimes int trans; /* transfer speed code */ 921573Srgrimes int heads; /* number of heads */ 931573Srgrimes int f_gap; /* format gap len */ 941573Srgrimes int f_inter; /* format interleave factor */ 951573Srgrimes}; 961573Srgrimes 971573Srgrimes#define FD_FORM _IOW('F', 61, struct fd_formb) /* format a track */ 981573Srgrimes#define FD_GTYPE _IOR('F', 62, struct fd_type) /* get drive type */ 991573Srgrimes 1001573Srgrimes#endif /* !def _IOCTL_FD_H */ 101189291Sdelphij