dev-rds.rst 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
  2. .. c:namespace:: V4L
  3. .. _rds:
  4. *************
  5. RDS Interface
  6. *************
  7. The Radio Data System transmits supplementary information in binary
  8. format, for example the station name or travel information, on an
  9. inaudible audio subcarrier of a radio program. This interface is aimed
  10. at devices capable of receiving and/or transmitting RDS information.
  11. For more information see the core RDS standard :ref:`iec62106` and the
  12. RBDS standard :ref:`nrsc4`.
  13. .. note::
  14. Note that the RBDS standard as is used in the USA is almost
  15. identical to the RDS standard. Any RDS decoder/encoder can also handle
  16. RBDS. Only some of the fields have slightly different meanings. See the
  17. RBDS standard for more information.
  18. The RBDS standard also specifies support for MMBS (Modified Mobile
  19. Search). This is a proprietary format which seems to be discontinued.
  20. The RDS interface does not support this format. Should support for MMBS
  21. (or the so-called 'E blocks' in general) be needed, then please contact
  22. the linux-media mailing list:
  23. `https://linuxtv.org/lists.php <https://linuxtv.org/lists.php>`__.
  24. Querying Capabilities
  25. =====================
  26. Devices supporting the RDS capturing API set the
  27. ``V4L2_CAP_RDS_CAPTURE`` flag in the ``capabilities`` field of struct
  28. :c:type:`v4l2_capability` returned by the
  29. :ref:`VIDIOC_QUERYCAP` ioctl. Any tuner that
  30. supports RDS will set the ``V4L2_TUNER_CAP_RDS`` flag in the
  31. ``capability`` field of struct :c:type:`v4l2_tuner`. If the
  32. driver only passes RDS blocks without interpreting the data the
  33. ``V4L2_TUNER_CAP_RDS_BLOCK_IO`` flag has to be set, see
  34. :ref:`Reading RDS data <reading-rds-data>`. For future use the flag
  35. ``V4L2_TUNER_CAP_RDS_CONTROLS`` has also been defined. However, a driver
  36. for a radio tuner with this capability does not yet exist, so if you are
  37. planning to write such a driver you should discuss this on the
  38. linux-media mailing list:
  39. `https://linuxtv.org/lists.php <https://linuxtv.org/lists.php>`__.
  40. Whether an RDS signal is present can be detected by looking at the
  41. ``rxsubchans`` field of struct :c:type:`v4l2_tuner`: the
  42. ``V4L2_TUNER_SUB_RDS`` will be set if RDS data was detected.
  43. Devices supporting the RDS output API set the ``V4L2_CAP_RDS_OUTPUT``
  44. flag in the ``capabilities`` field of struct
  45. :c:type:`v4l2_capability` returned by the
  46. :ref:`VIDIOC_QUERYCAP` ioctl. Any modulator that
  47. supports RDS will set the ``V4L2_TUNER_CAP_RDS`` flag in the
  48. ``capability`` field of struct
  49. :c:type:`v4l2_modulator`. In order to enable the RDS
  50. transmission one must set the ``V4L2_TUNER_SUB_RDS`` bit in the
  51. ``txsubchans`` field of struct
  52. :c:type:`v4l2_modulator`. If the driver only passes RDS
  53. blocks without interpreting the data the ``V4L2_TUNER_CAP_RDS_BLOCK_IO``
  54. flag has to be set. If the tuner is capable of handling RDS entities
  55. like program identification codes and radio text, the flag
  56. ``V4L2_TUNER_CAP_RDS_CONTROLS`` should be set, see
  57. :ref:`Writing RDS data <writing-rds-data>` and
  58. :ref:`FM Transmitter Control Reference <fm-tx-controls>`.
  59. .. _reading-rds-data:
  60. Reading RDS data
  61. ================
  62. RDS data can be read from the radio device with the
  63. :c:func:`read()` function. The data is packed in groups of
  64. three bytes.
  65. .. _writing-rds-data:
  66. Writing RDS data
  67. ================
  68. RDS data can be written to the radio device with the
  69. :c:func:`write()` function. The data is packed in groups of
  70. three bytes, as follows:
  71. RDS datastructures
  72. ==================
  73. .. c:type:: v4l2_rds_data
  74. .. flat-table:: struct v4l2_rds_data
  75. :header-rows: 0
  76. :stub-columns: 0
  77. :widths: 1 1 5
  78. * - __u8
  79. - ``lsb``
  80. - Least Significant Byte of RDS Block
  81. * - __u8
  82. - ``msb``
  83. - Most Significant Byte of RDS Block
  84. * - __u8
  85. - ``block``
  86. - Block description
  87. .. _v4l2-rds-block:
  88. .. tabularcolumns:: |p{2.9cm}|p{14.6cm}|
  89. .. flat-table:: Block description
  90. :header-rows: 0
  91. :stub-columns: 0
  92. :widths: 1 5
  93. * - Bits 0-2
  94. - Block (aka offset) of the received data.
  95. * - Bits 3-5
  96. - Deprecated. Currently identical to bits 0-2. Do not use these
  97. bits.
  98. * - Bit 6
  99. - Corrected bit. Indicates that an error was corrected for this data
  100. block.
  101. * - Bit 7
  102. - Error bit. Indicates that an uncorrectable error occurred during
  103. reception of this block.
  104. .. _v4l2-rds-block-codes:
  105. .. tabularcolumns:: |p{6.4cm}|p{2.0cm}|p{1.2cm}|p{7.0cm}|
  106. .. flat-table:: Block defines
  107. :header-rows: 0
  108. :stub-columns: 0
  109. :widths: 1 1 1 5
  110. * - V4L2_RDS_BLOCK_MSK
  111. -
  112. - 7
  113. - Mask for bits 0-2 to get the block ID.
  114. * - V4L2_RDS_BLOCK_A
  115. -
  116. - 0
  117. - Block A.
  118. * - V4L2_RDS_BLOCK_B
  119. -
  120. - 1
  121. - Block B.
  122. * - V4L2_RDS_BLOCK_C
  123. -
  124. - 2
  125. - Block C.
  126. * - V4L2_RDS_BLOCK_D
  127. -
  128. - 3
  129. - Block D.
  130. * - V4L2_RDS_BLOCK_C_ALT
  131. -
  132. - 4
  133. - Block C'.
  134. * - V4L2_RDS_BLOCK_INVALID
  135. - read-only
  136. - 7
  137. - An invalid block.
  138. * - V4L2_RDS_BLOCK_CORRECTED
  139. - read-only
  140. - 0x40
  141. - A bit error was detected but corrected.
  142. * - V4L2_RDS_BLOCK_ERROR
  143. - read-only
  144. - 0x80
  145. - An uncorrectable error occurred.