dtv-common.rst 1.7 KB

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