1 /* $NetBSD: fdio.h,v 1.3 1998/09/13 14:46:24 christos Exp $ */ 2 3 /*- 4 * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc. 5 * All rights reserved. 6 * 7 * This code is derived from software contributed to The NetBSD Foundation 8 * by John Kohl. 9 * 10 * Redistribution and use in source and binary forms, with or without 11 * modification, are permitted provided that the following conditions 12 * are met: 13 * 1. Redistributions of source code must retain the above copyright 14 * notice, this list of conditions and the following disclaimer. 15 * 2. Redistributions in binary form must reproduce the above copyright 16 * notice, this list of conditions and the following disclaimer in the 17 * documentation and/or other materials provided with the distribution. 18 * 3. All advertising materials mentioning features or use of this software 19 * must display the following acknowledgement: 20 * This product includes software developed by the NetBSD 21 * Foundation, Inc. and its contributors. 22 * 4. Neither the name of The NetBSD Foundation nor the names of its 23 * contributors may be used to endorse or promote products derived 24 * from this software without specific prior written permission. 25 * 26 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 27 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 28 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 29 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 30 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 31 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 32 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 33 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 34 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 35 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 36 * POSSIBILITY OF SUCH DAMAGE. 37 */ 38 39 #ifndef _SYS_FDIO_H_ 40 #define _SYS_FDIO_H_ 41 42 #include <sys/ioccom.h> 43 44 /* Floppy diskette definitions */ 45 46 enum fdformat_result { 47 FDFORMAT_SUCCESS, 48 FDFORMAT_MEDIA_ERROR, /* hardware reported a formatting 49 error */ 50 FDFORMAT_CONFIG_ERROR /* something bogus in parameters */ 51 }; 52 53 #define FDFORMAT_VERSION 19961120 54 55 struct fdformat_cmd { 56 u_int formatcmd_version; /* FDFORMAT_VERSION */ 57 int head; /* IN */ 58 int cylinder; /* IN */ 59 }; 60 61 struct fdformat_parms { 62 /* list of items taken from i386 formatting glop (NEC 765); 63 should be made the union of support needed for other devices. */ 64 u_int fdformat_version; /* rev this when needed; write drivers to 65 allow forward compatibility, please, 66 and add elements to the end of the 67 structure */ 68 u_int nbps; /* number of bytes per sector */ 69 u_int ncyl; /* number of cylinders */ 70 u_int nspt; /* sectors per track */ 71 u_int ntrk; /* number of heads/tracks per cyl */ 72 u_int stepspercyl; /* steps per cylinder */ 73 u_int gaplen; /* formatting gap length */ 74 u_int fillbyte; /* formatting fill byte */ 75 u_int xfer_rate; /* in bits per second; driver 76 must convert */ 77 u_int interleave; /* interleave factor */ 78 }; 79 80 81 #define FDOPT_NORETRY 0x0001 /* no retries on failure (cleared on close) */ 82 #define FDOPT_SILENT 0x0002 /* no error messages (cleared on close) */ 83 84 #define FDIOCGETOPTS _IOR('d', 114, int) /* drive options, see previous */ 85 #define FDIOCSETOPTS _IOW('d', 115, int) 86 87 #define FDIOCSETFORMAT _IOW('d', 116, struct fdformat_parms) /* set format parms */ 88 #define FDIOCGETFORMAT _IOR('d', 117, struct fdformat_parms) /* get format parms */ 89 #define FDIOCFORMAT_TRACK _IOW('d', 118, struct fdformat_cmd) /* do it */ 90 91 #endif /* _SYS_FDIO_H_ */ 92