Commit | Line | Data |
---|---|---|
5b3b8c81 MCC |
1 | Digital TV Demux kABI |
2 | --------------------- | |
3 | ||
4 | Digital TV Demux | |
5 | ~~~~~~~~~~~~~~~~ | |
6 | ||
7 | The Kernel Digital TV Demux kABI defines a driver-internal interface for | |
8 | registering low-level, hardware specific driver to a hardware independent | |
9 | demux layer. It is only of interest for Digital TV device driver writers. | |
1607b8b5 | 10 | The header file for this kABI is named ``demux.h`` and located in |
fada1935 | 11 | ``include/media``. |
5b3b8c81 MCC |
12 | |
13 | The demux kABI should be implemented for each demux in the system. It is | |
14 | used to select the TS source of a demux and to manage the demux resources. | |
15 | When the demux client allocates a resource via the demux kABI, it receives | |
16 | a pointer to the kABI of that resource. | |
17 | ||
18 | Each demux receives its TS input from a DVB front-end or from memory, as | |
19 | set via this demux kABI. In a system with more than one front-end, the kABI | |
20 | can be used to select one of the DVB front-ends as a TS source for a demux, | |
21 | unless this is fixed in the HW platform. | |
22 | ||
23 | The demux kABI only controls front-ends regarding to their connections with | |
24 | demuxes; the kABI used to set the other front-end parameters, such as | |
25 | tuning, are devined via the Digital TV Frontend kABI. | |
26 | ||
27 | The functions that implement the abstract interface demux should be defined | |
28 | static or module private and registered to the Demux core for external | |
29 | access. It is not necessary to implement every function in the struct | |
1607b8b5 | 30 | :c:type:`dmx_demux`. For example, a demux interface might support Section filtering, |
5b3b8c81 MCC |
31 | but not PES filtering. The kABI client is expected to check the value of any |
32 | function pointer before calling the function: the value of ``NULL`` means | |
33 | that the function is not available. | |
34 | ||
35 | Whenever the functions of the demux API modify shared data, the | |
36 | possibilities of lost update and race condition problems should be | |
37 | addressed, e.g. by protecting parts of code with mutexes. | |
38 | ||
39 | Note that functions called from a bottom half context must not sleep. | |
40 | Even a simple memory allocation without using ``GFP_ATOMIC`` can result in a | |
41 | kernel thread being put to sleep if swapping is needed. For example, the | |
42 | Linux Kernel calls the functions of a network device interface from a | |
43 | bottom half context. Thus, if a demux kABI function is called from network | |
44 | device code, the function must not sleep. | |
45 | ||
5b3b8c81 MCC |
46 | Demux Callback API |
47 | ~~~~~~~~~~~~~~~~~~ | |
48 | ||
49 | This kernel-space API comprises the callback functions that deliver filtered | |
50 | data to the demux client. Unlike the other DVB kABIs, these functions are | |
51 | provided by the client and called from the demux code. | |
52 | ||
53 | The function pointers of this abstract interface are not packed into a | |
54 | structure as in the other demux APIs, because the callback functions are | |
55 | registered and used independent of each other. As an example, it is possible | |
56 | for the API client to provide several callback functions for receiving TS | |
57 | packets and no callbacks for PES packets or sections. | |
58 | ||
59 | The functions that implement the callback API need not be re-entrant: when | |
60 | a demux driver calls one of these functions, the driver is not allowed to | |
61 | call the function again before the original call returns. If a callback is | |
62 | triggered by a hardware interrupt, it is recommended to use the Linux | |
63 | bottom half mechanism or start a tasklet instead of making the callback | |
64 | function call directly from a hardware interrupt. | |
65 | ||
66 | This mechanism is implemented by :c:func:`dmx_ts_cb()` and :c:func:`dmx_section_cb()` | |
67 | callbacks. | |
68 | ||
8c6b1863 MCC |
69 | Digital TV Demux device registration functions and data structures |
70 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
71 | ||
fada1935 | 72 | .. kernel-doc:: include/media/dmxdev.h |
8c6b1863 MCC |
73 | |
74 | High-level Digital TV demux interface | |
75 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
76 | ||
fada1935 | 77 | .. kernel-doc:: include/media/dvb_demux.h |
8c6b1863 MCC |
78 | |
79 | Driver-internal low-level hardware specific driver demux interface | |
80 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
1607b8b5 | 81 | |
fada1935 | 82 | .. kernel-doc:: include/media/demux.h |