From 7bed67f18f0c6e967054566c49a9123bbf8b7d3c Mon Sep 17 00:00:00 2001 From: Firefly Date: Thu, 12 Nov 2015 16:47:10 +0800 Subject: [PATCH] [hardware/rockchip/camera] CameraHal: v1.0x37.1 --- .../rockchip/camera/CameraHal/CameraHal.h | 4 +- .../camera/CameraHal/CameraIspAdapter.cpp | 5 +- .../camera/CameraHal/DisplayAdapter.cpp | 5 +- .../camera/Config/cam_board_rk3288.xml | 131 + .../camera/Config/cam_board_rk3368.xml | 131 + .../isi/drv/TC358749XBG_MIPI_YUV/Android.mk | 39 + .../include_priv/TC358749XBG_priv.h | 81 + .../source/TC358749XBG_PARREL.c | 3476 +++++++++++++++++ .../source/TC358749XBG_tables.c | 577 +++ 9 files changed, 4445 insertions(+), 4 deletions(-) create mode 100644 hardware/rockchip/camera/SiliconImage/isi/drv/TC358749XBG_MIPI_YUV/Android.mk create mode 100644 hardware/rockchip/camera/SiliconImage/isi/drv/TC358749XBG_MIPI_YUV/include_priv/TC358749XBG_priv.h create mode 100644 hardware/rockchip/camera/SiliconImage/isi/drv/TC358749XBG_MIPI_YUV/source/TC358749XBG_PARREL.c create mode 100644 hardware/rockchip/camera/SiliconImage/isi/drv/TC358749XBG_MIPI_YUV/source/TC358749XBG_tables.c diff --git a/hardware/rockchip/camera/CameraHal/CameraHal.h b/hardware/rockchip/camera/CameraHal/CameraHal.h index 2f57341158..1566234e0a 100644 --- a/hardware/rockchip/camera/CameraHal/CameraHal.h +++ b/hardware/rockchip/camera/CameraHal/CameraHal.h @@ -543,9 +543,11 @@ namespace android { 3) avoid the access of mDisplayBufInfo when it is NULL. *v1.0x37.0: compatible with android 6.0 +*v1.0x37.1: + 1) support TC358749XBG hdmi-in. */ -#define CONFIG_CAMERAHAL_VERSION KERNEL_VERSION(1, 0x36, 0xd) +#define CONFIG_CAMERAHAL_VERSION KERNEL_VERSION(1, 0x37, 0x1) /* */ diff --git a/hardware/rockchip/camera/CameraHal/CameraIspAdapter.cpp b/hardware/rockchip/camera/CameraHal/CameraIspAdapter.cpp index 3c5f31b14c..71daf52f58 100644 --- a/hardware/rockchip/camera/CameraHal/CameraIspAdapter.cpp +++ b/hardware/rockchip/camera/CameraHal/CameraIspAdapter.cpp @@ -270,7 +270,7 @@ status_t CameraIspAdapter::startPreview(int preview_w,int preview_h,int w, int h bool low_illumin = false; bool is_video = false; - + property_set("sys.hdmiin.display", "0");//just used by hdmi-in if ( ( !m_camDevice->hasSensor() ) && ( !m_camDevice->hasImage() ) ){ goto startPreview_end; @@ -2067,7 +2067,8 @@ void CameraIspAdapter::bufferCb( MediaBuffer_t* pMediaBuffer ) mRefEventNotifier->notifyNewFaceDecFrame(tmpFrame); } //need to display ? - if(mRefDisplayAdapter->isNeedSendToDisplay()){ + if(mRefDisplayAdapter->isNeedSendToDisplay()){ + property_set("sys.hdmiin.display", "1");//just used by hdmi-in MediaBufLockBuffer( pMediaBuffer ); //new frames FramInfo_s *tmpFrame=(FramInfo_s *)malloc(sizeof(FramInfo_s)); diff --git a/hardware/rockchip/camera/CameraHal/DisplayAdapter.cpp b/hardware/rockchip/camera/CameraHal/DisplayAdapter.cpp index ec43a9af59..b787e0a973 100644 --- a/hardware/rockchip/camera/CameraHal/DisplayAdapter.cpp +++ b/hardware/rockchip/camera/CameraHal/DisplayAdapter.cpp @@ -257,7 +257,10 @@ int DisplayAdapter::cameraDisplayBufferCreate(int width, int height, const char } goto fail; } - mDispBufUndqueueMin = undequeued; + if(undequeued < 2)//one buf may reduce frame rate. + mDispBufUndqueueMin = 2; + else + mDispBufUndqueueMin = undequeued; ///Set the number of buffers needed for camera preview //total = numBufs+undequeued; diff --git a/hardware/rockchip/camera/Config/cam_board_rk3288.xml b/hardware/rockchip/camera/Config/cam_board_rk3288.xml index ab4114ab46..1ad43d6bc9 100755 --- a/hardware/rockchip/camera/Config/cam_board_rk3288.xml +++ b/hardware/rockchip/camera/Config/cam_board_rk3288.xml @@ -916,4 +916,135 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/hardware/rockchip/camera/Config/cam_board_rk3368.xml b/hardware/rockchip/camera/Config/cam_board_rk3368.xml index c8f94d570d..1eeebe9795 100644 --- a/hardware/rockchip/camera/Config/cam_board_rk3368.xml +++ b/hardware/rockchip/camera/Config/cam_board_rk3368.xml @@ -914,4 +914,135 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/hardware/rockchip/camera/SiliconImage/isi/drv/TC358749XBG_MIPI_YUV/Android.mk b/hardware/rockchip/camera/SiliconImage/isi/drv/TC358749XBG_MIPI_YUV/Android.mk new file mode 100644 index 0000000000..7eb3d7f523 --- /dev/null +++ b/hardware/rockchip/camera/SiliconImage/isi/drv/TC358749XBG_MIPI_YUV/Android.mk @@ -0,0 +1,39 @@ +# +# RockChip Camera HAL +# +LOCAL_PATH:= $(call my-dir) + +include $(CLEAR_VARS) + +LOCAL_SRC_FILES:=\ + source/TC358749XBG_PARREL.c\ + source/TC358749XBG_tables.c\ + + +LOCAL_C_INCLUDES += \ + $(LOCAL_PATH)/include_priv\ + $(LOCAL_PATH)/../../include\ + $(LOCAL_PATH)/../../include_priv\ + $(LOCAL_PATH)/../../../include\ + + + +LOCAL_CFLAGS := -Wall -Wextra -std=c99 -Wformat-nonliteral -g -O0 -DDEBUG -pedantic +LOCAL_CFLAGS += -DLINUX -DMIPI_USE_CAMERIC -DHAL_MOCKUP -DCAM_ENGINE_DRAW_DOM_ONLY -D_FILE_OFFSET_BITS=64 -DHAS_STDINT_H +#LOCAL_STATIC_LIBRARIES := libisp_ebase libisp_oslayer libisp_common libisp_hal libisp_cameric_reg_drv libisp_cameric_drv libisp_isi +LOCAL_SHARED_LIBRARIES := libutils libcutils libion libisp_silicomimageisp_api +LOCAL_MODULE:= libisp_isi_drv_TC358749XBG + +#LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw +ifneq (1,$(strip $(shell expr $(PLATFORM_VERSION) \>= 5.0))) +LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw +else +ifneq ($(strip $(TARGET_2ND_ARCH)), ) +LOCAL_MULTILIB := both +endif +LOCAL_MODULE_RELATIVE_PATH := hw +endif + +LOCAL_MODULE_TAGS:= optional +include $(BUILD_SHARED_LIBRARY) + diff --git a/hardware/rockchip/camera/SiliconImage/isi/drv/TC358749XBG_MIPI_YUV/include_priv/TC358749XBG_priv.h b/hardware/rockchip/camera/SiliconImage/isi/drv/TC358749XBG_MIPI_YUV/include_priv/TC358749XBG_priv.h new file mode 100644 index 0000000000..c4a6e462fa --- /dev/null +++ b/hardware/rockchip/camera/SiliconImage/isi/drv/TC358749XBG_MIPI_YUV/include_priv/TC358749XBG_priv.h @@ -0,0 +1,81 @@ +#ifndef __TC358749XBG_PRIV_H__ +#define __TC358749XBG_PRIV_H__ + +#include +#include +#include + +/* +*v0.1.0x00 : Create file; +*/ +#define CONFIG_SENSOR_DRV_VERSION KERNEL_VERSION(0, 1, 0) + + + +#ifdef __cplusplus +extern "C" +{ +#endif + +#define TC358749XBG_DELAY_5MS (0x0000) //delay 5 ms +#define TC358749XBG_MODE_SELECT (0x0100) // rw - Bit[7:1]not used Bit[0]Streaming set 0: software_standby 1: streaming +#define TC358749XBG_SOFTWARE_RST (0x7080) // rw - Bit[7:1]not used Bit[0]software_reset + +#define TC358749XBG_CHIP_ID_HIGH_BYTE_DEFAULT (0x0147)// (0x0147) // r - +#define TC358749XBG_CHIP_ID_MIDDLE_BYTE_DEFAULT (0x0081) // r - +#define TC358749XBG_CHIP_ID_LOW_BYTE_DEFAULT (0x0000) // r - + +#define TC358749XBG_CHIP_ID_HIGH_BYTE (0x0000) // r - +#define TC358749XBG_CHIP_ID_MIDDLE_BYTE (0x0002) // r - +#define TC358749XBG_CHIP_ID_LOW_BYTE (0x0004) // r - +/***************************************************************************** +* Further defines for driver management +*****************************************************************************/ +#define TC358749XBG_DRIVER_INIT (0x00000001) + +/***************************************************************************** + *context structure + *****************************************************************************/ +typedef struct TC358749XBG_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; + + IsiSensorMipiInfo IsiSensorMipiInfo; +} TC358749XBG_Context_t; + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/hardware/rockchip/camera/SiliconImage/isi/drv/TC358749XBG_MIPI_YUV/source/TC358749XBG_PARREL.c b/hardware/rockchip/camera/SiliconImage/isi/drv/TC358749XBG_MIPI_YUV/source/TC358749XBG_PARREL.c new file mode 100644 index 0000000000..bf02147712 --- /dev/null +++ b/hardware/rockchip/camera/SiliconImage/isi/drv/TC358749XBG_MIPI_YUV/source/TC358749XBG_PARREL.c @@ -0,0 +1,3476 @@ +/****************************************************************************** + * + * Copyright 2010, Dream Chip Technologies GmbH. All rights reserved. + * No part of this work may be reproduced, modified, distributed, transmitted, + * transcribed, or translated into any language or computer format, in any form + * or by any means without written permission of: + * Dream Chip Technologies GmbH, Steinriede 10, 30827 Garbsen / Berenbostel, + * Germany + * + *****************************************************************************/ +/** + * @file TC358749XBG.c + * + * @brief + * ADD_DESCRIPTION_HERE + * + *****************************************************************************/ +#include +#include +#include + +#include +#include + +#include "isi.h" +#include "isi_iss.h" +#include "isi_priv.h" + +#include "TC358749XBG_priv.h" + + +#define CC_OFFSET_SCALING 2.0f +#define I2C_COMPLIANT_STARTBIT 1U + +#define TC358749XBG_HDMI2MIPI 1 + + +/****************************************************************************** + * local macro definitions + *****************************************************************************/ +CREATE_TRACER( TC358749XBG_INFO , "TC358749XBG: ", INFO, 0U ); +CREATE_TRACER( TC358749XBG_WARN , "TC358749XBG: ", WARNING, 0U ); +CREATE_TRACER( TC358749XBG_ERROR, "TC358749XBG: ", ERROR, 1U ); + +CREATE_TRACER( TC358749XBG_DEBUG, "TC358749XBG: ", INFO, 0U ); + +CREATE_TRACER( TC358749XBG_REG_INFO , "TC358749XBG: ", INFO, 0U); +CREATE_TRACER( TC358749XBG_REG_DEBUG, "TC358749XBG: ", INFO, 0U ); + +#define TC358749XBG_SLAVE_ADDR 0x1FU //0x20 /**< i2c slave address of the TC358749XBG camera sensor */ +#define TC358749XBG_SLAVE_ADDR2 0x0F +#define TC358749XBG_SLAVE_AF_ADDR 0x00U /**< i2c slave address of the TC358749XBG integrated AD5820 */ + + + +/****************************************************************************** + * local variable declarations + *****************************************************************************/ +const char TC358749XBG_g_acName[] = "TC358749XBG_ SOC_PARREL"; +extern const IsiRegDescription_t TC358749XBG_g_aRegDescription[]; +extern const IsiRegDescription_t TC358749XBG_g_svga[]; +extern const IsiRegDescription_t TC358749XBG_g_1600x1200[]; +extern const IsiRegDescription_t TC358749XBG_g_hdmi_input_check[]; +extern const IsiRegDescription_t TC358749XBG_g_edio[]; +extern const IsiRegDescription_t TC358749XBG_g_aRegVedioON[]; + + + + +const IsiSensorCaps_t TC358749XBG_g_IsiSensorDefaultConfig; + + +#define TC358749XBG_I2C_START_BIT (I2C_COMPLIANT_STARTBIT) // I2C bus start condition +#define TC358749XBG_I2C_NR_ADR_BYTES (2U) // 1 byte base address and 2 bytes sub address +#define TC358749XBG_I2C_NR_DAT_BYTES (2U) // 16 bit registers + +static uint16_t g_suppoted_mipi_lanenum_type = SUPPORT_MIPI_FOUR_LANE; +#define DEFAULT_NUM_LANES SUPPORT_MIPI_ONE_LANE +static bool bHdmiinExit = false; +static osThread gHdmiinThreadId; +/****************************************************************************** + * local function prototypes + *****************************************************************************/ +static RESULT TC358749XBG_IsiCreateSensorIss( IsiSensorInstanceConfig_t *pConfig ); +static RESULT TC358749XBG_IsiReleaseSensorIss( IsiSensorHandle_t handle ); +static RESULT TC358749XBG_IsiGetCapsIss( IsiSensorHandle_t handle, IsiSensorCaps_t *pIsiSensorCaps ); +static RESULT TC358749XBG_IsiSetupSensorIss( IsiSensorHandle_t handle, const IsiSensorConfig_t *pConfig ); +static RESULT TC358749XBG_IsiSensorSetStreamingIss( IsiSensorHandle_t handle, bool_t on ); +static RESULT TC358749XBG_IsiSensorSetPowerIss( IsiSensorHandle_t handle, bool_t on ); +static RESULT TC358749XBG_IsiCheckSensorConnectionIss( IsiSensorHandle_t handle ); +static RESULT TC358749XBG_IsiGetSensorRevisionIss( IsiSensorHandle_t handle, uint32_t *p_value); + +static RESULT TC358749XBG_IsiGetGainLimitsIss( IsiSensorHandle_t handle, float *pMinGain, float *pMaxGain); +static RESULT TC358749XBG_IsiGetIntegrationTimeLimitsIss( IsiSensorHandle_t handle, float *pMinIntegrationTime, float *pMaxIntegrationTime ); +static RESULT TC358749XBG_IsiExposureControlIss( IsiSensorHandle_t handle, float NewGain, float NewIntegrationTime, uint8_t *pNumberOfFramesToSkip, float *pSetGain, float *pSetIntegrationTime ); +static RESULT TC358749XBG_IsiGetCurrentExposureIss( IsiSensorHandle_t handle, float *pSetGain, float *pSetIntegrationTime ); +static RESULT TC358749XBG_IsiGetAfpsInfoIss ( IsiSensorHandle_t handle, uint32_t Resolution, IsiAfpsInfo_t* pAfpsInfo); +static RESULT TC358749XBG_IsiGetGainIss( IsiSensorHandle_t handle, float *pSetGain ); +static RESULT TC358749XBG_IsiGetGainIncrementIss( IsiSensorHandle_t handle, float *pIncr ); +static RESULT TC358749XBG_IsiSetGainIss( IsiSensorHandle_t handle, float NewGain, float *pSetGain ); +static RESULT TC358749XBG_IsiGetIntegrationTimeIss( IsiSensorHandle_t handle, float *pSetIntegrationTime ); +static RESULT TC358749XBG_IsiGetIntegrationTimeIncrementIss( IsiSensorHandle_t handle, float *pIncr ); +static RESULT TC358749XBG_IsiSetIntegrationTimeIss( IsiSensorHandle_t handle, float NewIntegrationTime, float *pSetIntegrationTime, uint8_t *pNumberOfFramesToSkip ); +static RESULT TC358749XBG_IsiGetResolutionIss( IsiSensorHandle_t handle, uint32_t *pSetResolution ); + +static RESULT TC358749XBG_IsiRegVedioReadIss( IsiSensorHandle_t handle, const uint32_t address, uint32_t *p_value ); + +static RESULT TC358749XBG_IsiRegReadIss( IsiSensorHandle_t handle, const uint32_t address, uint32_t *p_value ); +static RESULT TC358749XBG_IsiRegVedioWriteIss( IsiSensorHandle_t handle, const uint32_t address, const uint32_t value ); + +static RESULT TC358749XBG_IsiRegWriteIss( IsiSensorHandle_t handle, const uint32_t address, const uint32_t value ); + +static RESULT TC358749XBG_IsiGetCalibKFactor( IsiSensorHandle_t handle, Isi1x1FloatMatrix_t **pIsiKFactor ); +static RESULT TC358749XBG_IsiGetCalibPcaMatrix( IsiSensorHandle_t handle, Isi3x2FloatMatrix_t **pIsiPcaMatrix ); +static RESULT TC358749XBG_IsiGetCalibSvdMeanValue( IsiSensorHandle_t handle, Isi3x1FloatMatrix_t **pIsiSvdMeanValue ); +static RESULT TC358749XBG_IsiGetCalibCenterLine( IsiSensorHandle_t handle, IsiLine_t **ptIsiCenterLine); +static RESULT TC358749XBG_IsiGetCalibClipParam( IsiSensorHandle_t handle, IsiAwbClipParm_t **pIsiClipParam ); +static RESULT TC358749XBG_IsiGetCalibGlobalFadeParam( IsiSensorHandle_t handle, IsiAwbGlobalFadeParm_t **ptIsiGlobalFadeParam); +static RESULT TC358749XBG_IsiGetCalibFadeParam( IsiSensorHandle_t handle, IsiAwbFade2Parm_t **ptIsiFadeParam); +static RESULT TC358749XBG_IsiGetIlluProfile( IsiSensorHandle_t handle, const uint32_t CieProfile, IsiIlluProfile_t **ptIsiIlluProfile ); + +static RESULT TC358749XBG_IsiMdiInitMotoDriveMds( IsiSensorHandle_t handle ); +static RESULT TC358749XBG_IsiMdiSetupMotoDrive( IsiSensorHandle_t handle, uint32_t *pMaxStep ); +static RESULT TC358749XBG_IsiMdiFocusSet( IsiSensorHandle_t handle, const uint32_t Position ); +static RESULT TC358749XBG_IsiMdiFocusGet( IsiSensorHandle_t handle, uint32_t *pAbsStep ); +static RESULT TC358749XBG_IsiMdiFocusCalibrate( IsiSensorHandle_t handle ); + +static RESULT TC358749XBG_IsiGetSensorMipiInfoIss( IsiSensorHandle_t handle, IsiSensorMipiInfo *ptIsiSensorMipiInfo); +static RESULT TC358749XBG_IsiGetSensorIsiVersion( IsiSensorHandle_t handle, unsigned int* pVersion); + +static RESULT TC358749XBG_HdmiGetInputCheckRegIss(IsiSensorHandle_t handle, uint32_t *p_value); +static RESULT TC358749XBG_HdmiInputCheckRegReadIss( IsiSensorHandle_t handle, const uint32_t address,uint32_t *p_value); + + static int32_t HdmiinThreadHandler +( + void *p_arg +) +{ + IsiSensorHandle_t handle = (IsiSensorHandle_t)p_arg; + int ret = 0; + uint8_t p_value=0x00; + uint8_t p_color=0x00; + + TRACE( TC358749XBG_INFO, "%s: -----hdmiin--- thread--------\n", __FUNCTION__ ); + while(!bHdmiinExit){ + ret = IsiI2cReadSensorRegister( handle, 0x8521, &p_value, 1, BOOL_TRUE ); + TRACE( TC358749XBG_DEBUG, "%s (exit: 0x8521 0x%08x)\n", __FUNCTION__, p_value); + p_value = p_value & (0x0f); + if(p_value == 0xf) { + property_set("sys.hdmiin.resolution", "1"); + TRACE( TC358749XBG_DEBUG, "%s (exit: 1080P)\n", __FUNCTION__); + } else if(p_value == 0xc) { + property_set("sys.hdmiin.resolution", "2"); + TRACE( TC358749XBG_DEBUG, "%s (exit: 720P)\n", __FUNCTION__); + } + ret = IsiI2cReadSensorRegister( handle, 0x8528, &p_color, 1, BOOL_TRUE ); + TRACE( TC358749XBG_DEBUG, "%s (exit: 0x8528 0x%08x)\n", __FUNCTION__, p_color); + TRACE( TC358749XBG_DEBUG, "%s: -------- thread--------\n", __FUNCTION__ ); + osSleep( 2000 ); + } + return 0; +} + + +/*****************************************************************************/ +/** + * TC358749XBG_IsiCreateSensorIss + * + * @brief This function creates a new TC358749XBG 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 TC358749XBG_IsiCreateSensorIss +( + IsiSensorInstanceConfig_t *pConfig +) +{ + RESULT result = RET_SUCCESS; + + TC358749XBG_Context_t *pTC358749XBGCtx; + + TRACE( TC358749XBG_INFO, "%s (enter)\n", __FUNCTION__); + + if ( (pConfig == NULL) || (pConfig->pSensor ==NULL) ) + { + return ( RET_NULL_POINTER ); + } + + pTC358749XBGCtx = ( TC358749XBG_Context_t * )malloc ( sizeof (TC358749XBG_Context_t) ); + if ( pTC358749XBGCtx == NULL ) + { + TRACE( TC358749XBG_ERROR, "%s: Can't allocate ov14825 context\n", __FUNCTION__ ); + return ( RET_OUTOFMEM ); + } + MEMSET( pTC358749XBGCtx, 0, sizeof( TC358749XBG_Context_t ) ); + + result = HalAddRef( pConfig->HalHandle ); + if ( result != RET_SUCCESS ) + { + free ( pTC358749XBGCtx ); + return ( result ); + } + + pTC358749XBGCtx->IsiCtx.HalHandle = pConfig->HalHandle; + pTC358749XBGCtx->IsiCtx.HalDevID = pConfig->HalDevID; + pTC358749XBGCtx->IsiCtx.I2cBusNum = pConfig->I2cBusNum; + pTC358749XBGCtx->IsiCtx.SlaveAddress = ( pConfig->SlaveAddr == 0 ) ? TC358749XBG_SLAVE_ADDR : pConfig->SlaveAddr; + pTC358749XBGCtx->IsiCtx.NrOfAddressBytes = 2U; + + pTC358749XBGCtx->IsiCtx.I2cAfBusNum = pConfig->I2cAfBusNum; + pTC358749XBGCtx->IsiCtx.SlaveAfAddress = ( pConfig->SlaveAfAddr == 0 ) ? TC358749XBG_SLAVE_AF_ADDR : pConfig->SlaveAfAddr; + pTC358749XBGCtx->IsiCtx.NrOfAfAddressBytes = 0; + + pTC358749XBGCtx->IsiCtx.pSensor = pConfig->pSensor; + + pTC358749XBGCtx->Configured = BOOL_FALSE; + pTC358749XBGCtx->Streaming = BOOL_FALSE; + pTC358749XBGCtx->TestPattern = BOOL_FALSE; + pTC358749XBGCtx->isAfpsRun = BOOL_FALSE; + + pTC358749XBGCtx->IsiSensorMipiInfo.sensorHalDevID = pTC358749XBGCtx->IsiCtx.HalDevID; + if(pConfig->mipiLaneNum & g_suppoted_mipi_lanenum_type){ + pTC358749XBGCtx->IsiSensorMipiInfo.ucMipiLanes = pConfig->mipiLaneNum; + TRACE( TC358749XBG_INFO, "%s set lane numbers :%d\n", __FUNCTION__,pConfig->mipiLaneNum); + }else{ + TRACE( TC358749XBG_ERROR, "%s don't support lane numbers :%d,set to default %d\n", __FUNCTION__,pConfig->mipiLaneNum,DEFAULT_NUM_LANES); + pTC358749XBGCtx->IsiSensorMipiInfo.ucMipiLanes = DEFAULT_NUM_LANES; + } + + pConfig->hSensor = ( IsiSensorHandle_t )pTC358749XBGCtx; + +// result = HalSetCamConfig( pTC358749XBGCtx->IsiCtx.HalHandle, pTC358749XBGCtx->IsiCtx.HalDevID, true, true, false ); +// RETURN_RESULT_IF_DIFFERENT( RET_SUCCESS, result ); + +// result = HalSetClock( pTC358749XBGCtx->IsiCtx.HalHandle, pTC358749XBGCtx->IsiCtx.HalDevID, 10000000U); +// RETURN_RESULT_IF_DIFFERENT( RET_SUCCESS, result ); + bHdmiinExit = false; + osThreadCreate( &gHdmiinThreadId, HdmiinThreadHandler, (void *)pTC358749XBGCtx); + + + + TRACE( TC358749XBG_INFO, "%s (exit)\n", __FUNCTION__); + + return ( result ); +} + + + +/*****************************************************************************/ +/** + * TC358749XBG_IsiReleaseSensorIss + * + * @brief This function destroys/releases an TC358749XBG sensor instance. + * + * @param handle TC358749XBG sensor instance handle + * + * @return Return the result of the function call. + * @retval RET_SUCCESS + * @retval RET_WRONG_HANDLE + * + *****************************************************************************/ +static RESULT TC358749XBG_IsiReleaseSensorIss +( + IsiSensorHandle_t handle +) +{ + TC358749XBG_Context_t *pTC358749XBGCtx = (TC358749XBG_Context_t *)handle; + + RESULT result = RET_SUCCESS; + + TRACE( TC358749XBG_INFO, "%s (enter)\n", __FUNCTION__); + + if ( pTC358749XBGCtx == NULL ) + { + return ( RET_WRONG_HANDLE ); + } + +// (void)TC358749XBG_IsiSensorSetStreamingIss( pTC358749XBGCtx, BOOL_FALSE ); +// (void)TC358749XBG_IsiSensorSetPowerIss( pTC358749XBGCtx, BOOL_FALSE ); + + (void)HalDelRef( pTC358749XBGCtx->IsiCtx.HalHandle ); + + MEMSET( pTC358749XBGCtx, 0, sizeof( TC358749XBG_Context_t ) ); + free ( pTC358749XBGCtx ); + bHdmiinExit = true; + if ( OSLAYER_OK != osThreadWait( &gHdmiinThreadId) ) + TRACE( TC358749XBG_DEBUG, "%s wait hdmiiin listener thread exit\n", __FUNCTION__); + if ( OSLAYER_OK != osThreadClose( &gHdmiinThreadId ) ) + TRACE( TC358749XBG_DEBUG, "%s hdmiiin listener thread exit\n", __FUNCTION__); + TRACE( TC358749XBG_INFO, "%s (exit)\n", __FUNCTION__); + + return ( result ); +} + + + +/*****************************************************************************/ +/** + * TC358749XBG_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 TC358749XBG_IsiGetCapsIssInternal +( + IsiSensorCaps_t *pIsiSensorCaps, + uint32_t mipi_lanes +) +{ + + RESULT result = RET_SUCCESS; + + TRACE( TC358749XBG_INFO, "%s (enter)\n", __FUNCTION__); + + + if ( pIsiSensorCaps == NULL ) + { + return ( RET_NULL_POINTER ); + } + else + { + + if(mipi_lanes == SUPPORT_MIPI_FOUR_LANE){ + switch (pIsiSensorCaps->Index) + { + case 0: + { + pIsiSensorCaps->Resolution = ISI_RES_TV1080P60; + break; + } + case 1: + { + pIsiSensorCaps->Resolution = ISI_RES_TV720P60; + break; + } + 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_CBYCRY; + pIsiSensorCaps->Conv422 = ISI_CONV422_NOCOSITED; + pIsiSensorCaps->BPat = ISI_BPAT_RGRGGBGB ; + pIsiSensorCaps->HPol = ISI_HPOL_REFPOS; //hsync? + pIsiSensorCaps->VPol = ISI_VPOL_POS; //VPolarity + pIsiSensorCaps->Edge = ISI_EDGE_RISING; + pIsiSensorCaps->Bls = ISI_BLS_OFF; //close; + 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( TC358749XBG_INFO, "%s (exit)\n", __FUNCTION__); + + return ( result ); +} + + +static RESULT TC358749XBG_IsiGetCapsIss +( + IsiSensorHandle_t handle, + IsiSensorCaps_t *pIsiSensorCaps +) +{ + TC358749XBG_Context_t *pTC358749XBGCtx = (TC358749XBG_Context_t *)handle; + + RESULT result = RET_SUCCESS; + + TRACE( TC358749XBG_INFO, "%s (enter)\n", __FUNCTION__); + + if ( pTC358749XBGCtx == NULL ) + { + return ( RET_WRONG_HANDLE ); + } + + result = TC358749XBG_IsiGetCapsIssInternal(pIsiSensorCaps, pTC358749XBGCtx->IsiSensorMipiInfo.ucMipiLanes); + + + + TRACE( TC358749XBG_DEBUG, "%d ( pIsiSensorCaps->Index)\n", pIsiSensorCaps->Index); + TRACE( TC358749XBG_INFO, "%s (exit)\n", __FUNCTION__); + + return ( result ); +} + + +/*****************************************************************************/ +/** + * TC358749XBG_g_IsiSensorDefaultConfig + * + * @brief recommended default configuration for application use via call + * to IsiGetSensorIss() + * + *****************************************************************************/ +const IsiSensorCaps_t TC358749XBG_g_IsiSensorDefaultConfig = +{ + ISI_BUSWIDTH_8BIT_ZZ, // BusWidth + ISI_MODE_BT601, //ISI_MODE_MIPI, // MIPI + ISI_FIELDSEL_BOTH, // FieldSel + ISI_YCSEQ_CBYCRY, // YCSeq + ISI_CONV422_NOCOSITED, // Conv422 + ISI_BPAT_BGBGGRGR,//ISI_BPAT_BGBGGRGR, // BPat + ISI_HPOL_REFPOS, // HPol + ISI_VPOL_POS, // VPol + ISI_EDGE_FALLING, // Edge + ISI_BLS_OFF, // Bls + ISI_GAMMA_OFF, // Gamma + ISI_CCONV_OFF, // CConv + ISI_RES_SVGAP30, // Res + ISI_DWNSZ_SUBSMPL, // DwnSz + ISI_BLC_OFF , // BLC + ISI_AGC_OFF, // AGC + ISI_AWB_OFF, // AWB + ISI_AEC_OFF, // AEC + ISI_DPCC_OFF, // 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, +}; + + + +/*****************************************************************************/ +/** + * TC358749XBG_SetupOutputFormat + * + * @brief Setup of the image sensor considering the given configuration. + * + * @param handle TC358749XBG 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 TC358749XBG_SetupOutputFormat +( + TC358749XBG_Context_t *pTC358749XBGCtx, + const IsiSensorConfig_t *pConfig +) +{ + RESULT result = RET_SUCCESS; + TRACE( TC358749XBG_INFO, "%s%s (enter)\n", __FUNCTION__, pTC358749XBGCtx->isAfpsRun?"(AFPS)":"" ); + + /* bus-width */ + switch ( pConfig->BusWidth ) /* only ISI_BUSWIDTH_12BIT supported, no configuration needed here */ + { + case ISI_BUSWIDTH_8BIT_ZZ: + { + break; + } + + default: + { + TRACE( TC358749XBG_ERROR, "%s%s: bus width not supported\n", __FUNCTION__, pTC358749XBGCtx->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( TC358749XBG_ERROR, "%s%s: mode not supported\n", __FUNCTION__, pTC358749XBGCtx->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( TC358749XBG_ERROR, "%s%s: field selection not supported\n", __FUNCTION__, pTC358749XBGCtx->isAfpsRun?"(AFPS)":"" ); + return ( RET_NOTSUPP ); + } + } + + /* only Bayer mode is supported by TC358749XBG sensor, so the YCSequence parameter is not checked */ + 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( TC358749XBG_ERROR, "%s%s: 422 conversion not supported\n", __FUNCTION__, pTC358749XBGCtx->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( TC358749XBG_ERROR, "%s%s: bayer pattern not supported\n", __FUNCTION__, pTC358749XBGCtx->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( TC358749XBG_ERROR, "%s%s: HPol not supported\n", __FUNCTION__, pTC358749XBGCtx->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( TC358749XBG_ERROR, "%s%s: VPol not supported\n", __FUNCTION__, pTC358749XBGCtx->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( TC358749XBG_ERROR, "%s%s: edge mode not supported\n", __FUNCTION__, pTC358749XBGCtx->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( TC358749XBG_ERROR, "%s%s: gamma not supported\n", __FUNCTION__, pTC358749XBGCtx->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( TC358749XBG_ERROR, "%s%s: color conversion not supported\n", __FUNCTION__, pTC358749XBGCtx->isAfpsRun?"(AFPS)":"" ); + return ( RET_NOTSUPP ); + } + } + + switch ( pConfig->SmiaMode ) /* only ISI_SMIA_OFF supported, no configuration needed */ + { + case ISI_SMIA_OFF: + { + break; + } + + default: + { + TRACE( TC358749XBG_ERROR, "%s%s: SMIA mode not supported\n", __FUNCTION__, pTC358749XBGCtx->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( TC358749XBG_ERROR, "%s%s: MIPI mode not supported\n", __FUNCTION__, pTC358749XBGCtx->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(TC358749XBGC_ERROR, "%s%s: AFPS not supported\n", __FUNCTION__, pTC358749XBGCtx->isAfpsRun?"(AFPS)":"" ); + //return ( RET_NOTSUPP ); + } + } + + TRACE( TC358749XBG_INFO, "%s%s (exit)\n", __FUNCTION__, pTC358749XBGCtx->isAfpsRun?"(AFPS)":""); + return ( result ); + +} + +int TC358749XBG_get_PCLK( TC358749XBG_Context_t *pTC358749XBGCtx, int XVCLK) +{ + // calculate PCLK + + return 0; +} + +/*****************************************************************************/ +/** + * TC358749XBG_SetupOutputWindow + * + * @brief Setup of the image sensor considering the given configuration. + * + * @param handle TC358749XBG 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 TC358749XBG_SetupOutputWindow +( + TC358749XBG_Context_t *pTC358749XBGCtx, + const IsiSensorConfig_t *pConfig +) +{ + RESULT result = RET_SUCCESS; + + TRACE( TC358749XBG_INFO, "%s (enter.....)\n", __FUNCTION__); + pTC358749XBGCtx->IsiSensorMipiInfo.ulMipiFreq = 648; +#if 0 //kings + /* resolution */ + switch ( pConfig->Resolution ) + { + case ISI_RES_SVGAP30: + { + if((result = IsiRegDefaultsApply((IsiSensorHandle_t)pTC358749XBGCtx,TC358749XBG_g_svga)) != RET_SUCCESS){ + TRACE( TC358749XBG_ERROR, "%s: failed to set ISI_RES_SVGAP30 \n", __FUNCTION__ ); + }else{ + + TRACE( TC358749XBG_DEBUG, "%s: success to set ISI_RES_SVGAP30 \n", __FUNCTION__ ); + } + break; + } + case ISI_RES_1600_1200P7: + { + if((result = IsiRegDefaultsApply((IsiSensorHandle_t)pTC358749XBGCtx,TC358749XBG_g_1600x1200)) != RET_SUCCESS){ + TRACE( TC358749XBG_ERROR, "%s: failed to set ISI_RES_1600_1200P7 \n", __FUNCTION__ ); + }else{ + + TRACE( TC358749XBG_DEBUG, "%s: success to set ISI_RES_1600_1200P7 \n", __FUNCTION__ ); + } + break; + } + default: + { + TRACE( TC358749XBG_ERROR, "%s: Resolution not supported\n", __FUNCTION__ ); + return ( RET_NOTSUPP ); + } + } + +#endif + return ( result ); +} + + + + +/*****************************************************************************/ +/** + * TC358749XBG_SetupImageControl + * + * @brief Sets the image control functions (BLC, AGC, AWB, AEC, DPCC ...) + * + * @param handle TC358749XBG 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 TC358749XBG_SetupImageControl +( + TC358749XBG_Context_t *pTC358749XBGCtx, + const IsiSensorConfig_t *pConfig +) +{ + RESULT result = RET_SUCCESS; + + uint32_t RegValue = 0U; + + TRACE( TC358749XBG_INFO, "%s (enter)\n", __FUNCTION__); + + + return ( result ); +} + + +/*****************************************************************************/ +/** + * TC358749XBG_AecSetModeParameters + * + * @brief This function fills in the correct parameters in TC358749XBG-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 TC358749XBG 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 TC358749XBG_AecSetModeParameters +( + TC358749XBG_Context_t *pTC358749XBGCtx, + const IsiSensorConfig_t *pConfig +) +{ + RESULT result = RET_SUCCESS; + + return ( result ); +} +//static int int11; +/*****************************************************************************/ +/** + * TC358749XBG_IsiSetupSensorIss + * + * @brief Setup of the image sensor considering the given configuration. + * + * @param handle TC358749XBG 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 TC358749XBG_IsiSetupSensorIss +( + IsiSensorHandle_t handle, + const IsiSensorConfig_t *pConfig +) +{ + uint32_t data; + TC358749XBG_Context_t *pTC358749XBGCtx = (TC358749XBG_Context_t *)handle; + + RESULT result = RET_SUCCESS; + + uint32_t RegValue = 0; + + TRACE( TC358749XBG_INFO, "%s (enter)\n", __FUNCTION__); + + if ( pTC358749XBGCtx == NULL ) + { + TRACE( TC358749XBG_ERROR, "%s: Invalid sensor handle (NULL pointer detected)\n", __FUNCTION__ ); + return ( RET_WRONG_HANDLE ); + } + + if ( pConfig == NULL ) + { + TRACE( TC358749XBG_ERROR, "%s: Invalid configuration (NULL pointer detected)\n", __FUNCTION__ ); + return ( RET_NULL_POINTER ); + } + + if ( pTC358749XBGCtx->Streaming != BOOL_FALSE ) + { + return RET_WRONG_STATE; + } + + MEMCPY( &pTC358749XBGCtx->Config, pConfig, sizeof( IsiSensorConfig_t ) ); + + /* 2.) write default values derived from datasheet and evaluation kit (static setup altered by dynamic setup further below) */ + result = IsiRegDefaultsApply( pTC358749XBGCtx, TC358749XBG_g_aRegDescription ); + if ( result != RET_SUCCESS ) + { + return ( result ); + } + + /* sleep a while, that sensor can take over new default values */ + osSleep( 10 ); + #if 1 //kings + + + /* 3.) verify default values to make sure everything has been written correctly as expected */ + result = IsiRegDefaultsVerify( pTC358749XBGCtx, TC358749XBG_g_aRegDescription ); + if ( result != RET_SUCCESS ) + { + return ( result ); + } + // output of pclk for measurement (only debugging) + //result = TC358749XBG_IsiRegWriteIss( pTC358749XBGCtx, 0x3009U, 0x10U ); + RETURN_RESULT_IF_DIFFERENT( RET_SUCCESS, result ); + + //KINGS hdmi input timing check + //TC358749XBG_HdmiGetInputCheckRegIss(pTC358749XBGCtx,&data); + + #endif + + /* 4.) setup output format (RAW10|RAW12) */ + result = TC358749XBG_SetupOutputFormat( pTC358749XBGCtx, pConfig ); + if ( result != RET_SUCCESS ) + { + TRACE( TC358749XBG_ERROR, "%s: SetupOutputFormat failed.\n", __FUNCTION__); + return ( result ); + } + + /* 5.) setup output window */ + result = TC358749XBG_SetupOutputWindow( pTC358749XBGCtx, pConfig ); + if ( result != RET_SUCCESS ) + { + TRACE( TC358749XBG_ERROR, "%s: SetupOutputWindow failed.\n", __FUNCTION__); + return ( result ); + } + + result = TC358749XBG_SetupImageControl( pTC358749XBGCtx, pConfig ); + if ( result != RET_SUCCESS ) + { + TRACE( TC358749XBG_ERROR, "%s: SetupImageControl failed.\n", __FUNCTION__); + return ( result ); + } + + result = TC358749XBG_AecSetModeParameters( pTC358749XBGCtx, pConfig ); + if ( result != RET_SUCCESS ) + { + TRACE( TC358749XBG_ERROR, "%s: AecSetModeParameters failed.\n", __FUNCTION__); + return ( result ); + } + + if (result == RET_SUCCESS) + { + pTC358749XBGCtx->Configured = BOOL_TRUE; + } + + TRACE( TC358749XBG_INFO, "%s: (exit)\n", __FUNCTION__); + + return ( result ); +} + + + +/*****************************************************************************/ +/** + * TC358749XBG_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 TC358749XBG_IsiChangeSensorResolutionIss +( + IsiSensorHandle_t handle, + uint32_t Resolution, + uint8_t *pNumberOfFramesToSkip +) +{ + TC358749XBG_Context_t *pTC358749XBGCtx = (TC358749XBG_Context_t *)handle; + + RESULT result = RET_SUCCESS; + + TRACE( TC358749XBG_INFO, "%s (enter)\n", __FUNCTION__); + + if ( pTC358749XBGCtx == NULL ) + { + return ( RET_WRONG_HANDLE ); + } + + if (pNumberOfFramesToSkip == NULL) + { + return ( RET_NULL_POINTER ); + } + + if ( (pTC358749XBGCtx->Configured != BOOL_TRUE) || (pTC358749XBGCtx->Streaming != BOOL_FALSE) ) + { + return RET_WRONG_STATE; + } + + IsiSensorCaps_t Caps; + Caps.Index = 0; + Caps.Resolution = 0; + while (TC358749XBG_IsiGetCapsIss( handle, &Caps) == RET_SUCCESS) { + if (Resolution == Caps.Resolution) { + break; + } + Caps.Index++; + } + + if ( (Resolution & Caps.Resolution) == 0 ) + { + return RET_OUTOFRANGE; + } + + if ( Resolution == pTC358749XBGCtx->Config.Resolution ) + { + // well, no need to worry + *pNumberOfFramesToSkip = 0; + } + else + { + // change resolution + char *szResName = NULL; + result = IsiGetResolutionName( Resolution, &szResName ); + TRACE( TC358749XBG_DEBUG, "%s: NewRes=0x%08x (%s)\n", __FUNCTION__, Resolution, szResName); + + // update resolution in copy of config in context + pTC358749XBGCtx->Config.Resolution = Resolution; + + // tell sensor about that + result = TC358749XBG_SetupOutputWindow( pTC358749XBGCtx, &pTC358749XBGCtx->Config ); + if ( result != RET_SUCCESS ) + { + TRACE( TC358749XBG_ERROR, "%s: SetupOutputWindow failed.\n", __FUNCTION__); + return ( result ); + } + + // remember old exposure values + float OldGain = pTC358749XBGCtx->AecCurGain; + float OldIntegrationTime = pTC358749XBGCtx->AecCurIntegrationTime; + + // update limits & stuff (reset current & old settings) + result = TC358749XBG_AecSetModeParameters( pTC358749XBGCtx, &pTC358749XBGCtx->Config ); + if ( result != RET_SUCCESS ) + { + TRACE( TC358749XBG_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 = TC358749XBG_IsiExposureControlIss( handle, OldGain, OldIntegrationTime, &NumberOfFramesToSkip, &DummySetGain, &DummySetIntegrationTime ); + if ( result != RET_SUCCESS ) + { + TRACE( TC358749XBG_ERROR, "%s: TC358749XBG_IsiExposureControlIss failed.\n", __FUNCTION__); + return ( result ); + } + + // return number of frames that aren't exposed correctly + *pNumberOfFramesToSkip = NumberOfFramesToSkip + 1; + } + + TRACE( TC358749XBG_INFO, "%s (exit)\n", __FUNCTION__); + + return ( result ); +} + + + +/*****************************************************************************/ +/** + * TC358749XBG_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 TC358749XBG_IsiSensorSetStreamingIss +( + IsiSensorHandle_t handle, + bool_t on +) +{ + uint32_t RegValue = 0; + + TC358749XBG_Context_t *pTC358749XBGCtx = (TC358749XBG_Context_t *)handle; + + RESULT result = RET_SUCCESS; + + TRACE( TC358749XBG_INFO, "%s (enter)\n", __FUNCTION__); + + if ( pTC358749XBGCtx == NULL ) + { + return ( RET_WRONG_HANDLE ); + } + + if ( (pTC358749XBGCtx->Configured != BOOL_TRUE) || (pTC358749XBGCtx->Streaming == on) ) + { + return RET_WRONG_STATE; + } + + if (on == BOOL_TRUE) + { + /* enable streaming */ + //{0x854A ,0x00,"0x0100",eReadWrite},//01 + //{0x0004 ,0xD70C,"0x0100",eReadWrite_16}, //ConfCtl 0CD7 + result = TC358749XBG_IsiRegVedioReadIss ( handle, 0x854A, &RegValue); + TRACE( TC358749XBG_DEBUG, "0x854A = 0x%8x(BOOL_TRUE)\n", RegValue); + RETURN_RESULT_IF_DIFFERENT( RET_SUCCESS, result ); + result = TC358749XBG_IsiRegVedioReadIss ( handle, 0x854A, &RegValue); + TRACE( TC358749XBG_DEBUG, "0x854A = 0x%8x(BOOL_TRUE)\n", RegValue); + RETURN_RESULT_IF_DIFFERENT( RET_SUCCESS, result ); + result = TC358749XBG_IsiRegVedioReadIss ( handle, 0x0004, &RegValue); + TRACE( TC358749XBG_DEBUG, "0x0004 = 0x%8x(BOOL_TRUE)\n", RegValue); + RETURN_RESULT_IF_DIFFERENT( RET_SUCCESS, result ); + + //result = TC358749XBG_IsiRegVedioWriteIss( handle, 0x854A, 0x01); + //result = TC358749XBG_IsiRegVedioWriteIss( handle, 0x854A, 0x01); + //osSleep( 1 ); + //result = TC358749XBG_IsiRegVedioWriteIss( handle, 0x0004, 0xD70C); + TRACE( TC358749XBG_DEBUG, "%s (BOOL_TRUE)\n", __FUNCTION__); + result = RET_SUCCESS; + + } + else + { + /* disable streaming */ + //result = TC358749XBG_IsiRegVedioWriteIss( handle, 0x854A, 0x00); + //osSleep( 1 ); + //result = TC358749XBG_IsiRegVedioWriteIss( handle, 0x0004, 0xD60C); + //result = TC358749XBG_IsiRegWriteIss( handle, 0x4200, 0x0f); + /* + result = TC358749XBG_IsiRegReadIss ( handle, OV8858_MODE_SELECT, &RegValue); + RETURN_RESULT_IF_DIFFERENT( RET_SUCCESS, result ); + result = TC358749XBG_IsiRegWriteIss ( handle, OV8858_MODE_SELECT, (RegValue & ~OV8858_MODE_SELECT_ON) ); + RETURN_RESULT_IF_DIFFERENT( RET_SUCCESS, result ); + */ + TRACE( TC358749XBG_DEBUG, "%s (BOOL_FLUSE)\n", __FUNCTION__); + result = RET_SUCCESS; + + } + + if (result == RET_SUCCESS) + { + pTC358749XBGCtx->Streaming = on; + } + + TRACE( TC358749XBG_INFO, "%s (exit)\n", __FUNCTION__); + + return ( result ); +} + + + +/*****************************************************************************/ +/** + * TC358749XBG_IsiSensorSetPowerIss + * + * @brief Performs the power-up/power-down sequence of the camera, if possible. + * + * @param handle TC358749XBG 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 TC358749XBG_IsiSensorSetPowerIss +( + IsiSensorHandle_t handle, + bool_t on +) +{ + TC358749XBG_Context_t *pTC358749XBGCtx = (TC358749XBG_Context_t *)handle; + + RESULT result = RET_SUCCESS; + + TRACE( TC358749XBG_INFO, "%s (enter)\n", __FUNCTION__); + + if ( pTC358749XBGCtx == NULL ) + { + return ( RET_WRONG_HANDLE ); + } + + pTC358749XBGCtx->Configured = BOOL_FALSE; + pTC358749XBGCtx->Streaming = BOOL_FALSE; +#if 0 + TRACE( TC358749XBG_INFO, "%s power off \n", __FUNCTION__); + result = HalSetPower( pTC358749XBGCtx->IsiCtx.HalHandle, pTC358749XBGCtx->IsiCtx.HalDevID, false ); + RETURN_RESULT_IF_DIFFERENT( RET_SUCCESS, result ); + + TRACE( TC358749XBG_INFO, "%s reset on\n", __FUNCTION__); + result = HalSetReset( pTC358749XBGCtx->IsiCtx.HalHandle, pTC358749XBGCtx->IsiCtx.HalDevID, true ); + RETURN_RESULT_IF_DIFFERENT( RET_SUCCESS, result ); + + if (on == BOOL_TRUE) + { + TRACE( TC358749XBG_DEBUG, "%s power on \n", __FUNCTION__); + result = HalSetPower( pTC358749XBGCtx->IsiCtx.HalHandle, pTC358749XBGCtx->IsiCtx.HalDevID, true ); + RETURN_RESULT_IF_DIFFERENT( RET_SUCCESS, result ); + + osSleep( 10 ); + + TRACE( TC358749XBG_DEBUG, "%s reset off \n", __FUNCTION__); + result = HalSetReset( pTC358749XBGCtx->IsiCtx.HalHandle, pTC358749XBGCtx->IsiCtx.HalDevID, false ); + RETURN_RESULT_IF_DIFFERENT( RET_SUCCESS, result ); + + osSleep( 10 ); + + TRACE( TC358749XBG_DEBUG, "%s reset on \n", __FUNCTION__); + result = HalSetReset( pTC358749XBGCtx->IsiCtx.HalHandle, pTC358749XBGCtx->IsiCtx.HalDevID, true ); + RETURN_RESULT_IF_DIFFERENT( RET_SUCCESS, result ); + + osSleep( 10 ); + + TRACE( TC358749XBG_DEBUG, "%s reset off \n", __FUNCTION__); + result = HalSetReset( pTC358749XBGCtx->IsiCtx.HalHandle, pTC358749XBGCtx->IsiCtx.HalDevID, false ); + + osSleep( 50 ); + } +#endif + TRACE( TC358749XBG_INFO, "%s (exit)\n", __FUNCTION__); + + return ( result ); +} + + + +/*****************************************************************************/ +/** + * TC358749XBG_IsiCheckSensorConnectionIss + * + * @brief Checks the I2C-Connection to sensor by reading sensor revision id. + * + * @param handle TC358749XBG sensor instance handle + * + * @return Return the result of the function call. + * @retval RET_SUCCESS + * @retval RET_NULL_POINTER + * + *****************************************************************************/ +static RESULT TC358749XBG_IsiCheckSensorConnectionIss +( + IsiSensorHandle_t handle +) +{ + uint32_t RevId; + uint32_t value; + + RESULT result = RET_SUCCESS; + + TRACE( TC358749XBG_INFO, "%s (enter)\n", __FUNCTION__); + + if ( handle == NULL ) + { + return ( RET_WRONG_HANDLE ); + } + result = TC358749XBG_IsiGetSensorRevisionIss( handle, &value ); +#if 0 + RevId = TC358749XBG_CHIP_ID_HIGH_BYTE_DEFAULT; + //RevId = (RevId << 16U) | (TC358749XBG_CHIP_ID_MIDDLE_BYTE_DEFAULT<<8U); + //RevId = RevId | TC358749XBG_CHIP_ID_LOW_BYTE_DEFAULT; + + if ( (result != RET_SUCCESS) || (RevId != value) ) + { + TRACE( TC358749XBG_ERROR, "%s RevId = 0x%08x, value = 0x%08x \n", __FUNCTION__, RevId, value ); + return ( RET_FAILURE ); + } + + TRACE( TC358749XBG_DEBUG, "%s RevId = 0x%08x, value = 0x%08x \n", __FUNCTION__, RevId, value ); +#endif + TRACE( TC358749XBG_INFO, "%s (exit)\n", __FUNCTION__); + + return ( result ); +} + + + +/*****************************************************************************/ +/** + * TC358749XBG_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 TC358749XBG_IsiGetSensorRevisionIss +( + IsiSensorHandle_t handle, + uint32_t *p_value +) +{ + RESULT result = RET_SUCCESS; + + uint32_t data; + + TRACE( TC358749XBG_INFO, "%s (enter)\n", __FUNCTION__); +#if 0 + if ( handle == NULL ) + { + return ( RET_WRONG_HANDLE ); + } + + if ( p_value == NULL ) + { + return ( RET_NULL_POINTER ); + } + + *p_value = 0U; + result = TC358749XBG_IsiRegReadIss ( handle, TC358749XBG_CHIP_ID_HIGH_BYTE, &data ); + /* + *p_value = ( (data & 0xFF) << 16U ); + result = TC358749XBG_IsiRegReadIss ( handle, TC358749XBG_CHIP_ID_MIDDLE_BYTE, &data ); + *p_value |= ( (data & 0xFF) << 8U ); + result = TC358749XBG_IsiRegReadIss ( handle, TC358749XBG_CHIP_ID_LOW_BYTE, &data ); + *p_value |= ( (data & 0xFF)); + */ + *p_value = data; + + TRACE( TC358749XBG_DEBUG, "%s (exit),*p_value=0x%08x,data=0x%08x\n", __FUNCTION__,*p_value,data); +#endif + //KINGS hdmi input timing check + TC358749XBG_HdmiGetInputCheckRegIss(handle,&data); + + return ( result ); +} + + + +/*****************************************************************************/ +/** + * TC358749XBG_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 TC358749XBG_IsiRegReadIss +( + IsiSensorHandle_t handle, + const uint32_t address, + uint32_t *p_value +) +{ + RESULT result = RET_SUCCESS; + + TRACE( TC358749XBG_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, TC358749XBG_g_aRegDescription ); + TRACE( TC358749XBG_DEBUG, "%s (exit: NrOfBytes=%d)\n", __FUNCTION__, NrOfBytes); + if ( !NrOfBytes ) + { + NrOfBytes = 1; + } + TRACE( TC358749XBG_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( TC358749XBG_DEBUG, "%s (exit: 0x%08x 0x%08x)\n", __FUNCTION__, address, *p_value); + + return ( result ); +} + +static RESULT TC358749XBG_IsiRegVedioReadIss + ( + IsiSensorHandle_t handle, + const uint32_t address, + uint32_t *p_value + ) + { + RESULT result = RET_SUCCESS; + + TRACE( TC358749XBG_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, TC358749XBG_g_aRegVedioON ); + TRACE( TC358749XBG_DEBUG, "%s (exit: NrOfBytes=%d)\n", __FUNCTION__, NrOfBytes); + if ( !NrOfBytes ) + { + NrOfBytes = 1; + } + TRACE( TC358749XBG_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( TC358749XBG_DEBUG, "%s (exit: 0x%08x 0x%08x)\n", __FUNCTION__, address, *p_value); + + return ( result ); + } + + +/*****************************************************************************/ +/** + * TC358749XBG_HdmiGetInputCheckRegIss + * + * @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 TC358749XBG_HdmiGetInputCheckRegIss +( + IsiSensorHandle_t handle, + uint32_t *p_value +) +{ + RESULT result = RET_SUCCESS; + + uint32_t data; + + TRACE( TC358749XBG_INFO, "%s (enter)\n", __FUNCTION__); + + if ( handle == NULL ) + { + return ( RET_WRONG_HANDLE ); + } + + if ( p_value == NULL ) + { + return ( RET_NULL_POINTER ); + } + + //---------------------------------------------------------------------- + /* + *p_value = 0U; + result = TC358749XBG_HdmiInputCheckRegReadIss ( handle, 0x8C09, &data ); + *p_value = data; + TRACE( TC358749XBG_ERROR, "%s (exit),0x8C09: *p_value=0x%08x,data=0x%08x\n", __FUNCTION__,*p_value,data); + + *p_value = 0U; + result = TC358749XBG_HdmiInputCheckRegReadIss ( handle, 0x8C0A, &data ); + *p_value = data; + TRACE( TC358749XBG_ERROR, "%s (exit),0x8C0A: *p_value=0x%08x,data=0x%08x\n", __FUNCTION__,*p_value,data); + */ + //---------------------------------------------------------------------- + *p_value = 0U; + result = TC358749XBG_HdmiInputCheckRegReadIss ( handle, 0x8520, &data ); + *p_value = data; + TRACE( TC358749XBG_DEBUG, "%s (exit),0x8520: *p_value=0x%08x,data=0x%08x\n", __FUNCTION__,*p_value,data); + + *p_value = 0U; + result = TC358749XBG_HdmiInputCheckRegReadIss ( handle, 0x852E, &data ); + *p_value = data; + TRACE( TC358749XBG_DEBUG, "%s (exit),0x852E: *p_value=0x%08x,data=0x%08x\n", __FUNCTION__,*p_value,data); + + *p_value = 0U; + result = TC358749XBG_HdmiInputCheckRegReadIss ( handle, 0x852F, &data ); + *p_value = data; + TRACE( TC358749XBG_DEBUG, "%s (exit),0x852F: *p_value=0x%08x,data=0x%08x\n", __FUNCTION__,*p_value,data); + + *p_value = 0U; + result = TC358749XBG_HdmiInputCheckRegReadIss ( handle, 0x858A, &data ); + *p_value = data; + TRACE( TC358749XBG_DEBUG, "%s (exit),0x858A: *p_value=0x%08x,data=0x%08x\n", __FUNCTION__,*p_value,data); + + *p_value = 0U; + result = TC358749XBG_HdmiInputCheckRegReadIss ( handle, 0x858B, &data ); + *p_value = data; + TRACE( TC358749XBG_DEBUG, "%s (exit),0x858B: *p_value=0x%08x,data=0x%08x\n", __FUNCTION__,*p_value,data); + + *p_value = 0U; + result = TC358749XBG_HdmiInputCheckRegReadIss ( handle, 0x8580, &data ); + *p_value = data; + TRACE( TC358749XBG_DEBUG, "%s (exit),0x8580: *p_value=0x%08x,data=0x%08x\n", __FUNCTION__,*p_value,data); + + *p_value = 0U; + result = TC358749XBG_HdmiInputCheckRegReadIss ( handle, 0x8581, &data ); + *p_value = data; + TRACE( TC358749XBG_DEBUG, "%s (exit),0x8581: *p_value=0x%08x,data=0x%08x\n", __FUNCTION__,*p_value,data); + + *p_value = 0U; + result = TC358749XBG_HdmiInputCheckRegReadIss ( handle, 0x8582, &data ); + *p_value = data; + TRACE( TC358749XBG_DEBUG, "%s (exit),0x8582: *p_value=0x%08x,data=0x%08x\n", __FUNCTION__,*p_value,data); + + *p_value = 0U; + result = TC358749XBG_HdmiInputCheckRegReadIss ( handle, 0x8583, &data ); + *p_value = data; + TRACE( TC358749XBG_DEBUG, "%s (exit),0x8583: *p_value=0x%08x,data=0x%08x\n", __FUNCTION__,*p_value,data); + + *p_value = 0U; + result = TC358749XBG_HdmiInputCheckRegReadIss ( handle, 0x858C, &data ); + *p_value = data; + TRACE( TC358749XBG_DEBUG, "%s (exit),0x858C: *p_value=0x%08x,data=0x%08x\n", __FUNCTION__,*p_value,data); + + *p_value = 0U; + result = TC358749XBG_HdmiInputCheckRegReadIss ( handle, 0x858D, &data ); + *p_value = data; + TRACE( TC358749XBG_DEBUG, "%s (exit),0x858D: *p_value=0x%08x,data=0x%08x\n", __FUNCTION__,*p_value,data); + + *p_value = 0U; + result = TC358749XBG_HdmiInputCheckRegReadIss ( handle, 0x8584, &data ); + *p_value = data; + TRACE( TC358749XBG_DEBUG, "%s (exit),0x8584: *p_value=0x%08x,data=0x%08x\n", __FUNCTION__,*p_value,data); + + *p_value = 0U; + result = TC358749XBG_HdmiInputCheckRegReadIss ( handle, 0x8585, &data ); + *p_value = data; + TRACE( TC358749XBG_DEBUG, "%s (exit),0x8585: *p_value=0x%08x,data=0x%08x\n", __FUNCTION__,*p_value,data); + + *p_value = 0U; + result = TC358749XBG_HdmiInputCheckRegReadIss ( handle, 0x8586, &data ); + *p_value = data; + TRACE( TC358749XBG_DEBUG, "%s (exit),0x8586: *p_value=0x%08x,data=0x%08x\n", __FUNCTION__,*p_value,data); + + *p_value = 0U; + result = TC358749XBG_HdmiInputCheckRegReadIss ( handle, 0x8587, &data ); + *p_value = data; + TRACE( TC358749XBG_DEBUG, "%s (exit),0x8587: *p_value=0x%08x,data=0x%08x\n", __FUNCTION__,*p_value,data); + + *p_value = 0U; + result = TC358749XBG_HdmiInputCheckRegReadIss ( handle, 0x8588, &data ); + *p_value = data; + TRACE( TC358749XBG_DEBUG, "%s (exit),0x8588: *p_value=0x%08x,data=0x%08x\n", __FUNCTION__,*p_value,data); + + *p_value = 0U; + result = TC358749XBG_HdmiInputCheckRegReadIss ( handle, 0x8589, &data ); + *p_value = data; + TRACE( TC358749XBG_DEBUG, "%s (exit),0x8589: *p_value=0x%08x,data=0x%08x\n", __FUNCTION__,*p_value,data); + + *p_value = 0U; + result = TC358749XBG_HdmiInputCheckRegReadIss ( handle, 0x8526, &data ); + *p_value = data; + TRACE( TC358749XBG_DEBUG, "%s (exit),0x8526: *p_value=0x%08x,data=0x%08x\n", __FUNCTION__,*p_value,data); + + return ( result ); +} + + +/*****************************************************************************/ +/** + * TC358749XBG_HdmiInputCheckRegReadIss + * + * @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 TC358749XBG_HdmiInputCheckRegReadIss +( + IsiSensorHandle_t handle, + const uint32_t address, + uint32_t *p_value +) +{ + RESULT result = RET_SUCCESS; + + TRACE( TC358749XBG_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, TC358749XBG_g_hdmi_input_check ); + TRACE( TC358749XBG_DEBUG, "%s (exit: NrOfBytes=%d)\n", __FUNCTION__, NrOfBytes); + if ( !NrOfBytes ) + { + NrOfBytes = 1; + } + TRACE( TC358749XBG_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( TC358749XBG_DEBUG, "%s (exit: 0x%08x 0x%08x)\n", __FUNCTION__, address, *p_value); + + return ( result ); +} + + +/*****************************************************************************/ +/** + * TC358749XBG_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 TC358749XBG_IsiRegWriteIss +( + IsiSensorHandle_t handle, + const uint32_t address, + const uint32_t value +) +{ + RESULT result = RET_SUCCESS; + + uint8_t NrOfBytes; + + TRACE( TC358749XBG_INFO, "%s (enter)\n", __FUNCTION__); + + if ( handle == NULL ) + { + return ( RET_WRONG_HANDLE ); + } + + NrOfBytes = IsiGetNrDatBytesIss( address, TC358749XBG_g_aRegDescription ); + if ( !NrOfBytes ) + { + NrOfBytes = 1; + } + TRACE( TC358749XBG_DEBUG, "%s (IsiGetNrDatBytesIss %d 0x%08x 0x%08x)\n", __FUNCTION__, NrOfBytes, address, value); + + result = IsiI2cWriteSensorRegister( handle, address, (uint8_t *)(&value), NrOfBytes, BOOL_TRUE ); + + TRACE( TC358749XBG_DEBUG, "%s (exit: 0x%08x 0x%08x)\n", __FUNCTION__, address, value); + + return ( result ); +} + +static RESULT TC358749XBG_IsiRegVedioWriteIss +( + IsiSensorHandle_t handle, + const uint32_t address, + const uint32_t value +) +{ + RESULT result = RET_SUCCESS; + + uint8_t NrOfBytes; + + TRACE( TC358749XBG_INFO, "%s (enter)\n", __FUNCTION__); + + if ( handle == NULL ) + { + return ( RET_WRONG_HANDLE ); + } + + NrOfBytes = IsiGetNrDatBytesIss( address, TC358749XBG_g_aRegVedioON ); + if ( !NrOfBytes ) + { + NrOfBytes = 1; + } + TRACE( TC358749XBG_DEBUG, "%s (IsiGetNrDatBytesIss %d 0x%08x 0x%08x)\n", __FUNCTION__, NrOfBytes, address, value); + + result = IsiI2cWriteSensorRegister( handle, address, (uint8_t *)(&value), NrOfBytes, BOOL_TRUE ); + + TRACE( TC358749XBG_DEBUG, "%s (exit: 0x%08x 0x%08x)\n", __FUNCTION__, address, value); + + return ( result ); +} + + +/*****************************************************************************/ +/** + * TC358749XBG_IsiGetGainLimitsIss + * + * @brief Returns the exposure minimal and maximal values of an + * TC358749XBG instance + * + * @param handle TC358749XBG 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 TC358749XBG_IsiGetGainLimitsIss +( + IsiSensorHandle_t handle, + float *pMinGain, + float *pMaxGain +) +{ + TC358749XBG_Context_t *pTC358749XBGCtx = (TC358749XBG_Context_t *)handle; + + RESULT result = RET_SUCCESS; + + uint32_t RegValue = 0; + + TRACE( TC358749XBG_INFO, "%s: (enter)\n", __FUNCTION__); +#if 0 + + if ( pTC358749XBGCtx == NULL ) + { + TRACE( TC358749XBG_ERROR, "%s: Invalid sensor handle (NULL pointer detected)\n", __FUNCTION__ ); + return ( RET_WRONG_HANDLE ); + } + + if ( (pMinGain == NULL) || (pMaxGain == NULL) ) + { + TRACE( TC358749XBG_ERROR, "%s: NULL pointer received!!\n" ); + return ( RET_NULL_POINTER ); + } + + *pMinGain = pTC358749XBGCtx->AecMinGain; + *pMaxGain = pTC358749XBGCtx->AecMaxGain; +#endif + *pMinGain = 0; + *pMaxGain = 0; + + TRACE( TC358749XBG_INFO, "%s: (exit)\n", __FUNCTION__); + + return ( result ); +} + + + +/*****************************************************************************/ +/** + * TC358749XBG_IsiGetIntegrationTimeLimitsIss + * + * @brief Returns the minimal and maximal integration time values of an + * TC358749XBG instance + * + * @param handle TC358749XBG 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 TC358749XBG_IsiGetIntegrationTimeLimitsIss +( + IsiSensorHandle_t handle, + float *pMinIntegrationTime, + float *pMaxIntegrationTime +) +{ + TC358749XBG_Context_t *pTC358749XBGCtx = (TC358749XBG_Context_t *)handle; + + RESULT result = RET_SUCCESS; + + uint32_t RegValue = 0; + + TRACE( TC358749XBG_INFO, "%s: (enter)\n", __FUNCTION__); +#if 0 + if ( pTC358749XBGCtx == NULL ) + { + TRACE( TC358749XBG_ERROR, "%s: Invalid sensor handle (NULL pointer detected)\n", __FUNCTION__ ); + return ( RET_WRONG_HANDLE ); + } + + if ( (pMinIntegrationTime == NULL) || (pMaxIntegrationTime == NULL) ) + { + TRACE( TC358749XBG_ERROR, "%s: NULL pointer received!!\n" ); + return ( RET_NULL_POINTER ); + } + + *pMinIntegrationTime = pTC358749XBGCtx->AecMinIntegrationTime; + *pMaxIntegrationTime = pTC358749XBGCtx->AecMaxIntegrationTime; +#endif + TRACE( TC358749XBG_INFO, "%s: (exit)\n", __FUNCTION__); + + return ( result ); +} + + +/*****************************************************************************/ +/** + * TC358749XBG_IsiGetGainIss + * + * @brief Reads gain values from the image sensor module. + * + * @param handle TC358749XBG sensor instance handle + * @param pSetGain set gain + * + * @return Return the result of the function call. + * @retval RET_SUCCESS + * @retval RET_NULL_POINTER + * + *****************************************************************************/ +RESULT TC358749XBG_IsiGetGainIss +( + IsiSensorHandle_t handle, + float *pSetGain +) +{ + TC358749XBG_Context_t *pTC358749XBGCtx = (TC358749XBG_Context_t *)handle; + + RESULT result = RET_SUCCESS; + + TRACE( TC358749XBG_INFO, "%s: (enter)\n", __FUNCTION__); +#if 0 + if ( pTC358749XBGCtx == NULL ) + { + TRACE( TC358749XBG_ERROR, "%s: Invalid sensor handle (NULL pointer detected)\n", __FUNCTION__ ); + return ( RET_WRONG_HANDLE ); + } + + if ( pSetGain == NULL) + { + return ( RET_NULL_POINTER ); + } + + *pSetGain = pTC358749XBGCtx->AecCurGain; +#endif + *pSetGain = 0; + + TRACE( TC358749XBG_INFO, "%s: (exit)\n", __FUNCTION__); + + return ( result ); +} + + + +/*****************************************************************************/ +/** + * TC358749XBG_IsiGetGainIncrementIss + * + * @brief Get smallest possible gain increment. + * + * @param handle TC358749XBG sensor instance handle + * @param pIncr increment + * + * @return Return the result of the function call. + * @retval RET_SUCCESS + * @retval RET_NULL_POINTER + * + *****************************************************************************/ +RESULT TC358749XBG_IsiGetGainIncrementIss +( + IsiSensorHandle_t handle, + float *pIncr +) +{ + TC358749XBG_Context_t *pTC358749XBGCtx = (TC358749XBG_Context_t *)handle; + + RESULT result = RET_SUCCESS; + + TRACE( TC358749XBG_INFO, "%s: (enter)\n", __FUNCTION__); +#if 0 + if ( pTC358749XBGCtx == NULL ) + { + TRACE( TC358749XBG_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 = pTC358749XBGCtx->AecGainIncrement; +#endif + *pIncr = 0; + + TRACE( TC358749XBG_INFO, "%s: (exit)\n", __FUNCTION__); + + return ( result ); +} + + + +/*****************************************************************************/ +/** + * TC358749XBG_IsiSetGainIss + * + * @brief Writes gain values to the image sensor module. + * Updates current gain and exposure in sensor struct/state. + * + * @param handle TC358749XBG 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 TC358749XBG_IsiSetGainIss +( + IsiSensorHandle_t handle, + float NewGain, + float *pSetGain +) +{ + TC358749XBG_Context_t *pTC358749XBGCtx = (TC358749XBG_Context_t *)handle; + + RESULT result = RET_SUCCESS; + + uint16_t usGain = 0; + + TRACE( TC358749XBG_INFO, "%s: (enter)\n", __FUNCTION__); +#if 0 + if ( pTC358749XBGCtx == NULL ) + { + TRACE( TC358749XBG_ERROR, "%s: Invalid sensor handle (NULL pointer detected)\n", __FUNCTION__ ); + return ( RET_WRONG_HANDLE ); + } + + if ( pSetGain == NULL) + { + TRACE( TC358749XBG_ERROR, "%s: Invalid parameter (NULL pointer detected)\n", __FUNCTION__ ); + return ( RET_NULL_POINTER ); + } + + + if( NewGain < pTC358749XBGCtx->AecMinGain ) NewGain = pTC358749XBGCtx->AecMinGain; + if( NewGain > pTC358749XBGCtx->AecMaxGain ) NewGain = pTC358749XBGCtx->AecMaxGain; + + usGain = (uint16_t)NewGain; + + // write new gain into sensor registers, do not write if nothing has changed + if( (usGain != pTC358749XBGCtx->OldGain) ) + { + + pTC358749XBGCtx->OldGain = usGain; + } + + //calculate gain actually set + pTC358749XBGCtx->AecCurGain = NewGain; + + //return current state + *pSetGain = pTC358749XBGCtx->AecCurGain; + TRACE( TC358749XBG_DEBUG, "%s: g=%f\n", __FUNCTION__, *pSetGain ); +#endif + TRACE( TC358749XBG_INFO, "%s: (exit)\n", __FUNCTION__); + + return ( result ); +} + + + +/*****************************************************************************/ +/** + * TC358749XBG_IsiGetIntegrationTimeIss + * + * @brief Reads integration time values from the image sensor module. + * + * @param handle TC358749XBG sensor instance handle + * @param pSetIntegrationTime set integration time + * + * @return Return the result of the function call. + * @retval RET_SUCCESS + * @retval RET_NULL_POINTER + * + *****************************************************************************/ +RESULT TC358749XBG_IsiGetIntegrationTimeIss +( + IsiSensorHandle_t handle, + float *pSetIntegrationTime +) +{ + TC358749XBG_Context_t *pTC358749XBGCtx = (TC358749XBG_Context_t *)handle; + + RESULT result = RET_SUCCESS; + + TRACE( TC358749XBG_INFO, "%s: (enter)\n", __FUNCTION__); +#if 0 + if ( pTC358749XBGCtx == NULL ) + { + TRACE( TC358749XBG_ERROR, "%s: Invalid sensor handle (NULL pointer detected)\n", __FUNCTION__ ); + return ( RET_WRONG_HANDLE ); + } + + if ( pSetIntegrationTime == NULL ) + { + return ( RET_NULL_POINTER ); + } + + *pSetIntegrationTime = pTC358749XBGCtx->AecCurIntegrationTime; + + TRACE( TC358749XBG_INFO, "%s: (exit)\n", __FUNCTION__); +#endif + return ( result ); +} + + + +/*****************************************************************************/ +/** + * TC358749XBG_IsiGetIntegrationTimeIncrementIss + * + * @brief Get smallest possible integration time increment. + * + * @param handle TC358749XBG sensor instance handle + * @param pIncr increment + * + * @return Return the result of the function call. + * @retval RET_SUCCESS + * @retval RET_NULL_POINTER + * + *****************************************************************************/ +RESULT TC358749XBG_IsiGetIntegrationTimeIncrementIss +( + IsiSensorHandle_t handle, + float *pIncr +) +{ + TC358749XBG_Context_t *pTC358749XBGCtx = (TC358749XBG_Context_t *)handle; + + RESULT result = RET_SUCCESS; + + TRACE( TC358749XBG_INFO, "%s: (enter)\n", __FUNCTION__); +#if 0 + if ( pTC358749XBGCtx == NULL ) + { + TRACE( TC358749XBG_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 = pTC358749XBGCtx->AecIntegrationTimeIncrement; + + TRACE( TC358749XBG_INFO, "%s: (exit)\n", __FUNCTION__); +#endif + return ( result ); +} + + + +/*****************************************************************************/ +/** + * TC358749XBG_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 TC358749XBG 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 TC358749XBG_IsiSetIntegrationTimeIss +( + IsiSensorHandle_t handle, + float NewIntegrationTime, + float *pSetIntegrationTime, + uint8_t *pNumberOfFramesToSkip +) +{ + TC358749XBG_Context_t *pTC358749XBGCtx = (TC358749XBG_Context_t *)handle; + + RESULT result = RET_SUCCESS; + + + TRACE( TC358749XBG_DEBUG, "%s: Ti=%f\n", __FUNCTION__, *pSetIntegrationTime ); + TRACE( TC358749XBG_INFO, "%s: (exit)\n", __FUNCTION__); + + return ( result ); +} + + + + +/*****************************************************************************/ +/** + * TC358749XBG_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 TC358749XBG 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 TC358749XBG_IsiExposureControlIss +( + IsiSensorHandle_t handle, + float NewGain, + float NewIntegrationTime, + uint8_t *pNumberOfFramesToSkip, + float *pSetGain, + float *pSetIntegrationTime +) +{ + TC358749XBG_Context_t *pTC358749XBGCtx = (TC358749XBG_Context_t *)handle; + + RESULT result = RET_SUCCESS; +#if 0 + TRACE( TC358749XBG_DEBUG, "%s: (enter)\n", __FUNCTION__); + + if ( pTC358749XBGCtx == NULL ) + { + TRACE( TC358749XBG_ERROR, "%s: Invalid sensor handle (NULL pointer detected)\n", __FUNCTION__ ); + return ( RET_WRONG_HANDLE ); + } + + if ( (pNumberOfFramesToSkip == NULL) + || (pSetGain == NULL) + || (pSetIntegrationTime == NULL) ) + { + TRACE( TC358749XBG_ERROR, "%s: Invalid parameter (NULL pointer detected)\n", __FUNCTION__ ); + return ( RET_NULL_POINTER ); + } + + TRACE( TC358749XBG_DEBUG, "%s: g=%f, Ti=%f\n", __FUNCTION__, NewGain, NewIntegrationTime ); + + + result = TC358749XBG_IsiSetIntegrationTimeIss( handle, NewIntegrationTime, pSetIntegrationTime, pNumberOfFramesToSkip ); + result = TC358749XBG_IsiSetGainIss( handle, NewGain, pSetGain ); + + //*pNumberOfFramesToSkip = 2; + + TRACE( TC358749XBG_DEBUG, "%s: set: g=%f, Ti=%f, skip=%d\n", __FUNCTION__, *pSetGain, *pSetIntegrationTime, *pNumberOfFramesToSkip ); + TRACE( TC358749XBG_DEBUG, "%s: (exit)\n", __FUNCTION__); +#endif + TRACE( TC358749XBG_INFO, "%s: (exit)\n", __FUNCTION__); + return ( result ); +} + + + +/*****************************************************************************/ +/** + * TC358749XBG_IsiGetCurrentExposureIss + * + * @brief Returns the currently adjusted AE values + * + * @param handle TC358749XBG sensor instance handle + * + * @return Return the result of the function call. + * @retval RET_SUCCESS + * @retval RET_NULL_POINTER + * + *****************************************************************************/ +RESULT TC358749XBG_IsiGetCurrentExposureIss +( + IsiSensorHandle_t handle, + float *pSetGain, + float *pSetIntegrationTime +) +{ + TC358749XBG_Context_t *pTC358749XBGCtx = (TC358749XBG_Context_t *)handle; + + RESULT result = RET_SUCCESS; + + uint32_t RegValue = 0; + + TRACE( TC358749XBG_INFO, "%s: (enter)\n", __FUNCTION__); +#if 0 + if ( pTC358749XBGCtx == NULL ) + { + TRACE( TC358749XBG_ERROR, "%s: Invalid sensor handle (NULL pointer detected)\n", __FUNCTION__ ); + return ( RET_WRONG_HANDLE ); + } + + if ( (pSetGain == NULL) || (pSetIntegrationTime == NULL) ) + { + return ( RET_NULL_POINTER ); + } + + *pSetGain = pTC358749XBGCtx->AecCurGain; + *pSetIntegrationTime = pTC358749XBGCtx->AecCurIntegrationTime; +#endif + TRACE( TC358749XBG_INFO, "%s: (exit)\n", __FUNCTION__); + + return ( result ); +} + + + +/*****************************************************************************/ +/** + * TC358749XBG_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 TC358749XBG_IsiGetResolutionIss +( + IsiSensorHandle_t handle, + uint32_t *pSetResolution +) +{ + TC358749XBG_Context_t *pTC358749XBGCtx = (TC358749XBG_Context_t *)handle; + + RESULT result = RET_SUCCESS; + + TRACE( TC358749XBG_INFO, "%s: (enter)\n", __FUNCTION__); + + if ( pTC358749XBGCtx == NULL ) + { + TRACE( TC358749XBG_ERROR, "%s: Invalid sensor handle (NULL pointer detected)\n", __FUNCTION__ ); + return ( RET_WRONG_HANDLE ); + } + + if ( pSetResolution == NULL ) + { + return ( RET_NULL_POINTER ); + } + + *pSetResolution = pTC358749XBGCtx->Config.Resolution; + + TRACE( TC358749XBG_INFO, "%s: (exit)\n", __FUNCTION__); + + return ( result ); +} + + + +/*****************************************************************************/ +/** + * TC358749XBG_IsiGetAfpsInfoHelperIss + * + * @brief Calc AFPS sub resolution settings for the given resolution + * + * @param pTC358749XBGCtx TC358749XBG 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 TC358749XBG_IsiGetAfpsInfoHelperIss( + TC358749XBG_Context_t *pTC358749XBGCtx, + uint32_t Resolution, + IsiAfpsInfo_t* pAfpsInfo, + uint32_t AfpsStageIdx +) +{ + RESULT result = RET_SUCCESS; + + TRACE( TC358749XBG_INFO, "%s: (enter)\n", __FUNCTION__); +#if 0 + DCT_ASSERT(pTC358749XBGCtx != NULL); + DCT_ASSERT(pAfpsInfo != NULL); + DCT_ASSERT(AfpsStageIdx <= ISI_NUM_AFPS_STAGES); + + // update resolution in copy of config in context + pTC358749XBGCtx->Config.Resolution = Resolution; + + // tell sensor about that + result = TC358749XBG_SetupOutputWindow( pTC358749XBGCtx, &pTC358749XBGCtx->Config ); + if ( result != RET_SUCCESS ) + { + TRACE( TC358749XBG_ERROR, "%s: SetupOutputWindow failed for resolution ID %08x.\n", __FUNCTION__, Resolution); + return ( result ); + } + + // update limits & stuff (reset current & old settings) + result = TC358749XBG_AecSetModeParameters( pTC358749XBGCtx, &pTC358749XBGCtx->Config ); + if ( result != RET_SUCCESS ) + { + TRACE( TC358749XBG_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 = pTC358749XBGCtx->AecMaxIntegrationTime; + pAfpsInfo->AecMinGain = pTC358749XBGCtx->AecMinGain; + pAfpsInfo->AecMaxGain = pTC358749XBGCtx->AecMaxGain; + pAfpsInfo->AecMinIntTime = pTC358749XBGCtx->AecMinIntegrationTime; + pAfpsInfo->AecMaxIntTime = pTC358749XBGCtx->AecMaxIntegrationTime; + pAfpsInfo->AecSlowestResolution = Resolution; + +#endif + TRACE( TC358749XBG_INFO, "%s: (exit)\n", __FUNCTION__); + + return ( result ); +} + +/*****************************************************************************/ +/** + * TC358749XBG_IsiGetAfpsInfoIss + * + * @brief Returns the possible AFPS sub resolution settings for the given resolution series + * + * @param handle TC358749XBG 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 TC358749XBG_IsiGetAfpsInfoIss( + IsiSensorHandle_t handle, + uint32_t Resolution, + IsiAfpsInfo_t* pAfpsInfo +) +{ + TC358749XBG_Context_t *pTC358749XBGCtx = (TC358749XBG_Context_t *)handle; + + RESULT result = RET_SUCCESS; + + uint32_t RegValue = 0; + + TRACE( TC358749XBG_INFO, "%s: (enter)\n", __FUNCTION__); +#if 0 + if ( pTC358749XBGCtx == NULL ) + { + TRACE( TC358749XBG_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 = pTC358749XBGCtx->Config.Resolution; + } +#endif + TRACE( TC358749XBG_INFO, "%s: (exit)\n", __FUNCTION__); + + return ( result ); +} + + + +/*****************************************************************************/ +/** + * TC358749XBG_IsiGetCalibKFactor + * + * @brief Returns the TC358749XBG specific K-Factor + * + * @param handle TC358749XBG 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 TC358749XBG_IsiGetCalibKFactor +( + IsiSensorHandle_t handle, + Isi1x1FloatMatrix_t **pIsiKFactor +) +{ + TC358749XBG_Context_t *pTC358749XBGCtx = (TC358749XBG_Context_t *)handle; + + RESULT result = RET_SUCCESS; + + TRACE( TC358749XBG_INFO, "%s: (enter)\n", __FUNCTION__); + + if ( pTC358749XBGCtx == NULL ) + { + return ( RET_WRONG_HANDLE ); + } + + if ( pIsiKFactor == NULL ) + { + return ( RET_NULL_POINTER ); + } + + *pIsiKFactor = NULL; + + TRACE( TC358749XBG_INFO, "%s: (exit)\n", __FUNCTION__); + + return ( result ); +} + + +/*****************************************************************************/ +/** + * TC358749XBG_IsiGetCalibPcaMatrix + * + * @brief Returns the TC358749XBG specific PCA-Matrix + * + * @param handle TC358749XBG 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 TC358749XBG_IsiGetCalibPcaMatrix +( + IsiSensorHandle_t handle, + Isi3x2FloatMatrix_t **pIsiPcaMatrix +) +{ + TC358749XBG_Context_t *pTC358749XBGCtx = (TC358749XBG_Context_t *)handle; + + RESULT result = RET_SUCCESS; + + TRACE( TC358749XBG_INFO, "%s: (enter)\n", __FUNCTION__); + + if ( pTC358749XBGCtx == NULL ) + { + return ( RET_WRONG_HANDLE ); + } + + if ( pIsiPcaMatrix == NULL ) + { + return ( RET_NULL_POINTER ); + } + + *pIsiPcaMatrix = NULL; + + TRACE( TC358749XBG_INFO, "%s: (exit)\n", __FUNCTION__); + + return ( result ); +} + + + +/*****************************************************************************/ +/** + * TC358749XBG_IsiGetCalibSvdMeanValue + * + * @brief Returns the sensor specific SvdMean-Vector + * + * @param handle TC358749XBG 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 TC358749XBG_IsiGetCalibSvdMeanValue +( + IsiSensorHandle_t handle, + Isi3x1FloatMatrix_t **pIsiSvdMeanValue +) +{ + IsiSensorContext_t *pSensorCtx = (IsiSensorContext_t *)handle; + + RESULT result = RET_SUCCESS; + + TRACE( TC358749XBG_INFO, "%s: (enter)\n", __FUNCTION__); + + if ( pSensorCtx == NULL ) + { + return ( RET_WRONG_HANDLE ); + } + + if ( pIsiSvdMeanValue == NULL ) + { + return ( RET_NULL_POINTER ); + } + + *pIsiSvdMeanValue = NULL; + + TRACE( TC358749XBG_INFO, "%s: (exit)\n", __FUNCTION__); + + return ( result ); +} + + + +/*****************************************************************************/ +/** + * TC358749XBG_IsiGetCalibSvdMeanValue + * + * @brief Returns a pointer to the sensor specific centerline, a straight + * line in Hesse normal form in Rg/Bg colorspace + * + * @param handle TC358749XBG 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 TC358749XBG_IsiGetCalibCenterLine +( + IsiSensorHandle_t handle, + IsiLine_t **ptIsiCenterLine +) +{ + IsiSensorContext_t *pSensorCtx = (IsiSensorContext_t *)handle; + + RESULT result = RET_SUCCESS; + + TRACE( TC358749XBG_INFO, "%s: (enter)\n", __FUNCTION__); + + if ( pSensorCtx == NULL ) + { + return ( RET_WRONG_HANDLE ); + } + + if ( ptIsiCenterLine == NULL ) + { + return ( RET_NULL_POINTER ); + } + + *ptIsiCenterLine = NULL; + + TRACE( TC358749XBG_INFO, "%s: (exit)\n", __FUNCTION__); + + return ( result ); +} + + + +/*****************************************************************************/ +/** + * TC358749XBG_IsiGetCalibClipParam + * + * @brief Returns a pointer to the sensor specific arrays for Rg/Bg color + * space clipping + * + * @param handle TC358749XBG 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 TC358749XBG_IsiGetCalibClipParam +( + IsiSensorHandle_t handle, + IsiAwbClipParm_t **pIsiClipParam +) +{ + IsiSensorContext_t *pSensorCtx = (IsiSensorContext_t *)handle; + + RESULT result = RET_SUCCESS; + + TRACE( TC358749XBG_INFO, "%s: (enter)\n", __FUNCTION__); + + if ( pSensorCtx == NULL ) + { + return ( RET_WRONG_HANDLE ); + } + + if ( pIsiClipParam == NULL ) + { + return ( RET_NULL_POINTER ); + } + + *pIsiClipParam = NULL; + + TRACE( TC358749XBG_INFO, "%s: (exit)\n", __FUNCTION__); + + return ( result ); +} + + + +/*****************************************************************************/ +/** + * TC358749XBG_IsiGetCalibGlobalFadeParam + * + * @brief Returns a pointer to the sensor specific arrays for AWB out of + * range handling + * + * @param handle TC358749XBG 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 TC358749XBG_IsiGetCalibGlobalFadeParam +( + IsiSensorHandle_t handle, + IsiAwbGlobalFadeParm_t **ptIsiGlobalFadeParam +) +{ + IsiSensorContext_t *pSensorCtx = (IsiSensorContext_t *)handle; + + RESULT result = RET_SUCCESS; + + TRACE( TC358749XBG_INFO, "%s: (enter)\n", __FUNCTION__); + + if ( pSensorCtx == NULL ) + { + return ( RET_WRONG_HANDLE ); + } + + if ( ptIsiGlobalFadeParam == NULL ) + { + return ( RET_NULL_POINTER ); + } + + *ptIsiGlobalFadeParam = NULL; + + TRACE( TC358749XBG_INFO, "%s: (exit)\n", __FUNCTION__); + + return ( result ); +} + + + +/*****************************************************************************/ +/** + * TC358749XBG_IsiGetCalibFadeParam + * + * @brief Returns a pointer to the sensor specific arrays for near white + * pixel parameter calculations + * + * @param handle TC358749XBG 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 TC358749XBG_IsiGetCalibFadeParam +( + IsiSensorHandle_t handle, + IsiAwbFade2Parm_t **ptIsiFadeParam +) +{ + IsiSensorContext_t *pSensorCtx = (IsiSensorContext_t *)handle; + + RESULT result = RET_SUCCESS; + + TRACE( TC358749XBG_INFO, "%s: (enter)\n", __FUNCTION__); + + if ( pSensorCtx == NULL ) + { + return ( RET_WRONG_HANDLE ); + } + + if ( ptIsiFadeParam == NULL ) + { + return ( RET_NULL_POINTER ); + } + + *ptIsiFadeParam = NULL; + + TRACE( TC358749XBG_INFO, "%s: (exit)\n", __FUNCTION__); + + return ( result ); +} + +/*****************************************************************************/ +/** + * TC358749XBG_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 TC358749XBG_IsiGetIlluProfile +( + IsiSensorHandle_t handle, + const uint32_t CieProfile, + IsiIlluProfile_t **ptIsiIlluProfile +) +{ + TC358749XBG_Context_t *pTC358749XBGCtx = (TC358749XBG_Context_t *)handle; + + RESULT result = RET_SUCCESS; + + TRACE( TC358749XBG_INFO, "%s: (enter)\n", __FUNCTION__); + + if ( pTC358749XBGCtx == NULL ) + { + return ( RET_WRONG_HANDLE ); + } + + if ( ptIsiIlluProfile == NULL ) + { + return ( RET_NULL_POINTER ); + } + TRACE( TC358749XBG_INFO, "%s: (exit)\n", __FUNCTION__); + + return ( result ); +} + + + +/*****************************************************************************/ +/** + * TC358749XBG_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 TC358749XBG_IsiGetLscMatrixTable +( + IsiSensorHandle_t handle, + const uint32_t CieProfile, + IsiLscMatrixTable_t **pLscMatrixTable +) +{ + TC358749XBG_Context_t *pTC358749XBGCtx = (TC358749XBG_Context_t *)handle; + + RESULT result = RET_SUCCESS; + + TRACE( TC358749XBG_INFO, "%s: (enter)\n", __FUNCTION__); + + if ( pTC358749XBGCtx == NULL ) + { + return ( RET_WRONG_HANDLE ); + } + + if ( pLscMatrixTable == NULL ) + { + return ( RET_NULL_POINTER ); + } + else + + TRACE( TC358749XBG_INFO, "%s: (exit)\n", __FUNCTION__); + + return ( result ); +} + + +/*****************************************************************************/ +/** + * TC358749XBG_IsiMdiInitMotoDriveMds + * + * @brief General initialisation tasks like I/O initialisation. + * + * @param handle TC358749XBG sensor instance handle + * + * @return Return the result of the function call. + * @retval RET_SUCCESS + * @retval RET_WRONG_HANDLE + * @retval RET_NULL_POINTER + * + *****************************************************************************/ +static RESULT TC358749XBG_IsiMdiInitMotoDriveMds +( + IsiSensorHandle_t handle +) +{ + TC358749XBG_Context_t *pTC358749XBGCtx = (TC358749XBG_Context_t *)handle; + + RESULT result = RET_SUCCESS; + + TRACE( TC358749XBG_INFO, "%s: (enter)\n", __FUNCTION__); + + if ( pTC358749XBGCtx == NULL ) + { + return ( RET_WRONG_HANDLE ); + } + + TRACE( TC358749XBG_INFO, "%s: (exit)\n", __FUNCTION__); + + return ( result ); +} + + + +/*****************************************************************************/ +/** + * TC358749XBG_IsiMdiSetupMotoDrive + * + * @brief Setup of the MotoDrive and return possible max step. + * + * @param handle TC358749XBG 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 TC358749XBG_IsiMdiSetupMotoDrive +( + IsiSensorHandle_t handle, + uint32_t *pMaxStep +) +{ + TC358749XBG_Context_t *pTC358749XBGCtx = (TC358749XBG_Context_t *)handle; + + RESULT result = RET_SUCCESS; + + TRACE( TC358749XBG_INFO, "%s: (enter)\n", __FUNCTION__); + + if ( pTC358749XBGCtx == NULL ) + { + return ( RET_WRONG_HANDLE ); + } + + if ( pMaxStep == NULL ) + { + return ( RET_NULL_POINTER ); + } + + + TRACE( TC358749XBG_INFO, "%s: (exit)\n", __FUNCTION__); + + return ( result ); +} + + + +/*****************************************************************************/ +/** + * TC358749XBG_IsiMdiFocusSet + * + * @brief Drives the lens system to a certain focus point. + * + * @param handle TC358749XBG 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 TC358749XBG_IsiMdiFocusSet +( + IsiSensorHandle_t handle, + const uint32_t Position +) +{ + TC358749XBG_Context_t *pTC358749XBGCtx = (TC358749XBG_Context_t *)handle; + + RESULT result = RET_SUCCESS; + + uint32_t nPosition; + uint8_t data[2] = { 0, 0 }; + + TRACE( TC358749XBG_INFO, "%s: (enter)\n", __FUNCTION__); + + if ( pTC358749XBGCtx == NULL ) + { + return ( RET_WRONG_HANDLE ); + } + RETURN_RESULT_IF_DIFFERENT( RET_SUCCESS, result ); + + TRACE( TC358749XBG_INFO, "%s: (exit)\n", __FUNCTION__); + + return ( result ); +} + + + +/*****************************************************************************/ +/** + * TC358749XBG_IsiMdiFocusGet + * + * @brief Retrieves the currently applied focus point. + * + * @param handle TC358749XBG 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 TC358749XBG_IsiMdiFocusGet +( + IsiSensorHandle_t handle, + uint32_t *pAbsStep +) +{ + TC358749XBG_Context_t *pTC358749XBGCtx = (TC358749XBG_Context_t *)handle; + + RESULT result = RET_SUCCESS; + uint8_t data[2] = { 0, 0 }; + + TRACE( TC358749XBG_INFO, "%s: (enter)\n", __FUNCTION__); + + if ( pTC358749XBGCtx == NULL ) + { + return ( RET_WRONG_HANDLE ); + } + + if ( pAbsStep == NULL ) + { + return ( RET_NULL_POINTER ); + } + + TRACE( TC358749XBG_INFO, "%s: (exit)\n", __FUNCTION__); + + return ( result ); +} + + + +/*****************************************************************************/ +/** + * TC358749XBG_IsiMdiFocusCalibrate + * + * @brief Triggers a forced calibration of the focus hardware. + * + * @param handle TC358749XBG sensor instance handle + * + * @return Return the result of the function call. + * @retval RET_SUCCESS + * @retval RET_WRONG_HANDLE + * @retval RET_NULL_POINTER + * + *****************************************************************************/ +static RESULT TC358749XBG_IsiMdiFocusCalibrate +( + IsiSensorHandle_t handle +) +{ + TC358749XBG_Context_t *pTC358749XBGCtx = (TC358749XBG_Context_t *)handle; + + RESULT result = RET_SUCCESS; + + TRACE( TC358749XBG_INFO, "%s: (enter)\n", __FUNCTION__); + + if ( pTC358749XBGCtx == NULL ) + { + return ( RET_WRONG_HANDLE ); + } + + TRACE( TC358749XBG_INFO, "%s: (exit)\n", __FUNCTION__); + + return ( result ); +} + + + +/*****************************************************************************/ +/** + * TC358749XBG_IsiActivateTestPattern + * + * @brief Triggers a forced calibration of the focus hardware. + * + * @param handle TC358749XBG sensor instance handle + * + * @return Return the result of the function call. + * @retval RET_SUCCESS + * @retval RET_WRONG_HANDLE + * @retval RET_NULL_POINTER + * + ******************************************************************************/ +static RESULT TC358749XBG_IsiActivateTestPattern +( + IsiSensorHandle_t handle, + const bool_t enable +) +{ + TC358749XBG_Context_t *pTC358749XBGCtx = (TC358749XBG_Context_t *)handle; + + RESULT result = RET_SUCCESS; + + return ( result ); +} + + + +/*****************************************************************************/ +/** + * TC358749XBG_IsiGetSensorMipiInfoIss + * + * @brief Triggers a forced calibration of the focus hardware. + * + * @param handle TC358749XBG sensor instance handle + * + * @return Return the result of the function call. + * @retval RET_SUCCESS + * @retval RET_WRONG_HANDLE + * @retval RET_NULL_POINTER + * + ******************************************************************************/ +static RESULT TC358749XBG_IsiGetSensorMipiInfoIss +( + IsiSensorHandle_t handle, + IsiSensorMipiInfo *ptIsiSensorMipiInfo +) +{ + TC358749XBG_Context_t *pTC358749XBGCtx = (TC358749XBG_Context_t *)handle; + + RESULT result = RET_SUCCESS; + + TRACE( TC358749XBG_INFO, "%s: (enter)\n", __FUNCTION__); + + if ( pTC358749XBGCtx == NULL ) + { + return ( RET_WRONG_HANDLE ); + } + + + if ( ptIsiSensorMipiInfo == NULL ) + { + return ( result ); + } + + ptIsiSensorMipiInfo->ucMipiLanes = pTC358749XBGCtx->IsiSensorMipiInfo.ucMipiLanes; + ptIsiSensorMipiInfo->ulMipiFreq= pTC358749XBGCtx->IsiSensorMipiInfo.ulMipiFreq; + ptIsiSensorMipiInfo->sensorHalDevID = pTC358749XBGCtx->IsiSensorMipiInfo.sensorHalDevID; + + TRACE( TC358749XBG_DEBUG, "ucMipiLanes=%d,ulMipiFreq=%d,sensorHalDevID=%d\n", ptIsiSensorMipiInfo->ucMipiLanes,ptIsiSensorMipiInfo->ulMipiFreq,ptIsiSensorMipiInfo->sensorHalDevID ); + TRACE( TC358749XBG_INFO, "%s: (exit)\n", __FUNCTION__); + + return ( result ); +} + +static RESULT TC358749XBG_IsiGetSensorIsiVersion +( IsiSensorHandle_t handle, + unsigned int* pVersion +) +{ + TC358749XBG_Context_t *pTC358749XBGCtx = (TC358749XBG_Context_t *)handle; + uint8_t p_value; + int ret; + + RESULT result = RET_SUCCESS; + + + TRACE( TC358749XBG_INFO, "%s: (enter)\n", __FUNCTION__); + + if ( pTC358749XBGCtx == NULL ) + { + TRACE( TC358749XBG_ERROR, "%s: pTC358749XBGCtx IS NULL\n", __FUNCTION__); + return ( RET_WRONG_HANDLE ); + } + + if(pVersion == NULL) + { + TRACE( TC358749XBG_ERROR, "%s: pVersion IS NULL\n", __FUNCTION__); + return ( RET_WRONG_HANDLE ); + } + + *pVersion = CONFIG_ISI_VERSION; + /*need add szy*/ + /*uint8_t NrOfBytes = IsiGetNrDatBytesIss( address, TC358749XBG_g_hdmi_input_check ); + TRACE( TC358749XBG_ERROR, "%s (exit: NrOfBytes=%d)\n", __FUNCTION__, NrOfBytes); + if ( !NrOfBytes ) + { + NrOfBytes = 1; + } + TRACE( TC358749XBG_ERROR, "%s (IsiGetNrDatBytesIss %d 0x%08x)\n", __FUNCTION__, NrOfBytes, address);*/ + + return result; +} + + +/*****************************************************************************/ +/** + * TC358749XBG_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 TC358749XBG_IsiGetSensorIss +( + IsiSensor_t *pIsiSensor +) +{ + RESULT result = RET_SUCCESS; + + TRACE( TC358749XBG_INFO, "%s (enter)\n", __FUNCTION__); + + if ( pIsiSensor != NULL ) + { + pIsiSensor->pszName = TC358749XBG_g_acName; + pIsiSensor->pRegisterTable = TC358749XBG_g_aRegDescription; + pIsiSensor->pIsiSensorCaps = &TC358749XBG_g_IsiSensorDefaultConfig; + pIsiSensor->pIsiGetSensorIsiVer = TC358749XBG_IsiGetSensorIsiVersion; + + pIsiSensor->pIsiCreateSensorIss = TC358749XBG_IsiCreateSensorIss; + pIsiSensor->pIsiReleaseSensorIss = TC358749XBG_IsiReleaseSensorIss; + pIsiSensor->pIsiGetCapsIss = TC358749XBG_IsiGetCapsIss; + pIsiSensor->pIsiSetupSensorIss = TC358749XBG_IsiSetupSensorIss; + pIsiSensor->pIsiChangeSensorResolutionIss = TC358749XBG_IsiChangeSensorResolutionIss; + pIsiSensor->pIsiSensorSetStreamingIss = TC358749XBG_IsiSensorSetStreamingIss; + pIsiSensor->pIsiSensorSetPowerIss = TC358749XBG_IsiSensorSetPowerIss; + pIsiSensor->pIsiCheckSensorConnectionIss = TC358749XBG_IsiCheckSensorConnectionIss; + pIsiSensor->pIsiGetSensorRevisionIss = TC358749XBG_IsiGetSensorRevisionIss; + pIsiSensor->pIsiRegisterReadIss = TC358749XBG_IsiRegReadIss; + pIsiSensor->pIsiRegisterWriteIss = TC358749XBG_IsiRegWriteIss; + pIsiSensor->pIsiGetResolutionIss = TC358749XBG_IsiGetResolutionIss; + + /* AEC functions */ + pIsiSensor->pIsiExposureControlIss = TC358749XBG_IsiExposureControlIss; + pIsiSensor->pIsiGetGainLimitsIss = TC358749XBG_IsiGetGainLimitsIss; + pIsiSensor->pIsiGetIntegrationTimeLimitsIss = TC358749XBG_IsiGetIntegrationTimeLimitsIss; + pIsiSensor->pIsiGetCurrentExposureIss = TC358749XBG_IsiGetCurrentExposureIss; + pIsiSensor->pIsiGetGainIss = TC358749XBG_IsiGetGainIss; + pIsiSensor->pIsiGetGainIncrementIss = TC358749XBG_IsiGetGainIncrementIss; + pIsiSensor->pIsiSetGainIss = TC358749XBG_IsiSetGainIss; + pIsiSensor->pIsiGetIntegrationTimeIss = TC358749XBG_IsiGetIntegrationTimeIss; + pIsiSensor->pIsiGetIntegrationTimeIncrementIss = TC358749XBG_IsiGetIntegrationTimeIncrementIss; + pIsiSensor->pIsiSetIntegrationTimeIss = TC358749XBG_IsiSetIntegrationTimeIss; + pIsiSensor->pIsiGetAfpsInfoIss = TC358749XBG_IsiGetAfpsInfoIss; + + /* AWB specific functions */ + pIsiSensor->pIsiGetCalibKFactor = TC358749XBG_IsiGetCalibKFactor; + pIsiSensor->pIsiGetCalibPcaMatrix = TC358749XBG_IsiGetCalibPcaMatrix; + pIsiSensor->pIsiGetCalibSvdMeanValue = TC358749XBG_IsiGetCalibSvdMeanValue; + pIsiSensor->pIsiGetCalibCenterLine = TC358749XBG_IsiGetCalibCenterLine; + pIsiSensor->pIsiGetCalibClipParam = TC358749XBG_IsiGetCalibClipParam; + pIsiSensor->pIsiGetCalibGlobalFadeParam = TC358749XBG_IsiGetCalibGlobalFadeParam; + pIsiSensor->pIsiGetCalibFadeParam = TC358749XBG_IsiGetCalibFadeParam; + pIsiSensor->pIsiGetIlluProfile = TC358749XBG_IsiGetIlluProfile; + pIsiSensor->pIsiGetLscMatrixTable = TC358749XBG_IsiGetLscMatrixTable; + + /* AF functions */ + pIsiSensor->pIsiMdiInitMotoDriveMds = TC358749XBG_IsiMdiInitMotoDriveMds; + pIsiSensor->pIsiMdiSetupMotoDrive = TC358749XBG_IsiMdiSetupMotoDrive; + pIsiSensor->pIsiMdiFocusSet = TC358749XBG_IsiMdiFocusSet; + pIsiSensor->pIsiMdiFocusGet = TC358749XBG_IsiMdiFocusGet; + pIsiSensor->pIsiMdiFocusCalibrate = TC358749XBG_IsiMdiFocusCalibrate; + + /* MIPI */ + pIsiSensor->pIsiGetSensorMipiInfoIss = TC358749XBG_IsiGetSensorMipiInfoIss; + + /* Testpattern */ + pIsiSensor->pIsiActivateTestPattern = TC358749XBG_IsiActivateTestPattern; + } + else + { + result = RET_NULL_POINTER; + } + + TRACE( TC358749XBG_INFO, "%s (exit)\n", __FUNCTION__); + + return ( result ); +} + +static RESULT TC358749XBG_IsiGetSensorI2cInfo(sensor_i2c_info_t** pdata) +{ + sensor_i2c_info_t* pSensorI2cInfo; + + TRACE( TC358749XBG_INFO, "%s (Enter)\n", __FUNCTION__); + pSensorI2cInfo = ( sensor_i2c_info_t * )malloc ( sizeof (sensor_i2c_info_t) ); + + if ( pSensorI2cInfo == NULL ) + { + TRACE( TC358749XBG_ERROR, "%s: Can't allocate ov14825 context\n", __FUNCTION__ ); + return ( RET_OUTOFMEM ); + } + MEMSET( pSensorI2cInfo, 0, sizeof( sensor_i2c_info_t ) ); + + + pSensorI2cInfo->i2c_addr = TC358749XBG_SLAVE_ADDR; + pSensorI2cInfo->i2c_addr2 = TC358749XBG_SLAVE_ADDR2; + pSensorI2cInfo->soft_reg_addr = TC358749XBG_SOFTWARE_RST; + //pSensorI2cInfo->soft_reg_addr = 0xFFFF; + pSensorI2cInfo->soft_reg_value = 0x0000; //Assert reset,Exit Sleep,wait! + pSensorI2cInfo->reg_size = 2; + pSensorI2cInfo->value_size = 2; + + { + IsiSensorCaps_t Caps; + sensor_caps_t *pCaps; + uint32_t lanes,i; + + for (i=0; i<3; i++) { + lanes = (1<lane_res[i]); + if (g_suppoted_mipi_lanenum_type & lanes) { + Caps.Index = 0; + while(TC358749XBG_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 = TC358749XBG_CHIP_ID_HIGH_BYTE; + pChipIDInfo_H->chipid_reg_value = TC358749XBG_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 = TC358749XBG_CHIP_ID_MIDDLE_BYTE; + pChipIDInfo_M->chipid_reg_value = TC358749XBG_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 = TC358749XBG_CHIP_ID_LOW_BYTE; + pChipIDInfo_L->chipid_reg_value = TC358749XBG_CHIP_ID_LOW_BYTE_DEFAULT; + ListPrepareItem( pChipIDInfo_L ); + ListAddTail( &pSensorI2cInfo->chipid_info, pChipIDInfo_L ); + + //-----------------------kings add read system ctrl REG ----------------------------- + sensor_chipid_info_t* pChipIDInfo_0006 = (sensor_chipid_info_t *) malloc( sizeof(sensor_chipid_info_t) ); + if ( !pChipIDInfo_0006 ) + { + return RET_OUTOFMEM; + } + MEMSET( pChipIDInfo_0006, 0, sizeof(*pChipIDInfo_0006) ); + pChipIDInfo_0006->chipid_reg_addr = 0x0006; + pChipIDInfo_0006->chipid_reg_value = 0x0010; + ListPrepareItem( pChipIDInfo_0006 ); + ListAddTail( &pSensorI2cInfo->chipid_info, pChipIDInfo_0006 ); + + sensor_chipid_info_t* pChipIDInfo_000A = (sensor_chipid_info_t *) malloc( sizeof(sensor_chipid_info_t) ); + if ( !pChipIDInfo_000A ) + { + return RET_OUTOFMEM; + } + MEMSET( pChipIDInfo_000A, 0, sizeof(*pChipIDInfo_000A) ); + pChipIDInfo_000A->chipid_reg_addr = 0x000A; + pChipIDInfo_000A->chipid_reg_value = 0x0100; + ListPrepareItem( pChipIDInfo_000A ); + ListAddTail( &pSensorI2cInfo->chipid_info, pChipIDInfo_000A ); + + sensor_chipid_info_t* pChipIDInfo_000C = (sensor_chipid_info_t *) malloc( sizeof(sensor_chipid_info_t) ); + if ( !pChipIDInfo_000C ) + { + return RET_OUTOFMEM; + } + MEMSET( pChipIDInfo_000C, 0, sizeof(*pChipIDInfo_000C) ); + pChipIDInfo_000C->chipid_reg_addr = 0x000C; + pChipIDInfo_000C->chipid_reg_value = 0x3435; + ListPrepareItem( pChipIDInfo_000C ); + ListAddTail( &pSensorI2cInfo->chipid_info, pChipIDInfo_000C ); + + sensor_chipid_info_t* pChipIDInfo_000E = (sensor_chipid_info_t *) malloc( sizeof(sensor_chipid_info_t) ); + if ( !pChipIDInfo_000E ) + { + return RET_OUTOFMEM; + } + MEMSET( pChipIDInfo_000E, 0, sizeof(*pChipIDInfo_000E) ); + pChipIDInfo_000E->chipid_reg_addr = 0x000E; + pChipIDInfo_000E->chipid_reg_value = 0x3637; + ListPrepareItem( pChipIDInfo_000E ); + ListAddTail( &pSensorI2cInfo->chipid_info, pChipIDInfo_000E ); + + sensor_chipid_info_t* pChipIDInfo_0010 = (sensor_chipid_info_t *) malloc( sizeof(sensor_chipid_info_t) ); + if ( !pChipIDInfo_0010 ) + { + return RET_OUTOFMEM; + } + MEMSET( pChipIDInfo_0010, 0, sizeof(*pChipIDInfo_0010) ); + pChipIDInfo_0010->chipid_reg_addr = 0x0010; + pChipIDInfo_0010->chipid_reg_value = 0x0024; + ListPrepareItem( pChipIDInfo_0010 ); + ListAddTail( &pSensorI2cInfo->chipid_info, pChipIDInfo_0010 ); + //----------------------kings add end--------------------------------------------- +*/ + //oyyf sensor drv version + pSensorI2cInfo->sensor_drv_version = CONFIG_SENSOR_DRV_VERSION; + + *pdata = pSensorI2cInfo; + + TRACE( TC358749XBG_INFO, "%s (Exit)\n", __FUNCTION__); + return RET_SUCCESS; +} + +/****************************************************************************** + * See header file for detailed comment. + *****************************************************************************/ + +/*****************************************************************************/ +/** + */ +/*****************************************************************************/ +IsiCamDrvConfig_t IsiCamDrvConfig = +{ + 0, + TC358749XBG_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.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.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 */ + }, + TC358749XBG_IsiGetSensorI2cInfo, +}; + + + diff --git a/hardware/rockchip/camera/SiliconImage/isi/drv/TC358749XBG_MIPI_YUV/source/TC358749XBG_tables.c b/hardware/rockchip/camera/SiliconImage/isi/drv/TC358749XBG_MIPI_YUV/source/TC358749XBG_tables.c new file mode 100644 index 0000000000..91dc861c53 --- /dev/null +++ b/hardware/rockchip/camera/SiliconImage/isi/drv/TC358749XBG_MIPI_YUV/source/TC358749XBG_tables.c @@ -0,0 +1,577 @@ +#include +#include +#include + +#include + +#include "isi.h" +#include "isi_iss.h" +#include "isi_priv.h" +#include "TC358749XBG_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 TC358749XBG_g_aRegDescription[] = +{ + // +{0x0004,0x0400,"0x0100",eReadWrite_16}, +{0x0002,0x807F,"0x0100",eReadWrite_16}, +{0x0002,0x0000,"0x0100",eReadWrite_16}, + // +{0x0020,0x5B30,"0x0100",eReadWrite_16}, +{0x0022,0x0302,"0x0100",eReadWrite_16}, + {0x0 ,0x1,"0x0100",eDelay}, +{0x0022,0x1302,"0x0100",eReadWrite_16}, + // +{0x0006,0xF401,"0x0100",eReadWrite_16}, + // +{0x0060,0x0100,"0x0100",eReadWrite_16}, +{0x7080,0x0000,"0x0100",eReadWrite_16}, + // +{0x0014,0x0000,"0x0100",eReadWrite_16}, +{0x0016,0xFF05,"0x0100",eReadWrite_16}, + // +{0x0140,0x00000000,"0x0100",eReadWrite_32}, +{0x0144,0x00000000,"0x0100",eReadWrite_32}, +{0x0148,0x00000000,"0x0100",eReadWrite_32}, +{0x014C,0x00000000,"0x0100",eReadWrite_32}, +{0x0150,0x00000000,"0x0100",eReadWrite_32}, + // +{0x0210,0x70170000,"0x0100",eReadWrite_32}, +{0x0214,0x05000000,"0x0100",eReadWrite_32}, +{0x0218,0x05260000,"0x0100",eReadWrite_32}, +{0x021C,0x02000000,"0x0100",eReadWrite_32}, +{0x0220,0x05050000,"0x0100",eReadWrite_32}, +{0x0224,0x68420000,"0x0100",eReadWrite_32}, +{0x0228,0x09000000,"0x0100",eReadWrite_32}, +{0x022C,0x03000000,"0x0100",eReadWrite_32}, +{0x0230,0x05000000,"0x0100",eReadWrite_32}, +{0x0234,0x1F000000,"0x0100",eReadWrite_32}, +{0x0238,0x00000000,"0x0100",eReadWrite_32}, +{0x0204,0x01000000,"0x0100",eReadWrite_32}, +{0x0518,0x01000000,"0x0100",eReadWrite_32}, +{0x0500,0x868000A3,"0x0100",eReadWrite_32}, + // +{0x0012,0x0200,"0x0100",eReadWrite_16}, + // +{0x8502,0x01,"0x0100",eReadWrite}, +{0x8512,0xFE,"0x0100",eReadWrite}, +{0x8514,0x00,"0x0100",eReadWrite}, +{0x8515,0x00,"0x0100",eReadWrite}, +{0x8516,0x00,"0x0100",eReadWrite}, + // +{0x8531,0x01,"0x0100",eReadWrite}, +{0x8540,0x8C,"0x0100",eReadWrite}, +{0x8541,0x0A,"0x0100",eReadWrite}, +{0x8630,0xB0,"0x0100",eReadWrite}, +{0x8631,0x1E,"0x0100",eReadWrite}, +{0x8632,0x04,"0x0100",eReadWrite}, +{0x8670,0x01,"0x0100",eReadWrite}, + // +{0x8532,0x80,"0x0100",eReadWrite}, +{0x8536,0x40,"0x0100",eReadWrite}, +{0x853F,0x0A,"0x0100",eReadWrite}, + // +{0x8543,0x32,"0x0100",eReadWrite}, +{0x8544,0x10,"0x0100",eReadWrite}, +{0x8545,0x31,"0x0100",eReadWrite}, +{0x8546,0x2D,"0x0100",eReadWrite}, + // +{0x85C7,0x01,"0x0100",eReadWrite}, +{0x85CA,0x00,"0x0100",eReadWrite}, +{0x85CB,0x01,"0x0100",eReadWrite}, + // +{0x8C00,0x00,"0x0100",eReadWrite}, +{0x8C01,0xFF,"0x0100",eReadWrite}, +{0x8C02,0xFF,"0x0100",eReadWrite}, +{0x8C03,0xFF,"0x0100",eReadWrite}, +{0x8C04,0xFF,"0x0100",eReadWrite}, +{0x8C05,0xFF,"0x0100",eReadWrite}, +{0x8C06,0xFF,"0x0100",eReadWrite}, +{0x8C07,0x00,"0x0100",eReadWrite}, +{0x8C08,0x52,"0x0100",eReadWrite}, +{0x8C09,0x62,"0x0100",eReadWrite}, +{0x8C0A,0x88,"0x0100",eReadWrite}, +{0x8C0B,0x88,"0x0100",eReadWrite}, +{0x8C0C,0x00,"0x0100",eReadWrite}, +{0x8C0D,0x88,"0x0100",eReadWrite}, +{0x8C0E,0x88,"0x0100",eReadWrite}, +{0x8C0F,0x88,"0x0100",eReadWrite}, +{0x8C10,0x1C,"0x0100",eReadWrite}, +{0x8C11,0x15,"0x0100",eReadWrite}, +{0x8C12,0x01,"0x0100",eReadWrite}, +{0x8C13,0x03,"0x0100",eReadWrite}, +{0x8C14,0x80,"0x0100",eReadWrite}, +{0x8C15,0x00,"0x0100",eReadWrite}, +{0x8C16,0x00,"0x0100",eReadWrite}, +{0x8C17,0x78,"0x0100",eReadWrite}, +{0x8C18,0x0A,"0x0100",eReadWrite}, +{0x8C19,0x0D,"0x0100",eReadWrite}, +{0x8C1A,0xC9,"0x0100",eReadWrite}, +{0x8C1B,0xA0,"0x0100",eReadWrite}, +{0x8C1C,0x57,"0x0100",eReadWrite}, +{0x8C1D,0x47,"0x0100",eReadWrite}, +{0x8C1E,0x98,"0x0100",eReadWrite}, +{0x8C1F,0x27,"0x0100",eReadWrite}, +{0x8C20,0x12,"0x0100",eReadWrite}, +{0x8C21,0x48,"0x0100",eReadWrite}, +{0x8C22,0x4C,"0x0100",eReadWrite}, +{0x8C23,0x00,"0x0100",eReadWrite}, +{0x8C24,0x00,"0x0100",eReadWrite}, +{0x8C25,0x00,"0x0100",eReadWrite}, +{0x8C26,0x01,"0x0100",eReadWrite}, +{0x8C27,0x01,"0x0100",eReadWrite}, +{0x8C28,0x01,"0x0100",eReadWrite}, +{0x8C29,0x01,"0x0100",eReadWrite}, +{0x8C2A,0x01,"0x0100",eReadWrite}, +{0x8C2B,0x01,"0x0100",eReadWrite}, +{0x8C2C,0x01,"0x0100",eReadWrite}, +{0x8C2D,0x01,"0x0100",eReadWrite}, +{0x8C2E,0x01,"0x0100",eReadWrite}, +{0x8C2F,0x01,"0x0100",eReadWrite}, +{0x8C30,0x01,"0x0100",eReadWrite}, +{0x8C31,0x01,"0x0100",eReadWrite}, +{0x8C32,0x01,"0x0100",eReadWrite}, +{0x8C33,0x01,"0x0100",eReadWrite}, +{0x8C34,0x01,"0x0100",eReadWrite}, +{0x8C35,0x01,"0x0100",eReadWrite}, +{0x8C36,0x02,"0x0100",eReadWrite}, +{0x8C37,0x3A,"0x0100",eReadWrite}, +{0x8C38,0x80,"0x0100",eReadWrite}, +{0x8C39,0x18,"0x0100",eReadWrite}, +{0x8C3A,0x71,"0x0100",eReadWrite}, +{0x8C3B,0x38,"0x0100",eReadWrite}, +{0x8C3C,0x2D,"0x0100",eReadWrite}, +{0x8C3D,0x40,"0x0100",eReadWrite}, +{0x8C3E,0x58,"0x0100",eReadWrite}, +{0x8C3F,0x2C,"0x0100",eReadWrite}, +{0x8C40,0x45,"0x0100",eReadWrite}, +{0x8C41,0x00,"0x0100",eReadWrite}, +{0x8C42,0xC4,"0x0100",eReadWrite}, +{0x8C43,0x8E,"0x0100",eReadWrite}, +{0x8C44,0x21,"0x0100",eReadWrite}, +{0x8C45,0x00,"0x0100",eReadWrite}, +{0x8C46,0x00,"0x0100",eReadWrite}, +{0x8C47,0x1E,"0x0100",eReadWrite}, +{0x8C48,0x01,"0x0100",eReadWrite}, +{0x8C49,0x1D,"0x0100",eReadWrite}, +{0x8C4A,0x00,"0x0100",eReadWrite}, +{0x8C4B,0x72,"0x0100",eReadWrite}, +{0x8C4C,0x51,"0x0100",eReadWrite}, +{0x8C4D,0xD0,"0x0100",eReadWrite}, +{0x8C4E,0x1E,"0x0100",eReadWrite}, +{0x8C4F,0x20,"0x0100",eReadWrite}, +{0x8C50,0x6E,"0x0100",eReadWrite}, +{0x8C51,0x28,"0x0100",eReadWrite}, +{0x8C52,0x55,"0x0100",eReadWrite}, +{0x8C53,0x00,"0x0100",eReadWrite}, +{0x8C54,0xC4,"0x0100",eReadWrite}, +{0x8C55,0x8E,"0x0100",eReadWrite}, +{0x8C56,0x21,"0x0100",eReadWrite}, +{0x8C57,0x00,"0x0100",eReadWrite}, +{0x8C58,0x00,"0x0100",eReadWrite}, +{0x8C59,0x1E,"0x0100",eReadWrite}, +{0x8C5A,0x00,"0x0100",eReadWrite}, +{0x8C5B,0x00,"0x0100",eReadWrite}, +{0x8C5C,0x00,"0x0100",eReadWrite}, +{0x8C5D,0xFC,"0x0100",eReadWrite}, +{0x8C5E,0x00,"0x0100",eReadWrite}, +{0x8C5F,0x54,"0x0100",eReadWrite}, +{0x8C60,0x6F,"0x0100",eReadWrite}, +{0x8C61,0x73,"0x0100",eReadWrite}, +{0x8C62,0x68,"0x0100",eReadWrite}, +{0x8C63,0x69,"0x0100",eReadWrite}, +{0x8C64,0x62,"0x0100",eReadWrite}, +{0x8C65,0x61,"0x0100",eReadWrite}, +{0x8C66,0x2D,"0x0100",eReadWrite}, +{0x8C67,0x48,"0x0100",eReadWrite}, +{0x8C68,0x32,"0x0100",eReadWrite}, +{0x8C69,0x43,"0x0100",eReadWrite}, +{0x8C6A,0x50,"0x0100",eReadWrite}, +{0x8C6B,0x0A,"0x0100",eReadWrite}, +{0x8C6C,0x00,"0x0100",eReadWrite}, +{0x8C6D,0x00,"0x0100",eReadWrite}, +{0x8C6E,0x00,"0x0100",eReadWrite}, +{0x8C6F,0xFD,"0x0100",eReadWrite}, +{0x8C70,0x00,"0x0100",eReadWrite}, +{0x8C71,0x17,"0x0100",eReadWrite}, +{0x8C72,0x3D,"0x0100",eReadWrite}, +{0x8C73,0x0F,"0x0100",eReadWrite}, +{0x8C74,0x8C,"0x0100",eReadWrite}, +{0x8C75,0x17,"0x0100",eReadWrite}, +{0x8C76,0x00,"0x0100",eReadWrite}, +{0x8C77,0x0A,"0x0100",eReadWrite}, +{0x8C78,0x20,"0x0100",eReadWrite}, +{0x8C79,0x20,"0x0100",eReadWrite}, +{0x8C7A,0x20,"0x0100",eReadWrite}, +{0x8C7B,0x20,"0x0100",eReadWrite}, +{0x8C7C,0x20,"0x0100",eReadWrite}, +{0x8C7D,0x20,"0x0100",eReadWrite}, +{0x8C7E,0x01,"0x0100",eReadWrite}, +{0x8C7F,0x63,"0x0100",eReadWrite}, +{0x8C80,0x02,"0x0100",eReadWrite}, +{0x8C81,0x03,"0x0100",eReadWrite}, +{0x8C82,0x17,"0x0100",eReadWrite}, +{0x8C83,0x74,"0x0100",eReadWrite}, +{0x8C84,0x47,"0x0100",eReadWrite}, +{0x8C85,0x10,"0x0100",eReadWrite}, +{0x8C86,0x04,"0x0100",eReadWrite}, +{0x8C87,0x05,"0x0100",eReadWrite}, +{0x8C88,0x05,"0x0100",eReadWrite}, +{0x8C89,0x05,"0x0100",eReadWrite}, +{0x8C8A,0x05,"0x0100",eReadWrite}, +{0x8C8B,0x05,"0x0100",eReadWrite}, +{0x8C8C,0x23,"0x0100",eReadWrite}, +{0x8C8D,0x09,"0x0100",eReadWrite}, +{0x8C8E,0x07,"0x0100",eReadWrite}, +{0x8C8F,0x01,"0x0100",eReadWrite}, +{0x8C90,0x66,"0x0100",eReadWrite}, +{0x8C91,0x03,"0x0100",eReadWrite}, +{0x8C92,0x0C,"0x0100",eReadWrite}, +{0x8C93,0x00,"0x0100",eReadWrite}, +{0x8C94,0x30,"0x0100",eReadWrite}, +{0x8C95,0x00,"0x0100",eReadWrite}, +{0x8C96,0x80,"0x0100",eReadWrite}, +{0x8C97,0x8C,"0x0100",eReadWrite}, +{0x8C98,0x0A,"0x0100",eReadWrite}, +{0x8C99,0xD0,"0x0100",eReadWrite}, +{0x8C9A,0x01,"0x0100",eReadWrite}, +{0x8C9B,0x1D,"0x0100",eReadWrite}, +{0x8C9C,0x80,"0x0100",eReadWrite}, +{0x8C9D,0x18,"0x0100",eReadWrite}, +{0x8C9E,0x71,"0x0100",eReadWrite}, +{0x8C9F,0x38,"0x0100",eReadWrite}, +{0x8CA0,0x16,"0x0100",eReadWrite}, +{0x8CA1,0x40,"0x0100",eReadWrite}, +{0x8CA2,0x58,"0x0100",eReadWrite}, +{0x8CA3,0x2C,"0x0100",eReadWrite}, +{0x8CA4,0x25,"0x0100",eReadWrite}, +{0x8CA5,0x00,"0x0100",eReadWrite}, +{0x8CA6,0x80,"0x0100",eReadWrite}, +{0x8CA7,0x38,"0x0100",eReadWrite}, +{0x8CA8,0x74,"0x0100",eReadWrite}, +{0x8CA9,0x00,"0x0100",eReadWrite}, +{0x8CAA,0x00,"0x0100",eReadWrite}, +{0x8CAB,0x18,"0x0100",eReadWrite}, +{0x8CAC,0x01,"0x0100",eReadWrite}, +{0x8CAD,0x1D,"0x0100",eReadWrite}, +{0x8CAE,0x80,"0x0100",eReadWrite}, +{0x8CAF,0x18,"0x0100",eReadWrite}, +{0x8CB0,0x71,"0x0100",eReadWrite}, +{0x8CB1,0x38,"0x0100",eReadWrite}, +{0x8CB2,0x16,"0x0100",eReadWrite}, +{0x8CB3,0x40,"0x0100",eReadWrite}, +{0x8CB4,0x58,"0x0100",eReadWrite}, +{0x8CB5,0x2C,"0x0100",eReadWrite}, +{0x8CB6,0x25,"0x0100",eReadWrite}, +{0x8CB7,0x00,"0x0100",eReadWrite}, +{0x8CB8,0x80,"0x0100",eReadWrite}, +{0x8CB9,0x38,"0x0100",eReadWrite}, +{0x8CBA,0x74,"0x0100",eReadWrite}, +{0x8CBB,0x00,"0x0100",eReadWrite}, +{0x8CBC,0x00,"0x0100",eReadWrite}, +{0x8CBD,0x18,"0x0100",eReadWrite}, +{0x8CBE,0x01,"0x0100",eReadWrite}, +{0x8CBF,0x1D,"0x0100",eReadWrite}, +{0x8CC0,0x80,"0x0100",eReadWrite}, +{0x8CC1,0x18,"0x0100",eReadWrite}, +{0x8CC2,0x71,"0x0100",eReadWrite}, +{0x8CC3,0x38,"0x0100",eReadWrite}, +{0x8CC4,0x16,"0x0100",eReadWrite}, +{0x8CC5,0x40,"0x0100",eReadWrite}, +{0x8CC6,0x58,"0x0100",eReadWrite}, +{0x8CC7,0x2C,"0x0100",eReadWrite}, +{0x8CC8,0x25,"0x0100",eReadWrite}, +{0x8CC9,0x00,"0x0100",eReadWrite}, +{0x8CCA,0x80,"0x0100",eReadWrite}, +{0x8CCB,0x38,"0x0100",eReadWrite}, +{0x8CCC,0x74,"0x0100",eReadWrite}, +{0x8CCD,0x00,"0x0100",eReadWrite}, +{0x8CCE,0x00,"0x0100",eReadWrite}, +{0x8CCF,0x18,"0x0100",eReadWrite}, +{0x8CD0,0x01,"0x0100",eReadWrite}, +{0x8CD1,0x1D,"0x0100",eReadWrite}, +{0x8CD2,0x80,"0x0100",eReadWrite}, +{0x8CD3,0x18,"0x0100",eReadWrite}, +{0x8CD4,0x71,"0x0100",eReadWrite}, +{0x8CD5,0x38,"0x0100",eReadWrite}, +{0x8CD6,0x16,"0x0100",eReadWrite}, +{0x8CD7,0x40,"0x0100",eReadWrite}, +{0x8CD8,0x58,"0x0100",eReadWrite}, +{0x8CD9,0x2C,"0x0100",eReadWrite}, +{0x8CDA,0x25,"0x0100",eReadWrite}, +{0x8CDB,0x00,"0x0100",eReadWrite}, +{0x8CDC,0x80,"0x0100",eReadWrite}, +{0x8CDD,0x38,"0x0100",eReadWrite}, +{0x8CDE,0x74,"0x0100",eReadWrite}, +{0x8CDF,0x00,"0x0100",eReadWrite}, +{0x8CE0,0x00,"0x0100",eReadWrite}, +{0x8CE1,0x18,"0x0100",eReadWrite}, +{0x8CE2,0x00,"0x0100",eReadWrite}, +{0x8CE3,0x00,"0x0100",eReadWrite}, +{0x8CE4,0x00,"0x0100",eReadWrite}, +{0x8CE5,0x00,"0x0100",eReadWrite}, +{0x8CE6,0x00,"0x0100",eReadWrite}, +{0x8CE7,0x00,"0x0100",eReadWrite}, +{0x8CE8,0x00,"0x0100",eReadWrite}, +{0x8CE9,0x00,"0x0100",eReadWrite}, +{0x8CEA,0x00,"0x0100",eReadWrite}, +{0x8CEB,0x00,"0x0100",eReadWrite}, +{0x8CEC,0x00,"0x0100",eReadWrite}, +{0x8CED,0x00,"0x0100",eReadWrite}, +{0x8CEE,0x00,"0x0100",eReadWrite}, +{0x8CEF,0x00,"0x0100",eReadWrite}, +{0x8CF0,0x00,"0x0100",eReadWrite}, +{0x8CF1,0x00,"0x0100",eReadWrite}, +{0x8CF2,0x00,"0x0100",eReadWrite}, +{0x8CF3,0x00,"0x0100",eReadWrite}, +{0x8CF4,0x00,"0x0100",eReadWrite}, +{0x8CF5,0x00,"0x0100",eReadWrite}, +{0x8CF6,0x00,"0x0100",eReadWrite}, +{0x8CF7,0x00,"0x0100",eReadWrite}, +{0x8CF8,0x00,"0x0100",eReadWrite}, +{0x8CF9,0x00,"0x0100",eReadWrite}, +{0x8CFA,0x00,"0x0100",eReadWrite}, +{0x8CFB,0x00,"0x0100",eReadWrite}, +{0x8CFC,0x00,"0x0100",eReadWrite}, +{0x8CFD,0x00,"0x0100",eReadWrite}, +{0x8CFE,0x00,"0x0100",eReadWrite}, +{0x8CFF,0xB5,"0x0100",eReadWrite}, + // + // +{0x8573,0x81,"0x0100",eReadWrite}, + // +{0x8600,0x00,"0x0100",eReadWrite}, +{0x8602,0xF3,"0x0100",eReadWrite}, +{0x8603,0x02,"0x0100",eReadWrite}, +{0x8604,0x0C,"0x0100",eReadWrite}, +{0x8606,0x05,"0x0100",eReadWrite}, +{0x8607,0x00,"0x0100",eReadWrite}, +{0x8620,0x2A,"0x0100",eReadWrite}, +{0x8621,0x02,"0x0100",eReadWrite}, +{0x8640,0x01,"0x0100",eReadWrite}, +{0x8641,0x65,"0x0100",eReadWrite}, +{0x8642,0x07,"0x0100",eReadWrite}, +{0x8652,0x02,"0x0100",eReadWrite}, +{0x8665,0x10,"0x0100",eReadWrite}, + // +{0x8709,0xFF,"0x0100",eReadWrite}, +{0x870B,0x2C,"0x0100",eReadWrite}, +{0x870C,0x53,"0x0100",eReadWrite}, +{0x870D,0x01,"0x0100",eReadWrite}, +{0x870E,0x30,"0x0100",eReadWrite}, +{0x9007,0x10,"0x0100",eReadWrite}, +{0x854A,0x01,"0x0100",eReadWrite}, +{0x0004,0xD70C,"0x0100",eReadWrite_16}, +{0x0000 ,0x00,"eTableEnd",eTableEnd} +}; + +const IsiRegDescription_t TC358749XBG_g_aRegVedioON[] = +{ + //------------------------------------ + //Let HDMI Source start access + {0x854A ,0x00,"0x0100",eReadWrite},//01 + //Let HDMI Source start access + {0x854A ,0x00,"0x0100",eReadWrite},//01 + + {0x0 ,0x1,"0x0100",eDelay}, //eDelay 10us shiji:1ms + + //Wait until HDMI sync is established + {0x8520 ,0x00,"0x0100",eReadOnly}, //CLK_Status + + {0x0004 ,0x0400,"0x0100",eReadWrite_16}, //ConfCtl 0CD7 + //--------------------------- + {0x0000 ,0x00,"eTableEnd",eTableEnd} +}; + +const IsiRegDescription_t TC358749XBG_g_hdmi_input_check[] = +{ + //------HDMI input video timing check + //PCLK + {0x852E ,0x00,"0x0100",eReadOnly}, //PX_FREQ0 + {0x852F ,0x00,"0x0100",eReadOnly}, //PX_FREQ1 + //Horizontal Related + {0x858A ,0x00,"0x0100",eReadOnly}, //H_SIZE[7:0] + {0x858B ,0x00,"0x0100",eReadOnly}, //H_SIZE[12:8] + {0x8580 ,0x00,"0x0100",eReadOnly}, //DE_HPOS[7:0] + {0x8581 ,0x00,"0x0100",eReadOnly}, //DE_HPOS[12:8] + {0x8582 ,0x00,"0x0100",eReadOnly}, //DE_HWID[7:0] + {0x8583 ,0x00,"0x0100",eReadOnly}, //DE_HWID[12:8] + //Vertical Related + {0x858C ,0x00,"0x0100",eReadOnly}, //V_SIZE[7:0] + {0x858D ,0x00,"0x0100",eReadOnly}, //V_SIZE[12:8] + {0x8584 ,0x00,"0x0100",eReadOnly}, //DE_VPOS_A[7:0] + {0x8585 ,0x00,"0x0100",eReadOnly}, //DE_VPOS_A[12:8] + {0x8586 ,0x00,"0x0100",eReadOnly}, //DE_VPOS_B[7:0] + {0x8587 ,0x00,"0x0100",eReadOnly}, //DE_VPOS_B[12:8] + {0x8588 ,0x00,"0x0100",eReadOnly}, //DE_VWID[7:0] + {0x8589 ,0x00,"0x0100",eReadOnly}, //DE_VWID[12:8] + //VSYNC,HSYNC Porarity + {0x8586 ,0x00,"0x0100",eReadOnly}, //CLK_Status + + {0x0000 ,0x00,"eTableEnd",eTableEnd} +}; + +const IsiRegDescription_t TC358749XBG_g_edio[] = +{ + //EDIO + {0x8C09 ,0x62,"0x0100",eReadWrite}, + {0x8C0A ,0x88,"0x0100",eReadWrite}, + {0x8C0B ,0x88,"0x0100",eReadWrite}, + {0x8C0C ,0x00,"0x0100",eReadWrite}, + {0x8C0D ,0x88,"0x0100",eReadWrite}, + {0x8C0E ,0x88,"0x0100",eReadWrite}, + {0x8C0F ,0x88,"0x0100",eReadWrite}, + + {0x8C10 ,0x1C,"0x0100",eReadWrite}, + {0x8C11 ,0x15,"0x0100",eReadWrite}, + + {0x8C36 ,0x02,"0x0100",eReadWrite}, + {0x8C37 ,0x3A,"0x0100",eReadWrite}, + {0x8C38 ,0x80,"0x0100",eReadWrite}, + {0x8C39 ,0x18,"0x0100",eReadWrite}, + {0x8C3A ,0x71,"0x0100",eReadWrite}, + {0x8C3B ,0x38,"0x0100",eReadWrite}, + {0x8C3C ,0x2D,"0x0100",eReadWrite}, + {0x8C3D ,0x40,"0x0100",eReadWrite}, + {0x8C3E ,0x58,"0x0100",eReadWrite}, + {0x8C3F ,0x2C,"0x0100",eReadWrite}, + + {0x8C40 ,0x45,"0x0100",eReadWrite}, + {0x8C41 ,0x00,"0x0100",eReadWrite}, + {0x8C42 ,0x80,"0x0100",eReadWrite}, + {0x8C43 ,0x38,"0x0100",eReadWrite}, + {0x8C44 ,0x74,"0x0100",eReadWrite}, + {0x8C48 ,0x02,"0x0100",eReadWrite}, + {0x8C49 ,0x34,"0x0100",eReadWrite}, + {0x8C4A ,0x80,"0x0100",eReadWrite}, + {0x8C4B ,0x18,"0x0100",eReadWrite}, + {0x8C4C ,0x71,"0x0100",eReadWrite}, + {0x8C4D ,0x38,"0x0100",eReadWrite}, + {0x8C4E ,0x2D,"0x0100",eReadWrite}, + {0x8C4F ,0x40,"0x0100",eReadWrite}, + + {0x8C50 ,0x58,"0x0100",eReadWrite}, + {0x8C51 ,0x2C,"0x0100",eReadWrite}, + {0x8C52 ,0x45,"0x0100",eReadWrite}, + {0x8C53 ,0x00,"0x0100",eReadWrite}, + {0x8C54 ,0x80,"0x0100",eReadWrite}, + {0x8C55 ,0x38,"0x0100",eReadWrite}, + {0x8C56 ,0x74,"0x0100",eReadWrite}, + {0x8C5E ,0x00,"0x0100",eReadWrite}, + {0x8C5F ,0x54,"0x0100",eReadWrite}, + + {0x8C60 ,0x6F,"0x0100",eReadWrite}, + {0x8C61 ,0x73,"0x0100",eReadWrite}, + {0x8C62 ,0x68,"0x0100",eReadWrite}, + {0x8C63 ,0x69,"0x0100",eReadWrite}, + {0x8C64 ,0x62,"0x0100",eReadWrite}, + {0x8C65 ,0x61,"0x0100",eReadWrite}, + {0x8C66 ,0x2D,"0x0100",eReadWrite}, + {0x8C67 ,0x48,"0x0100",eReadWrite}, + {0x8C68 ,0x32,"0x0100",eReadWrite}, + {0x8C69 ,0x44,"0x0100",eReadWrite}, + {0x8C6A ,0x0A,"0x0100",eReadWrite}, + {0x8C6B ,0x20,"0x0100",eReadWrite}, + + {0x8C84 ,0x47,"0x0100",eReadWrite}, + {0x8C85 ,0x0A,"0x0100",eReadWrite}, + {0x8C86 ,0x0A,"0x0100",eReadWrite}, + {0x8C87 ,0x0A,"0x0100",eReadWrite}, + {0x8C88 ,0x0A,"0x0100",eReadWrite}, + {0x8C89 ,0x0A,"0x0100",eReadWrite}, + {0x8C8A ,0x0A,"0x0100",eReadWrite}, + {0x8C8B ,0x0A,"0x0100",eReadWrite}, + + {0x8C9A ,0x02,"0x0100",eReadWrite}, + {0x8C9B ,0x3A,"0x0100",eReadWrite}, + {0x8C9C ,0x80,"0x0100",eReadWrite}, + {0x8C9D ,0x18,"0x0100",eReadWrite}, + {0x8C9E ,0x71,"0x0100",eReadWrite}, + {0x8C9F ,0x38,"0x0100",eReadWrite}, + + {0x8CA0 ,0x2D,"0x0100",eReadWrite}, + {0x8CA1 ,0x40,"0x0100",eReadWrite}, + {0x8CA2 ,0x58,"0x0100",eReadWrite}, + {0x8CA3 ,0x2C,"0x0100",eReadWrite}, + {0x8CA4 ,0x45,"0x0100",eReadWrite}, + {0x8CA5 ,0x00,"0x0100",eReadWrite}, + {0x8CA6 ,0x80,"0x0100",eReadWrite}, + {0x8CA7 ,0x38,"0x0100",eReadWrite}, + {0x8CA8 ,0x74,"0x0100",eReadWrite}, + {0x8CAC ,0x02,"0x0100",eReadWrite}, + {0x8CAD ,0x3A,"0x0100",eReadWrite}, + {0x8CAE ,0x80,"0x0100",eReadWrite}, + {0x8CAF ,0x18,"0x0100",eReadWrite}, + + {0x8CB0 ,0x71,"0x0100",eReadWrite}, + {0x8CB1 ,0x38,"0x0100",eReadWrite}, + {0x8CB2 ,0x2D,"0x0100",eReadWrite}, + {0x8CB3 ,0x40,"0x0100",eReadWrite}, + {0x8CB4 ,0x58,"0x0100",eReadWrite}, + {0x8CB5 ,0x2C,"0x0100",eReadWrite}, + {0x8CB6 ,0x45,"0x0100",eReadWrite}, + {0x8CB7 ,0x00,"0x0100",eReadWrite}, + {0x8CB8 ,0x80,"0x0100",eReadWrite}, + {0x8CB9 ,0x38,"0x0100",eReadWrite}, + {0x8CBA ,0x74,"0x0100",eReadWrite}, + {0x8CBE ,0x02,"0x0100",eReadWrite}, + {0x8CBF ,0x3A,"0x0100",eReadWrite}, + + {0x8CC0 ,0x80,"0x0100",eReadWrite}, + {0x8CC1 ,0x18,"0x0100",eReadWrite}, + {0x8CC2 ,0x71,"0x0100",eReadWrite}, + {0x8CC3 ,0x38,"0x0100",eReadWrite}, + {0x8CC4 ,0x2D,"0x0100",eReadWrite}, + {0x8CC5 ,0x40,"0x0100",eReadWrite}, + {0x8CC6 ,0x58,"0x0100",eReadWrite}, + {0x8CC7 ,0x2C,"0x0100",eReadWrite}, + {0x8CC8 ,0x45,"0x0100",eReadWrite}, + {0x8CC9 ,0x00,"0x0100",eReadWrite}, + {0x8CCA ,0x80,"0x0100",eReadWrite}, + {0x8CCB ,0x38,"0x0100",eReadWrite}, + {0x8CCC ,0x74,"0x0100",eReadWrite}, + + {0x8CD0 ,0x02,"0x0100",eReadWrite}, + {0x8CD1 ,0x3A,"0x0100",eReadWrite}, + {0x8CD2 ,0x80,"0x0100",eReadWrite}, + {0x8CD3 ,0x18,"0x0100",eReadWrite}, + {0x8CD4 ,0x71,"0x0100",eReadWrite}, + {0x8CD5 ,0x38,"0x0100",eReadWrite}, + {0x8CD6 ,0x2D,"0x0100",eReadWrite}, + {0x8CD7 ,0x40,"0x0100",eReadWrite}, + {0x8CD8 ,0x58,"0x0100",eReadWrite}, + {0x8CD9 ,0x2C,"0x0100",eReadWrite}, + {0x8CDA ,0x45,"0x0100",eReadWrite}, + {0x8CDB ,0x00,"0x0100",eReadWrite}, + {0x8CDC ,0x80,"0x0100",eReadWrite}, + {0x8CDD ,0x38,"0x0100",eReadWrite}, + {0x8CDE ,0x74,"0x0100",eReadWrite}, + + {0x0000 ,0x00,"eTableEnd",eTableEnd} +}; + + +const IsiRegDescription_t TC358749XBG_g_svga[] = +{ + + {0x0000 ,0x00,"eTableEnd",eTableEnd} +}; + +const IsiRegDescription_t TC358749XBG_g_1600x1200[] = +{ + {0x0000 ,0x00,"eTableEnd",eTableEnd} + +}; + +