1 /*- 2 * Copyright (c) 1982, 1986 The Regents of the University of California. 3 * All rights reserved. 4 * 5 * %sccs.include.redist.c% 6 * 7 * @(#)rsp.h 7.2 (Berkeley) 05/09/91 8 */ 9 10 /* 11 * TU58 transfer protocol constants and data structures 12 */ 13 14 /* 15 * Structure of a command packet 16 */ 17 struct packet { 18 u_char pk_flag; /* indicates packet type (cmd, data, etc.) */ 19 u_char pk_mcount; /* length of packet (bytes) */ 20 u_char pk_op; /* operation to perform (read, write, etc.) */ 21 u_char pk_mod; /* modifier for op or returned status */ 22 u_char pk_unit; /* unit number */ 23 u_char pk_sw; /* switches */ 24 u_short pk_seq; /* sequence number, always zero */ 25 u_short pk_count; /* requested byte count for read or write */ 26 u_short pk_block; /* block number for read, write, or seek */ 27 u_short pk_chksum; /* checksum, by words with end around carry */ 28 }; 29 30 /* 31 * States 32 */ 33 #define TUS_INIT1 0 /* sending nulls */ 34 #define TUS_INIT2 1 /* sending inits */ 35 #define TUS_IDLE 2 /* initialized, no transfer in progress */ 36 #define TUS_SENDH 3 /* sending header */ 37 #define TUS_SENDD 4 /* sending data */ 38 #define TUS_SENDC 5 /* sending checksum */ 39 #define TUS_SENDR 6 /* sending read command packet */ 40 #define TUS_SENDW 7 /* sending write command packet */ 41 #define TUS_GETH 8 /* reading header */ 42 #define TUS_GETD 9 /* reading data */ 43 #define TUS_GETC 10 /* reading checksum */ 44 #define TUS_GET 11 /* reading an entire packet */ 45 #define TUS_WAIT 12 /* waiting for continue */ 46 #define TUS_RCVERR 13 /* receiver error in pseudo DMA routine */ 47 #define TUS_CHKERR 14 /* checksum error in pseudo DMA routine */ 48 49 #define TUS_NSTATES 15 50 51 #define printstate(state) \ 52 if ((state) < TUS_NSTATES) \ 53 printf("%s", tustates[(state)]); \ 54 else \ 55 printf("%d", (state)); 56 57 /* 58 * Packet Flags 59 */ 60 #define TUF_DATA 1 /* data packet */ 61 #define TUF_CMD 2 /* command packet */ 62 #define TUF_INITF 4 /* initialize */ 63 #define TUF_CONT 020 /* continue */ 64 #define TUF_XOFF 023 /* flow control */ 65 66 /* 67 * Op Codes 68 */ 69 #define TUOP_NOOP 0 /* no operation */ 70 #define TUOP_INIT 1 /* initialize */ 71 #define TUOP_READ 2 /* read block */ 72 #define TUOP_WRITE 3 /* write block */ 73 #define TUOP_SEEK 5 /* seek to block */ 74 #define TUOP_DIAGNOSE 7 /* run micro-diagnostics */ 75 #define TUOP_END 0100 /* end packet */ 76 77 /* 78 * Mod Flags 79 */ 80 #define TUMD_WRV 1 /* write with read verify */ 81 82 /* 83 * Switches 84 */ 85 #define TUSW_MRSP 010 /* use Modified RSP */ 86 87