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