summaryrefslogtreecommitdiffstats
path: root/Documentation/media/kapi/dtv-common.rst
blob: 40cf1033b5e1f934af49c2bb37cf67d40d09bcd9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
Digital TV Common functions
---------------------------

Math functions
~~~~~~~~~~~~~~

Provide some commonly-used math functions, usually required in order to
estimate signal strength and signal to noise measurements in dB.

.. kernel-doc:: drivers/media/dvb-core/dvb_math.h


DVB devices
~~~~~~~~~~~

Those functions are responsible for handling the DVB device nodes.

.. kernel-doc:: drivers/media/dvb-core/dvbdev.h

Digital TV Ring buffer
~~~~~~~~~~~~~~~~~~~~~~

Those routines implement ring buffers used to handle digital TV data and
copy it from/to userspace.

.. note::

  1) For performance reasons read and write routines don't check buffer sizes
     and/or number of bytes free/available. This has to be done before these
     routines are called. For example:

   .. code-block:: c

        /* write @buflen: bytes */
        free = dvb_ringbuffer_free(rbuf);
        if (free >= buflen)
                count = dvb_ringbuffer_write(rbuf, buffer, buflen);
        else
                /* do something */

        /* read min. 1000, max. @bufsize: bytes */
        avail = dvb_ringbuffer_avail(rbuf);
        if (avail >= 1000)
                count = dvb_ringbuffer_read(rbuf, buffer, min(avail, bufsize));
        else
                /* do something */

  2) If there is exactly one reader and one writer, there is no need
     to lock read or write operations.
     Two or more readers must be locked against each other.
     Flushing the buffer counts as a read operation.
     Resetting the buffer counts as a read and write operation.
     Two or more writers must be locked against each other.

.. kernel-doc:: drivers/media/dvb-core/dvb_ringbuffer.h
OpenPOWER on IntegriCloud