blob: 77cee8df68ef189b65d346776e0be50b1c0b5073 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
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
37static 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 separate
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*/
Andrew Morton8d8706e2006-01-11 12:17:49 -080057struct BootSequence {
58 WORD NumPackets;
59 WORD LoadBase;
60 WORD CodeSize;
Linus Torvalds1da177e2005-04-16 15:20:36 -070061};
62
63#define BOOT_SEQUENCE_LEN 8
64
Andrew Morton8d8706e2006-01-11 12:17:49 -080065struct SamTop {
66 BYTE Unit;
67 BYTE Link;
Linus Torvalds1da177e2005-04-16 15:20:36 -070068};
69
Andrew Morton8d8706e2006-01-11 12:17:49 -080070struct CmdHdr {
71 BYTE PcCommand;
72 union {
73 BYTE PcPhbNum;
74 BYTE PcLinkNum;
75 BYTE PcIDNum;
76 } U0;
Linus Torvalds1da177e2005-04-16 15:20:36 -070077};
78
79
Andrew Morton8d8706e2006-01-11 12:17:49 -080080struct PktCmd {
81 union {
82 struct {
83 struct CmdHdr CmdHdr;
84 struct BootSequence PcBootSequence;
85 } S1;
86 struct {
87 WORD PcSequence;
88 BYTE PcBootData[RTA_BOOT_DATA_SIZE];
89 } S2;
90 struct {
91 WORD __crud__;
92 BYTE PcUniqNum[4]; /* this is really a uint. */
93 BYTE PcModuleTypes; /* what modules are fitted */
94 } S3;
95 struct {
96 struct CmdHdr CmdHdr;
97 BYTE __undefined__;
98 BYTE PcModemStatus;
99 BYTE PcPortStatus;
100 BYTE PcSubCommand; /* commands like mem or register dump */
101 WORD PcSubAddr; /* Address for command */
102 BYTE PcSubData[64]; /* Date area for command */
103 } S4;
104 struct {
105 struct CmdHdr CmdHdr;
106 BYTE PcCommandText[1];
107 BYTE __crud__[20];
108 BYTE PcIDNum2; /* It had to go somewhere! */
109 } S5;
110 struct {
111 struct CmdHdr CmdHdr;
112 struct SamTop Topology[LINKS_PER_UNIT];
113 } S6;
114 } U1;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700115};
116
Andrew Morton8d8706e2006-01-11 12:17:49 -0800117struct PktCmd_M {
118 union {
119 struct {
120 struct {
121 uchar PcCommand;
122 union {
123 uchar PcPhbNum;
124 uchar PcLinkNum;
125 uchar PcIDNum;
126 } U0;
127 } CmdHdr;
128 struct {
129 ushort NumPackets;
130 ushort LoadBase;
131 ushort CodeSize;
132 } PcBootSequence;
133 } S1;
134 struct {
135 ushort PcSequence;
136 uchar PcBootData[RTA_BOOT_DATA_SIZE];
137 } S2;
138 struct {
139 ushort __crud__;
140 uchar PcUniqNum[4]; /* this is really a uint. */
141 uchar PcModuleTypes; /* what modules are fitted */
142 } S3;
143 struct {
144 ushort __cmd_hdr__;
145 uchar __undefined__;
146 uchar PcModemStatus;
147 uchar PcPortStatus;
148 uchar PcSubCommand;
149 ushort PcSubAddr;
150 uchar PcSubData[64];
151 } S4;
152 struct {
153 ushort __cmd_hdr__;
154 uchar PcCommandText[1];
155 uchar __crud__[20];
156 uchar PcIDNum2; /* Tacked on end */
157 } S5;
158 struct {
159 ushort __cmd_hdr__;
160 struct Top Topology[LINKS_PER_UNIT];
161 } S6;
162 } U1;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700163};
164
165#define Command U1.S1.CmdHdr.PcCommand
166#define PhbNum U1.S1.CmdHdr.U0.PcPhbNum
167#define IDNum U1.S1.CmdHdr.U0.PcIDNum
168#define IDNum2 U1.S5.PcIDNum2
169#define LinkNum U1.S1.CmdHdr.U0.PcLinkNum
170#define Sequence U1.S2.PcSequence
171#define BootData U1.S2.PcBootData
172#define BootSequence U1.S1.PcBootSequence
173#define UniqNum U1.S3.PcUniqNum
174#define ModemStatus U1.S4.PcModemStatus
175#define PortStatus U1.S4.PcPortStatus
176#define SubCommand U1.S4.PcSubCommand
177#define SubAddr U1.S4.PcSubAddr
178#define SubData U1.S4.PcSubData
179#define CommandText U1.S5.PcCommandText
180#define RouteTopology U1.S6.Topology
181#define ModuleTypes U1.S3.PcModuleTypes
182
183#endif