K230 VICAP API Reference#
Overview#
Overview#
The VICAP subsystem is the subsystem responsible for video image input capture processing in the K230 SOC. By processing the signal output by the sensor in real time, a restored and enhanced digital image is obtained, making it closer to the image seen by the human eye in reality. Mainly including MIPI RxDphy, MIPI CSI, ISP and DW. MIPI is used to receive high-speed differential signals from the sensor and convert them into a DVP interface for ISP processing; ISP is used for image information processing; DW is used for fisheye correction and multi-channel resize output.
This document mainly describes the VICAP module application programming interface, which provides application developers with the operation interface and configuration parameters for capturing video image data through the VICAP module.
Functional Description#
VICAP#
The VICAP module is an abstract description of the entire image acquisition and processing unit.
VICAP hardware consists of four modules: Sensor, VI, ISP, and Dewarp (as shown in Figure 1-1 below). Supports up to 3 sensors to be connected simultaneously. The MCM module inside the ISP implements time division multiplexing management of multiple sensors. The output data of the multiple sensors is written to DDR through the Write interface of the Memory Interface of the MCM, and then read through the Read interface and loaded into the ISP Pipeline for processing.

Figure 1-1 VICAP hardware architecture diagram
The VICAP software architecture is shown in Figure 1-2, from top to bottom: application interface layer, media interface layer, system framework layer, driver layer and hardware layer.
Application layer interface: Provides API interface and usage instructions in the form of kd_mapi_vicap_xxx. It further encapsulates the functional interfaces provided by each sub-module of the media interface layer, simplifying the application development process.
Media interface layer: This layer consists of various sub-modules of VICAP, each sub-module provides its own media interface API encapsulation.
Framework layer: Responsible for the control and management of VICAP’s entire system software functions and business logic. By integrating the interfaces and functions provided by each sub-module, a complete VICAP system control logic and process is formed.
Driver layer: A collection of kernel driver functions for each hardware module of VICAP.
Hardware layer: A collection of specific hardware modules of VICAP, including sensor.

Sensor#
The Sensor module is one of the data sources for VICAP to capture images, and is responsible for configuring the operating parameters and working mode of the image photosensitive unit.
The K230 platform supports multiple interface types of sensors. We take the currently most commonly used MIPI CSI interface Sensor as an example to illustrate. The schematic diagram of the hardware connection between the Sensor and the main control platform is as follows:

Figure 1-3
The main control issues a configuration register through the I2C interface to control the working mode of the sensor, and the sensor sends image data to the main control SOC through the MIPI CSI interface.
The Sensor module system architecture is shown in Figure 1-4 below:

