Commit 526f902b authored by sam.xiang's avatar sam.xiang Committed by forum_service

middleware: weekly update 2023-05-22 1. update awb algo 2. support some sensor...

middleware: weekly update 2023-05-22 1. update awb algo 2. support some sensor 3. add cv181x ko_shrink 4. update codec driver

Change-Id: Ie0cf772066a25dcb12074ee562cdabd71d63cd06
parent 34605614
......@@ -30,45 +30,11 @@ sample/vio/sample_vio
sample/vdecvo/sample_vdecvo
sample/multivenc/sample_multivenc
sample/ir_auto/ir_auto
sample/ive/sample_16bitto8bit
sample/ive/sample_add
sample/ive/sample_and
sample/ive/sample_bernsen
sample/ive/sample_bgmodel
sample/ive/sample_cannyedge
sample/ive/sample_cannyhysedge
sample/ive/sample_csc
sample/ive/sample_dilate
sample/ive/sample_dma
sample/ive/sample_erode
sample/ive/sample_filter
sample/ive/sample_filterandcsc
sample/ive/sample_framediffmotion
sample/ive/sample_gmm
sample/ive/sample_gmm2
sample/ive/sample_gradfg
sample/ive/sample_hist
sample/ive/sample_integ
sample/ive/sample_lbp
sample/ive/sample_magandang
sample/ive/sample_map
sample/ive/sample_ncc
sample/ive/sample_normgrad
sample/ive/sample_or
sample/ive/sample_ordstatfilter
sample/ive/sample_query
sample/ive/sample_resize
sample/ive/sample_sad
sample/ive/sample_sobel
sample/ive/sample_stcandicorner
sample/ive/sample_sub
sample/ive/sample_thresh
sample/ive/sample_thresh_S16
sample/ive/sample_thresh_U16
sample/ive/sample_xor
sample/mipi_tx/lt9611/lt9611
sample/osdc/sample_osdc
sample/scene_auto/sample_scene_auto
sample/sensor_test/sensor_test
sample/tp2863_tp2803/sample_test_tp2863_tp2803
self_test/cvi_test/cvi_test
self_test/cvi_test/res
......@@ -82,6 +48,9 @@ self_test/rgn_ut/rgn_ut
self_test/dwa_ut/dwa_ut
self_test/vb_ut/vb_ut
self_test/sys_ut/sys_ut
self_test/vc_test/cvi_h264_enc_test
self_test/vc_test/cvi_h265_enc_test
self_test/vc_test/cvi_jpg_codec
self_test/fast_image_ut/fast_image_ut
self_test/audio/aud_auto_test_sample/cvi_auto_play
self_test/audio/aud_auto_test_sample/cvi_auto_record
......@@ -92,8 +61,6 @@ self_test/audio/audio_pcm/sample_audio_internal
self_test/audio/audio_resample/sample_audio_resample
self_test/audio/audio_transcode/sample_audio_transcode
modules/venc/vc/jpeg/driver/bm_jpg_test
modules/venc/vc/jpeg/driver/bmjpuapi/bmjpegdec
modules/venc/vc/jpeg/driver/bmjpuapi/bmjpegenc
......@@ -108,4 +75,4 @@ modules/venc/vc/jpeg/driver/include/version.h
.vscode/settings.json
modules/isp
ko
......@@ -54,6 +54,7 @@ sensor-$(CONFIG_SENSOR_TECHPOINT_TP2825) += techpoint_tp2825
else ifeq ($(CHIP_ARCH), $(filter $(CHIP_ARCH), CV180X CV181X CV182X))
sensor-$(CONFIG_SENSOR_BRIGATES_BG0808) += brigates_bg0808
sensor-$(CONFIG_SENSOR_GCORE_GC02M1) += gcore_gc02m1
sensor-$(CONFIG_SENSOR_GCORE_GC0312) += gcore_gc0312
sensor-$(CONFIG_SENSOR_GCORE_GC0329) += gcore_gc0329
sensor-$(CONFIG_SENSOR_GCORE_GC1054) += gcore_gc1054
sensor-$(CONFIG_SENSOR_GCORE_GC2053) += gcore_gc2053
......@@ -89,14 +90,19 @@ sensor-$(CONFIG_SENSOR_SMS_SC531AI_2L) += sms_sc531ai_2L
sensor-$(CONFIG_SENSOR_SMS_SC3332) += sms_sc3332
sensor-$(CONFIG_SENSOR_SMS_SC3335) += sms_sc3335
sensor-$(CONFIG_SENSOR_SMS_SC3336) += sms_sc3336
sensor-$(CONFIG_SENSOR_SMS_SC2331_1L) += sms_sc2331_1L
sensor-$(CONFIG_SENSOR_SMS_SC2335) += sms_sc2335
sensor-$(CONFIG_SENSOR_SMS_SC2336) += sms_sc2336
sensor-$(CONFIG_SENSOR_SMS_SC2336P) += sms_sc2336p
sensor-$(CONFIG_SENSOR_SMS_SC4336) += sms_sc4336
sensor-$(CONFIG_SENSOR_SMS_SC4336P) += sms_sc4336p
sensor-$(CONFIG_SENSOR_SMS_SC5336_2L) += sms_sc5336_2L
sensor-$(CONFIG_SENSOR_SOI_F23) += soi_f23
sensor-$(CONFIG_SENSOR_SOI_F35) += soi_f35
sensor-$(CONFIG_SENSOR_SOI_F37P) += soi_f37p
sensor-$(CONFIG_SENSOR_SOI_K06) += soi_k06
sensor-$(CONFIG_SENSOR_SOI_Q03) += soi_q03
sensor-$(CONFIG_SENSOR_SOI_Q03P) += soi_q03p
sensor-$(CONFIG_SENSOR_SONY_IMX307) += sony_imx307
sensor-$(CONFIG_SENSOR_SONY_IMX307_SLAVE) += sony_imx307_slave
sensor-$(CONFIG_SENSOR_SONY_IMX307_2L) += sony_imx307_2L
......@@ -108,6 +114,7 @@ sensor-$(CONFIG_SENSOR_SONY_IMX327_SUBLVDS) += sony_imx327_sublvds
sensor-$(CONFIG_SENSOR_SONY_IMX335) += sony_imx335
sensor-$(CONFIG_SENSOR_TECHPOINT_TP2825) += techpoint_tp2825
sensor-$(CONFIG_SENSOR_TECHPOINT_TP2863) += techpoint_tp2863
sensor-$(CONFIG_SENSOR_LONTIUM_LT6911) += lontium_lt6911
else
$(error not supported chip arch cv180x/cv181x/cv182x/cv183x)
endif
......@@ -28,6 +28,8 @@ brigates_bg0808:
gcore_gc02m1:
$(call MAKE_SENSOR, ${@})
gcore_gc0312:
$(call MAKE_SENSOR, ${@})
gcore_gc0329:
$(call MAKE_SENSOR, ${@})
......@@ -134,15 +136,27 @@ sms_sc3335:
sms_sc3336:
$(call MAKE_SENSOR, ${@})
sms_sc2331_1L:
$(call MAKE_SENSOR, ${@})
sms_sc2335:
$(call MAKE_SENSOR, ${@})
sms_sc2336:
$(call MAKE_SENSOR, ${@})
sms_sc2336p:
$(call MAKE_SENSOR, ${@})
sms_sc4336:
$(call MAKE_SENSOR, ${@})
sms_sc4336p:
$(call MAKE_SENSOR, ${@})
sms_sc5336_2L:
$(call MAKE_SENSOR, ${@})
soi_f23:
$(call MAKE_SENSOR, ${@})
......@@ -155,6 +169,9 @@ soi_f37p:
soi_q03:
$(call MAKE_SENSOR, ${@})
soi_q03p:
$(call MAKE_SENSOR, ${@})
soi_k06:
$(call MAKE_SENSOR, ${@})
......@@ -191,6 +208,9 @@ techpoint_tp2825:
techpoint_tp2863:
$(call MAKE_SENSOR, ${@})
lontium_lt6911:
$(call MAKE_SENSOR, ${@})
all_sensor:
@$(MAKE) -f Makefile_full || exit 1;
......
SHELL = /bin/bash
ifeq ($(PARAM_FILE), )
PARAM_FILE=../../../../../../$(shell echo $(MW_VER))/Makefile.param
include $(PARAM_FILE)
endif
SDIR = $(PWD)
SRCS = $(wildcard $(SDIR)/*.c)
INCS = -I$(MW_INC) -I$(ISP_INC) -I$(KERNEL_INC) -I./include
OBJS = $(SRCS:.c=.o)
DEPS = $(SRCS:.c=.d)
TARGET_A = $(MW_LIB)/libsns_gc0312.a
TARGET_SO = $(MW_LIB)/libsns_gc0312.so
EXTRA_CFLAGS = $(INCS)
EXTRA_LDFLAGS =
.PHONY : clean all
all : $(TARGET_A) $(TARGET_SO)
$(SDIR)/%.o: $(SDIR)/%.c
@$(CC) $(DEPFLAGS) $(CFLAGS) $(EXTRA_CFLAGS) -c $< -o $@
@echo [$(notdir $(CC))] $(notdir $@)
$(TARGET_A): $(OBJS)
@$(AR) $(ARFLAGS) $@ $(OBJS)
@echo -e $(YELLOW)[LINK]$(END)[$(notdir $(AR))] $(notdir $(TARGET_A))
$(TARGET_SO): $(OBJS)
@$(LD) $(LDFLAGS) $(EXTRA_LDFLAGS) -o $@ --start-group $(OBJS) --end-group
@echo -e $(GREEN)[LINK]$(END)[$(notdir $(LD))] $(notdir $(TARGET_SO))
clean:
@rm -f $(OBJS) $(DEPS) $(TARGET_A) $(TARGET_SO)
-include $(DEPS)
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <syslog.h>
#include <errno.h>
#ifdef ARCH_CV182X
#include "cvi_type.h"
#include "cvi_comm_video.h"
#include <linux/cvi_vip_snsr.h>
#else
#include <linux/cvi_type.h>
#include <linux/cvi_comm_video.h>
#include <linux/vi_snsr.h>
#endif
#include "cvi_debug.h"
#include "cvi_comm_sns.h"
#include "cvi_sns_ctrl.h"
#include "cvi_ae_comm.h"
#include "cvi_awb_comm.h"
#include "cvi_ae.h"
#include "cvi_awb.h"
#include "cvi_isp.h"
#include "gc0312_cmos_ex.h"
#include "gc0312_cmos_param.h"
#define GC0312_ID 0xb310
#define GC0312_I2C_ADDR_1 0x21
#define GC0312_I2C_ADDR_IS_VALID(addr) ((addr) == GC0312_I2C_ADDR_1)
/****************************************************************************
* global variables *
****************************************************************************/
ISP_SNS_STATE_S *g_pastGc0312[VI_MAX_PIPE_NUM] = {CVI_NULL};
#define GC0312_SENSOR_GET_CTX(dev, pstCtx) (pstCtx = g_pastGc0312[dev])
#define GC0312_SENSOR_SET_CTX(dev, pstCtx) (g_pastGc0312[dev] = pstCtx)
#define GC0312_SENSOR_RESET_CTX(dev) (g_pastGc0312[dev] = CVI_NULL)
ISP_SNS_COMMBUS_U g_aunGc0312_BusInfo[VI_MAX_PIPE_NUM] = {
[0] = { .s8I2cDev = 0},
[1 ... VI_MAX_PIPE_NUM - 1] = { .s8I2cDev = -1}
};
/****************************************************************************
* local variables and functions *
****************************************************************************/
#define GC0312_RES_IS_480P(w, h) ((w) == 640 && (h) == 480)
static CVI_S32 cmos_get_wdr_size(VI_PIPE ViPipe, ISP_SNS_ISP_INFO_S *pstIspCfg)
{
const GC0312_MODE_S *pstMode = CVI_NULL;
ISP_SNS_STATE_S *pstSnsState = CVI_NULL;
GC0312_SENSOR_GET_CTX(ViPipe, pstSnsState);
CMOS_CHECK_POINTER(pstSnsState);
pstMode = &g_astGc0312_mode;
pstIspCfg->frm_num = 1;
memcpy(&pstIspCfg->img_size[0], &pstMode->stImg, sizeof(ISP_WDR_SIZE_S));
return CVI_SUCCESS;
}
static CVI_S32 cmos_get_sns_regs_info(VI_PIPE ViPipe, ISP_SNS_SYNC_INFO_S *pstSnsSyncInfo)
{
ISP_SNS_STATE_S *pstSnsState = CVI_NULL;
ISP_SNS_SYNC_INFO_S *pstCfg0 = CVI_NULL;
CMOS_CHECK_POINTER(pstSnsSyncInfo);
GC0312_SENSOR_GET_CTX(ViPipe, pstSnsState);
CMOS_CHECK_POINTER(pstSnsState);
pstCfg0 = &pstSnsState->astSyncInfo[0];
cmos_get_wdr_size(ViPipe, &pstCfg0->ispCfg);
memcpy(pstSnsSyncInfo, &pstSnsState->astSyncInfo[0], sizeof(ISP_SNS_SYNC_INFO_S));
return CVI_SUCCESS;
}
static CVI_S32 cmos_set_image_mode(VI_PIPE ViPipe, ISP_CMOS_SENSOR_IMAGE_MODE_S *pstSensorImageMode)
{
CVI_U8 u8SensorImageMode = 0;
ISP_SNS_STATE_S *pstSnsState = CVI_NULL;
CMOS_CHECK_POINTER(pstSensorImageMode);
GC0312_SENSOR_GET_CTX(ViPipe, pstSnsState);
CMOS_CHECK_POINTER(pstSnsState);
u8SensorImageMode = pstSnsState->u8ImgMode;
pstSnsState->bSyncInit = CVI_FALSE;
if (pstSensorImageMode->f32Fps <= 20) {
if (pstSnsState->enWDRMode == WDR_MODE_NONE) {
if (GC0312_RES_IS_480P(pstSensorImageMode->u16Width, pstSensorImageMode->u16Height))
u8SensorImageMode = GC0312_MODE_640X480P20;
else {
CVI_TRACE_SNS(CVI_DBG_ERR, "Not support! Width:%d, Height:%d, Fps:%f, WDRMode:%d\n",
pstSensorImageMode->u16Width,
pstSensorImageMode->u16Height,
pstSensorImageMode->f32Fps,
pstSnsState->enWDRMode);
return CVI_FAILURE;
}
} else {
CVI_TRACE_SNS(CVI_DBG_ERR, "Not support! Width:%d, Height:%d, Fps:%f, WDRMode:%d\n",
pstSensorImageMode->u16Width,
pstSensorImageMode->u16Height,
pstSensorImageMode->f32Fps,
pstSnsState->enWDRMode);
return CVI_FAILURE;
}
} else {
CVI_TRACE_SNS(CVI_DBG_ERR, "Not support this Fps:%f\n", pstSensorImageMode->f32Fps);
return CVI_FAILURE;
}
if ((pstSnsState->bInit == CVI_TRUE) && (u8SensorImageMode == pstSnsState->u8ImgMode)) {
/* Don't need to switch SensorImageMode */
return CVI_FAILURE;
}
pstSnsState->u8ImgMode = u8SensorImageMode;
return CVI_SUCCESS;
}
static CVI_VOID sensor_global_init(VI_PIPE ViPipe)
{
ISP_SNS_STATE_S *pstSnsState = CVI_NULL;
GC0312_SENSOR_GET_CTX(ViPipe, pstSnsState);
CMOS_CHECK_POINTER_VOID(pstSnsState);
pstSnsState->bInit = CVI_FALSE;
pstSnsState->bSyncInit = CVI_FALSE;
pstSnsState->u8ImgMode = GC0312_MODE_640X480P20;
pstSnsState->enWDRMode = WDR_MODE_NONE;
}
static CVI_S32 sensor_rx_attr(VI_PIPE ViPipe, SNS_COMBO_DEV_ATTR_S *pstRxAttr)
{
ISP_SNS_STATE_S *pstSnsState = CVI_NULL;
GC0312_SENSOR_GET_CTX(ViPipe, pstSnsState);
CMOS_CHECK_POINTER(pstSnsState);
CMOS_CHECK_POINTER(pstRxAttr);
memcpy(pstRxAttr, &gc0312_rx_attr, sizeof(*pstRxAttr));
pstRxAttr->img_size.width = g_astGc0312_mode.stImg.stSnsSize.u32Width;
pstRxAttr->img_size.height = g_astGc0312_mode.stImg.stSnsSize.u32Height;
return CVI_SUCCESS;
}
static CVI_S32 sensor_patch_rx_attr(RX_INIT_ATTR_S *pstRxInitAttr)
{
SNS_COMBO_DEV_ATTR_S *pstRxAttr = &gc0312_rx_attr;
CMOS_CHECK_POINTER(pstRxInitAttr);
if (pstRxInitAttr->stMclkAttr.bMclkEn)
pstRxAttr->mclk.cam = pstRxInitAttr->stMclkAttr.u8Mclk;
if (pstRxInitAttr->MipiDev >= VI_MAX_DEV_NUM)
return CVI_SUCCESS;
pstRxAttr->devno = pstRxInitAttr->MipiDev;
return CVI_SUCCESS;
}
static CVI_S32 cmos_init_sensor_exp_function(ISP_SENSOR_EXP_FUNC_S *pstSensorExpFunc)
{
CMOS_CHECK_POINTER(pstSensorExpFunc);
memset(pstSensorExpFunc, 0, sizeof(ISP_SENSOR_EXP_FUNC_S));
pstSensorExpFunc->pfn_cmos_sensor_init = gc0312_init;
pstSensorExpFunc->pfn_cmos_sensor_exit = gc0312_exit;
pstSensorExpFunc->pfn_cmos_sensor_global_init = sensor_global_init;
pstSensorExpFunc->pfn_cmos_set_image_mode = cmos_set_image_mode;
pstSensorExpFunc->pfn_cmos_get_sns_reg_info = cmos_get_sns_regs_info;
return CVI_SUCCESS;
}
/****************************************************************************
* callback structure *
****************************************************************************/
static CVI_VOID sensor_patch_i2c_addr(CVI_S32 s32I2cAddr)
{
if (GC0312_I2C_ADDR_IS_VALID(s32I2cAddr))
gc0312_i2c_addr = s32I2cAddr;
}
static CVI_S32 gc0312_set_bus_info(VI_PIPE ViPipe, ISP_SNS_COMMBUS_U unSNSBusInfo)
{
g_aunGc0312_BusInfo[ViPipe].s8I2cDev = unSNSBusInfo.s8I2cDev;
return CVI_SUCCESS;
}
static CVI_S32 sensor_ctx_init(VI_PIPE ViPipe)
{
ISP_SNS_STATE_S *pastSnsStateCtx = CVI_NULL;
GC0312_SENSOR_GET_CTX(ViPipe, pastSnsStateCtx);
if (pastSnsStateCtx == CVI_NULL) {
pastSnsStateCtx = (ISP_SNS_STATE_S *)malloc(sizeof(ISP_SNS_STATE_S));
if (pastSnsStateCtx == CVI_NULL) {
CVI_TRACE_SNS(CVI_DBG_ERR, "Isp[%d] SnsCtx malloc memory failed!\n", ViPipe);
return -ENOMEM;
}
}
memset(pastSnsStateCtx, 0, sizeof(ISP_SNS_STATE_S));
GC0312_SENSOR_SET_CTX(ViPipe, pastSnsStateCtx);
return CVI_SUCCESS;
}
static CVI_VOID sensor_ctx_exit(VI_PIPE ViPipe)
{
ISP_SNS_STATE_S *pastSnsStateCtx = CVI_NULL;
GC0312_SENSOR_GET_CTX(ViPipe, pastSnsStateCtx);
SENSOR_FREE(pastSnsStateCtx);
GC0312_SENSOR_RESET_CTX(ViPipe);
}
static CVI_S32 sensor_register_callback(VI_PIPE ViPipe, ALG_LIB_S *pstAeLib, ALG_LIB_S *pstAwbLib)
{
CVI_S32 s32Ret;
ISP_SENSOR_REGISTER_S stIspRegister;
ISP_SNS_ATTR_INFO_S stSnsAttrInfo;
(void) pstAeLib;
(void) pstAwbLib;
s32Ret = sensor_ctx_init(ViPipe);
if (s32Ret != CVI_SUCCESS)
return CVI_FAILURE;
stSnsAttrInfo.eSensorId = GC0312_ID;
s32Ret = cmos_init_sensor_exp_function(&stIspRegister.stSnsExp);
s32Ret |= CVI_ISP_SensorRegCallBack(ViPipe, &stSnsAttrInfo, &stIspRegister);
if (s32Ret != CVI_SUCCESS) {
CVI_TRACE_SNS(CVI_DBG_ERR, "sensor register callback function failed!\n");
return s32Ret;
}
return CVI_SUCCESS;
}
static CVI_S32 sensor_unregister_callback(VI_PIPE ViPipe, ALG_LIB_S *pstAeLib, ALG_LIB_S *pstAwbLib)
{
CVI_S32 s32Ret;
(void) pstAeLib;
(void) pstAwbLib;
s32Ret = CVI_ISP_SensorUnRegCallBack(ViPipe, GC0312_ID);
if (s32Ret != CVI_SUCCESS) {
CVI_TRACE_SNS(CVI_DBG_ERR, "sensor unregister callback function failed!\n");
return s32Ret;
}
sensor_ctx_exit(ViPipe);
return CVI_SUCCESS;
}
static CVI_S32 sensor_probe(VI_PIPE ViPipe)
{
return gc0312_probe(ViPipe);
}
ISP_SNS_OBJ_S stSnsGc0312_Obj = {
.pfnRegisterCallback = sensor_register_callback,
.pfnUnRegisterCallback = sensor_unregister_callback,
.pfnStandby = CVI_NULL,
.pfnRestart = CVI_NULL,
.pfnWriteReg = gc0312_write_register,
.pfnReadReg = gc0312_read_register,
.pfnSetBusInfo = gc0312_set_bus_info,
.pfnSetInit = CVI_NULL,
.pfnMirrorFlip = CVI_NULL,
.pfnPatchRxAttr = sensor_patch_rx_attr,
.pfnPatchI2cAddr = sensor_patch_i2c_addr,
.pfnGetRxAttr = sensor_rx_attr,
.pfnExpSensorCb = cmos_init_sensor_exp_function,
.pfnExpAeCb = CVI_NULL,
.pfnSnsProbe = sensor_probe,
};
#ifndef __GC0312_CMOS_EX_H_
#define __GC0312_CMOS_EX_H_
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif
#endif
#ifdef ARCH_CV182X
#include <linux/cvi_vip_cif.h>
#include <linux/cvi_vip_snsr.h>
#include "cvi_type.h"
#else
#include <linux/cif_uapi.h>
#include <linux/vi_snsr.h>
#include <linux/cvi_type.h>
#endif
#include "cvi_sns_ctrl.h"
typedef enum _GC0312_MODE_E {
GC0312_MODE_640X480P20 = 0,
GC0312_MODE_NUM
} GC0312_SLAVE_MODE_E;
typedef struct _GC0312_MODE_S {
ISP_WDR_SIZE_S stImg;
CVI_FLOAT f32MaxFps;
CVI_FLOAT f32MinFps;
CVI_U32 u32HtsDef;
CVI_U32 u32VtsDef;
SNS_ATTR_S stExp;
SNS_ATTR_LARGE_S stAgain;
SNS_ATTR_LARGE_S stDgain;
char name[64];
} GC0312_MODE_S;
/****************************************************************************
* external variables and functions *
****************************************************************************/
extern ISP_SNS_STATE_S *g_pastGc0312[VI_MAX_PIPE_NUM];
extern ISP_SNS_COMMBUS_U g_aunGc0312_BusInfo[];
extern CVI_U8 gc0312_i2c_addr;
extern const CVI_U32 gc0312_addr_byte;
extern const CVI_U32 gc0312_data_byte;
extern void gc0312_init(VI_PIPE ViPipe);
extern void gc0312_exit(VI_PIPE ViPipe);
extern void gc0312_standby(VI_PIPE ViPipe);
extern void gc0312_restart(VI_PIPE ViPipe);
extern int gc0312_write_register(VI_PIPE ViPipe, int addr, int data);
extern int gc0312_read_register(VI_PIPE ViPipe, int addr);
extern void gc0312_mirror_flip(VI_PIPE ViPipe, ISP_SNS_MIRRORFLIP_TYPE_E eSnsMirrorFlip);
extern int gc0312_probe(VI_PIPE ViPipe);
#ifdef __cplusplus
#if __cplusplus
}
#endif
#endif /* End of #ifdef __cplusplus */
#endif /* __GC0312_CMOS_EX_H_ */
#ifndef __GC0312_CMOS_PARAM_H_
#define __GC0312_CMOS_PARAM_H_
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif
#endif
#ifdef ARCH_CV182X
#include <linux/cvi_vip_cif.h>
#include <linux/cvi_vip_snsr.h>
#include "cvi_type.h"
#else
#include <linux/cif_uapi.h>
#include <linux/vi_snsr.h>
#include <linux/cvi_type.h>
#endif
#include "cvi_sns_ctrl.h"
#include "gc0312_cmos_ex.h"
static const GC0312_MODE_S g_astGc0312_mode = {
.name = "640X480P20",
.stImg = {
.stSnsSize = {
.u32Width = 640,
.u32Height = 480,
},
.stWndRect = {
.s32X = 0,
.s32Y = 0,
.u32Width = 640,
.u32Height = 480,
},
.stMaxSize = {
.u32Width = 640,
.u32Height = 480,
},
},
};
struct combo_dev_attr_s gc0312_rx_attr = {
.input_mode = INPUT_MODE_BT601,
.mac_clk = RX_MAC_CLK_200M,
.ttl_attr = {
.vi = TTL_VI_SRC_VI0,
.ttl_fmt = TTL_VSDE_11B,
.raw_data_type = RAW_DATA_8BIT,
.func = {
11, -1, -1, 12,
1, 3, 4, 2,
0, 5, 6, 7,
-1, -1, -1, -1,
-1, -1, -1, -1,
},
},
.mclk = {
.cam = 1,
.freq = CAMPLL_FREQ_24M,
},
.devno = 0,
};
#ifdef __cplusplus
#if __cplusplus
}
#endif
#endif /* End of #ifdef __cplusplus */
#endif /* __GC0312_CMOS_PARAM_H_ */
SHELL = /bin/bash
ifeq ($(PARAM_FILE), )
PARAM_FILE=../../../../../../$(shell echo $(MW_VER))/Makefile.param
include $(PARAM_FILE)
endif
SDIR = $(PWD)
SRCS = $(wildcard $(SDIR)/*.c)
INCS = -I$(MW_INC) -I$(ISP_INC) -I$(KERNEL_INC) -I./include
OBJS = $(SRCS:.c=.o)
DEPS = $(SRCS:.c=.d)
TARGET_A = $(MW_LIB)/libsns_lt6911.a
TARGET_SO = $(MW_LIB)/libsns_lt6911.so
EXTRA_CFLAGS = $(INCS)
EXTRA_LDFLAGS =
.PHONY : clean all
all : $(TARGET_A) $(TARGET_SO)
$(SDIR)/%.o: $(SDIR)/%.c
@$(CC) $(DEPFLAGS) $(CFLAGS) $(EXTRA_CFLAGS) -c $< -o $@
@echo [$(notdir $(CC))] $(notdir $@)
$(TARGET_A): $(OBJS)
@$(AR) $(ARFLAGS) $@ $(OBJS)
@echo -e $(YELLOW)[LINK]$(END)[$(notdir $(AR))] $(notdir $(TARGET_A))
$(TARGET_SO): $(OBJS)
@$(LD) $(LDFLAGS) $(EXTRA_LDFLAGS) -o $@ --start-group $(OBJS) --end-group
@echo -e $(GREEN)[LINK]$(END)[$(notdir $(LD))] $(notdir $(TARGET_SO))
clean:
@rm -f $(OBJS) $(DEPS) $(TARGET_A) $(TARGET_SO)
-include $(DEPS)
#ifndef __LT6911_CMOS_EX_H_
#define __LT6911_CMOS_EX_H_
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif
#endif
#ifdef ARCH_CV182X
#include <linux/cvi_vip_cif.h>
#include <linux/cvi_vip_snsr.h>
#include "cvi_type.h"
#else
#include <linux/cif_uapi.h>
#include <linux/vi_snsr.h>
#include <linux/cvi_type.h>
#endif
#include "cvi_sns_ctrl.h"
#ifndef UNUSED
#define UNUSED(x) ((void)(x))
#endif
enum lt6911_linear_regs_e {
LINEAR_REGS_NUM
};
typedef enum _LT6911_MODE_E {
LT6911_MODE_NONE,
LT6911_MODE_NORMAL,
LT6911_MODE_NUM
} LT6911_MODE_E;
typedef struct _LT6911_MODE_S {
ISP_WDR_SIZE_S astImg[2];
char name[64];
} LT6911_MODE_S;
extern CVI_U8 lt6911_i2c_addr;
extern const CVI_U32 lt6911_addr_byte;
extern const CVI_U32 lt6911_data_byte;
extern void lt6911_init(VI_PIPE ViPipe);
extern void lt6911_exit(VI_PIPE ViPipe);
extern void lt6911_standby(VI_PIPE ViPipe);
extern void lt6911_restart(VI_PIPE ViPipe);
extern int lt6911_write(VI_PIPE ViPipe, int addr, int data);
extern int lt6911_read(VI_PIPE ViPipe, int addr);
extern void lt6911_mirror_flip(VI_PIPE ViPipe, ISP_SNS_MIRRORFLIP_TYPE_E eSnsMirrorFlip);
extern int lt6911_probe(VI_PIPE ViPipe);
#ifdef __cplusplus
#if __cplusplus
}
#endif
#endif /* End of #ifdef __cplusplus */
#endif /* __LT6911_CMOS_EX_H_ */
\ No newline at end of file
#ifndef __LT6911_CMOS_PARAM_H_
#define __LT6911_CMOS_PARAM_H_
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif
#endif
#ifdef ARCH_CV182X
#include <linux/cvi_vip_cif.h>
#include <linux/cvi_vip_snsr.h>
#include "cvi_type.h"
#else
#include <linux/cif_uapi.h>
#include <linux/vi_snsr.h>
#include <linux/cvi_type.h>
#endif
#include "cvi_sns_ctrl.h"
#include "lt6911_cmos_ex.h"
// not real time resolution
#define WIDTH 3840//3840 1920
#define HEIGHT 2160//2160 1080
static LT6911_MODE_S g_astLt6911_mode[LT6911_MODE_NUM] = {
[LT6911_MODE_NORMAL] = {
.name = "lt6911",
.astImg[0] = {
.stSnsSize = {
.u32Width = WIDTH,
.u32Height = HEIGHT,
},
.stWndRect = {
.s32X = 0,
.s32Y = 0,
.u32Width = WIDTH,
.u32Height = HEIGHT,
},
.stMaxSize = {
.u32Width = WIDTH,
.u32Height = HEIGHT,
},
},
},
};
struct combo_dev_attr_s lt6911_rx_attr = {
.input_mode = INPUT_MODE_MIPI,
.mac_clk = RX_MAC_CLK_600M,
.mipi_attr = {
.raw_data_type = YUV422_8BIT,
.lane_id = {2, 0, 1, 3, 4}, //3, 0, 1, 2, 4 ; 1, 4, 3, 2, 0 2, 0, 1, 3, 4 3, 1, 2, 4, 0
.pn_swap = {1, 1, 1, 1, 1},
.wdr_mode = CVI_MIPI_WDR_MODE_NONE,
.dphy = {
.enable = 1,
.hs_settle = 8,
},
},
.mclk = {
.cam = 0,
.freq = CAMPLL_FREQ_NONE,
},
.devno = 1,
};
#ifdef __cplusplus
#if __cplusplus
}
#endif
#endif /* End of #ifdef __cplusplus */
#endif /* __LT6911_CMOS_PARAM_H_ */
\ No newline at end of file
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <syslog.h>
#include <fcntl.h>
#include <unistd.h>
#include <linux/i2c.h>
#include <linux/i2c-dev.h>
#ifdef ARCH_CV182X
#include <linux/cvi_vip_snsr.h>
#include "cvi_comm_video.h"
#else
#include <linux/vi_snsr.h>
#include <linux/cvi_comm_video.h>
#endif
#include "cvi_sns_ctrl.h"
#include "lt6911_cmos_ex.h"
#define LT6911_I2C_DEV 3
#define LT6911_I2C_BANK_ADDR 0xff
CVI_U8 lt6911_i2c_addr = 0x2b;
const CVI_U32 lt6911_addr_byte = 1;
const CVI_U32 lt6911_data_byte = 1;
static int g_fd[VI_MAX_PIPE_NUM] = {[0 ... (VI_MAX_PIPE_NUM - 1)] = -1};
int lt6911_i2c_init(VI_PIPE ViPipe)
{
char acDevFile[16] = {0};
if (g_fd[ViPipe] >= 0)
return CVI_SUCCESS;
int ret;
snprintf(acDevFile, sizeof(acDevFile), "/dev/i2c-%u", LT6911_I2C_DEV);
g_fd[ViPipe] = open(acDevFile, O_RDWR, 0600);
if (g_fd[ViPipe] < 0) {
CVI_TRACE_SNS(CVI_DBG_ERR, "Open /dev/i2c-%u error!\n", LT6911_I2C_DEV);
return CVI_FAILURE;
}
ret = ioctl(g_fd[ViPipe], I2C_SLAVE_FORCE, lt6911_i2c_addr);
if (ret < 0) {
CVI_TRACE_SNS(CVI_DBG_ERR, "I2C_SLAVE_FORCE error!\n");
close(g_fd[ViPipe]);
g_fd[ViPipe] = -1;
return ret;
}
return CVI_SUCCESS;
}
int lt6911_i2c_exit(VI_PIPE ViPipe)
{
if (g_fd[ViPipe] >= 0) {
close(g_fd[ViPipe]);
g_fd[ViPipe] = -1;
return CVI_SUCCESS;
}
return CVI_FAILURE;
}
int lt6911_read_register(VI_PIPE ViPipe, int addr)
{
int ret, data;
char buf[8];
int idx = 0;
if (g_fd[ViPipe] < 0)
return CVI_FAILURE;
if (lt6911_addr_byte == 2)
buf[idx++] = (addr >> 8) & 0xff;
// add address byte 0
buf[idx++] = addr & 0xff;
ret = write(g_fd[ViPipe], buf, lt6911_addr_byte);
if (ret < 0) {
CVI_TRACE_SNS(CVI_DBG_ERR, "I2C_WRITE error!\n");
return ret;
}
buf[0] = 0;
buf[1] = 0;
ret = read(g_fd[ViPipe], buf, lt6911_data_byte);
if (ret < 0) {
CVI_TRACE_SNS(CVI_DBG_ERR, "I2C_READ error!\n");
return ret;
}
// pack read back data
data = 0;
if (lt6911_data_byte == 2) {
data = buf[0] << 8;
data += buf[1];
} else {
data = buf[0];
}
syslog(LOG_DEBUG, "vipipe:%d i2c r 0x%x = 0x%x\n", ViPipe, addr, data);
return data;
}
int lt6911_write_register(VI_PIPE ViPipe, int addr, int data)
{
int idx = 0;
int ret;
char buf[8];
if (g_fd[ViPipe] < 0)
return CVI_SUCCESS;
if (lt6911_addr_byte == 2) {
buf[idx] = (addr >> 8) & 0xff;
idx++;
}
buf[idx] = addr & 0xff;
idx++;
if (lt6911_data_byte == 2) {
buf[idx] = (data >> 8) & 0xff;
idx++;
}
buf[idx] = data & 0xff;
idx++;
ret = write(g_fd[ViPipe], buf, lt6911_addr_byte + lt6911_data_byte);
if (ret < 0) {
CVI_TRACE_SNS(CVI_DBG_ERR, "I2C_WRITE error!\n");
return CVI_FAILURE;
}
// ret = read(g_fd[ViPipe], buf, lt6911_addr_byte + lt6911_data_byte);
syslog(LOG_DEBUG, "ViPipe:%d i2c w 0x%x 0x%x\n", ViPipe, addr, data);
return CVI_SUCCESS;
}
static int lt6911_i2c_read(VI_PIPE ViPipe, int RegAddr)
{
uint8_t bank = RegAddr >> 8;
uint8_t addr = RegAddr & 0xff;
lt6911_write_register(ViPipe, LT6911_I2C_BANK_ADDR, bank);
return lt6911_read_register(ViPipe, addr);
}
static int lt6911_i2c_write(VI_PIPE ViPipe, int RegAddr, int data)
{
uint8_t bank = RegAddr >> 8;
uint8_t addr = RegAddr & 0xff;
lt6911_write_register(ViPipe, LT6911_I2C_BANK_ADDR, bank);
return lt6911_write_register(ViPipe, addr, data);
}
int lt6911_read(VI_PIPE ViPipe, int addr)
{
int data = 0;
lt6911_i2c_write(ViPipe, 0x80ee, 0x01);
data = lt6911_i2c_read(ViPipe, addr);
lt6911_i2c_write(ViPipe, 0x80ee, 0x00);
return data;
}
int lt6911_write(VI_PIPE ViPipe, int addr, int data)
{
lt6911_i2c_write(ViPipe, 0x80ee, 0x01);
lt6911_i2c_write(ViPipe, addr, data);
lt6911_i2c_write(ViPipe, 0x80ee, 0x00);
return CVI_SUCCESS;
}
#define LT6911_CHIP_ID_ADDR_H 0xa000
#define LT6911_CHIP_ID_ADDR_L 0xa001
#define LT6911_CHIP_ID 0x1605
int lt6911_probe(VI_PIPE ViPipe)
{
int nVal;
int nVal2;
usleep(50);
if (lt6911_i2c_init(ViPipe) != CVI_SUCCESS)
return CVI_FAILURE;
nVal = lt6911_read(ViPipe, LT6911_CHIP_ID_ADDR_H);
nVal2 = lt6911_read(ViPipe, LT6911_CHIP_ID_ADDR_L);
if (nVal < 0 || nVal2 < 0) {
CVI_TRACE_SNS(CVI_DBG_ERR, "read sensor id error.\n");
return nVal;
}
printf("data:%02x %02x\n", nVal, nVal2);
if ((((nVal & 0xFF) << 8) | (nVal2 & 0xFF)) != LT6911_CHIP_ID) {
CVI_TRACE_SNS(CVI_DBG_ERR, "Sensor ID Mismatch! Use the wrong sensor??\n");
return CVI_FAILURE;
}
return CVI_SUCCESS;
}
void lt6911_init(VI_PIPE ViPipe)
{
lt6911_i2c_init(ViPipe);
}
void lt6911_exit(VI_PIPE ViPipe)
{
lt6911_i2c_exit(ViPipe);
}
\ No newline at end of file
SHELL = /bin/bash
ifeq ($(PARAM_FILE), )
PARAM_FILE=../../../../../../$(shell echo $(MW_VER))/Makefile.param
include $(PARAM_FILE)
endif
SDIR = $(PWD)
SRCS = $(wildcard $(SDIR)/*.c)
INCS = -I$(MW_INC) -I$(ISP_INC) -I$(KERNEL_INC) -I./include
OBJS = $(SRCS:.c=.o)
DEPS = $(SRCS:.c=.d)
TARGET_A = $(MW_LIB)/libsns_sc2331_1L.a
TARGET_SO = $(MW_LIB)/libsns_sc2331_1L.so
EXTRA_CFLAGS = $(INCS)
EXTRA_LDFLAGS =
.PHONY : clean all
all : $(TARGET_A) $(TARGET_SO)
$(SDIR)/%.o: $(SDIR)/%.c
@$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c $< -o $@
@echo [$(notdir $(CC))] $(notdir $@)
$(TARGET_A): $(OBJS)
@$(AR) $(ARFLAGS) $@ $(OBJS)
@echo -e $(YELLOW)[LINK]$(END)[$(notdir $(AR))] $(notdir $(TARGET_A))
$(TARGET_SO): $(OBJS)
@$(LD) $(LDFLAGS) $(EXTRA_LDFLAGS) -o $@ --start-group $(OBJS) --end-group
@echo -e $(GREEN)[LINK]$(END)[$(notdir $(LD))] $(notdir $(TARGET_SO))
clean:
@rm -f $(OBJS) $(DEPS) $(TARGET_A) $(TARGET_SO)
-include $(DEPS)
#ifndef __SC2331_1L_CMOS_EX_H_
#define __SC2331_1L_CMOS_EX_H_
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif
#endif
#ifdef ARCH_CV182X
#include <linux/cvi_vip_cif.h>
#include <linux/cvi_vip_snsr.h>
#include "cvi_type.h"
#else
#include <linux/cif_uapi.h>
#include <linux/vi_snsr.h>
#include <linux/cvi_type.h>
#endif
#include "cvi_sns_ctrl.h"
enum sc2331_1L_linear_regs_e {
LINEAR_EXP_H_ADDR,
LINEAR_EXP_M_ADDR,
LINEAR_EXP_L_ADDR,
LINEAR_AGAIN_H_ADDR,
LINEAR_AGAIN_L_ADDR,
LINEAR_DGAIN_H_ADDR,
LINEAR_DGAIN_L_ADDR,
LINEAR_VMAX_H_ADDR,
LINEAR_VMAX_L_ADDR,
LINEAR_REGS_NUM
};
typedef enum _SC2331_1L_MODE_E {
SC2331_1L_MODE_1920X1080P30 = 0,
SC2331_1L_MODE_LINEAR_NUM,
SC2331_1L_MODE_NUM
} SC2331_1L_MODE_E;
typedef struct _SC2331_1L_MODE_S {
ISP_WDR_SIZE_S astImg[2];
CVI_FLOAT f32MaxFps;
CVI_FLOAT f32MinFps;
CVI_U32 u32HtsDef;
CVI_U32 u32VtsDef;
SNS_ATTR_S stExp[2];
SNS_ATTR_S stAgain[2];
SNS_ATTR_S stDgain[2];
char name[64];
} SC2331_1L_MODE_S;
/****************************************************************************
* external variables and functions *
****************************************************************************/
extern ISP_SNS_STATE_S *g_pastSC2331_1L[VI_MAX_PIPE_NUM];
extern ISP_SNS_COMMBUS_U g_aunSC2331_1L_BusInfo[];
extern CVI_U16 g_au16SC2331_1L_GainMode[];
extern CVI_U16 g_au16SC2331_1L_L2SMode[];
extern const CVI_U8 sc2331_1L_i2c_addr;
extern const CVI_U32 sc2331_1L_addr_byte;
extern const CVI_U32 sc2331_1L_data_byte;
extern void sc2331_1L_mirror_flip(VI_PIPE ViPipe, ISP_SNS_MIRRORFLIP_TYPE_E eSnsMirrorFlip);
extern void sc2331_1L_init(VI_PIPE ViPipe);
extern void sc2331_1L_exit(VI_PIPE ViPipe);
extern void sc2331_1L_standby(VI_PIPE ViPipe);
extern void sc2331_1L_restart(VI_PIPE ViPipe);
extern int sc2331_1L_write_register(VI_PIPE ViPipe, int addr, int data);
extern int sc2331_1L_read_register(VI_PIPE ViPipe, int addr);
extern int sc2331_1L_probe(VI_PIPE ViPipe);
#ifdef __cplusplus
#if __cplusplus
}
#endif
#endif /* End of #ifdef __cplusplus */
#endif /* __SC2331_1L_CMOS_EX_H_ */
#ifndef __SC2331_1L_CMOS_PARAM_H_
#define __SC2331_1L_CMOS_PARAM_H_
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif
#endif
#ifdef ARCH_CV182X
#include <linux/cvi_vip_cif.h>
#include <linux/cvi_vip_snsr.h>
#include "cvi_type.h"
#else
#include <linux/cif_uapi.h>
#include <linux/vi_snsr.h>
#include <linux/cvi_type.h>
#endif
#include "cvi_sns_ctrl.h"
#include "sc2331_1L_cmos_ex.h"
static const SC2331_1L_MODE_S g_astSC2331_1L_mode[SC2331_1L_MODE_NUM] = {
[SC2331_1L_MODE_1920X1080P30] = {
.name = "1080p30",
.astImg[0] = {
.stSnsSize = {
.u32Width = 1920,
.u32Height = 1080,
},
.stWndRect = {
.s32X = 0,
.s32Y = 0,
.u32Width = 1920,
.u32Height = 1080,
},
.stMaxSize = {
.u32Width = 1920,
.u32Height = 1080,
},
},
.f32MaxFps = 30,
.f32MinFps = 0.51, /* 1125 * 30 / 0x7FFF */
.u32HtsDef = 2560,
.u32VtsDef = 1530,
.stExp[0] = {
.u16Min = 2,//3
.u16Max = 1530*2 - 13,
.u16Def = 400,
.u16Step = 1,
},
.stAgain[0] = {
.u16Min = 1024,
.u16Max = 32768,
.u16Def = 1024,
.u16Step = 1,
},
.stDgain[0] = {
.u16Min = 1024,
.u16Max = 4096,
.u16Def = 1024,
.u16Step = 1,
},
},
};
static ISP_CMOS_BLACK_LEVEL_S g_stIspBlcCalibratio = {
.bUpdate = CVI_TRUE,
.blcAttr = {
.Enable = 1,
.enOpType = OP_TYPE_AUTO,
.stManual = {256, 256, 256, 256, 0, 0, 0, 0
#ifdef ARCH_CV182X
, 1092, 1092, 1092, 1092
#endif
},
.stAuto = {
{256, 256, 256, 256, 256, 256, 256, 256, /*8*/256, 256, 256, 256, 256, 256, 256, 256},
{256, 256, 256, 256, 256, 256, 256, 256, /*8*/256, 256, 256, 256, 256, 256, 256, 256},
{256, 256, 256, 256, 256, 256, 256, 256, /*8*/256, 256, 256, 256, 256, 256, 256, 256},
{256, 256, 256, 256, 256, 256, 256, 256, /*8*/256, 256, 256, 256, 256, 256, 256, 256},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
#ifdef ARCH_CV182X
{1092, 1092, 1092, 1092, 1092, 1092, 1092, 1092,
/*8*/1092, 1092, 1092, 1092, 1092, 1092, 1092, 1092},
{1092, 1092, 1092, 1092, 1092, 1092, 1092, 1092,
/*8*/1092, 1092, 1092, 1092, 1092, 1092, 1092, 1092},
{1092, 1092, 1092, 1092, 1092, 1092, 1092, 1092,
/*8*/1092, 1092, 1092, 1092, 1092, 1092, 1092, 1092},
{1092, 1092, 1092, 1092, 1092, 1092, 1092, 1092,
/*8*/1092, 1092, 1092, 1092, 1092, 1092, 1092, 1092},
#endif
},
},
};
struct combo_dev_attr_s sc2331_1L_rx_attr = {
.input_mode = INPUT_MODE_MIPI,
.mac_clk = RX_MAC_CLK_200M,
.mipi_attr = {
.raw_data_type = RAW_DATA_10BIT,
.lane_id = {3, 2, -1, -1, -1},
.wdr_mode = CVI_MIPI_WDR_MODE_NONE,
.dphy = {
.enable = 1,
.hs_settle = 8,
},
},
.mclk = {
.cam = 0,
.freq = CAMPLL_FREQ_27M,
},
.devno = 0,
};
#ifdef __cplusplus
#if __cplusplus
}
#endif
#endif /* End of #ifdef __cplusplus */
#endif /* __SC2331_1L_CMOS_PARAM_H_ */
SHELL = /bin/bash
ifeq ($(PARAM_FILE), )
PARAM_FILE=../../../../../../$(shell echo $(MW_VER))/Makefile.param
include $(PARAM_FILE)
endif
SDIR = $(PWD)
SRCS = $(wildcard $(SDIR)/*.c)
INCS = -I$(MW_INC) -I$(ISP_INC) -I$(KERNEL_INC) -I./include
OBJS = $(SRCS:.c=.o)
DEPS = $(SRCS:.c=.d)
TARGET_A = $(MW_LIB)/libsns_sc2336p.a
TARGET_SO = $(MW_LIB)/libsns_sc2336p.so
EXTRA_CFLAGS = $(INCS)
EXTRA_LDFLAGS =
.PHONY : clean all
all : $(TARGET_A) $(TARGET_SO)
$(SDIR)/%.o: $(SDIR)/%.c
@$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c $< -o $@
@echo [$(notdir $(CC))] $(notdir $@)
$(TARGET_A): $(OBJS)
@$(AR) $(ARFLAGS) $@ $(OBJ)
@echo -e $(YELLOW)[LINK]$(END)[$(notdir $(AR))] $(notdir $(TARGET_A))
$(TARGET_SO): $(OBJS)
@$(LD) $(LDFLAGS) $(EXTRA_LDFLAGS) -o $@ --start-group $(OBJS) --end-group
@echo -e $(GREEN)[LINK]$(END)[$(notdir $(LD))] $(notdir $(TARGET_SO))
clean:
@rm -f $(OBJS) $(DEPS) $(TARGET_A) $(TARGET_SO)
-include $(DEPS)
#ifndef __SC2336P_CMOS_EX_H_
#define __SC2336P_CMOS_EX_H_
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif
#endif
#ifdef ARCH_CV182X
#include <linux/cvi_vip_cif.h>
#include <linux/cvi_vip_snsr.h>
#include "cvi_type.h"
#else
#include <linux/cif_uapi.h>
#include <linux/vi_snsr.h>
#include <linux/cvi_type.h>
#endif
#include "cvi_sns_ctrl.h"
enum sc2336p_linear_regs_e {
LINEAR_SHS1_0_ADDR,
LINEAR_SHS1_1_ADDR,
LINEAR_SHS1_2_ADDR,
LINEAR_AGAIN_0_ADDR,
LINEAR_DGAIN_0_ADDR,
LINEAR_DGAIN_1_ADDR,
LINEAR_VMAX_0_ADDR,
LINEAR_VMAX_1_ADDR,
LINEAR_REGS_NUM
};
typedef enum _SC2336P_MODE_E {
SC2336P_MODE_1080P30 = 0,
SC2336P_MODE_LINEAR_NUM,
SC2336P_MODE_NUM
} SC2336P_MODE_E;
typedef struct _SC2336P_STATE_S {
CVI_U32 u32Sexp_MAX; /* (2*{16’h3e23,16’h3e24} – 'd10)/2 */
} SC2336P_STATE_S;
typedef struct _SC2336P_MODE_S {
ISP_WDR_SIZE_S astImg[2];
CVI_FLOAT f32MaxFps;
CVI_FLOAT f32MinFps;
CVI_U32 u32HtsDef;
CVI_U32 u32VtsDef;
SNS_ATTR_S stExp[2];
SNS_ATTR_S stAgain[2];
SNS_ATTR_S stDgain[2];
CVI_U16 u16SexpMaxReg; /* {16’h3e23,16’h3e24} */
char name[64];
} SC2336P_MODE_S;
/****************************************************************************
* external variables and functions *
****************************************************************************/
extern ISP_SNS_STATE_S *g_pastSC2336P[VI_MAX_PIPE_NUM];
extern ISP_SNS_COMMBUS_U g_aunSC2336P_BusInfo[];
extern CVI_U16 g_au16SC2336P_GainMode[];
extern CVI_U16 g_au16SC2336P_L2SMode[];
extern const CVI_U8 sc2336p_i2c_addr;
extern const CVI_U32 sc2336p_addr_byte;
extern const CVI_U32 sc2336p_data_byte;
extern void sc2336p_init(VI_PIPE ViPipe);
extern void sc2336p_exit(VI_PIPE ViPipe);
extern void sc2336p_standby(VI_PIPE ViPipe);
extern void sc2336p_restart(VI_PIPE ViPipe);
extern int sc2336p_write_register(VI_PIPE ViPipe, int addr, int data);
extern int sc2336p_read_register(VI_PIPE ViPipe, int addr);
extern void sc2336p_mirror_flip(VI_PIPE ViPipe, ISP_SNS_MIRRORFLIP_TYPE_E eSnsMirrorFlip);
extern int sc2336p_probe(VI_PIPE ViPipe);
#ifdef __cplusplus
#if __cplusplus
}
#endif
#endif /* End of #ifdef __cplusplus */
#endif /* __SC2336P_CMOS_EX_H_ */
#ifndef __SC2336P_CMOS_PARAM_H_
#define __SC2336P_CMOS_PARAM_H_
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif
#endif
#ifdef ARCH_CV182X
#include <linux/cvi_vip_cif.h>
#include <linux/cvi_vip_snsr.h>
#include "cvi_type.h"
#else
#include <linux/cif_uapi.h>
#include <linux/vi_snsr.h>
#include <linux/cvi_type.h>
#endif
#include "cvi_sns_ctrl.h"
#include "sc2336p_cmos_ex.h"
static const SC2336P_MODE_S g_astSC2336P_mode[SC2336P_MODE_NUM] = {
[SC2336P_MODE_1080P30] = {
.name = "1080p30",
.astImg[0] = {
.stSnsSize = {
.u32Width = 1920,
.u32Height = 1080,
},
.stWndRect = {
.s32X = 0,
.s32Y = 0,
.u32Width = 1920,
.u32Height = 1080,
},
.stMaxSize = {
.u32Width = 1920,
.u32Height = 1080,
},
},
.f32MaxFps = 30,
.f32MinFps = 0.51, /* 1125 * 30 / 0xFFFF*/
.u32HtsDef = 2560,
.u32VtsDef = 1125,
.stExp[0] = {
.u16Min = 1,
.u16Max = 12184 - 6,
.u16Def = 400,
.u16Step = 1,
},
.stAgain[0] = {
.u16Min = 1024,
.u16Max = 32768,
.u16Def = 1024,
.u16Step = 1,
},
.stDgain[0] = {
.u16Min = 1024,
.u16Max = 4096,
.u16Def = 1024,
.u16Step = 1,
},
},
};
static ISP_CMOS_BLACK_LEVEL_S g_stIspBlcCalibratio = {
.bUpdate = CVI_TRUE,
.blcAttr = {
.Enable = 1,
.enOpType = OP_TYPE_AUTO,
.stManual = {260, 260, 260, 260, 0, 0, 0, 0
#ifdef ARCH_CV182X
, 1093, 1093, 1093, 1093
#endif
},
.stAuto = {
{260, 260, 260, 260, 260, 252, 252, 252, /*8*/260, 260, 260, 260, 260, 260, 260, 260},
{260, 260, 260, 260, 260, 252, 252, 252, /*8*/260, 260, 260, 260, 260, 260, 260, 260},
{260, 260, 260, 260, 260, 252, 252, 252, /*8*/260, 260, 260, 260, 260, 260, 260, 260},
{260, 260, 260, 260, 260, 252, 252, 252, /*8*/260, 260, 260, 260, 260, 260, 260, 260},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
#ifdef ARCH_CV182X
{1093, 1093, 1093, 1093, 1093, 1091, 1091, 1091,
/*8*/1093, 1093, 1093, 1093, 1093, 1093, 1093, 1093},
{1093, 1093, 1093, 1093, 1093, 1091, 1091, 1091,
/*8*/1093, 1093, 1093, 1093, 1093, 1093, 1093, 1093},
{1093, 1093, 1093, 1093, 1093, 1091, 1091, 1091,
/*8*/1093, 1093, 1093, 1093, 1093, 1093, 1093, 1093},
{1093, 1093, 1093, 1093, 1093, 1091, 1091, 1091,
/*8*/1093, 1093, 1093, 1093, 1093, 1093, 1093, 1093},
#endif
},
},
};
struct combo_dev_attr_s sc2336p_rx_attr = {
.input_mode = INPUT_MODE_MIPI,
.mac_clk = RX_MAC_CLK_200M,
.mipi_attr = {
.raw_data_type = RAW_DATA_10BIT,
.lane_id = {2, 1, 3, -1, -1},
.wdr_mode = CVI_MIPI_WDR_MODE_NONE,
.dphy = {
.enable = 1,
.hs_settle = 8,
}
},
.mclk = {
.cam = 0,
.freq = CAMPLL_FREQ_27M,
},
.devno = 0,
};
#ifdef __cplusplus
#if __cplusplus
}
#endif
#endif /* End of #ifdef __cplusplus */
#endif /* __SC2336P_CMOS_PARAM_H_ */
SHELL = /bin/bash
ifeq ($(PARAM_FILE), )
PARAM_FILE=../../../../../../$(shell echo $(MW_VER))/Makefile.param
include $(PARAM_FILE)
endif
SDIR = $(PWD)
SRCS = $(wildcard $(SDIR)/*.c)
INCS = -I$(MW_INC) -I$(ISP_INC) -I$(KERNEL_INC) -I./include
OBJS = $(SRCS:.c=.o)
DEPS = $(SRCS:.c=.d)
TARGET_A = $(MW_LIB)/libsns_sc4336p.a
TARGET_SO = $(MW_LIB)/libsns_sc4336p.so
EXTRA_CFLAGS = $(INCS)
EXTRA_LDFLAGS =
.PHONY : clean all
all : $(TARGET_A) $(TARGET_SO)
$(SDIR)/%.o: $(SDIR)/%.c
@$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c $< -o $@
@echo [$(notdir $(CC))] $(notdir $@)
$(TARGET_A): $(OBJS)
@$(AR) $(ARFLAGS) $@ $(OBJS)
@echo -e $(YELLOW)[LINK]$(END)[$(notdir $(AR))] $(notdir $(TARGET_A))
$(TARGET_SO): $(OBJS)
@$(LD) $(LDFLAGS) $(EXTRA_LDFLAGS) -o $@ --start-group $(OBJS) --end-group
@echo -e $(GREEN)[LINK]$(END)[$(notdir $(LD))] $(notdir $(TARGET_SO))
clean:
@rm -f $(OBJS) $(DEPS) $(TARGET_A) $(TARGET_SO)
-include $(DEPS)
#ifndef __SC4336P_CMOS_EX_H_
#define __SC4336P_CMOS_EX_H_
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif
#endif
#ifdef ARCH_CV182X
#include <linux/cvi_vip_cif.h>
#include <linux/cvi_vip_snsr.h>
#include "cvi_type.h"
#else
#include <linux/cif_uapi.h>
#include <linux/vi_snsr.h>
#include <linux/cvi_type.h>
#endif
#include "cvi_sns_ctrl.h"
enum sc4336p_linear_regs_e {
LINEAR_SHS1_0_ADDR,
LINEAR_SHS1_1_ADDR,
LINEAR_SHS1_2_ADDR,
LINEAR_AGAIN_ADDR,
LINEAR_DGAIN_ADDR,
LINEAR_D_FINEGAIN_ADDR,
LINEAR_VMAX_0_ADDR,
LINEAR_VMAX_1_ADDR,
LINEAR_REGS_NUM
};
typedef enum _SC4336P_MODE_E {
SC4336P_MODE_1440P30 = 0,
SC4336P_MODE_NUM
} SC4336P_MODE_E;
typedef struct _SC4336P_MODE_S {
ISP_WDR_SIZE_S astImg[2];
CVI_FLOAT f32MaxFps;
CVI_FLOAT f32MinFps;
CVI_U32 u32HtsDef;
CVI_U32 u32VtsDef;
SNS_ATTR_LARGE_S stExp[2];
SNS_ATTR_LARGE_S stAgain[2];
SNS_ATTR_LARGE_S stDgain[2];
char name[64];
} SC4336P_MODE_S;
/****************************************************************************
* external variables and functions *
****************************************************************************/
extern ISP_SNS_STATE_S *g_pastSC4336P[VI_MAX_PIPE_NUM];
extern ISP_SNS_COMMBUS_U g_aunSC4336P_BusInfo[];
extern CVI_U16 g_au16SC4336P_GainMode[];
extern CVI_U16 g_au16SC4336P_L2SMode[];
extern CVI_U8 sc4336p_i2c_addr;
extern const CVI_U32 sc4336p_addr_byte;
extern const CVI_U32 sc4336p_data_byte;
extern void sc4336p_init(VI_PIPE ViPipe);
extern void sc4336p_exit(VI_PIPE ViPipe);
extern void sc4336p_standby(VI_PIPE ViPipe);
extern void sc4336p_restart(VI_PIPE ViPipe);
extern int sc4336p_write_register(VI_PIPE ViPipe, int addr, int data);
extern int sc4336p_read_register(VI_PIPE ViPipe, int addr);
extern void sc4336p_mirror_flip(VI_PIPE ViPipe, ISP_SNS_MIRRORFLIP_TYPE_E eSnsMirrorFlip);
extern int sc4336p_probe(VI_PIPE ViPipe);
#ifdef __cplusplus
#if __cplusplus
}
#endif
#endif /* End of #ifdef __cplusplus */
#endif /* __SC4336P_CMOS_EX_H_ */
SHELL = /bin/bash
ifeq ($(PARAM_FILE), )
PARAM_FILE=../../../../../../$(shell echo $(MW_VER))/Makefile.param
include $(PARAM_FILE)
endif
SDIR = $(PWD)
SRCS = $(wildcard $(SDIR)/*.c)
INCS = -I$(MW_INC) -I$(ISP_INC) -I$(KERNEL_INC) -I./include
OBJS = $(SRCS:.c=.o)
DEPS = $(SRCS:.c=.d)
TARGET_A = $(MW_LIB)/libsns_sc5336_2L.a
TARGET_SO = $(MW_LIB)/libsns_sc5336_2L.so
EXTRA_CFLAGS = $(INCS)
EXTRA_LDFLAGS =
.PHONY : clean all
all : $(TARGET_A) $(TARGET_SO)
$(SDIR)/%.o: $(SDIR)/%.c
@$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c $< -o $@
@echo [$(notdir $(CC))] $(notdir $@)
$(TARGET_A): $(OBJS)
@$(AR) $(ARFLAGS) $@ $(OBJS)
@echo -e $(YELLOW)[LINK]$(END)[$(notdir $(AR))] $(notdir $(TARGET_A))
$(TARGET_SO): $(OBJS)
@$(LD) $(LDFLAGS) $(EXTRA_LDFLAGS) -o $@ --start-group $(OBJS) --end-group
@echo -e $(GREEN)[LINK]$(END)[$(notdir $(LD))] $(notdir $(TARGET_SO))
clean:
@rm -f $(OBJS) $(DEPS) $(TARGET_A) $(TARGET_SO)
-include $(DEPS)
SHELL = /bin/bash
ifeq ($(PARAM_FILE), )
PARAM_FILE=../../../../../../$(shell echo $(MW_VER))/Makefile.param
include $(PARAM_FILE)
endif
SDIR = $(PWD)
SRCS = $(wildcard $(SDIR)/*.c)
INCS = -I$(MW_INC) -I$(ISP_INC) -I$(KERNEL_INC) -I./include
OBJS = $(SRCS:.c=.o)
DEPS = $(SRCS:.c=.d)
TARGET_A = $(MW_LIB)/libsns_q03p.a
TARGET_SO = $(MW_LIB)/libsns_q03p.so
EXTRA_CFLAGS = $(INCS)
EXTRA_LDFLAGS =
.PHONY : clean all
all : $(TARGET_A) $(TARGET_SO)
$(SDIR)/%.o: $(SDIR)/%.c
@$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c $< -o $@
@echo [$(notdir $(CC))] $(notdir $@)
$(TARGET_A): $(OBJS)
@$(AR) $(ARFLAGS) $@ $(OBJ)
@echo -e $(YELLOW)[LINK]$(END)[$(notdir $(AR))] $(notdir $(TARGET_A))
$(TARGET_SO): $(OBJS)
@$(LD) $(LDFLAGS) $(EXTRA_LDFLAGS) -o $@ --start-group $(OBJS) --end-group
@echo -e $(GREEN)[LINK]$(END)[$(notdir $(LD))] $(notdir $(TARGET_SO))
clean:
@rm -f $(OBJS) $(DEPS) $(TARGET_A) $(TARGET_SO)
-include $(DEPS)
This diff is collapsed.
SHELL = /bin/bash
ifeq ($(PARAM_FILE), )
PARAM_FILE=../../../../../../$(shell echo $(MW_VER))/Makefile.param
include $(PARAM_FILE)
endif
SDIR = $(PWD)
SRCS = $(wildcard $(SDIR)/*.c)
INCS = -I$(MW_INC) -I$(ISP_INC) -I$(KERNEL_INC) -I./include
OBJS = $(SRCS:.c=.o)
DEPS = $(SRCS:.c=.d)
TARGET_A = $(MW_LIB)/libsns_gc0312.a
TARGET_SO = $(MW_LIB)/libsns_gc0312.so
EXTRA_CFLAGS = $(INCS)
EXTRA_LDFLAGS =
.PHONY : clean all
all : $(TARGET_A) $(TARGET_SO)
$(SDIR)/%.o: $(SDIR)/%.c
@$(CC) $(DEPFLAGS) $(CFLAGS) $(EXTRA_CFLAGS) -c $< -o $@
@echo [$(notdir $(CC))] $(notdir $@)
$(TARGET_A): $(OBJS)
@$(AR) $(ARFLAGS) $@ $(OBJS)
@echo -e $(YELLOW)[LINK]$(END)[$(notdir $(AR))] $(notdir $(TARGET_A))
$(TARGET_SO): $(OBJS)
@$(LD) $(LDFLAGS) $(EXTRA_LDFLAGS) -o $@ --start-group $(OBJS) --end-group
@echo -e $(GREEN)[LINK]$(END)[$(notdir $(LD))] $(notdir $(TARGET_SO))
clean:
@rm -f $(OBJS) $(DEPS) $(TARGET_A) $(TARGET_SO)
-include $(DEPS)
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment