요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
.. SPDX-License-Identifier: GPL-2.0
.. include:: <isonum.txt>
The mgb4 driver
===============
Copyright |copy| 2023 - 2025 Digiteq Automotive
author: Martin Tůma <martin.tuma@digiteqautomotive.com>
This is a v4l2 device driver for the Digiteq Automotive FrameGrabber 4, a PCIe
card capable of capturing and generating FPD-Link III and GMSL2/3 video streams
as used in the automotive industry.
sysfs interface
---------------
The mgb4 driver provides a sysfs interface, that is used to configure video
stream related parameters (some of them must be set properly before the v4l2
device can be opened) and obtain the video device/stream status.
There are two types of parameters - global / PCI card related, found under
``/sys/class/video4linux/videoX/device`` and module specific found under
``/sys/class/video4linux/videoX``.
Global (PCI card) parameters
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
**module_type** (R):
Module type.
| 0 - No module present
| 1 - FPDL3
| 2 - GMSL (one serializer, two daisy chained deserializers)
| 3 - GMSL (one serializer, two deserializers)
| 4 - GMSL (two deserializers with two daisy chain outputs)
**module_version** (R):
Module version number. Zero in case of a missing module.
**fw_type** (R):
Firmware type.
| 1 - FPDL3
| 2 - GMSL
**fw_version** (R):
Firmware version number.
**serial_number** (R):
Card serial number. The format is::
PRODUCT-REVISION-SERIES-SERIAL
where each component is a 8b number.
Common FPDL3/GMSL input parameters
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
**input_id** (R):
Input number ID, zero based.
**oldi_lane_width** (RW):
Number of deserializer output lanes.
| 0 - single
| 1 - dual (default)
**color_mapping** (RW):
Mapping of the incoming bits in the signal to the colour bits of the pixels.
| 0 - OLDI/JEIDA
| 1 - SPWG/VESA (default)
**link_status** (R):
Video link status. If the link is locked, chips are properly connected and
communicating at the same speed and protocol. The link can be locked without
an active video stream.
A value of 0 is equivalent to the V4L2_IN_ST_NO_SYNC flag of the V4L2
VIDIOC_ENUMINPUT status bits.
| 0 - unlocked
| 1 - locked
**stream_status** (R):
Video stream status. A stream is detected if the link is locked, the input
pixel clock is running and the DE signal is moving.
A value of 0 is equivalent to the V4L2_IN_ST_NO_SIGNAL flag of the V4L2
VIDIOC_ENUMINPUT status bits.
| 0 - not detected
| 1 - detected
**video_width** (R):
Video stream width. This is the actual width as detected by the HW.
The value is identical to what VIDIOC_QUERY_DV_TIMINGS returns in the width
field of the v4l2_bt_timings struct.
**video_height** (R):
Video stream height. This is the actual height as detected by the HW.
The value is identical to what VIDIOC_QUERY_DV_TIMINGS returns in the height
field of the v4l2_bt_timings struct.
**vsync_status** (R):
The type of VSYNC pulses as detected by the video format detector.
The value is equivalent to the flags returned by VIDIOC_QUERY_DV_TIMINGS in
the polarities field of the v4l2_bt_timings struct.
| 0 - active low
| 1 - active high
| 2 - not available
**hsync_status** (R):
The type of HSYNC pulses as detected by the video format detector.
The value is equivalent to the flags returned by VIDIOC_QUERY_DV_TIMINGS in
the polarities field of the v4l2_bt_timings struct.
| 0 - active low
| 1 - active high
| 2 - not available
**vsync_gap_length** (RW):
If the incoming video signal does not contain synchronization VSYNC and
HSYNC pulses, these must be generated internally in the FPGA to achieve
the correct frame ordering. This value indicates, how many "empty" pixels
(pixels with deasserted Data Enable signal) are necessary to generate the
internal VSYNC pulse.
**hsync_gap_length** (RW):
If the incoming video signal does not contain synchronization VSYNC and
HSYNC pulses, these must be generated internally in the FPGA to achieve
the correct frame ordering. This value indicates, how many "empty" pixels
(pixels with deasserted Data Enable signal) are necessary to generate the
internal HSYNC pulse. The value must be greater than 1 and smaller than
vsync_gap_length.
**pclk_frequency** (R):
Input pixel clock frequency in kHz.
The value is identical to what VIDIOC_QUERY_DV_TIMINGS returns in
the pixelclock field of the v4l2_bt_timings struct.
*Note: The frequency_range parameter must be set properly first to get
a valid frequency here.*
**hsync_width** (R):
Width of the HSYNC signal in PCLK clock ticks.
The value is identical to what VIDIOC_QUERY_DV_TIMINGS returns in
the hsync field of the v4l2_bt_timings struct.
**vsync_width** (R):
Width of the VSYNC signal in PCLK clock ticks.
The value is identical to what VIDIOC_QUERY_DV_TIMINGS returns in
the vsync field of the v4l2_bt_timings struct.
**hback_porch** (R):
Number of PCLK pulses between deassertion of the HSYNC signal and the first
valid pixel in the video line (marked by DE=1).
The value is identical to what VIDIOC_QUERY_DV_TIMINGS returns in
the hbackporch field of the v4l2_bt_timings struct.
**hfront_porch** (R):
Number of PCLK pulses between the end of the last valid pixel in the video
line (marked by DE=1) and assertion of the HSYNC signal.
The value is identical to what VIDIOC_QUERY_DV_TIMINGS returns in
the hfrontporch field of the v4l2_bt_timings struct.
**vback_porch** (R):
Number of video lines between deassertion of the VSYNC signal and the video
line with the first valid pixel (marked by DE=1).
The value is identical to what VIDIOC_QUERY_DV_TIMINGS returns in
the vbackporch field of the v4l2_bt_timings struct.
**vfront_porch** (R):
Number of video lines between the end of the last valid pixel line (marked
by DE=1) and assertion of the VSYNC signal.
The value is identical to what VIDIOC_QUERY_DV_TIMINGS returns in
the vfrontporch field of the v4l2_bt_timings struct.
**frequency_range** (RW)
PLL frequency range of the OLDI input clock generator. The PLL frequency is
derived from the Pixel Clock Frequency (PCLK) and is equal to PCLK if
oldi_lane_width is set to "single" and PCLK/2 if oldi_lane_width is set to
"dual".
| 0 - PLL < 50MHz (default)
| 1 - PLL >= 50MHz
*Note: This parameter can not be changed while the input v4l2 device is
open.*
Common FPDL3/GMSL output parameters
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
**output_id** (R):
Output number ID, zero based.
**video_source** (RW):
Output video source. If set to 0 or 1, the source is the corresponding card
input and the v4l2 output devices are disabled. If set to 2 or 3, the source
is the corresponding v4l2 video output device. The default is
the corresponding v4l2 output, i.e. 2 for OUT1 and 3 for OUT2.
| 0 - input 0
| 1 - input 1
| 2 - v4l2 output 0
| 3 - v4l2 output 1
*Note: This parameter can not be changed while ANY of the input/output v4l2
devices is open.*
**display_width** (RW):
Display width. There is no autodetection of the connected display, so the
proper value must be set before the start of streaming. The default width
is 1280.
*Note: This parameter can not be changed while the output v4l2 device is
open.*
**display_height** (RW):
Display height. There is no autodetection of the connected display, so the
proper value must be set before the start of streaming. The default height
is 640.
*Note: This parameter can not be changed while the output v4l2 device is
open.*
**frame_rate** (RW):
Output video signal frame rate limit in frames per second. Due to
the limited output pixel clock steps, the card can not always generate
a frame rate perfectly matching the value required by the connected display.
Using this parameter one can limit the frame rate by "crippling" the signal
so that the lines are not equal (the porches of the last line differ) but
the signal appears like having the exact frame rate to the connected display.
The default frame rate limit is 60Hz.
**hsync_polarity** (RW):
HSYNC signal polarity.
| 0 - active low (default)
| 1 - active high
**vsync_polarity** (RW):
VSYNC signal polarity.
| 0 - active low (default)
| 1 - active high
**de_polarity** (RW):
DE signal polarity.
| 0 - active low
| 1 - active high (default)
**pclk_frequency** (RW):
Output pixel clock frequency. Allowed values are between 25000-190000(kHz)
and there is a non-linear stepping between two consecutive allowed
frequencies. The driver finds the nearest allowed frequency to the given
value and sets it. When reading this property, you get the exact
frequency set by the driver. The default frequency is 61150kHz.
*Note: This parameter can not be changed while the output v4l2 device is
open.*
**hsync_width** (RW):
Width of the HSYNC signal in pixels. The default value is 40.
**vsync_width** (RW):
Width of the VSYNC signal in video lines. The default value is 20.
**hback_porch** (RW):
Number of PCLK pulses between deassertion of the HSYNC signal and the first
valid pixel in the video line (marked by DE=1). The default value is 50.
**hfront_porch** (RW):
Number of PCLK pulses between the end of the last valid pixel in the video
line (marked by DE=1) and assertion of the HSYNC signal. The default value
is 50.
**vback_porch** (RW):
Number of video lines between deassertion of the VSYNC signal and the video
line with the first valid pixel (marked by DE=1). The default value is 31.
**vfront_porch** (RW):
Number of video lines between the end of the last valid pixel line (marked
by DE=1) and assertion of the VSYNC signal. The default value is 30.
FPDL3 specific input parameters
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
**fpdl3_input_width** (RW):
Number of deserializer input lines.
| 0 - auto (default)
| 1 - single
| 2 - dual
FPDL3 specific output parameters
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
**fpdl3_output_width** (RW):
Number of serializer output lines.
| 0 - auto (default)
| 1 - single
| 2 - dual
GMSL specific input parameters
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
**gmsl_mode** (RW):
GMSL speed mode.
| 0 - 12Gb/s (default)
| 1 - 6Gb/s
| 2 - 3Gb/s
| 3 - 1.5Gb/s
**gmsl_stream_id** (RW):
The GMSL multi-stream contains up to four video streams. This parameter
selects which stream is captured by the video input. The value is the
zero-based index of the stream. The default stream id is 0.
*Note: This parameter can not be changed while the input v4l2 device is
open.*
**gmsl_fec** (RW):
GMSL Forward Error Correction (FEC).
| 0 - disabled
| 1 - enabled (default)
MTD partitions
--------------
The mgb4 driver creates a MTD device with two partitions:
- mgb4-fw.X - FPGA firmware.
- mgb4-data.X - Factory settings, e.g. card serial number.
The *mgb4-fw* partition is writable and is used for FW updates, *mgb4-data* is
read-only. The *X* attached to the partition name represents the card number.
Depending on the CONFIG_MTD_PARTITIONED_MASTER kernel configuration, you may
also have a third partition named *mgb4-flash* available in the system. This
partition represents the whole, unpartitioned, card's FLASH memory and one should
not fiddle with it...
IIO (triggers)
--------------
The mgb4 driver creates an Industrial I/O (IIO) device that provides trigger and
signal level status capability. The following scan elements are available:
**activity**:
The trigger levels and pending status.
| bit 1 - trigger 1 pending
| bit 2 - trigger 2 pending
| bit 5 - trigger 1 level
| bit 6 - trigger 2 level
**timestamp**:
The trigger event timestamp.
The iio device can operate either in "raw" mode where you can fetch the signal
levels (activity bits 5 and 6) using sysfs access or in triggered buffer mode.
In the triggered buffer mode you can follow the signal level changes (activity
bits 1 and 2) using the iio device in /dev. If you enable the timestamps, you
will also get the exact trigger event time that can be matched to a video frame
(every mgb4 video frame has a timestamp with the same clock source).
*Note: although the activity sample always contains all the status bits, it makes
no sense to get the pending bits in raw mode or the level bits in the triggered
buffer mode - the values do not represent valid data in such case.*
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
mgb4 드라이버
1-14이 문서는 GPL-2.0 라이선스를 따르며 Copyright © 2023-2025 Digiteq Automotive입니다. 저자는 Martin Tůma <martin.tuma@digiteqautomotive.com>입니다.
`mgb4`는 Digiteq Automotive FrameGrabber 4용 V4L2 device driver입니다. 이 PCIe card는 자동차 산업에서 사용하는 FPD-Link III와 GMSL2/3 video stream을 capture하고 생성할 수 있습니다.
sysfs interface
15-25`mgb4` driver는 video stream 관련 parameter를 설정하고 video device 또는 stream 상태를 읽는 sysfs interface를 제공합니다. 일부 parameter는 V4L2 device를 열기 전에 반드시 올바르게 설정해야 합니다.
Parameter는 두 종류입니다. Global 또는 PCI card 관련 parameter는 `/sys/class/video4linux/videoX/device` 아래에 있고, module별 parameter는 `/sys/class/video4linux/videoX` 아래에 있습니다.
Global card 정보와 input/output module 설정은 서로 다른 sysfs level에 노출됩니다.
Global PCI card parameter
26-56| Parameter | 권한 | 설명 | 값 또는 형식 |
|---|---|---|---|
| module_type | R | Module type입니다. | 0: module 없음; 1: FPDL3; 2: GMSL, serializer 1개와 daisy-chain deserializer 2개; 3: GMSL, serializer 1개와 deserializer 2개; 4: GMSL, daisy-chain output 2개를 가진 deserializer 2개 |
| module_version | R | Module version 번호입니다. Module이 없으면 0입니다. | |
| fw_type | R | Firmware type입니다. | 1: FPDL3; 2: GMSL |
| fw_version | R | Firmware version 번호입니다. | |
| serial_number | R | Card serial number입니다. 각 component는 8-bit number입니다. | PRODUCT-REVISION-SERIES-SERIAL |
공통 FPDL3/GMSL input parameter
57-203Input parameter는 link와 stream 감지, 실제 video timing, synchronization gap 및 OLDI PLL range를 제어하거나 보고합니다. `R`은 read-only, `RW`는 read/write입니다.
| Parameter | 권한 | 설명 | 값·API 대응·제약 |
|---|---|---|---|
| input_id | R | 0부터 시작하는 input 번호 ID입니다. | |
| oldi_lane_width | RW | Deserializer output lane 수입니다. | 0: single; 1: dual, 기본값 |
| color_mapping | RW | 입력 signal bit를 pixel colour bit에 mapping하는 방식입니다. | 0: OLDI/JEIDA; 1: SPWG/VESA, 기본값 |
| link_status | R | Video link 상태입니다. Locked이면 chip이 올바르게 연결되어 같은 speed와 protocol로 통신합니다. Active video stream이 없어도 link는 lock될 수 있습니다. | 0: unlocked, V4L2 VIDIOC_ENUMINPUT의 V4L2_IN_ST_NO_SYNC와 동등; 1: locked |
| stream_status | R | Link가 locked이고 input pixel clock이 동작하며 DE signal이 움직이면 video stream을 감지한 것입니다. | 0: 미감지, V4L2 VIDIOC_ENUMINPUT의 V4L2_IN_ST_NO_SIGNAL과 동등; 1: 감지 |
| video_width | R | Hardware가 감지한 실제 video stream width입니다. | VIDIOC_QUERY_DV_TIMINGS가 v4l2_bt_timings.width에 반환하는 값과 동일 |
| video_height | R | Hardware가 감지한 실제 video stream height입니다. | VIDIOC_QUERY_DV_TIMINGS가 v4l2_bt_timings.height에 반환하는 값과 동일 |
| vsync_status | R | Video format detector가 감지한 VSYNC pulse type입니다. v4l2_bt_timings.polarities의 VIDIOC_QUERY_DV_TIMINGS flag와 동등합니다. | 0: active low; 1: active high; 2: 사용 불가 |
| hsync_status | R | Video format detector가 감지한 HSYNC pulse type입니다. v4l2_bt_timings.polarities의 VIDIOC_QUERY_DV_TIMINGS flag와 동등합니다. | 0: active low; 1: active high; 2: 사용 불가 |
| vsync_gap_length | RW | 입력 video에 VSYNC/HSYNC synchronization pulse가 없을 때 FPGA가 올바른 frame 순서를 위해 내부 VSYNC를 생성하는 데 필요한 empty pixel 수입니다. Empty pixel은 Data Enable이 deassert된 pixel입니다. | |
| hsync_gap_length | RW | 입력 video에 synchronization pulse가 없을 때 FPGA가 내부 HSYNC를 생성하는 데 필요한 empty pixel 수입니다. | 1보다 크고 vsync_gap_length보다 작아야 함 |
| pclk_frequency | R | Input pixel clock frequency를 kHz로 표시합니다. v4l2_bt_timings.pixelclock의 VIDIOC_QUERY_DV_TIMINGS 값과 동일합니다. | 유효한 값을 얻으려면 frequency_range를 먼저 올바르게 설정해야 함 |
| hsync_width | R | PCLK clock tick 단위의 HSYNC signal width입니다. | v4l2_bt_timings.hsync의 VIDIOC_QUERY_DV_TIMINGS 값과 동일 |
| vsync_width | R | PCLK clock tick 단위의 VSYNC signal width입니다. | v4l2_bt_timings.vsync의 VIDIOC_QUERY_DV_TIMINGS 값과 동일 |
| hback_porch | R | HSYNC deassertion부터 video line의 첫 valid pixel, 즉 DE=1까지의 PCLK pulse 수입니다. | v4l2_bt_timings.hbackporch와 동일 |
| hfront_porch | R | Video line의 마지막 valid pixel 종료부터 HSYNC assertion까지의 PCLK pulse 수입니다. | v4l2_bt_timings.hfrontporch와 동일 |
| vback_porch | R | VSYNC deassertion부터 첫 valid pixel이 있는 video line까지의 line 수입니다. | v4l2_bt_timings.vbackporch와 동일 |
| vfront_porch | R | 마지막 valid pixel line 종료부터 VSYNC assertion까지의 video line 수입니다. | v4l2_bt_timings.vfrontporch와 동일 |
| frequency_range | RW | OLDI input clock generator의 PLL frequency range입니다. PLL frequency는 PCLK에서 유도되며 oldi_lane_width가 single이면 PCLK, dual이면 PCLK/2입니다. | 0: PLL < 50MHz, 기본값; 1: PLL >= 50MHz. Input V4L2 device가 열린 동안 변경할 수 없음 |
공통 FPDL3/GMSL output parameter
204-299Output parameter는 source routing, display geometry, frame rate, signal polarity와 pixel timing을 설정합니다. 자동 display 감지가 없으므로 streaming 전에 geometry와 clock을 올바르게 지정해야 합니다.
| Parameter | 권한 | 설명 | 값·기본값·제약 |
|---|---|---|---|
| output_id | R | 0부터 시작하는 output 번호 ID입니다. | |
| video_source | RW | Output video source입니다. 0 또는 1이면 해당 card input을 사용하고 V4L2 output device를 비활성화합니다. 2 또는 3이면 해당 V4L2 video output device를 사용합니다. | 0: input 0; 1: input 1; 2: V4L2 output 0; 3: V4L2 output 1. 기본값은 OUT1=2, OUT2=3. 어떤 input/output V4L2 device라도 열려 있으면 변경 불가 |
| display_width | RW | 연결된 display를 자동 감지하지 않으므로 streaming 시작 전에 올바른 display width를 설정해야 합니다. | 기본값 1280. Output V4L2 device가 열린 동안 변경 불가 |
| display_height | RW | 연결된 display를 자동 감지하지 않으므로 streaming 시작 전에 올바른 display height를 설정해야 합니다. | 기본값 640. Output V4L2 device가 열린 동안 변경 불가 |
| frame_rate | RW | 초당 frame 수로 나타낸 output video signal frame-rate limit입니다. Output pixel clock step이 제한되어 display가 요구하는 frame rate를 정확히 만들 수 없는 경우, 마지막 line의 porch를 다르게 해 line을 불균등하게 만드는 방식으로 signal을 조정하여 display에는 정확한 frame rate처럼 보이게 제한합니다. | 기본 limit 60Hz |
| hsync_polarity | RW | HSYNC signal polarity입니다. | 0: active low, 기본값; 1: active high |
| vsync_polarity | RW | VSYNC signal polarity입니다. | 0: active low, 기본값; 1: active high |
| de_polarity | RW | DE signal polarity입니다. | 0: active low; 1: active high, 기본값 |
| pclk_frequency | RW | Output pixel clock frequency입니다. 허용 범위는 25000-190000kHz이고 연속 허용 주파수 사이의 step은 비선형입니다. Driver는 지정 값에 가장 가까운 허용 주파수를 설정하며, 읽을 때는 실제 설정된 정확한 주파수를 반환합니다. | 기본값 61150kHz. Output V4L2 device가 열린 동안 변경 불가 |
| hsync_width | RW | Pixel 단위 HSYNC signal width입니다. | 기본값 40 |
| vsync_width | RW | Video line 단위 VSYNC signal width입니다. | 기본값 20 |
| hback_porch | RW | HSYNC deassertion부터 첫 valid pixel, 즉 DE=1까지의 PCLK pulse 수입니다. | 기본값 50 |
| hfront_porch | RW | 마지막 valid pixel 종료부터 HSYNC assertion까지의 PCLK pulse 수입니다. | 기본값 50 |
| vback_porch | RW | VSYNC deassertion부터 첫 valid pixel이 있는 video line까지의 line 수입니다. | 기본값 31 |
| vfront_porch | RW | 마지막 valid pixel line 종료부터 VSYNC assertion까지의 video line 수입니다. | 기본값 30 |
FPDL3 전용 input parameter
300-309| Parameter | 권한 | 설명 | 값 |
|---|---|---|---|
| fpdl3_input_width | RW | Deserializer input line 수입니다. | 0: auto, 기본값; 1: single; 2: dual |
FPDL3 전용 output parameter
310-319| Parameter | 권한 | 설명 | 값 |
|---|---|---|---|
| fpdl3_output_width | RW | Serializer output line 수입니다. | 0: auto, 기본값; 1: single; 2: dual |
GMSL 전용 input parameter
320-344| Parameter | 권한 | 설명 | 값·제약 |
|---|---|---|---|
| gmsl_mode | RW | GMSL speed mode입니다. | 0: 12Gb/s, 기본값; 1: 6Gb/s; 2: 3Gb/s; 3: 1.5Gb/s |
| gmsl_stream_id | RW | 최대 4개 video stream을 담는 GMSL multi-stream에서 video input이 capture할 stream을 선택합니다. 값은 0부터 시작하는 stream index입니다. | 기본 stream ID 0. Input V4L2 device가 열린 동안 변경 불가 |
| gmsl_fec | RW | GMSL Forward Error Correction(FEC) 설정입니다. | 0: disabled; 1: enabled, 기본값 |
MTD partition
345-358`mgb4` driver는 기본적으로 두 MTD partition을 생성합니다. Partition 이름의 `X`는 card 번호입니다.
| Partition | 접근 | 용도 |
|---|---|---|
| mgb4-fw.X | RW | FPGA firmware이며 firmware update에 사용합니다. |
| mgb4-data.X | R | Card serial number 같은 factory setting을 저장합니다. |
| mgb4-flash | 위험 | CONFIG_MTD_PARTITIONED_MASTER에 따라 나타나는 전체 비분할 card FLASH memory입니다. 직접 수정하면 안 됩니다. |
`mgb4-flash`는 card 전체의 비분할 FLASH memory를 나타냅니다. `CONFIG_MTD_PARTITIONED_MASTER` 설정에 따라 보일 수 있지만 직접 조작하지 마십시오.
IIO trigger
359-385`mgb4` driver는 trigger와 signal level 상태를 제공하는 Industrial I/O(IIO) device를 생성합니다.
| Scan element | 의미 | Bit 또는 clock |
|---|---|---|
| activity | Trigger level과 pending 상태입니다. | bit 1: trigger 1 pending; bit 2: trigger 2 pending; bit 5: trigger 1 level; bit 6: trigger 2 level |
| timestamp | Trigger event timestamp입니다. | Video frame과 같은 clock source |
IIO device는 raw mode 또는 triggered buffer mode로 동작합니다. Raw mode에서는 sysfs를 통해 activity bit 5와 6의 signal level을 가져옵니다. Triggered buffer mode에서는 `/dev`의 IIO device를 사용해 activity bit 1과 2의 signal level 변화를 추적합니다.
Timestamp를 활성화하면 video frame과 정확히 대응시킬 수 있는 trigger event 시간을 얻습니다. 모든 `mgb4` video frame timestamp가 IIO event와 같은 clock source를 사용하기 때문입니다.
Activity sample에는 항상 모든 status bit가 있지만 raw mode의 pending bit와 triggered buffer mode의 level bit는 유효한 data를 나타내지 않으므로 읽을 의미가 없습니다.
Mode에 따라 activity field에서 의미 있는 bit가 다르며 timestamp는 video frame과 같은 clock domain을 사용합니다.
FrameGrabber 4 제어 구조
mgb4.rst:1-385`mgb4`는 두 video input과 output의 link·stream·timing·routing을 sysfs로 제어하고, FPGA firmware는 MTD로, external trigger는 IIO로 노출합니다. Device를 열기 전에 바꿔야 하는 parameter와 open 상태에서 변경할 수 없는 parameter를 구분해야 합니다.
V4L2 video stream, sysfs configuration, MTD firmware, IIO trigger가 하나의 PCIe card에서 역할별 interface로 분리됩니다.