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 **************************************************************************** 11 ****************************************************************************/ 12 #ifndef _LINUX_FD_H 13 #define _LINUX_FD_H 14 15 #include <linux/ioctl.h> 16 #include <linux/compiler.h> 17 18 struct floppy_struct { 19 unsigned int size, 20 sect, 21 head, 22 track, 23 stretch; 24 #define FD_STRETCH 1 25 #define FD_SWAPSIDES 2 26 #define FD_ZEROBASED 4 27 28 unsigned char gap, 29 30 rate, 31 #define FD_2M 0x4 32 #define FD_SIZECODEMASK 0x38 33 #define FD_SIZECODE(floppy) (((((floppy)->rate&FD_SIZECODEMASK)>> 3)+ 2) %8) 34 #define FD_SECTSIZE(floppy) ( (floppy)->rate & FD_2M ? 512 : 128 << FD_SIZECODE(floppy) ) 35 #define FD_PERP 0x40 36 37 spec1, 38 fmt_gap; 39 const char * name; 40 }; 41 42 #define FDCLRPRM _IO(2, 0x41) 43 44 #define FDSETPRM _IOW(2, 0x42, struct floppy_struct) 45 #define FDSETMEDIAPRM FDSETPRM 46 47 #define FDDEFPRM _IOW(2, 0x43, struct floppy_struct) 48 #define FDGETPRM _IOR(2, 0x04, struct floppy_struct) 49 #define FDDEFMEDIAPRM FDDEFPRM 50 #define FDGETMEDIAPRM FDGETPRM 51 52 #define FDMSGON _IO(2,0x45) 53 #define FDMSGOFF _IO(2,0x46) 54 55 #define FD_FILL_BYTE 0xF6 56 57 struct format_descr { 58 unsigned int device,head,track; 59 }; 60 61 #define FDFMTBEG _IO(2,0x47) 62 63 #define FDFMTTRK _IOW(2,0x48, struct format_descr) 64 65 #define FDFMTEND _IO(2,0x49) 66 67 struct floppy_max_errors { 68 unsigned int 69 abort, 70 read_track, 71 reset, 72 recal, 73 74 reporting; 75 76 }; 77 78 #define FDSETEMSGTRESH _IO(2,0x4a) 79 80 #define FDFLUSH _IO(2,0x4b) 81 82 #define FDSETMAXERRS _IOW(2, 0x4c, struct floppy_max_errors) 83 #define FDGETMAXERRS _IOR(2, 0x0e, struct floppy_max_errors) 84 85 typedef char floppy_drive_name[16]; 86 #define FDGETDRVTYP _IOR(2, 0x0f, floppy_drive_name) 87 88 struct floppy_drive_params { 89 signed char cmos; 90 91 unsigned long max_dtr; 92 unsigned long hlt; 93 unsigned long hut; 94 unsigned long srt; 95 96 unsigned long spinup; 97 unsigned long spindown; 98 unsigned char spindown_offset; 99 unsigned char select_delay; 100 unsigned char rps; 101 unsigned char tracks; 102 unsigned long timeout; 103 104 unsigned char interleave_sect; 105 106 struct floppy_max_errors max_errors; 107 108 char flags; 109 110 #define FTD_MSG 0x10 111 #define FD_BROKEN_DCL 0x20 112 #define FD_DEBUG 0x02 113 #define FD_SILENT_DCL_CLEAR 0x4 114 #define FD_INVERTED_DCL 0x80 115 116 char read_track; 117 118 short autodetect[8]; 119 120 int checkfreq; 121 int native_format; 122 }; 123 124 enum { 125 FD_NEED_TWADDLE_BIT, 126 FD_VERIFY_BIT, 127 FD_DISK_NEWCHANGE_BIT, 128 FD_UNUSED_BIT, 129 FD_DISK_CHANGED_BIT, 130 FD_DISK_WRITABLE_BIT 131 }; 132 133 #define FDSETDRVPRM _IOW(2, 0x90, struct floppy_drive_params) 134 #define FDGETDRVPRM _IOR(2, 0x11, struct floppy_drive_params) 135 136 struct floppy_drive_struct { 137 unsigned long flags; 138 139 #define FD_NEED_TWADDLE (1 << FD_NEED_TWADDLE_BIT) 140 #define FD_VERIFY (1 << FD_VERIFY_BIT) 141 #define FD_DISK_NEWCHANGE (1 << FD_DISK_NEWCHANGE_BIT) 142 #define FD_DISK_CHANGED (1 << FD_DISK_CHANGED_BIT) 143 #define FD_DISK_WRITABLE (1 << FD_DISK_WRITABLE_BIT) 144 145 unsigned long spinup_date; 146 unsigned long select_date; 147 unsigned long first_read_date; 148 short probed_format; 149 short track; 150 short maxblock; 151 short maxtrack; 152 int generation; 153 154 int keep_data; 155 156 int fd_ref; 157 int fd_device; 158 unsigned long last_checked; 159 160 char *dmabuf; 161 int bufblocks; 162 }; 163 164 #define FDGETDRVSTAT _IOR(2, 0x12, struct floppy_drive_struct) 165 #define FDPOLLDRVSTAT _IOR(2, 0x13, struct floppy_drive_struct) 166 167 enum reset_mode { 168 FD_RESET_IF_NEEDED, 169 FD_RESET_IF_RAWCMD, 170 FD_RESET_ALWAYS 171 }; 172 #define FDRESET _IO(2, 0x54) 173 174 struct floppy_fdc_state { 175 int spec1; 176 int spec2; 177 int dtr; 178 unsigned char version; 179 unsigned char dor; 180 unsigned long address; 181 unsigned int rawcmd:2; 182 unsigned int reset:1; 183 unsigned int need_configure:1; 184 unsigned int perp_mode:2; 185 unsigned int has_fifo:1; 186 unsigned int driver_version; 187 #define FD_DRIVER_VERSION 0x100 188 189 unsigned char track[4]; 190 191 }; 192 193 #define FDGETFDCSTAT _IOR(2, 0x15, struct floppy_fdc_state) 194 195 struct floppy_write_errors { 196 197 unsigned int write_errors; 198 199 unsigned long first_error_sector; 200 int first_error_generation; 201 unsigned long last_error_sector; 202 int last_error_generation; 203 204 unsigned int badness; 205 }; 206 207 #define FDWERRORCLR _IO(2, 0x56) 208 209 #define FDWERRORGET _IOR(2, 0x17, struct floppy_write_errors) 210 211 #define FDHAVEBATCHEDRAWCMD 212 213 struct floppy_raw_cmd { 214 unsigned int flags; 215 #define FD_RAW_READ 1 216 #define FD_RAW_WRITE 2 217 #define FD_RAW_NO_MOTOR 4 218 #define FD_RAW_DISK_CHANGE 4 219 #define FD_RAW_INTR 8 220 #define FD_RAW_SPIN 0x10 221 #define FD_RAW_NO_MOTOR_AFTER 0x20 222 #define FD_RAW_NEED_DISK 0x40 223 #define FD_RAW_NEED_SEEK 0x80 224 225 #define FD_RAW_MORE 0x100 226 #define FD_RAW_STOP_IF_FAILURE 0x200 227 #define FD_RAW_STOP_IF_SUCCESS 0x400 228 #define FD_RAW_SOFTFAILURE 0x800 229 230 #define FD_RAW_FAILURE 0x10000 231 #define FD_RAW_HARDFAILURE 0x20000 232 233 void __user *data; 234 char *kernel_data; 235 struct floppy_raw_cmd *next; 236 long length; 237 long phys_length; 238 int buffer_length; 239 240 unsigned char rate; 241 unsigned char cmd_count; 242 unsigned char cmd[16]; 243 unsigned char reply_count; 244 unsigned char reply[16]; 245 int track; 246 int resultcode; 247 248 int reserved1; 249 int reserved2; 250 }; 251 252 #define FDRAWCMD _IO(2, 0x58) 253 254 #define FDTWADDLE _IO(2, 0x59) 255 256 #define FDEJECT _IO(2, 0x5a) 257 258 #endif 259