2.20. V4L2 媒体总线函数和数据结构

enum v4l2_mbus_csi2_cphy_line_orders_type

CSI-2 C-PHY 线序

常量

V4L2_MBUS_CSI2_CPHY_LINE_ORDER_ABC

C-PHY 线序 ABC(默认)

V4L2_MBUS_CSI2_CPHY_LINE_ORDER_ACB

C-PHY 线序 ACB

V4L2_MBUS_CSI2_CPHY_LINE_ORDER_BAC

C-PHY 线序 BAC

V4L2_MBUS_CSI2_CPHY_LINE_ORDER_BCA

C-PHY 线序 BCA

V4L2_MBUS_CSI2_CPHY_LINE_ORDER_CAB

C-PHY 线序 CAB

V4L2_MBUS_CSI2_CPHY_LINE_ORDER_CBA

C-PHY 线序 CBA

struct v4l2_mbus_config_mipi_csi2

MIPI CSI-2 数据总线配置

定义:

struct v4l2_mbus_config_mipi_csi2 {
    unsigned int flags;
    unsigned char data_lanes[V4L2_MBUS_CSI2_MAX_DATA_LANES];
    unsigned char clock_lane;
    unsigned char num_data_lanes;
    bool lane_polarities[1 + V4L2_MBUS_CSI2_MAX_DATA_LANES];
    enum v4l2_mbus_csi2_cphy_line_orders_type line_orders[V4L2_MBUS_CSI2_MAX_DATA_LANES];
};

成员

flags

媒体总线 (V4L2_MBUS_*) 标志

data_lanes

物理数据通道索引数组

clock_lane

时钟通道的物理通道索引

num_data_lanes

数据通道数

lane_polarities

通道的极性。顺序与物理通道相同。

line_orders

数据通道的线序。顺序与物理通道相同。

struct v4l2_mbus_config_parallel

并行数据总线配置

定义:

struct v4l2_mbus_config_parallel {
    unsigned int flags;
    unsigned char bus_width;
    unsigned char data_shift;
};

成员

flags

媒体总线 (V4L2_MBUS_*) 标志

bus_width

总线宽度(以位为单位)

data_shift

数据移位(以位为单位)

struct v4l2_mbus_config_mipi_csi1

CSI-1/CCP2 数据总线配置

定义:

struct v4l2_mbus_config_mipi_csi1 {
    unsigned char clock_inv:1;
    unsigned char strobe:1;
    bool lane_polarity[2];
    unsigned char data_lane;
    unsigned char clock_lane;
};

成员

clock_inv

时钟/选通信号的极性 false - 未反转,true - 反转

strobe

false - 数据/时钟,true - 数据/选通

lane_polarity

时钟(索引 0)和数据通道索引 (1) 的极性

data_lane

数据通道号

clock_lane

时钟通道号

enum v4l2_mbus_type

媒体总线类型

常量

V4L2_MBUS_UNKNOWN

未知总线类型,无 V4L2 媒体总线配置

V4L2_MBUS_PARALLEL

带 hsync 和 vsync 的并行接口

V4L2_MBUS_BT656

带嵌入式同步的并行接口,也可用于 BT.1120

V4L2_MBUS_CSI1

MIPI CSI-1 串行接口

V4L2_MBUS_CCP2

CCP2(紧凑型相机端口 2)

V4L2_MBUS_CSI2_DPHY

MIPI CSI-2 串行接口,带 D-PHY

V4L2_MBUS_CSI2_CPHY

MIPI CSI-2 串行接口,带 C-PHY

V4L2_MBUS_DPI

MIPI VIDEO DPI 接口

V4L2_MBUS_INVALID

无效总线类型(保持在最后)

struct v4l2_mbus_config

媒体总线配置

定义:

struct v4l2_mbus_config {
    enum v4l2_mbus_type type;
    u64 link_freq;
    union {
        struct v4l2_mbus_config_parallel parallel;
        struct v4l2_mbus_config_mipi_csi1 mipi_csi1;
        struct v4l2_mbus_config_mipi_csi2 mipi_csi2;
    } bus;
};

成员

type

接口类型

link_freq

链接频率。另请参见 V4L2_CID_LINK_FREQ 控件。

bus

总线配置数据结构

bus.parallel

嵌入式 struct v4l2_mbus_config_parallel。如果总线是并行或 BT.656,则使用此项。

bus.mipi_csi1

嵌入式 struct v4l2_mbus_config_mipi_csi1。如果总线是 MIPI 联盟的相机串行接口版本 1 (MIPI CSI1) 或标准移动成像架构的紧凑型相机端口 2 (SMIA CCP2),则使用此项。

bus.mipi_csi2

嵌入式 struct v4l2_mbus_config_mipi_csi2。如果总线是 MIPI 联盟的相机串行接口版本 2 (MIPI CSI2),则使用此项。

void v4l2_fill_pix_format(struct v4l2_pix_format *pix_fmt, const struct v4l2_mbus_framefmt *mbus_fmt)

辅助例程,用于从 struct v4l2_mbus_framefmt 填充 struct v4l2_pix_format 字段。

参数

struct v4l2_pix_format *pix_fmt

指向要填充的 struct v4l2_pix_format 的指针

const struct v4l2_mbus_framefmt *mbus_fmt

指向要用作模型的 struct v4l2_mbus_framefmt 的指针

void v4l2_fill_mbus_format(struct v4l2_mbus_framefmt *mbus_fmt, const struct v4l2_pix_format *pix_fmt, u32 code)

辅助例程,用于从 struct v4l2_pix_format 和数据格式代码填充 struct v4l2_mbus_framefmt

参数

struct v4l2_mbus_framefmt *mbus_fmt

指向要填充的 struct v4l2_mbus_framefmt 的指针

const struct v4l2_pix_format *pix_fmt

指向要用作模型的 struct v4l2_pix_format 的指针

u32 code

数据格式代码(来自 enum v4l2_mbus_pixelcode

void v4l2_fill_pix_format_mplane(struct v4l2_pix_format_mplane *pix_mp_fmt, const struct v4l2_mbus_framefmt *mbus_fmt)

辅助例程,用于从媒体总线结构填充 struct v4l2_pix_format_mplane 字段。

参数

struct v4l2_pix_format_mplane *pix_mp_fmt

指向要填充的 struct v4l2_pix_format_mplane 的指针

const struct v4l2_mbus_framefmt *mbus_fmt

指向要用作模型的 struct v4l2_mbus_framefmt 的指针

void v4l2_fill_mbus_format_mplane(struct v4l2_mbus_framefmt *mbus_fmt, const struct v4l2_pix_format_mplane *pix_mp_fmt)

辅助例程,用于从 struct v4l2_pix_format_mplane 填充 struct v4l2_mbus_framefmt

参数

struct v4l2_mbus_framefmt *mbus_fmt

指向要填充的 struct v4l2_mbus_framefmt 的指针

const struct v4l2_pix_format_mplane *pix_mp_fmt

指向要用作模型的 struct v4l2_pix_format_mplane 的指针