linux_fdio.h 5.6 KB

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