ftape-ctl.h 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. #ifndef _FTAPE_CTL_H
  2. #define _FTAPE_CTL_H
  3. /*
  4. * Copyright (C) 1993-1996 Bas Laarhoven,
  5. * (C) 1996-1997 Claus-Justus Heine.
  6. This program is free software; you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation; either version 2, or (at your option)
  9. any later version.
  10. This program is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. GNU General Public License for more details.
  14. You should have received a copy of the GNU General Public License
  15. along with this program; see the file COPYING. If not, write to
  16. the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  17. *
  18. * $Source: /homes/cvs/ftape-stacked/ftape/lowlevel/ftape-ctl.h,v $
  19. * $Revision: 1.2 $
  20. * $Date: 1997/10/05 19:18:09 $
  21. *
  22. * This file contains the non-standard IOCTL related definitions
  23. * for the QIC-40/80/3010/3020 floppy-tape driver "ftape" for
  24. * Linux.
  25. */
  26. #include <linux/ioctl.h>
  27. #include <linux/mtio.h>
  28. #include <linux/ftape-vendors.h>
  29. #include "../lowlevel/ftape-rw.h"
  30. #include <linux/ftape-header-segment.h>
  31. typedef struct {
  32. int used; /* any reading or writing done */
  33. /* isr statistics */
  34. unsigned int id_am_errors; /* id address mark not found */
  35. unsigned int id_crc_errors; /* crc error in id address mark */
  36. unsigned int data_am_errors; /* data address mark not found */
  37. unsigned int data_crc_errors; /* crc error in data field */
  38. unsigned int overrun_errors; /* fdc access timing problem */
  39. unsigned int no_data_errors; /* sector not found */
  40. unsigned int retries; /* number of tape retries */
  41. /* ecc statistics */
  42. unsigned int crc_errors; /* crc error in data */
  43. unsigned int crc_failures; /* bad data without crc error */
  44. unsigned int ecc_failures; /* failed to correct */
  45. unsigned int corrected; /* total sectors corrected */
  46. /* general statistics */
  47. unsigned int rewinds; /* number of tape rewinds */
  48. unsigned int defects; /* bad sectors due to media defects */
  49. } history_record;
  50. /* this structure contains * ALL * information that we want
  51. * our child modules to know about, but don't want them to
  52. * modify.
  53. */
  54. typedef struct {
  55. /* vendor information */
  56. vendor_struct fti_drive_type;
  57. /* data rates */
  58. unsigned int fti_used_data_rate;
  59. unsigned int fti_drive_max_rate;
  60. unsigned int fti_fdc_max_rate;
  61. /* drive selection, either FTAPE_SEL_A/B/C/D */
  62. int fti_drive_sel;
  63. /* flags set after decode the drive and tape status */
  64. unsigned int fti_formatted :1;
  65. unsigned int fti_no_tape :1;
  66. unsigned int fti_write_protected:1;
  67. unsigned int fti_new_tape :1;
  68. /* values of last queried drive/tape status and error */
  69. ft_drive_error fti_last_error;
  70. ft_drive_status fti_last_status;
  71. /* cartridge geometry */
  72. unsigned int fti_tracks_per_tape;
  73. unsigned int fti_segments_per_track;
  74. /* location of header segments, etc. */
  75. int fti_used_header_segment;
  76. int fti_header_segment_1;
  77. int fti_header_segment_2;
  78. int fti_first_data_segment;
  79. int fti_last_data_segment;
  80. /* the format code as stored in the header segment */
  81. ft_format_type fti_format_code;
  82. /* the following is the sole reason for the ftape_set_status() call */
  83. unsigned int fti_qic_std;
  84. /* is tape running? */
  85. volatile enum runner_status_enum fti_runner_status;
  86. /* is tape reading/writing/verifying/formatting/deleting */
  87. buffer_state_enum fti_state;
  88. /* flags fatal hardware error */
  89. unsigned int fti_failure:1;
  90. /* history record */
  91. history_record fti_history;
  92. } ftape_info;
  93. /* vendor information */
  94. #define ft_drive_type ftape_status.fti_drive_type
  95. /* data rates */
  96. #define ft_data_rate ftape_status.fti_used_data_rate
  97. #define ft_drive_max_rate ftape_status.fti_drive_max_rate
  98. #define ft_fdc_max_rate ftape_status.fti_fdc_max_rate
  99. /* drive selection, either FTAPE_SEL_A/B/C/D */
  100. #define ft_drive_sel ftape_status.fti_drive_sel
  101. /* flags set after decode the drive and tape status */
  102. #define ft_formatted ftape_status.fti_formatted
  103. #define ft_no_tape ftape_status.fti_no_tape
  104. #define ft_write_protected ftape_status.fti_write_protected
  105. #define ft_new_tape ftape_status.fti_new_tape
  106. /* values of last queried drive/tape status and error */
  107. #define ft_last_error ftape_status.fti_last_error
  108. #define ft_last_status ftape_status.fti_last_status
  109. /* cartridge geometry */
  110. #define ft_tracks_per_tape ftape_status.fti_tracks_per_tape
  111. #define ft_segments_per_track ftape_status.fti_segments_per_track
  112. /* the format code as stored in the header segment */
  113. #define ft_format_code ftape_status.fti_format_code
  114. /* the qic status as returned by report drive configuration */
  115. #define ft_qic_std ftape_status.fti_qic_std
  116. #define ft_used_header_segment ftape_status.fti_used_header_segment
  117. #define ft_header_segment_1 ftape_status.fti_header_segment_1
  118. #define ft_header_segment_2 ftape_status.fti_header_segment_2
  119. #define ft_first_data_segment ftape_status.fti_first_data_segment
  120. #define ft_last_data_segment ftape_status.fti_last_data_segment
  121. /* is tape running? */
  122. #define ft_runner_status ftape_status.fti_runner_status
  123. /* is tape reading/writing/verifying/formatting/deleting */
  124. #define ft_driver_state ftape_status.fti_state
  125. /* flags fatal hardware error */
  126. #define ft_failure ftape_status.fti_failure
  127. /* history record */
  128. #define ft_history ftape_status.fti_history
  129. /*
  130. * ftape-ctl.c defined global vars.
  131. */
  132. extern ftape_info ftape_status;
  133. extern int ftape_segments_per_head;
  134. extern int ftape_segments_per_cylinder;
  135. extern int ftape_init_drive_needed;
  136. /*
  137. * ftape-ctl.c defined global functions.
  138. */
  139. extern int ftape_mmap(struct vm_area_struct *vma);
  140. extern int ftape_enable(int drive_selection);
  141. extern void ftape_disable(void);
  142. extern int ftape_seek_to_bot(void);
  143. extern int ftape_seek_to_eot(void);
  144. extern int ftape_abort_operation(void);
  145. extern void ftape_calc_timeouts(unsigned int qic_std,
  146. unsigned int data_rate,
  147. unsigned int tape_len);
  148. extern int ftape_calibrate_data_rate(unsigned int qic_std);
  149. extern const ftape_info *ftape_get_status(void);
  150. #endif