aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/dvb/README.flexcop
diff options
context:
space:
mode:
Diffstat (limited to 'Documentation/dvb/README.flexcop')
-rw-r--r--Documentation/dvb/README.flexcop279
1 files changed, 279 insertions, 0 deletions
diff --git a/Documentation/dvb/README.flexcop b/Documentation/dvb/README.flexcop
new file mode 100644
index 000000000000..9ec735714e43
--- /dev/null
+++ b/Documentation/dvb/README.flexcop
@@ -0,0 +1,279 @@
1This README escorted the skystar2-driver rewriting procedure. It describes the
2state of the new flexcop-driver set and some internals are written down here
3too.
4
5How to do something in here?
6============================
7
8make -f Makefile.t
9make -C ../build-2.6
10./in.sh # load the drivers
11./rm.sh # unload the drivers
12
13Please read this file, if you want to contribute.
14
15This document hopefully describes things about the flexcop and its
16device-offsprings. Goal is to write a easy-to-write and easy-to-read set of
17drivers based on the skystar2.c and other information.
18
19This directory is temporary. It is used for rewriting the skystar2.c and to
20create shared code, which then can be used by the usb box as well.
21
22Remark: flexcop-pci.c was a copy of skystar2.c, but every line has been
23touched and rewritten.
24
25General coding processing
26=========================
27
28We should proceed as follows (as long as no one complains):
29
300) Think before start writing code!
31
321) rewriting the skystar2.c with the help of the flexcop register descriptions
33and splitting up the files to a pci-bus-part and a flexcop-part.
34The new driver will be called b2c2-flexcop-pci.ko/b2c2-flexcop-usb.ko for the
35device-specific part and b2c2-flexcop.ko for the common flexcop-functions.
36
372) Search for errors in the leftover of flexcop-pci.c (compare with pluto2.c
38and other pci drivers)
39
403) make some beautification (see 'Improvements when rewriting (refactoring) is
41done')
42
434) Testing the new driver and maybe substitute the skystar2.c with it, to reach
44a wider tester audience.
45
465) creating an usb-bus-part using the already written flexcop code for the pci
47card.
48
49Idea: create a kernel-object for the flexcop and export all important
50functions. This option saves kernel-memory, but maybe a lot of functions have
51to be exported to kernel namespace.
52
53
54Current situation
55=================
56
570) Done :)
581) Done (some minor issues left)
592) Done
603) Not ready yet, more information is necessary
614) next to be done (see the table below)
625) USB driver is working (yes, there are some minor issues)
63
64What seems to be ready?
65-----------------------
66
671) Rewriting
681a) i2c is cut off from the flexcop-pci.c and seems to work
691b) moved tuner and demod stuff from flexcop-pci.c to flexcop-tuner-fe.c
701c) moved lnb and diseqc stuff from flexcop-pci.c to flexcop-tuner-fe.c
711e) eeprom (reading MAC address)
721d) sram (no dynamic sll size detection (commented out) (using default as JJ told me))
731f) misc. register accesses for reading parameters (e.g. resetting, revision)
741g) pid/mac filter (flexcop-hw-filter.c)
751i) dvb-stuff initialization in flexcop.c (done)
761h) dma stuff (now just using the size-irq, instead of all-together, to be done)
771j) remove flexcop initialization from flexcop-pci.c completely (done)
781l) use a well working dma IRQ method (done, see 'Known bugs and problems and TODO')
791k) cleanup flexcop-files (remove unused EXPORT_SYMBOLs, make static from
80non-static where possible, moved code to proper places)
81
822) Search for errors in the leftover of flexcop-pci.c (partially done)
835a) add MAC address reading
84
85What to do in the near future?
86--------------------------------------
87(no special order here)
88
89
905) USB driver
915b) optimize isoc-transfer (submitting/killing isoc URBs when transfer is starting)
925c) feeding of ISOC data to the software demux (format of the isochronous data
93and speed optimization, no real error)
94
95Testing changes
96---------------
97
98O = item is working
99P = item is partially working
100X = item is not working
101N = item does not apply here
102<empty field> = item need to be examined
103
104 | PCI | USB
105item | mt352 | nxt2002 | stv0299 | mt312 | mt352 | nxt2002 | stv0299 | mt312
106-------+-------+---------+---------+-------+-------+---------+---------+-------
1071a) | O | | | | N | N | N | N
1081b) | O | | | | | | O |
1091c) | N | N | | | N | N | O |
1101d) | O | O
1111e) | O | O
1121f) | P
1131g) | O
1141h) | P |
1151i) | O | N
1161j) | O | N
1171l) | O | N
1182) | O | N
1195a) | N | O
1205b)* | N |
1215c)* | N |
122
123* - not done yet
124
125Known bugs and problems and TODO
126--------------------------------
127
1281g/h/l) when pid filtering is enabled on the pci card
129
130DMA usage currently:
131 The DMA is splitted in 2 equal-sized subbuffers. The Flexcop writes to first
132 address and triggers an IRQ when it's full and starts writing to the second
133 address. When the second address is full, the IRQ is triggered again, and
134 the flexcop writes to first address again, and so on.
135 The buffersize of each address is currently 640*188 bytes.
136
137 Problem is, when using hw-pid-filtering and doing some low-bandwidth
138 operation (like scanning) the buffers won't be filled enough to trigger
139 the IRQ. That's why:
140
141 When PID filtering is activated, the timer IRQ is used. Every 1.97 ms the IRQ
142 is triggered. Is the current write address of DMA1 different to the one
143 during the last IRQ, then the data is passed to the demuxer.
144
145 There is an additional DMA-IRQ-method: packet count IRQ. This isn't
146 implemented correctly yet.
147
148 The solution is to disable HW PID filtering, but I don't know how the DVB
149 API software demux behaves on slow systems with 45MBit/s TS.
150
151Solved bugs :)
152--------------
1531g) pid-filtering (somehow pid index 4 and 5 (EMM_PID and ECM_PID) aren't
154working)
155SOLUTION: also index 0 was affected, because net_translation is done for
156these indexes by default
157
1585b) isochronous transfer does only work in the first attempt (for the Sky2PC USB,
159Air2PC is working)
160SOLUTION: the flexcop was going asleep and never really woke up again (don't
161know if this need fixes, see flexcop-fe-tuner.c:flexcop_sleep)
162
163Improvements when rewriting (refactoring) is done
164=================================================
165
166- split sleeping of the flexcop (misc_204.ACPI3_sig = 1;) from lnb_control
167 (enable sleeping for other demods than dvb-s)
168- add support for CableStar (stv0297 Microtune 203x/ALPS)
169
170Debugging
171---------
172- add verbose debugging to skystar2.c (dump the reg_dw_data) and compare it
173 with this flexcop, this is important, because i2c is now using the
174 flexcop_ibi_value union from flexcop-reg.h (do you have a better idea for
175 that, please tell us so).
176
177Everything which is identical in the following table, can be put into a common
178flexcop-module.
179
180 PCI USB
181-------------------------------------------------------------------------------
182Different:
183Register access: accessing IO memory USB control message
184I2C bus: I2C bus of the FC USB control message
185Data transfer: DMA isochronous transfer
186EEPROM transfer: through i2c bus not clear yet
187
188Identical:
189Streaming: accessing registers
190PID Filtering: accessing registers
191Sram destinations: accessing registers
192Tuner/Demod: I2C bus
193DVB-stuff: can be written for common use
194
195Restrictions:
196============
197
198We need to create a bus-specific-struct and a flexcop-struct.
199
200bus-specific-struct:
201
202struct flexcop_pci
203...
204
205struct flexcop_usb
206...
207
208
209struct flexcop_device {
210 void *bus_specific; /* container for bus-specific struct */
211...
212}
213
214PCI i2c can read/write max 4 bytes at a time, USB can more
215
216Functions
217=========
218
219Syntax
220------
221
222- Flexcop functions will be called "flexcop(_[a-z0-9]+)+" and exported as such
223 if needed.
224- Flexcop-device functions will be called "flexcop_device(_[a-z0-9]+)+" and
225 exported as such if needed.
226- Both will be compiled to b2c2-flexcop.ko and their source can be found in the
227 flexcop*.[hc]
228
229Callbacks and exports
230---------------------
231
232Bus-specific functions will be given as callbacks (function pointers) to the
233flexcop-module. (within the flexcop_device-struct)
234
235Initialization process
236======================
237
238b2c2-flexcop.ko is loaded
239b2c2-flexcop-<bus>.ko is loaded
240
241suppose a device is found:
242malloc flexcop and the bus-specific variables (via flexcop_device_malloc)
243fill the bus-specific variable
244fill the flexcop variable (especially the bus-specific callbacks)
245bus-specific initialization
246 - ...
247do the common initialization (via flexcop_device_initialize)
248 - reset the card
249 - determine flexcop type (II, IIB, III)
250 - hw_filters (bus dependent)
251 - 0x204
252 - set sram size
253 - create the dvb-stuff
254 - create i2c stuff
255 - frontend-initialization
256done
257bus specific:
258 - media_destination (this and the following 3 are bus specific)
259 - cai_dest
260 - cao_dest
261 - net_destination
262
263Bugs fixed while rewriting the driver
264=====================================
265
266- EEPROM access (to read the MAC address) was fixed to death some time last
267 year. (fixed here and in skystar2.c) (Bjarne, this was the piece of code
268 (fix-chipaddr) we were wondering about)
269
270
271Acknowledgements (just for the rewriting part)
272================
273
274Bjarne Steinsbo thought a lot in the first place of the pci part for this code
275sharing idea.
276
277Andreas Oberritter for providing a recent PCI initialization template (pluto2.c).
278
279comments, critics and ideas to linux-dvb@linuxtv.org or patrick.boettcher@desy.de