← Documents Documentation/userspace-api/media/v4l/dev-sdr.rst GitHub 원문 ↗

Linux 6.18.37 · Userspace API / Media / V4L

Software Defined Radio 인터페이스

SDR receiver/transmitter capability, ADC/DAC 및 RF tuner 순서, FourCC data format과 I/O를 설명합니다.

Source pathDocumentation/userspace-api/media/v4l/dev-sdr.rst
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.

1. 요약·해설

원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.

요약·해설

dev-sdr.rst:1-107

SDR은 ADC/DAC sample stream을 애플리케이션에서 변복조합니다. Sampling frequency용 SDR tuner를 RF tuner보다 먼저 두고, 열거한 FourCC와 드라이버가 반환한 최대 buffer 크기로 data path를 구성합니다.

2. 영어 원문 전체

번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.

원문 전체 펼치기
1 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
2
3 .. _sdr:
4
5 **************************************
6 Software Defined Radio Interface (SDR)
7 **************************************
8
9 SDR is an abbreviation of Software Defined Radio, the radio device which
10 uses application software for modulation or demodulation. This interface
11 is intended for controlling and data streaming of such devices.
12
13 SDR devices are accessed through character device special files named
14 ``/dev/swradio0`` to ``/dev/swradio255`` with major number 81 and
15 dynamically allocated minor numbers 0 to 255.
16
17
18 Querying Capabilities
19 =====================
20
21 Devices supporting the SDR receiver interface set the
22 ``V4L2_CAP_SDR_CAPTURE`` and ``V4L2_CAP_TUNER`` flag in the
23 ``capabilities`` field of struct
24 :c:type:`v4l2_capability` returned by the
25 :ref:`VIDIOC_QUERYCAP` ioctl. That flag means the
26 device has an Analog to Digital Converter (ADC), which is a mandatory
27 element for the SDR receiver.
28
29 Devices supporting the SDR transmitter interface set the
30 ``V4L2_CAP_SDR_OUTPUT`` and ``V4L2_CAP_MODULATOR`` flag in the
31 ``capabilities`` field of struct
32 :c:type:`v4l2_capability` returned by the
33 :ref:`VIDIOC_QUERYCAP` ioctl. That flag means the
34 device has an Digital to Analog Converter (DAC), which is a mandatory
35 element for the SDR transmitter.
36
37 At least one of the read/write or streaming I/O methods
38 must be supported.
39
40
41 Supplemental Functions
42 ======================
43
44 SDR devices can support :ref:`controls <control>`, and must support
45 the :ref:`tuner` ioctls. Tuner ioctls are used for setting the
46 ADC/DAC sampling rate (sampling frequency) and the possible radio
47 frequency (RF).
48
49 The ``V4L2_TUNER_SDR`` tuner type is used for setting SDR device ADC/DAC
50 frequency, and the ``V4L2_TUNER_RF`` tuner type is used for setting
51 radio frequency. The tuner index of the RF tuner (if any) must always
52 follow the SDR tuner index. Normally the SDR tuner is #0 and the RF
53 tuner is #1.
54
55 The :ref:`VIDIOC_S_HW_FREQ_SEEK` ioctl is
56 not supported.
57
58
59 Data Format Negotiation
60 =======================
61
62 The SDR device uses the :ref:`format` ioctls to select the
63 capture and output format. Both the sampling resolution and the data
64 streaming format are bound to that selectable format. In addition to the
65 basic :ref:`format` ioctls, the
66 :ref:`VIDIOC_ENUM_FMT` ioctl must be supported as
67 well.
68
69 To use the :ref:`format` ioctls applications set the ``type``
70 field of a struct :c:type:`v4l2_format` to
71 ``V4L2_BUF_TYPE_SDR_CAPTURE`` or ``V4L2_BUF_TYPE_SDR_OUTPUT`` and use
72 the struct :c:type:`v4l2_sdr_format` ``sdr`` member
73 of the ``fmt`` union as needed per the desired operation. Currently
74 there are two fields, ``pixelformat`` and ``buffersize``, of
75 struct :c:type:`v4l2_sdr_format` which are used.
76 Content of the ``pixelformat`` is V4L2 FourCC code of the data format.
77 The ``buffersize`` field is maximum buffer size in bytes required for
78 data transfer, set by the driver in order to inform application.
79
80
81 .. c:type:: v4l2_sdr_format
82
83 .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.5cm}|
84
85 .. flat-table:: struct v4l2_sdr_format
86 :header-rows: 0
87 :stub-columns: 0
88 :widths: 1 1 2
89
90 * - __u32
91 - ``pixelformat``
92 - The data format or type of compression, set by the application.
93 This is a little endian
94 :ref:`four character code <v4l2-fourcc>`. V4L2 defines SDR
95 formats in :ref:`sdr-formats`.
96 * - __u32
97 - ``buffersize``
98 - Maximum size in bytes required for data. Value is set by the
99 driver.
100 * - __u8
101 - ``reserved[24]``
102 - This array is reserved for future extensions. Drivers and
103 applications must set it to zero.
104
105
106 An SDR device may support :ref:`read/write <rw>` and/or streaming
107 (:ref:`memory mapping <mmap>` or :ref:`user pointer <userp>`) I/O.
108

