cmdpkt.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  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. u16 NumPackets;
  55. u16 LoadBase;
  56. u16 CodeSize;
  57. };
  58. #define BOOT_SEQUENCE_LEN 8
  59. struct SamTop {
  60. u8 Unit;
  61. u8 Link;
  62. };
  63. struct CmdHdr {
  64. u8 PcCommand;
  65. union {
  66. u8 PcPhbNum;
  67. u8 PcLinkNum;
  68. u8 PcIDNum;
  69. } U0;
  70. };
  71. struct PktCmd {
  72. union {
  73. struct {
  74. struct CmdHdr CmdHdr;
  75. struct BootSequence PcBootSequence;
  76. } S1;
  77. struct {
  78. u16 PcSequence;
  79. u8 PcBootData[RTA_BOOT_DATA_SIZE];
  80. } S2;
  81. struct {
  82. u16 __crud__;
  83. u8 PcUniqNum[4]; /* this is really a uint. */
  84. u8 PcModuleTypes; /* what modules are fitted */
  85. } S3;
  86. struct {
  87. struct CmdHdr CmdHdr;
  88. u8 __undefined__;
  89. u8 PcModemStatus;
  90. u8 PcPortStatus;
  91. u8 PcSubCommand; /* commands like mem or register dump */
  92. u16 PcSubAddr; /* Address for command */
  93. u8 PcSubData[64]; /* Date area for command */
  94. } S4;
  95. struct {
  96. struct CmdHdr CmdHdr;
  97. u8 PcCommandText[1];
  98. u8 __crud__[20];
  99. u8 PcIDNum2; /* It had to go somewhere! */
  100. } S5;
  101. struct {
  102. struct CmdHdr CmdHdr;
  103. struct SamTop Topology[LINKS_PER_UNIT];
  104. } S6;
  105. } U1;
  106. };
  107. struct PktCmd_M {
  108. union {
  109. struct {
  110. struct {
  111. u8 PcCommand;
  112. union {
  113. u8 PcPhbNum;
  114. u8 PcLinkNum;
  115. u8 PcIDNum;
  116. } U0;
  117. } CmdHdr;
  118. struct {
  119. u16 NumPackets;
  120. u16 LoadBase;
  121. u16 CodeSize;
  122. } PcBootSequence;
  123. } S1;
  124. struct {
  125. u16 PcSequence;
  126. u8 PcBootData[RTA_BOOT_DATA_SIZE];
  127. } S2;
  128. struct {
  129. u16 __crud__;
  130. u8 PcUniqNum[4]; /* this is really a uint. */
  131. u8 PcModuleTypes; /* what modules are fitted */
  132. } S3;
  133. struct {
  134. u16 __cmd_hdr__;
  135. u8 __undefined__;
  136. u8 PcModemStatus;
  137. u8 PcPortStatus;
  138. u8 PcSubCommand;
  139. u16 PcSubAddr;
  140. u8 PcSubData[64];
  141. } S4;
  142. struct {
  143. u16 __cmd_hdr__;
  144. u8 PcCommandText[1];
  145. u8 __crud__[20];
  146. u8 PcIDNum2; /* Tacked on end */
  147. } S5;
  148. struct {
  149. u16 __cmd_hdr__;
  150. struct Top Topology[LINKS_PER_UNIT];
  151. } S6;
  152. } U1;
  153. };
  154. #define Command U1.S1.CmdHdr.PcCommand
  155. #define PhbNum U1.S1.CmdHdr.U0.PcPhbNum
  156. #define IDNum U1.S1.CmdHdr.U0.PcIDNum
  157. #define IDNum2 U1.S5.PcIDNum2
  158. #define LinkNum U1.S1.CmdHdr.U0.PcLinkNum
  159. #define Sequence U1.S2.PcSequence
  160. #define BootData U1.S2.PcBootData
  161. #define BootSequence U1.S1.PcBootSequence
  162. #define UniqNum U1.S3.PcUniqNum
  163. #define ModemStatus U1.S4.PcModemStatus
  164. #define PortStatus U1.S4.PcPortStatus
  165. #define SubCommand U1.S4.PcSubCommand
  166. #define SubAddr U1.S4.PcSubAddr
  167. #define SubData U1.S4.PcSubData
  168. #define CommandText U1.S5.PcCommandText
  169. #define RouteTopology U1.S6.Topology
  170. #define ModuleTypes U1.S3.PcModuleTypes
  171. #endif