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