3. 한국어 전문 번역

영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.

SDR 장치, ADC/DAC와 capability

1-40

SDR은 Software Defined Radio의 약자로 modulation과 demodulation을 application software에서 수행하는 radio 장치입니다. 이 인터페이스는 그런 장치의 control과 data streaming을 담당합니다.

SDR 장치는 major 81과 동적으로 할당되는 minor 0부터 255를 사용하며 `/dev/swradio0`부터 `/dev/swradio255` character device로 접근합니다.

SDR receiver는 `V4L2_CAP_SDR_CAPTURE`와 `V4L2_CAP_TUNER`를 `VIDIOC_QUERYCAP` 결과에 설정합니다. 이는 receiver의 필수 구성요소인 ADC(Analog to Digital Converter)가 있음을 뜻합니다.

SDR transmitter는 `V4L2_CAP_SDR_OUTPUT`과 `V4L2_CAP_MODULATOR`를 설정하며 필수 구성요소인 DAC(Digital to Analog Converter)가 있음을 뜻합니다. Capture/output 모두 read/write 또는 streaming I/O 중 적어도 하나를 지원해야 합니다.

SDR 역할별 capability
항목설명
ReceiverV4L2_CAP_SDR_CAPTURE + V4L2_CAP_TUNER
Receiver converterADC, analog signal을 digital sample로 변환
TransmitterV4L2_CAP_SDR_OUTPUT + V4L2_CAP_MODULATOR
Transmitter converterDAC, digital sample을 analog signal로 변환
I/ORead/write 또는 streaming 중 적어도 하나

Converter 방향과 필수 flag를 연결합니다.

SDR signal 방향
Receiver RF/analog inputADC에서 digital sample 생성SDR capture stream을 application으로 전달Application이 modulation/demodulation 수행Output stream을 DAC로 전달Transmitter RF/analog output 생성

Software와 RF 경로 사이의 converter 방향입니다.

.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later

.. _sdr:

**************************************
Software Defined Radio Interface (SDR)
**************************************

SDR is an abbreviation of Software Defined Radio, the radio device which
uses application software for modulation or demodulation. This interface
is intended for controlling and data streaming of such devices.

SDR devices are accessed through character device special files named
``/dev/swradio0`` to ``/dev/swradio255`` with major number 81 and
dynamically allocated minor numbers 0 to 255.


Querying Capabilities
=====================

Devices supporting the SDR receiver interface set the
``V4L2_CAP_SDR_CAPTURE`` and ``V4L2_CAP_TUNER`` flag in the
``capabilities`` field of struct
:c:type:`v4l2_capability` returned by the
:ref:`VIDIOC_QUERYCAP` ioctl. That flag means the
device has an Analog to Digital Converter (ADC), which is a mandatory
element for the SDR receiver.