Figure 1-4 sensor system architecture diagram
From top to bottom: media interface layer, hardware driver layer and hardware layer
Media interface layer: Provides kd_mpi_sensor_xxx interface for external modules to operate and access sensor devices.
Driver layer: This layer mainly includes two parts: sensor_dev and sensor_drv.
sensor_dev: Responsible for the registration of device driver files and provides the implementation process of the file operation interface. By registering the device file node /dev/sensorxx, user space programs can access the kernel driver.
sensor_drv: specific sensor hardware driver, and encapsulates sensor operations into a unified interface.
Hardware layer: sensor module hardware. The current system supports up to three hardware sensors at the same time.
API Reference#
VICAP#
This function module provides the following APIs:
VICAP API is divided into the following categories by function:
Device configuration and management#
kd_mpi_vicap_get_sensor_info - Get sensor configuration information
kd_mpi_vicap_set_dev_attr - Set VICAP device properties
kd_mpi_vicap_get_dev_attr - Get VICAP device properties
kd_mpi_vicap_set_chn_attr - Set channel properties
kd_mpi_vicap_get_chn_attr - Get channel properties
kd_mpi_vicap_init - Initialize VICAP device
kd_mpi_vicap_deinit - Deinitialize VICAP device
flow control#
kd_mpi_vicap_start_stream - Start data flow
kd_mpi_vicap_stop_stream - Stop data flow
kd_mpi_vicap_set_vi_drop_frame - Set frame loss
Image Capture and Dump#
kd_mpi_vicap_dump_frame - Dump image frame
kd_mpi_vicap_dump_release - Release Dump Frame
kd_mpi_vicap_set_dump_reserved - Set Dump Retention
kd_mpi_vicap_load_image - Load image data (offline mode)
kd_mpi_vicap_dump_register - Dump register configuration
sensor control#
kd_mpi_vicap_get_sensor_fd - Get sensor file descriptor
kd_mpi_vicap_again_set - Set analog gain
kd_mpi_vicap_again_get - Get analog gain
kd_mpi_vicap_intg_time_set - Set integration time (exposure)
kd_mpi_vicap_set_af_enable - Set autofocus enable
kd_mpi_vicap_tpg_enable - Enable test pattern generator
Clocks and synchronization#
kd_mpi_vicap_set_mclk - Set master clock
kd_mpi_vicap_set_slave_enable - Set slave mode enable
kd_mpi_vicap_set_slave_attr - Set slave mode properties
kd_mpi_vicap_3d_mode_crtl - 3D Mode Control
kd_mpi_vicap_get_sensor_info#
Description
Obtain sensor configuration information based on the specified sensor configuration type
Syntax
k_s32 kd_mpi_vicap_get_sensor_info(k_vicap_sensor_type sensor_type, k_vicap_sensor_info *sensor_info)
Parameters
Parameter name |
describe |
Input/Output |
|---|---|---|
sensor_type |
Sensor configuration type |
Input |
sensor_info |
Sensor configuration information |
Output |
Return Value
return value |
describe |
|---|---|
0 |
success. |
non-0 |
Failure, refer to error code definition. |
Chip differences
None.
Requirements
Header File: mpi_vicap_api.h
Library File: libvicap.a
Notes
Application developers need to first call this API to obtain sensor configuration information based on the sensor configuration type they want to use, and then call subsequent interfaces based on the configuration information to initialize other VICAP modules.
Example
None.
Related Topics
kd_mpi_vicap_set_dev_attr#
Description
Set VICAP device properties
Syntax
k_s32 kd_mpi_vicap_set_dev_attr(k_vicap_dev dev_num, k_vicap_dev_attr dev_attr)
Parameters
Parameter name |
describe |
Input/Output |
|---|---|---|
dev_num |
VICAP device number |
Input |
dev_attr |
VICAP device properties |
Input |
Return Value
return value |
describe |
|---|---|
0 |
success. |
non-0 |
Failure, refer to error code definition. |
Chip differences
None.
Requirements
Header File: mpi_vicap_api.h
Library File: libvicap.a
Notes
None.
Example
None.
Related Topics
kd_mpi_vicap_get_dev_attr#
Description
Get VICAP device properties
Syntax
k_s32 kd_mpi_vicap_get_dev_attr(k_vicap_dev dev_num, k_vicap_dev_attr *dev_attr)
Parameters
Parameter name |
describe |
Input/Output |
|---|---|---|
dev_num |
VICAP device number |
Input |
dev_attr |
VICAP device properties |
Output |
Return Value
return value |
describe |
|---|---|
0 |
success. |
non-0 |
Failure, refer to error code definition. |
Chip differences
None.
Requirements
Header File: mpi_vicap_api.h
Library File: libvicap.a
Notes
None.
Example
None.
Related Topics
kd_mpi_vicap_set_chn_attr#
Description
Set VICAP device properties
Syntax
k_s32 kd_mpi_vicap_set_chn_attr(k_vicap_dev dev_num, k_vicap_chn chn_num, k_vicap_chn_attr chn_attr)
Parameters
Parameter name |
describe |
Input/Output |
|---|---|---|
dev_num |
VICAP device number |
Input |
chn_num |
VICAP output channel number |
Input |
chn_attr |
VICAP output channel properties |
Input |
Return Value
return value |
describe |
|---|---|
0 |
success. |
non-0 |
Failure, refer to error code definition. |
Chip differences
None.
Requirements
Header File: mpi_vicap_api.h
Library File: libvicap.a
Notes
None.
Example
None.
Related Topics
kd_mpi_vicap_get_chn_attr#
Description
Get VICAP device properties
Syntax
k_s32 kd_mpi_vicap_get_chn_attr(k_vicap_dev dev_num, k_vicap_chn chn_num, k_vicap_chn_attr *chn_attr)
Parameters
Parameter name |
describe |
Input/Output |
|---|---|---|
dev_num |
VICAP device number |
Input |
chn_num |
VICAP output channel number |
Input |
chn_attr |
VICAP output channel properties |
Output |
Return Value
return value |
describe |
|---|---|
0 |
success. |
non-0 |
Failure, refer to error code definition. |
Chip differences
None.
Requirements
Header File: mpi_vicap_api.h
Library File: libvicap.a
Notes
None.
Example
None.
Related Topics
kd_mpi_vicap_init#
Description
VICAP device initialization
Syntax
k_s32 kd_mpi_vicap_init(k_vicap_dev dev_num)
Parameters
Parameter name |
describe |
Input/Output |
|---|---|---|
dev_num |
VICAP device number |
Input |
Return Value
return value |
describe |
|---|---|
0 |
success. |
non-0 |
Failure, refer to error code definition. |
Chip differences
None.
Requirements
Header File: mpi_vicap_api.h
Library File: libvicap.a
Notes
Before using this interface, you need to call kd_mpi_vicap_set_dev_attr to set the device attributes, and then call kd_mpi_vicap_set_chn_attr to set the output channel attributes.
Example
None
Related Topics
kd_mpi_vicap_deinit#
Description
VICAP device de-initialization
Syntax
k_s32 kd_mpi_vicap_deinit(k_vicap_dev dev_num)
Parameters
Parameter name |
describe |
Input/Output |
|---|---|---|
dev_num |
VICAP device number |
Input |
Return Value
return value |
describe |
|---|---|
0 |
success. |
non-0 |
Failure, refer to error code definition. |
Chip differences
None.
Requirements
Header File: mpi_vicap_api.h
Library File: libvicap.a
Notes
None.
Example
None.
Related Topics
kd_mpi_vicap_start_stream#
Description
Start the VICAP device output data stream
Syntax
k_s32 kd_mpi_vicap_start_stream(k_vicap_dev dev_num)
Parameters
Parameter name |
describe |
Input/Output |
|---|---|---|
dev_num |
VICAP device number |
Input |
Return Value
return value |
describe |
|---|---|
0 |
success. |
non-0 |
Failure, refer to error code definition. |
Chip differences
None.
Requirements
Header File: mpi_vicap_api.h
Library File: libvicap.a
Notes
None.
Example
None.
Related Topics
kd_mpi_vicap_stop_stream#
Description
Stop VICAP device data stream output
Syntax
k_s32 kd_mpi_vicap_stop_stream(k_vicap_dev dev_num)
Parameters
Parameter name |
describe |
Input/Output |
|---|---|---|
dev_num |
VICAP device number |
Input |
Return Value
return value |
describe |
|---|---|
0 |
success. |
non-0 |
Failure, refer to error code definition. |
Chip differences
None.
Requirements
Header File: mpi_vicap_api.h
Library File: libvicap.a
Notes
None
Example
None.
Related Topics
kd_mpi_vicap_dump_frame#
Description
Dump vicap data according to the specified device and output channel
Syntax
k_s32 kd_mpi_vicap_dump_frame(k_vicap_dev dev_num, k_vicap_chn chn_num, k_vicap_dump_format foramt,
k_video_frame_info *vf_info, k_u32 milli_sec)
Parameters
Parameter name |
describe |
Input/Output |
|---|---|---|
dev_num |
VICAP device number |
Input |
chn_num |
VICAP output channel number |
Input |
foramt |
Dump data type |
Input |
vf_info |
Dump frame information |
Output |
milli_sec |
timeout |
Input |
Return Value
return value |
describe |
|---|---|
0 |
success. |
non-0 |
Failure, refer to error code definition. |
Chip differences
None.
Requirements
Header File: mpi_vicap_api.h
Library File: libvicap.a
Notes
None.
Example
None.
Related Topics
kd_mpi_vicap_dump_release#
Description
Release dump data frame
Syntax
k_s32 kd_mpi_vicap_dump_release(k_vicap_dev dev_num, k_vicap_chn chn_num, const k_video_frame_info *vf_info)
Parameters
Parameter name |
describe |
Input/Output |
|---|---|---|
dev_num |
VICAP device number |
Input |
chn_num |
VICAP output channel number |
Input |
vf_info |
Dump frame information |
Input |
Return Value
return value |
describe |
|---|---|
0 |
success. |
non-0 |
Failure, refer to error code definition. |
Chip differences
None.
Requirements
Header File: mpi_vicap_api.h
Library File: libvicap.a
Notes
None.
Example
None.
Related Topics
kd_mpi_vicap_set_vi_drop_frame#
Description
Set hardware frame loss
Syntax
k_s32 kd_mpi_vicap_set_vi_drop_frame(k_vicap_csi_num csi, k_vicap_drop_frame *frame, k_bool enable)
Parameters
Parameter name |
describe |
Input/Output |
|---|---|---|
csi |
VICAP device number |
Input |
frame |
Structure, see below |
|
m |
Drop n frames every m frames |
Input |
n |
Drop n frames every m frames |
Input |
mode |
hdr mode |
Input |
enable |
Whether to turn on |
Input |
Return Value
return value |
describe |
|---|---|
0 |
success. |
non-0 |
Failure, refer to error code definition. |
Chip differences
None.
Requirements
Header File: mpi_vicap_api.h
Library File: libvicap.a
kd_mpi_vicap_set_mclk#
Description
Set MCLK frequency
Syntax
k_s32 kd_mpi_vicap_set_mclk(k_vicap_mclk_id id, k_vicap_mclk_sel sel, k_u8 mclk_div, k_u8 mclk_en)
Parameters
Parameter name |
describe |
Input/Output |
|---|---|---|
id |
MCLK ID |
Input |
sel |
clock source |
Input |
mclk_div |
Frequency division coefficient |
Input |
mclk_en |
Whether to turn on |
Input |
Return Value
return value |
describe |
|---|---|
0 |
success. |
non-0 |
Failure, refer to error code definition. |
Chip differences
None.
Requirements
Header File: mpi_vicap_api.h
Library File: libvicap.a
kd_mpi_vicap_set_dump_reserved#
Description
Set whether to enable fast dump mode
Syntax
void kd_mpi_vicap_set_dump_reserved(k_vicap_dev dev_num, k_vicap_chn chn_num, k_bool reserved)
Parameters
Parameter name |
describe |
Input/Output |
|---|---|---|
dev_num |
VICAP device number |
Input |
chn_num |
VICAP output channel number |
Input |
reserved |
Whether to enable fast dump mode |
Input |
Return Value
return value |
describe |
|---|---|
0 |
success. |
non-0 |
Failure, refer to error code definition. |
Chip differences
None.
kd_mpi_vicap_set_slave_enable#
Description
Enable slave mode
Syntax
k_s32 kd_mpi_vicap_set_slave_enable(k_vicap_slave_id id, k_vicap_slave_enable *enable)
Parameters
Parameter name |
describe |
Input/Output |
|---|---|---|
id |
ID of slave mode |
Input |
enable |
Whether to enable slave mode |
Input |
Return Value
return value |
describe |
|---|---|
0 |
success. |
non-0 |
Failure, refer to error code definition. |
Chip differences
None.
kd_mpi_vicap_set_slave_attr#
Description
Set slave mode parameters
Syntax
k_s32 kd_mpi_vicap_set_slave_attr(k_vicap_slave_id id, k_vicap_slave_info *info)
Parameters
Parameter name |
describe |
Input/Output |
|---|---|---|
id |
ID of slave mode |
Input |
info |
Parameters of slave mode |
Input |
Return Value
return value |
describe |
|---|---|
0 |
success. |
non-0 |
Failure, refer to error code definition. |
Chip differences
None.
kd_mpi_vicap_3d_mode_crtl#
Description
Set 3d mode enable
Syntax
k_s32 kd_mpi_vicap_3d_mode_crtl(k_bool enable)
Parameters
Parameter name |
describe |
Input/Output |
|---|---|---|
enable |
3d mode enabled |
Input |
Return Value
return value |
describe |
|---|---|
0 |
success. |
non-0 |
Failure, refer to error code definition. |
Chip differences
None.
Requirements
Header File: mpi_vicap_api.h
Library File: libvicap.a
Sensor#
This function module provides the following APIs:
kd_mpi_sensor_open#
Description
Open the sensor device according to the sensor device name
Syntax
k_s32 kd_mpi_sensor_open(const char *sensor_name)
Parameters
Parameter name |
describe |
Input/Output |
|---|---|---|
sensor_name |
Sensor device name |
Input |
Return Value
return value |
describe |
|---|---|
Positive value |
success. Return device descriptor |
negative value |
Failure, refer to error code definition. |
Chip differences
None.
Requirements
Header File: mpi_sensor_api.h
Library File: libsensor.a
Notes
None.
Example
None.
Related Topics
kd_mpi_sensor_close#
Description
Close sensor device
Syntax
k_s32 kd_mpi_sensor_close (k_s32 fd)
Parameters
Parameter name |
describe |
Input/Output |
|---|---|---|
fd |
Sensor device file descriptor |
Input |
Return Value
return value |
describe |
|---|---|
0 |
success. |
non-0 |
Failure, refer to error code definition. |
Chip differences
None.
Requirements
Header File: mpi_sensor_api.h
Library File: libsensor.a
Notes
None.
Example
None.
Related Topics
kd_mpi_sensor_power_set#
Description
Set sensor power status
Syntax
k_s32 kd_mpi_sensor_power_set(k_s32 fd, k_bool on)
Parameters
Parameter name |
describe |
Input/Output |
|---|---|---|
fd |
Sensor device file descriptor |
Input |
on |
Set the sensor power-on status, K_TRUE: power on, K_FALSE: power off |
Input |
Return Value
return value |
describe |
|---|---|
0 |
success. |
non-0 |
Failure, refer to error code definition. |
Chip differences
None.
Requirements
Header File: mpi_sensor_api.h
Library File: libsensor.a
Notes
None.
Example
None.
Related Topics
kd_mpi_sensor_id_get#
Description
Get sensor id
Syntax
k_s32 kd_mpi_sensor_id_get(k_s32 fd, k_u32 *sensor_id)
Parameters
Parameter name |
describe |
Input/Output |
|---|---|---|
fd |
Sensor device file descriptor |
Input |
sensor_id |
Obtained sensor id |
Output |
Return Value
return value |
describe |
|---|---|
0 |
success. |
non-0 |
Failure, refer to error code definition. |
Chip differences
None.
Requirements
Header File: mpi_sensor_api.h
Library File: libsensor.a
Notes
None.
Example
None.
Related Topics
kd_mpi_sensor_init#
Description
Sensor initialization
Syntax
k_s32 kd_mpi_sensor_init(k_s32 fd, k_sensor_mode mode)
Parameters
Parameter name |
describe |
Input/Output |
|---|---|---|
fd |
Sensor device file descriptor |
Input |
mode |
Initialize the sensor configuration register according to the specified sensor mode |
Input |
Return Value
return value |
describe |
|---|---|
0 |
success. |
non-0 |
Failure, refer to error code definition. |
Chip differences
None.
Requirements
Header File: mpi_sensor_api.h
Library File: libsensor.a
Notes
None.
Example
None.
Related Topics
kd_mpi_sensor_reg_read#
Description
Read the contents of the sensor register
Syntax
k_s32 kd_mpi_sensor_reg_read(k_s32 fd, k_u32 reg_addr, k_u32 *reg_val)
Parameters
Parameter name |
describe |
Input/Output |
|---|---|---|
fd |
Sensor device file descriptor |
Input |
reg_addr |
Sensor register address |
Input |
reg_val |
Read register contents |
Output |
Return Value
return value |
describe |
|---|---|
0 |
success. |
non-0 |
Failure, refer to error code definition. |
Chip differences
None.
Requirements
Header File: mpi_sensor_api.h
Library File: libsensor.a
Notes
None.
Example
None.
Related Topics
kd_mpi_sensor_reg_write#
Description
Write the contents of sensor register
Syntax
k_s32 kd_mpi_sensor_reg_write(k_s32 fd, k_u32 reg_addr, k_u32 reg_val)
Parameters
Parameter name |
describe |
Input/Output |
|---|---|---|
fd |
Sensor device file descriptor |
Input |
reg_addr |
Sensor register address |
Input |
reg_val |
Write the contents of the sensor register |
Input |
Return Value
return value |
describe |
|---|---|
0 |
success. |
non-0 |
Failure, refer to error code definition. |
Chip differences
None.
Requirements
Header File: mpi_sensor_api.h
Library File: libsensor.a
Notes
None.
Example
None.
Related Topics
kd_mpi_sensor_mode_get#
Description
Get sensor mode configuration
Syntax
k_s32 kd_mpi_sensor_mode_get(k_s32 fd, k_sensor_mode *mode)
Parameters
Parameter name |
describe |
Input/Output |
|---|---|---|
fd |
Sensor device file descriptor |
Input |
mode |
Return the obtained sensor mode configuration parameters |
Output |
Return Value
return value |
describe |
|---|---|
0 |
success. |
non-0 |
Failure, refer to error code definition. |
Chip differences
None.
Requirements
Header File: mpi_sensor_api.h
Library File: libsensor.a
Notes
None.
Example
None.
Related Topics
kd_mpi_sensor_mode_set#
Description
Set sensor mode configuration
Syntax
k_s32 kd_mpi_sensor_mode_get(k_s32 fd, k_sensor_mode mode)
Parameters
Parameter name |
describe |
Input/Output |
|---|---|---|
fd |
Sensor device file descriptor |
Input |
mode |
Set sensor mode configuration parameters |
Input |
Return Value
return value |
describe |
|---|---|
0 |
success. |
non-0 |
Failure, refer to error code definition. |
Chip differences
None.
Requirements
Header File: mpi_sensor_api.h
Library File: libsensor.a
Notes
None.
Example
None.
Related Topics
kd_mpi_sensor_stream_enable#
Description
Set sensor mode configuration
Syntax
k_s32 kd_mpi_sensor_stream_enable(k_s32 fd, k_s32 enable)
Parameters
Parameter name |
describe |
Input/Output |
|---|---|---|
fd |
Sensor device file descriptor |
Input |
enable |
Set the sensor stream output status, 0: disable output, non-0: enable output |
Input |
Return Value
return value |
describe |
|---|---|
0 |
success. |
non-0 |
Failure, refer to error code definition. |
Chip differences
None.
Requirements
Header File: mpi_sensor_api.h
Library File: libsensor.a
Notes
None.
Example
None.
Related Topics
kd_mpi_sensor_again_set#
Description
Set sensor analog gain
Syntax
k_s32 kd_mpi_sensor_again_set(k_s32 fd, k_sensor_gain gain)
Parameters
Parameter name |
describe |
Input/Output |
|---|---|---|
fd |
Sensor device file descriptor |
Input |
gain |
gain configuration parameters |
Input |
Return Value
return value |
describe |
|---|---|
0 |
success. |
non-0 |
Failure, refer to error code definition. |
Chip differences
None.
Requirements
Header File: mpi_sensor_api.h
Library File: libsensor.a
Notes
None.
Example
None.
Related Topics
kd_mpi_sensor_again_get#
Description
Get sensor analog gain
Syntax
k_s32 kd_mpi_sensor_again_set(k_s32 fd, k_sensor_gain *gain)
Parameters
Parameter name |
describe |
Input/Output |
|---|---|---|
fd |
Sensor device file descriptor |
Input |
gain |
gain configuration parameters |
Output |
Return Value
return value |
describe |
|---|---|
0 |
success. |
non-0 |
Failure, refer to error code definition. |
Chip differences
None.
Requirements
Header File: mpi_sensor_api.h
Library File: libsensor.a
Notes
None.
Example
None.
Related Topics
kd_mpi_sensor_dgain_set#
Description
Set sensor digital gain
Syntax
k_s32 kd_mpi_sensor_dgain_set(k_s32 fd, k_sensor_gain gain)
Parameters
Parameter name |
describe |
Input/Output |
|---|---|---|
fd |
Sensor device file descriptor |
Input |
gain |
gain configuration parameters |
Input |
Return Value
return value |
describe |
|---|---|
0 |
success. |
non-0 |
Failure, refer to error code definition. |
Chip differences
None.
Requirements
Header File: mpi_sensor_api.h
Library File: libsensor.a
Notes
None.
Example
None.
Related Topics
kd_mpi_sensor_dgain_get#
Description
Get sensor digital gain
Syntax
k_s32 kd_mpi_sensor_dgain_get(k_s32 fd, k_sensor_gain *gain)
Parameters
Parameter name |
describe |
Input/Output |
|---|---|---|
fd |
Sensor device file descriptor |
Input |
gain |
gain configuration parameters |
Output |
Return Value
return value |
describe |
|---|---|
0 |
success. |
non-0 |
Failure, refer to error code definition. |
Chip differences
None.
Requirements
Header File: mpi_sensor_api.h
Library File: libsensor.a
Notes
None.
Example
None.
Related Topics
kd_mpi_sensor_intg_time_set#
Description
Set sensor integration time
Syntax
k_s32 kd_mpi_sensor_intg_time_set(k_s32 fd, k_sensor_intg_time time)
Parameters
Parameter name |
describe |
Input/Output |
|---|---|---|
fd |
Sensor device file descriptor |
Input |
time |
Integration time configuration parameters |
Input |
Return Value
return value |
describe |
|---|---|
0 |
success. |
non-0 |
Failure, refer to error code definition. |
Chip differences
None.
Requirements
Header File: mpi_sensor_api.h
Library File: libsensor.a
Notes
None.
Example
None.
Related Topics
kd_mpi_sensor_intg_time_get#
Description
Get sensor integration time
Syntax
k_s32 kd_mpi_sensor_intg_time_get(k_s32 fd, k_sensor_intg_time *time)
Parameters
Parameter name |
describe |
Input/Output |
|---|---|---|
fd |
Sensor device file descriptor |
Input |
time |
Integration time configuration parameters |
Output |
Return Value
return value |
describe |
|---|---|
0 |
success. |
non-0 |
Failure, refer to error code definition. |
Chip differences
None.
Requirements
Header File: mpi_sensor_api.h
Library File: libsensor.a
Notes
None.
Example
None.
Related Topics
kd_mpi_sensor_otpdata_get#
Description
Get sensor otp data
Syntax
k_s32 kd_mpi_sensor_otpdata_get(k_s32 fd, void *ota_data)
Parameters
Parameter name |
describe |
Input/Output |
|---|---|---|
fd |
Sensor device file descriptor |
Input |
ota_data |
otp data |
Input |
Return Value
return value |
describe |
|---|---|
0 |
success. |
non-0 |
Failure, refer to error code definition. |
Chip differences
None.
Requirements
Header File: mpi_sensor_api.h
Library File: libsensor.a
Notes
None.
Example
None.
Related Topics
kd_mpi_sensor_otpdata_set#
Description
Set sensor otp data
Syntax
k_s32 kd_mpi_sensor_otpdata_set(k_s32 fd, void *ota_data)
Parameters
Parameter name |
describe |
Input/Output |
|---|---|---|
fd |
Sensor device file descriptor |
Input |
ota_data |
otp data |
Input |
Return Value
return value |
describe |
|---|---|
0 |
success. |
non-0 |
Failure, refer to error code definition. |
Chip differences
None.
Requirements
Header File: mpi_sensor_api.h
Library File: libsensor.a
Notes
None.
Example
None.
Related Topics
kd_mpi_sensor_get_exposure_time_range#
Description
Get sensor exposure time range
Syntax
k_s32 kd_mpi_sensor_get_exposure_time_range(k_s32 fd, k_sensor_exposure_time_range *range)
Parameters
Parameter name |
describe |
Input/Output |
|---|---|---|
fd |
Sensor device file descriptor |
Input |
range |
Exposure range configuration parameters |
Output |
Return Value
return value |
describe |
|---|---|
0 |
success. |
Not 0 |
Failure, refer to error code definition. |
Chip differences
None.
Requirements
Header File: mpi_sensor_api.h
Library File: libsensor.a
Notes
The returned exposure time unit is microseconds (us)
Example
k_sensor_exposure_time_range range;
k_s32 ret = kd_mpi_sensor_get_exposure_time_range(fd, &range);
if (ret == 0) {
printf("Exposure range: %.0f - %.0f us\n",
range.min_intg_time_us, range.max_intg_time_us);
}
Related Topics
kd_mpi_sensor_get_gain_range#
Description
Get the sensor gain range (including minimum value, maximum value and step size)
Syntax
k_s32 kd_mpi_sensor_get_gain_range(k_s32 fd, k_sensor_gain_range *range)
Parameters
Parameter name |
describe |
Input/Output |
|---|---|---|
fd |
Sensor device file descriptor |
Input |
range |
Gain range configuration parameters |
Output |
Return Value
return value |
describe |
|---|---|
0 |
success. |
Not 0 |
Failure, refer to error code definition. |
Chip differences
None.
Requirements
Header File: mpi_sensor_api.h
Library File: libsensor.a
Notes
The returned gain range consists of min_gain, max_gain and step_gain
Example
k_sensor_gain_range range;
k_s32 ret = kd_mpi_sensor_get_gain_range(fd, &range);
if (ret == 0) {
printf("Gain range: %.2f - %.2f, step: %.6f\n",
range.min_gain, range.max_gain, range.step_gain);
}
Related Topics
kd_mpi_sensor_get_focus_caps#
Description
Obtain sensor focusing capability information (only supports sensor modules with autofocus function)
Syntax
k_s32 kd_mpi_sensor_get_focus_caps(k_s32 fd, k_sensor_autofocus_caps *caps)
Parameters
Parameter name |
describe |
Input/Output |
|---|---|---|
fd |
Sensor device file descriptor |
Input |
caps |
Focus capability configuration parameters |
Output |
Return Value
return value |
describe |
|---|---|
0 |
success. |
Not 0 |
Failure, refer to error code definition. |
Chip differences
None.
Requirements
Header File: mpi_sensor_api.h
Library File: libsensor.a
Notes
Only supports sensor modules with autofocus function
Example
k_sensor_autofocus_caps caps;
k_s32 ret = kd_mpi_sensor_get_focus_caps(fd, &caps);
if (ret == 0) {
printf("Focus caps available\n");
}
Related Topics
kd_mpi_vicap_get_sensor_fd#
Description
Get the sensor file descriptor associated with the VICAP device
Syntax
k_s32 kd_mpi_vicap_get_sensor_fd(k_vicap_sensor_attr *sensor_attr)
Parameters
Parameter name |
describe |
Input/Output |
|---|---|---|
sensor_attr |
Sensor attribute structure pointer, including device number and returned sensor_fd |
Input/Output |
Return Value
return value |
describe |
|---|---|
K_SUCCESS (0) |
Success |
K_FAILED (not 0) |
Failed, the device number is invalid or the sensor is not turned on |
Chip differences
None.
Requirements
Header File: mpi_vicap_api.h
Library File: libvicap.a
Notes
You must first initialize the VICAP device and open the sensor before you can obtain fd
sensor_attr->dev_num must be within the valid range (VICAP_DEV_ID_0 to VICAP_DEV_ID_MAX-1)
The returned sensor_fd can be used for subsequent sensor-related operations
Example
k_vicap_sensor_attr sensor_attr;
sensor_attr.dev_num = VICAP_DEV_ID_0;
k_s32 ret = kd_mpi_vicap_get_sensor_fd(&sensor_attr);
if (ret == K_SUCCESS) {
printf("Sensor fd: %d\n", sensor_attr.sensor_fd);
// You can use sensor_attr.sensor_fd for sensor operations
}
Related Topics
kd_mpi_vicap_tpg_enable#
Description
Enable or disable the test pattern generator (TPG, Test Pattern Generator)
Syntax
k_s32 kd_mpi_vicap_tpg_enable(k_bool enable)
Parameters
Parameter name |
describe |
Input/Output |
|---|---|---|
enable |
K_TRUE: enable TPG, K_FALSE: disable TPG |
Input |
Return Value
return value |
describe |
|---|---|
0 |
Success |
Not 0 |
Failure, refer to error code definition |
Chip differences
None.
Requirements
Header File: mpi_vicap_api.h
Library File: libvicap.a
Notes
TPG is used for debugging and does not rely on real sensor input
When enabled, VICAP will output test patterns instead of real image data
Example
// Enable test pattern
kd_mpi_vicap_tpg_enable(K_TRUE);
// Disable test pattern and use real sensor data
kd_mpi_vicap_tpg_enable(K_FALSE);
Related Topics
kd_mpi_vicap_load_image#
Description
Load user image data into VICAP (for offline mode)
Syntax
k_s32 kd_mpi_vicap_load_image(k_vicap_dev dev_num, const void *image_data, k_u32 data_len)
Parameters
Parameter name |
describe |
Input/Output |
|---|---|---|
dev_num |
VICAP device number |
Input |
image_data |
Image data pointer |
Input |
data_len |
Image data length (bytes) |
Input |
Return Value
return value |
describe |
|---|---|
0 |
Success |
Not 0 |
Failed, the device number is invalid or the parameters are wrong |
Chip differences
None.
Requirements
Header File: mpi_vicap_api.h
Library File: libvicap.a
Notes
Only available in offline mode (VICAP_WORK_OFFLINE_MODE)
image_data cannot be NULL
Data format needs to match VICAP configuration
Example
// Load image data to VICAP device 0
const void *image_data = ...; // Image data
k_u32 data_len = 1920 * 1080 * 3; // 1080P RGB data size
k_s32 ret = kd_mpi_vicap_load_image(VICAP_DEV_ID_0, image_data, data_len);
if (ret == 0) {
printf("Image loaded successfully\n");
}
Related Topics
kd_mpi_vicap_dump_register#
Description
Dump VICAP register configuration to file (for debugging)
Syntax
k_s32 kd_mpi_vicap_dump_register(k_vicap_dev dev_num, const char *file_name)
Parameters
Parameter name |
describe |
Input/Output |
|---|---|---|
dev_num |
VICAP device number |
Input |
file_name |
Output file path |
Input |
Return Value
return value |
describe |
|---|---|
0 |
Success |
Not 0 |
Failed, file open failed or dump failed |
Chip differences
None.
Requirements
Header File: mpi_vicap_api.h
Library File: libvicap.a
Notes
The output file contains the register configuration for ISP and Dewarp (if enabled)
For debugging and problem analysis
The file will be overwritten if it already exists
Example
// Dump register configuration of VICAP device 0 to file
k_s32 ret = kd_mpi_vicap_dump_register(VICAP_DEV_ID_0, "/sdcard/vicap_reg_dump.txt");
if (ret == 0) {
printf("Register dump saved to /sdcard/vicap_reg_dump.txt\n");
}
Related Topics
kd_mpi_vicap_again_set#
Description
Set sensor analog gain (Again)
Syntax
k_s32 kd_mpi_vicap_again_set(k_vicap_dev dev_num, k_sensor_gain gain)
Parameters
Parameter name |
describe |
Input/Output |
|---|---|---|
dev_num |
VICAP device number |
Input |
gain |
Gain configuration structure |
Input |
Return Value
return value |
describe |
|---|---|
0 |
Success |
Not 0 |
Failure, refer to error code definition |
Chip differences
None.
Requirements
Header File: mpi_vicap_api.h
Library File: libvicap.a
Notes
The gain value must be within the sensor support range
It is recommended to call
kd_mpi_sensor_get_gain_range()first to get the rangeGain structure definition reference k_sensor_gain
Example
k_sensor_gain gain;
gain.gain[0] = 4.0f; // Set channel 0 gain to 4.0
k_s32 ret = kd_mpi_vicap_again_set(VICAP_DEV_ID_0, gain);
if (ret == 0) {
printf("Gain set successfully\n");
}
Related Topics
kd_mpi_vicap_again_get#
Description
Get the current analog gain value of the sensor
Syntax
k_s32 kd_mpi_vicap_again_get(k_vicap_dev dev_num, k_sensor_gain *gain)
Parameters
Parameter name |
describe |
Input/Output |
|---|---|---|
dev_num |
VICAP device number |
Input |
gain |
Output gain configuration structure pointer |
Output |
Return Value
return value |
describe |
|---|---|
0 |
Success |
Not 0 |
Failure, refer to error code definition |
Chip differences
None.
Requirements
Header File: mpi_vicap_api.h
Library File: libvicap.a
Notes
The gain pointer cannot be NULL
The unit of the returned gain value is a multiple (for example, 4.0 means 4 times gain)
Example
k_sensor_gain gain;
k_s32 ret = kd_mpi_vicap_again_get(VICAP_DEV_ID_0, &gain);
if (ret == 0) {
printf("Current gain: %.2f\n", gain.gain[0]);
}
Related Topics
kd_mpi_vicap_intg_time_set#
Description
Set sensor integration time (exposure time)
Syntax
k_s32 kd_mpi_vicap_intg_time_set(k_vicap_dev dev_num, k_sensor_intg_time time)
Parameters
Parameter name |
describe |
Input/Output |
|---|---|---|
dev_num |
VICAP device number |
Input |
time |
Integration time configuration structure (unit: seconds) |
Input |
Return Value
return value |
describe |
|---|---|
0 |
Success |
Not 0 |
Failure, refer to error code definition |
Chip differences
None.
Requirements
Header File: mpi_vicap_api.h
Library File: libvicap.a
Notes
The integration time must be within the sensor support range
It is recommended to call
kd_mpi_sensor_get_exposure_time_range()first to get the rangetime structure definition reference k_sensor_intg_time
Example
k_sensor_intg_time time;
time.intg_time[0] = 0.01f; // 10ms exposure time
k_s32 ret = kd_mpi_vicap_intg_time_set(VICAP_DEV_ID_0, time);
if (ret == 0) {
printf("Exposure time set to 10ms\n");
}
Related Topics
kd_mpi_vicap_set_af_enable#
Description
Set the autofocus function enable status
Syntax
k_s32 kd_mpi_vicap_set_af_enable(k_vicap_dev dev_num, k_bool enable)
Parameters
Parameter name |
describe |
Input/Output |
|---|---|---|
dev_num |
VICAP device number |
Input |
enable |
K_TRUE: enable autofocus, K_FALSE: disable autofocus |
Input |
Return Value
return value |
describe |
|---|---|
0 |
Success |
Not 0 |
Failure, refer to error code definition |
Chip differences
None.
Requirements
Header File: mpi_vicap_api.h
Library File: libvicap.a
Notes
Only supports sensor modules with autofocus function
After disabling, you need to manually call the focus interface.
Example
// Enable autofocus
kd_mpi_vicap_set_af_enable(VICAP_DEV_ID_0, K_TRUE);
// Disable autofocus and use manual focus
kd_mpi_vicap_set_af_enable(VICAP_DEV_ID_0, K_FALSE);
Related Topics
kd_mpi_vicap_get_af_enable#
Description
Get the current enabling status of the autofocus function
Syntax
k_s32 kd_mpi_vicap_get_af_enable(k_vicap_dev dev_num, k_bool *enable)
Parameters
Parameter name |
describe |
Input/Output |
|---|---|---|
dev_num |
VICAP device number |
Input |
enable |
Output enable status pointer (K_TRUE: enabled, K_FALSE: disabled) |
Output |
Return Value
return value |
describe |
|---|---|
0 |
Success |
Not 0 |
Failure, refer to error code definition |
Chip differences
None.
Requirements
Header File: mpi_vicap_api.h
Library File: libvicap.a
Notes
enable pointer cannot be NULL
The returned enable status reflects the current working status of the autofocus function.
Example
k_bool enable;
k_s32 ret = kd_mpi_vicap_get_af_enable(VICAP_DEV_ID_0, &enable);
if (ret == 0) {
if (enable) {
printf("Auto-focus is enabled\n");
} else {
printf("Auto-focus is disabled\n");
}
}
Related Topics
data type#
VICAP#
The relevant data types of this function module are defined as follows:
k_vicap_sensor_type#
[Description] Definition of sensor types currently supported by the system
definition
typedef enum {
OV_OV9732_MIPI_1280X720_30FPS_10BIT_LINEAR = 0,
OV_OV9286_MIPI_1280X720_30FPS_10BIT_LINEAR_IR = 1,
OV_OV9286_MIPI_1280X720_30FPS_10BIT_LINEAR_SPECKLE = 2,
OV_OV9286_MIPI_1280X720_60FPS_10BIT_LINEAR_IR = 3,
OV_OV9286_MIPI_1280X720_60FPS_10BIT_LINEAR_SPECKLE = 4,
OV_OV9286_MIPI_1280X720_30FPS_10BIT_LINEAR_IR_SPECKLE = 5,
OV_OV9286_MIPI_1280X720_60FPS_10BIT_LINEAR_IR_SPECKLE = 6,
IMX335_MIPI_2LANE_RAW12_1920X1080_30FPS_LINEAR = 7,
IMX335_MIPI_2LANE_RAW12_2592X1944_30FPS_LINEAR = 8,
IMX335_MIPI_4LANE_RAW12_2592X1944_30FPS_LINEAR = 9,
IMX335_MIPI_2LANE_RAW12_1920X1080_30FPS_MCLK_7425_LINEAR = 10,
IMX335_MIPI_2LANE_RAW12_2592X1944_30FPS_MCLK_7425_LINEAR = 11,
IMX335_MIPI_4LANE_RAW12_2592X1944_30FPS_MCLK_7425_LINEAR = 12,
IMX335_MIPI_4LANE_RAW10_2XDOL = 13,
IMX335_MIPI_4LANE_RAW10_3XDOL = 14,
SC_SC035HGS_MIPI_1LANE_RAW10_640X480_120FPS_LINEAR = 15,
SC_SC035HGS_MIPI_1LANE_RAW10_640X480_60FPS_LINEAR = 16,
SC_SC035HGS_MIPI_1LANE_RAW10_640X480_30FPS_LINEAR = 17,
OV_OV9286_MIPI_1280X720_30FPS_10BIT_MCLK_25M_LINEAR_SPECKLE = 18,
OV_OV9286_MIPI_1280X720_30FPS_10BIT_MCLK_25M_LINEAR_IR = 19,
OV_OV9732_MIPI_1280X720_30FPS_10BIT_MCLK_16M_LINEAR = 20,
OV_OV5647_MIPI_1920X1080_30FPS_10BIT_LINEAR = 21,
OV_OV5647_MIPI_2592x1944_10FPS_10BIT_LINEAR = 22,
OV_OV5647_MIPI_640x480_60FPS_10BIT_LINEAR = 23,
OV_OV5647_MIPI_CSI0_1920X1080_30FPS_10BIT_LINEAR = 24,
SC_SC201CS_MIPI_1LANE_RAW10_1600X1200_30FPS_LINEAR = 25,
SC_SC201CS_SLAVE_MODE_MIPI_1LANE_RAW10_1600X1200_30FPS_LINEAR = 26,
OV_OV5647_MIPI_CSI1_1920X1080_30FPS_10BIT_LINEAR = 27,
OV_OV5647_MIPI_CSI2_1920X1080_30FPS_10BIT_LINEAR = 28,
XS9922B_MIPI_CSI0_1280X720_30FPS_YUV422_DOL3 = 29,
XS9950_MIPI_CSI0_1280X720_30FPS_YUV422 = 30,
XS9950_MIPI_CSI1_1280X720_30FPS_YUV422 = 31,
XS9950_MIPI_CSI2_1280X720_30FPS_YUV422 = 32,
XS9950_MIPI_CSI0_1920X1080_30FPS_YUV422 = 33,
OV_OV9286_MIPI_1280X720_30FPS_10BIT_MCLK_25M_LINEAR_SPECKLE_V2 = 34,
OV_OV9286_MIPI_1280X720_30FPS_10BIT_MCLK_25M_LINEAR_IR_V2 = 35,
OV_OV9732_MIPI_1280X720_30FPS_10BIT_MCLK_16M_LINEAR_V2 = 36,
OV_OV5647_MIPI_CSI0_1920X1080_30FPS_10BIT_LINEAR_V2 = 37,
OV_OV5647_MIPI_CSI1_1920X1080_30FPS_10BIT_LINEAR_V2 = 38,
OV_OV5647_MIPI_CSI2_1920X1080_30FPS_10BIT_LINEAR_V2 = 39,
GC2053_MIPI_CSI0_1920X1080_30FPS_10BIT_LINEAR = 40,
SENSOR_TYPE_MAX,
} k_vicap_sensor_type;
member
Member name |
describe |
|---|---|
OV_OV9732_MIPI_1280X720_30FPS_10BIT_LINEAR |
OV9732 1lan 10bit 720P30 frame linear output configuration external crystal oscillator 16M connected to csi0 |
OV_OV9286_MIPI_1280X720_30FPS_10BIT_LINEAR_IR |
OV9286 2lan 10bit 720P30 frame linear output configuration ir image external crystal oscillator 25M connected to CSI1 |
OV_OV9286_MIPI_1280X720_30FPS_10BIT_LINEAR_SPECKLE |
OV9286 2lan 10bit 720P30 frame linear output configuration speckle image external crystal oscillator 25M connected to CSI1 |
OV_OV9286_MIPI_1280X720_60FPS_10BIT_LINEAR_IR |
OV9286 2lan 10bit 720P60 frame linear output configuration ir image external crystal oscillator 25M connected to CSI1 |
OV_OV9286_MIPI_1280X720_60FPS_10BIT_LINEAR_SPECKLE |
OV9286 2lan 10bit 720P60 frame linear output configuration speckle image external crystal oscillator 25M connected to CSI1 |
IMX335_MIPI_2LANE_RAW12_1920X1080_30FPS_LINEAR |
imx335 12bit 2lan 1080P30 frame linear output external crystal oscillator 24M connected to csi0 |
IMX335_MIPI_2LANE_RAW12_2592X1944_30FPS_LINEAR |
imx335 12bit 2lan full size 30 frame linear output external crystal oscillator 24M connected to csi0 |
IMX335_MIPI_4LANE_RAW12_2592X1944_30FPS_LINEAR |
imx335 12bit 4lan full size 30 frame linear output external crystal oscillator 24M connected to csi0 |
IMX335_MIPI_2LANE_RAW12_1920X1080_30FPS_MCLK_7425_LINEAR |
imx335 12bit 2lan 1080P30 frame linear output chip output 74.25M clock connected to csi0 |
IMX335_MIPI_2LANE_RAW12_2592X1944_30FPS_MCLK_7425_LINEAR |
imx335 12bit 2lan full size 30 frame linear output chip output 74.25M clock connected to csi0 |
IMX335_MIPI_4LANE_RAW12_2592X1944_30FPS_MCLK_7425_LINEAR |
imx335 12bit 4lan full size 30 frame linear output chip output 74.25M clock connected to csi0 |
IMX335_MIPI_4LANE_RAW10_2XDOL |
imx335 10bit 4lan full size 15 frames 2dol output external crystal oscillator 24M connected to csi0 |
IMX335_MIPI_4LANE_RAW10_3XDOL |
imx335 10bit 4lan full size 15 frames 3dol output external crystal oscillator 24M connected to csi0 |
SC_SC035HGS_MIPI_1LANE_RAW10_640X480_120FPS_LINEAR |
sc035 10bit 1lan 640x480 120 frame linear output external crystal oscillator 24M connected to csi2 |
SC_SC035HGS_MIPI_1LANE_RAW10_640X480_60FPS_LINEAR |
sc035 10bit 1lan 640x480 60 frame linear output external crystal oscillator 24M connected to csi2 |
SC_SC035HGS_MIPI_1LANE_RAW10_640X480_30FPS_LINEAR |
sc035 10bit 1lan 640x480 30 frames linear output external crystal oscillator 24M connected to csi2 |
OV_OV9286_MIPI_1280X720_30FPS_10BIT_MCLK_25M_LINEAR_SPECKLE |
OV9286 2lan 10bit 720P30 frame linear output configuration speckle image chip output 25M clock connected to CSI1 |
OV_OV9286_MIPI_1280X720_30FPS_10BIT_MCLK_25M_LINEAR_IR |
OV9286 2lan 10bit 720P30 frame linear output configuration ir image chip output 25M clock connected to CSI1 |
OV_OV9732_MIPI_1280X720_30FPS_10BIT_MCLK_16M_LINEAR |
OV9732 1lan 10bit 720P30 frame linear output configuration chip output 16M clock connected to csi0 |
OV_OV5647_MIPI_1920X1080_30FPS_10BIT_LINEAR |
OV5647 2lan 10bit 1080P30 frame linear output configuration external crystal oscillator 25M connected to CSI2 |
OV_OV5647_MIPI_2592x1944_10FPS_10BIT_LINEAR |
OV5647 2lan 10bit full size 10 frame linear output configuration external crystal oscillator 25M connected to CSI2 |
OV_OV5647_MIPI_640x480_60FPS_10BIT_LINEAR |
OV5647 2lan 10bit 640x480 60 frame linear output configuration external crystal oscillator 25M connected to CSI2 |
OV_OV5647_MIPI_CSI0_1920X1080_30FPS_10BIT_LINEAR |
OV5647 2lan 10bit 1080P30 frame linear output configuration chip output 25M clock connected to csi0 |
SC_SC201CS_MIPI_1LANE_RAW10_1600X1200_30FPS_LINEAR |
sc201 1lan 10bit 1600x1200 30 frames linear output crystal oscillator 27M connected to csi1 |
SC_SC201CS_SLAVE_MODE_MIPI_1LANE_RAW10_1600X1200_30FPS_LINEAR |
sc201 1lan 10bit slave mode 1600x1200 30 frames linear output crystal oscillator 27M connected to csi1 |
OV_OV5647_MIPI_CSI1_1920X1080_30FPS_10BIT_LINEAR |
OV5647 2lan 10bit 1080P30 frame linear output configuration external crystal oscillator 25M external csi1 |
OV_OV5647_MIPI_CSI2_1920X1080_30FPS_10BIT_LINEAR |
OV5647 2lan 10bit 1080P30 frame linear output configuration external crystal oscillator 25M external csi2 |
XS9950_MIPI_CSI0_1280X720_30FPS_YUV422 |
XS9950 2lan yuv422 720P25 frame linear output analog camera connected to CSI0 |
XS9950_MIPI_CSI1_1280X720_30FPS_YUV422 |
XS9950 2lan yuv422 720P25 frame linear output analog camera connected to CSI1 |
OV_OV9286_MIPI_1280X720_30FPS_10BIT_MCLK_25M_LINEAR_SPECKLE_V2 |
OV9286 2lan 10bit 720P30 frame linear output configuration speckle image chip output 25M clock connected to CSI1 |
OV_OV9286_MIPI_1280X720_30FPS_10BIT_MCLK_25M_LINEAR_IR_V2 |
OV9286 2lan 10bit 720P30 frame linear output configuration ir image chip output 25M clock connected to CSI1 |
OV_OV9732_MIPI_1280X720_30FPS_10BIT_MCLK_16M_LINEAR_V2 |
OV9732 1lan 10bit 720P30 frame linear output configuration chip output 16M clock connected to CSI2 |
OV_OV5647_MIPI_CSI0_1920X1080_30FPS_10BIT_LINEAR_V2 |
OV5647 2lan 10bit 1080P30 frame linear output configuration external crystal oscillator 25M external csi0 |
OV_OV5647_MIPI_CSI1_1920X1080_30FPS_10BIT_LINEAR_V2 |
OV5647 2lan 10bit 1080P30 frame linear output configuration external crystal oscillator 25M external csi1 |
OV_OV5647_MIPI_CSI2_1920X1080_30FPS_10BIT_LINEAR_V2 |
OV5647 2lan 10bit 1080P30 frame linear output configuration chip output 25M clock connected to CSI2 |
GC2053_MIPI_CSI0_1920X1080_30FPS_10BIT_LINEAR |
GC2053 2lan 10bit 1080P30 frame linear output configuration chip output 16M clock connected to csi0 |
Notes
This list needs to be maintained by sensor driver developers. Application developers use the sensor type defined here to open the sensor device of the specified type.
k_vicap_dev#
[Explanation] vicap device number definition
definition
typedef enum {
VICAP_DEV_ID_0 = 0,
VICAP_DEV_ID_1 = 1,
VICAP_DEV_ID_2 = 2,
VICAP_DEV_ID_MAX,
} k_vicap_dev;
member
Member name |
describe |
|---|---|
VICAP_DEV_ID_0 |
VICAP device 0 |
VICAP_DEV_ID_1 |
VICAP device 1 |
VICAP_DEV_ID_2 |
VICAP device 2 |
k_vicap_chn#
[Explanation] vicap output channel number definition
definition
typedef enum {
VICAP_CHN_ID_0 = 0,
VICAP_CHN_ID_1 = 1,
VICAP_CHN_ID_2 = 2,
VICAP_CHN_ID_MAX,
} k_vicap_chn;
member
Member name |
describe |
|---|---|
VICAP_CHN_ID_0 |
VICAP output channel 0 |
VICAP_CHN_ID_1 |
VICAP output channel 1 |
VICAP_CHN_ID_2 |
VICAP output channel 2 |
k_vicap_csi_num#
[Explanation] vicap csi label definition
definition
typedef enum {
VICAP_CSI0 = 1,
VICAP_CSI1 = 2,
VICAP_CSI2 = 3,
} k_vicap_csi_num;
member
Member name |
describe |
|---|---|
VICAP_CSI0 |
CSI0 |
VICAP_CSI1 |
CSI1 |
VICAP_CSI2 |
CSI2 |
Notes
The CSI number of the Sensor connection is determined by the physical connection of the hardware.
k_vicap_mipi_lanes#
[Explanation] Vicap mipi channel number definition
definition
typedef enum {
VICAP_MIPI_1LANE = 0,
VICAP_MIPI_2LANE = 1,
VICAP_MIPI_4LANE = 3,
} k_vicap_mipi_lanes;
member
Member name |
describe |
|---|---|
VICAP_MIPI_1LANE |
1 lane |
VICAP_MIPI_2LANE |
2 lane |
VICAP_MIPI_4LANE |
4 lane |
Notes
The number of mipi channels used for Sensor connection is determined by the physical connection of the hardware. When using 4lane, only two sensors can be connected at most.
k_vicap_csi_data_type#
[Explanation] Vicap mipi channel number definition
definition
typedef enum {
VICAP_CSI_DATA_TYPE_RAW8 = 0x2A,
VICAP_CSI_DATA_TYPE_RAW10 = 0x2B,
VICAP_CSI_DATA_TYPE_RAW12 = 0x2C,
VICAP_CSI_DATA_TYPE_RAW14 = 0x2D,
} k_vicap_csi_data_type;
member
Member name |
describe |
|---|---|
VICAP_CSI_DATA_TYPE_RAW8 |
RAW8 |
VICAP_CSI_DATA_TYPE_RAW10 |
RAW10 |
VICAP_CSI_DATA_TYPE_RAW12 |
RAW12 |
VICAP_CSI_DATA_TYPE_RAW14 |
RAW14 |
Notes
None
k_vicap_data_source#
[Description] vicap data source
definition
typedef enum {
VICAP_SOURCE_CSI0 = 0, /**< vicap acquire data from the csi0*/
VICAP_SOURCE_CSI1 = 1, /**< vicap acquire data from the csi0*/
VICAP_SOURCE_CSI1_FS_TR0 = 2, /**<vicap acquire data from the csi1 for flash trigger 0*/
VICAP_SOURCE_CSI1_FS_TR1 = 3, /**<vicap acquire data from the csi0 for flash trigger 1*/
VICAP_SOURCE_CSI2 = 4, /**< vicap acquire data from the csi2*/
} k_vicap_data_source;
member
Member name |
describe |
|---|---|
VICAP_SOURCE_CSI0 |
VICAP data source is CSI0 |
VICAP_SOURCE_CSI1 |
VICAP data source is CSI1 |
VICAP_SOURCE_CSI1_FS_TR0 |
VICAP data source is CSI1 Flash trigger 0 |
VICAP_SOURCE_CSI1_FS_TR1 |
VICAP data source is CSI1 Flash trigger 1 |
VICAP_SOURCE_CSI2 |
VICAP data source is CSI2 |
Notes
k_vicap_vi_dvp_port#
[Description] vicap vi dvp port number
definition
typedef enum {
VICAP_VI_DVP_PORT0 = 0,
VICAP_VI_DVP_PORT1 = 1,
VICAP_VI_DVP_PORT2 = 2,
VICAP_VI_DVP_PORT_MAX,
} k_vicap_vi_dvp_port;
member
Member name |
describe |
|---|---|
VICAP_VI_DVP_PORT0 |
DVP port 0 |
VICAP_VI_DVP_PORT1 |
DVP port 1 |
VICAP_VI_DVP_PORT2 |
DVP port 2 |
Notes
By default, port 0 corresponds to CSI0, port 1 corresponds to CSI1, and port 2 corresponds to CSI2.
Only port 0 supports HDR sensor. When users need to use HDR mode, they must bind it to DVP port 0.
When users need to change the port mapping relationship, they need to perform a binding operation
k_vicap_vi_flash_mode#
[Description] vicap flash light source control mode
definition
typedef enum {
VICAP_FLASH_FOLLOW_STROBE = 0,
VICAP_FLASH_FOLLOW_STROBE_BASE_PWM = 1,
VICAP_FLASH_NORMAL_PWM = 2,
VICAP_FLASH_DISABLE = 3, /**< disable flash light*/
} k_vicap_vi_flash_mode;
member
Member name |
describe |
|---|---|
VICAP_FLASH_FOLLOW_STROBE |
Controlled by strobe signal |
VICAP_FLASH_FOLLOW_STROBE_BASE_PWM |
Based on PWM mode controlled by strobe signal |
VICAP_FLASH_NORMAL_PWM |
Controlled by PWM signal |
VICAP_FLASH_DISABLE |
Disable |
Notes
k_vicap_img_window#
[Description] VICAP image window definition
definition
typedef struct {
k_u16 h_start;
k_u16 v_start;
k_u16 width;
k_u16 height;
} k_vicap_img_window;
member
Member name |
describe |
|---|---|
h_start |
horizontal starting position |
v_start |
vertical starting position |
width |
image width |
height |
image height |
k_vicap_work_mode#
[Description] vicap working mode
definition
typedef enum {
VICAP_WORK_ONLINE_MODE,
VICAP_WORK_OFFLINE_MODE,
VICAP_WORK_ONLY_MCM_MODE,
} k_vicap_work_mode;
member
Member name |
describe |
|---|---|
VICAP_WORK_ONLINE_MODE |
Online mode |
VICAP_WORK_OFFLINE_MODE |
Offline mode |
VICAP_WORK_ONLY_MCM_MODE |
Only works in mcm mode |
Notes When supporting multiple camera inputs, offline mode must be specified. Configure VICAP_WORK_ONLY_MCM_MODE, and the dump image can only use the yuv444 format.
k_vicap_sensor_info#
[Description] VICAP sensor configuration information
definition
typedef struct {
const char *sensor_name;
k_vicap_csi_num csi_num; /**< CSI NUM that the sensor connects to*/
k_vicap_mipi_lanes mipi_lanes; /**< MIPI lanes that the sensor connects to*/
k_vicap_data_source source_id; /**<source id that the sensor used to*/
k_bool is_3d_sensor;
k_vicap_mipi_phy_freq phy_freq;
k_vicap_csi_data_type data_type;
k_vicap_hdr_mode hdr_mode;
k_vicap_vi_flash_mode flash_mode;
k_vicap_sensor_type sensor_type;
} k_vicap_sensor_info;
member
Member name |
describe |
|---|---|
sensor_name |
Sensor name |
csi_num |
The CSI number of the current sensor hardware connection |
mipi_lanes |
The number of MIPI channels used by the current sensor hardware connection |
source_id |
VICAP data source label currently used by the sensor |
is_3d_sensor |
Whether it is 3Dsensor |
phy_freq |
PHY frequency |
data_type |
MIPI CSI data type |
hdr_mode |
HDR mode |
flash_mode |
Flash configuration mode |
sensor_type |
Sensor configuration type |
k_vicap_dump_format#
[Description] VICAPdumo data frame format
definition
typedef enum {
VICAP_DUMP_YUV = 0,
VICAP_DUMP_RGB = 1,
VICAP_DUMP_RAW = 2,
VICAP_DUMP_YUV444 = 3,
} k_vicap_dump_format;
member
Member name |
describe |
|---|---|
VICAP_DUMP_YUV |
Dump YUV data |
VICAP_DUMP_RGB |
Dump RGB data |
VICAP_DUMP_RAW |
Dump RAW data |
VICAP_DUMP_YUV444 |
Dump YUV444 data |
k_vicap_dev_attr#
[Description] VICAP device properties
definition
typedef struct {
k_vicap_window acq_win;
k_vicap_work_mode mode;
k_vicap_isp_pipe_ctrl pipe_ctrl;
k_u32 cpature_frame;
k_vicap_sensor_info sensor_info;
k_bool dw_enable;
k_u32 buffer_num;
k_u32 buffer_size;
k_vicap_mirror mirror;
} k_vicap_dev_attr;
member
Member name |
describe |
|---|---|
acq_win |
Image capture window |
mode |
Vicap working mode. When supporting multiple camera inputs, offline mode must be specified. |
pipe_ctrl |
ISP pipeline control switch. |
cpature_frame |
Specify the number of frames to collect data, input range [0,1023], 0: continuous collection |
sensor_info |
Sensor configuration information |
dw_enable |
Dewarp enabled |
buffer_num |
In offline mode, configure the number of buffers for the sensor to receive data. |
buffer_size |
In offline mode, configure the buffer size of the sensor to receive data. |
mirror |
The mirror function of sensor |
[Note] For small memory application scenarios, it is recommended to turn off the 3DNR module to reduce memory usage. When setting device properties for the application in shutdown mode, set pipe_ctrl.bits.dnr3_enable to 0
k_vicap_chn_attr#
[Description] VICAP device properties
definition
typedef struct {
k_vicap_window out_win;
k_vicap_window crop_win;
k_vicap_window scale_win;
k_bool crop_enable;
k_bool scale_enable;
k_bool chn_enable;
k_pixel_format pix_format;
k_u32 buffer_num;
k_u32 buffer_size;
k_u8 alignment;
} k_vicap_chn_attr;
member
Member name |
describe |
|---|---|
out_win |
Output window size |
crop_win |
Crop window size |
scale_win |
Zoom window size |
crop_enable |
Crop enabled |
scale_enable |
Zoom enabled |
chn_enable |
Channel enable |
pix_format |
Output pixel format |
buffer_num |
Number of buffers used by the current channel |
buffer_size |
buffer size |
alignment |
buffer alignment |
k_vicap_mirror#
[Description] vicap sensor mirror function
definition
typedef enum {
VICAP_MIRROR_NONE = 0,
VICAP_MIRROR_HOR = 1,
VICAP_MIRROR_VER = 2,
VICAP_MIRROR_BOTH = 3,
} k_vicap_mirror;
member
Member name |
describe |
|---|---|
VICAP_MIRROR_NONE |
sensor does not require mirror |
VICAP_MIRROR_HOR |
sensor horizontal mirror |
VICAP_MIRROR_VER |
sensor vertical mirror |
VICAP_MIRROR_BOTH |
sensor horizontal and vertical mirror |
Notes
Sensor#
The relevant data types of this function module are defined as follows:
k_sensor_bayer_pattern#
[Definition] Bayer mode definition of sensor output
typedef enum {
BAYER_RGGB = 0,
BAYER_GRBG = 1,
BAYER_GBRG = 2,
BAYER_BGGR = 3,
BAYER_BUTT } k_sensor_bayer_pattern;
member
Member name |
describe |
|---|---|
BAYER_RGGB |
RGGB mode |
BAYER_GRBG |
GRBG mode |
BAYER_GBRG |
GBRG mode |
BAYER_BGGR |
BGGR mode |
k_sensor_exp_frame_type#
Description
definition
typedef enum {
SENSOR_EXPO_FRAME_TYPE_1FRAME = 0,
SENSOR_EXPO_FRAME_TYPE_2FRAMES = 1,
SENSOR_EXPO_FRAME_TYPE_3FRAMES = 2,
SENSOR_EXPO_FRAME_TYPE_4FRAMES = 3,
SENSOR_EXPO_FRAME_TYPE_MAX } k_sensor_exp_frame_type;
member
Member name |
describe |
|---|---|
SENSOR_EXPO_FRAME_TYPE_1FRAME |
Linear mode, single frame exposure |
SENSOR_EXPO_FRAME_TYPE_2FRAMES |
2-frame HDR exposure mode |
SENSOR_EXPO_FRAME_TYPE_3FRAMES |
2-frame HDR exposure mode |
SENSOR_EXPO_FRAME_TYPE_4FRAMES |
4-frame HDR exposure mode |
k_sensor_exposure_param#
[Explanation] Sensor exposure parameter definition
definition
typedef struct {
k_u8 exp_frame_type;
float gain[SENSOR_EXPO_FRAME_TYPE_MAX];
float exp_time[SENSOR_EXPO_FRAME_TYPE_MAX];
} k_sensor_exposure_param;
member
Member name |
describe |
|---|---|
exp_frame_type |
Exposure type |
gain |
exposure gain |
exp_time |
Exposure time |
k_sensor_intg_time#
[Explanation] Definition of sensor exposure time
definition
typedef struct {
k_u8 exp_frame_type;
float intg_time[SENSOR_EXPO_FRAME_TYPE_MAX];
} k_sensor_intg_time;
member
Member name |
describe |
|---|---|
exp_frame_type |
Exposure type |
intg_time |
Integration time |
k_sensor_gain#
[Explanation] Exposure gain definition
definition
typedef struct {
k_u8 exp_frame_type;
float gain[SENSOR_EXPO_FRAME_TYPE_MAX];
} k_sensor_gain;
member
Member name |
describe |
|---|---|
exp_frame_type |
Exposure type |
gain |
exposure gain |
k_sensor_size#
[Description] Image size definition supported by sensor
definition
typedef struct {
k_u32 bounds_width;
k_u32 bounds_height;
k_u32 top;
k_u32 left;
k_u32 width;
k_u32 height;
} k_sensor_size;
member
Member name |
describe |
|---|---|
bounds_width |
width border |
bounds_height |
height boundary |
top |
top border |
left |
left border |
width |
width |
height |
high |
k_sensor_ae_info#
[Description] ae parameter configuration
definition
typedef struct {
k_u16 frame_length;
k_u16 cur_frame_length;
float one_line_exp_time;
k_u32 gain_accuracy;
float min_gain;
float max_gain;
float integration_time_increment;
float gain_increment;
k_u16 max_long_integraion_line;
k_u16 min_long_integraion_line;
k_u16 max_integraion_line;
k_u16 min_integraion_line;
k_u16 max_vs_integraion_line;
k_u16 min_vs_integraion_line;
float max_long_integraion_time;
float min_long_integraion_time;
float max_integraion_time;
float min_integraion_time;
float max_vs_integraion_time;
float min_vs_integraion_time;
float cur_long_integration_time;
float cur_integration_time;
float cur_vs_integration_time;
float cur_long_gain;
float cur_long_again;
float cur_long_dgain;
float cur_gain;
float cur_again;
float cur_dgain;
float cur_vs_gain;
float cur_vs_again;
float cur_vs_dgain;
k_sensor_gain_info long_gain;
k_sensor_gain_info gain;
k_sensor_gain_info vs_gain;
k_sensor_gain_info a_long_gain;
k_sensor_gain_info a_gain;
k_sensor_gain_info a_vs_gain;
k_sensor_gain_info d_long_gain;
k_sensor_gain_info d_gain;
k_sensor_gain_info d_vs_gain;
k_u32 max_fps;
k_u32 min_fps;
k_u32 cur_fps;
k_sensor_auto_fps afps_info;
k_u32 hdr_ratio;
} k_sensor_ae_info;
member
Member name |
describe |
|---|---|
frame_length |
Frame length |
cur_frame_length |
Current frame length |
one_line_exp_time |
Row exposure time (unit: s) |
gain_accuracy |
Gain accuracy |
min_gain |
minimum gain |
max_gain |
maximum gain |
integration_time_increment |
Increment of integration time |
gain_increment |
gain increment |
max_long_integraion_line |
Maximum long frame integration line |
min_long_integraion_line |
Minimum long frame integration line |
max_integraion_line |
Maximum mid-frame integration line |
min_integraion_line |
Minimum mid-frame integral line |
max_vs_integraion_line |
Maximum short frame integration line |
min_vs_integraion_line |
Minimum short frame integration line |
max_long_integraion_time |
Maximum long frame product time |
min_long_integraion_time |
Minimum long frame product time |
max_integraion_time |
Maximum frame product time |
min_integraion_time |
Minimum mid-frame product time |
max_vs_integraion_time |
Maximum short frame product time |
min_vs_integraion_time |
Minimum short frame product time |
cur_long_integration_time |
Current long frame integration time |
cur_integration_time |
Current frame integration time |
cur_vs_integration_time |
Current short frame integration time |
cur_long_gain |
Current long frame gain |
cur_long_again |
Current long frame analog gain |
cur_long_dgain |
Current long frame digital gain |
cur_gain |
current frame gain |
cur_again |
Current frame analog gain |
cur_dgain |
Current frame digital gain |
cur_vs_gain |
Current short frame gain |
cur_vs_again |
Current short frame analog gain |
cur_vs_dgain |
Current short frame digital gain |
long_gain |
long frame gain |
gain |
medium gain |
vs_gain |
short frame gain |
a_long_gain |
Long frame analog gain |
a_gain |
Mid frame analog gain |
a_vs_gain |
Short frame analog gain |
d_long_gain |
Long frame digital gain |
d_gain |
Mid frame digital gain |
d_vs_gain |
short frame digital gain |
max_fps |
Max frame rate |
min_fps |
Minimum frame rate |
cur_fps |
Current frame rate |
hdr_ratio |
HDR ratio |
k_sensor_mode#
[Description] sensor mode parameters
definition
typedef struct {
k_u32 index;
k_vicap_sensor_type sensor_type;
k_sensor_size size;
k_u32 fps;
k_u32 hdr_mode;
k_u32 stitching_mode;
k_u32 bit_width;
k_u32 bayer_pattern;
k_sensor_mipi_info mipi_info;
k_sensor_ae_info ae_info;
k_sensor_reg_list *reg_list;
} k_sensor_mode;
member
Member name |
describe |
|---|---|
index |
Current mode index |
sensor_type |
Sensor configuration type |
size |
Current mode sensor size |
fps |
Frame rate |
hdr_mode |
HDR mode |
stitching_mode |
HDR stiching mode |
bit_width |
Output data width |
bayer_pattern |
Bayer model |
mipi_info |
MIPI parameter information |
ae_info |
AE parameter information |
reg_list |
Register configuration list of current mode |
otp_type |
otp type: sensor, self-use and user |
otp_date |
otp data |
k_sensor_otp_date#
[Description] sensor otp parameters
definition
typedef struct {
k_u8 otp_type;
k_u8 otp_date[20];
} k_sensor_otp_date;
member
Member name |
describe |
|---|---|
otp_type |
otp type: sensor, self-use and user |
otp_date |
otp data |
MAPI#
This function module provides the following APIs:
[kd_mapi_vicap_get_sensor_fd]
[kd_mapi_vicap_get_sensor_info]
[kd_mapi_vicap_set_dev_attr]
[kd_mapi_vicap_set_chn_attr]
[kd_mapi_vicap_start]
[kd_mapi_vicap_stop]
[kd_mapi_vicap_dump_frame]
[kd_mapi_vicap_release_frame]
[kd_mapi_vicap_set_vi_drop_frame]
[kd_mapi_vicap_set_mclk]
[kd_mapi_vicap_tuning]
[kd_mapi_isp_ae_get_roi]
[kd_mapi_isp_ae_set_roi]
[kd_mapi_sensor_otpdata_get]
API#
kd_mapi_vicap_get_sensor_fd#
Description
Get the file descriptor according to the specified sensor
Syntax
k_s32 kd_mapi_vicap_get_sensor_fd(k_vicap_sensor_attr *sensor_attr)
Parameters
Parameter name |
describe |
Input/Output |
|---|---|---|
sensor_attr |
Sensor properties |
Input & Output |
Return Value
return value |
describe |
|---|---|
0 |
success. |
non-0 |
Failure, refer to error code definition. |
Chip differences
None.
Requirements
Header File: mapi_vicap_api.h
Library File: libmapi.a
kd_mapi_vicap_get_sensor_info#
Description
Obtain sensor configuration information according to the specified sensor configuration type, see kd_mpi_vicap_get_sensor_info, put sensor_type into sensor_info.sensor_type, the usage is the same
Syntax
k_s32 kd_mapi_vicap_get_sensor_info(k_vicap_sensor_info *sensor_info)
Return Value
return value |
describe |
|---|---|
0 |
success. |
non-0 |
Failure, refer to error code definition. |
Chip differences
None.
Requirements
Header File: mapi_vicap_api.h
Library File: libmapi.a
kd_mapi_vicap_set_dev_attr#
Description
Set VICAP device properties, see kd_mpi_vicap_set_dev_attr, put dev_num into dev_info.vicap_dev, the usage is the same
Syntax
k_s32 kd_mapi_vicap_set_dev_attr(k_vicap_dev_set_info dev_info)
Return Value
return value |
describe |
|---|---|
0 |
success. |
non-0 |
Failure, refer to error code definition. |
Chip differences
None.
Requirements
Header File: mapi_vicap_api.h
Library File: libmapi.a
kd_mapi_vicap_set_chn_attr#
Description
Set VICAP channel attributes, see kd_mpi_vicap_set_chn_attr, put dev_num into chn_info.vicap_dev, put chn_num into chn_info.vicap_chn, the usage is the same
Syntax
k_s32 kd_mapi_vicap_set_chn_attr(k_vicap_chn_set_info chn_info)
Return Value
return value |
describe |
|---|---|
0 |
success. |
non-0 |
Failure, refer to error code definition. |
Chip differences
None.
Requirements
Header File: mapi_vicap_api.h
Library File: libmapi.a
kd_mapi_vicap_start#
Description
kd_mpi_vicap_init + kd_mpi_vicap_start_stream
Syntax
k_s32 kd_mapi_vicap_start(k_vicap_dev vicap_dev)
Return Value
return value |
describe |
|---|---|
0 |
success. |
non-0 |
Failure, refer to error code definition. |
Chip differences
None.
Requirements
Header File: mapi_vicap_api.h
Library File: libmapi.a
kd_mapi_vicap_stop#
Description
kd_mpi_vicap_stop_stream + kd_mpi_vicap_deinit
Syntax
k_s32 kd_mapi_vicap_stop(k_vicap_dev vicap_dev)
Return Value
return value |
describe |
|---|---|
0 |
success. |
non-0 |
Failure, refer to error code definition. |
Chip differences
None.
Requirements
Header File: mapi_vicap_api.h
Library File: libmapi.a
kd_mapi_vicap_dump_frame#
Description
Dump vicap data according to the specified device and output channel, see kd_mpi_vicap_dump_frame
Syntax
k_s32 kd_mapi_vicap_dump_frame(k_vicap_dev dev_num, k_vicap_chn chn_num, k_vicap_dump_format foramt, k_video_frame_info *vf_info, k_u32 milli_sec)
Parameters
Parameter name |
describe |
Input/Output |
|---|---|---|
dev_num |
VICAP device number |
Input |
chn_num |
VICAP output channel number |
Input |
foramt |
Dump data type |
Input |
vf_info |
Dump frame information |
Output |
milli_sec |
timeout |
Input |
Return Value
return value |
describe |
|---|---|
0 |
success. |
non-0 |
Failure, refer to error code definition. |
Chip differences
None.
Requirements
Header File: mapi_vicap_api.h
Library File: libmapi.a
kd_mapi_vicap_release_frame#
Description
Release the dump data frame, see kd_mpi_vicap_dump_release
Syntax
k_s32 kd_mapi_vicap_release_frame(k_vicap_dev dev_num, k_vicap_chn chn_num, const k_video_frame_info *vf_info)
Parameters
Parameter name |
describe |
Input/Output |
|---|---|---|
dev_num |
VICAP device number |
Input |
chn_num |
VICAP output channel number |
Input |
vf_info |
Dump frame information |
Input |
Return Value
return value |
describe |
|---|---|
0 |
success. |
non-0 |
Failure, refer to error code definition. |
Chip differences
None.
Requirements
Header File: mapi_vicap_api.h
Library File: libmapi.a
kd_mapi_vicap_set_vi_drop_frame#
Description
Set hardware frame loss, see kd_mpi_vicap_set_vi_drop_frame
Syntax
k_s32 kd_mapi_vicap_set_vi_drop_frame(k_vicap_csi_num csi, k_vicap_drop_frame *frame, k_bool enable)
Parameters
Parameter name |
describe |
Input/Output |
|---|---|---|
csi |
VICAP device number |
Input |
frame |
Structure, see below |
|
m |
Drop n frames every m frames |
Input |
n |
Drop n frames every m frames |
Input |
mode |
hdr mode |
Input |
enable |
Whether to turn on |
Input |
Return Value
return value |
describe |
|---|---|
0 |
success. |
non-0 |
Failure, refer to error code definition. |
Chip differences
None.
Requirements
Header File: mapi_vicap_api.h
Library File: libmapi.a
kd_mapi_vicap_set_mclk#
Description
Set MCLK frequency, see kd_mpi_vicap_set_mclk
Syntax
k_s32 kd_mapi_vicap_set_mclk(k_vicap_mclk_id id, k_vicap_mclk_sel sel, k_u8 mclk_div, k_u8 mclk_en)
Parameters
Parameter name |
describe |
Input/Output |
|---|---|---|
id |
MCLK ID |
Input |
sel |
clock source |
Input |
mclk_div |
Frequency division coefficient |
Input |
mclk_en |
Whether to turn on |
Input |
Return Value
return value |
describe |
|---|---|
0 |
success. |
non-0 |
Failure, refer to error code definition. |
Chip differences
None.
Requirements
Header File: mapi_vicap_api.h
Library File: libmapi.a
kd_mapi_vicap_tuning#
Description
Used to process commands sent by the tuning client
Syntax
k_s32 kd_mapi_vicap_tuning(char* string, k_u32 size, char** response, k_u32* response_len)
Return Value
return value |
describe |
|---|---|
0 |
success. |
non-0 |
Failure, refer to error code definition. |
Chip differences
None.
Requirements
Header File: mapi_vicap_api.h
Library File: libmapi.a
kd_mapi_isp_ae_get_roi#
Description
Get AE ROI configuration
Syntax
k_s32 kd_mapi_isp_ae_get_roi(k_vicap_dev dev_num, k_isp_ae_roi *ae_roi)
Return Value
return value |
describe |
|---|---|
0 |
success. |
non-0 |
Failure, refer to error code definition. |
Chip differences
None.
Requirements
Header File: mapi_isp_api.h
Library File: libmapi.a
kd_mapi_isp_ae_set_roi#
Description
Set AE ROI
Syntax
k_s32 kd_mapi_isp_ae_set_roi(k_vicap_dev dev_num, k_isp_ae_roi ae_roi)
Return Value
return value |
describe |
|---|---|
0 |
success. |
non-0 |
Failure, refer to error code definition. |
Chip differences
None.
Requirements
Header File: mapi_isp_api.h
Library File: libmapi.a
kd_mapi_sensor_otpdata_get#
Description
Get sensor otp data
Syntax
k_s32 kd_mapi_sensor_otpdata_get(k_s32 sensor_type, k_sensor_otp_date *otp_data)
Return Value
return value |
describe |
|---|---|
0 |
success. |
non-0 |
Failure, refer to error code definition. |
Chip differences
None.
Requirements
Header File: mapi_isp_api.h
Library File: libmapi.a
error code#
Table 41 VICAP API error codes
error code |
Macro definition |
Description |
|---|---|---|
0xA0158001 |
K_ERR_VICAP_INVALID_DEVID |
Device ID is outside the legal range |
0xA0158002 |
K_ERR_VICAP_INVALID_CHNID |
Channel ID is outside the legal range |
0xA0158003 |
K_ERR_VICAP_ILLEGAL_PARAM |
Parameter exceeds legal range |
0xA0158004 |
K_ERR_VICAP_EXIST |
Trying to apply for or create an existing device, channel or resource |
0xA0158005 |
K_ERR_VICAP_UNEXIST |
Attempting to use or destroy a non-existent device, channel or resource |
0xA0158006 |
K_ERR_VICAP_NULL_PTR |
There is a null pointer in the function parameter |
0xA0158007 |
K_ERR_VICAP_NOT_CONFIG |
Not configured before use |
0xA0158008 |
K_ERR_VICAP_NOT_SUPPORT |
Unsupported parameters or functions |
0xA0158009 |
K_ERR_VICAP_NOT_PERM |
This operation is not allowed, such as trying to modify static configuration parameters |
0xA015800C |
K_ERR_VICAP_NOMEM |
Failed to allocate memory, such as insufficient system memory |
0xA015800D |
K_ERR_VICAP_NOBUF |
Failed to allocate cache, such as the requested data buffer is too large |
0xA015800E |
K_ERR_VICAP_BUF_EMPTY |
No data in buffer |
0xA015800F |
K_ERR_VICAP_BUF_FULL |
The buffer is full of data |
0xA0158010 |
K_ERR_VICAP_NOTREADY |
The system is not initialized or the corresponding module is not loaded. |
0xA0158011 |
K_ERR_VICAP_BADADDR |
The address is outside the legal range |
0xA0158012 |
K_ERR_VICAP_BUSY |
VICAP system is busy |
debugging information#
For VICAP memory management and system binding debugging information, please refer to “K230 System Control API Reference”.
