1 /* 2 * SCSI tape interface description 3 * 4 * Written by Julian Elischer (julian (at) tfs.com) 5 * for TRW Financial Systems. 6 * 7 * TRW Financial Systems, in accordance with their agreement with Carnegie 8 * Mellon University, makes this software available to CMU to distribute 9 * or use in any manner that they see fit as long as this message is kept with 10 * the software. For this reason TFS also grants any other persons or 11 * organisations permission to use or modify this software. 12 * 13 * TFS supplies this software to be publicly redistributed 14 * on the understanding that TFS is not responsible for the correct 15 * functioning of this software in any circumstances. 16 * 17 * $Id: scsi_tape.h,v 1.2 1993/05/20 03:46:34 cgd Exp $ 18 */ 19 20 /* 21 * Ported to run under 386BSD by Julian Elischer (julian (at) tfs.com) Sept 1992 22 */ 23 24 /* 25 * SCSI command format 26 */ 27 28 29 struct scsi_rw_tape 30 { 31 u_char op_code; 32 u_char fixed:1; 33 u_char :4; 34 u_char lun:3; 35 u_char len[3]; 36 u_char link:1; 37 u_char flag:1; 38 u_char :6; 39 } rw_tape; 40 41 struct scsi_space 42 { 43 u_char op_code; 44 u_char code:2; 45 u_char :3; 46 u_char lun:3; 47 u_char number[3]; 48 u_char link:1; 49 u_char flag:1; 50 u_char :6; 51 } space; 52 #define SP_BLKS 0 53 #define SP_FILEMARKS 1 54 #define SP_SEQ_FILEMARKS 2 55 #define SP_EOM 3 56 57 struct scsi_write_filemarks 58 { 59 u_char op_code; 60 u_char :5; 61 u_char lun:3; 62 u_char number[3]; 63 u_char link:1; 64 u_char flag:1; 65 u_char :6; 66 } write_filemarks; 67 68 struct scsi_rewind 69 { 70 u_char op_code; 71 u_char immed:1; 72 u_char :4; 73 u_char lun:3; 74 u_char unused[3]; 75 u_char link:1; 76 u_char flag:1; 77 u_char :6; 78 } rewind; 79 80 struct scsi_load 81 { 82 u_char op_code; 83 u_char immed:1; 84 u_char :4; 85 u_char lun:3; 86 u_char unused[2]; 87 u_char load:1; 88 u_char reten:1; 89 u_char :6; 90 u_char link:1; 91 u_char flag:1; 92 u_char :6; 93 } load; 94 #define LD_UNLOAD 0 95 #define LD_LOAD 1 96 97 struct scsi_blk_limits 98 { 99 u_char op_code; 100 u_char :5; 101 u_char lun:3; 102 u_char unused[3]; 103 u_char link:1; 104 u_char flag:1; 105 u_char :6; 106 } blk_limits; 107 108 /* 109 * Opcodes 110 */ 111 112 #define REWIND 0x01 113 #define READ_BLK_LIMITS 0x05 114 #define READ_COMMAND_TAPE 0x08 115 #define WRITE_COMMAND_TAPE 0x0a 116 #define WRITE_FILEMARKS 0x10 117 #define SPACE 0x11 118 #define LOAD_UNLOAD 0x1b /* same as above */ 119 120 121 122 struct scsi_blk_limits_data 123 { 124 u_char reserved; 125 u_char max_length_2; /* Most significant */ 126 u_char max_length_1; 127 u_char max_length_0; /* Least significant */ 128 u_char min_length_1; /* Most significant */ 129 u_char min_length_0; /* Least significant */ 130 }; 131 132 struct scsi_mode_header_tape 133 { 134 u_char data_length; /* Sense data length */ 135 u_char medium_type; 136 u_char speed:4; 137 u_char buf_mode:3; 138 u_char write_protected:1; 139 u_char blk_desc_len; 140 }; 141 142 143 #define QIC_120 0x0f 144 #define QIC_150 0x10 145 #define QIC_320 0x11 146 #define QIC_525 0x11 147 #define QIC_1320 0x12 148 149 150