qcaspi.xml 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814
  1. <chapter id='driver-spi'>
  2. <title>
  3. Serial Drivers
  4. </title>
  5. <section id="driver-spi-intro">
  6. <title>
  7. Introduction
  8. </title>
  9. <para>
  10. Most Qualcomm Atheros PLC chipsets are Ethernet-to-Powerline bridges but the QCA7000 is a Serial-to-Powerline bridge, ... with a big difference. The QCA7000 expects the host serial stream to be segmented into Ethernet frames where each frame is encapsulated by a distinct serial header and trailer. This means the host can format and transmit, or receive and decode, standard Ethernet 802.3 frames over an ordinary SPI or UART interface thereby enabling full Ethernet or Internet protocol communications over powerline at low cost and low speed. The enabling component here is an Ethernet-to-Serial driver that supports the SPI or UART interface connected to the QCA7000. This section covers such a driver.
  11. </para>
  12. <para>
  13. The example driver described here was written for the Freescale iMX28 board support package running a custom Freescale Linux distribution. As such, we believe that this driver is suitable for the iMX28 processor out of the box but it could be adapted to other processors.
  14. </para>
  15. </section>
  16. <section id="driver-spi-principles">
  17. <title>
  18. Principles of Operation
  19. </title>
  20. <para>
  21. 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.
  22. </para>
  23. <table>
  24. <title>
  25. SPI Transmit Frame
  26. </title>
  27. <para>
  28. Allocate a 1528-byte buffer to accommodate the largest outgoing serial packet and pad with <constant>NUL</constant> bytes. Write <varname>SOF</varname>, compute and write <varname>FL</varname>, copy the outgoing frame then write <varname>EOF</varname>. Serially transmit <varname>FL</varname> + <constant>12</constant> buffer bytes to the QCA7000.
  29. </para>
  30. <tgroup cols="4">
  31. <thead>
  32. <row>
  33. <entry>
  34. Offset
  35. </entry>
  36. <entry>
  37. Length
  38. </entry>
  39. <entry>
  40. Symbol
  41. </entry>
  42. <entry>
  43. Description
  44. </entry>
  45. </row>
  46. </thead>
  47. <tbody>
  48. <row>
  49. <entry>
  50. 0x0000
  51. </entry>
  52. <entry>
  53. 4
  54. </entry>
  55. <entry>
  56. SOF
  57. </entry>
  58. <entry>
  59. Start Of Frame. Must be <constant>0xAAAAAAAA</constant>.
  60. </entry>
  61. </row>
  62. <row>
  63. <entry>
  64. 0x0004
  65. </entry>
  66. <entry>
  67. 2
  68. </entry>
  69. <entry>
  70. FL
  71. </entry>
  72. <entry>
  73. The Ethernet frame length in little endian format. The frame starts at offset <constant>0x0008</constant> here and includes all fields up to but excluding <varname>EOF</varname>. The minimum is <constant>60</constant>. The maximum is <constant>1518</constant> if <varname>VLAN</varname> is omitted and <constant>1522</constant> if not.
  74. </entry>
  75. </row>
  76. <row>
  77. <entry>
  78. 0x0006
  79. </entry>
  80. <entry>
  81. 2
  82. </entry>
  83. <entry>
  84. RSVD
  85. </entry>
  86. <entry>
  87. Must be <constant>0x0000</constant>. Reserved to ensure 4-byte frame alignment.
  88. </entry>
  89. </row>
  90. <row>
  91. <entry>
  92. 0x0008
  93. </entry>
  94. <entry>
  95. 6
  96. </entry>
  97. <entry>
  98. DA
  99. </entry>
  100. <entry>
  101. Destination address.
  102. </entry>
  103. </row>
  104. <row>
  105. <entry>
  106. 0x000E
  107. </entry>
  108. <entry>
  109. 6
  110. </entry>
  111. <entry>
  112. SA
  113. </entry>
  114. <entry>
  115. 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.
  116. </entry>
  117. </row>
  118. <row>
  119. <entry>
  120. 0x0014
  121. </entry>
  122. <entry>
  123. 4
  124. </entry>
  125. <entry>
  126. VLAN
  127. </entry>
  128. <entry>
  129. Virtual LAN tag. This field may be omitted.
  130. </entry>
  131. </row>
  132. <row>
  133. <entry>
  134. 0x0018
  135. </entry>
  136. <entry>
  137. 2
  138. </entry>
  139. <entry>
  140. ET
  141. </entry>
  142. <entry>
  143. Ethertype. This field starts at offset <constant>0x0014</constant> if <varname>VLAN</varname> is omitted.
  144. </entry>
  145. </row>
  146. <row>
  147. <entry>
  148. 0x001A
  149. </entry>
  150. <entry>
  151. 42 to 1500
  152. </entry>
  153. <entry>
  154. BODY
  155. </entry>
  156. <entry>
  157. Frame body. This field starts at offset <constant>0x0016</constant> and ranges from <constant>46</constant> to <constant>1500</constant> bytes if <varname>VLAN</varname> is omitted.
  158. </entry>
  159. </row>
  160. <row>
  161. <entry>
  162. 0x004A to 0x05F8
  163. </entry>
  164. <entry>
  165. 4
  166. </entry>
  167. <entry>
  168. EOF
  169. </entry>
  170. <entry>
  171. End Of Frame. Must be <constant>0x5555</constant>. This field starts at offset <constant>0x0008</constant> plus <varname>FL</varname>.
  172. </entry>
  173. </row>
  174. </tbody>
  175. </tgroup>
  176. </table>
  177. <table>
  178. <title>
  179. SPI Receive Frame
  180. </title>
  181. <para>
  182. 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.
  183. </para>
  184. <para>
  185. Allocate a 1532-byte buffer to accomodate the largest incoming serial packet. Read <varname>LEN</varname> to determine the size of the incoming serial packet. Read <varname>LEN</varname> bytes into the buffer. Beware that <varname>LEN</varname> is a multiple of 4-bytes so there may be a few trailing <constant>NUL</constant> bytes in buffer.
  186. </para>
  187. <tgroup cols="4">
  188. <thead>
  189. <row>
  190. <entry>
  191. Offset
  192. </entry>
  193. <entry>
  194. Length
  195. </entry>
  196. <entry>
  197. Symbol
  198. </entry>
  199. <entry>
  200. Description
  201. </entry>
  202. </row>
  203. </thead>
  204. <tbody>
  205. <row>
  206. <entry>
  207. 0x0000
  208. </entry>
  209. <entry>
  210. 4
  211. </entry>
  212. <entry>
  213. LEN
  214. </entry>
  215. <entry>
  216. Hardware generated packet length. This field is only generated for SPI packets, not the UART packets.
  217. </entry>
  218. </row>
  219. <row>
  220. <entry>
  221. 0x0004
  222. </entry>
  223. <entry>
  224. 4
  225. </entry>
  226. <entry>
  227. SOF
  228. </entry>
  229. <entry>
  230. Start Of Frame. Must be <constant>0xAAAAAAAA</constant>.
  231. </entry>
  232. </row>
  233. <row>
  234. <entry>
  235. 0x0008
  236. </entry>
  237. <entry>
  238. 2
  239. </entry>
  240. <entry>
  241. FL
  242. </entry>
  243. <entry>
  244. Ethernet frame length in little endian format. The frame starts at offset <constant>0x000C</constant> here and includes all fields up to but excluding <varname>EOF</varname>. The minimum length is <constant>60</constant>. The maximum is <constant>1518</constant> if <varname>VLAN</varname> is omitted and <constant>1522</constant> if not.
  245. </entry>
  246. </row>
  247. <row>
  248. <entry>
  249. 0x000A
  250. </entry>
  251. <entry>
  252. 2
  253. </entry>
  254. <entry>
  255. RSVD
  256. </entry>
  257. <entry>
  258. Must be <constant>0x0000</constant>. Reserved to ensure 4-byte frame alignment.
  259. </entry>
  260. </row>
  261. <row>
  262. <entry>
  263. 0x000C
  264. </entry>
  265. <entry>
  266. 6
  267. </entry>
  268. <entry>
  269. DA
  270. </entry>
  271. <entry>
  272. Destination address.
  273. </entry>
  274. </row>
  275. <row>
  276. <entry>
  277. 0x0012
  278. </entry>
  279. <entry>
  280. 6
  281. </entry>
  282. <entry>
  283. SA
  284. </entry>
  285. <entry>
  286. 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.
  287. </entry>
  288. </row>
  289. <row>
  290. <entry>
  291. 0x0018
  292. </entry>
  293. <entry>
  294. 4
  295. </entry>
  296. <entry>
  297. VLAN
  298. </entry>
  299. <entry>
  300. Virtual LAN tag. This field may be omitted.
  301. </entry>
  302. </row>
  303. <row>
  304. <entry>
  305. 0x001C
  306. </entry>
  307. <entry>
  308. 2
  309. </entry>
  310. <entry>
  311. ET
  312. </entry>
  313. <entry>
  314. Ethertype. This field starts offset <constant>0x0018</constant> if <varname>VLAN</varname> is omitted.
  315. </entry>
  316. </row>
  317. <row>
  318. <entry>
  319. 0x001E
  320. </entry>
  321. <entry>
  322. 42 to 1500
  323. </entry>
  324. <entry>
  325. BODY
  326. </entry>
  327. <entry>
  328. Frame body. This field starts at offset <constant>0x001A</constant> and ranges from <constant>46</constant> to <constant>1500</constant> bytes if <varname>VLAN</varname> is omitted.
  329. </entry>
  330. </row>
  331. <row>
  332. <entry>
  333. 0x004A to 0x05F8
  334. </entry>
  335. <entry>
  336. 4
  337. </entry>
  338. <entry>
  339. EOF
  340. </entry>
  341. <entry>
  342. End Of Frame. Must be <constant>0x5555</constant>. This field starts at offset <constant>0x000C</constant> plus <varname>FL</varname>.
  343. </entry>
  344. </row>
  345. </tbody>
  346. </tgroup>
  347. </table>
  348. </section>
  349. <section id="qcaspi1">
  350. <title>
  351. SPI Serial Driver
  352. </title>
  353. <section id="qcaspi_spi_thread">
  354. <title>
  355. qcaspi_spi_thread
  356. </title>
  357. <funcsynopsis>
  358. <funcprototype>
  359. <funcdef>static int <function>qcaspi_spi_thread</function></funcdef>
  360. <paramdef>char void * <parameter>data</parameter></paramdef>
  361. </funcprototype>
  362. </funcsynopsis>
  363. <para>
  364. Manages synchronization with the exteranl QCA7000.
  365. Handles interrupts fomr the external QCA7000.
  366. Transmits frames for the transmit queue to the QCA7000.
  367. </para>
  368. </section>
  369. <section id="qcaspi_qca7k_sync">
  370. <title>
  371. qcaspi_qca7k_sync
  372. </title>
  373. <funcsynopsis>
  374. <funcprototype>
  375. <funcdef>void <function>qca_qca7k_sync</function></funcdef>
  376. <paramdef>char struct qcaspi * <parameter>qca</parameter></paramdef>
  377. <paramdef>int <parameter>event</parameter></paramdef>
  378. </funcprototype>
  379. </funcsynopsis>
  380. <para>
  381. Keeps track of the current synchonization state.
  382. </para>
  383. </section>
  384. </section>
  385. <section id="qcaspi2">
  386. <title>
  387. Register Functions
  388. </title>
  389. <section id="qcaspi_read_register">
  390. <title>
  391. qcaspi_read_register
  392. </title>
  393. <funcsynopsis>
  394. <funcprototype>
  395. <funcdef>uint16_t <function>qcaspi_read_register</function></funcdef>
  396. <paramdef>struct qcaspi * <parameter>qca</parameter></paramdef>
  397. <paramdef>uint16_t <parameter>reg</parameter></paramdef>
  398. </funcprototype>
  399. </funcsynopsis>
  400. <para>
  401. Reads a QCA7000 register and returns register content.
  402. </para>
  403. </section>
  404. <section id="qcaspi_write_register">
  405. <title>
  406. qcaspi_write_register
  407. </title>
  408. <funcsynopsis>
  409. <funcprototype>
  410. <funcdef>void <function>qcaspi_write_register</function></funcdef>
  411. <paramdef>struct qcaspi * <parameter>qca</parameter></paramdef>
  412. <paramdef>uint16_t <parameter>reg</parameter></paramdef>
  413. <paramdef>uint16_t <parameter>value</parameter></paramdef>
  414. </funcprototype>
  415. </funcsynopsis>
  416. <para>
  417. Write a value into a QCA7000 register.
  418. </para>
  419. </section>
  420. <section id="qcaspi_tx_cmd">
  421. <title>
  422. qcaspi_tx_cmd
  423. </title>
  424. <funcsynopsis>
  425. <funcprototype>
  426. <funcdef>int <function>qcaspi_tx_cmd</function></funcdef>
  427. <paramdef>struct qcaspi * <parameter>qca</parameter></paramdef>
  428. <paramdef>uint16_t <parameter>cmd</parameter></paramdef>
  429. </funcprototype>
  430. </funcsynopsis>
  431. <para>
  432. Transmit a 16-bit command to the QCA7000. This is currently used when performing a legacy DMA read or write.
  433. </para>
  434. </section>
  435. </section>
  436. <section id="qcaspi3">
  437. <title>
  438. Interrupt Functions
  439. </title>
  440. <section id="disable_spi_interrupts">
  441. <title>
  442. disable_spi_interrupts
  443. </title>
  444. <funcsynopsis>
  445. <funcprototype>
  446. <funcdef>uint32_t <function>disable_spi_interrupts</function></funcdef>
  447. <paramdef>struct qcaspi * <parameter>qca</parameter></paramdef>
  448. </funcprototype>
  449. </funcsynopsis>
  450. <para>
  451. Disables interrupts by writing <constant>0</constant> to the QCA7000 <varname>INTR_ENABLE</varname> register.
  452. </para>
  453. </section>
  454. <section id="enable_spi_interrupts">
  455. <title>
  456. enable_spi_interrupts
  457. </title>
  458. <funcsynopsis>
  459. <funcprototype>
  460. <funcdef>uint32_t <function>enable_spi_interrupts</function></funcdef>
  461. <paramdef>struct qcaspi * <parameter>qca</parameter></paramdef>
  462. <paramdef>uint32_t <parameter>intr_enable</parameter></paramdef>
  463. </funcprototype>
  464. </funcsynopsis>
  465. <para>
  466. Enables interrupts specified by writing to the QCA7000 <varname>INTR_ENABLE</varname> register and returns the previous register value.
  467. </para>
  468. </section>
  469. <section id="qcaspi_intr_handler">
  470. <title>
  471. qcaspi_intr_handler
  472. </title>
  473. <funcsynopsis>
  474. <funcprototype>
  475. <funcdef>static irqreturn_t <function>qcaspi_intr_handler</function></funcdef>
  476. <paramdef>int <parameter>irq</parameter></paramdef>
  477. <paramdef>void * <parameter>data</parameter></paramdef>
  478. </funcprototype>
  479. </funcsynopsis>
  480. <para>
  481. Called to service interrupts on rising edge of the QCA7000 interrupt line.
  482. </para>
  483. </section>
  484. </section>
  485. <section id="qcaspi4">
  486. <title>
  487. Transmit Functions
  488. </title>
  489. <section id="qcaspi_transmit">
  490. <title>
  491. qcaspi_transmit
  492. </title>
  493. <funcsynopsis>
  494. <funcprototype>
  495. <funcdef>int <function>qcaspi_transmit</function></funcdef>
  496. <paramdef>struct qcaspi * <parameter>qca</parameter></paramdef>
  497. </funcprototype>
  498. </funcsynopsis>
  499. <para>
  500. Transmit as many frames as possible from the transmit queue.
  501. </para>
  502. </section>
  503. <section id="qcaspi_tx_frame">
  504. <title>
  505. qcaspi_tx_frame
  506. </title>
  507. <funcsynopsis>
  508. <funcprototype>
  509. <funcdef>int <function>qcaspi_tx_frame</function></funcdef>
  510. <paramdef>struct qcaspi * <parameter>qca</parameter></paramdef>
  511. <paramdef>struct sk_buff * <parameter>skb</parameter></paramdef>
  512. </funcprototype>
  513. </funcsynopsis>
  514. <para>
  515. Transmit a single socket buffer over the SPI interface.
  516. </para>
  517. </section>
  518. <section id="qcaspi_flush_txq">
  519. <title>
  520. qcaspi_flush_txq
  521. </title>
  522. <funcsynopsis>
  523. <funcprototype>
  524. <funcdef>void <function>qcaspi_flush_txq</function></funcdef>
  525. <paramdef>struct qcaspi * <parameter>qca</parameter></paramdef>
  526. </funcprototype>
  527. </funcsynopsis>
  528. <para>
  529. Flush the transmit queue. Typically called when a synchronization issue is detected between the SPI master (host) and SPI slave (QCA7000).
  530. </para>
  531. </section>
  532. </section>
  533. <section id="qcaspi5">
  534. <title>
  535. Receive Functions
  536. </title>
  537. <section id="qcaspi_receive">
  538. <title>
  539. qcaspi_receive
  540. </title>
  541. <funcsynopsis>
  542. <funcprototype>
  543. <funcdef>int <function>qcaspi_receive</function></funcdef>
  544. <paramdef>struct qcaspi * <parameter>qca</parameter></paramdef>
  545. </funcprototype>
  546. </funcsynopsis>
  547. <para>
  548. Reads the QCA7000 read buffer bytes register and reads all available data from the QCA7000. Calls function to parse out the individual Ethernet frames and passes them to the Linux kernel protocol stack.
  549. </para>
  550. </section>
  551. </section>
  552. <section id="qcaspi6">
  553. <title>
  554. DMA Functions
  555. </title>
  556. <section id="qcaspi_dma_read_burst">
  557. <title>
  558. qcaspi_dma_read_burst
  559. </title>
  560. <funcsynopsis>
  561. <funcprototype>
  562. <funcdef>uint32_t <function>qcaspi_dma_read_burst</function></funcdef>
  563. <paramdef>struct qcaspi * <parameter>qca</parameter></paramdef>
  564. <paramdef>uint8_t * <parameter>buffer</parameter></paramdef>
  565. <paramdef>uint32_t <parameter>length</parameter></paramdef>
  566. </funcprototype>
  567. </funcsynopsis>
  568. <para>
  569. Performs QCA7000 DMA burst read.
  570. </para>
  571. </section>
  572. <section id="qcaspi_dma_read_legacy">
  573. <title>
  574. qcaspi_dma_read_legacy
  575. </title>
  576. <funcsynopsis>
  577. <funcprototype>
  578. <funcdef>uint32_t <function>qcaspi_dma_read_legacy</function></funcdef>
  579. <paramdef>struct qcaspi * <parameter>qca</parameter></paramdef>
  580. <paramdef>uint8_t * <parameter>buffer</parameter></paramdef>
  581. <paramdef>uint32_t <parameter>length</parameter></paramdef>
  582. </funcprototype>
  583. </funcsynopsis>
  584. <para>
  585. Performs QCA7000 DMA legacy read.
  586. </para>
  587. </section>
  588. <section id="qcaspi_dma_write_burst">
  589. <title>
  590. qcaspi_dma_write_burst
  591. </title>
  592. <funcsynopsis>
  593. <funcprototype>
  594. <funcdef>uint32_t <function>qcaspi_dma_write_burst</function></funcdef>
  595. <paramdef>struct qcaspi * <parameter>qca</parameter></paramdef>
  596. <paramdef>uint8_t * <parameter>buffer</parameter></paramdef>
  597. <paramdef>uint32_t <parameter>length</parameter></paramdef>
  598. </funcprototype>
  599. </funcsynopsis>
  600. <para>
  601. Called by <function>qcaspi_tx_frame</function> to peform a DMA burst write instead of a legacy write.
  602. </para>
  603. </section>
  604. <section id="qcaspi_dma_write_legacy">
  605. <title>
  606. qcaspi_dma_write_legacy
  607. </title>
  608. <funcsynopsis>
  609. <funcprototype>
  610. <funcdef>uint32_t <function>qcaspi_dma_write_legacy</function></funcdef>
  611. <paramdef>struct qcaspi * <parameter>qca</parameter></paramdef>
  612. <paramdef>uint8_t * <parameter>buffer</parameter></paramdef>
  613. <paramdef>uint32_t <parameter>length</parameter></paramdef>
  614. </funcprototype>
  615. </funcsynopsis>
  616. <para>
  617. Called by <function>qcaspi_tx_frame</function> to peform a DMA legacy write instead of a burst write.
  618. </para>
  619. </section>
  620. </section>
  621. <section id="qcaspi7">
  622. <title>
  623. Support Functions
  624. </title>
  625. <section id="QcaFrmCreateHeader">
  626. <title>
  627. QcaFrmCreateHeader
  628. </title>
  629. <funcsynopsis>
  630. <funcprototype>
  631. <funcdef>uint32_t <function>QcaFrmCreateHeader</function></funcdef>
  632. <paramdef>uint8_t * <parameter>buffer</parameter></paramdef>
  633. <paramdef>uint16_t <parameter>length</parameter></paramdef>
  634. </funcprototype>
  635. </funcsynopsis>
  636. <para>
  637. Encode buffer with the required SPI header and overall frame length.
  638. </para>
  639. </section>
  640. <section id="QcaFrmCreateFooter">
  641. <title>
  642. QcaFrmCreateFooter
  643. </title>
  644. <funcsynopsis>
  645. <funcprototype>
  646. <funcdef>uint32_t <function>QcaFrmCreateFooter</function></funcdef>
  647. <paramdef>uint8_t * <parameter>buffer</parameter></paramdef>
  648. </funcprototype>
  649. </funcsynopsis>
  650. <para>
  651. Encode buffer with the required SPI footer.
  652. </para>
  653. </section>
  654. <section id="QcaFrmFsmInit">
  655. <title>
  656. QcaFrmFsmInit
  657. </title>
  658. <funcsynopsis>
  659. <funcprototype>
  660. <funcdef>void <function>QcaFrmFsmInit</function></funcdef>
  661. <paramdef>QcaFrmHdl * <parameter>frmHdl</parameter></paramdef>
  662. </funcprototype>
  663. </funcsynopsis>
  664. <para>
  665. Initialize the state machine used to decode the incoming QCA7000 byte stream.
  666. </para>
  667. </section>
  668. <section id="QcaFrmFsmDecode">
  669. <title>
  670. QcaFrmFsmDecode
  671. </title>
  672. <funcsynopsis>
  673. <funcprototype>
  674. <funcdef>uint32_t <function>QcaFrmFsmDecode</function></funcdef>
  675. <paramdef>QcaFrmHdl * <parameter>frmHdl</parameter></paramdef>
  676. <paramdef>uint8_t * <parameter>buffer</parameter></paramdef>
  677. <paramdef>uint16_t <parameter>length</parameter></paramdef>
  678. <paramdef>uint8_t <parameter>bytevalue</parameter></paramdef>
  679. </funcprototype>
  680. </funcsynopsis>
  681. <para>
  682. Feeds incoming bytes into the state machine and breaks the stream into individual frames. Frames are passed to the Linux kernel.
  683. </para>
  684. </section>
  685. </section>
  686. <section id="qcaspi">
  687. <title>
  688. Kernel Functions
  689. </title>
  690. <section id="qcaspi_netdev_xmit">
  691. <title>
  692. qcaspi_netdev_xmit
  693. </title>
  694. <funcsynopsis>
  695. <funcprototype>
  696. <funcdef>int <function>qcaspi_netdev_xmit</function></funcdef>
  697. <paramdef>struct sk_buff * <parameter>skb</parameter></paramdef>
  698. <paramdef>struct net_device * <parameter>device</parameter></paramdef>
  699. </funcprototype>
  700. </funcsynopsis>
  701. <para>
  702. Called by the Linux kernel append outgoing frames to the transmit queue.
  703. </para>
  704. </section>
  705. <section id="qcaspi_netdev_tx_timeout">
  706. <title>
  707. qcaspi_netdev_tx_timeout
  708. </title>
  709. <funcsynopsis>
  710. <funcprototype>
  711. <funcdef>void <function>qcaspi_netdev_tx_timeout</function></funcdef>
  712. <paramdef>struct net_device * <parameter>device</parameter></paramdef>
  713. </funcprototype>
  714. </funcsynopsis>
  715. <para>
  716. Called by the Linux kernel after the transmit queue has been stopped for an extended period of time.
  717. </para>
  718. </section>
  719. <section id="qcaspi_netdev_uninit">
  720. <title>
  721. qcaspi_netdev_uninit
  722. </title>
  723. <funcsynopsis>
  724. <funcprototype>
  725. <funcdef>static void <function>qcaspi_netdev_uninit</function></funcdef>
  726. <paramdef>struct net_device * <parameter>device</parameter></paramdef>
  727. </funcprototype>
  728. </funcsynopsis>
  729. <para>
  730. Called when function <function>unregister_netdev</function> is called. For the QCA7000 driver, function <function>qcaspi_mod_exit</function> calls function <function>unregister_netdev</function>.
  731. </para>
  732. </section>
  733. <section id="qcaspi_netdev_get_stats">
  734. <title>
  735. qcaspi_netdev_get_stats
  736. </title>
  737. <funcsynopsis>
  738. <funcprototype>
  739. <funcdef>struct net_device_stats * <function>qcaspi_netdev_get_stats</function></funcdef>
  740. <paramdef>struct net_device * <parameter>device</parameter></paramdef>
  741. </funcprototype>
  742. </funcsynopsis>
  743. <para>
  744. Returns transmit, receive and error statistics associated with the net device. These are the statistics displayed by <application>ifconfig</application>.
  745. </para>
  746. </section>
  747. <section id="qcaspi_netdev_change_mtu">
  748. <title>
  749. qcaspi_netdev_change_mtu
  750. </title>
  751. <funcsynopsis>
  752. <funcprototype>
  753. <funcdef>int <function>qcaspi_netdev_change_mtu</function></funcdef>
  754. <paramdef>struct net_device * <parameter>device</parameter></paramdef>
  755. <paramdef>int <parameter>new_mtu</parameter></paramdef>
  756. </funcprototype>
  757. </funcsynopsis>
  758. <para>
  759. Changes the serial interface MTU size.
  760. </para>
  761. </section>
  762. <section id="qcaspi_netdev_set_mac_address">
  763. <title>
  764. qcaspi_netdev_set_mac_address
  765. </title>
  766. <funcsynopsis>
  767. <funcprototype>
  768. <funcdef>static int <function>qcaspi_netdev_set_mac_address</function></funcdef>
  769. <paramdef>struct net_device * <parameter>device</parameter></paramdef>
  770. <paramdef>void * <parameter>memory</parameter></paramdef>
  771. </funcprototype>
  772. </funcsynopsis>
  773. <para>
  774. Sets the serial interface MAC address. Called by <application>ifconfig</application> whenever user types <command>ifconfig qca0 hw ether xx:xx:xx:xx:xx:xx</command>.
  775. </para>
  776. </section>
  777. <section id="qcaspi_netdev_close">
  778. <title>
  779. qcaspi_netdev_close
  780. </title>
  781. <funcsynopsis>
  782. <funcprototype>
  783. <funcdef>int <function>qcaspi_netdev_close</function></funcdef>
  784. <paramdef>struct net_device * <parameter>device</parameter></paramdef>
  785. </funcprototype>
  786. </funcsynopsis>
  787. <para>
  788. Called by <application>ifconfig</application> to disable the network interface.
  789. </para>
  790. </section>
  791. <section id="qcaspi_mod_exit">
  792. <title>
  793. qcaspi_mod_exit
  794. </title>
  795. <funcsynopsis>
  796. <funcprototype>
  797. <funcdef>static void <function>qcaspi_mod_exit</function></funcdef>
  798. <paramdef><parameter>void</parameter></paramdef>
  799. </funcprototype>
  800. </funcsynopsis>
  801. <para>
  802. Called by the kernel to shutdown the driver module.
  803. </para>
  804. </section>
  805. </section>
  806. </chapter>