Home | History | Annotate | Line # | Download | only in common
linux_fdio.h revision 1.2.4.1
      1  1.2.4.1   yamt /*	$NetBSD: linux_fdio.h,v 1.2.4.1 2007/09/03 14:32:21 yamt Exp $	*/
      2      1.1   fvdl 
      3      1.1   fvdl /*
      4      1.1   fvdl  * Copyright (c) 2000 Wasabi Systems, Inc.
      5      1.1   fvdl  * All rights reserved.
      6      1.1   fvdl  *
      7      1.1   fvdl  * Written by Frank van der Linden for Wasabi Systems, Inc.
      8      1.1   fvdl  *
      9      1.1   fvdl  * Redistribution and use in source and binary forms, with or without
     10      1.1   fvdl  * modification, are permitted provided that the following conditions
     11      1.1   fvdl  * are met:
     12      1.1   fvdl  * 1. Redistributions of source code must retain the above copyright
     13      1.1   fvdl  *    notice, this list of conditions and the following disclaimer.
     14      1.1   fvdl  * 2. Redistributions in binary form must reproduce the above copyright
     15      1.1   fvdl  *    notice, this list of conditions and the following disclaimer in the
     16      1.1   fvdl  *    documentation and/or other materials provided with the distribution.
     17      1.1   fvdl  * 3. All advertising materials mentioning features or use of this software
     18      1.1   fvdl  *    must display the following acknowledgement:
     19      1.1   fvdl  *      This product includes software developed for the NetBSD Project by
     20      1.1   fvdl  *      Wasabi Systems, Inc.
     21      1.1   fvdl  * 4. The name of Wasabi Systems, Inc. may not be used to endorse
     22      1.1   fvdl  *    or promote products derived from this software without specific prior
     23      1.1   fvdl  *    written permission.
     24      1.1   fvdl  *
     25      1.1   fvdl  * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
     26      1.1   fvdl  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     27      1.1   fvdl  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     28      1.1   fvdl  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL WASABI SYSTEMS, INC
     29      1.1   fvdl  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     30      1.1   fvdl  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     31      1.1   fvdl  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     32      1.1   fvdl  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     33      1.1   fvdl  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     34      1.1   fvdl  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     35      1.1   fvdl  * POSSIBILITY OF SUCH DAMAGE.
     36      1.1   fvdl  */
     37      1.1   fvdl 
     38      1.1   fvdl #ifndef _LINUX_FDIO_H
     39      1.1   fvdl #define _LINUX_FDIO_H
     40      1.1   fvdl 
     41      1.1   fvdl /*
     42      1.1   fvdl  * Linux floppy ioctl call structures and defines.
     43      1.1   fvdl  */
     44      1.1   fvdl 
     45      1.1   fvdl struct linux_floppy_struct {
     46      1.1   fvdl 	u_int size;
     47      1.1   fvdl 	u_int sect;
     48      1.1   fvdl 	u_int head;
     49      1.1   fvdl 	u_int track;
     50      1.1   fvdl 	u_int stretch;
     51      1.1   fvdl 	u_char gap;
     52      1.1   fvdl 	u_char rate;
     53      1.1   fvdl 	u_char spec1;
     54      1.1   fvdl 	u_char fmt_gap;
     55      1.1   fvdl 	const char *name;
     56      1.1   fvdl };
     57      1.1   fvdl 
     58      1.1   fvdl struct linux_floppy_max_errors {
     59      1.1   fvdl 	u_int abort;
     60      1.1   fvdl 	u_int read_track;
     61      1.1   fvdl 	u_int reset;
     62      1.1   fvdl 	u_int recal;
     63      1.1   fvdl 	u_int reporting;
     64      1.1   fvdl };
     65      1.1   fvdl 
     66      1.1   fvdl struct linux_floppy_drive_params {
     67      1.1   fvdl 	char cmos;
     68      1.1   fvdl 	u_long max_dtr;
     69      1.1   fvdl 	u_long hlt;
     70      1.1   fvdl 	u_long hut;
     71      1.1   fvdl         u_long srt;
     72      1.1   fvdl 	u_long spinup;
     73      1.1   fvdl 	u_long spindown;
     74      1.1   fvdl         u_char spindown_offset;
     75      1.1   fvdl 	u_char select_delay;
     76      1.1   fvdl 	u_char rps;
     77      1.1   fvdl 	u_char tracks;
     78      1.1   fvdl 	u_long timeout;
     79      1.1   fvdl 	u_char interleave_sect;
     80      1.1   fvdl 	struct linux_floppy_max_errors max_errors;
     81      1.1   fvdl 	char flags;
     82      1.1   fvdl 	char read_track;
     83      1.1   fvdl 	short autodetect[8];
     84      1.1   fvdl 	int checkfreq;
     85      1.1   fvdl 	int native_format;
     86      1.1   fvdl };
     87      1.1   fvdl 
     88      1.1   fvdl struct linux_floppy_drive_struct {
     89      1.1   fvdl 	u_long flags;
     90      1.1   fvdl 	u_long spinup_date;
     91      1.1   fvdl 	u_long select_date;
     92      1.1   fvdl 	u_long first_read_date;
     93      1.1   fvdl 	short probed_format;
     94      1.1   fvdl 	short track;
     95      1.1   fvdl 	short maxblock;
     96      1.1   fvdl 	short maxtrack;
     97      1.1   fvdl 	int generation;
     98      1.1   fvdl 	int keep_data;
     99      1.1   fvdl 	int fd_ref;
    100      1.1   fvdl 	int fd_device;
    101      1.1   fvdl 	u_long last_checked;
    102      1.1   fvdl 	char *dmabuf;
    103      1.1   fvdl 	int bufblocks;
    104      1.1   fvdl };
    105      1.1   fvdl 
    106      1.1   fvdl #define LINUX_FD_NEED_TWADDLE	0x01
    107      1.1   fvdl #define LINUX_FD_VERIFY		0x02
    108      1.1   fvdl #define LINUX_FD_DISK_NEWCHANGE	0x04
    109      1.1   fvdl #define LINUX_FD_DISK_CHANGED	0x10
    110      1.1   fvdl #define LINUX_FD_DISK_WRITABLE	0x20
    111      1.1   fvdl 
    112      1.1   fvdl 
    113      1.2  perry struct linux_floppy_fdc_state {
    114      1.1   fvdl 	int spec1;
    115      1.1   fvdl 	int spec2;
    116      1.1   fvdl 	int dtr;
    117      1.1   fvdl 	u_char version;
    118      1.1   fvdl 	u_char dor;
    119      1.1   fvdl 	u_long address;
    120      1.1   fvdl 	u_int rawcmd:2;
    121      1.1   fvdl 	u_int reset:1;
    122      1.1   fvdl 	u_int need_configure:1;
    123      1.1   fvdl 	u_int perp_mode:2;
    124      1.1   fvdl 	u_int has_fifo:1;
    125      1.1   fvdl 	u_int driver_version;
    126      1.1   fvdl 	u_char track[4];
    127      1.1   fvdl };
    128      1.1   fvdl 
    129      1.1   fvdl struct linux_floppy_write_errors {
    130      1.1   fvdl 	u_int write_errors;
    131      1.1   fvdl 	u_long first_error_sector;
    132      1.1   fvdl 	u_int first_error_generation;
    133      1.1   fvdl 	u_long last_error_sector;
    134      1.1   fvdl 	u_int last_error_generation;
    135      1.1   fvdl 	u_int badness;
    136      1.1   fvdl };
    137      1.1   fvdl 
    138      1.1   fvdl struct linux_floppy_raw_cmd {
    139      1.1   fvdl 	u_int flags;
    140      1.1   fvdl 	void *data;
    141  1.2.4.1   yamt 	void *kernel_data;
    142      1.1   fvdl 	struct floppy_raw_cmd *next;
    143      1.1   fvdl 	long length;
    144      1.1   fvdl 	long phys_length;
    145      1.1   fvdl 	int buffer_length;
    146      1.1   fvdl 	u_char rate;
    147      1.1   fvdl 	u_char cmd_count;
    148      1.1   fvdl 	u_char cmd[16];
    149      1.1   fvdl 	u_char reply_count;
    150      1.1   fvdl 	u_char reply[16];
    151      1.1   fvdl 	int track;
    152      1.1   fvdl 	int resultcode;
    153      1.1   fvdl 	int reserved1;
    154      1.1   fvdl 	int reserved2;
    155      1.1   fvdl };
    156      1.1   fvdl 
    157      1.1   fvdl struct linux_format_descr {
    158      1.1   fvdl 	u_int device;
    159      1.1   fvdl 	u_int head;
    160      1.1   fvdl 	u_int track;
    161      1.1   fvdl };
    162      1.1   fvdl 
    163      1.1   fvdl typedef char linux_floppy_drive_name[16];
    164      1.1   fvdl 
    165      1.1   fvdl #define LINUX_FDCLRPRM		_LINUX_IO(2, 0x41)
    166      1.1   fvdl #define LINUX_FDSETPRM		_LINUX_IOW(2, 0x42, struct linux_floppy_struct)
    167      1.1   fvdl #define LINUX_FDDEFPRM		_LINUX_IOW(2, 0x43, struct linux_floppy_struct)
    168      1.1   fvdl #define LINUX_FDGETPRM		_LINUX_IOR(2, 0x04, struct linux_floppy_struct)
    169      1.1   fvdl #define LINUX_FDMSGON		_LINUX_IO(2, 0x45)
    170      1.1   fvdl #define LINUX_FDMSGOFF		_LINUX_IO(2, 0x46)
    171      1.1   fvdl #define LINUX_FDFMTBEG		_LINUX_IO(2, 0x47)
    172      1.1   fvdl #define LINUX_FDFMTTRK		_LINUX_IOW(2, 0x48, struct linux_format_descr)
    173      1.1   fvdl #define LINUX_FDFMTEND		_LINUX_IO(2, 0x49)
    174      1.1   fvdl #define LINUX_FDSETEMSGTRESH	_LINUX_IO(2, 0x4a)
    175      1.1   fvdl #define LINUX_FDFLUSH		_LINUX_IO(2, 0x4b)
    176      1.1   fvdl #define LINUX_FDSETMAXERRS \
    177      1.1   fvdl 	_LINUX_IOW(2, 0x4c, struct linux_floppy_max_errors)
    178      1.1   fvdl #define LINUX_FDGETMAXERRS \
    179      1.1   fvdl 	_LINUX_IOR(2, 0x0e, struct linux_floppy_max_errors)
    180      1.1   fvdl #define LINUX_FDGETDRVTYP	_LINUX_IOR(2, 0x0f, linux_floppy_drive_name)
    181      1.1   fvdl /* 0x90 is not a typo, that's how it's listed in the Linux include file */
    182      1.1   fvdl #define LINUX_FDSETDRVPRM \
    183      1.1   fvdl 	_LINUX_IOW(2, 0x90, struct linux_floppy_drive_params)
    184      1.1   fvdl #define LINUX_FDGETDRVPRM \
    185      1.1   fvdl 	_LINUX_IOR(2, 0x11, struct linux_floppy_drive_params)
    186      1.1   fvdl #define LINUX_FDGETDRVSTAT \
    187      1.1   fvdl 	_LINUX_IOR(2, 0x12, struct linux_floppy_drive_struct)
    188      1.1   fvdl #define LINUX_FDPOLLDRVSTAT \
    189      1.1   fvdl 	_LINUX_IOR(2, 0x13, struct linux_floppy_drive_struct)
    190      1.1   fvdl #define LINUX_FDRESET		_LINUX_IO(2, 0x54)
    191      1.1   fvdl #define LINUX_FDGETFDCSTAT \
    192      1.1   fvdl 	_LINUX_IOR(2, 0x15, struct linux_floppy_fdc_state)
    193      1.1   fvdl #define LINUX_FDWERRORCLR	_LINUX_IO(2, 0x56)
    194      1.1   fvdl #define LINUX_FDWERRORGET \
    195      1.1   fvdl 	_LINUX_IOR(2, 0x17, struct linux_floppy_write_errors)
    196      1.1   fvdl #define LINUX_FDRAWCMD		_LINUX_IO(2, 0x58)
    197      1.1   fvdl #define LINUX_FDTWADDLE		_LINUX_IO(2, 0x59)
    198      1.1   fvdl #define LINUX_FDEJECT		_LINUX_IO(2, 0x5a)
    199      1.1   fvdl 
    200      1.1   fvdl #endif /* _LINUX_FDIO_H */
    201