cmdpkt.h 4.3 KB

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