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 的指標