Linux 2.6.21.1
[linux/fpc-iii.git] / drivers / char / rio / cmdpkt.h
blob357ae57224364be31c234fbb957626167d97f13c
1 /*
2 ** -----------------------------------------------------------------------------
3 **
4 ** Perle Specialix driver for Linux
5 ** Ported from existing RIO Driver for SCO sources.
7 * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK.
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.
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.
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.
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
28 ** ident @(#)cmdpkt.h 1.2
30 ** -----------------------------------------------------------------------------
32 #ifndef __rio_cmdpkt_h__
33 #define __rio_cmdpkt_h__
35 #ifdef SCCS_LABELS
36 #ifndef lint
37 static char *_cmdpkt_h_sccs_ = "@(#)cmdpkt.h 1.2";
38 #endif
39 #endif
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.
50 #define RTA_BOOT_DATA_SIZE (PKT_MAX_DATA_LEN-2)
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!
57 struct BootSequence {
58 u16 NumPackets;
59 u16 LoadBase;
60 u16 CodeSize;
63 #define BOOT_SEQUENCE_LEN 8
65 struct SamTop {
66 u8 Unit;
67 u8 Link;
70 struct CmdHdr {
71 u8 PcCommand;
72 union {
73 u8 PcPhbNum;
74 u8 PcLinkNum;
75 u8 PcIDNum;
76 } U0;
80 struct PktCmd {
81 union {
82 struct {
83 struct CmdHdr CmdHdr;
84 struct BootSequence PcBootSequence;
85 } S1;
86 struct {
87 u16 PcSequence;
88 u8 PcBootData[RTA_BOOT_DATA_SIZE];
89 } S2;
90 struct {
91 u16 __crud__;
92 u8 PcUniqNum[4]; /* this is really a uint. */
93 u8 PcModuleTypes; /* what modules are fitted */
94 } S3;
95 struct {
96 struct CmdHdr CmdHdr;
97 u8 __undefined__;
98 u8 PcModemStatus;
99 u8 PcPortStatus;
100 u8 PcSubCommand; /* commands like mem or register dump */
101 u16 PcSubAddr; /* Address for command */
102 u8 PcSubData[64]; /* Date area for command */
103 } S4;
104 struct {
105 struct CmdHdr CmdHdr;
106 u8 PcCommandText[1];
107 u8 __crud__[20];
108 u8 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;
117 struct PktCmd_M {
118 union {
119 struct {
120 struct {
121 u8 PcCommand;
122 union {
123 u8 PcPhbNum;
124 u8 PcLinkNum;
125 u8 PcIDNum;
126 } U0;
127 } CmdHdr;
128 struct {
129 u16 NumPackets;
130 u16 LoadBase;
131 u16 CodeSize;
132 } PcBootSequence;
133 } S1;
134 struct {
135 u16 PcSequence;
136 u8 PcBootData[RTA_BOOT_DATA_SIZE];
137 } S2;
138 struct {
139 u16 __crud__;
140 u8 PcUniqNum[4]; /* this is really a uint. */
141 u8 PcModuleTypes; /* what modules are fitted */
142 } S3;
143 struct {
144 u16 __cmd_hdr__;
145 u8 __undefined__;
146 u8 PcModemStatus;
147 u8 PcPortStatus;
148 u8 PcSubCommand;
149 u16 PcSubAddr;
150 u8 PcSubData[64];
151 } S4;
152 struct {
153 u16 __cmd_hdr__;
154 u8 PcCommandText[1];
155 u8 __crud__[20];
156 u8 PcIDNum2; /* Tacked on end */
157 } S5;
158 struct {
159 u16 __cmd_hdr__;
160 struct Top Topology[LINKS_PER_UNIT];
161 } S6;
162 } U1;
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
183 #endif