rk3399 android7.1 camera驱动位置:
hardware/rockchip/camera/SiliconImage/isi/drv
MIPI摄像头的注册是在HAL层中进行的,CameraService在启动时会调用HAL层的camera_get_number_of_cameras函数来获取系统中存在的摄像头数量,首次调用camera_get_number_of_cameras会完成所有摄像头的注册。hardware/rockchip/camera/CameraHal/CameraHal_board_xml_parse.cpp
文件中的RegisterSensorDevice函数里
rk android的sensor驱动不走kernel
1.VIRTUAL_MIPI_YUV/VIRTUAL_priv.h
/******************************************************************************
*
* The copyright in this software is owned by Rockchip and/or its licensors.
* This software is made available subject to the conditions of the license
* terms to be determined and negotiated by Rockchip and you.
* THIS SOFTWARE IS PROVIDED TO YOU ON AN "AS IS" BASIS and ROCKCHP AND/OR
* ITS LICENSORS DISCLAIMS ANY AND ALL WARRANTIES AND REPRESENTATIONS WITH
* RESPECT TO SUCH SOFTWARE, WHETHER EXPRESS,IMPLIED, STATUTORY OR OTHERWISE,
* INCLUDING WITHOUT LIMITATION, ANY IMPLIED WARRANTIES OF TITLE, NON-INFRINGEMENT,
* MERCHANTABILITY, SATISFACTROY QUALITY, ACCURACY OR FITNESS FOR A PARTICULAR PURPOSE.
* Except as expressively authorized by Rockchip and/or its licensors, you may not
* (a) disclose, distribute, sell, sub-license, or transfer this software to any third party,
* in whole or part; (b) modify this software, in whole or part; (c) decompile, reverse-engineer,
* dissemble, or attempt to derive any source code from the software.
*
*****************************************************************************/
#ifndef __VIRTUAL_MIPI_PRIV_H__
#define __VIRTUAL_MIPI_PRIV_H__
#include <ebase/types.h>
#include <common/return_codes.h>
#include <hal/hal_api.h>
/*
*v0.1.0x00 : first release;
*v0.2.0:
* 1).add senosr drv version in get sensor i2c info func
*v0.3.0:
* 1). support for isi v0.5.0
*v0.4.0
* 1). support for isi v0.6.0
*v0.5.0
* 1). support for isi v0.7.0
*v0.6.0
* 1). support for isi v0.0xc.0
* 2). change VPol from ISI_VPOL_NEG to ISI_VPOL_POS
*v0.7.0
* 1). support isi v0.0xd.0
*/
#define CONFIG_SENSOR_DRV_VERSION KERNEL_VERSION(0, 7, 0)
#ifdef __cplusplus
extern "C"
{
#endif
#define VIRTUAL_MIPI_DELAY_5MS (0x0000) //delay 5 ms
#define VIRTUAL_MIPI_MODE_SELECT (0x0026) // rw - Bit[7:1]not used Bit[0]Streaming set 0: software_standby 1: streaming
#define VIRTUAL_MIPI_SOFTWARE_RST (0x0010) // rw - Bit[7:1]not used Bit[0]software_reset
#define VIRTUAL_MIPI_CHIP_ID_HIGH_BYTE_DEFAULT (0x00) // r -
#define VIRTUAL_MIPI_CHIP_ID_MIDDLE_BYTE_DEFAULT (0x00) // r -
#define VIRTUAL_MIPI_CHIP_ID_LOW_BYTE_DEFAULT (0x00) // r -
#define VIRTUAL_MIPI_CHIP_ID_HIGH_BYTE (0x0003) // r -
#define VIRTUAL_MIPI_CHIP_ID_MIDDLE_BYTE (0x0004) // r -
#define VIRTUAL_MIPI_CHIP_ID_LOW_BYTE (0x0000) // r -
/*****************************************************************************
* Further defines for driver management
*****************************************************************************/
#define VIRTUAL_MIPI_DRIVER_INIT (0x00000001)
/*****************************************************************************
* ov14825 context structure
*****************************************************************************/
typedef struct VIRTUAL_MIPI_Context_s
{
IsiSensorContext_t IsiCtx; /**< common context of ISI and ISI driver layer; @note: MUST BE FIRST IN DRIVER CONTEXT */
modify below here
IsiSensorConfig_t Config; /**< sensor configuration */
bool_t Configured; /**< flags that config was applied to sensor */
bool_t Streaming; /**< flags that sensor is streaming data */
bool_t TestPattern; /**< flags that sensor is streaming test-pattern */
bool_t isAfpsRun; /**< if true, just do anything required for Afps parameter calculation, but DON'T access SensorHW! */
bool_t GroupHold;
float VtPixClkFreq; /**< pixel clock */
uint16_t LineLengthPck; /**< line length with blanking */
uint16_t FrameLengthLines; /**< frame line length */
float AecMaxGain;
float AecMinGain;
float AecMaxIntegrationTime;
float AecMinIntegrationTime;
float AecIntegrationTimeIncrement; /**< _smallest_ increment the sensor/driver can handle (e.g. used for sliders in the application) */
float AecGainIncrement; /**< _smallest_ increment the sensor/driver can handle (e.g. used for sliders in the application) */
float AecCurGain;
float AecCurIntegrationTime;
uint16_t OldGain; /**< gain multiplier */
uint32_t OldCoarseIntegrationTime;
uint32_t OldFineIntegrationTime;
uint32_t preview_minimum_framerate;
IsiSensorMipiInfo IsiSensorMipiInfo;
} VIRTUAL_MIPI_Context_t;
#ifdef __cplusplus
}
#endif
#endif
2.VIRTUAL_MIPI_YUV/VIRTUAL_PARREL.c
/******************************************************************************
*
* The copyright in this software is owned by Rockchip and/or its licensors.
* This software is made available subject to the conditions of the license
* terms to be determined and negotiated by Rockchip and you.
* THIS SOFTWARE IS PROVIDED TO YOU ON AN "AS IS" BASIS and ROCKCHP AND/OR
* ITS LICENSORS DISCLAIMS ANY AND ALL WARRANTIES AND REPRESENTATIONS WITH
* RESPECT TO SUCH SOFTWARE, WHETHER EXPRESS,IMPLIED, STATUTORY OR OTHERWISE,
* INCLUDING WITHOUT LIMITATION, ANY IMPLIED WARRANTIES OF TITLE, NON-INFRINGEMENT,
* MERCHANTABILITY, SATISFACTROY QUALITY, ACCURACY OR FITNESS FOR A PARTICULAR PURPOSE.
* Except as expressively authorized by Rockchip and/or its licensors, you may not
* (a) disclose, distribute, sell, sub-license, or transfer this software to any third party,
* in whole or part; (b) modify this software, in whole or part; (c) decompile, reverse-engineer,
* dissemble, or attempt to derive any source code from the software.
*
*****************************************************************************/
/**
* @file VIRTUAL_MIPI.c
*
* @brief
* ADD_DESCRIPTION_HERE
*
*****************************************************************************/
#include <ebase/types.h>
#include <ebase/trace.h>
#include <ebase/builtins.h>
#include <common/return_codes.h>
#include <common/misc.h>
#include "isi.h"
#include "isi_iss.h"
#include "isi_priv.h"
#include "VIRTUAL_MIPI_priv.h"
#define CC_OFFSET_SCALING 2.0f
#define I2C_COMPLIANT_STARTBIT 1U
/******************************************************************************
* local macro definitions
*****************************************************************************/
CREATE_TRACER( VIRTUAL_MIPI_INFO , "VIRTUAL_MIPI: ", INFO, 1U );
CREATE_TRACER( VIRTUAL_MIPI_WARN , "VIRTUAL_MIPI: ", WARNING, 1U );
CREATE_TRACER( VIRTUAL_MIPI_ERROR, "VIRTUAL_MIPI: ", ERROR, 1U );
CREATE_TRACER( VIRTUAL_MIPI_DEBUG, "VIRTUAL_MIPI: ", INFO, 1U );
CREATE_TRACER( VIRTUAL_MIPI_REG_INFO , "VIRTUAL_MIPI: ", INFO, 1);
CREATE_TRACER( VIRTUAL_MIPI_REG_DEBUG, "VIRTUAL_MIPI: ", INFO, 0U );
#define VIRTUAL_MIPI_SLAVE_ADDR 0x84U //0x20 /**< i2c slave address of the VIRTUAL_MIPI camera sensor */
#define VIRTUAL_MIPI_SLAVE_ADDR2 0x00
#define VIRTUAL_MIPI_SLAVE_AF_ADDR 0x00U /**< i2c slave address of the VIRTUAL_MIPI integrated AD5820 */
/******************************************************************************
* local variable declarations
*****************************************************************************/
const char VIRTUAL_MIPI_g_acName[] = "VIRTUAL_MIPI_ SOC_PARREL";
extern const IsiRegDescription_t VIRTUAL_MIPI_g_aRegDescription[];
extern const IsiRegDescription_t VIRTUAL_MIPI_g_svga[];
extern const IsiRegDescription_t VIRTUAL_MIPI_g_1600x1200[];
const IsiSensorCaps_t VIRTUAL_MIPI_g_IsiSensorDefaultConfig;
#define VIRTUAL_MIPI_I2C_START_BIT (I2C_COMPLIANT_STARTBIT) // I2C bus start condition
#define VIRTUAL_MIPI_I2C_NR_ADR_BYTES (2U) // 1 byte base address and 2 bytes sub address
#define VIRTUAL_MIPI_I2C_NR_DAT_BYTES (1U) // 8 bit registers
static uint16_t g_suppoted_mipi_lanenum_type = SUPPORT_MIPI_TWO_LANE;
#define DEFAULT_NUM_LANES SUPPORT_MIPI_TWO_LANE
/******************************************************************************
* local function prototypes
*****************************************************************************/
static RESULT VIRTUAL_MIPI_IsiCreateSensorIss( IsiSensorInstanceConfig_t *pConfig );
static RESULT VIRTUAL_MIPI_IsiReleaseSensorIss( IsiSensorHandle_t handle );
static RESULT VIRTUAL_MIPI_IsiGetCapsIss( IsiSensorHandle_t handle, IsiSensorCaps_t *pIsiSensorCaps );
static RESULT VIRTUAL_MIPI_IsiSetupSensorIss( IsiSensorHandle_t handle, const IsiSensorConfig_t *pConfig );
static RESULT VIRTUAL_MIPI_IsiSensorSetStreamingIss( IsiSensorHandle_t handle, bool_t on );
static RESULT VIRTUAL_MIPI_IsiSensorSetPowerIss( IsiSensorHandle_t handle, bool_t on );
static RESULT VIRTUAL_MIPI_IsiCheckSensorConnectionIss( IsiSensorHandle_t handle );
static RESULT VIRTUAL_MIPI_IsiGetSensorRevisionIss( IsiSensorHandle_t handle, uint32_t *p_value);
static RESULT VIRTUAL_MIPI_IsiGetGainLimitsIss( IsiSensorHandle_t handle, float *pMinGain, float *pMaxGain);
static RESULT VIRTUAL_MIPI_IsiGetIntegrationTimeLimitsIss( IsiSensorHandle_t handle, float *pMinIntegrationTime, float *pMaxIntegrationTime );
static RESULT VIRTUAL_MIPI_IsiExposureControlIss( IsiSensorHandle_t handle, float NewGain, float NewIntegrationTime, uint8_t *pNumberOfFramesToSkip, float *pSetGain, float *pSetIntegrationTime );
static RESULT VIRTUAL_MIPI_IsiGetCurrentExposureIss( IsiSensorHandle_t handle, float *pSetGain, float *pSetIntegrationTime );
static RESULT VIRTUAL_MIPI_IsiGetAfpsInfoIss ( IsiSensorHandle_t handle, uint32_t Resolution, IsiAfpsInfo_t* pAfpsInfo);
static RESULT VIRTUAL_MIPI_IsiGetGainIss( IsiSensorHandle_t handle, float *pSetGain );
static RESULT VIRTUAL_MIPI_IsiGetGainIncrementIss( IsiSensorHandle_t handle, float *pIncr );
static RESULT VIRTUAL_MIPI_IsiSetGainIss( IsiSensorHandle_t handle, float NewGain, float *pSetGain );
static RESULT VIRTUAL_MIPI_IsiGetIntegrationTimeIss( IsiSensorHandle_t handle, float *pSetIntegrationTime );
static RESULT VIRTUAL_MIPI_IsiGetIntegrationTimeIncrementIss( IsiSensorHandle_t handle, float *pIncr );
static RESULT VIRTUAL_MIPI_IsiSetIntegrationTimeIss( IsiSensorHandle_t handle, float NewIntegrationTime, float *pSetIntegrationTime, uint8_t *pNumberOfFramesToSkip );
static RESULT VIRTUAL_MIPI_IsiGetResolutionIss( IsiSensorHandle_t handle, uint32_t *pSetResolution );
static RESULT VIRTUAL_MIPI_IsiRegReadIss( IsiSensorHandle_t handle, const uint32_t address, uint32_t *p_value );
static RESULT VIRTUAL_MIPI_IsiRegWriteIss( IsiSensorHandle_t handle, const uint32_t address, const uint32_t value );
static RESULT VIRTUAL_MIPI_IsiGetCalibKFactor( IsiSensorHandle_t handle, Isi1x1FloatMatrix_t **pIsiKFactor );
static RESULT VIRTUAL_MIPI_IsiGetCalibPcaMatrix( IsiSensorHandle_t handle, Isi3x2FloatMatrix_t **pIsiPcaMatrix );
static RESULT VIRTUAL_MIPI_IsiGetCalibSvdMeanValue( IsiSensorHandle_t handle, Isi3x1FloatMatrix_t **pIsiSvdMeanValue );
static RESULT VIRTUAL_MIPI_IsiGetCalibCenterLine( IsiSensorHandle_t handle, IsiLine_t **ptIsiCenterLine);
static RESULT VIRTUAL_MIPI_IsiGetCalibClipParam( IsiSensorHandle_t handle, IsiAwbClipParm_t **pIsiClipParam );
static RESULT VIRTUAL_MIPI_IsiGetCalibGlobalFadeParam( IsiSensorHandle_t handle, IsiAwbGlobalFadeParm_t **ptIsiGlobalFadeParam);
static RESULT VIRTUAL_MIPI_IsiGetCalibFadeParam( IsiSensorHandle_t handle, IsiAwbFade2Parm_t **ptIsiFadeParam);
static RESULT VIRTUAL_MIPI_IsiGetIlluProfile( IsiSensorHandle_t handle, const uint32_t CieProfile, IsiIlluProfile_t **ptIsiIlluProfile );
static RESULT VIRTUAL_MIPI_IsiMdiInitMotoDriveMds( IsiSensorHandle_t handle );
static RESULT VIRTUAL_MIPI_IsiMdiSetupMotoDrive( IsiSensorHandle_t handle, uint32_t *pMaxStep );
static RESULT VIRTUAL_MIPI_IsiMdiFocusSet( IsiSensorHandle_t handle, const uint32_t Position );
static RESULT VIRTUAL_MIPI_IsiMdiFocusGet( IsiSensorHandle_t handle, uint32_t *pAbsStep );
static RESULT VIRTUAL_MIPI_IsiMdiFocusCalibrate( IsiSensorHandle_t handle );
static RESULT VIRTUAL_MIPI_IsiGetSensorMipiInfoIss( IsiSensorHandle_t handle, IsiSensorMipiInfo *ptIsiSensorMipiInfo);
static RESULT VIRTUAL_MIPI_IsiGetSensorIsiVersion( IsiSensorHandle_t handle, unsigned int* pVersion);
/*****************************************************************************/
/**
* VIRTUAL_MIPI_IsiCreateSensorIss
*
* @brief This function creates a new VIRTUAL_MIPI sensor instance handle.
*
* @param pConfig configuration structure to create the instance
*
* @return Return the result of the function call.
* @retval RET_SUCCESS
* @retval RET_NULL_POINTER
* @retval RET_OUTOFMEM
*
*****************************************************************************/
static RESULT VIRTUAL_MIPI_IsiCreateSensorIss
(
IsiSensorInstanceConfig_t *pConfig
)
{
RESULT result = RET_SUCCESS;
VIRTUAL_MIPI_Context_t *pVIRTUAL_MIPICtx;
TRACE( VIRTUAL_MIPI_INFO, "%s (enter)\n", __FUNCTION__);
if ( (pConfig == NULL) || (pConfig->pSensor ==NULL) )
{
return ( RET_NULL_POINTER );
}
pVIRTUAL_MIPICtx = ( VIRTUAL_MIPI_Context_t * )malloc ( sizeof (VIRTUAL_MIPI_Context_t) );
if ( pVIRTUAL_MIPICtx == NULL )
{
TRACE( VIRTUAL_MIPI_ERROR, "%s: Can't allocate ov14825 context\n", __FUNCTION__ );
return ( RET_OUTOFMEM );
}
MEMSET( pVIRTUAL_MIPICtx, 0, sizeof( VIRTUAL_MIPI_Context_t ) );
result = HalAddRef( pConfig->HalHandle );
if ( result != RET_SUCCESS )
{
free ( pVIRTUAL_MIPICtx );
return ( result );
}
pVIRTUAL_MIPICtx->IsiCtx.HalHandle = pConfig->HalHandle;
pVIRTUAL_MIPICtx->IsiCtx.HalDevID = pConfig->HalDevID;
pVIRTUAL_MIPICtx->IsiCtx.I2cBusNum = pConfig->I2cBusNum;
pVIRTUAL_MIPICtx->IsiCtx.SlaveAddress = ( pConfig->SlaveAddr == 0 ) ? VIRTUAL_MIPI_SLAVE_ADDR : pConfig->SlaveAddr;
pVIRTUAL_MIPICtx->IsiCtx.NrOfAddressBytes = 2U;
pVIRTUAL_MIPICtx->IsiCtx.I2cAfBusNum = pConfig->I2cAfBusNum;
pVIRTUAL_MIPICtx->IsiCtx.SlaveAfAddress = ( pConfig->SlaveAfAddr == 0 ) ? VIRTUAL_MIPI_SLAVE_AF_ADDR : pConfig->SlaveAfAddr;
pVIRTUAL_MIPICtx->IsiCtx.NrOfAfAddressBytes = 0;
pVIRTUAL_MIPICtx->IsiCtx.pSensor = pConfig->pSensor;
pVIRTUAL_MIPICtx->Configured = BOOL_FALSE;
pVIRTUAL_MIPICtx->Streaming = BOOL_FALSE;
pVIRTUAL_MIPICtx->TestPattern = BOOL_FALSE;
pVIRTUAL_MIPICtx->isAfpsRun = BOOL_FALSE;
pVIRTUAL_MIPICtx->IsiSensorMipiInfo.sensorHalDevID = pVIRTUAL_MIPICtx->IsiCtx.HalDevID;
if(pConfig->mipiLaneNum & g_suppoted_mipi_lanenum_type){
pVIRTUAL_MIPICtx->IsiSensorMipiInfo.ucMipiLanes = pConfig->mipiLaneNum;
}else{
TRACE( VIRTUAL_MIPI_ERROR, "%s don't support lane numbers :%d,set to default %d\n", __FUNCTION__,pConfig->mipiLaneNum,DEFAULT_NUM_LANES);
pVIRTUAL_MIPICtx->IsiSensorMipiInfo.ucMipiLanes = DEFAULT_NUM_LANES;
}
pConfig->hSensor = ( IsiSensorHandle_t )pVIRTUAL_MIPICtx;
result = HalSetCamConfig( pVIRTUAL_MIPICtx->IsiCtx.HalHandle, pVIRTUAL_MIPICtx->IsiCtx.HalDevID, true, true, false );
RETURN_RESULT_IF_DIFFERENT( RET_SUCCESS, result );
result = HalSetClock( pVIRTUAL_MIPICtx->IsiCtx.HalHandle, pVIRTUAL_MIPICtx->IsiCtx.HalDevID, 10000000U);
RETURN_RESULT_IF_DIFFERENT( RET_SUCCESS, result );
TRACE( VIRTUAL_MIPI_INFO, "%s (exit)\n", __FUNCTION__);
return ( result );
}
/*****************************************************************************/
/**
* VIRTUAL_MIPI_IsiReleaseSensorIss
*
* @brief This function destroys/releases an VIRTUAL_MIPI sensor instance.
*
* @param handle VIRTUAL_MIPI sensor instance handle
*
* @return Return the result of the function call.
* @retval RET_SUCCESS
* @retval RET_WRONG_HANDLE
*
*****************************************************************************/
static RESULT VIRTUAL_MIPI_IsiReleaseSensorIss
(
IsiSensorHandle_t handle
)
{
VIRTUAL_MIPI_Context_t *pVIRTUAL_MIPICtx = (VIRTUAL_MIPI_Context_t *)handle;
RESULT result = RET_SUCCESS;
TRACE( VIRTUAL_MIPI_INFO, "%s (enter)\n", __FUNCTION__);
if ( pVIRTUAL_MIPICtx == NULL )
{
return ( RET_WRONG_HANDLE );
}
(void)VIRTUAL_MIPI_IsiSensorSetStreamingIss( pVIRTUAL_MIPICtx, BOOL_FALSE );
(void)VIRTUAL_MIPI_IsiSensorSetPowerIss( pVIRTUAL_MIPICtx, BOOL_FALSE );
(void)HalDelRef( pVIRTUAL_MIPICtx->IsiCtx.HalHandle );
MEMSET( pVIRTUAL_MIPICtx, 0, sizeof( VIRTUAL_MIPI_Context_t ) );
free ( pVIRTUAL_MIPICtx );
TRACE( VIRTUAL_MIPI_INFO, "%s (exit)\n", __FUNCTION__);
return ( result );
}
/*****************************************************************************/
/**
* VIRTUAL_MIPI_IsiGetCapsIss
*
* @brief fills in the correct pointers for the sensor description struct
*
* @param param1 pointer to sensor capabilities structure
*
* @return Return the result of the function call.
* @retval RET_SUCCESS
* @retval RET_NULL_POINTER
*
*****************************************************************************/
static RESULT VIRTUAL_MIPI_IsiGetCapsIssInternal
(
IsiSensorCaps_t *pIsiSensorCaps,
uint32_t mipi_lanes
)
{
RESULT result = RET_SUCCESS;
TRACE( VIRTUAL_MIPI_INFO, "%s (enter)\n", __FUNCTION__);
if ( pIsiSensorCaps == NULL )
{
return ( RET_NULL_POINTER );
}
else
{
if(mipi_lanes == SUPPORT_MIPI_FOUR_LANE){
switch (pIsiSensorCaps->Index)
{
default:
{
result = RET_OUTOFRANGE;
goto end;
}
}
} else if(mipi_lanes == SUPPORT_MIPI_TWO_LANE) {
switch (pIsiSensorCaps->Index)
{
case 0:
{
pIsiSensorCaps->Resolution = ISI_RES_1600_1200P7;
break;
}
case 1:
{
pIsiSensorCaps->Resolution = ISI_RES_SVGAP30;
break;
}
default:
{
result = RET_OUTOFRANGE;
goto end;
}
}
} else if(mipi_lanes == SUPPORT_MIPI_ONE_LANE) {
switch (pIsiSensorCaps->Index)
{
default:
{
result = RET_OUTOFRANGE;
goto end;
}
}
}
pIsiSensorCaps->BusWidth = ISI_BUSWIDTH_8BIT_ZZ;
pIsiSensorCaps->Mode = ISI_MODE_BT601;
pIsiSensorCaps->FieldSelection = ISI_FIELDSEL_BOTH;
pIsiSensorCaps->YCSequence = ISI_YCSEQ_YCBYCR|ISI_YCSEQ_CBYCRY;
pIsiSensorCaps->Conv422 = ISI_CONV422_NOCOSITED;
pIsiSensorCaps->BPat = ISI_BPAT_RGRGGBGB ;
pIsiSensorCaps->HPol = ISI_HPOL_REFPOS;
pIsiSensorCaps->VPol = ISI_VPOL_POS;
pIsiSensorCaps->Edge = ISI_EDGE_RISING;
pIsiSensorCaps->Bls = ISI_BLS_OFF;
pIsiSensorCaps->Gamma = ISI_GAMMA_ON;
pIsiSensorCaps->CConv = ISI_CCONV_ON;
pIsiSensorCaps->BLC = ( ISI_BLC_AUTO );
pIsiSensorCaps->AGC = ( ISI_AGC_AUTO );
pIsiSensorCaps->AWB = ( ISI_AWB_AUTO );
pIsiSensorCaps->AEC = ( ISI_AEC_AUTO );
pIsiSensorCaps->DPCC = ( ISI_DPCC_AUTO );
pIsiSensorCaps->DwnSz = ISI_DWNSZ_SUBSMPL;
pIsiSensorCaps->CieProfile = 0;
pIsiSensorCaps->SmiaMode = ISI_SMIA_OFF;
pIsiSensorCaps->MipiMode = ISI_MIPI_MODE_YUV422_8;
pIsiSensorCaps->AfpsResolutions = ( ISI_AFPS_NOTSUPP );
pIsiSensorCaps->SensorOutputMode = ISI_SENSOR_OUTPUT_MODE_YUV;
}
end:
TRACE( VIRTUAL_MIPI_INFO, "%s (exit)\n", __FUNCTION__);
return ( result );
}
static RESULT VIRTUAL_MIPI_IsiGetCapsIss
(
IsiSensorHandle_t handle,
IsiSensorCaps_t *pIsiSensorCaps
)
{
VIRTUAL_MIPI_Context_t *pVIRTUAL_MIPICtx = (VIRTUAL_MIPI_Context_t *)handle;
RESULT result = RET_SUCCESS;
TRACE( VIRTUAL_MIPI_INFO, "%s (enter)\n", __FUNCTION__);
if ( pVIRTUAL_MIPICtx == NULL )
{
return ( RET_WRONG_HANDLE );
}
result = VIRTUAL_MIPI_IsiGetCapsIssInternal(pIsiSensorCaps, pVIRTUAL_MIPICtx->IsiSensorMipiInfo.ucMipiLanes);
TRACE( VIRTUAL_MIPI_INFO, "%s (exit)\n", __FUNCTION__);
return ( result );
}
/*****************************************************************************/
/**
* VIRTUAL_MIPI_g_IsiSensorDefaultConfig
*
* @brief recommended default configuration for application use via call
* to IsiGetSensorIss()
*
*****************************************************************************/
const IsiSensorCaps_t VIRTUAL_MIPI_g_IsiSensorDefaultConfig =
{
ISI_BUSWIDTH_8BIT_ZZ, // BusWidth
ISI_MODE_BT601, //ISI_MODE_MIPI, // MIPI
ISI_FIELDSEL_BOTH, // FieldSel
ISI_YCSEQ_YCBYCR, // YCSeq
ISI_CONV422_NOCOSITED, // Conv422
ISI_BPAT_RGRGGBGB,//ISI_BPAT_BGBGGRGR, // BPat
ISI_HPOL_REFPOS, // HPol
ISI_VPOL_POS, // VPol
ISI_EDGE_RISING, // Edge
ISI_BLS_OFF, // Bls
ISI_GAMMA_ON, // Gamma
ISI_CCONV_ON, // CConv
ISI_RES_SVGAP30, // Res
ISI_DWNSZ_SUBSMPL, // DwnSz
ISI_BLC_AUTO, // BLC
ISI_AGC_AUTO, // AGC
ISI_AWB_AUTO, // AWB
ISI_AEC_AUTO, // AEC
ISI_DPCC_AUTO, // DPCC
0, // CieProfile, this is also used as start profile for AWB (if not altered by menu settings)
ISI_SMIA_OFF, // SmiaMode
ISI_MIPI_MODE_YUV422_8, // MipiMode
ISI_AFPS_NOTSUPP, // AfpsResolutions
ISI_SENSOR_OUTPUT_MODE_YUV,
0,
};
/*****************************************************************************/
/**
* VIRTUAL_MIPI_SetupOutputFormat
*
* @brief Setup of the image sensor considering the given configuration.
*
* @param handle VIRTUAL_MIPI sensor instance handle
* @param pConfig pointer to sensor configuration structure
*
* @return Return the result of the function call.
* @retval RET_SUCCESS
* @retval RET_NULL_POINTER
*
*****************************************************************************/
RESULT VIRTUAL_MIPI_SetupOutputFormat
(
VIRTUAL_MIPI_Context_t *pVIRTUAL_MIPICtx,
const IsiSensorConfig_t *pConfig
)
{
RESULT result = RET_SUCCESS;
return result;
TRACE( VIRTUAL_MIPI_INFO, "%s%s (enter)\n", __FUNCTION__, pVIRTUAL_MIPICtx->isAfpsRun?"(AFPS)":"" );
/* bus-width */
switch ( pConfig->BusWidth ) /* only ISI_BUSWIDTH_12BIT supported, no configuration needed here */
{
//case ISI_BUSWIDTH_12BIT:
case ISI_BUSWIDTH_8BIT_ZZ:
//case ISI_BUSWIDTH_12BIT:
{
break;
}
default:
{
TRACE( VIRTUAL_MIPI_ERROR, "%s%s: bus width not supported\n", __FUNCTION__, pVIRTUAL_MIPICtx->isAfpsRun?"(AFPS)":"" );
return ( RET_NOTSUPP );
}
}
/* mode */
switch ( pConfig->Mode ) /* only ISI_MODE_BAYER supported, no configuration needed here */
{
case( ISI_MODE_MIPI ):
case ISI_MODE_BAYER:
case ISI_MODE_BT601:
case ISI_MODE_PICT:
case ISI_MODE_DATA:
{
break;
}
default:
{
TRACE( VIRTUAL_MIPI_ERROR, "%s%s: mode not supported\n", __FUNCTION__, pVIRTUAL_MIPICtx->isAfpsRun?"(AFPS)":"" );
return ( RET_NOTSUPP );
}
}
/* field-selection */
switch ( pConfig->FieldSelection ) /* only ISI_FIELDSEL_BOTH supported, no configuration needed */
{
case ISI_FIELDSEL_BOTH:
{
break;
}
default:
{
TRACE( VIRTUAL_MIPI_ERROR, "%s%s: field selection not supported\n", __FUNCTION__, pVIRTUAL_MIPICtx->isAfpsRun?"(AFPS)":"" );
return ( RET_NOTSUPP );
}
}
switch ( pConfig->YCSequence )
{
default:
{
break;
}
}
/* 422 conversion */
switch ( pConfig->Conv422 ) /* only ISI_CONV422_NOCOSITED supported, no configuration needed */
{
case ISI_CONV422_NOCOSITED:
case ISI_CONV422_COSITED:
case ISI_CONV422_INTER:
{
break;
}
default:
{
TRACE( VIRTUAL_MIPI_ERROR, "%s%s: 422 conversion not supported\n", __FUNCTION__, pVIRTUAL_MIPICtx->isAfpsRun?"(AFPS)":"" );
return ( RET_NOTSUPP );
}
}
/* bayer-pattern */
switch ( pConfig->BPat ) /* only ISI_BPAT_BGBGGRGR supported, no configuration needed */
{
case ISI_BPAT_BGBGGRGR:
case ISI_BPAT_RGRGGBGB:
{
break;
}
default:
{
TRACE( VIRTUAL_MIPI_ERROR, "%s%s: bayer pattern not supported\n", __FUNCTION__, pVIRTUAL_MIPICtx->isAfpsRun?"(AFPS)":"" );
return ( RET_NOTSUPP );
}
}
/* horizontal polarity */
switch ( pConfig->HPol ) /* only ISI_HPOL_REFPOS supported, no configuration needed */
{
case ISI_HPOL_REFPOS:
{
break;
}
default:
{
TRACE( VIRTUAL_MIPI_ERROR, "%s%s: HPol not supported\n", __FUNCTION__, pVIRTUAL_MIPICtx->isAfpsRun?"(AFPS)":"" );
return ( RET_NOTSUPP );
}
}
/* vertical polarity */
switch ( pConfig->VPol ) /*no configuration needed */
{
case ISI_VPOL_NEG:
{
break;
}
case ISI_VPOL_POS:
{
break;
}
default:
{
TRACE( VIRTUAL_MIPI_ERROR, "%s%s: VPol not supported\n", __FUNCTION__, pVIRTUAL_MIPICtx->isAfpsRun?"(AFPS)":"" );
return ( RET_NOTSUPP );
}
}
/* edge */
switch ( pConfig->Edge ) /* only ISI_EDGE_RISING supported, no configuration needed */
{
case ISI_EDGE_RISING:
{
break;
}
case ISI_EDGE_FALLING: /*TODO for MIPI debug*/
{
break;
}
default:
{
TRACE( VIRTUAL_MIPI_ERROR, "%s%s: edge mode not supported\n", __FUNCTION__, pVIRTUAL_MIPICtx->isAfpsRun?"(AFPS)":"" );
return ( RET_NOTSUPP );
}
}
/* gamma */
switch ( pConfig->Gamma ) /* only ISI_GAMMA_OFF supported, no configuration needed */
{
case ISI_GAMMA_ON:
case ISI_GAMMA_OFF:
{
break;
}
default:
{
TRACE( VIRTUAL_MIPI_ERROR, "%s%s: gamma not supported\n", __FUNCTION__, pVIRTUAL_MIPICtx->isAfpsRun?"(AFPS)":"" );
return ( RET_NOTSUPP );
}
}
/* color conversion */
switch ( pConfig->CConv ) /* only ISI_CCONV_OFF supported, no configuration needed */
{
case ISI_CCONV_OFF:
case ISI_CCONV_ON:
{
break;
}
default:
{
TRACE( VIRTUAL_MIPI_ERROR, "%s%s: color conversion not supported\n", __FUNCTION__, pVIRTUAL_MIPICtx->isAfpsRun?"(AFPS)":"" );
return ( RET_NOTSUPP );
}
}
switch ( pConfig->SmiaMode ) /* only ISI_SMIA_OFF supported, no configuration needed */
{
case ISI_SMIA_OFF:
{
break;
}
default:
{
TRACE( VIRTUAL_MIPI_ERROR, "%s%s: SMIA mode not supported\n", __FUNCTION__, pVIRTUAL_MIPICtx->isAfpsRun?"(AFPS)":"" );
return ( RET_NOTSUPP );
}
}
switch ( pConfig->MipiMode ) /* only ISI_MIPI_MODE_RAW_12 supported, no configuration needed */
{
case ISI_MIPI_MODE_RAW_10:
case ISI_MIPI_MODE_YUV422_8:
case ISI_MIPI_OFF:
{
break;
}
default:
{
TRACE( VIRTUAL_MIPI_ERROR, "%s%s: MIPI mode not supported\n", __FUNCTION__, pVIRTUAL_MIPICtx->isAfpsRun?"(AFPS)":"" );
return ( RET_NOTSUPP );
}
}
switch ( pConfig->AfpsResolutions ) /* no configuration needed */
{
case ISI_AFPS_NOTSUPP:
{
break;
}
default:
{
// don't care about what comes in here
//TRACE( VIRTUAL_MIPI_ERROR, "%s%s: AFPS not supported\n", __FUNCTION__, pVIRTUAL_MIPICtx->isAfpsRun?"(AFPS)":"" );
//return ( RET_NOTSUPP );
}
}
TRACE( VIRTUAL_MIPI_INFO, "%s%s (exit)\n", __FUNCTION__, pVIRTUAL_MIPICtx->isAfpsRun?"(AFPS)":"");
return ( result );
}
int VIRTUAL_MIPI_get_PCLK( VIRTUAL_MIPI_Context_t *pVIRTUAL_MIPICtx, int XVCLK)
{
// calculate PCLK
return 0;
}
/*****************************************************************************/
/**
* VIRTUAL_MIPI_SetupOutputWindow
*
* @brief Setup of the image sensor considering the given configuration.
*
* @param handle VIRTUAL_MIPI sensor instance handle
* @param pConfig pointer to sensor configuration structure
*
* @return Return the result of the function call.
* @retval RET_SUCCESS
* @retval RET_NULL_POINTER
*
*****************************************************************************/
static RESULT VIRTUAL_MIPI_SetupOutputWindow
(
VIRTUAL_MIPI_Context_t *pVIRTUAL_MIPICtx,
const IsiSensorConfig_t *pConfig
)
{
RESULT result = RET_SUCCESS;
TRACE( VIRTUAL_MIPI_ERROR, "%s (enter.....)\n", __FUNCTION__);
pVIRTUAL_MIPICtx->IsiSensorMipiInfo.ulMipiFreq = 528; //420; //680; //620; //480; //580; //528; //328;
/* resolution */
#ifdef HW_SENSOR
switch ( pConfig->Resolution )
{
case ISI_RES_SVGAP30:
{
if((result = IsiRegDefaultsApply((IsiSensorHandle_t)pVIRTUAL_MIPICtx,VIRTUAL_MIPI_g_svga)) != RET_SUCCESS){
TRACE( VIRTUAL_MIPI_ERROR, "%s: failed to set ISI_RES_SVGAP30 \n", __FUNCTION__ );
}else{
TRACE( VIRTUAL_MIPI_ERROR, "%s: success to set ISI_RES_SVGAP30 \n", __FUNCTION__ );
}
break;
}
case ISI_RES_1600_1200P7:
{
if((result = IsiRegDefaultsApply((IsiSensorHandle_t)pVIRTUAL_MIPICtx,VIRTUAL_MIPI_g_1600x1200)) != RET_SUCCESS){
TRACE( VIRTUAL_MIPI_ERROR, "%s: failed to set ISI_RES_1600_1200P7 \n", __FUNCTION__ );
}else{
TRACE( VIRTUAL_MIPI_INFO, "%s: success to set ISI_RES_1600_1200P7 \n", __FUNCTION__ );
}
break;
}
default:
{
TRACE( VIRTUAL_MIPI_ERROR, "%s: Resolution not supported\n", __FUNCTION__ );
return ( RET_NOTSUPP );
}
}
#endif
return ( result );
}
/*****************************************************************************/
/**
* VIRTUAL_MIPI_SetupImageControl
*
* @brief Sets the image control functions (BLC, AGC, AWB, AEC, DPCC ...)
*
* @param handle VIRTUAL_MIPI sensor instance handle
* @param pConfig pointer to sensor configuration structure
*
* @return Return the result of the function call.
* @retval RET_SUCCESS
* @retval RET_NULL_POINTER
*
*****************************************************************************/
RESULT VIRTUAL_MIPI_SetupImageControl
(
VIRTUAL_MIPI_Context_t *pVIRTUAL_MIPICtx,
const IsiSensorConfig_t *pConfig
)
{
RESULT result = RET_SUCCESS;
uint32_t RegValue = 0U;
TRACE( VIRTUAL_MIPI_INFO, "%s (enter)\n", __FUNCTION__);
return ( result );
}
/*****************************************************************************/
/**
* VIRTUAL_MIPI_AecSetModeParameters
*
* @brief This function fills in the correct parameters in VIRTUAL_MIPI-Instances
* according to AEC mode selection in IsiSensorConfig_t.
*
* @note It is assumed that IsiSetupOutputWindow has been called before
* to fill in correct values in instance structure.
*
* @param handle VIRTUAL_MIPI context
* @param pConfig pointer to sensor configuration structure
*
* @return Return the result of the function call.
* @retval RET_SUCCESS
* @retval RET_NULL_POINTER
*
*****************************************************************************/
static RESULT VIRTUAL_MIPI_AecSetModeParameters
(
VIRTUAL_MIPI_Context_t *pVIRTUAL_MIPICtx,
const IsiSensorConfig_t *pConfig
)
{
RESULT result = RET_SUCCESS;
return ( result );
}
//static int int11;
/*****************************************************************************/
/**
* VIRTUAL_MIPI_IsiSetupSensorIss
*
* @brief Setup of the image sensor considering the given configuration.
*
* @param handle VIRTUAL_MIPI sensor instance handle
* @param pConfig pointer to sensor configuration structure
*
* @return Return the result of the function call.
* @retval RET_SUCCESS
* @retval RET_NULL_POINTER
*
*****************************************************************************/
static RESULT VIRTUAL_MIPI_IsiSetupSensorIss
(
IsiSensorHandle_t handle,
const IsiSensorConfig_t *pConfig
)
{
VIRTUAL_MIPI_Context_t *pVIRTUAL_MIPICtx = (VIRTUAL_MIPI_Context_t *)handle;
RESULT result = RET_SUCCESS;
uint32_t RegValue = 0;
TRACE( VIRTUAL_MIPI_INFO, "%s (enter)\n", __FUNCTION__);
if ( pVIRTUAL_MIPICtx == NULL )
{
TRACE( VIRTUAL_MIPI_ERROR, "%s: Invalid sensor handle (NULL pointer detected)\n", __FUNCTION__ );
return ( RET_WRONG_HANDLE );
}
if ( pConfig == NULL )
{
TRACE( VIRTUAL_MIPI_ERROR, "%s: Invalid configuration (NULL pointer detected)\n", __FUNCTION__ );
return ( RET_NULL_POINTER );
}
if ( pVIRTUAL_MIPICtx->Streaming != BOOL_FALSE )
{
return RET_WRONG_STATE;
}
MEMCPY( &pVIRTUAL_MIPICtx->Config, pConfig, sizeof( IsiSensorConfig_t ) );
TRACE( VIRTUAL_MIPI_ERROR, "%s (enter)\n", __FUNCTION__);
TRACE( VIRTUAL_MIPI_ERROR, "%s (enter).........\n", __FUNCTION__);
#ifdef HW_SENSOR
/* 2.) write default values derived from datasheet and evaluation kit (static setup altered by dynamic setup further below) */
result = IsiRegDefaultsApply( pVIRTUAL_MIPICtx, VIRTUAL_MIPI_g_aRegDescription );
if ( result != RET_SUCCESS )
{
return ( result );
}
/* sleep a while, that sensor can take over new default values */
osSleep( 10 );
#if 0
/* 3.) verify default values to make sure everything has been written correctly as expected */
result = IsiRegDefaultsVerify( pVIRTUAL_MIPICtx, VIRTUAL_MIPI_g_aRegDescription );
if ( result != RET_SUCCESS )
{
return ( result );
}
// output of pclk for measurement (only debugging)
result = VIRTUAL_MIPI_IsiRegWriteIss( pVIRTUAL_MIPICtx, 0x3009U, 0x10U );
RETURN_RESULT_IF_DIFFERENT( RET_SUCCESS, result );
#endif
#endif
/* 4.) setup output format (RAW10|RAW12) */
result = VIRTUAL_MIPI_SetupOutputFormat( pVIRTUAL_MIPICtx, pConfig );
if ( result != RET_SUCCESS )
{
TRACE( VIRTUAL_MIPI_ERROR, "%s: SetupOutputFormat failed.\n", __FUNCTION__);
return ( result );
}
/* 5.) setup output window */
result = VIRTUAL_MIPI_SetupOutputWindow( pVIRTUAL_MIPICtx, pConfig );
if ( result != RET_SUCCESS )
{
TRACE( VIRTUAL_MIPI_ERROR, "%s: SetupOutputWindow failed.\n", __FUNCTION__);
return ( result );
}
#ifdef HW_SENSOR
result = VIRTUAL_MIPI_SetupImageControl( pVIRTUAL_MIPICtx, pConfig );
if ( result != RET_SUCCESS )
{
TRACE( VIRTUAL_MIPI_ERROR, "%s: SetupImageControl failed.\n", __FUNCTION__);
return ( result );
}
result = VIRTUAL_MIPI_AecSetModeParameters( pVIRTUAL_MIPICtx, pConfig );
if ( result != RET_SUCCESS )
{
TRACE( VIRTUAL_MIPI_ERROR, "%s: AecSetModeParameters failed.\n", __FUNCTION__);
return ( result );
}
#endif
if (result == RET_SUCCESS)
{
pVIRTUAL_MIPICtx->Configured = BOOL_TRUE;
}
TRACE( VIRTUAL_MIPI_INFO, "%s: (exit)\n", __FUNCTION__);
return ( result );
}
/*****************************************************************************/
/**
* VIRTUAL_MIPI_IsiChangeSensorResolutionIss
*
* @brief Change image sensor resolution while keeping all other static settings.
* Dynamic settings like current gain & integration time are kept as
* close as possible. Sensor needs 2 frames to engage (first 2 frames
* are not correctly exposed!).
*
* @note Re-read current & min/max values as they will probably have changed!
*
* @param handle Sensor instance handle
* @param Resolution new resolution ID
* @param pNumberOfFramesToSkip reference to storage for number of frames to skip
*
* @return Return the result of the function call.
* @retval RET_SUCCESS
* @retval RET_WRONG_HANDLE
* @retval RET_WRONG_STATE
* @retval RET_OUTOFRANGE
*
*****************************************************************************/
static RESULT VIRTUAL_MIPI_IsiChangeSensorResolutionIss
(
IsiSensorHandle_t handle,
uint32_t Resolution,
uint8_t *pNumberOfFramesToSkip
)
{
VIRTUAL_MIPI_Context_t *pVIRTUAL_MIPICtx = (VIRTUAL_MIPI_Context_t *)handle;
RESULT result = RET_SUCCESS;
TRACE( VIRTUAL_MIPI_INFO, "%s (enter)\n", __FUNCTION__);
#ifdef HW_SENSOR
if ( pVIRTUAL_MIPICtx == NULL )
{
return ( RET_WRONG_HANDLE );
}
if (pNumberOfFramesToSkip == NULL)
{
return ( RET_NULL_POINTER );
}
if ( (pVIRTUAL_MIPICtx->Configured != BOOL_TRUE) || (pVIRTUAL_MIPICtx->Streaming != BOOL_FALSE) )
{
return RET_WRONG_STATE;
}
IsiSensorCaps_t Caps;
Caps.Index = 0;
Caps.Resolution = 0;
while (VIRTUAL_MIPI_IsiGetCapsIss( handle, &Caps) == RET_SUCCESS) {
if (Resolution == Caps.Resolution) {
break;
}
Caps.Index++;
}
if ( (Resolution & Caps.Resolution) == 0 )
{
return RET_OUTOFRANGE;
}
if ( Resolution == pVIRTUAL_MIPICtx->Config.Resolution )
{
// well, no need to worry
*pNumberOfFramesToSkip = 0;
}
else
{
// change resolution
char *szResName = NULL;
result = IsiGetResolutionName( Resolution, &szResName );
TRACE( VIRTUAL_MIPI_DEBUG, "%s: NewRes=0x%08x (%s)\n", __FUNCTION__, Resolution, szResName);
// update resolution in copy of config in context
pVIRTUAL_MIPICtx->Config.Resolution = Resolution;
// tell sensor about that
result = VIRTUAL_MIPI_SetupOutputWindow( pVIRTUAL_MIPICtx, &pVIRTUAL_MIPICtx->Config );
if ( result != RET_SUCCESS )
{
TRACE( VIRTUAL_MIPI_ERROR, "%s: SetupOutputWindow failed.\n", __FUNCTION__);
return ( result );
}
// remember old exposure values
float OldGain = pVIRTUAL_MIPICtx->AecCurGain;
float OldIntegrationTime = pVIRTUAL_MIPICtx->AecCurIntegrationTime;
// update limits & stuff (reset current & old settings)
result = VIRTUAL_MIPI_AecSetModeParameters( pVIRTUAL_MIPICtx, &pVIRTUAL_MIPICtx->Config );
if ( result != RET_SUCCESS )
{
TRACE( VIRTUAL_MIPI_ERROR, "%s: AecSetModeParameters failed.\n", __FUNCTION__);
return ( result );
}
// restore old exposure values (at least within new exposure values' limits)
uint8_t NumberOfFramesToSkip = 2;
float DummySetGain;
float DummySetIntegrationTime;
result = VIRTUAL_MIPI_IsiExposureControlIss( handle, OldGain, OldIntegrationTime, &NumberOfFramesToSkip, &DummySetGain, &DummySetIntegrationTime );
if ( result != RET_SUCCESS )
{
TRACE( VIRTUAL_MIPI_ERROR, "%s: VIRTUAL_MIPI_IsiExposureControlIss failed.\n", __FUNCTION__);
return ( result );
}
// return number of frames that aren't exposed correctly
*pNumberOfFramesToSkip = NumberOfFramesToSkip + 1;
}
#endif
TRACE( VIRTUAL_MIPI_INFO, "%s (exit)\n", __FUNCTION__);
return ( result );
}
/*****************************************************************************/
/**
* VIRTUAL_MIPI_IsiSensorSetStreamingIss
*
* @brief Enables/disables streaming of sensor data, if possible.
*
* @param handle Sensor instance handle
* @param on new streaming state (BOOL_TRUE=on, BOOL_FALSE=off)
*
* @return Return the result of the function call.
* @retval RET_SUCCESS
* @retval RET_WRONG_HANDLE
* @retval RET_WRONG_STATE
*
*****************************************************************************/
static RESULT VIRTUAL_MIPI_IsiSensorSetStreamingIss
(
IsiSensorHandle_t handle,
bool_t on
)
{
uint32_t RegValue = 0;
VIRTUAL_MIPI_Context_t *pVIRTUAL_MIPICtx = (VIRTUAL_MIPI_Context_t *)handle;
RESULT result = RET_SUCCESS;
TRACE( VIRTUAL_MIPI_INFO, "%s (enter)\n", __FUNCTION__);
if ( pVIRTUAL_MIPICtx == NULL )
{
return ( RET_WRONG_HANDLE );
}
if ( (pVIRTUAL_MIPICtx->Configured != BOOL_TRUE) || (pVIRTUAL_MIPICtx->Streaming == on) )
{
return RET_WRONG_STATE;
}
#ifdef HW_SENSOR
if (on == BOOL_TRUE)
{
/* enable streaming */
result = VIRTUAL_MIPI_IsiRegWriteIss( handle, 0x0100, 0x1);
result = VIRTUAL_MIPI_IsiRegWriteIss( handle, 0x4200, 0x0);
}
else
{
/* disable streaming */
result = VIRTUAL_MIPI_IsiRegWriteIss( handle, 0x0100, 0x0);
result = VIRTUAL_MIPI_IsiRegWriteIss( handle, 0x4200, 0x0f);
}
#endif
if (result == RET_SUCCESS)
{
pVIRTUAL_MIPICtx->Streaming = on;
}
TRACE( VIRTUAL_MIPI_INFO, "%s (exit)\n", __FUNCTION__);
return ( result );
}
/*****************************************************************************/
/**
* VIRTUAL_MIPI_IsiSensorSetPowerIss
*
* @brief Performs the power-up/power-down sequence of the camera, if possible.
*
* @param handle VIRTUAL_MIPI sensor instance handle
* @param on new power state (BOOL_TRUE=on, BOOL_FALSE=off)
*
* @return Return the result of the function call.
* @retval RET_SUCCESS
* @retval RET_NULL_POINTER
*
*****************************************************************************/
static RESULT VIRTUAL_MIPI_IsiSensorSetPowerIss
(
IsiSensorHandle_t handle,
bool_t on
)
{
VIRTUAL_MIPI_Context_t *pVIRTUAL_MIPICtx = (VIRTUAL_MIPI_Context_t *)handle;
RESULT result = RET_SUCCESS;
TRACE( VIRTUAL_MIPI_INFO, "%s (enter)\n", __FUNCTION__);
if ( pVIRTUAL_MIPICtx == NULL )
{
return ( RET_WRONG_HANDLE );
}
pVIRTUAL_MIPICtx->Configured = BOOL_FALSE;
pVIRTUAL_MIPICtx->Streaming = BOOL_FALSE;
TRACE( VIRTUAL_MIPI_DEBUG, "%s power off \n", __FUNCTION__);
result = HalSetPower( pVIRTUAL_MIPICtx->IsiCtx.HalHandle, pVIRTUAL_MIPICtx->IsiCtx.HalDevID, false );
RETURN_RESULT_IF_DIFFERENT( RET_SUCCESS, result );
TRACE( VIRTUAL_MIPI_DEBUG, "%s reset on\n", __FUNCTION__);
result = HalSetReset( pVIRTUAL_MIPICtx->IsiCtx.HalHandle, pVIRTUAL_MIPICtx->IsiCtx.HalDevID, true );
RETURN_RESULT_IF_DIFFERENT( RET_SUCCESS, result );
if (on == BOOL_TRUE)
{
TRACE( VIRTUAL_MIPI_DEBUG, "%s power on \n", __FUNCTION__);
result = HalSetPower( pVIRTUAL_MIPICtx->IsiCtx.HalHandle, pVIRTUAL_MIPICtx->IsiCtx.HalDevID, true );
RETURN_RESULT_IF_DIFFERENT( RET_SUCCESS, result );
osSleep( 10 );
TRACE( VIRTUAL_MIPI_DEBUG, "%s reset off \n", __FUNCTION__);
result = HalSetReset( pVIRTUAL_MIPICtx->IsiCtx.HalHandle, pVIRTUAL_MIPICtx->IsiCtx.HalDevID, false );
RETURN_RESULT_IF_DIFFERENT( RET_SUCCESS, result );
osSleep( 10 );
TRACE( VIRTUAL_MIPI_DEBUG, "%s reset on \n", __FUNCTION__);
result = HalSetReset( pVIRTUAL_MIPICtx->IsiCtx.HalHandle, pVIRTUAL_MIPICtx->IsiCtx.HalDevID, true );
RETURN_RESULT_IF_DIFFERENT( RET_SUCCESS, result );
osSleep( 10 );
TRACE( VIRTUAL_MIPI_DEBUG, "%s reset off \n", __FUNCTION__);
result = HalSetReset( pVIRTUAL_MIPICtx->IsiCtx.HalHandle, pVIRTUAL_MIPICtx->IsiCtx.HalDevID, false );
osSleep( 50 );
}
TRACE( VIRTUAL_MIPI_INFO, "%s (exit)\n", __FUNCTION__);
return ( result );
}
/*****************************************************************************/
/**
* VIRTUAL_MIPI_IsiCheckSensorConnectionIss
*
* @brief Checks the I2C-Connection to sensor by reading sensor revision id.
*
* @param handle VIRTUAL_MIPI sensor instance handle
*
* @return Return the result of the function call.
* @retval RET_SUCCESS
* @retval RET_NULL_POINTER
*
*****************************************************************************/
static RESULT VIRTUAL_MIPI_IsiCheckSensorConnectionIss
(
IsiSensorHandle_t handle
)
{
uint32_t RevId;
uint32_t value;
RESULT result = RET_SUCCESS;
TRACE( VIRTUAL_MIPI_INFO, "%s (enter)\n", __FUNCTION__);
if ( handle == NULL )
{
return ( RET_WRONG_HANDLE );
}
RevId = VIRTUAL_MIPI_CHIP_ID_HIGH_BYTE_DEFAULT;
RevId = (RevId << 16U) | (VIRTUAL_MIPI_CHIP_ID_MIDDLE_BYTE_DEFAULT<<8U);
RevId = RevId | VIRTUAL_MIPI_CHIP_ID_LOW_BYTE_DEFAULT;
result = VIRTUAL_MIPI_IsiGetSensorRevisionIss( handle, &value );
if ( (result != RET_SUCCESS) || (RevId != value) )
{
TRACE( VIRTUAL_MIPI_ERROR, "%s RevId = 0x%08x, value = 0x%08x \n", __FUNCTION__, RevId, value );
return ( RET_FAILURE );
}
TRACE( VIRTUAL_MIPI_DEBUG, "%s RevId = 0x%08x, value = 0x%08x \n", __FUNCTION__, RevId, value );
TRACE( VIRTUAL_MIPI_INFO, "%s (exit)\n", __FUNCTION__);
return ( result );
}
/*****************************************************************************/
/**
* VIRTUAL_MIPI_IsiGetSensorRevisionIss
*
* @brief reads the sensor revision register and returns this value
*
* @param handle pointer to sensor description struct
* @param p_value pointer to storage value
*
* @return Return the result of the function call.
* @retval RET_SUCCESS
* @retval RET_WRONG_HANDLE
* @retval RET_NULL_POINTER
*
*****************************************************************************/
static RESULT VIRTUAL_MIPI_IsiGetSensorRevisionIss
(
IsiSensorHandle_t handle,
uint32_t *p_value
)
{
RESULT result = RET_SUCCESS;
uint32_t data;
TRACE( VIRTUAL_MIPI_INFO, "%s (enter)\n", __FUNCTION__);
if ( handle == NULL )
{
return ( RET_WRONG_HANDLE );
}
if ( p_value == NULL )
{
return ( RET_NULL_POINTER );
}
*p_value = 0U;
#ifdef HW_SENSOR
result = VIRTUAL_MIPI_IsiRegReadIss ( handle, VIRTUAL_MIPI_CHIP_ID_HIGH_BYTE, &data );
*p_value = ( (data & 0xFF) << 16U );
result = VIRTUAL_MIPI_IsiRegReadIss ( handle, VIRTUAL_MIPI_CHIP_ID_MIDDLE_BYTE, &data );
*p_value |= ( (data & 0xFF) << 8U );
result = VIRTUAL_MIPI_IsiRegReadIss ( handle, VIRTUAL_MIPI_CHIP_ID_LOW_BYTE, &data );
*p_value |= ( (data & 0xFF));
#endif
TRACE( VIRTUAL_MIPI_INFO, "%s (exit)\n", __FUNCTION__);
return ( result );
}
/*****************************************************************************/
/**
* VIRTUAL_MIPI_IsiRegReadIss
*
* @brief grants user read access to the camera register
*
* @param handle pointer to sensor description struct
* @param address sensor register to write
* @param p_value pointer to value
*
* @return Return the result of the function call.
* @retval RET_SUCCESS
* @retval RET_WRONG_HANDLE
* @retval RET_NULL_POINTER
*
*****************************************************************************/
static RESULT VIRTUAL_MIPI_IsiRegReadIss
(
IsiSensorHandle_t handle,
const uint32_t address,
uint32_t *p_value
)
{
RESULT result = RET_SUCCESS;
// TRACE( VIRTUAL_MIPI_INFO, "%s (enter)\n", __FUNCTION__);
if ( handle == NULL )
{
return ( RET_WRONG_HANDLE );
}
if ( p_value == NULL )
{
return ( RET_NULL_POINTER );
}
else
{
uint8_t NrOfBytes = IsiGetNrDatBytesIss( address, VIRTUAL_MIPI_g_aRegDescription );
if ( !NrOfBytes )
{
NrOfBytes = 1;
}
// TRACE( VIRTUAL_MIPI_REG_DEBUG, "%s (IsiGetNrDatBytesIss %d 0x%08x)\n", __FUNCTION__, NrOfBytes, address);
*p_value = 0;
result = IsiI2cReadSensorRegister( handle, address, (uint8_t *)p_value, NrOfBytes, BOOL_TRUE );
}
// TRACE( VIRTUAL_MIPI_INFO, "%s (exit: 0x%08x 0x%08x)\n", __FUNCTION__, address, *p_value);
return ( result );
}
/*****************************************************************************/
/**
* VIRTUAL_MIPI_IsiRegWriteIss
*
* @brief grants user write access to the camera register
*
* @param handle pointer to sensor description struct
* @param address sensor register to write
* @param value value to write
*
* @return Return the result of the function call.
* @retval RET_SUCCESS
* @retval RET_WRONG_HANDLE
*
*****************************************************************************/
static RESULT VIRTUAL_MIPI_IsiRegWriteIss
(
IsiSensorHandle_t handle,
const uint32_t address,
const uint32_t value
)
{
RESULT result = RET_SUCCESS;
uint8_t NrOfBytes;
// TRACE( VIRTUAL_MIPI_INFO, "%s (enter)\n", __FUNCTION__);
if ( handle == NULL )
{
return ( RET_WRONG_HANDLE );
}
NrOfBytes = IsiGetNrDatBytesIss( address, VIRTUAL_MIPI_g_aRegDescription );
if ( !NrOfBytes )
{
NrOfBytes = 1;
}
// TRACE( VIRTUAL_MIPI_REG_DEBUG, "%s (IsiGetNrDatBytesIss %d 0x%08x 0x%08x)\n", __FUNCTION__, NrOfBytes, address, value);
result = IsiI2cWriteSensorRegister( handle, address, (uint8_t *)(&value), NrOfBytes, BOOL_TRUE );
// TRACE( VIRTUAL_MIPI_INFO, "%s (exit: 0x%08x 0x%08x)\n", __FUNCTION__, address, value);
return ( result );
}
/*****************************************************************************/
/**
* VIRTUAL_MIPI_IsiGetGainLimitsIss
*
* @brief Returns the exposure minimal and maximal values of an
* VIRTUAL_MIPI instance
*
* @param handle VIRTUAL_MIPI sensor instance handle
* @param pMinExposure Pointer to a variable receiving minimal exposure value
* @param pMaxExposure Pointer to a variable receiving maximal exposure value
*
* @return Return the result of the function call.
* @retval RET_SUCCESS
* @retval RET_NULL_POINTER
*
*****************************************************************************/
static RESULT VIRTUAL_MIPI_IsiGetGainLimitsIss
(
IsiSensorHandle_t handle,
float *pMinGain,
float *pMaxGain
)
{
VIRTUAL_MIPI_Context_t *pVIRTUAL_MIPICtx = (VIRTUAL_MIPI_Context_t *)handle;
RESULT result = RET_SUCCESS;
uint32_t RegValue = 0;
TRACE( VIRTUAL_MIPI_INFO, "%s: (enter)\n", __FUNCTION__);
if ( pVIRTUAL_MIPICtx == NULL )
{
TRACE( VIRTUAL_MIPI_ERROR, "%s: Invalid sensor handle (NULL pointer detected)\n", __FUNCTION__ );
return ( RET_WRONG_HANDLE );
}
if ( (pMinGain == NULL) || (pMaxGain == NULL) )
{
TRACE( VIRTUAL_MIPI_ERROR, "%s: NULL pointer received!!\n" );
return ( RET_NULL_POINTER );
}
*pMinGain = pVIRTUAL_MIPICtx->AecMinGain;
*pMaxGain = pVIRTUAL_MIPICtx->AecMaxGain;
TRACE( VIRTUAL_MIPI_INFO, "%s: (enter)\n", __FUNCTION__);
return ( result );
}
/*****************************************************************************/
/**
* VIRTUAL_MIPI_IsiGetIntegrationTimeLimitsIss
*
* @brief Returns the minimal and maximal integration time values of an
* VIRTUAL_MIPI instance
*
* @param handle VIRTUAL_MIPI sensor instance handle
* @param pMinExposure Pointer to a variable receiving minimal exposure value
* @param pMaxExposure Pointer to a variable receiving maximal exposure value
*
* @return Return the result of the function call.
* @retval RET_SUCCESS
* @retval RET_NULL_POINTER
*
*****************************************************************************/
static RESULT VIRTUAL_MIPI_IsiGetIntegrationTimeLimitsIss
(
IsiSensorHandle_t handle,
float *pMinIntegrationTime,
float *pMaxIntegrationTime
)
{
VIRTUAL_MIPI_Context_t *pVIRTUAL_MIPICtx = (VIRTUAL_MIPI_Context_t *)handle;
RESULT result = RET_SUCCESS;
uint32_t RegValue = 0;
TRACE( VIRTUAL_MIPI_INFO, "%s: (enter)\n", __FUNCTION__);
if ( pVIRTUAL_MIPICtx == NULL )
{
TRACE( VIRTUAL_MIPI_ERROR, "%s: Invalid sensor handle (NULL pointer detected)\n", __FUNCTION__ );
return ( RET_WRONG_HANDLE );
}
if ( (pMinIntegrationTime == NULL) || (pMaxIntegrationTime == NULL) )
{
TRACE( VIRTUAL_MIPI_ERROR, "%s: NULL pointer received!!\n" );
return ( RET_NULL_POINTER );
}
*pMinIntegrationTime = pVIRTUAL_MIPICtx->AecMinIntegrationTime;
*pMaxIntegrationTime = pVIRTUAL_MIPICtx->AecMaxIntegrationTime;
TRACE( VIRTUAL_MIPI_INFO, "%s: (enter)\n", __FUNCTION__);
return ( result );
}
/*****************************************************************************/
/**
* VIRTUAL_MIPI_IsiGetGainIss
*
* @brief Reads gain values from the image sensor module.
*
* @param handle VIRTUAL_MIPI sensor instance handle
* @param pSetGain set gain
*
* @return Return the result of the function call.
* @retval RET_SUCCESS
* @retval RET_NULL_POINTER
*
*****************************************************************************/
RESULT VIRTUAL_MIPI_IsiGetGainIss
(
IsiSensorHandle_t handle,
float *pSetGain
)
{
VIRTUAL_MIPI_Context_t *pVIRTUAL_MIPICtx = (VIRTUAL_MIPI_Context_t *)handle;
RESULT result = RET_SUCCESS;
TRACE( VIRTUAL_MIPI_INFO, "%s: (enter)\n", __FUNCTION__);
if ( pVIRTUAL_MIPICtx == NULL )
{
TRACE( VIRTUAL_MIPI_ERROR, "%s: Invalid sensor handle (NULL pointer detected)\n", __FUNCTION__ );
return ( RET_WRONG_HANDLE );
}
if ( pSetGain == NULL)
{
return ( RET_NULL_POINTER );
}
*pSetGain = pVIRTUAL_MIPICtx->AecCurGain;
TRACE( VIRTUAL_MIPI_INFO, "%s: (exit)\n", __FUNCTION__);
return ( result );
}
/*****************************************************************************/
/**
* VIRTUAL_MIPI_IsiGetGainIncrementIss
*
* @brief Get smallest possible gain increment.
*
* @param handle VIRTUAL_MIPI sensor instance handle
* @param pIncr increment
*
* @return Return the result of the function call.
* @retval RET_SUCCESS
* @retval RET_NULL_POINTER
*
*****************************************************************************/
RESULT VIRTUAL_MIPI_IsiGetGainIncrementIss
(
IsiSensorHandle_t handle,
float *pIncr
)
{
VIRTUAL_MIPI_Context_t *pVIRTUAL_MIPICtx = (VIRTUAL_MIPI_Context_t *)handle;
RESULT result = RET_SUCCESS;
TRACE( VIRTUAL_MIPI_INFO, "%s: (enter)\n", __FUNCTION__);
if ( pVIRTUAL_MIPICtx == NULL )
{
TRACE( VIRTUAL_MIPI_ERROR, "%s: Invalid sensor handle (NULL pointer detected)\n", __FUNCTION__ );
return ( RET_WRONG_HANDLE );
}
if ( pIncr == NULL)
{
return ( RET_NULL_POINTER );
}
//_smallest_ increment the sensor/driver can handle (e.g. used for sliders in the application)
*pIncr = pVIRTUAL_MIPICtx->AecGainIncrement;
TRACE( VIRTUAL_MIPI_INFO, "%s: (exit)\n", __FUNCTION__);
return ( result );
}
/*****************************************************************************/
/**
* VIRTUAL_MIPI_IsiSetGainIss
*
* @brief Writes gain values to the image sensor module.
* Updates current gain and exposure in sensor struct/state.
*
* @param handle VIRTUAL_MIPI sensor instance handle
* @param NewGain gain to be set
* @param pSetGain set gain
*
* @return Return the result of the function call.
* @retval RET_SUCCESS
* @retval RET_WRONG_HANDLE
* @retval RET_NULL_POINTER
* @retval RET_INVALID_PARM
* @retval RET_FAILURE
*
*****************************************************************************/
RESULT VIRTUAL_MIPI_IsiSetGainIss
(
IsiSensorHandle_t handle,
float NewGain,
float *pSetGain
)
{
VIRTUAL_MIPI_Context_t *pVIRTUAL_MIPICtx = (VIRTUAL_MIPI_Context_t *)handle;
RESULT result = RET_SUCCESS;
uint16_t usGain = 0;
TRACE( VIRTUAL_MIPI_INFO, "%s: (enter)\n", __FUNCTION__);
if ( pVIRTUAL_MIPICtx == NULL )
{
TRACE( VIRTUAL_MIPI_ERROR, "%s: Invalid sensor handle (NULL pointer detected)\n", __FUNCTION__ );
return ( RET_WRONG_HANDLE );
}
if ( pSetGain == NULL)
{
TRACE( VIRTUAL_MIPI_ERROR, "%s: Invalid parameter (NULL pointer detected)\n", __FUNCTION__ );
return ( RET_NULL_POINTER );
}
if( NewGain < pVIRTUAL_MIPICtx->AecMinGain ) NewGain = pVIRTUAL_MIPICtx->AecMinGain;
if( NewGain > pVIRTUAL_MIPICtx->AecMaxGain ) NewGain = pVIRTUAL_MIPICtx->AecMaxGain;
usGain = (uint16_t)NewGain;
// write new gain into sensor registers, do not write if nothing has changed
if( (usGain != pVIRTUAL_MIPICtx->OldGain) )
{
pVIRTUAL_MIPICtx->OldGain = usGain;
}
//calculate gain actually set
pVIRTUAL_MIPICtx->AecCurGain = NewGain;
//return current state
*pSetGain = pVIRTUAL_MIPICtx->AecCurGain;
TRACE( VIRTUAL_MIPI_DEBUG, "%s: g=%f\n", __FUNCTION__, *pSetGain );
TRACE( VIRTUAL_MIPI_INFO, "%s: (exit)\n", __FUNCTION__);
return ( result );
}
/*****************************************************************************/
/**
* VIRTUAL_MIPI_IsiGetIntegrationTimeIss
*
* @brief Reads integration time values from the image sensor module.
*
* @param handle VIRTUAL_MIPI sensor instance handle
* @param pSetIntegrationTime set integration time
*
* @return Return the result of the function call.
* @retval RET_SUCCESS
* @retval RET_NULL_POINTER
*
*****************************************************************************/
RESULT VIRTUAL_MIPI_IsiGetIntegrationTimeIss
(
IsiSensorHandle_t handle,
float *pSetIntegrationTime
)
{
VIRTUAL_MIPI_Context_t *pVIRTUAL_MIPICtx = (VIRTUAL_MIPI_Context_t *)handle;
RESULT result = RET_SUCCESS;
TRACE( VIRTUAL_MIPI_INFO, "%s: (enter)\n", __FUNCTION__);
if ( pVIRTUAL_MIPICtx == NULL )
{
TRACE( VIRTUAL_MIPI_ERROR, "%s: Invalid sensor handle (NULL pointer detected)\n", __FUNCTION__ );
return ( RET_WRONG_HANDLE );
}
if ( pSetIntegrationTime == NULL )
{
return ( RET_NULL_POINTER );
}
*pSetIntegrationTime = pVIRTUAL_MIPICtx->AecCurIntegrationTime;
TRACE( VIRTUAL_MIPI_INFO, "%s: (exit)\n", __FUNCTION__);
return ( result );
}
/*****************************************************************************/
/**
* VIRTUAL_MIPI_IsiGetIntegrationTimeIncrementIss
*
* @brief Get smallest possible integration time increment.
*
* @param handle VIRTUAL_MIPI sensor instance handle
* @param pIncr increment
*
* @return Return the result of the function call.
* @retval RET_SUCCESS
* @retval RET_NULL_POINTER
*
*****************************************************************************/
RESULT VIRTUAL_MIPI_IsiGetIntegrationTimeIncrementIss
(
IsiSensorHandle_t handle,
float *pIncr
)
{
VIRTUAL_MIPI_Context_t *pVIRTUAL_MIPICtx = (VIRTUAL_MIPI_Context_t *)handle;
RESULT result = RET_SUCCESS;
TRACE( VIRTUAL_MIPI_INFO, "%s: (enter)\n", __FUNCTION__);
if ( pVIRTUAL_MIPICtx == NULL )
{
TRACE( VIRTUAL_MIPI_ERROR, "%s: Invalid sensor handle (NULL pointer detected)\n", __FUNCTION__ );
return ( RET_WRONG_HANDLE );
}
if ( pIncr == NULL )
{
return ( RET_NULL_POINTER );
}
//_smallest_ increment the sensor/driver can handle (e.g. used for sliders in the application)
*pIncr = pVIRTUAL_MIPICtx->AecIntegrationTimeIncrement;
TRACE( VIRTUAL_MIPI_INFO, "%s: (exit)\n", __FUNCTION__);
return ( result );
}
/*****************************************************************************/
/**
* VIRTUAL_MIPI_IsiSetIntegrationTimeIss
*
* @brief Writes gain and integration time values to the image sensor module.
* Updates current integration time and exposure in sensor
* struct/state.
*
* @param handle VIRTUAL_MIPI sensor instance handle
* @param NewIntegrationTime integration time to be set
* @param pSetIntegrationTime set integration time
* @param pNumberOfFramesToSkip number of frames to skip until AE is
* executed again
*
* @return Return the result of the function call.
* @retval RET_SUCCESS
* @retval RET_WRONG_HANDLE
* @retval RET_NULL_POINTER
* @retval RET_INVALID_PARM
* @retval RET_FAILURE
* @retval RET_DIVISION_BY_ZERO
*
*****************************************************************************/
RESULT VIRTUAL_MIPI_IsiSetIntegrationTimeIss
(
IsiSensorHandle_t handle,
float NewIntegrationTime,
float *pSetIntegrationTime,
uint8_t *pNumberOfFramesToSkip
)
{
VIRTUAL_MIPI_Context_t *pVIRTUAL_MIPICtx = (VIRTUAL_MIPI_Context_t *)handle;
RESULT result = RET_SUCCESS;
TRACE( VIRTUAL_MIPI_DEBUG, "%s: Ti=%f\n", __FUNCTION__, *pSetIntegrationTime );
TRACE( VIRTUAL_MIPI_INFO, "%s: (exit)\n", __FUNCTION__);
return ( result );
}
/*****************************************************************************/
/**
* VIRTUAL_MIPI_IsiExposureControlIss
*
* @brief Camera hardware dependent part of the exposure control loop.
* Calculates appropriate register settings from the new exposure
* values and writes them to the image sensor module.
*
* @param handle VIRTUAL_MIPI sensor instance handle
* @param NewGain newly calculated gain to be set
* @param NewIntegrationTime newly calculated integration time to be set
* @param pNumberOfFramesToSkip number of frames to skip until AE is
* executed again
*
* @return Return the result of the function call.
* @retval RET_SUCCESS
* @retval RET_WRONG_HANDLE
* @retval RET_NULL_POINTER
* @retval RET_INVALID_PARM
* @retval RET_FAILURE
* @retval RET_DIVISION_BY_ZERO
*
*****************************************************************************/
RESULT VIRTUAL_MIPI_IsiExposureControlIss
(
IsiSensorHandle_t handle,
float NewGain,
float NewIntegrationTime,
uint8_t *pNumberOfFramesToSkip,
float *pSetGain,
float *pSetIntegrationTime
)
{
VIRTUAL_MIPI_Context_t *pVIRTUAL_MIPICtx = (VIRTUAL_MIPI_Context_t *)handle;
RESULT result = RET_SUCCESS;
TRACE( VIRTUAL_MIPI_INFO, "%s: (enter)\n", __FUNCTION__);
if ( pVIRTUAL_MIPICtx == NULL )
{
TRACE( VIRTUAL_MIPI_ERROR, "%s: Invalid sensor handle (NULL pointer detected)\n", __FUNCTION__ );
return ( RET_WRONG_HANDLE );
}
if ( (pNumberOfFramesToSkip == NULL)
|| (pSetGain == NULL)
|| (pSetIntegrationTime == NULL) )
{
TRACE( VIRTUAL_MIPI_ERROR, "%s: Invalid parameter (NULL pointer detected)\n", __FUNCTION__ );
return ( RET_NULL_POINTER );
}
TRACE( VIRTUAL_MIPI_DEBUG, "%s: g=%f, Ti=%f\n", __FUNCTION__, NewGain, NewIntegrationTime );
result = VIRTUAL_MIPI_IsiSetIntegrationTimeIss( handle, NewIntegrationTime, pSetIntegrationTime, pNumberOfFramesToSkip );
result = VIRTUAL_MIPI_IsiSetGainIss( handle, NewGain, pSetGain );
//*pNumberOfFramesToSkip = 2;
TRACE( VIRTUAL_MIPI_DEBUG, "%s: set: g=%f, Ti=%f, skip=%d\n", __FUNCTION__, *pSetGain, *pSetIntegrationTime, *pNumberOfFramesToSkip );
TRACE( VIRTUAL_MIPI_INFO, "%s: (exit)\n", __FUNCTION__);
return ( result );
}
/*****************************************************************************/
/**
* VIRTUAL_MIPI_IsiGetCurrentExposureIss
*
* @brief Returns the currently adjusted AE values
*
* @param handle VIRTUAL_MIPI sensor instance handle
*
* @return Return the result of the function call.
* @retval RET_SUCCESS
* @retval RET_NULL_POINTER
*
*****************************************************************************/
RESULT VIRTUAL_MIPI_IsiGetCurrentExposureIss
(
IsiSensorHandle_t handle,
float *pSetGain,
float *pSetIntegrationTime
)
{
VIRTUAL_MIPI_Context_t *pVIRTUAL_MIPICtx = (VIRTUAL_MIPI_Context_t *)handle;
RESULT result = RET_SUCCESS;
uint32_t RegValue = 0;
TRACE( VIRTUAL_MIPI_INFO, "%s: (enter)\n", __FUNCTION__);
if ( pVIRTUAL_MIPICtx == NULL )
{
TRACE( VIRTUAL_MIPI_ERROR, "%s: Invalid sensor handle (NULL pointer detected)\n", __FUNCTION__ );
return ( RET_WRONG_HANDLE );
}
if ( (pSetGain == NULL) || (pSetIntegrationTime == NULL) )
{
return ( RET_NULL_POINTER );
}
*pSetGain = pVIRTUAL_MIPICtx->AecCurGain;
*pSetIntegrationTime = pVIRTUAL_MIPICtx->AecCurIntegrationTime;
TRACE( VIRTUAL_MIPI_INFO, "%s: (exit)\n", __FUNCTION__);
return ( result );
}
/*****************************************************************************/
/**
* VIRTUAL_MIPI_IsiGetResolutionIss
*
* @brief Reads integration time values from the image sensor module.
*
* @param handle sensor instance handle
* @param pSettResolution set resolution
*
* @return Return the result of the function call.
* @retval RET_SUCCESS
* @retval RET_WRONG_HANDLE
* @retval RET_NULL_POINTER
*
*****************************************************************************/
RESULT VIRTUAL_MIPI_IsiGetResolutionIss
(
IsiSensorHandle_t handle,
uint32_t *pSetResolution
)
{
VIRTUAL_MIPI_Context_t *pVIRTUAL_MIPICtx = (VIRTUAL_MIPI_Context_t *)handle;
RESULT result = RET_SUCCESS;
TRACE( VIRTUAL_MIPI_INFO, "%s: (enter)\n", __FUNCTION__);
if ( pVIRTUAL_MIPICtx == NULL )
{
TRACE( VIRTUAL_MIPI_ERROR, "%s: Invalid sensor handle (NULL pointer detected)\n", __FUNCTION__ );
return ( RET_WRONG_HANDLE );
}
if ( pSetResolution == NULL )
{
return ( RET_NULL_POINTER );
}
*pSetResolution = pVIRTUAL_MIPICtx->Config.Resolution;
TRACE( VIRTUAL_MIPI_INFO, "%s: (exit)\n", __FUNCTION__);
return ( result );
}
/*****************************************************************************/
/**
* VIRTUAL_MIPI_IsiGetAfpsInfoHelperIss
*
* @brief Calc AFPS sub resolution settings for the given resolution
*
* @param pVIRTUAL_MIPICtx VIRTUAL_MIPI sensor instance (dummy!) context
* @param Resolution Any supported resolution to query AFPS params for
* @param pAfpsInfo Reference of AFPS info structure to write the results to
* @param AfpsStageIdx Index of current AFPS stage to use
*
* @return Return the result of the function call.
* @retval RET_SUCCESS
*
*****************************************************************************/
static RESULT VIRTUAL_MIPI_IsiGetAfpsInfoHelperIss(
VIRTUAL_MIPI_Context_t *pVIRTUAL_MIPICtx,
uint32_t Resolution,
IsiAfpsInfo_t* pAfpsInfo,
uint32_t AfpsStageIdx
)
{
RESULT result = RET_SUCCESS;
TRACE( VIRTUAL_MIPI_INFO, "%s: (enter)\n", __FUNCTION__);
DCT_ASSERT(pVIRTUAL_MIPICtx != NULL);
DCT_ASSERT(pAfpsInfo != NULL);
DCT_ASSERT(AfpsStageIdx <= ISI_NUM_AFPS_STAGES);
// update resolution in copy of config in context
pVIRTUAL_MIPICtx->Config.Resolution = Resolution;
// tell sensor about that
result = VIRTUAL_MIPI_SetupOutputWindow( pVIRTUAL_MIPICtx, &pVIRTUAL_MIPICtx->Config );
if ( result != RET_SUCCESS )
{
TRACE( VIRTUAL_MIPI_ERROR, "%s: SetupOutputWindow failed for resolution ID %08x.\n", __FUNCTION__, Resolution);
return ( result );
}
// update limits & stuff (reset current & old settings)
result = VIRTUAL_MIPI_AecSetModeParameters( pVIRTUAL_MIPICtx, &pVIRTUAL_MIPICtx->Config );
if ( result != RET_SUCCESS )
{
TRACE( VIRTUAL_MIPI_ERROR, "%s: AecSetModeParameters failed for resolution ID %08x.\n", __FUNCTION__, Resolution);
return ( result );
}
// take over params
pAfpsInfo->Stage[AfpsStageIdx].Resolution = Resolution;
pAfpsInfo->Stage[AfpsStageIdx].MaxIntTime = pVIRTUAL_MIPICtx->AecMaxIntegrationTime;
pAfpsInfo->AecMinGain = pVIRTUAL_MIPICtx->AecMinGain;
pAfpsInfo->AecMaxGain = pVIRTUAL_MIPICtx->AecMaxGain;
pAfpsInfo->AecMinIntTime = pVIRTUAL_MIPICtx->AecMinIntegrationTime;
pAfpsInfo->AecMaxIntTime = pVIRTUAL_MIPICtx->AecMaxIntegrationTime;
pAfpsInfo->AecSlowestResolution = Resolution;
TRACE( VIRTUAL_MIPI_INFO, "%s: (exit)\n", __FUNCTION__);
return ( result );
}
/*****************************************************************************/
/**
* VIRTUAL_MIPI_IsiGetAfpsInfoIss
*
* @brief Returns the possible AFPS sub resolution settings for the given resolution series
*
* @param handle VIRTUAL_MIPI sensor instance handle
* @param Resolution Any resolution within the AFPS group to query;
* 0 (zero) to use the currently configured resolution
* @param pAfpsInfo Reference of AFPS info structure to store the results
*
* @return Return the result of the function call.
* @retval RET_SUCCESS
* @retval RET_WRONG_HANDLE
* @retval RET_NULL_POINTER
* @retval RET_NOTSUPP
*
*****************************************************************************/
RESULT VIRTUAL_MIPI_IsiGetAfpsInfoIss(
IsiSensorHandle_t handle,
uint32_t Resolution,
IsiAfpsInfo_t* pAfpsInfo
)
{
VIRTUAL_MIPI_Context_t *pVIRTUAL_MIPICtx = (VIRTUAL_MIPI_Context_t *)handle;
RESULT result = RET_SUCCESS;
uint32_t RegValue = 0;
TRACE( VIRTUAL_MIPI_INFO, "%s: (enter)\n", __FUNCTION__);
if ( pVIRTUAL_MIPICtx == NULL )
{
TRACE( VIRTUAL_MIPI_ERROR, "%s: Invalid sensor handle (NULL pointer detected)\n", __FUNCTION__ );
return ( RET_WRONG_HANDLE );
}
if ( pAfpsInfo == NULL )
{
return ( RET_NULL_POINTER );
}
// use currently configured resolution?
if (Resolution == 0)
{
Resolution = pVIRTUAL_MIPICtx->Config.Resolution;
}
TRACE( VIRTUAL_MIPI_INFO, "%s: (exit)\n", __FUNCTION__);
return ( result );
}
/*****************************************************************************/
/**
* VIRTUAL_MIPI_IsiGetCalibKFactor
*
* @brief Returns the VIRTUAL_MIPI specific K-Factor
*
* @param handle VIRTUAL_MIPI sensor instance handle
* @param pIsiKFactor Pointer to Pointer receiving the memory address
*
* @return Return the result of the function call.
* @retval RET_SUCCESS
* @retval RET_WRONG_HANDLE
* @retval RET_NULL_POINTER
*
*****************************************************************************/
static RESULT VIRTUAL_MIPI_IsiGetCalibKFactor
(
IsiSensorHandle_t handle,
Isi1x1FloatMatrix_t **pIsiKFactor
)
{
VIRTUAL_MIPI_Context_t *pVIRTUAL_MIPICtx = (VIRTUAL_MIPI_Context_t *)handle;
RESULT result = RET_SUCCESS;
TRACE( VIRTUAL_MIPI_INFO, "%s: (enter)\n", __FUNCTION__);
if ( pVIRTUAL_MIPICtx == NULL )
{
return ( RET_WRONG_HANDLE );
}
if ( pIsiKFactor == NULL )
{
return ( RET_NULL_POINTER );
}
*pIsiKFactor = NULL;
TRACE( VIRTUAL_MIPI_INFO, "%s: (exit)\n", __FUNCTION__);
return ( result );
}
/*****************************************************************************/
/**
* VIRTUAL_MIPI_IsiGetCalibPcaMatrix
*
* @brief Returns the VIRTUAL_MIPI specific PCA-Matrix
*
* @param handle VIRTUAL_MIPI sensor instance handle
* @param pIsiPcaMatrix Pointer to Pointer receiving the memory address
*
* @return Return the result of the function call.
* @retval RET_SUCCESS
* @retval RET_WRONG_HANDLE
* @retval RET_NULL_POINTER
*
*****************************************************************************/
static RESULT VIRTUAL_MIPI_IsiGetCalibPcaMatrix
(
IsiSensorHandle_t handle,
Isi3x2FloatMatrix_t **pIsiPcaMatrix
)
{
VIRTUAL_MIPI_Context_t *pVIRTUAL_MIPICtx = (VIRTUAL_MIPI_Context_t *)handle;
RESULT result = RET_SUCCESS;
TRACE( VIRTUAL_MIPI_INFO, "%s: (enter)\n", __FUNCTION__);
if ( pVIRTUAL_MIPICtx == NULL )
{
return ( RET_WRONG_HANDLE );
}
if ( pIsiPcaMatrix == NULL )
{
return ( RET_NULL_POINTER );
}
*pIsiPcaMatrix = NULL;
TRACE( VIRTUAL_MIPI_INFO, "%s: (exit)\n", __FUNCTION__);
return ( result );
}
/*****************************************************************************/
/**
* VIRTUAL_MIPI_IsiGetCalibSvdMeanValue
*
* @brief Returns the sensor specific SvdMean-Vector
*
* @param handle VIRTUAL_MIPI sensor instance handle
* @param pIsiSvdMeanValue Pointer to Pointer receiving the memory address
*
* @return Return the result of the function call.
* @retval RET_SUCCESS
* @retval RET_WRONG_HANDLE
* @retval RET_NULL_POINTER
*
*****************************************************************************/
static RESULT VIRTUAL_MIPI_IsiGetCalibSvdMeanValue
(
IsiSensorHandle_t handle,
Isi3x1FloatMatrix_t **pIsiSvdMeanValue
)
{
IsiSensorContext_t *pSensorCtx = (IsiSensorContext_t *)handle;
RESULT result = RET_SUCCESS;
TRACE( VIRTUAL_MIPI_INFO, "%s: (enter)\n", __FUNCTION__);
if ( pSensorCtx == NULL )
{
return ( RET_WRONG_HANDLE );
}
if ( pIsiSvdMeanValue == NULL )
{
return ( RET_NULL_POINTER );
}
*pIsiSvdMeanValue = NULL;
TRACE( VIRTUAL_MIPI_INFO, "%s: (exit)\n", __FUNCTION__);
return ( result );
}
/*****************************************************************************/
/**
* VIRTUAL_MIPI_IsiGetCalibSvdMeanValue
*
* @brief Returns a pointer to the sensor specific centerline, a straight
* line in Hesse normal form in Rg/Bg colorspace
*
* @param handle VIRTUAL_MIPI sensor instance handle
* @param pIsiSvdMeanValue Pointer to Pointer receiving the memory address
*
* @return Return the result of the function call.
* @retval RET_SUCCESS
* @retval RET_WRONG_HANDLE
* @retval RET_NULL_POINTER
*
*****************************************************************************/
static RESULT VIRTUAL_MIPI_IsiGetCalibCenterLine
(
IsiSensorHandle_t handle,
IsiLine_t **ptIsiCenterLine
)
{
IsiSensorContext_t *pSensorCtx = (IsiSensorContext_t *)handle;
RESULT result = RET_SUCCESS;
TRACE( VIRTUAL_MIPI_INFO, "%s: (enter)\n", __FUNCTION__);
if ( pSensorCtx == NULL )
{
return ( RET_WRONG_HANDLE );
}
if ( ptIsiCenterLine == NULL )
{
return ( RET_NULL_POINTER );
}
*ptIsiCenterLine = NULL;
TRACE( VIRTUAL_MIPI_INFO, "%s: (exit)\n", __FUNCTION__);
return ( result );
}
/*****************************************************************************/
/**
* VIRTUAL_MIPI_IsiGetCalibClipParam
*
* @brief Returns a pointer to the sensor specific arrays for Rg/Bg color
* space clipping
*
* @param handle VIRTUAL_MIPI sensor instance handle
* @param pIsiSvdMeanValue Pointer to Pointer receiving the memory address
*
* @return Return the result of the function call.
* @retval RET_SUCCESS
* @retval RET_WRONG_HANDLE
* @retval RET_NULL_POINTER
*
*****************************************************************************/
static RESULT VIRTUAL_MIPI_IsiGetCalibClipParam
(
IsiSensorHandle_t handle,
IsiAwbClipParm_t **pIsiClipParam
)
{
IsiSensorContext_t *pSensorCtx = (IsiSensorContext_t *)handle;
RESULT result = RET_SUCCESS;
TRACE( VIRTUAL_MIPI_INFO, "%s: (enter)\n", __FUNCTION__);
if ( pSensorCtx == NULL )
{
return ( RET_WRONG_HANDLE );
}
if ( pIsiClipParam == NULL )
{
return ( RET_NULL_POINTER );
}
*pIsiClipParam = NULL;
TRACE( VIRTUAL_MIPI_INFO, "%s: (exit)\n", __FUNCTION__);
return ( result );
}
/*****************************************************************************/
/**
* VIRTUAL_MIPI_IsiGetCalibGlobalFadeParam
*
* @brief Returns a pointer to the sensor specific arrays for AWB out of
* range handling
*
* @param handle VIRTUAL_MIPI sensor instance handle
* @param pIsiSvdMeanValue Pointer to Pointer receiving the memory address
*
* @return Return the result of the function call.
* @retval RET_SUCCESS
* @retval RET_WRONG_HANDLE
* @retval RET_NULL_POINTER
*
*****************************************************************************/
static RESULT VIRTUAL_MIPI_IsiGetCalibGlobalFadeParam
(
IsiSensorHandle_t handle,
IsiAwbGlobalFadeParm_t **ptIsiGlobalFadeParam
)
{
IsiSensorContext_t *pSensorCtx = (IsiSensorContext_t *)handle;
RESULT result = RET_SUCCESS;
TRACE( VIRTUAL_MIPI_INFO, "%s: (enter)\n", __FUNCTION__);
if ( pSensorCtx == NULL )
{
return ( RET_WRONG_HANDLE );
}
if ( ptIsiGlobalFadeParam == NULL )
{
return ( RET_NULL_POINTER );
}
*ptIsiGlobalFadeParam = NULL;
TRACE( VIRTUAL_MIPI_INFO, "%s: (exit)\n", __FUNCTION__);
return ( result );
}
/*****************************************************************************/
/**
* VIRTUAL_MIPI_IsiGetCalibFadeParam
*
* @brief Returns a pointer to the sensor specific arrays for near white
* pixel parameter calculations
*
* @param handle VIRTUAL_MIPI sensor instance handle
* @param pIsiSvdMeanValue Pointer to Pointer receiving the memory address
*
* @return Return the result of the function call.
* @retval RET_SUCCESS
* @retval RET_WRONG_HANDLE
* @retval RET_NULL_POINTER
*
*****************************************************************************/
static RESULT VIRTUAL_MIPI_IsiGetCalibFadeParam
(
IsiSensorHandle_t handle,
IsiAwbFade2Parm_t **ptIsiFadeParam
)
{
IsiSensorContext_t *pSensorCtx = (IsiSensorContext_t *)handle;
RESULT result = RET_SUCCESS;
TRACE( VIRTUAL_MIPI_INFO, "%s: (enter)\n", __FUNCTION__);
if ( pSensorCtx == NULL )
{
return ( RET_WRONG_HANDLE );
}
if ( ptIsiFadeParam == NULL )
{
return ( RET_NULL_POINTER );
}
*ptIsiFadeParam = NULL;
TRACE( VIRTUAL_MIPI_INFO, "%s: (exit)\n", __FUNCTION__);
return ( result );
}
/*****************************************************************************/
/**
* VIRTUAL_MIPI_IsiGetIlluProfile
*
* @brief Returns a pointer to illumination profile idetified by CieProfile
* bitmask
*
* @param handle sensor instance handle
* @param CieProfile
* @param ptIsiIlluProfile Pointer to Pointer receiving the memory address
*
* @return Return the result of the function call.
* @retval RET_SUCCESS
* @retval RET_WRONG_HANDLE
* @retval RET_NULL_POINTER
*
*****************************************************************************/
static RESULT VIRTUAL_MIPI_IsiGetIlluProfile
(
IsiSensorHandle_t handle,
const uint32_t CieProfile,
IsiIlluProfile_t **ptIsiIlluProfile
)
{
VIRTUAL_MIPI_Context_t *pVIRTUAL_MIPICtx = (VIRTUAL_MIPI_Context_t *)handle;
RESULT result = RET_SUCCESS;
TRACE( VIRTUAL_MIPI_INFO, "%s: (enter)\n", __FUNCTION__);
if ( pVIRTUAL_MIPICtx == NULL )
{
return ( RET_WRONG_HANDLE );
}
if ( ptIsiIlluProfile == NULL )
{
return ( RET_NULL_POINTER );
}
TRACE( VIRTUAL_MIPI_INFO, "%s: (exit)\n", __FUNCTION__);
return ( result );
}
/*****************************************************************************/
/**
* VIRTUAL_MIPI_IsiGetLscMatrixTable
*
* @brief Returns a pointer to illumination profile idetified by CieProfile
* bitmask
*
* @param handle sensor instance handle
* @param CieProfile
* @param ptIsiIlluProfile Pointer to Pointer receiving the memory address
*
* @return Return the result of the function call.
* @retval RET_SUCCESS
* @retval RET_WRONG_HANDLE
* @retval RET_NULL_POINTER
*
*****************************************************************************/
static RESULT VIRTUAL_MIPI_IsiGetLscMatrixTable
(
IsiSensorHandle_t handle,
const uint32_t CieProfile,
IsiLscMatrixTable_t **pLscMatrixTable
)
{
VIRTUAL_MIPI_Context_t *pVIRTUAL_MIPICtx = (VIRTUAL_MIPI_Context_t *)handle;
RESULT result = RET_SUCCESS;
TRACE( VIRTUAL_MIPI_INFO, "%s: (enter)\n", __FUNCTION__);
if ( pVIRTUAL_MIPICtx == NULL )
{
return ( RET_WRONG_HANDLE );
}
if ( pLscMatrixTable == NULL )
{
return ( RET_NULL_POINTER );
}
else
TRACE( VIRTUAL_MIPI_INFO, "%s: (exit)\n", __FUNCTION__);
return ( result );
}
/*****************************************************************************/
/**
* VIRTUAL_MIPI_IsiMdiInitMotoDriveMds
*
* @brief General initialisation tasks like I/O initialisation.
*
* @param handle VIRTUAL_MIPI sensor instance handle
*
* @return Return the result of the function call.
* @retval RET_SUCCESS
* @retval RET_WRONG_HANDLE
* @retval RET_NULL_POINTER
*
*****************************************************************************/
static RESULT VIRTUAL_MIPI_IsiMdiInitMotoDriveMds
(
IsiSensorHandle_t handle
)
{
VIRTUAL_MIPI_Context_t *pVIRTUAL_MIPICtx = (VIRTUAL_MIPI_Context_t *)handle;
RESULT result = RET_SUCCESS;
TRACE( VIRTUAL_MIPI_INFO, "%s: (enter)\n", __FUNCTION__);
if ( pVIRTUAL_MIPICtx == NULL )
{
return ( RET_WRONG_HANDLE );
}
TRACE( VIRTUAL_MIPI_INFO, "%s: (exit)\n", __FUNCTION__);
return ( result );
}
/*****************************************************************************/
/**
* VIRTUAL_MIPI_IsiMdiSetupMotoDrive
*
* @brief Setup of the MotoDrive and return possible max step.
*
* @param handle VIRTUAL_MIPI sensor instance handle
* pMaxStep pointer to variable to receive the maximum
* possible focus step
*
* @return Return the result of the function call.
* @retval RET_SUCCESS
* @retval RET_WRONG_HANDLE
* @retval RET_NULL_POINTER
*
*****************************************************************************/
static RESULT VIRTUAL_MIPI_IsiMdiSetupMotoDrive
(
IsiSensorHandle_t handle,
uint32_t *pMaxStep
)
{
VIRTUAL_MIPI_Context_t *pVIRTUAL_MIPICtx = (VIRTUAL_MIPI_Context_t *)handle;
RESULT result = RET_SUCCESS;
TRACE( VIRTUAL_MIPI_INFO, "%s: (enter)\n", __FUNCTION__);
if ( pVIRTUAL_MIPICtx == NULL )
{
return ( RET_WRONG_HANDLE );
}
if ( pMaxStep == NULL )
{
return ( RET_NULL_POINTER );
}
TRACE( VIRTUAL_MIPI_INFO, "%s: (exit)\n", __FUNCTION__);
return ( result );
}
/*****************************************************************************/
/**
* VIRTUAL_MIPI_IsiMdiFocusSet
*
* @brief Drives the lens system to a certain focus point.
*
* @param handle VIRTUAL_MIPI sensor instance handle
* AbsStep absolute focus point to apply
*
* @return Return the result of the function call.
* @retval RET_SUCCESS
* @retval RET_WRONG_HANDLE
* @retval RET_NULL_POINTER
*
*****************************************************************************/
static RESULT VIRTUAL_MIPI_IsiMdiFocusSet
(
IsiSensorHandle_t handle,
const uint32_t Position
)
{
VIRTUAL_MIPI_Context_t *pVIRTUAL_MIPICtx = (VIRTUAL_MIPI_Context_t *)handle;
RESULT result = RET_SUCCESS;
uint32_t nPosition;
uint8_t data[2] = { 0, 0 };
TRACE( VIRTUAL_MIPI_INFO, "%s: (enter)\n", __FUNCTION__);
if ( pVIRTUAL_MIPICtx == NULL )
{
return ( RET_WRONG_HANDLE );
}
RETURN_RESULT_IF_DIFFERENT( RET_SUCCESS, result );
TRACE( VIRTUAL_MIPI_INFO, "%s: (exit)\n", __FUNCTION__);
return ( result );
}
/*****************************************************************************/
/**
* VIRTUAL_MIPI_IsiMdiFocusGet
*
* @brief Retrieves the currently applied focus point.
*
* @param handle VIRTUAL_MIPI sensor instance handle
* pAbsStep pointer to a variable to receive the current
* focus point
*
* @return Return the result of the function call.
* @retval RET_SUCCESS
* @retval RET_WRONG_HANDLE
* @retval RET_NULL_POINTER
*
*****************************************************************************/
static RESULT VIRTUAL_MIPI_IsiMdiFocusGet
(
IsiSensorHandle_t handle,
uint32_t *pAbsStep
)
{
VIRTUAL_MIPI_Context_t *pVIRTUAL_MIPICtx = (VIRTUAL_MIPI_Context_t *)handle;
RESULT result = RET_SUCCESS;
uint8_t data[2] = { 0, 0 };
TRACE( VIRTUAL_MIPI_INFO, "%s: (enter)\n", __FUNCTION__);
if ( pVIRTUAL_MIPICtx == NULL )
{
return ( RET_WRONG_HANDLE );
}
if ( pAbsStep == NULL )
{
return ( RET_NULL_POINTER );
}
TRACE( VIRTUAL_MIPI_INFO, "%s: (exit)\n", __FUNCTION__);
return ( result );
}
/*****************************************************************************/
/**
* VIRTUAL_MIPI_IsiMdiFocusCalibrate
*
* @brief Triggers a forced calibration of the focus hardware.
*
* @param handle VIRTUAL_MIPI sensor instance handle
*
* @return Return the result of the function call.
* @retval RET_SUCCESS
* @retval RET_WRONG_HANDLE
* @retval RET_NULL_POINTER
*
*****************************************************************************/
static RESULT VIRTUAL_MIPI_IsiMdiFocusCalibrate
(
IsiSensorHandle_t handle
)
{
VIRTUAL_MIPI_Context_t *pVIRTUAL_MIPICtx = (VIRTUAL_MIPI_Context_t *)handle;
RESULT result = RET_SUCCESS;
TRACE( VIRTUAL_MIPI_INFO, "%s: (enter)\n", __FUNCTION__);
if ( pVIRTUAL_MIPICtx == NULL )
{
return ( RET_WRONG_HANDLE );
}
TRACE( VIRTUAL_MIPI_INFO, "%s: (exit)\n", __FUNCTION__);
return ( result );
}
/*****************************************************************************/
/**
* VIRTUAL_MIPI_IsiActivateTestPattern
*
* @brief Triggers a forced calibration of the focus hardware.
*
* @param handle VIRTUAL_MIPI sensor instance handle
*
* @return Return the result of the function call.
* @retval RET_SUCCESS
* @retval RET_WRONG_HANDLE
* @retval RET_NULL_POINTER
*
******************************************************************************/
static RESULT VIRTUAL_MIPI_IsiActivateTestPattern
(
IsiSensorHandle_t handle,
const bool_t enable
)
{
VIRTUAL_MIPI_Context_t *pVIRTUAL_MIPICtx = (VIRTUAL_MIPI_Context_t *)handle;
RESULT result = RET_SUCCESS;
return ( result );
}
/*****************************************************************************/
/**
* VIRTUAL_MIPI_IsiGetSensorMipiInfoIss
*
* @brief Triggers a forced calibration of the focus hardware.
*
* @param handle VIRTUAL_MIPI sensor instance handle
*
* @return Return the result of the function call.
* @retval RET_SUCCESS
* @retval RET_WRONG_HANDLE
* @retval RET_NULL_POINTER
*
******************************************************************************/
static RESULT VIRTUAL_MIPI_IsiGetSensorMipiInfoIss
(
IsiSensorHandle_t handle,
IsiSensorMipiInfo *ptIsiSensorMipiInfo
)
{
VIRTUAL_MIPI_Context_t *pVIRTUAL_MIPICtx = (VIRTUAL_MIPI_Context_t *)handle;
RESULT result = RET_SUCCESS;
TRACE( VIRTUAL_MIPI_INFO, "%s: (enter)\n", __FUNCTION__);
if ( pVIRTUAL_MIPICtx == NULL )
{
return ( RET_WRONG_HANDLE );
}
if ( ptIsiSensorMipiInfo == NULL )
{
return ( result );
}
ptIsiSensorMipiInfo->ucMipiLanes = pVIRTUAL_MIPICtx->IsiSensorMipiInfo.ucMipiLanes;
ptIsiSensorMipiInfo->ulMipiFreq= pVIRTUAL_MIPICtx->IsiSensorMipiInfo.ulMipiFreq;
ptIsiSensorMipiInfo->sensorHalDevID = pVIRTUAL_MIPICtx->IsiSensorMipiInfo.sensorHalDevID;
TRACE( VIRTUAL_MIPI_INFO, "%s: (exit)\n", __FUNCTION__);
return ( result );
}
static RESULT VIRTUAL_MIPI_IsiGetSensorIsiVersion
( IsiSensorHandle_t handle,
unsigned int* pVersion
)
{
VIRTUAL_MIPI_Context_t *pVIRTUAL_MIPICtx = (VIRTUAL_MIPI_Context_t *)handle;
RESULT result = RET_SUCCESS;
TRACE( VIRTUAL_MIPI_INFO, "%s: (enter)\n", __FUNCTION__);
if ( pVIRTUAL_MIPICtx == NULL )
{
TRACE( VIRTUAL_MIPI_ERROR, "%s: pVIRTUAL_MIPICtx IS NULL\n", __FUNCTION__);
return ( RET_WRONG_HANDLE );
}
if(pVersion == NULL)
{
TRACE( VIRTUAL_MIPI_ERROR, "%s: pVersion IS NULL\n", __FUNCTION__);
return ( RET_WRONG_HANDLE );
}
*pVersion = CONFIG_ISI_VERSION;
return result;
}
/*****************************************************************************/
/**
* VIRTUAL_MIPI_IsiGetSensorIss
*
* @brief fills in the correct pointers for the sensor description struct
*
* @param param1 pointer to sensor description struct
*
* @return Return the result of the function call.
* @retval RET_SUCCESS
* @retval RET_NULL_POINTER
*
*****************************************************************************/
RESULT VIRTUAL_MIPI_IsiGetSensorIss
(
IsiSensor_t *pIsiSensor
)
{
RESULT result = RET_SUCCESS;
TRACE( VIRTUAL_MIPI_INFO, "%s (enter)\n", __FUNCTION__);
if ( pIsiSensor != NULL )
{
pIsiSensor->pszName = VIRTUAL_MIPI_g_acName;
pIsiSensor->pRegisterTable = VIRTUAL_MIPI_g_aRegDescription;
pIsiSensor->pIsiSensorCaps = &VIRTUAL_MIPI_g_IsiSensorDefaultConfig;
pIsiSensor->pIsiGetSensorIsiVer = VIRTUAL_MIPI_IsiGetSensorIsiVersion;
pIsiSensor->pIsiCreateSensorIss = VIRTUAL_MIPI_IsiCreateSensorIss;
pIsiSensor->pIsiReleaseSensorIss = VIRTUAL_MIPI_IsiReleaseSensorIss;
pIsiSensor->pIsiGetCapsIss = VIRTUAL_MIPI_IsiGetCapsIss;
pIsiSensor->pIsiSetupSensorIss = VIRTUAL_MIPI_IsiSetupSensorIss;
pIsiSensor->pIsiChangeSensorResolutionIss = VIRTUAL_MIPI_IsiChangeSensorResolutionIss;
pIsiSensor->pIsiSensorSetStreamingIss = VIRTUAL_MIPI_IsiSensorSetStreamingIss;
pIsiSensor->pIsiSensorSetPowerIss = VIRTUAL_MIPI_IsiSensorSetPowerIss;
pIsiSensor->pIsiCheckSensorConnectionIss = VIRTUAL_MIPI_IsiCheckSensorConnectionIss;
pIsiSensor->pIsiGetSensorRevisionIss = VIRTUAL_MIPI_IsiGetSensorRevisionIss;
pIsiSensor->pIsiRegisterReadIss = VIRTUAL_MIPI_IsiRegReadIss;
pIsiSensor->pIsiRegisterWriteIss = VIRTUAL_MIPI_IsiRegWriteIss;
/* AEC functions */
pIsiSensor->pIsiExposureControlIss = VIRTUAL_MIPI_IsiExposureControlIss;
pIsiSensor->pIsiGetGainLimitsIss = VIRTUAL_MIPI_IsiGetGainLimitsIss;
pIsiSensor->pIsiGetIntegrationTimeLimitsIss = VIRTUAL_MIPI_IsiGetIntegrationTimeLimitsIss;
pIsiSensor->pIsiGetCurrentExposureIss = VIRTUAL_MIPI_IsiGetCurrentExposureIss;
pIsiSensor->pIsiGetGainIss = VIRTUAL_MIPI_IsiGetGainIss;
pIsiSensor->pIsiGetGainIncrementIss = VIRTUAL_MIPI_IsiGetGainIncrementIss;
pIsiSensor->pIsiSetGainIss = VIRTUAL_MIPI_IsiSetGainIss;
pIsiSensor->pIsiGetIntegrationTimeIss = VIRTUAL_MIPI_IsiGetIntegrationTimeIss;
pIsiSensor->pIsiGetIntegrationTimeIncrementIss = VIRTUAL_MIPI_IsiGetIntegrationTimeIncrementIss;
pIsiSensor->pIsiSetIntegrationTimeIss = VIRTUAL_MIPI_IsiSetIntegrationTimeIss;
pIsiSensor->pIsiGetResolutionIss = VIRTUAL_MIPI_IsiGetResolutionIss;
pIsiSensor->pIsiGetAfpsInfoIss = VIRTUAL_MIPI_IsiGetAfpsInfoIss;
/* AWB specific functions */
pIsiSensor->pIsiGetCalibKFactor = VIRTUAL_MIPI_IsiGetCalibKFactor;
pIsiSensor->pIsiGetCalibPcaMatrix = VIRTUAL_MIPI_IsiGetCalibPcaMatrix;
pIsiSensor->pIsiGetCalibSvdMeanValue = VIRTUAL_MIPI_IsiGetCalibSvdMeanValue;
pIsiSensor->pIsiGetCalibCenterLine = VIRTUAL_MIPI_IsiGetCalibCenterLine;
pIsiSensor->pIsiGetCalibClipParam = VIRTUAL_MIPI_IsiGetCalibClipParam;
pIsiSensor->pIsiGetCalibGlobalFadeParam = VIRTUAL_MIPI_IsiGetCalibGlobalFadeParam;
pIsiSensor->pIsiGetCalibFadeParam = VIRTUAL_MIPI_IsiGetCalibFadeParam;
pIsiSensor->pIsiGetIlluProfile = VIRTUAL_MIPI_IsiGetIlluProfile;
pIsiSensor->pIsiGetLscMatrixTable = VIRTUAL_MIPI_IsiGetLscMatrixTable;
/* AF functions */
pIsiSensor->pIsiMdiInitMotoDriveMds = VIRTUAL_MIPI_IsiMdiInitMotoDriveMds;
pIsiSensor->pIsiMdiSetupMotoDrive = VIRTUAL_MIPI_IsiMdiSetupMotoDrive;
pIsiSensor->pIsiMdiFocusSet = VIRTUAL_MIPI_IsiMdiFocusSet;
pIsiSensor->pIsiMdiFocusGet = VIRTUAL_MIPI_IsiMdiFocusGet;
pIsiSensor->pIsiMdiFocusCalibrate = VIRTUAL_MIPI_IsiMdiFocusCalibrate;
/* MIPI */
pIsiSensor->pIsiGetSensorMipiInfoIss = VIRTUAL_MIPI_IsiGetSensorMipiInfoIss;
/* Testpattern */
pIsiSensor->pIsiActivateTestPattern = VIRTUAL_MIPI_IsiActivateTestPattern;
}
else
{
result = RET_NULL_POINTER;
}
TRACE( VIRTUAL_MIPI_INFO, "%s (exit)\n", __FUNCTION__);
return ( result );
}
static RESULT VIRTUAL_MIPI_IsiGetSensorI2cInfo(sensor_i2c_info_t** pdata)
{
sensor_i2c_info_t* pSensorI2cInfo;
pSensorI2cInfo = ( sensor_i2c_info_t * )malloc ( sizeof (sensor_i2c_info_t) );
if ( pSensorI2cInfo == NULL )
{
TRACE( VIRTUAL_MIPI_ERROR, "%s: Can't allocate ov14825 context\n", __FUNCTION__ );
return ( RET_OUTOFMEM );
}
MEMSET( pSensorI2cInfo, 0, sizeof( sensor_i2c_info_t ) );
pSensorI2cInfo->i2c_addr = VIRTUAL_MIPI_SLAVE_ADDR;
pSensorI2cInfo->i2c_addr2 = VIRTUAL_MIPI_SLAVE_ADDR2;
pSensorI2cInfo->soft_reg_addr = VIRTUAL_MIPI_SOFTWARE_RST;
pSensorI2cInfo->soft_reg_value = 0x01;
pSensorI2cInfo->reg_size = 2;
pSensorI2cInfo->value_size = 1;
{
IsiSensorCaps_t Caps;
sensor_caps_t *pCaps;
uint32_t lanes,i;
for (i=0; i<3; i++) {
lanes = (1<<i);
ListInit(&pSensorI2cInfo->lane_res[i]);
if (g_suppoted_mipi_lanenum_type & lanes) {
Caps.Index = 0;
while(VIRTUAL_MIPI_IsiGetCapsIssInternal(&Caps,lanes)==RET_SUCCESS) {
pCaps = malloc(sizeof(sensor_caps_t));
if (pCaps != NULL) {
memcpy(&pCaps->caps,&Caps,sizeof(IsiSensorCaps_t));
ListPrepareItem(pCaps);
ListAddTail(&pSensorI2cInfo->lane_res[i], pCaps);
}
Caps.Index++;
}
}
}
}
ListInit(&pSensorI2cInfo->chipid_info);
sensor_chipid_info_t* pChipIDInfo_H = (sensor_chipid_info_t *) malloc( sizeof(sensor_chipid_info_t) );
if ( !pChipIDInfo_H )
{
return RET_OUTOFMEM;
}
MEMSET( pChipIDInfo_H, 0, sizeof(*pChipIDInfo_H) );
pChipIDInfo_H->chipid_reg_addr = VIRTUAL_MIPI_CHIP_ID_HIGH_BYTE;
pChipIDInfo_H->chipid_reg_value = VIRTUAL_MIPI_CHIP_ID_HIGH_BYTE_DEFAULT;
ListPrepareItem( pChipIDInfo_H );
ListAddTail( &pSensorI2cInfo->chipid_info, pChipIDInfo_H );
sensor_chipid_info_t* pChipIDInfo_M = (sensor_chipid_info_t *) malloc( sizeof(sensor_chipid_info_t) );
if ( !pChipIDInfo_M )
{
return RET_OUTOFMEM;
}
MEMSET( pChipIDInfo_M, 0, sizeof(*pChipIDInfo_M) );
pChipIDInfo_M->chipid_reg_addr = VIRTUAL_MIPI_CHIP_ID_MIDDLE_BYTE;
pChipIDInfo_M->chipid_reg_value = VIRTUAL_MIPI_CHIP_ID_MIDDLE_BYTE_DEFAULT;
ListPrepareItem( pChipIDInfo_M );
ListAddTail( &pSensorI2cInfo->chipid_info, pChipIDInfo_M );
sensor_chipid_info_t* pChipIDInfo_L = (sensor_chipid_info_t *) malloc( sizeof(sensor_chipid_info_t) );
if ( !pChipIDInfo_L )
{
return RET_OUTOFMEM;
}
MEMSET( pChipIDInfo_L, 0, sizeof(*pChipIDInfo_L) );
pChipIDInfo_L->chipid_reg_addr = VIRTUAL_MIPI_CHIP_ID_LOW_BYTE;
pChipIDInfo_L->chipid_reg_value = VIRTUAL_MIPI_CHIP_ID_LOW_BYTE_DEFAULT;
ListPrepareItem( pChipIDInfo_L );
ListAddTail( &pSensorI2cInfo->chipid_info, pChipIDInfo_L );
//oyyf sensor drv version
pSensorI2cInfo->sensor_drv_version = CONFIG_SENSOR_DRV_VERSION;
*pdata = pSensorI2cInfo;
return RET_SUCCESS;
}
/******************************************************************************
* See header file for detailed comment.
*****************************************************************************/
/*****************************************************************************/
/**
*/
/*****************************************************************************/
IsiCamDrvConfig_t IsiCamDrvConfig =
{
0,
VIRTUAL_MIPI_IsiGetSensorIss,
{
0, /**< IsiSensor_t.pszName */
0, /**< IsiSensor_t.pRegisterTable */
0, /**< IsiSensor_t.pIsiSensorCaps */
0, /**< IsiSensor_t.pIsiGetSensorIsiVer_t>*/ //oyyf add
0, /**< IsiSensor_t.pIsiGetSensorTuningXmlVersion_t>*/ //oyyf add
0, /**< IsiSensor_t.pIsiWhiteBalanceIlluminationChk>*/ //ddl@rock-chips.com
0, /**< IsiSensor_t.pIsiWhiteBalanceIlluminationSet>*/ //ddl@rock-chips.com
0, /**< IsiSensor_t.pIsiCheckOTPInfo>*/ //zyc
0, /**< IsiSensor_t.pIsiSetSensorOTPInfo>*/ //zyl
0, /**< IsiSensor_t.pIsiEnableSensorOTP>*/ //zyl
0, /**< IsiSensor_t.pIsiCreateSensorIss */
0, /**< IsiSensor_t.pIsiReleaseSensorIss */
0, /**< IsiSensor_t.pIsiGetCapsIss */
0, /**< IsiSensor_t.pIsiSetupSensorIss */
0, /**< IsiSensor_t.pIsiChangeSensorResolutionIss */
0, /**< IsiSensor_t.pIsiSensorSetStreamingIss */
0, /**< IsiSensor_t.pIsiSensorSetPowerIss */
0, /**< IsiSensor_t.pIsiCheckSensorConnectionIss */
0, /**< IsiSensor_t.pIsiGetSensorRevisionIss */
0, /**< IsiSensor_t.pIsiRegisterReadIss */
0, /**< IsiSensor_t.pIsiRegisterWriteIss */
0, /**< IsiSensor_t.pIsiIsEvenFieldIss */
0, /**< IsiSensor_t.pIsiExposureControlIss */
0, /**< IsiSensor_t.pIsiGetGainLimitsIss */
0, /**< IsiSensor_t.pIsiGetIntegrationTimeLimitsIss */
0, /**< IsiSensor_t.pIsiGetCurrentExposureIss */
0, /**< IsiSensor_t.pIsiGetGainIss */
0, /**< IsiSensor_t.pIsiGetGainIncrementIss */
0, /**< IsiSensor_t.pIsiSetGainIss */
0, /**< IsiSensor_t.pIsiGetIntegrationTimeIss */
0, /**< IsiSensor_t.pIsiGetIntegrationTimeIncrementIss */
0, /**< IsiSensor_t.pIsiSetIntegrationTimeIss */
0, /**< IsiSensor_t.pIsiGetResolutionIss */
0, /**< IsiSensor_t.pIsiGetAfpsInfoIss */
0, /**< IsiSensor_t.pIsiGetCalibKFactor */
0, /**< IsiSensor_t.pIsiGetCalibPcaMatrix */
0, /**< IsiSensor_t.pIsiGetCalibSvdMeanValue */
0, /**< IsiSensor_t.pIsiGetCalibCenterLine */
0, /**< IsiSensor_t.pIsiGetCalibClipParam */
0, /**< IsiSensor_t.pIsiGetCalibGlobalFadeParam */
0, /**< IsiSensor_t.pIsiGetCalibFadeParam */
0, /**< IsiSensor_t.pIsiGetIlluProfile */
0, /**< IsiSensor_t.pIsiGetLscMatrixTable */
0, /**< IsiSensor_t.pIsiMdiInitMotoDriveMds */
0, /**< IsiSensor_t.pIsiMdiSetupMotoDrive */
0, /**< IsiSensor_t.pIsiMdiFocusSet */
0, /**< IsiSensor_t.pIsiMdiFocusGet */
0, /**< IsiSensor_t.pIsiMdiFocusCalibrate */
0, /**< IsiSensor_t.pIsiGetSensorMipiInfoIss */
0, /**< IsiSensor_t.pIsiActivateTestPattern */
0,
0, /**< IsiSensor_t.pIsiGetColorIss */
},
VIRTUAL_MIPI_IsiGetSensorI2cInfo,
};
已注释掉与硬件通讯函数,直接返回成功了,寄存器配置已经用不上,只是复制原有的camera
3.VIRTUAL_MIPI_YUV/VIRTUAL_tables.c
/******************************************************************************
*
* The copyright in this software is owned by Rockchip and/or its licensors.
* This software is made available subject to the conditions of the license
* terms to be determined and negotiated by Rockchip and you.
* THIS SOFTWARE IS PROVIDED TO YOU ON AN "AS IS" BASIS and ROCKCHP AND/OR
* ITS LICENSORS DISCLAIMS ANY AND ALL WARRANTIES AND REPRESENTATIONS WITH
* RESPECT TO SUCH SOFTWARE, WHETHER EXPRESS,IMPLIED, STATUTORY OR OTHERWISE,
* INCLUDING WITHOUT LIMITATION, ANY IMPLIED WARRANTIES OF TITLE, NON-INFRINGEMENT,
* MERCHANTABILITY, SATISFACTROY QUALITY, ACCURACY OR FITNESS FOR A PARTICULAR PURPOSE.
* Except as expressively authorized by Rockchip and/or its licensors, you may not
* (a) disclose, distribute, sell, sub-license, or transfer this software to any third party,
* in whole or part; (b) modify this software, in whole or part; (c) decompile, reverse-engineer,
* dissemble, or attempt to derive any source code from the software.
*
*****************************************************************************/
#include <ebase/types.h>
#include <ebase/trace.h>
#include <ebase/builtins.h>
#include <common/return_codes.h>
#include "isi.h"
#include "isi_iss.h"
#include "isi_priv.h"
#include "VIRTUAL_MIPI_priv.h"
/*****************************************************************************
* DEFINES
*****************************************************************************/
/*****************************************************************************
* GLOBALS
*****************************************************************************/
// Image sensor register settings default values taken from data sheet OV8810_DS_1.1_SiliconImage.pdf.
// The settings may be altered by the code in IsiSetupSensor.
const IsiRegDescription_t VIRTUAL_MIPI_g_aRegDescription[] =
{
//{0x0103,0x01,"",eReadWrite}, //software reset
{0x3002,0x00,"",eReadWrite}, //gpio input, vsync input, fsin input
{0x3016,0x1c,"",eReadWrite}, //drive strength of low speed = 1x, bypass latch of hs_enable
{0x3018,0x40,"",eReadWrite}, //0x44:MIPI 1 lane, 10-bit mode
{0x301d,0xf0,"",eReadWrite}, //enable clocks
{0x3020,0x20,"",eReadWrite}, //output raw
{0x3082,0x2c,"",eReadWrite}, //PLL
{0x3083,0x03,"",eReadWrite}, //PLL
{0x3084,0x0f,"",eReadWrite}, //PLL
{0x3085,0x03,"",eReadWrite}, //PLL
{0x3086,0x00,"",eReadWrite}, //PLL
{0x3087,0x00,"",eReadWrite}, //PLL
{0x3501,0x26,"",eReadWrite}, //exposure M
{0x3502,0x40,"",eReadWrite}, //exposure L
{0x3503,0x03,"",eReadWrite}, //AGC manual, AEC manual
{0x350b,0x36,"",eReadWrite}, //Gain L
{0x3600,0xb4,"",eReadWrite}, //analog conrtol
{0x3603,0x35,"",eReadWrite}, //
{0x3604,0x24,"",eReadWrite}, //
{0x3605,0x00,"",eReadWrite}, //
{0x3620,0x24,"",eReadWrite}, //26 ;
{0x3621,0x34,"",eReadWrite}, //37 ;
{0x3622,0x03,"",eReadWrite}, //04 ;
{0x3628,0x10,"",eReadWrite}, //analog control
{0x3705,0x3c,"",eReadWrite}, //sensor control
{0x370a,0x23,"",eReadWrite}, //
{0x370c,0x50,"",eReadWrite}, //
{0x370d,0x00,"",eReadWrite}, //c0 ;
{0x3717,0x58,"",eReadWrite}, //
{0x3718,0x80,"",eReadWrite}, //88 ;
{0x3720,0x00,"",eReadWrite}, //
{0x3721,0x09,"",eReadWrite}, //00 ;
{0x3722,0x0b,"",eReadWrite}, //00 ;
{0x3723,0x48,"",eReadWrite}, //00 ;
{0x3738,0x99,"",eReadWrite}, //00 ; sensor control
{0x3781,0x80,"",eReadWrite}, //PSRAM
{0x3784,0x0c,"",eReadWrite}, //
{0x3789,0x60,"",eReadWrite}, //PSRAM
{0x3800,0x00,"",eReadWrite}, //x start H
{0x3801,0x00,"",eReadWrite}, //x start L
{0x3802,0x00,"",eReadWrite}, //y start H
{0x3803,0x00,"",eReadWrite}, //y start L
{0x3804,0x06,"",eReadWrite}, //x end H
{0x3805,0x4f,"",eReadWrite}, //x end L
{0x3806,0x04,"",eReadWrite}, //y end H
{0x3807,0xbf,"",eReadWrite}, //y end L
{0x3808,0x03,"",eReadWrite}, //x output size H
{0x3809,0x20,"",eReadWrite}, //x output size L
{0x380a,0x02,"",eReadWrite}, //y output size H
{0x380b,0x58,"",eReadWrite}, //y output size L
{0x380c,0x06,"",eReadWrite}, //HTS H
{0x380d,0xac,"",eReadWrite}, //HTS L
{0x380e,0x02,"",eReadWrite}, //VTS H
{0x380f,0x84,"",eReadWrite}, //VTS L
{0x3810,0x00,"",eReadWrite}, //ISP x win H
{0x3811,0x04,"",eReadWrite}, //ISP x win L
{0x3812,0x00,"",eReadWrite}, //ISP y win H
{0x3813,0x04,"",eReadWrite}, //ISP y win L
{0x3814,0x31,"",eReadWrite}, //x inc
{0x3815,0x31,"",eReadWrite}, //y inc
{0x3819,0x04,"",eReadWrite}, //Vsync end row L
{0x3820,0xc2,"",eReadWrite}, //vsub48_blc on, vflip_blc on, vbinf on,
{0x3821,0x01,"",eReadWrite}, //hbin on
{0x3820,0xc2,"",eReadWrite}, //vsub48_blc on, vflip_blc on, vbinf on,
{0x3821,0x05,"",eReadWrite}, //Mirror on, hbin on
{0x3820,0xc6,"",eReadWrite}, //vsub48_blc on, vflip_blc on, Flip on, vbinf on,
{0x3821,0x01,"",eReadWrite}, //hbin on
{0x3820,0xc6,"",eReadWrite}, //vsub48_blc on, vflip_blc on, Flip on, vbinf on,
{0x3821,0x05,"",eReadWrite}, //Mirror on, hbin on
{0x382a,0x08,"",eReadWrite}, //auto VTS
{0x3a00,0x41,"",eReadWrite}, //night mode off, band enable
{0x3a02,0x90,"",eReadWrite}, //50Hz
{0x3a03,0x4e,"",eReadWrite}, //AEC target H
{0x3a04,0x40,"",eReadWrite}, //AEC target L
{0x3a06,0x00,"",eReadWrite}, //B50 H
{0x3a07,0xc1,"",eReadWrite}, //B50 L
{0x3a08,0x00,"",eReadWrite}, //B60 H
{0x3a09,0xa1,"",eReadWrite}, //B60 L
{0x3a0a,0x07,"",eReadWrite}, //max exp 50 H
{0x3a0b,0x8a,"",eReadWrite}, //max exp 50 L, 10 band
{0x3a0c,0x07,"",eReadWrite}, //max exp 60 H
{0x3a0d,0x8c,"",eReadWrite}, //max exp 60 L, 12 band
{0x3a0e,0x02,"",eReadWrite}, //VTS band 50 H
{0x3a0f,0x43,"",eReadWrite}, //VTS band 50 L
{0x3a10,0x02,"",eReadWrite}, //VTS band 60 H
{0x3a11,0x84,"",eReadWrite}, //VTS band 60 L
{0x3a13,0xf8,"",eReadWrite}, //gain ceiling = 15.5x
{0x4000,0x81,"",eReadWrite}, //avg_weight = 8, mf_en on
{0x4001,0x40,"",eReadWrite}, //format_trig_beh on
{0x4002,0x00,"",eReadWrite}, //blc target
{0x4003,0x10,"",eReadWrite}, //blc target
{0x4008,0x00,"",eReadWrite}, //bl_start
{0x4009,0x03,"",eReadWrite}, //bl_end
{0x4300,0x30,"",eReadWrite}, //YUV 422
{0x430e,0x00,"",eReadWrite}, //
{0x4602,0x02,"",eReadWrite}, //VFIFO R2, frame reset enable
{0x4837,0x1e,"",eReadWrite}, //MIPI global timing
{0x5000,0xff,"",eReadWrite}, //lenc_en, awb_gain_en, lcd_en, avg_en, bc_en, WC_en, blc_en
{0x5001,0x05,"",eReadWrite}, //auto blc offset, avg after LCD
{0x5002,0x32,"",eReadWrite}, //dpc_href_s, sof_sel, bias_plus
{0x5003,0x10,"",eReadWrite}, //bias_man
{0x5004,0xff,"",eReadWrite}, //uv_dsn_en, rgb_dns_en, gamma_en, cmx_en, cip_en, raw_dns_en, strech_en, awb_en
{0x5005,0x12,"",eReadWrite}, //sde_en, rgb2yuv_en
{0x0100,0x00,"",eReadWrite}, //wake up
{0x0101,0x01,"",eReadWrite}, //
{0x1000,0x01,"",eReadWrite}, //
{0x0129,0x10,"",eReadWrite}, //
{0x5180,0xf4,"",eReadWrite}, //AWB
{0x5181,0x11,"",eReadWrite}, //
{0x5182,0x41,"",eReadWrite}, //
{0x5183,0x42,"",eReadWrite}, //
{0x5184,0x82,"",eReadWrite}, //78; cwf_x
{0x5185,0x62,"",eReadWrite}, //cwf_y
{0x5186,0x86,"",eReadWrite}, //kx(cwf 2 a)x2y
{0x5187,0xd0,"",eReadWrite}, //Ky(cwf 2 day)y2x
{0x5188,0x10,"",eReadWrite}, //cwf range
{0x5189,0x0e,"",eReadWrite}, //a range
{0x518a,0x20,"",eReadWrite}, //day range
{0x518b,0x4f,"",eReadWrite}, //day limit
{0x518c,0x3c,"",eReadWrite}, //a limit
{0x518d,0xf8,"",eReadWrite}, //
{0x518e,0x04,"",eReadWrite}, //
{0x518f,0x7f,"",eReadWrite}, //
{0x5190,0x40,"",eReadWrite}, //
{0x5191,0x5f,"",eReadWrite}, //
{0x5192,0x40,"",eReadWrite}, //
{0x5193,0xff,"",eReadWrite}, //
{0x5194,0x40,"",eReadWrite}, //
{0x5195,0x07,"",eReadWrite}, //
{0x5196,0x99,"",eReadWrite}, //
{0x5197,0x04,"",eReadWrite}, //
{0x5198,0x00,"",eReadWrite}, //
{0x5199,0x06,"",eReadWrite}, //
{0x519a,0x61,"",eReadWrite}, //
{0x519b,0x04,"",eReadWrite}, //AWB
{0x5200,0x09,"",eReadWrite}, //stretch minimum = 3096, auto enable
{0x5201,0x00,"",eReadWrite}, //stretch min low level
{0x5202,0x06,"",eReadWrite}, //stretch min low level
{0x5203,0x20,"",eReadWrite}, //stretch min high level
{0x5204,0x41,"",eReadWrite}, //stretch step2, step1
{0x5205,0x16,"",eReadWrite}, //stretch current low level
{0x5206,0x00,"",eReadWrite}, //stretch current high level L
{0x5207,0x05,"",eReadWrite}, //stretch current high level H
{0x520b,0x30,"",eReadWrite}, //stretch_thres1 L
{0x520c,0x75,"",eReadWrite}, //stretch_thres1 M
{0x520d,0x00,"",eReadWrite}, //stretch_thres1 H
{0x520e,0x30,"",eReadWrite}, //stretch_thres2 L
{0x520f,0x75,"",eReadWrite}, //stretch_thres2 M
{0x5210,0x00,"",eReadWrite}, //stretch_thres2 H
{0x5280,0x15,"",eReadWrite}, //m_nNoise YSlop = 5, Parameter noise and edgethre calculated by noise list
{0x5281,0x06,"",eReadWrite}, //m_nNoiseList[0]
{0x5282,0x06,"",eReadWrite}, //m_nNoiseList[1]
{0x5283,0x08,"",eReadWrite}, //m_nNoiseList[2]
{0x5284,0x1c,"",eReadWrite}, //m_nNoiseList[3]
{0x5285,0x1c,"",eReadWrite}, //m_nNoiseList[4]
{0x5286,0x20,"",eReadWrite}, //m_nNoiseList[5]
{0x5287,0x10,"",eReadWrite}, //m_nMaxEdgeGThre
{0x5300,0xc5,"",eReadWrite}, //m_bColorEdgeEnable, m_bAntiAlasing on, m_nNoise YSlop = 5
{0x5301,0xa0,"",eReadWrite}, //m_nSharpenSlop = 1
{0x5302,0x06,"",eReadWrite}, //m_nNoiseList[0]
{0x5303,0x08,"",eReadWrite}, //m_nNoiseList[1]
{0x5304,0x10,"",eReadWrite}, //m_nNoiseList[2]
{0x5305,0x20,"",eReadWrite}, //m_nNoiseList[3]
{0x5306,0x30,"",eReadWrite}, //m_nNoiseList[4]
{0x5307,0x60,"",eReadWrite}, //m_nNoiseList[5]
{0x5308,0x32,"",eReadWrite}, //m_nMaxSarpenGain, m_nMinSharpenGain
{0x5309,0x00,"",eReadWrite}, //m_nMinSharpen
{0x530a,0x2a,"",eReadWrite}, //m_nMaxSharpen
{0x530b,0x02,"",eReadWrite}, //m_nMinDetail
{0x530c,0x02,"",eReadWrite}, //m_nMaxDetail
{0x530d,0x00,"",eReadWrite}, //m_nDetailRatioList[0]
{0x530e,0x0c,"",eReadWrite}, //m_nDetailRatioList[1]
{0x530f,0x14,"",eReadWrite}, //m_nDetailRatioList[2]
{0x5310,0x1a,"",eReadWrite}, //m_nSharpenNegEdgeRatio
{0x5311,0x20,"",eReadWrite}, //m_nClrEdgeShT1
{0x5312,0x80,"",eReadWrite}, //m_nClrEdgeShT2
{0x5313,0x4b,"",eReadWrite}, //m_nClrEdgeShpSlop
{0x5380,0x01,"",eReadWrite}, //nCCM_D[0][0] H
{0x5381,0x83,"",eReadWrite}, //nCCM_D[0][0] L
{0x5382,0x00,"",eReadWrite}, //nCCM_D[0][1] H
{0x5383,0x1f,"",eReadWrite}, //nCCM_D[0][1] L
{0x5384,0x00,"",eReadWrite}, //nCCM_D[1][0] H
{0x5385,0x88,"",eReadWrite}, //nCCM_D[1][0] L
{0x5386,0x00,"",eReadWrite}, //nCCM_D[1][1] H
{0x5387,0x82,"",eReadWrite}, //nCCM_D[1][1] L
{0x5388,0x00,"",eReadWrite}, //nCCM_D[2][0] H
{0x5389,0x40,"",eReadWrite}, //nCCM_D[2][0] L
{0x538a,0x01,"",eReadWrite}, //nCCM_D[2][1] H
{0x538b,0xb9,"",eReadWrite}, //nCCM_D[2][1] L
{0x538c,0x10,"",eReadWrite}, //Sing bit [2][1], [2][0], [1][1], [1][0], [0][1], [0][0]
{0x5400,0x0d,"",eReadWrite}, //m_pCurveYList[0]
{0x5401,0x1a,"",eReadWrite}, //m_pCurveYList[1]
{0x5402,0x32,"",eReadWrite}, //m_pCurveYList[2]
{0x5403,0x59,"",eReadWrite}, //m_pCurveYList[3]
{0x5404,0x68,"",eReadWrite}, //m_pCurveYList[4]
{0x5405,0x76,"",eReadWrite}, //m_pCurveYList[5]
{0x5406,0x82,"",eReadWrite}, //m_pCurveYList[6]
{0x5407,0x8c,"",eReadWrite}, //m_pCurveYList[7]
{0x5408,0x94,"",eReadWrite}, //m_pCurveYList[8]
{0x5409,0x9c,"",eReadWrite}, //m_pCurveYList[9]
{0x540a,0xa9,"",eReadWrite}, //m_pCurveYList[10]
{0x540b,0xb6,"",eReadWrite}, //m_pCurveYList[11]
{0x540c,0xcc,"",eReadWrite}, //m_pCurveYList[12]
{0x540d,0xdd,"",eReadWrite}, //m_pCurveYList[13]
{0x540e,0xeb,"",eReadWrite}, //m_pCurveYList[14]
{0x540f,0xa0,"",eReadWrite}, //m_nMaxShadowHGain
{0x5410,0x6e,"",eReadWrite}, //m_nMidTongHGain
{0x5411,0x06,"",eReadWrite}, //m_nHighLightHGain
{0x5480,0x19,"",eReadWrite}, //m_nShadowExtraNoise = 12, m_bSmoothYEnable
{0x5481,0x00,"",eReadWrite}, //m_nNoiseYList[1], m_nNoiseYList[0]
{0x5482,0x09,"",eReadWrite}, //m_nNoiseYList[3], m_nNoiseYList[2]
{0x5483,0x12,"",eReadWrite}, //m_nNoiseYList[5], m_nNoiseYList[4]
{0x5484,0x04,"",eReadWrite}, //m_nNoiseUVList[0]
{0x5485,0x06,"",eReadWrite}, //m_nNoiseUVList[1]
{0x5486,0x08,"",eReadWrite}, //m_nNoiseUVList[2]
{0x5487,0x0c,"",eReadWrite}, //m_nNoiseUVList[3]
{0x5488,0x10,"",eReadWrite}, //m_nNoiseUVList[4]
{0x5489,0x18,"",eReadWrite}, //m_nNoiseUVList[5]
{0x5500,0x00,"",eReadWrite}, //m_nNoiseList[0]
{0x5501,0x01,"",eReadWrite}, //m_nNoiseList[1]
{0x5502,0x02,"",eReadWrite}, //m_nNoiseList[2]
{0x5503,0x03,"",eReadWrite}, //m_nNoiseList[3]
{0x5504,0x04,"",eReadWrite}, //m_nNoiseList[4]
{0x5505,0x05,"",eReadWrite}, //m_nNoiseList[5]
{0x5506,0x00,"",eReadWrite}, //uuv_dns_psra_man dis, m_nShadowExtraNoise = 0
{0x5600,0x06,"",eReadWrite}, //fixy off, neg off, gray off, fix_v off, fix_u off, contrast_en, saturation on
{0x5603,0x40,"",eReadWrite}, //sat U
{0x5604,0x20,"",eReadWrite}, //sat V
{0x5609,0x10,"",eReadWrite}, //uvadj_th1
{0x560a,0x40,"",eReadWrite}, //uvadj_th2
{0x560b,0x00,"",eReadWrite}, //
{0x5800,0x03,"",eReadWrite}, //red x0 H
{0x5801,0x10,"",eReadWrite}, //red x0 L
{0x5802,0x02,"",eReadWrite}, //red y0 H
{0x5803,0x68,"",eReadWrite}, //red y0 L
{0x5804,0x2a,"",eReadWrite}, //red a1
{0x5805,0x05,"",eReadWrite}, //red a2
{0x5806,0x12,"",eReadWrite}, //red b1
{0x5807,0x05,"",eReadWrite}, //red b2
{0x5808,0x03,"",eReadWrite}, //green x0 H
{0x5809,0x38,"",eReadWrite}, //green x0 L
{0x580a,0x02,"",eReadWrite}, //green y0 H
{0x580b,0x68,"",eReadWrite}, //green y0 L
{0x580c,0x20,"",eReadWrite}, //green a1
{0x580d,0x05,"",eReadWrite}, //green a2
{0x580e,0x52,"",eReadWrite}, //green b1
{0x580f,0x06,"",eReadWrite}, //green b2
{0x5810,0x03,"",eReadWrite}, //blue x0 H
{0x5811,0x10,"",eReadWrite}, //blue x0 L
{0x5812,0x02,"",eReadWrite}, //blue y0 H
{0x5813,0x7c,"",eReadWrite}, //blue y0 L
{0x5814,0x1c,"",eReadWrite}, //bule a1
{0x5815,0x05,"",eReadWrite}, //blue a2
{0x5816,0x42,"",eReadWrite}, //blue b1
{0x5817,0x06,"",eReadWrite}, //blue b2
{0x5818,0x0d,"",eReadWrite}, //rst_seed on, md_en, coef_m off, gcoef_en
{0x5819,0x10,"",eReadWrite}, //lenc_coef_th
{0x581a,0x04,"",eReadWrite}, //lenc_gain_thre1
{0x581b,0x08,"",eReadWrite}, //lenc_gain_thre2
{0x3503,0x00,"",eReadWrite}, //AEC auto, AGC auto
{0x0000 ,0x00,"eTableEnd",eTableEnd}
};
const IsiRegDescription_t VIRTUAL_MIPI_g_svga[] =
{
#if 1 //15fps
{0x4200,0x0f,"",eReadWrite}, // stream off
{0x3501,0x26,"",eReadWrite}, // exposure M
{0x3502,0x40,"",eReadWrite}, // exposure L
{0x3620,0x24,"",eReadWrite}, // analog control
{0x3621,0x34,"",eReadWrite}, //
{0x3622,0x03,"",eReadWrite}, // analog control
{0x370a,0x23,"",eReadWrite}, // sensor control
{0x370d,0x00,"",eReadWrite}, //
{0x3718,0x88,"",eReadWrite}, //
{0x3721,0x09,"",eReadWrite}, //
{0x3722,0x0b,"",eReadWrite}, //
{0x3723,0x48,"",eReadWrite}, //
{0x3738,0x99,"",eReadWrite}, // sensor control
{0x3801,0x00,"",eReadWrite}, // x start L
{0x3803,0x00,"",eReadWrite}, // y start L
{0x3804,0x06,"",eReadWrite}, // x end H
{0x3805,0x4f,"",eReadWrite}, // x end L
{0x3806,0x04,"",eReadWrite}, // y end H
{0x3807,0xbf,"",eReadWrite}, // y end L
{0x3808,0x03,"",eReadWrite}, // x output size H
{0x3809,0x20,"",eReadWrite}, // x output size L
{0x380a,0x02,"",eReadWrite}, // y output size H
{0x380b,0x58,"",eReadWrite}, // y output size L
{0x380c,0x0d,"",eReadWrite}, // HTS H
{0x380d,0x58,"",eReadWrite}, // HTS L
{0x380e,0x02,"",eReadWrite}, // VTS H
{0x380f,0x84,"",eReadWrite}, // VTS L
{0x3811,0x04,"",eReadWrite}, // ISP x win L
{0x3813,0x04,"",eReadWrite}, // ISP y win L
{0x3814,0x31,"",eReadWrite}, // x inc
{0x3815,0x31,"",eReadWrite}, // y inc
{0x3820,0xc2,"",eReadWrite}, // vsub48_blc on, vflip_blc on, vbinf on,
{0x3821,0x01,"",eReadWrite}, // hbin on
{0x3820,0xc2,"",eReadWrite}, // vsub48_blc on, vflip_blc on, vbinf on,
{0x3821,0x05,"",eReadWrite}, // Mirror on, hbin on
{0x3820,0xc6,"",eReadWrite}, // vsub48_blc on, vflip_blc on, Flip on, vbinf on,
{0x3821,0x01,"",eReadWrite}, // hbin on
{0x3820,0xc6,"",eReadWrite}, // vsub48_blc on, vflip_blc on, Flip on, vbinf on,
{0x3821,0x05,"",eReadWrite}, // Mirror on, hbin on
{0x382a,0x00,"",eReadWrite}, // fixed VTS
{0x3a00,0x41,"",eReadWrite}, // night mode off, band on
{0x3a07,0xc1,"",eReadWrite}, // B50 L
{0x3a09,0xa1,"",eReadWrite}, // B60 L
{0x3a0a,0x12,"",eReadWrite}, // max exp 50 H
{0x3a0b,0x18,"",eReadWrite}, // max exp 50 L
{0x3a0c,0x14,"",eReadWrite}, // max exp 60 H
{0x3a0d,0x20,"",eReadWrite}, // max exp 60 L
{0x3a0e,0x02,"",eReadWrite}, // VTS band 50 H
{0x3a0f,0x43,"",eReadWrite}, // VTS band 50 L
{0x3a10,0x02,"",eReadWrite}, // VTS band 60 H
{0x3a11,0x84,"",eReadWrite}, // VTS band 60 L
{0x3a13,0x80,"",eReadWrite}, // gain ceiling = 8x
{0x4008,0x00,"",eReadWrite}, // bl_start
{0x4009,0x03,"",eReadWrite}, // bl_end
{0x5003,0x0c,"",eReadWrite}, // manual blc offset
//{0x4200,0x00,"",eReadWrite}, // stream on
#else //30~10fps
{0x4202,0x0f,"",eReadWrite}, // stream off
{0x3501,0x26,"",eReadWrite}, // exposure M
{0x3502,0x40,"",eReadWrite}, // exposure L
{0x3620,0x24,"",eReadWrite}, // analog control
{0x3621,0x34,"",eReadWrite}, //
{0x3622,0x03,"",eReadWrite}, // analog control
{0x370a,0x23,"",eReadWrite}, // sensor control
{0x370d,0x00,"",eReadWrite}, //
{0x3718,0x80,"",eReadWrite}, //
{0x3721,0x09,"",eReadWrite}, //
{0x3722,0x0b,"",eReadWrite}, //
{0x3723,0x48,"",eReadWrite}, //
{0x3738,0x99,"",eReadWrite}, // sensor control
{0x3801,0x00,"",eReadWrite}, // x start L
{0x3803,0x00,"",eReadWrite}, // y start L
{0x3804,0x06,"",eReadWrite}, // x end H
{0x3805,0x4f,"",eReadWrite}, // x end L
{0x3806,0x04,"",eReadWrite}, // y end H
{0x3807,0xbf,"",eReadWrite}, // y end L
{0x3808,0x03,"",eReadWrite}, // x output size H
{0x3809,0x20,"",eReadWrite}, // x output size L
{0x380a,0x02,"",eReadWrite}, // y output size H
{0x380b,0x58,"",eReadWrite}, // y output size L
{0x380c,0x06,"",eReadWrite}, // HTS H
{0x380d,0xac,"",eReadWrite}, // HTS L
{0x380e,0x02,"",eReadWrite}, // VTS H
{0x380f,0x84,"",eReadWrite}, // VTS L
{0x3811,0x04,"",eReadWrite}, // ISP x win L
{0x3813,0x04,"",eReadWrite}, // ISP y win L
{0x3814,0x31,"",eReadWrite}, // x inc
{0x3815,0x31,"",eReadWrite}, // y inc
{0x3820,0xc2,"",eReadWrite}, // vsub48_blc on, vflip_blc on, vbinf on,
{0x3821,0x01,"",eReadWrite}, // hbin on
{0x3820,0xc2,"",eReadWrite}, // vsub48_blc on, vflip_blc on, vbinf on,
{0x3821,0x05,"",eReadWrite}, // Mirror on, hbin on
{0x3820,0xc6,"",eReadWrite}, // vsub48_blc on, vflip_blc on, Flip on, vbinf on,
{0x3821,0x01,"",eReadWrite}, // hbin on
{0x3820,0xc6,"",eReadWrite}, // vsub48_blc on, vflip_blc on, Flip on, vbinf on,
{0x3821,0x05,"",eReadWrite}, // Mirror on, hbin on
{0x382a,0x08,"",eReadWrite}, // auto VTS
{0x3a00,0x43,"",eReadWrite}, // night mode on, band on
{0x3a07,0xc1,"",eReadWrite}, // B50 L
{0x3a09,0xa1,"",eReadWrite}, // B60 L
{0x3a0a,0x07,"",eReadWrite}, // max exp 50 H
{0x3a0b,0x8a,"",eReadWrite}, // max exp 50 L
{0x3a0c,0x07,"",eReadWrite}, // max exp 60 H
{0x3a0d,0x8c,"",eReadWrite}, // max exp 60 L
{0x3a0e,0x02,"",eReadWrite}, // VTS band 50 H
{0x3a0f,0x43,"",eReadWrite}, // VTS band 50 L
{0x3a10,0x02,"",eReadWrite}, // VTS band 60 H
{0x3a11,0x84,"",eReadWrite}, // VTS band 60 L
{0x3a13,0x80,"",eReadWrite}, // gain ceiling = 8x
{0x4008,0x00,"",eReadWrite}, // bl_start
{0x4009,0x03,"",eReadWrite}, // bl_end
{0x5003,0x0c,"",eReadWrite}, // manual blc offset
{0x4200,0x00,"",eReadWrite}, // stream on
#endif
{0x0000 ,0x00,"eTableEnd",eTableEnd}
};
const IsiRegDescription_t VIRTUAL_MIPI_g_1600x1200[] =
{
#if 0 //7.5fps
{0x4202,0x0f,"",eReadWrite}, // stream off
{0x3503,0x03,"",eReadWrite}, // AGC manual, AEC manual
{0x3501,0x4e,"",eReadWrite}, // exposure M
{0x3502,0xe0,"",eReadWrite}, // exposure L
{0x3620,0x24,"",eReadWrite}, // analog control
{0x3621,0x34,"",eReadWrite}, //
{0x3622,0x03,"",eReadWrite}, // analog control
{0x370a,0x21,"",eReadWrite}, // sensor control
{0x370d,0xc0,"",eReadWrite}, //
{0x3718,0x80,"",eReadWrite}, //
{0x3721,0x09,"",eReadWrite}, //
{0x3722,0x06,"",eReadWrite}, //
{0x3723,0x59,"",eReadWrite}, //
{0x3738,0x99,"",eReadWrite}, // sensor control
{0x3801,0x00,"",eReadWrite}, // x start L
{0x3803,0x00,"",eReadWrite}, // y start L
{0x3804,0x06,"",eReadWrite}, // x end H
{0x3805,0x4f,"",eReadWrite}, // x end L
{0x3806,0x04,"",eReadWrite}, // y end H
{0x3807,0xbf,"",eReadWrite}, // y end L
{0x3808,0x06,"",eReadWrite}, // x output size H
{0x3809,0x40,"",eReadWrite}, // x output size L
{0x380a,0x04,"",eReadWrite}, // y output size H
{0x380b,0xb0,"",eReadWrite}, // y output size L
{0x380c,0x06,"",eReadWrite}, // HTS H
{0x380d,0xa4,"",eReadWrite}, // HTS L
{0x380e,0x0a,"",eReadWrite}, // VTS H
{0x380f,0x1c,"",eReadWrite}, // VTS L
{0x3811,0x08,"",eReadWrite}, // ISP x win L
{0x3813,0x08,"",eReadWrite}, // ISP y win L
{0x3814,0x11,"",eReadWrite}, // x inc
{0x3815,0x11,"",eReadWrite}, // y inc
{0x3820,0xc0,"",eReadWrite}, // vsub48_blc on, vflip_blc on, vbinf off,
{0x3821,0x00,"",eReadWrite}, // hbin off
{0x3820,0xc0,"",eReadWrite}, // vsub48_blc on, vflip_blc on, vbinf off,
{0x3821,0x04,"",eReadWrite}, // Mirror on, hbin off
{0x3820,0xc4,"",eReadWrite}, // vsub48_blc on, vflip_blc on, Flip on, vbinf off,
{0x3821,0x00,"",eReadWrite}, // hbin off
{0x3820,0xc4,"",eReadWrite}, // vsub48_blc on, vflip_blc on, Flip on, vbinf off,
{0x3821,0x04,"",eReadWrite}, // Mirror on, hbin off
{0x382a,0x00,"",eReadWrite}, // fixed VTS
{0x3a00,0x41,"",eReadWrite}, // night mode off, band on
{0x3a07,0xc2,"",eReadWrite}, // B50 L
{0x3a09,0xa1,"",eReadWrite}, // B60 L
{0x3a0a,0x09,"",eReadWrite}, // max exp 50 H
{0x3a0b,0xda,"",eReadWrite}, // max exp 50 L
{0x3a0c,0x0a,"",eReadWrite}, // max exp 60 H
{0x3a0d,0x10,"",eReadWrite}, // max exp 60 L
{0x3a0e,0x09,"",eReadWrite}, // VTS band 50 H
{0x3a0f,0xda,"",eReadWrite}, // VTS band 50 L
{0x3a10,0x0a,"",eReadWrite}, // VTS band 60 H
{0x3a11,0x10,"",eReadWrite}, // VTS band 60 L
{0x3a13,0x80,"",eReadWrite}, // gain ceilling = 8x
{0x4008,0x02,"",eReadWrite}, // bl_start
{0x4009,0x09,"",eReadWrite}, // bl_end
{0x4202,0x00,"",eReadWrite}, // stream on
#else //7.5-15fps
{0x4202,0x0f,"",eReadWrite}, // stream off
{0x3503,0x03,"",eReadWrite}, // AGC manual, AEC manual
{0x3501,0x4e,"",eReadWrite}, // exposure M
{0x3502,0xe0,"",eReadWrite}, // exposure L
{0x3620,0x24,"",eReadWrite}, // analog control
{0x3621,0x34,"",eReadWrite}, //
{0x3622,0x03,"",eReadWrite}, // analog control
{0x370a,0x21,"",eReadWrite}, // sensor control
{0x370d,0xc0,"",eReadWrite}, //
{0x3718,0x80,"",eReadWrite}, //
{0x3721,0x09,"",eReadWrite}, //
{0x3722,0x06,"",eReadWrite}, //
{0x3723,0x59,"",eReadWrite}, //
{0x3738,0x99,"",eReadWrite}, // sensor control
{0x3801,0x00,"",eReadWrite}, // x start L
{0x3803,0x00,"",eReadWrite}, // y start L
{0x3804,0x06,"",eReadWrite}, // x end H
{0x3805,0x4f,"",eReadWrite}, // x end L
{0x3806,0x04,"",eReadWrite}, // y end H
{0x3807,0xbf,"",eReadWrite}, // y end L
{0x3808,0x06,"",eReadWrite}, // x output size H
{0x3809,0x40,"",eReadWrite}, // x output size L
{0x380a,0x04,"",eReadWrite}, // y output size H
{0x380b,0xb0,"",eReadWrite}, // y output size L
{0x380c,0x06,"",eReadWrite}, // HTS H
{0x380d,0xa4,"",eReadWrite}, // HTS L
{0x380e,0x05,"",eReadWrite}, // VTS H
{0x380f,0x0e,"",eReadWrite}, // VTS L
{0x3811,0x08,"",eReadWrite}, // ISP x win L
{0x3813,0x08,"",eReadWrite}, // ISP y win L
{0x3814,0x11,"",eReadWrite}, // x inc
{0x3815,0x11,"",eReadWrite}, // y inc
{0x3820,0xc0,"",eReadWrite}, // vsub48_blc on, vflip_blc on, vbinf off,
{0x3821,0x00,"",eReadWrite}, // hbin off
{0x3820,0xc0,"",eReadWrite}, // vsub48_blc on, vflip_blc on, vbinf off,
{0x3821,0x04,"",eReadWrite}, // Mirror on, hbin off
{0x3820,0xc4,"",eReadWrite}, // vsub48_blc on, vflip_blc on, Flip on, vbinf off,
{0x3821,0x00,"",eReadWrite}, // hbin off
{0x3820,0xc4,"",eReadWrite}, // vsub48_blc on, vflip_blc on, Flip on, vbinf off,
{0x3821,0x04,"",eReadWrite}, // Mirror on, hbin off
{0x382a,0x08,"",eReadWrite}, // auto VTS
{0x3a00,0x41,"",eReadWrite}, // night mode off, band on
{0x3a07,0xc2,"",eReadWrite}, // B50 L
{0x3a09,0xa1,"",eReadWrite}, // B60 L
{0x3a0a,0x09,"",eReadWrite}, // max exp 50 H
{0x3a0b,0xda,"",eReadWrite}, // max exp 50 L
{0x3a0c,0x0a,"",eReadWrite}, // max exp 60 H
{0x3a0d,0x10,"",eReadWrite}, // max exp 60 L
{0x3a0e,0x04,"",eReadWrite}, // VTS band 50 H
{0x3a0f,0x8c,"",eReadWrite}, // VTS band 50 L
{0x3a10,0x05,"",eReadWrite}, // VTS band 60 H
{0x3a11,0x08,"",eReadWrite}, // VTS band 60 L
{0x4008,0x02,"",eReadWrite}, // bl_start
{0x4009,0x09,"",eReadWrite}, // bl_end
{0x4202,0x00,"",eReadWrite}, // stream on
#endif
{0x0000 ,0x00,"eTableEnd",eTableEnd}
};