1 /* $NetBSD: rsp.h,v 1.2 2001/05/15 18:59:45 ragge Exp $ */ 2 /* 3 * Copyright (c) 1995 Ludd, University of Lule}, Sweden. 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: 9 * 1. Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * 2. Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * 3. All advertising materials mentioning features or use of this software 15 * must display the following acknowledgement: 16 * This product includes software developed at Ludd, University of 17 * Lule}, Sweden and its contributors. 18 * 4. The name of the author may not be used to endorse or promote products 19 * derived from this software without specific prior written permission 20 * 21 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 22 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 23 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 24 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 25 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 26 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 30 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 */ 32 33 34 /* 35 * The Radial Serial Protocol (RSP) that TU58 (DECtape II) uses 36 * is a strange animal that is sent over serial lines. 37 * Most packet types can match the struct rsp, but some can't (i.e. 38 * data packets). 39 * More about RSP can be read in Digital Peripherals Handbook, p. 92. 40 */ 41 42 struct rsp { 43 char rsp_typ; /* Packet type */ 44 char rsp_sz; /* Packet size */ 45 char rsp_op; /* Operation */ 46 char rsp_mod; /* Modifier */ 47 char rsp_drv; /* Tape drive number */ 48 char rsp_sw; /* Switches */ 49 char rsp_xx1; /* Unused, always zero */ 50 char rsp_xx2; /* Unused, always zero */ 51 short rsp_cnt; /* Byte count to transfer */ 52 short rsp_blk; /* Block number */ 53 short rsp_sum; /* Checksum of packet */ 54 }; 55 56 /* Types of packets */ 57 #define RSP_TYP_DATA 001 /* DATA packet */ 58 #define RSP_TYP_COMMAND 002 /* COMMAND packet */ 59 #define RSP_TYP_INIT 004 /* INITIALIZE packet */ 60 #define RSP_TYP_BOOT 010 /* BOOTSTRAP packet (PDP11) */ 61 #define RSP_TYP_CONTINUE 020 /* CONTINUE packet */ 62 #define RSP_TYP_XOFF 023 /* XOFF packet */ 63 64 /* Operation types */ 65 #define RSP_OP_NOP 000 /* No operation */ 66 #define RSP_OP_RESET 001 /* Reset */ 67 #define RSP_OP_READ 002 /* Read data */ 68 #define RSP_OP_WRITE 003 /* Write data */ 69 #define RSP_OP_POS 005 /* Position tape */ 70 #define RSP_OP_DIAG 007 /* internal diagnose */ 71 #define RSP_OP_GSTAT 010 /* Get status */ 72 #define RSP_OP_SSTAT 011 /* Set status */ 73 #define RSP_OP_END 0100 /* End packet */ 74 75 /* Modifier */ 76 #define RSP_MOD_VERIFY 001 /* Verify read data */ 77 #define RSP_MOD_OK 000 /* Success */ 78 #define RSP_MOD_RETR 001 /* Success w/ retries */ 79 #define RSP_MOD_FAIL -1 /* Failed self-test */ 80 #define RSP_MOD_PART -2 /* Partial operation */ 81 #define RSP_MOD_NET -8 /* Non-existent tape drive */ 82 #define RSP_MOD_NOC -9 /* No cartridge */ 83 #define RSP_MOD_WP -11 /* Write protected */ 84 #define RSP_MOD_DERR -17 /* Data error */ 85 #define RSP_MOD_SERR -32 /* Seek error */ 86 #define RSP_MOD_STOP -33 /* Motor stopped */ 87 #define RSP_MOD_INVAL -48 /* Invalid opcode */ 88 #define RSP_MOD_INVBLK -55 /* Invalid bloch number */ 89 90