media: dvb kAPI docs: document dvb_vb2.h
[linux-block.git] / Documentation / media / kapi / dtv-common.rst
CommitLineData
5b3b8c81
MCC
1Digital TV Common functions
2---------------------------
3
4Math functions
5~~~~~~~~~~~~~~
6
7Provide some commonly-used math functions, usually required in order to
8estimate signal strength and signal to noise measurements in dB.
9
fada1935 10.. kernel-doc:: include/media/dvb_math.h
5b3b8c81
MCC
11
12
13DVB devices
14~~~~~~~~~~~
15
16Those functions are responsible for handling the DVB device nodes.
17
fada1935 18.. kernel-doc:: include/media/dvbdev.h
5b3b8c81
MCC
19
20Digital TV Ring buffer
21~~~~~~~~~~~~~~~~~~~~~~
22
23Those routines implement ring buffers used to handle digital TV data and
24copy it from/to userspace.
25
26.. note::
27
28 1) For performance reasons read and write routines don't check buffer sizes
29 and/or number of bytes free/available. This has to be done before these
30 routines are called. For example:
31
32 .. code-block:: c
33
34 /* write @buflen: bytes */
35 free = dvb_ringbuffer_free(rbuf);
36 if (free >= buflen)
37 count = dvb_ringbuffer_write(rbuf, buffer, buflen);
38 else
39 /* do something */
40
41 /* read min. 1000, max. @bufsize: bytes */
42 avail = dvb_ringbuffer_avail(rbuf);
43 if (avail >= 1000)
44 count = dvb_ringbuffer_read(rbuf, buffer, min(avail, bufsize));
45 else
46 /* do something */
47
48 2) If there is exactly one reader and one writer, there is no need
49 to lock read or write operations.
50 Two or more readers must be locked against each other.
51 Flushing the buffer counts as a read operation.
52 Resetting the buffer counts as a read and write operation.
53 Two or more writers must be locked against each other.
54
fada1935 55.. kernel-doc:: include/media/dvb_ringbuffer.h
9f577d6d
MCC
56
57Digital TV VB2 handler
58~~~~~~~~~~~~~~~~~~~~~~
59
60.. kernel-doc:: include/media/dvb_vb2.h