cmdpkt.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  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. #ifdef SCCS_LABELS
  35. #ifndef lint
  36. static char *_cmdpkt_h_sccs_ = "@(#)cmdpkt.h 1.2";
  37. #endif
  38. #endif
  39. /*
  40. ** overlays for the data area of a packet. Used in both directions
  41. ** (to build a packet to send, and to interpret a packet that arrives)
  42. ** and is very inconvenient for MIPS, so they appear as two separate
  43. ** structures - those used for modifying/reading packets on the card
  44. ** and those for modifying/reading packets in real memory, which have an _M
  45. ** suffix.
  46. */
  47. #define RTA_BOOT_DATA_SIZE (PKT_MAX_DATA_LEN-2)
  48. /*
  49. ** The boot information packet looks like this:
  50. ** This structure overlays a PktCmd->CmdData structure, and so starts
  51. ** at Data[2] in the actual pkt!
  52. */
  53. struct BootSequence
  54. {
  55. WORD NumPackets;
  56. WORD LoadBase;
  57. WORD CodeSize;
  58. };
  59. #define BOOT_SEQUENCE_LEN 8
  60. struct SamTop
  61. {
  62. BYTE Unit;
  63. BYTE Link;
  64. };
  65. struct CmdHdr
  66. {
  67. BYTE PcCommand;
  68. union
  69. {
  70. BYTE PcPhbNum;
  71. BYTE PcLinkNum;
  72. BYTE PcIDNum;
  73. } U0;
  74. };
  75. struct PktCmd
  76. {
  77. union
  78. {
  79. struct
  80. {
  81. struct CmdHdr CmdHdr;
  82. struct BootSequence PcBootSequence;
  83. } S1;
  84. struct
  85. {
  86. WORD PcSequence;
  87. BYTE PcBootData[RTA_BOOT_DATA_SIZE];
  88. } S2;
  89. struct
  90. {
  91. WORD __crud__;
  92. BYTE PcUniqNum[4]; /* this is really a uint. */
  93. BYTE PcModuleTypes; /* what modules are fitted */
  94. } S3;
  95. struct
  96. {
  97. struct CmdHdr CmdHdr;
  98. BYTE __undefined__;
  99. BYTE PcModemStatus;
  100. BYTE PcPortStatus;
  101. BYTE PcSubCommand; /* commands like mem or register dump */
  102. WORD PcSubAddr; /* Address for command */
  103. BYTE PcSubData[64]; /* Date area for command */
  104. } S4;
  105. struct
  106. {
  107. struct CmdHdr CmdHdr;
  108. BYTE PcCommandText[1];
  109. BYTE __crud__[20];
  110. BYTE PcIDNum2; /* It had to go somewhere! */
  111. } S5;
  112. struct
  113. {
  114. struct CmdHdr CmdHdr;
  115. struct SamTop Topology[LINKS_PER_UNIT];
  116. } S6;
  117. } U1;
  118. };
  119. struct PktCmd_M
  120. {
  121. union
  122. {
  123. struct
  124. {
  125. struct
  126. {
  127. uchar PcCommand;
  128. union
  129. {
  130. uchar PcPhbNum;
  131. uchar PcLinkNum;
  132. uchar PcIDNum;
  133. } U0;
  134. } CmdHdr;
  135. struct
  136. {
  137. ushort NumPackets;
  138. ushort LoadBase;
  139. ushort CodeSize;
  140. } PcBootSequence;
  141. } S1;
  142. struct
  143. {
  144. ushort PcSequence;
  145. uchar PcBootData[RTA_BOOT_DATA_SIZE];
  146. } S2;
  147. struct
  148. {
  149. ushort __crud__;
  150. uchar PcUniqNum[4]; /* this is really a uint. */
  151. uchar PcModuleTypes; /* what modules are fitted */
  152. } S3;
  153. struct
  154. {
  155. ushort __cmd_hdr__;
  156. uchar __undefined__;
  157. uchar PcModemStatus;
  158. uchar PcPortStatus;
  159. uchar PcSubCommand;
  160. ushort PcSubAddr;
  161. uchar PcSubData[64];
  162. } S4;
  163. struct
  164. {
  165. ushort __cmd_hdr__;
  166. uchar PcCommandText[1];
  167. uchar __crud__[20];
  168. uchar PcIDNum2; /* Tacked on end */
  169. } S5;
  170. struct
  171. {
  172. ushort __cmd_hdr__;
  173. struct Top Topology[LINKS_PER_UNIT];
  174. } S6;
  175. } U1;
  176. };
  177. #define Command U1.S1.CmdHdr.PcCommand
  178. #define PhbNum U1.S1.CmdHdr.U0.PcPhbNum
  179. #define IDNum U1.S1.CmdHdr.U0.PcIDNum
  180. #define IDNum2 U1.S5.PcIDNum2
  181. #define LinkNum U1.S1.CmdHdr.U0.PcLinkNum
  182. #define Sequence U1.S2.PcSequence
  183. #define BootData U1.S2.PcBootData
  184. #define BootSequence U1.S1.PcBootSequence
  185. #define UniqNum U1.S3.PcUniqNum
  186. #define ModemStatus U1.S4.PcModemStatus
  187. #define PortStatus U1.S4.PcPortStatus
  188. #define SubCommand U1.S4.PcSubCommand
  189. #define SubAddr U1.S4.PcSubAddr
  190. #define SubData U1.S4.PcSubData
  191. #define CommandText U1.S5.PcCommandText
  192. #define RouteTopology U1.S6.Topology
  193. #define ModuleTypes U1.S3.PcModuleTypes
  194. #endif