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