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