1 /*
2 ** -----------------------------------------------------------------------------
3 **
4 **  Perle Specialix driver for Linux
5 **  Ported from existing RIO Driver for SCO sources.
6  *
7  *  (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK.
8  *
9  *      This program is free software; you can redistribute it and/or modify
10  *      it under the terms of the GNU General Public License as published by
11  *      the Free Software Foundation; either version 2 of the License, or
12  *      (at your option) any later version.
13  *
14  *      This program is distributed in the hope that it will be useful,
15  *      but WITHOUT ANY WARRANTY; without even the implied warranty of
16  *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  *      GNU General Public License for more details.
18  *
19  *      You should have received a copy of the GNU General Public License
20  *      along with this program; if not, write to the Free Software
21  *      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 **
23 **	Module		: cmdpkt.h
24 **	SID		: 1.2
25 **	Last Modified	: 11/6/98 11:34:09
26 **	Retrieved	: 11/6/98 11:34:20
27 **
28 **  ident @(#)cmdpkt.h	1.2
29 **
30 ** -----------------------------------------------------------------------------
31 */
32 #ifndef __rio_cmdpkt_h__
33 #define __rio_cmdpkt_h__
34 
35 #ifdef SCCS_LABELS
36 #ifndef lint
37 static char *_cmdpkt_h_sccs_ = "@(#)cmdpkt.h	1.2";
38 #endif
39 #endif
40 
41 /*
42 ** overlays for the data area of a packet. Used in both directions
43 ** (to build a packet to send, and to interpret a packet that arrives)
44 ** and is very inconvenient for MIPS, so they appear as two seperate
45 ** structures - those used for modifying/reading packets on the card
46 ** and those for modifying/reading packets in real memory, which have an _M
47 ** suffix.
48 */
49 
50 #define	RTA_BOOT_DATA_SIZE (PKT_MAX_DATA_LEN-2)
51 
52 /*
53 ** The boot information packet looks like this:
54 ** This structure overlays a PktCmd->CmdData structure, and so starts
55 ** at Data[2] in the actual pkt!
56 */
57 struct BootSequence
58 {
59     WORD	NumPackets;
60     WORD	LoadBase;
61     WORD	CodeSize;
62 };
63 
64 #define	BOOT_SEQUENCE_LEN	8
65 
66 struct SamTop
67 {
68     BYTE Unit;
69     BYTE Link;
70 };
71 
72 struct CmdHdr
73 {
74     BYTE PcCommand;
75     union
76     {
77     BYTE PcPhbNum;
78     BYTE PcLinkNum;
79     BYTE PcIDNum;
80     } U0;
81 };
82 
83 
84 struct PktCmd
85 {
86     union
87     {
88 	struct
89 	{
90 	    struct CmdHdr CmdHdr;
91 	    struct BootSequence PcBootSequence;
92 	} S1;
93 	struct
94 	{
95 	    WORD PcSequence;
96 	    BYTE PcBootData[RTA_BOOT_DATA_SIZE];
97 	} S2;
98 	struct
99 	{
100 	    WORD  __crud__;
101 	    BYTE  PcUniqNum[4];	        /* this is really a uint. */
102 	    BYTE  PcModuleTypes;  	/* what modules are fitted */
103 	} S3;
104 	struct
105 	{
106 	    struct CmdHdr CmdHdr;
107 	    BYTE   __undefined__;
108 	    BYTE   PcModemStatus;
109 	    BYTE   PcPortStatus;
110 	    BYTE   PcSubCommand;	/* commands like mem or register dump */
111 	    WORD   PcSubAddr;		/* Address for command */
112 	    BYTE   PcSubData[64];	/* Date area for command */
113 	} S4;
114 	struct
115 	{
116 	    struct CmdHdr CmdHdr;
117 	    BYTE   PcCommandText[1];
118 	    BYTE   __crud__[20];
119 	    BYTE   PcIDNum2;		/* It had to go somewhere! */
120 	} S5;
121 	struct
122 	{
123 	    struct CmdHdr CmdHdr;
124 	    struct SamTop    Topology[LINKS_PER_UNIT];
125 	} S6;
126     } U1;
127 };
128 
129 struct PktCmd_M
130 {
131     union
132     {
133 	struct
134 	{
135 	    struct
136 	    {
137     		uchar PcCommand;
138     		union
139     		{
140     		    uchar PcPhbNum;
141     		    uchar PcLinkNum;
142     		    uchar PcIDNum;
143     		} U0;
144 	    } CmdHdr;
145 	    struct
146 	    {
147                 ushort	NumPackets;
148                 ushort	LoadBase;
149                 ushort	CodeSize;
150             } PcBootSequence;
151 	} S1;
152 	struct
153 	{
154 	    ushort PcSequence;
155 	    uchar PcBootData[RTA_BOOT_DATA_SIZE];
156 	} S2;
157 	struct
158 	{
159 	    ushort  __crud__;
160 	    uchar  PcUniqNum[4];	        /* this is really a uint. */
161 	    uchar  PcModuleTypes;  	/* what modules are fitted */
162 	} S3;
163 	struct
164 	{
165 	    ushort  __cmd_hdr__;
166 	    uchar   __undefined__;
167 	    uchar   PcModemStatus;
168 	    uchar   PcPortStatus;
169 	    uchar   PcSubCommand;
170 	    ushort  PcSubAddr;
171 	    uchar   PcSubData[64];
172 	} S4;
173 	struct
174 	{
175 	    ushort  __cmd_hdr__;
176 	    uchar   PcCommandText[1];
177 	    uchar   __crud__[20];
178 	    uchar   PcIDNum2;		/* Tacked on end */
179 	} S5;
180 	struct
181 	{
182 	    ushort  __cmd_hdr__;
183 	    struct Top Topology[LINKS_PER_UNIT];
184 	} S6;
185     } U1;
186 };
187 
188 #define Command		U1.S1.CmdHdr.PcCommand
189 #define PhbNum		U1.S1.CmdHdr.U0.PcPhbNum
190 #define IDNum		U1.S1.CmdHdr.U0.PcIDNum
191 #define IDNum2		U1.S5.PcIDNum2
192 #define LinkNum		U1.S1.CmdHdr.U0.PcLinkNum
193 #define Sequence	U1.S2.PcSequence
194 #define BootData	U1.S2.PcBootData
195 #define BootSequence	U1.S1.PcBootSequence
196 #define UniqNum		U1.S3.PcUniqNum
197 #define ModemStatus	U1.S4.PcModemStatus
198 #define PortStatus	U1.S4.PcPortStatus
199 #define SubCommand	U1.S4.PcSubCommand
200 #define SubAddr		U1.S4.PcSubAddr
201 #define SubData		U1.S4.PcSubData
202 #define CommandText	U1.S5.PcCommandText
203 #define RouteTopology	U1.S6.Topology
204 #define ModuleTypes	U1.S3.PcModuleTypes
205 
206 #endif
207