README.flexcop 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. This README escorted the skystar2-driver rewriting procedure. It describes the
  2. state of the new flexcop-driver set and some internals are written down here
  3. too.
  4. This document hopefully describes things about the flexcop and its
  5. device-offsprings. Goal was to write an easy-to-write and easy-to-read set of
  6. drivers based on the skystar2.c and other information.
  7. Remark: flexcop-pci.c was a copy of skystar2.c, but every line has been
  8. touched and rewritten.
  9. History & News
  10. ==============
  11. 2005-04-01 - correct USB ISOC transfers (thanks to Vadim Catana)
  12. General coding processing
  13. =========================
  14. We should proceed as follows (as long as no one complains):
  15. 0) Think before start writing code!
  16. 1) rewriting the skystar2.c with the help of the flexcop register descriptions
  17. and splitting up the files to a pci-bus-part and a flexcop-part.
  18. The new driver will be called b2c2-flexcop-pci.ko/b2c2-flexcop-usb.ko for the
  19. device-specific part and b2c2-flexcop.ko for the common flexcop-functions.
  20. 2) Search for errors in the leftover of flexcop-pci.c (compare with pluto2.c
  21. and other pci drivers)
  22. 3) make some beautification (see 'Improvements when rewriting (refactoring) is
  23. done')
  24. 4) Testing the new driver and maybe substitute the skystar2.c with it, to reach
  25. a wider tester audience.
  26. 5) creating an usb-bus-part using the already written flexcop code for the pci
  27. card.
  28. Idea: create a kernel-object for the flexcop and export all important
  29. functions. This option saves kernel-memory, but maybe a lot of functions have
  30. to be exported to kernel namespace.
  31. Current situation
  32. =================
  33. 0) Done :)
  34. 1) Done (some minor issues left)
  35. 2) Done
  36. 3) Not ready yet, more information is necessary
  37. 4) next to be done (see the table below)
  38. 5) USB driver is working (yes, there are some minor issues)
  39. What seems to be ready?
  40. -----------------------
  41. 1) Rewriting
  42. 1a) i2c is cut off from the flexcop-pci.c and seems to work
  43. 1b) moved tuner and demod stuff from flexcop-pci.c to flexcop-tuner-fe.c
  44. 1c) moved lnb and diseqc stuff from flexcop-pci.c to flexcop-tuner-fe.c
  45. 1e) eeprom (reading MAC address)
  46. 1d) sram (no dynamic sll size detection (commented out) (using default as JJ told me))
  47. 1f) misc. register accesses for reading parameters (e.g. resetting, revision)
  48. 1g) pid/mac filter (flexcop-hw-filter.c)
  49. 1i) dvb-stuff initialization in flexcop.c (done)
  50. 1h) dma stuff (now just using the size-irq, instead of all-together, to be done)
  51. 1j) remove flexcop initialization from flexcop-pci.c completely (done)
  52. 1l) use a well working dma IRQ method (done, see 'Known bugs and problems and TODO')
  53. 1k) cleanup flexcop-files (remove unused EXPORT_SYMBOLs, make static from
  54. non-static where possible, moved code to proper places)
  55. 2) Search for errors in the leftover of flexcop-pci.c (partially done)
  56. 5a) add MAC address reading
  57. 5c) feeding of ISOC data to the software demux (format of the isochronous data
  58. and speed optimization, no real error) (thanks to Vadim Catana)
  59. What to do in the near future?
  60. --------------------------------------
  61. (no special order here)
  62. 5) USB driver
  63. 5b) optimize isoc-transfer (submitting/killing isoc URBs when transfer is starting)
  64. Testing changes
  65. ---------------
  66. O = item is working
  67. P = item is partially working
  68. X = item is not working
  69. N = item does not apply here
  70. <empty field> = item need to be examined
  71. | PCI | USB
  72. item | mt352 | nxt2002 | stv0299 | mt312 | mt352 | nxt2002 | stv0299 | mt312
  73. -------+-------+---------+---------+-------+-------+---------+---------+-------
  74. 1a) | O | | | | N | N | N | N
  75. 1b) | O | | | | | | O |
  76. 1c) | N | N | | | N | N | O |
  77. 1d) | O | O
  78. 1e) | O | O
  79. 1f) | P
  80. 1g) | O
  81. 1h) | P |
  82. 1i) | O | N
  83. 1j) | O | N
  84. 1l) | O | N
  85. 2) | O | N
  86. 5a) | N | O
  87. 5b)* | N |
  88. 5c) | N | O
  89. * - not done yet
  90. Known bugs and problems and TODO
  91. --------------------------------
  92. 1g/h/l) when pid filtering is enabled on the pci card
  93. DMA usage currently:
  94. The DMA is splitted in 2 equal-sized subbuffers. The Flexcop writes to first
  95. address and triggers an IRQ when it's full and starts writing to the second
  96. address. When the second address is full, the IRQ is triggered again, and
  97. the flexcop writes to first address again, and so on.
  98. The buffersize of each address is currently 640*188 bytes.
  99. Problem is, when using hw-pid-filtering and doing some low-bandwidth
  100. operation (like scanning) the buffers won't be filled enough to trigger
  101. the IRQ. That's why:
  102. When PID filtering is activated, the timer IRQ is used. Every 1.97 ms the IRQ
  103. is triggered. Is the current write address of DMA1 different to the one
  104. during the last IRQ, then the data is passed to the demuxer.
  105. There is an additional DMA-IRQ-method: packet count IRQ. This isn't
  106. implemented correctly yet.
  107. The solution is to disable HW PID filtering, but I don't know how the DVB
  108. API software demux behaves on slow systems with 45MBit/s TS.
  109. Solved bugs :)
  110. --------------
  111. 1g) pid-filtering (somehow pid index 4 and 5 (EMM_PID and ECM_PID) aren't
  112. working)
  113. SOLUTION: also index 0 was affected, because net_translation is done for
  114. these indexes by default
  115. 5b) isochronous transfer does only work in the first attempt (for the Sky2PC
  116. USB, Air2PC is working) SOLUTION: the flexcop was going asleep and never really
  117. woke up again (don't know if this need fixes, see
  118. flexcop-fe-tuner.c:flexcop_sleep)
  119. NEWS: when the driver is loaded and unloaded and loaded again (w/o doing
  120. anything in the while the driver is loaded the first time), no transfers take
  121. place anymore.
  122. Improvements when rewriting (refactoring) is done
  123. =================================================
  124. - split sleeping of the flexcop (misc_204.ACPI3_sig = 1;) from lnb_control
  125. (enable sleeping for other demods than dvb-s)
  126. - add support for CableStar (stv0297 Microtune 203x/ALPS) (almost done, incompatibilities with the Nexus-CA)
  127. Debugging
  128. ---------
  129. - add verbose debugging to skystar2.c (dump the reg_dw_data) and compare it
  130. with this flexcop, this is important, because i2c is now using the
  131. flexcop_ibi_value union from flexcop-reg.h (do you have a better idea for
  132. that, please tell us so).
  133. Everything which is identical in the following table, can be put into a common
  134. flexcop-module.
  135. PCI USB
  136. -------------------------------------------------------------------------------
  137. Different:
  138. Register access: accessing IO memory USB control message
  139. I2C bus: I2C bus of the FC USB control message
  140. Data transfer: DMA isochronous transfer
  141. EEPROM transfer: through i2c bus not clear yet
  142. Identical:
  143. Streaming: accessing registers
  144. PID Filtering: accessing registers
  145. Sram destinations: accessing registers
  146. Tuner/Demod: I2C bus
  147. DVB-stuff: can be written for common use
  148. Acknowledgements (just for the rewriting part)
  149. ================
  150. Bjarne Steinsbo thought a lot in the first place of the pci part for this code
  151. sharing idea.
  152. Andreas Oberritter for providing a recent PCI initialization template
  153. (pluto2.c).
  154. Boleslaw Ciesielski for pointing out a problem with firmware loader.
  155. Vadim Catana for correcting the USB transfer.
  156. comments, critics and ideas to linux-dvb@linuxtv.org.