Devices supporting the SDR transmitter interface set the
``V4L2_CAP_SDR_OUTPUT`` and ``V4L2_CAP_MODULATOR`` flag in the
``capabilities`` field of struct
:c:type:`v4l2_capability` returned by the
:ref:`VIDIOC_QUERYCAP` ioctl. That flag means the
device has an Digital to Analog Converter (DAC), which is a mandatory
element for the SDR transmitter.

At least one of the read/write or streaming I/O methods
must be supported.

Sampling frequency와 RF tuner 순서

41-58

SDR 장치는 control을 지원할 수 있고 tuner ioctl은 반드시 지원해야 합니다. Tuner ioctl은 ADC/DAC sampling rate, 즉 sampling frequency와 가능한 radio frequency(RF)를 설정하는 데 사용합니다.

`V4L2_TUNER_SDR` type은 ADC/DAC frequency를 설정하고 `V4L2_TUNER_RF` type은 radio frequency를 설정합니다. RF tuner가 있다면 index는 항상 SDR tuner 뒤에 와야 합니다. 보통 SDR tuner는 index 0, RF tuner는 index 1입니다.

SDR 장치는 `VIDIOC_S_HW_FREQ_SEEK` ioctl을 지원하지 않습니다. 애플리케이션은 hardware seek가 아니라 tuner range와 원하는 frequency를 직접 관리해야 합니다.

SDR tuner index
항목설명
Index 0보통 V4L2_TUNER_SDR, ADC/DAC sampling frequency
Index 1선택적 V4L2_TUNER_RF, radio frequency
순서 규칙RF tuner는 반드시 대응 SDR tuner 뒤에 위치
Hardware seekVIDIOC_S_HW_FREQ_SEEK 미지원

Sampling clock과 RF 주파수 객체의 순서를 고정합니다.

SDR 주파수 설정
V4L2_TUNER_SDR 객체 열거ADC/DAC sampling frequency 설정다음 index의 V4L2_TUNER_RF 존재 여부 확인지원 범위 안에서 radio frequency 설정Hardware seek 없이 software가 주파수 선택

Sampling frequency를 정한 뒤 RF tuner를 구성합니다.

Supplemental Functions
======================

SDR devices can support :ref:`controls <control>`, and must support
the :ref:`tuner` ioctls. Tuner ioctls are used for setting the
ADC/DAC sampling rate (sampling frequency) and the possible radio
frequency (RF).

The ``V4L2_TUNER_SDR`` tuner type is used for setting SDR device ADC/DAC
frequency, and the ``V4L2_TUNER_RF`` tuner type is used for setting
radio frequency. The tuner index of the RF tuner (if any) must always
follow the SDR tuner index. Normally the SDR tuner is #0 and the RF
tuner is #1.

The :ref:`VIDIOC_S_HW_FREQ_SEEK` ioctl is
not supported.

SDR data format 협상

59-80

SDR 장치는 format ioctl로 capture와 output format을 선택합니다. Sampling resolution과 data streaming format이 선택한 format에 함께 묶이며, 기본 format ioctl 외에 `VIDIOC_ENUM_FMT`도 반드시 지원해야 합니다.

애플리케이션은 `struct v4l2_format.type`을 `V4L2_BUF_TYPE_SDR_CAPTURE` 또는 `V4L2_BUF_TYPE_SDR_OUTPUT`으로 설정하고 `fmt` union의 `struct v4l2_sdr_format sdr` 멤버를 사용합니다.

현재 `v4l2_sdr_format`에서 사용되는 필드는 `pixelformat`과 `buffersize`입니다. `pixelformat`은 data format의 V4L2 FourCC이고, `buffersize`는 data transfer에 필요한 최대 byte 수를 드라이버가 애플리케이션에 알리는 값입니다.

