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