The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 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 |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame] | 14 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 15 | #include <linux/ioctl.h> |
| 16 | #include <linux/compiler.h> |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame] | 17 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 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 |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame] | 27 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 28 | unsigned char gap, |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame] | 29 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 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 |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame] | 36 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 37 | spec1, |
| 38 | fmt_gap; |
| 39 | const char * name; |
| 40 | }; |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame] | 41 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 42 | #define FDCLRPRM _IO(2, 0x41) |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame] | 43 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 44 | #define FDSETPRM _IOW(2, 0x42, struct floppy_struct) |
| 45 | #define FDSETMEDIAPRM FDSETPRM |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame] | 46 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 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 |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame] | 51 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 52 | #define FDMSGON _IO(2,0x45) |
| 53 | #define FDMSGOFF _IO(2,0x46) |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame] | 54 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 55 | #define FD_FILL_BYTE 0xF6 |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame] | 56 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 57 | struct format_descr { |
| 58 | unsigned int device,head,track; |
| 59 | }; |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame] | 60 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 61 | #define FDFMTBEG _IO(2,0x47) |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame] | 62 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 63 | #define FDFMTTRK _IOW(2,0x48, struct format_descr) |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame] | 64 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 65 | #define FDFMTEND _IO(2,0x49) |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame] | 66 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 67 | struct floppy_max_errors { |
| 68 | unsigned int |
| 69 | abort, |
| 70 | read_track, |
| 71 | reset, |
| 72 | recal, |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame] | 73 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 74 | reporting; |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame] | 75 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 76 | }; |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame] | 77 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 78 | #define FDSETEMSGTRESH _IO(2,0x4a) |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame] | 79 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 80 | #define FDFLUSH _IO(2,0x4b) |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame] | 81 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 82 | #define FDSETMAXERRS _IOW(2, 0x4c, struct floppy_max_errors) |
| 83 | #define FDGETMAXERRS _IOR(2, 0x0e, struct floppy_max_errors) |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame] | 84 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 85 | typedef char floppy_drive_name[16]; |
| 86 | #define FDGETDRVTYP _IOR(2, 0x0f, floppy_drive_name) |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame] | 87 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 88 | struct floppy_drive_params { |
| 89 | signed char cmos; |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame] | 90 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 91 | unsigned long max_dtr; |
| 92 | unsigned long hlt; |
| 93 | unsigned long hut; |
| 94 | unsigned long srt; |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame] | 95 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 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; |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame] | 103 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 104 | unsigned char interleave_sect; |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame] | 105 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 106 | struct floppy_max_errors max_errors; |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame] | 107 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 108 | char flags; |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame] | 109 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 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 |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame] | 115 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 116 | char read_track; |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame] | 117 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 118 | short autodetect[8]; |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame] | 119 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 120 | int checkfreq; |
| 121 | int native_format; |
| 122 | }; |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame] | 123 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 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 | }; |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame] | 132 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 133 | #define FDSETDRVPRM _IOW(2, 0x90, struct floppy_drive_params) |
| 134 | #define FDGETDRVPRM _IOR(2, 0x11, struct floppy_drive_params) |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame] | 135 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 136 | struct floppy_drive_struct { |
| 137 | unsigned long flags; |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame] | 138 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 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) |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame] | 144 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 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; |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame] | 153 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 154 | int keep_data; |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame] | 155 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 156 | int fd_ref; |
| 157 | int fd_device; |
| 158 | unsigned long last_checked; |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame] | 159 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 160 | char *dmabuf; |
| 161 | int bufblocks; |
| 162 | }; |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame] | 163 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 164 | #define FDGETDRVSTAT _IOR(2, 0x12, struct floppy_drive_struct) |
| 165 | #define FDPOLLDRVSTAT _IOR(2, 0x13, struct floppy_drive_struct) |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame] | 166 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 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) |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame] | 173 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 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 |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame] | 188 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 189 | unsigned char track[4]; |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame] | 190 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 191 | }; |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame] | 192 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 193 | #define FDGETFDCSTAT _IOR(2, 0x15, struct floppy_fdc_state) |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame] | 194 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 195 | struct floppy_write_errors { |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame] | 196 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 197 | unsigned int write_errors; |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame] | 198 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 199 | unsigned long first_error_sector; |
| 200 | int first_error_generation; |
| 201 | unsigned long last_error_sector; |
| 202 | int last_error_generation; |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame] | 203 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 204 | unsigned int badness; |
| 205 | }; |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame] | 206 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 207 | #define FDWERRORCLR _IO(2, 0x56) |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame] | 208 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 209 | #define FDWERRORGET _IOR(2, 0x17, struct floppy_write_errors) |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame] | 210 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 211 | #define FDHAVEBATCHEDRAWCMD |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame] | 212 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 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 |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame] | 224 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 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 |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame] | 229 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 230 | #define FD_RAW_FAILURE 0x10000 |
| 231 | #define FD_RAW_HARDFAILURE 0x20000 |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame] | 232 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 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; |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame] | 239 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 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; |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame] | 247 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 248 | int reserved1; |
| 249 | int reserved2; |
| 250 | }; |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame] | 251 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 252 | #define FDRAWCMD _IO(2, 0x58) |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame] | 253 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 254 | #define FDTWADDLE _IO(2, 0x59) |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame] | 255 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 256 | #define FDEJECT _IO(2, 0x5a) |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame] | 257 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 258 | #endif |