ch08s02.html 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. <html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Principles of Operation</title><meta name="generator" content="DocBook XSL Stylesheets V1.76.1"><meta name="keywords" content="Intellon, Atheros, Qualcomm, HomePlug, powerline, communications, INT6000, INT6300, INT6400, AR7400, AR7420"><link rel="home" href="index.html" title="Qualcomm Atheros Open Powerline Toolkit"><link rel="up" href="ch08.html" title="Chapter 8.  Serial Drivers"><link rel="prev" href="ch08.html" title="Chapter 8.  Serial Drivers"><link rel="next" href="ch08s03.html" title="SPI Serial Driver"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">
  2. Principles of Operation
  3. </th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch08.html">Prev</a> </td><th width="60%" align="center">Chapter 8. 
  4. Serial Drivers
  5. </th><td width="20%" align="right"> <a accesskey="n" href="ch08s03.html">Next</a></td></tr></table><hr></div><div class="section" title="Principles of Operation"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="driver-spi-principles"></a>
  6. Principles of Operation
  7. </h2></div></div></div><p>
  8. The basic unit of data transfer over MII and powerline is the IEEE 802.3 Ethernet frame. On output, the host must encapsulate each Ethernet frame as shown below before serial transmission to the QCA7000. The QCA7000 strips off the serial header and footer and forwards the frame over powerline.
  9. </p><div class="table"><a name="idp25292736"></a><p class="title"><b>Table 8.1. 
  10. SPI Transmit Frame
  11. </b></p><div class="table-contents"><p>
  12. Allocate a 1528-byte buffer to accommodate the largest outgoing serial packet and pad with <code class="constant">NUL</code> bytes. Write <code class="varname">SOF</code>, compute and write <code class="varname">FL</code>, copy the outgoing frame then write <code class="varname">EOF</code>. Serially transmit <code class="varname">FL</code> + <code class="constant">12</code> buffer bytes to the QCA7000.
  13. </p><table summary="
  14. SPI Transmit Frame
  15. " border="1"><colgroup><col><col><col><col></colgroup><thead><tr><th>
  16. Offset
  17. </th><th>
  18. Length
  19. </th><th>
  20. Symbol
  21. </th><th>
  22. Description
  23. </th></tr></thead><tbody><tr><td>
  24. 0x0000
  25. </td><td>
  26. 4
  27. </td><td>
  28. SOF
  29. </td><td>
  30. Start Of Frame. Must be <code class="constant">0xAAAAAAAA</code>.
  31. </td></tr><tr><td>
  32. 0x0004
  33. </td><td>
  34. 2
  35. </td><td>
  36. FL
  37. </td><td>
  38. The Ethernet frame length in little endian format. The frame starts at offset <code class="constant">0x0008</code> here and includes all fields up to but excluding <code class="varname">EOF</code>. The minimum is <code class="constant">60</code>. The maximum is <code class="constant">1518</code> if <code class="varname">VLAN</code> is omitted and <code class="constant">1522</code> if not.
  39. </td></tr><tr><td>
  40. 0x0006
  41. </td><td>
  42. 2
  43. </td><td>
  44. RSVD
  45. </td><td>
  46. Must be <code class="constant">0x0000</code>. Reserved to ensure 4-byte frame alignment.
  47. </td></tr><tr><td>
  48. 0x0008
  49. </td><td>
  50. 6
  51. </td><td>
  52. DA
  53. </td><td>
  54. Destination address.
  55. </td></tr><tr><td>
  56. 0x000E
  57. </td><td>
  58. 6
  59. </td><td>
  60. SA
  61. </td><td>
  62. Source address. This must not be the MAC address of the powerline device. This must be the MAC address of the local host serial interface as assigned by the SP or UART driver. The PLC device and the associated host interface must have different MAC address.
  63. </td></tr><tr><td>
  64. 0x0014
  65. </td><td>
  66. 4
  67. </td><td>
  68. VLAN
  69. </td><td>
  70. Virtual LAN tag. This field may be omitted.
  71. </td></tr><tr><td>
  72. 0x0018
  73. </td><td>
  74. 2
  75. </td><td>
  76. ET
  77. </td><td>
  78. Ethertype. This field starts at offset <code class="constant">0x0014</code> if <code class="varname">VLAN</code> is omitted.
  79. </td></tr><tr><td>
  80. 0x001A
  81. </td><td>
  82. 42 to 1500
  83. </td><td>
  84. BODY
  85. </td><td>
  86. Frame body. This field starts at offset <code class="constant">0x0016</code> and ranges from <code class="constant">46</code> to <code class="constant">1500</code> bytes if <code class="varname">VLAN</code> is omitted.
  87. </td></tr><tr><td>
  88. 0x004A to 0x05F8
  89. </td><td>
  90. 4
  91. </td><td>
  92. EOF
  93. </td><td>
  94. End Of Frame. Must be <code class="constant">0x5555</code>. This field starts at offset <code class="constant">0x0008</code> plus <code class="varname">FL</code>.
  95. </td></tr></tbody></table></div></div><br class="table-break"><div class="table"><a name="idp25310504"></a><p class="title"><b>Table 8.2. 
  96. SPI Receive Frame
  97. </b></p><div class="table-contents"><p>
  98. The SPI read frame occurs in response to a read interrupt generated by the QCA7000. The host must acknowledge a read interrupt and service it by reading and acting on QCA7000 SPI register values. For incoming frames, the host reads the 32-bit overall packet length reported by the QCA7000 then read that many bytes, stripping off the serial header and footer and forwarding the Ethernet frame to the host.
  99. </p><p>
  100. Allocate a 1532-byte buffer to accomodate the largest incoming serial packet. Read <code class="varname">LEN</code> to determine the size of the incoming serial packet. Read <code class="varname">LEN</code> bytes into the buffer. Beware that <code class="varname">LEN</code> is a multiple of 4-bytes so there may be a few trailing <code class="constant">NUL</code> bytes in buffer.
  101. </p><table summary="
  102. SPI Receive Frame
  103. " border="1"><colgroup><col><col><col><col></colgroup><thead><tr><th>
  104. Offset
  105. </th><th>
  106. Length
  107. </th><th>
  108. Symbol
  109. </th><th>
  110. Description
  111. </th></tr></thead><tbody><tr><td>
  112. 0x0000
  113. </td><td>
  114. 4
  115. </td><td>
  116. LEN
  117. </td><td>
  118. Hardware generated packet length. This field is only generated for SPI packets, not the UART packets.
  119. </td></tr><tr><td>
  120. 0x0004
  121. </td><td>
  122. 4
  123. </td><td>
  124. SOF
  125. </td><td>
  126. Start Of Frame. Must be <code class="constant">0xAAAAAAAA</code>.
  127. </td></tr><tr><td>
  128. 0x0008
  129. </td><td>
  130. 2
  131. </td><td>
  132. FL
  133. </td><td>
  134. Ethernet frame length in little endian format. The frame starts at offset <code class="constant">0x000C</code> here and includes all fields up to but excluding <code class="varname">EOF</code>. The minimum length is <code class="constant">60</code>. The maximum is <code class="constant">1518</code> if <code class="varname">VLAN</code> is omitted and <code class="constant">1522</code> if not.
  135. </td></tr><tr><td>
  136. 0x000A
  137. </td><td>
  138. 2
  139. </td><td>
  140. RSVD
  141. </td><td>
  142. Must be <code class="constant">0x0000</code>. Reserved to ensure 4-byte frame alignment.
  143. </td></tr><tr><td>
  144. 0x000C
  145. </td><td>
  146. 6
  147. </td><td>
  148. DA
  149. </td><td>
  150. Destination address.
  151. </td></tr><tr><td>
  152. 0x0012
  153. </td><td>
  154. 6
  155. </td><td>
  156. SA
  157. </td><td>
  158. Source address. This must not be the MAC address of the powerline device. This must be the MAC address of the local host serial interface as assigned by the SP or UART driver. The PLC device and the associated host interface must have different MAC address.
  159. </td></tr><tr><td>
  160. 0x0018
  161. </td><td>
  162. 4
  163. </td><td>
  164. VLAN
  165. </td><td>
  166. Virtual LAN tag. This field may be omitted.
  167. </td></tr><tr><td>
  168. 0x001C
  169. </td><td>
  170. 2
  171. </td><td>
  172. ET
  173. </td><td>
  174. Ethertype. This field starts offset <code class="constant">0x0018</code> if <code class="varname">VLAN</code> is omitted.
  175. </td></tr><tr><td>
  176. 0x001E
  177. </td><td>
  178. 42 to 1500
  179. </td><td>
  180. BODY
  181. </td><td>
  182. Frame body. This field starts at offset <code class="constant">0x001A</code> and ranges from <code class="constant">46</code> to <code class="constant">1500</code> bytes if <code class="varname">VLAN</code> is omitted.
  183. </td></tr><tr><td>
  184. 0x004A to 0x05F8
  185. </td><td>
  186. 4
  187. </td><td>
  188. EOF
  189. </td><td>
  190. End Of Frame. Must be <code class="constant">0x5555</code>. This field starts at offset <code class="constant">0x000C</code> plus <code class="varname">FL</code>.
  191. </td></tr></tbody></table></div></div><br class="table-break"></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch08.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch08.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch08s03.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 8. 
  192. Serial Drivers
  193.  </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 
  194. SPI Serial Driver
  195. </td></tr></table></div></body></html>