1 /**************************************************************************** 2 **************************************************************************** 3 *** 4 *** This header was automatically generated from a Linux kernel header 5 *** of the same name, to make information necessary for userspace to 6 *** call into the kernel available to libc. It contains only constants, 7 *** structures, and macros generated from the original header, and thus, 8 *** contains no copyrightable information. 9 *** 10 *** To edit the content of this header, modify the corresponding 11 *** source file (e.g. under external/kernel-headers/original/) then 12 *** run bionic/libc/kernel/tools/update_all.py 13 *** 14 *** Any manual change here will be lost the next time this script will 15 *** be run. You've been warned! 16 *** 17 **************************************************************************** 18 ****************************************************************************/ 19 #ifndef _UAPI_LINUX_FD_H 20 #define _UAPI_LINUX_FD_H 21 #include <linux/ioctl.h> 22 #include <linux/compiler.h> 23 struct floppy_struct { 24 unsigned int size, sect, head, track, stretch; 25 #define FD_STRETCH 1 26 #define FD_SWAPSIDES 2 27 #define FD_ZEROBASED 4 28 #define FD_SECTBASEMASK 0x3FC 29 #define FD_MKSECTBASE(s) (((s) ^ 1) << 2) 30 #define FD_SECTBASE(floppy) ((((floppy)->stretch & FD_SECTBASEMASK) >> 2) ^ 1) 31 unsigned char gap, rate, 32 #define FD_2M 0x4 33 #define FD_SIZECODEMASK 0x38 34 #define FD_SIZECODE(floppy) (((((floppy)->rate & FD_SIZECODEMASK) >> 3) + 2) % 8) 35 #define FD_SECTSIZE(floppy) ((floppy)->rate & FD_2M ? 512 : 128 << FD_SIZECODE(floppy)) 36 #define FD_PERP 0x40 37 spec1, fmt_gap; 38 const char * name; 39 }; 40 #define FDCLRPRM _IO(2, 0x41) 41 #define FDSETPRM _IOW(2, 0x42, struct floppy_struct) 42 #define FDSETMEDIAPRM FDSETPRM 43 #define FDDEFPRM _IOW(2, 0x43, struct floppy_struct) 44 #define FDGETPRM _IOR(2, 0x04, struct floppy_struct) 45 #define FDDEFMEDIAPRM FDDEFPRM 46 #define FDGETMEDIAPRM FDGETPRM 47 #define FDMSGON _IO(2, 0x45) 48 #define FDMSGOFF _IO(2, 0x46) 49 #define FD_FILL_BYTE 0xF6 50 struct format_descr { 51 unsigned int device, head, track; 52 }; 53 #define FDFMTBEG _IO(2, 0x47) 54 #define FDFMTTRK _IOW(2, 0x48, struct format_descr) 55 #define FDFMTEND _IO(2, 0x49) 56 struct floppy_max_errors { 57 unsigned int abort, read_track, reset, recal, reporting; 58 }; 59 #define FDSETEMSGTRESH _IO(2, 0x4a) 60 #define FDFLUSH _IO(2, 0x4b) 61 #define FDSETMAXERRS _IOW(2, 0x4c, struct floppy_max_errors) 62 #define FDGETMAXERRS _IOR(2, 0x0e, struct floppy_max_errors) 63 typedef char floppy_drive_name[16]; 64 #define FDGETDRVTYP _IOR(2, 0x0f, floppy_drive_name) 65 struct floppy_drive_params { 66 signed char cmos; 67 unsigned long max_dtr; 68 unsigned long hlt; 69 unsigned long hut; 70 unsigned long srt; 71 unsigned long spinup; 72 unsigned long spindown; 73 unsigned char spindown_offset; 74 unsigned char select_delay; 75 unsigned char rps; 76 unsigned char tracks; 77 unsigned long timeout; 78 unsigned char interleave_sect; 79 struct floppy_max_errors max_errors; 80 char flags; 81 #define FTD_MSG 0x10 82 #define FD_BROKEN_DCL 0x20 83 #define FD_DEBUG 0x02 84 #define FD_SILENT_DCL_CLEAR 0x4 85 #define FD_INVERTED_DCL 0x80 86 char read_track; 87 #define FD_AUTODETECT_SIZE 8 88 short autodetect[FD_AUTODETECT_SIZE]; 89 int checkfreq; 90 int native_format; 91 }; 92 enum { 93 FD_NEED_TWADDLE_BIT, 94 FD_VERIFY_BIT, 95 FD_DISK_NEWCHANGE_BIT, 96 FD_UNUSED_BIT, 97 FD_DISK_CHANGED_BIT, 98 FD_DISK_WRITABLE_BIT, 99 FD_OPEN_SHOULD_FAIL_BIT 100 }; 101 #define FDSETDRVPRM _IOW(2, 0x90, struct floppy_drive_params) 102 #define FDGETDRVPRM _IOR(2, 0x11, struct floppy_drive_params) 103 struct floppy_drive_struct { 104 unsigned long flags; 105 #define FD_NEED_TWADDLE (1 << FD_NEED_TWADDLE_BIT) 106 #define FD_VERIFY (1 << FD_VERIFY_BIT) 107 #define FD_DISK_NEWCHANGE (1 << FD_DISK_NEWCHANGE_BIT) 108 #define FD_DISK_CHANGED (1 << FD_DISK_CHANGED_BIT) 109 #define FD_DISK_WRITABLE (1 << FD_DISK_WRITABLE_BIT) 110 unsigned long spinup_date; 111 unsigned long select_date; 112 unsigned long first_read_date; 113 short probed_format; 114 short track; 115 short maxblock; 116 short maxtrack; 117 int generation; 118 int keep_data; 119 int fd_ref; 120 int fd_device; 121 unsigned long last_checked; 122 char * dmabuf; 123 int bufblocks; 124 }; 125 #define FDGETDRVSTAT _IOR(2, 0x12, struct floppy_drive_struct) 126 #define FDPOLLDRVSTAT _IOR(2, 0x13, struct floppy_drive_struct) 127 enum reset_mode { 128 FD_RESET_IF_NEEDED, 129 FD_RESET_IF_RAWCMD, 130 FD_RESET_ALWAYS 131 }; 132 #define FDRESET _IO(2, 0x54) 133 struct floppy_fdc_state { 134 int spec1; 135 int spec2; 136 int dtr; 137 unsigned char version; 138 unsigned char dor; 139 unsigned long address; 140 unsigned int rawcmd : 2; 141 unsigned int reset : 1; 142 unsigned int need_configure : 1; 143 unsigned int perp_mode : 2; 144 unsigned int has_fifo : 1; 145 unsigned int driver_version; 146 #define FD_DRIVER_VERSION 0x100 147 unsigned char track[4]; 148 }; 149 #define FDGETFDCSTAT _IOR(2, 0x15, struct floppy_fdc_state) 150 struct floppy_write_errors { 151 unsigned int write_errors; 152 unsigned long first_error_sector; 153 int first_error_generation; 154 unsigned long last_error_sector; 155 int last_error_generation; 156 unsigned int badness; 157 }; 158 #define FDWERRORCLR _IO(2, 0x56) 159 #define FDWERRORGET _IOR(2, 0x17, struct floppy_write_errors) 160 #define FDHAVEBATCHEDRAWCMD 161 struct floppy_raw_cmd { 162 unsigned int flags; 163 #define FD_RAW_READ 1 164 #define FD_RAW_WRITE 2 165 #define FD_RAW_NO_MOTOR 4 166 #define FD_RAW_DISK_CHANGE 4 167 #define FD_RAW_INTR 8 168 #define FD_RAW_SPIN 0x10 169 #define FD_RAW_NO_MOTOR_AFTER 0x20 170 #define FD_RAW_NEED_DISK 0x40 171 #define FD_RAW_NEED_SEEK 0x80 172 #define FD_RAW_MORE 0x100 173 #define FD_RAW_STOP_IF_FAILURE 0x200 174 #define FD_RAW_STOP_IF_SUCCESS 0x400 175 #define FD_RAW_SOFTFAILURE 0x800 176 #define FD_RAW_FAILURE 0x10000 177 #define FD_RAW_HARDFAILURE 0x20000 178 void * data; 179 char * kernel_data; 180 struct floppy_raw_cmd * next; 181 long length; 182 long phys_length; 183 int buffer_length; 184 unsigned char rate; 185 #define FD_RAW_CMD_SIZE 16 186 #define FD_RAW_REPLY_SIZE 16 187 #define FD_RAW_CMD_FULLSIZE (FD_RAW_CMD_SIZE + 1 + FD_RAW_REPLY_SIZE) 188 unsigned char cmd_count; 189 union { 190 struct { 191 unsigned char cmd[FD_RAW_CMD_SIZE]; 192 unsigned char reply_count; 193 unsigned char reply[FD_RAW_REPLY_SIZE]; 194 }; 195 unsigned char fullcmd[FD_RAW_CMD_FULLSIZE]; 196 }; 197 int track; 198 int resultcode; 199 int reserved1; 200 int reserved2; 201 }; 202 #define FDRAWCMD _IO(2, 0x58) 203 #define FDTWADDLE _IO(2, 0x59) 204 #define FDEJECT _IO(2, 0x5a) 205 #endif 206