1/* $NetBSD: fdio.h,v 1.6 2016/01/23 01:26:14 dholland 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 *
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 */
31
32#ifndef _SYS_FDIO_H_
33#define _SYS_FDIO_H_
34
35#include <sys/ioccom.h>
36
37/* Floppy diskette definitions */
38
39enum fdformat_result {
40 FDFORMAT_SUCCESS,
41 FDFORMAT_MEDIA_ERROR, /* hardware reported a formatting
42 error */
43 FDFORMAT_CONFIG_ERROR /* something bogus in parameters */
44};
45
46#define FDFORMAT_VERSION 19961120
47
48struct fdformat_cmd {
49 unsigned int formatcmd_version; /* FDFORMAT_VERSION */
50 int head; /* IN */
51 int cylinder; /* IN */
52};
53
54struct fdformat_parms {
55/* list of items taken from i386 formatting glop (NEC 765);
56 should be made the union of support needed for other devices. */
57 unsigned int fdformat_version;/* rev this when needed; write drivers to
58 allow forward compatibility, please,
59 and add elements to the end of the
60 structure */
61 unsigned int nbps; /* number of bytes per sector */
62 unsigned int ncyl; /* number of cylinders */
63 unsigned int nspt; /* sectors per track */
64 unsigned int ntrk; /* number of heads/tracks per cyl */
65 unsigned int stepspercyl; /* steps per cylinder */
66 unsigned int gaplen; /* formatting gap length */
67 unsigned int fillbyte; /* formatting fill byte */
68 unsigned int xfer_rate; /* in bits per second; driver
69 must convert */
70 unsigned int interleave; /* interleave factor */
71};
72
73
74#define FDOPT_NORETRY 0x0001 /* no retries on failure (cleared on close) */
75#define FDOPT_SILENT 0x0002 /* no error messages (cleared on close) */
76
77#define FDIOCGETOPTS _IOR('d', 114, int) /* drive options, see previous */
78#define FDIOCSETOPTS _IOW('d', 115, int)
79
80#define FDIOCSETFORMAT _IOW('d', 116, struct fdformat_parms) /* set format parms */
81#define FDIOCGETFORMAT _IOR('d', 117, struct fdformat_parms) /* get format parms */
82#define FDIOCFORMAT_TRACK _IOW('d', 118, struct fdformat_cmd) /* do it */
83
84#endif /* _SYS_FDIO_H_ */
85