SDR format 선택
VIDIOC_ENUM_FMT로 SDR format 열거SDR_CAPTURE 또는 SDR_OUTPUT type 지정원하는 pixelformat 선택Format ioctl로 실제 format 협상Driver가 반환한 buffersize 확인최대 크기를 수용하는 I/O buffer 준비

지원 형식을 열거하고 buffer type별 실제 값을 협상합니다.

SDR format 핵심
항목설명
V4L2_BUF_TYPE_SDR_CAPTUREReceiver sample input buffer type
V4L2_BUF_TYPE_SDR_OUTPUTTransmitter sample output buffer type
pixelformatSampling resolution과 streaming layout을 나타내는 FourCC
buffersizeDriver가 정하는 최대 data buffer byte 수

Resolution과 stream representation이 FourCC에 결합됩니다.

Data Format Negotiation
=======================

The SDR device uses the :ref:`format` ioctls to select the
capture and output format. Both the sampling resolution and the data
streaming format are bound to that selectable format. In addition to the
basic :ref:`format` ioctls, the
:ref:`VIDIOC_ENUM_FMT` ioctl must be supported as
well.

To use the :ref:`format` ioctls applications set the ``type``
field of a struct :c:type:`v4l2_format` to
``V4L2_BUF_TYPE_SDR_CAPTURE`` or ``V4L2_BUF_TYPE_SDR_OUTPUT`` and use
the struct :c:type:`v4l2_sdr_format` ``sdr`` member
of the ``fmt`` union as needed per the desired operation. Currently
there are two fields, ``pixelformat`` and ``buffersize``, of
struct :c:type:`v4l2_sdr_format` which are used.
Content of the ``pixelformat`` is V4L2 FourCC code of the data format.
The ``buffersize`` field is maximum buffer size in bytes required for
data transfer, set by the driver in order to inform application.

v4l2_sdr_format과 I/O 방식

81-107

`struct v4l2_sdr_format.pixelformat`은 애플리케이션이 설정하는 data format 또는 compression type이며 little-endian four character code입니다. V4L2가 정의한 SDR format 목록에서 선택합니다.

`buffersize`는 data에 필요한 최대 byte 수이고 드라이버가 설정합니다. `reserved[24]`는 향후 확장을 위한 배열이므로 드라이버와 애플리케이션 모두 0으로 유지해야 합니다.

SDR 장치는 read/write와 streaming I/O를 하나 이상 지원할 수 있습니다. Streaming 방식에는 memory mapping과 user pointer가 포함됩니다.

struct v4l2_sdr_format
항목설명
pixelformatApplication이 설정하는 little-endian FourCC
buffersizeDriver가 설정하는 최대 data byte 수
reserved[24]양쪽 모두 0으로 설정

현재 사용 필드와 예약 공간입니다.

SDR I/O 방식
항목설명
read/write일반 file I/O로 sample 전송
Memory mappingMapped streaming buffer 사용
User pointerApplication buffer 주소를 streaming queue에 전달

장치가 하나 이상의 data path를 제공합니다.

.. c:type:: v4l2_sdr_format

.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.5cm}|

.. flat-table:: struct v4l2_sdr_format
    :header-rows:  0
    :stub-columns: 0
    :widths:       1 1 2

    * - __u32
      - ``pixelformat``
      - The data format or type of compression, set by the application.
	This is a little endian
	:ref:`four character code <v4l2-fourcc>`. V4L2 defines SDR
	formats in :ref:`sdr-formats`.
    * - __u32
      - ``buffersize``
      - Maximum size in bytes required for data. Value is set by the
	driver.
    * - __u8
      - ``reserved[24]``
      - This array is reserved for future extensions. Drivers and
	applications must set it to zero.


An SDR device may support :ref:`read/write <rw>` and/or streaming
(:ref:`memory mapping <mmap>` or :ref:`user pointer <userp>`) I/O.