Packages: add Sigmastar infinity6 sensor source

pull/938/head
Viktor 2023-08-05 14:55:12 +02:00 committed by viktorxda
parent 1c1c434dbb
commit aa6571d783
51 changed files with 36473 additions and 7888 deletions

View File

@ -85,6 +85,7 @@ source "$BR2_EXTERNAL_GENERAL_PATH/package/rtw-hostapd/Config.in"
source "$BR2_EXTERNAL_GENERAL_PATH/package/sigmastar-osdrv-infinity6b0/Config.in"
source "$BR2_EXTERNAL_GENERAL_PATH/package/sigmastar-osdrv-infinity6e/Config.in"
source "$BR2_EXTERNAL_GENERAL_PATH/package/sigmastar-osdrv-msc313e/Config.in"
source "$BR2_EXTERNAL_GENERAL_PATH/package/sigmastar-osdrv-sensor/Config.in"
source "$BR2_EXTERNAL_GENERAL_PATH/package/ssw101b/Config.in"
source "$BR2_EXTERNAL_GENERAL_PATH/package/uacme-openipc/Config.in"
source "$BR2_EXTERNAL_GENERAL_PATH/package/uqmi-openipc/Config.in"

View File

@ -1,4 +1,5 @@
config BR2_PACKAGE_SIGMASTAR_OSDRV_INFINITY6B0
bool "sigmastar-osdrv-infinity6b0"
select BR2_PACKAGE_SIGMASTAR_OSDRV_SENSOR
help
SigmaStar infinity6b0 kernel modules

View File

@ -4,6 +4,7 @@
#
PATH_MODULE=/lib/modules/4.9.84/sigmastar
PATH_SENSOR=${PATH_MODULE}/sensor
SENSOR=$(fw_printenv -n sensor)
detect_sensor() {
@ -17,13 +18,13 @@ detect_sensor() {
set_sensor() {
case ${SENSOR} in
gc4653|imx335|sc2239|sc3335)
insmod ${PATH_MODULE}/sensor_${SENSOR}_mipi.ko chmap=1
insmod ${PATH_SENSOR}/sensor_${SENSOR}_mipi.ko chmap=1
;;
gc2053|sc2335)
insmod ${PATH_MODULE}/sensor_${SENSOR}_mipi.ko chmap=1 lane_num=2 hdr_lane_num=2
insmod ${PATH_SENSOR}/sensor_${SENSOR}_mipi.ko chmap=1 lane_num=2 hdr_lane_num=2
;;
imx307)
insmod ${PATH_MODULE}/sensor_${SENSOR}_mipi.ko chmap=1 lane_num=2 hdr_lane_num=2 mclk=37.125M
insmod ${PATH_SENSOR}/sensor_${SENSOR}_mipi.ko chmap=1 lane_num=2 hdr_lane_num=2 mclk=37.125M
;;
*)
echo -e "\n\e[1;31mUNSUPPORTED sensor found - ${SENSOR}\e[0m\n" | logger -s -t OpenIPC

View File

@ -12,7 +12,6 @@ SIGMASTAR_OSDRV_INFINITY6B0_LICENSE_FILES = LICENSE
define SIGMASTAR_OSDRV_INFINITY6B0_INSTALL_TARGET_CMDS
$(INSTALL) -m 755 -d $(TARGET_DIR)/lib/modules/4.9.84/sigmastar
$(INSTALL) -m 644 -t $(TARGET_DIR)/lib/modules/4.9.84/sigmastar $(SIGMASTAR_OSDRV_INFINITY6B0_PKGDIR)/files/kmod/*
$(INSTALL) -m 644 -t $(TARGET_DIR)/lib/modules/4.9.84/sigmastar $(SIGMASTAR_OSDRV_INFINITY6B0_PKGDIR)/files/sensors/kmod/*
$(INSTALL) -m 755 -d $(TARGET_DIR)/etc/firmware
$(INSTALL) -m 644 -t $(TARGET_DIR)/etc/firmware $(SIGMASTAR_OSDRV_INFINITY6B0_PKGDIR)/files/sensors/firmware/*

View File

@ -1,4 +1,5 @@
config BR2_PACKAGE_SIGMASTAR_OSDRV_INFINITY6E
bool "sigmastar-osdrv-infinity6e"
select BR2_PACKAGE_SIGMASTAR_OSDRV_SENSOR
help
SigmaStar infinity6e kernel modules

View File

@ -4,6 +4,7 @@
#
PATH_MODULE=/lib/modules/4.9.84/sigmastar
PATH_SENSOR=${PATH_MODULE}/sensor
SENSOR=$(fw_printenv -n sensor)
detect_sensor() {
@ -17,7 +18,7 @@ detect_sensor() {
set_sensor() {
case ${SENSOR} in
imx274|imx335|imx347|imx415|sc8235)
insmod ${PATH_MODULE}/sensor_${SENSOR}_mipi.ko chmap=1
insmod ${PATH_SENSOR}/sensor_${SENSOR}_mipi.ko chmap=1
;;
*)
echo -e "\n\e[1;31mUNSUPPORTED sensor found - ${SENSOR}\e[0m\n" | logger -s -t OpenIPC

View File

@ -12,7 +12,6 @@ SIGMASTAR_OSDRV_INFINITY6E_LICENSE_FILES = LICENSE
define SIGMASTAR_OSDRV_INFINITY6E_INSTALL_TARGET_CMDS
$(INSTALL) -m 755 -d $(TARGET_DIR)/lib/modules/4.9.84/sigmastar
$(INSTALL) -m 644 -t $(TARGET_DIR)/lib/modules/4.9.84/sigmastar $(SIGMASTAR_OSDRV_INFINITY6E_PKGDIR)/files/kmod/*
$(INSTALL) -m 644 -t $(TARGET_DIR)/lib/modules/4.9.84/sigmastar $(SIGMASTAR_OSDRV_INFINITY6E_PKGDIR)/files/sensors/kmod/*
$(INSTALL) -m 755 -d $(TARGET_DIR)/etc/firmware
$(INSTALL) -m 644 -t $(TARGET_DIR)/etc/firmware $(SIGMASTAR_OSDRV_INFINITY6E_PKGDIR)/files/sensors/firmware/*

View File

@ -0,0 +1,5 @@
config BR2_PACKAGE_SIGMASTAR_OSDRV_SENSOR
bool "sigmastar-osdrv-sensor"
default n
help
Sigmastar sensor kernel driver

View File

@ -0,0 +1,20 @@
################################################################################
#
# sigmastar-osdrv-sensor
#
################################################################################
SIGMASTAR_OSDRV_SENSOR_LICENSE = MIT
SIGMASTAR_OSDRV_SENSOR_LICENSE_FILES = LICENSE
define SIGMASTAR_OSDRV_SENSOR_EXTRACT_CMDS
cp -r $(SIGMASTAR_OSDRV_SENSOR_PKGDIR)/src/* $(@D)
endef
SIGMASTAR_OSDRV_SENSOR_MODULE_SUBDIRS = $(OPENIPC_SOC_FAMILY)
SIGMASTAR_OSDRV_SENSOR_MODULE_MAKE_OPTS = \
INSTALL_MOD_DIR=sigmastar \
KSRC=$(LINUX_DIR)
$(eval $(kernel-module))
$(eval $(generic-package))

View File

@ -0,0 +1,9 @@
EXTRA_CFLAGS += -I $(PWD)/include -I $(KSRC)/drivers/sstar/include
EXTRA_CFLAGS += -D SENSOR_MODULE_VERSION=$(OPENIPC_SOC_MODEL)-$(OPENIPC_SOC_FAMILY)
obj-m := $(patsubst $(PWD)/%.c, %.o, $(wildcard $(PWD)/sensor/*.c))
modules:
$(MAKE) -C $(KSRC) M=$(PWD) modules
clean:
$(MAKE) -C $(KSRC) M=$(PWD) clean

View File

@ -0,0 +1,53 @@
/* Copyright (c) 2018-2019 Sigmastar Technology Corp.
All rights reserved.
Unless otherwise stipulated in writing, any and all information contained
herein regardless in any format shall remain the sole proprietary of
Sigmastar Technology Corp. and be kept in strict confidence
(Sigmastar Confidential Information) by the recipient.
Any unauthorized act including without limitation unauthorized disclosure,
copying, use, reproduction, sale, distribution, modification, disassembling,
reverse engineering and compiling of the contents of Sigmastar Confidential
Information is unlawful and strictly prohibited. Sigmastar hereby reserves the
rights to any and all damages, losses, costs and expenses resulting therefrom.
*/
#ifndef DRV_SENSOR_H
#define DRV_SENSOR_H
#include <cam_os_wrapper.h>
#define SENSOR_DMSG(args...) do{}while(0)
#define SENSOR_EMSG(args...) CamOsPrintf(args)
#define SENSOR_IMSG(args...) CamOsPrintf(args)
#if 0
typedef enum {
I2C_FMT_A8D8, /**< 8 bits Address, 8 bits Data */
I2C_FMT_A16D8,/**< 16 bits Address 8 bits Data */
I2C_FMT_A8D16,/**< 8 bits Address 16 bits Data */
I2C_FMT_A16D16,/**< 16 bits Address 16 bits Data */
I2C_FMT_END/**< Reserved */
} ISP_I2C_FMT;
#endif
extern s32 WriteRegisterPair(int slaveAddr, short reg, unsigned short value, ISP_I2C_FMT fmt);
extern u64 intlog10(u32 value);
extern u64 intlog2(u32 value);
extern s32 DrvRegisterSensorDriver(u32 nCamID, SensorInitHandle pfnSensorInitHandle);
extern s32 DrvRegisterPlaneDriver(u32 nCamID, u32 nPlaneID, SensorInitHandle pfnSensorInitHandle);
extern s32 DrvRegisterSensorDriverEx(u32 nSNRPadID, SensorInitHandle pfnSensorInitHandle, void *pPrivateData);
extern s32 DrvRegisterPlaneDriverEx(u32 nSNRPadID, u32 nPlaneID, SensorInitHandle pfnSensorInitHandle, void *pPrivateData);
extern s32 DrvSensorRelease(u32 nSNRPadID);
extern s32 DrvSensorEarlyInitSync(u32 nSNRPadID);
extern s32 DrvRegisterSensorI2CSlaveID(u32 nCamID, u32 Slaveid);
extern s32 DrvRegisterPlaneI2CSlaveID(u32 nCamID, u32 nPlaneID, u32 Slaveid);
extern s32 DrvSensorHandleVer(u32 version_major, u32 version_minor);
extern s32 DrvSensorIFVer(u32 version_major, u32 version_minor);
extern s32 DrvSensorI2CVer(u32 version_major, u32 version_minor);
#define DrvUnregisterSensorDriverEx(nSNRPadID) DrvSensorRelease((nSNRPadID))
#define SENSOR_USLEEP(us) CamOsUsSleep(us)
#define SENSOR_MSLEEP(ms) CamOsMsSleep(ms)
#define SENSOR_UDELAY(us) CamOsUsDelay(us)
#define SENSOR_MDELAY(ms) CamOsMsDelay(ms)
#endif

View File

@ -0,0 +1,379 @@
/* Copyright (c) 2018-2019 Sigmastar Technology Corp.
All rights reserved.
Unless otherwise stipulated in writing, any and all information contained
herein regardless in any format shall remain the sole proprietary of
Sigmastar Technology Corp. and be kept in strict confidence
(Sigmastar Confidential Information) by the recipient.
Any unauthorized act including without limitation unauthorized disclosure,
copying, use, reproduction, sale, distribution, modification, disassembling,
reverse engineering and compiling of the contents of Sigmastar Confidential
Information is unlawful and strictly prohibited. Sigmastar hereby reserves the
rights to any and all damages, losses, costs and expenses resulting therefrom.
*/
#ifndef _SENSOR_OS_WRAPPER_H_
#define _SENSOR_OS_WRAPPER_H_
#if defined(__KERNEL__)
#define CAM_OS_LINUX_KERNEL
#endif
#include <cam_os_wrapper.h>
#include <drv_ms_cus_sensor.h>
#include <drv_sensor.h>
/******************************************************** RTK ***********************************************************/
#if defined(CAM_OS_RTK)
typedef unsigned char bool;
#ifndef true
#define true 1
#define false 0
#endif
#ifndef _SENSOR_SLAVE_ID_
#define _SENSOR_SLAVE_ID_ 0
#endif
#define SENSOR_DRV_ENTRY_IMPL_BEGIN(NAME)
#define SENSOR_DRV_ENTRY_IMPL_END(Name,LinearEntry,HdrSefEntry,HdrLefEntry)\
int Name##_init_driver(unsigned char chmap)\
{\
int nCamID=0;\
/*To avoid compile warning*/\
void* p0 = LinearEntry;\
void* p1 = HdrSefEntry;\
void* p2 = HdrLefEntry;\
for(nCamID=0;nCamID<4;++nCamID)\
{\
if((chmap>>nCamID)&0x1)\
{\
if(p0){ DrvRegisterSensorDriver(nCamID, LinearEntry);\
DrvRegisterSensorI2CSlaveID(nCamID, (_SENSOR_SLAVE_ID_>>(nCamID*8))&0xFF);\
SENSOR_DMSG("Connect %s linear to sensor pad %d\n",__FUNCTION__, nCamID);\
}\
if(p1){ DrvRegisterPlaneDriver(nCamID, 1, HdrSefEntry);\
DrvRegisterPlaneI2CSlaveID(nCamID, 1, (_SENSOR_SLAVE_ID_>>(nCamID*8))&0xFF);\
SENSOR_DMSG("Connect %s SEF to vif sensor pad %d\n",__FUNCTION__, nCamID);\
}\
if(p2){ DrvRegisterPlaneDriver(nCamID, 0, HdrLefEntry);\
DrvRegisterPlaneI2CSlaveID(nCamID, 0, (_SENSOR_SLAVE_ID_>>(nCamID*8))&0xFF);\
SENSOR_DMSG("Connect %s LEF to sensor pad %d\n",__FUNCTION__, nCamID);\
}\
}\
}\
return 0;\
}
static volatile int lane_num = 2;
static volatile int hdr_lane_num=2;
#define SENSOR_DRV_PARAM_MCLK() "NONE"
#define SENSOR_USLEEP_(us) {CamOsUsDelay(us);}
#define SENSOR_MSLEEP_(ms) {CamOsMsDelay(ms);}
/*Extension version*/
#define SENSOR_DRV_ENTRY_IMPL_BEGIN_EX(NAME) SENSOR_DRV_ENTRY_IMPL_BEGIN(NAME)
#define MAX_CAMID_LEN 4
#define SENSOR_DRV_ENTRY_IMPL_END_EX(Name,LinearEntry,HdrSefEntry,HdrLefEntry,PrivateDataType)\
static PrivateDataType* g_pData[2][MAX_CAMID_LEN] = {{0,0,0,0}, {0,0,0,0}};\
static PrivateDataType g_PrivData[2][MAX_CAMID_LEN];\
int Name##_init_driver(unsigned char chmap)\
{\
int nCamID=0;\
/*To avoid compile warning*/\
void* p0 = LinearEntry;\
void* p1 = HdrSefEntry;\
void* p2 = HdrLefEntry;\
for(nCamID=0;nCamID<MAX_CAMID_LEN;++nCamID)\
{\
if((chmap>>nCamID)&0x1)\
{\
if(p0){\
/*void* pData = CamOsMemAlloc(sizeof(PrivateDataType));*/\
void* pData = &g_PrivData[0][nCamID];/*Change private data to static var*/\
memset(pData,0,sizeof(PrivateDataType));\
DrvRegisterSensorDriverEx(nCamID, LinearEntry,pData);\
DrvRegisterSensorI2CSlaveID(nCamID, (_SENSOR_SLAVE_ID_>>(nCamID*8))&0xFF);\
SENSOR_DMSG("Connect %s linear to sensor pad %d\n",__FUNCTION__, nCamID);\
g_pData[0][nCamID] = pData;\
}\
if(p1||p2){\
/*void* pData = CamOsMemAlloc(sizeof(PrivateDataType));*/\
void* pData = &g_PrivData[1][nCamID];/*Change private data to static var*/\
memset(pData,0,sizeof(PrivateDataType));\
if(p1){\
DrvRegisterPlaneDriverEx(nCamID, 1, HdrSefEntry,pData);\
DrvRegisterPlaneI2CSlaveID(nCamID, 1, (_SENSOR_SLAVE_ID_>>(nCamID*8))&0xFF);\
SENSOR_DMSG("Connect %s SEF to vif sensor pad %d\n",__FUNCTION__, nCamID);\
}\
if(p2){\
DrvRegisterPlaneDriverEx(nCamID, 0, HdrLefEntry,pData);\
DrvRegisterPlaneI2CSlaveID(nCamID, 0, (_SENSOR_SLAVE_ID_>>(nCamID*8))&0xFF);\
SENSOR_DMSG("Connect %s LEF to sensor pad %d\n",__FUNCTION__, nCamID);\
}\
g_pData[1][nCamID] = pData;\
}\
DrvSensorEarlyInitSync(nCamID);\
}\
}\
return 0;\
}\
\
int Name##_deinit_driver(unsigned char chmap)\
{\
int nCamID=0;\
for(nCamID=0;nCamID<MAX_CAMID_LEN;++nCamID)\
{\
if((chmap>>nCamID)&0x1)\
{\
if(g_pData[0][nCamID] || g_pData[1][nCamID])\
{\
DrvUnregisterSensorDriverEx(nCamID);\
if(g_pData[0][nCamID]){\
/*CamOsMemRelease((void*)g_pData[0][nCamID]);*/\
g_pData[0][nCamID] = 0;\
}\
if(g_pData[1][nCamID]){\
/*CamOsMemRelease((void*)g_pData[1][nCamID]);*/\
g_pData[1][nCamID] = 0;\
}\
}\
}\
}\
return 0;\
}
/******************************************************** LINUX ***********************************************************/
#elif defined(CAM_OS_LINUX_KERNEL)
#include <linux/module.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/string.h>
#include <linux/delay.h>
#define SENSOR_DRV_ENTRY_IMPL_BEGIN(Name) \
int chmap = 0;\
module_param(chmap, int, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP);\
MODULE_PARM_DESC(chmap, "VIF channel mapping");\
char *mclk = "use default parameter";\
module_param(mclk, charp, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP);\
MODULE_PARM_DESC(mclk, "Assign MCLK");
int lane_num = 2;\
module_param(lane_num, int, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP);\
MODULE_PARM_DESC(lane_num, "sensor output lane number");
int hdr_lane_num = 4;\
module_param(hdr_lane_num, int, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP);\
MODULE_PARM_DESC(hdr_lane_num, "sensor output lane number");
int i2c_slave_id = 0;\
module_param(i2c_slave_id, int, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP);\
MODULE_PARM_DESC(i2c_slave_id, "sensor i2c slave id");
#define SENSOR_DRV_ENTRY_IMPL_END(Name,LinearEntry,HdrSefEntry,HdrLefEntry) \
static int __init Name##_init_driver(void)\
{\
int nCamID=0;\
void* p0 = LinearEntry;\
void* p1 = HdrSefEntry;\
void* p2 = HdrLefEntry;\
if(DrvSensorHandleVer(CUS_CAMSENSOR_HANDLE_MAJ_VER, CUS_CAMSENSOR_HANDLE_MIN_VER)==FAIL)\
return FAIL;\
if(DrvSensorIFVer(CUS_CAMSENSORIF_MAJ_VER, CUS_CAMSENSORIF_MIN_VER)==FAIL)\
return FAIL;\
if(DrvSensorI2CVer(CUS_CAMSENSOR_I2C_MAJ_VER, CUS_CAMSENSOR_I2C_MIN_VER)==FAIL)\
return FAIL;\
for(nCamID=0;nCamID<4;++nCamID)\
{\
if((chmap>>nCamID)&0x1)\
{\
if(p0){ DrvRegisterSensorDriver(nCamID, LinearEntry);\
DrvRegisterSensorI2CSlaveID(nCamID, (i2c_slave_id>>(nCamID*8))&0xFF);\
pr_info("Connect %s linear to sensor pad %d\n",__FUNCTION__, nCamID);\
}\
if(p1){ DrvRegisterPlaneDriver(nCamID, 1, HdrSefEntry);\
DrvRegisterPlaneI2CSlaveID(nCamID, 1, (i2c_slave_id>>(nCamID*8))&0xFF);\
pr_info("Connect %s SEF to vif sensor pad %d\n",__FUNCTION__, nCamID);\
}\
if(p2){ DrvRegisterPlaneDriver(nCamID, 0, HdrLefEntry);\
DrvRegisterPlaneI2CSlaveID(nCamID, 0, (i2c_slave_id>>(nCamID*8))&0xFF);\
pr_info("Connect %s LEF to sensor pad %d\n",__FUNCTION__, nCamID);\
}\
}\
}\
return 0;\
}\
static void __exit Name##_exit_driver(void)\
{\
pr_info("sensordrv exit");\
}\
subsys_initcall(Name##_init_driver);\
module_exit(Name##_exit_driver);\
MODULE_DESCRIPTION("Sensor_"#Name);\
MODULE_AUTHOR("SigmaStar");\
MODULE_LICENSE("Proprietary");
#define SENSOR_DRV_PARAM_MCLK() (mclk)
#define SENSOR_USLEEP_(us) CamOsUsSleep(us)
#define SENSOR_MSLEEP_(ms) CamOsMsSleep(ms)
/*Extension version*/
#define SENSOR_DRV_ENTRY_IMPL_BEGIN_EX(Name) SENSOR_DRV_ENTRY_IMPL_BEGIN(Name)
#define MAX_CAMID_LEN 4
#define SENSOR_DRV_ENTRY_IMPL_END_EX(Name,LinearEntry,HdrSefEntry,HdrLefEntry,PrivateDataType) \
static PrivateDataType* g_pData[2][MAX_CAMID_LEN] = {{0,0,0,0}, {0,0,0,0}};\
static int __init Name##_init_driver(void)\
{\
int nCamID=0;\
void* p0 = LinearEntry;\
void* p1 = HdrSefEntry;\
void* p2 = HdrLefEntry;\
if(DrvSensorHandleVer(CUS_CAMSENSOR_HANDLE_MAJ_VER, CUS_CAMSENSOR_HANDLE_MIN_VER)==FAIL)\
return FAIL;\
if(DrvSensorIFVer(CUS_CAMSENSORIF_MAJ_VER, CUS_CAMSENSORIF_MIN_VER)==FAIL)\
return FAIL;\
if(DrvSensorI2CVer(CUS_CAMSENSOR_I2C_MAJ_VER, CUS_CAMSENSOR_I2C_MIN_VER)==FAIL)\
return FAIL;\
for(nCamID=0;nCamID<MAX_CAMID_LEN;++nCamID)\
{\
if((chmap>>nCamID)&0x1)\
{\
if(p0){\
void* pData = CamOsMemAlloc(sizeof(PrivateDataType));\
memset(pData,0,sizeof(PrivateDataType));\
DrvRegisterSensorDriverEx(nCamID, LinearEntry,pData);\
DrvRegisterSensorI2CSlaveID(nCamID, (i2c_slave_id>>(nCamID*8))&0xFF);\
pr_info("Connect %s linear to sensor pad %d\n",__FUNCTION__, nCamID);\
g_pData[0][nCamID] = pData;\
}\
if(p1||p2){\
void* pData = CamOsMemAlloc(sizeof(PrivateDataType));\
memset(pData,0,sizeof(PrivateDataType));\
if(p1){\
DrvRegisterPlaneDriverEx(nCamID, 1, HdrSefEntry,pData);\
DrvRegisterPlaneI2CSlaveID(nCamID, 1, (i2c_slave_id>>(nCamID*8))&0xFF);\
pr_info("Connect %s SEF to vif sensor pad %d\n",__FUNCTION__, nCamID);\
}\
if(p2){\
DrvRegisterPlaneDriverEx(nCamID, 0, HdrLefEntry,pData);\
DrvRegisterPlaneI2CSlaveID(nCamID, 0, (i2c_slave_id>>(nCamID*8))&0xFF);\
pr_info("Connect %s LEF to sensor pad %d\n",__FUNCTION__, nCamID);\
}\
g_pData[1][nCamID] = pData;\
}\
}\
}\
return 0;\
}\
static void __exit Name##_exit_driver(void)\
{\
int nCamID=0;\
for(nCamID=0;nCamID<MAX_CAMID_LEN;++nCamID)\
{\
if((chmap>>nCamID)&0x1)\
{\
if(g_pData[0][nCamID] || g_pData[1][nCamID])\
{\
DrvUnregisterSensorDriverEx(nCamID);\
if(g_pData[0][nCamID]){\
CamOsMemRelease((void*)g_pData[0][nCamID]);\
g_pData[0][nCamID] = 0;\
}\
if(g_pData[1][nCamID]){\
CamOsMemRelease((void*)g_pData[1][nCamID]);\
g_pData[1][nCamID] = 0;\
}\
}\
}\
}\
}\
subsys_initcall(Name##_init_driver);\
module_exit(Name##_exit_driver);\
MODULE_DESCRIPTION("Sensor_"#Name);\
MODULE_AUTHOR("SigmaStar");\
MODULE_LICENSE("Proprietary");
//define 3 ch AHD application impl
#define SENSOR_DRV_ENTRY_3CHAHD_IMPL_END_EX(Name,LinearEntry,AhdCh0Entry,AhdCh1Entry, AhdCh2Entry,PrivateDataType)\
static PrivateDataType* g_pData[2][MAX_CAMID_LEN] = {{0,0,0,0}, {0,0,0,0}};\
static int __init Name##_init_driver(void)\
{\
int nCamID=0;\
void* p0 = LinearEntry;\
void* p1 = AhdCh0Entry;\
void* p2 = AhdCh1Entry;\
void* p3 = AhdCh2Entry;\
if(DrvSensorHandleVer(CUS_CAMSENSOR_HANDLE_MAJ_VER, CUS_CAMSENSOR_HANDLE_MIN_VER)==FAIL)\
return FAIL;\
if(DrvSensorIFVer(CUS_CAMSENSORIF_MAJ_VER, CUS_CAMSENSORIF_MIN_VER)==FAIL)\
return FAIL;\
if(DrvSensorI2CVer(CUS_CAMSENSOR_I2C_MAJ_VER, CUS_CAMSENSOR_I2C_MIN_VER)==FAIL)\
return FAIL;\
for(nCamID=0;nCamID<MAX_CAMID_LEN;++nCamID)\
{\
if((chmap>>nCamID)&0x1)\
{\
if(p0){\
void* pData = CamOsMemAlloc(sizeof(PrivateDataType));\
memset(pData,0,sizeof(PrivateDataType));\
DrvRegisterSensorDriverEx(nCamID, LinearEntry,pData);\
DrvRegisterSensorI2CSlaveID(nCamID, (i2c_slave_id>>(nCamID*8))&0xFF);\
pr_info("Connect %s linear to sensor pad %d\n",__FUNCTION__, nCamID);\
g_pData[0][nCamID] = pData;\
}\
if(p1||p2||p3){\
void* pData = CamOsMemAlloc(sizeof(PrivateDataType));\
memset(pData,0,sizeof(PrivateDataType));\
if(p1){\
DrvRegisterPlaneDriverEx(nCamID, 0, AhdCh0Entry,pData);\
DrvRegisterPlaneI2CSlaveID(nCamID, 0, (i2c_slave_id>>(nCamID*8))&0xFF);\
pr_info("Connect %s AHD0 to vif sensor pad %d\n",__FUNCTION__, nCamID);\
}\
if(p2){\
DrvRegisterPlaneDriverEx(nCamID, 1, AhdCh1Entry,pData);\
DrvRegisterPlaneI2CSlaveID(nCamID, 1, (i2c_slave_id>>(nCamID*8))&0xFF);\
pr_info("Connect %s AHD1 to sensor pad %d\n",__FUNCTION__, nCamID);\
}\
if(p3){\
DrvRegisterPlaneDriverEx(nCamID, 2, AhdCh2Entry,pData);\
DrvRegisterPlaneI2CSlaveID(nCamID, 2, (i2c_slave_id>>(nCamID*8))&0xFF);\
pr_info("Connect %s AHD2 to sensor pad %d\n",__FUNCTION__, nCamID);\
}\
g_pData[1][nCamID] = pData;\
}\
}\
}\
return 0;\
}\
static void __exit Name##_exit_driver(void)\
{\
int nCamID=0;\
for(nCamID=0;nCamID<MAX_CAMID_LEN;++nCamID)\
{\
if((chmap>>nCamID)&0x1)\
{\
if(g_pData[0][nCamID] || g_pData[1][nCamID])\
{\
DrvUnregisterSensorDriverEx(nCamID);\
if(g_pData[0][nCamID]){\
CamOsMemRelease((void*)g_pData[0][nCamID]);\
g_pData[0][nCamID] = 0;\
}\
if(g_pData[1][nCamID]){\
CamOsMemRelease((void*)g_pData[1][nCamID]);\
g_pData[1][nCamID] = 0;\
}\
}\
}\
}\
}\
subsys_initcall(Name##_init_driver);\
module_exit(Name##_exit_driver);\
MODULE_DESCRIPTION("Sensor_"#Name);\
MODULE_AUTHOR("SigmaStar");\
MODULE_LICENSE("Proprietary");
#endif //end of CAM_OS_LINUX_KERNEL
#endif //endif _SENSOR_OS_WRAPPER_H_

View File

@ -0,0 +1,114 @@
/* Copyright (c) 2018-2019 Sigmastar Technology Corp.
All rights reserved.
Unless otherwise stipulated in writing, any and all information contained
herein regardless in any format shall remain the sole proprietary of
Sigmastar Technology Corp. and be kept in strict confidence
(Sigmastar Confidential Information) by the recipient.
Any unauthorized act including without limitation unauthorized disclosure,
copying, use, reproduction, sale, distribution, modification, disassembling,
reverse engineering and compiling of the contents of Sigmastar Confidential
Information is unlawful and strictly prohibited. Sigmastar hereby reserves the
rights to any and all damages, losses, costs and expenses resulting therefrom.
*/
#ifndef _DRV_SENSOR_INIT_H_
#define _DRV_SENSOR_INIT_H_
//#define SENSOR_INIT_CMDQ_MODE
#define SENSOR_INIT_DRV_MODE
/* for sensor driver */
#define I2C_1A1B_W(reg,val) {(reg),(val)}
#define CMDQ_DELAY_MS(ms) {(0xFFFF),(ms)}
#define I2CM_1A1D_W(slave_addr,reg,val) \
{(reg),(val)}
#define I2CM_1A1D_W_BURST2(slave_addr,reg,d0,d1) \
{(reg),(d0)},\
{(reg)+1,(d1)}
#define I2CM_1A1D_W_BURST3(slave_addr,reg,d0,d1,d2) \
{(reg),(d0)},\
{(reg)+1,(d1)},\
{(reg)+2,(d2)}
#define I2CM_1A1D_W_BURST4(slave_addr,reg,d0,d1,d2,d3) \
{(reg),(d0)},\
{(reg)+1,(d1)},\
{(reg)+2,(d2)},\
{(reg)+3,(d3)}
#define I2CM_1A1D_W_BURST5(slave_addr,reg,d0,d1,d2,d3,d4) \
{(reg),(d0)},\
{(reg)+1,(d1)},\
{(reg)+2,(d2)},\
{(reg)+3,(d3)},\
{(reg)+4,(d4)}
#define I2CM_1A1D_W_BURST6(slave_addr,reg,d0,d1,d2,d3,d4,d5) \
{(reg),(d0)},\
{(reg)+1,(d1)},\
{(reg)+2,(d2)},\
{(reg)+3,(d3)},\
{(reg)+4,(d4)},\
{(reg)+5,(d5)}
#define I2CM_1A1D_W_BURST7(slave_addr,reg,d0,d1,d2,d3,d4,d5,d6) \
{(reg),(d0)},\
{(reg)+1,(d1)},\
{(reg)+2,(d2)},\
{(reg)+3,(d3)},\
{(reg)+4,(d4)},\
{(reg)+5,(d5)},\
{(reg)+6,(d6)}
#define I2CM_2A1D_W(slave_addr,reg,val) \
{(reg),(val)}
#define I2CM_2A1D_W_BURST2(slave_addr,reg,d0,d1) \
{(reg),(d0)},\
{(reg)+1,(d1)}
#define I2CM_2A1D_W_BURST3(slave_addr,reg,d0,d1,d2) \
{(reg),(d0)},\
{(reg)+1,(d1)},\
{(reg)+2,(d2)}
#define I2CM_2A1D_W_BURST4(slave_addr,reg,d0,d1,d2,d3) \
{(reg),(d0)},\
{(reg)+1,(d1)},\
{(reg)+2,(d2)},\
{(reg)+3,(d3)}
#define I2CM_2A1D_W_BURST5(slave_addr,reg,d0,d1,d2,d3,d4) \
{(reg),(d0)},\
{(reg)+1,(d1)},\
{(reg)+2,(d2)},\
{(reg)+3,(d3)},\
{(reg)+4,(d4)}
#define I2CM_2A1D_W_BURST6(slave_addr,reg,d0,d1,d2,d3,d4,d5) \
{(reg),(d0)},\
{(reg)+1,(d1)},\
{(reg)+2,(d2)},\
{(reg)+3,(d3)},\
{(reg)+4,(d4)},\
{(reg)+5,(d5)}
#define I2CM_2A2D_W(slave_addr,reg,val) \
{(reg),(val)}
#define I2CM_2A2D_W_BURST2(slave_addr,reg,d0,d1) \
{(reg),(d0)},\
{(reg)+1,(d1)}
#define I2CM_2A2D_W_BURST3(slave_addr,reg,d0,d1,d2) \
{(reg),(d0)},\
{(reg)+1,(d1)},\
{(reg)+2,(d2)}
#define SENSOR_INIT_TABLE I2C_ARRAY
#endif

View File

@ -0,0 +1,168 @@
/* Copyright (c) 2018-2019 Sigmastar Technology Corp.
All rights reserved.
Unless otherwise stipulated in writing, any and all information contained
herein regardless in any format shall remain the sole proprietary of
Sigmastar Technology Corp. and be kept in strict confidence
(Sigmastar Confidential Information) by the recipient.
Any unauthorized act including without limitation unauthorized disclosure,
copying, use, reproduction, sale, distribution, modification, disassembling,
reverse engineering and compiling of the contents of Sigmastar Confidential
Information is unlawful and strictly prohibited. Sigmastar hereby reserves the
rights to any and all damages, losses, costs and expenses resulting therefrom.
*/
/*! @file isp_i2c_api.h
@brief This file contains Infinity ISP I2C basic API.
*/
/** @defgroup group1 ISP I2C API
* @{
*/
#ifndef ISP_I2C_API_H
#define ISP_I2C_API_H
#define SENSOR_I2C_SUCCESS (0)
#define SENSOR_I2C_FAIL (-1)
#define SENSOR_I2C_NOT_SUPPORT (-2)
/**@brief handle version info */
typedef struct _version_info{
u16 major;
u16 minor;
}__attribute__((packed, aligned(1))) version_info;
/*! @brief I2C API handle.*/
struct __i2c_handle_t;
/*! @brief I2C batch read/write data.*/
typedef struct _I2C_ARRAY{
u16 reg; /**< Register address.*/
u16 data; /**< Data.*/
} I2C_ARRAY;
/*! @brief I2C burst read/write data.*/
typedef struct _I2C_ARRAY_BURST{
u16 reg; /**< Register address.*/
u16 *data; /**< Data.*/
} I2C_ARRAY_BURST;
/*! @brief I2C data direction*/
typedef enum {
I2C_RW_R, /**< Data direction read.*/
I2C_RW_W,/**< Data direction write.*/
} I2C_RW;
/*! @brief Use for i2c_array_rw only */
typedef struct _I2C_CPX_ARRAY{
I2C_RW rw; /**< Data direction */
u16 reg; /**< Device register address */
u16 data; /**< Data write to device or read from device*/
}__attribute__((packed, aligned(1))) I2C_CPX_ARRAY;
/*! @brief Internal use for I2C API*/
typedef enum {
I2C_FMT_A8D8, /**< 8 bits Address, 8 bits Data */
I2C_FMT_A16D8,/**< 16 bits Address 8 bits Data */
I2C_FMT_A8D16,/**< 8 bits Address 16 bits Data */
I2C_FMT_A16D16,/**< 16 bits Address 16 bits Data */
I2C_FMT_END/**< Reserved */
} ISP_I2C_FMT;
/*! @brief ISP_I2C_MODE Internal use for I2C API*/
typedef enum {
I2C_LEGACY_MODE, /**< Do not use */
I2C_NORMAL_MODE /**< Sensor driver can only use I2C_NORMAL_MODE */
} ISP_I2C_MODE;
/*! @brief app_i2c_cfg I2C setting for sensor and bus.*/
typedef struct _app_i2c_cfg{
ISP_I2C_MODE mode; //!< I2C_NORMAL_MODE only
ISP_I2C_FMT fmt; //!< I2C data format
u32 speed; //!< I2C clock in Hz
u16 address; //!< Sensor slave address , bit[7~1] are available, bit[0] user don't care
u16 reserved;
}__attribute__((packed, aligned(1))) app_i2c_cfg;
/*! @brief The interface of I2C APIs export to user*/
typedef struct _i2c_handle_t {
//int version;
version_info version;
void *pdata; //i2c_private_data
u32 nSensorID;
/** @brief Open isp i2c port. This function must be called before using isp I2C APIs.
Call i2c_close to close isp i2c port and allocated resource.
@param[in] handle Handle to isp i2c api.
@param[in] cfg I2C initial configuration.
@retval SENSOR_I2C_SUCCESS or SENSOR_I2C_FAIL if error occurs.
*/
int (*i2c_open)(struct _i2c_handle_t* handle, app_i2c_cfg *cfg);
/** @brief Close isp I2C port. Call this functon to release resource which allocated form i2c_open.
@param[in] handle Handle to isp i2c api.
@param[in] cfg I2C configuration mode and spped are necessary in this stage.
@retval SENSOR_I2C_SUCCESS or SENSOR_I2C_FAIL if error occurs.
*/
int (*i2c_close)(struct _i2c_handle_t* handle );
/** @brief Write single data to device.
@param[in] handle Handle to isp i2c api.
@param[in] cfg I2C config, fmd and address are necessary in this stage.
@param[in] reg Device register address address width depend on cfg->fmt.
@param[in] data Data to write, data width depend on cfg->fmt.
@retval SENSOR_I2C_SUCCESS or SENSOR_I2C_FAIL if error occurs.
*/
int (*i2c_tx)(struct _i2c_handle_t* handle , app_i2c_cfg *cfg, u16 reg, u16 data);
/** @brief Read single data from device.
@param[in] handle Handle to isp i2c api.
@param[in] cfg I2C config, fmd and address are necessary in this stage.
@param[in] reg Device register address address width depend on cfg->fmt.
@param[out] data Data buffer for read, data width depend on cfg->fmt.
@retval SENSOR_I2C_SUCCESS or SENSOR_I2C_FAIL if error occurs.
*/
int (*i2c_rx)(struct _i2c_handle_t* handle, app_i2c_cfg *cfg, u16 reg, volatile u16 *data);
/** @brief Batch write to device.
@param[in] handle Handle to isp i2c api.
@param[in] cfg I2C config, fmd and address are necessary in this stage.
@param[in] pdata Data array.
@param[in] len Array size.
@retval SENSOR_I2C_SUCCESS or SENSOR_I2C_FAIL if error occurs.
*/
int (*i2c_array_tx)(struct _i2c_handle_t* handle, app_i2c_cfg *cfg, I2C_ARRAY *pdata, u32 len);
/** @brief Burst write to device.
@param[in] handle Handle to isp i2c api.
@param[in] cfg I2C config, fmd and address are necessary in this stage.
@param[in] pdata Data array.
@param[in] len Array size.
@retval SENSOR_I2C_SUCCESS or SENSOR_I2C_FAIL if error occurs.
*/
int (*i2c_burst_tx)(struct _i2c_handle_t* handle, app_i2c_cfg *cfg, I2C_ARRAY_BURST *pdata, u32 len);
int (*i2c_burst_rx)(struct _i2c_handle_t* handle, app_i2c_cfg *cfg, I2C_ARRAY_BURST *pdata, u32 len);
/** @brief Batch read from device.
@param[in] handle Handle to isp i2c api.
@param[in] cfg I2C config, fmd and address are necessary in this stage.
@param[out] pdata Data array.
@param[in] len Array size.
@retval SENSOR_I2C_SUCCESS or SENSOR_I2C_FAIL if error occurs.
*/
int (*i2c_array_rx)(struct _i2c_handle_t* handle, app_i2c_cfg *cfg, I2C_ARRAY *pdata, u32 len);
/** @brief Composite batch read/write
@param[in] handle Handle to isp i2c api.
@param[in] cfg I2C config, fmd and address are necessary in this stage.
@param[in][out] pdata Data description array.
@param[in] len Array size.
@retval SENSOR_I2C_SUCCESS or SENSOR_I2C_FAIL if error occurs.
*/
int (*i2c_array_rw)(struct _i2c_handle_t* handle, app_i2c_cfg *cfg, I2C_CPX_ARRAY *pdata, u32 len);
} i2c_handle_t;
/** @} */ // end of ISP I2C API
#endif

View File

@ -0,0 +1,9 @@
EXTRA_CFLAGS += -I $(PWD)/include -I $(KSRC)/drivers/sstar/include
EXTRA_CFLAGS += -D SENSOR_MODULE_VERSION=$(OPENIPC_SOC_MODEL)-$(OPENIPC_SOC_FAMILY)
obj-m := $(patsubst $(PWD)/%.c, %.o, $(wildcard $(PWD)/sensor/*.c))
modules:
$(MAKE) -C $(KSRC) M=$(PWD) modules
clean:
$(MAKE) -C $(KSRC) M=$(PWD) clean

View File

@ -0,0 +1,53 @@
/* Copyright (c) 2018-2019 Sigmastar Technology Corp.
All rights reserved.
Unless otherwise stipulated in writing, any and all information contained
herein regardless in any format shall remain the sole proprietary of
Sigmastar Technology Corp. and be kept in strict confidence
(Sigmastar Confidential Information) by the recipient.
Any unauthorized act including without limitation unauthorized disclosure,
copying, use, reproduction, sale, distribution, modification, disassembling,
reverse engineering and compiling of the contents of Sigmastar Confidential
Information is unlawful and strictly prohibited. Sigmastar hereby reserves the
rights to any and all damages, losses, costs and expenses resulting therefrom.
*/
#ifndef DRV_SENSOR_H
#define DRV_SENSOR_H
#include <cam_os_wrapper.h>
#define SENSOR_DMSG(args...) do{}while(0)
#define SENSOR_EMSG(args...) CamOsPrintf(args)
#define SENSOR_IMSG(args...) CamOsPrintf(args)
#if 0
typedef enum {
I2C_FMT_A8D8, /**< 8 bits Address, 8 bits Data */
I2C_FMT_A16D8,/**< 16 bits Address 8 bits Data */
I2C_FMT_A8D16,/**< 8 bits Address 16 bits Data */
I2C_FMT_A16D16,/**< 16 bits Address 16 bits Data */
I2C_FMT_END/**< Reserved */
} ISP_I2C_FMT;
#endif
extern s32 WriteRegisterPair(int slaveAddr, short reg, unsigned short value, ISP_I2C_FMT fmt);
extern u64 intlog10(u32 value);
extern u64 intlog2(u32 value);
extern s32 DrvRegisterSensorDriver(u32 nCamID, SensorInitHandle pfnSensorInitHandle);
extern s32 DrvRegisterPlaneDriver(u32 nCamID, u32 nPlaneID, SensorInitHandle pfnSensorInitHandle);
extern s32 DrvRegisterSensorDriverEx(u32 nSNRPadID, SensorInitHandle pfnSensorInitHandle, void *pPrivateData);
extern s32 DrvRegisterPlaneDriverEx(u32 nSNRPadID, u32 nPlaneID, SensorInitHandle pfnSensorInitHandle, void *pPrivateData);
extern s32 DrvSensorRelease(u32 nSNRPadID);
extern s32 DrvSensorEarlyInitSync(u32 nSNRPadID);
extern s32 DrvRegisterSensorI2CSlaveID(u32 nCamID, u32 Slaveid);
extern s32 DrvRegisterPlaneI2CSlaveID(u32 nCamID, u32 nPlaneID, u32 Slaveid);
extern s32 DrvSensorHandleVer(u32 version_major, u32 version_minor);
extern s32 DrvSensorIFVer(u32 version_major, u32 version_minor);
extern s32 DrvSensorI2CVer(u32 version_major, u32 version_minor);
#define DrvUnregisterSensorDriverEx(nSNRPadID) DrvSensorRelease((nSNRPadID))
#define SENSOR_USLEEP(us) CamOsUsSleep(us)
#define SENSOR_MSLEEP(ms) CamOsMsSleep(ms)
#define SENSOR_UDELAY(us) CamOsUsDelay(us)
#define SENSOR_MDELAY(ms) CamOsMsDelay(ms)
#endif

View File

@ -0,0 +1,379 @@
/* Copyright (c) 2018-2019 Sigmastar Technology Corp.
All rights reserved.
Unless otherwise stipulated in writing, any and all information contained
herein regardless in any format shall remain the sole proprietary of
Sigmastar Technology Corp. and be kept in strict confidence
(Sigmastar Confidential Information) by the recipient.
Any unauthorized act including without limitation unauthorized disclosure,
copying, use, reproduction, sale, distribution, modification, disassembling,
reverse engineering and compiling of the contents of Sigmastar Confidential
Information is unlawful and strictly prohibited. Sigmastar hereby reserves the
rights to any and all damages, losses, costs and expenses resulting therefrom.
*/
#ifndef _SENSOR_OS_WRAPPER_H_
#define _SENSOR_OS_WRAPPER_H_
#if defined(__KERNEL__)
#define CAM_OS_LINUX_KERNEL
#endif
#include <cam_os_wrapper.h>
#include <drv_ms_cus_sensor.h>
#include <drv_sensor.h>
/******************************************************** RTK ***********************************************************/
#if defined(CAM_OS_RTK)
typedef unsigned char bool;
#ifndef true
#define true 1
#define false 0
#endif
#ifndef _SENSOR_SLAVE_ID_
#define _SENSOR_SLAVE_ID_ 0
#endif
#define SENSOR_DRV_ENTRY_IMPL_BEGIN(NAME)
#define SENSOR_DRV_ENTRY_IMPL_END(Name,LinearEntry,HdrSefEntry,HdrLefEntry)\
int Name##_init_driver(unsigned char chmap)\
{\
int nCamID=0;\
/*To avoid compile warning*/\
void* p0 = LinearEntry;\
void* p1 = HdrSefEntry;\
void* p2 = HdrLefEntry;\
for(nCamID=0;nCamID<4;++nCamID)\
{\
if((chmap>>nCamID)&0x1)\
{\
if(p0){ DrvRegisterSensorDriver(nCamID, LinearEntry);\
DrvRegisterSensorI2CSlaveID(nCamID, (_SENSOR_SLAVE_ID_>>(nCamID*8))&0xFF);\
SENSOR_DMSG("Connect %s linear to sensor pad %d\n",__FUNCTION__, nCamID);\
}\
if(p1){ DrvRegisterPlaneDriver(nCamID, 1, HdrSefEntry);\
DrvRegisterPlaneI2CSlaveID(nCamID, 1, (_SENSOR_SLAVE_ID_>>(nCamID*8))&0xFF);\
SENSOR_DMSG("Connect %s SEF to vif sensor pad %d\n",__FUNCTION__, nCamID);\
}\
if(p2){ DrvRegisterPlaneDriver(nCamID, 0, HdrLefEntry);\
DrvRegisterPlaneI2CSlaveID(nCamID, 0, (_SENSOR_SLAVE_ID_>>(nCamID*8))&0xFF);\
SENSOR_DMSG("Connect %s LEF to sensor pad %d\n",__FUNCTION__, nCamID);\
}\
}\
}\
return 0;\
}
static volatile int lane_num = 2;
static volatile int hdr_lane_num=2;
#define SENSOR_DRV_PARAM_MCLK() "NONE"
#define SENSOR_USLEEP_(us) {CamOsUsDelay(us);}
#define SENSOR_MSLEEP_(ms) {CamOsMsDelay(ms);}
/*Extension version*/
#define SENSOR_DRV_ENTRY_IMPL_BEGIN_EX(NAME) SENSOR_DRV_ENTRY_IMPL_BEGIN(NAME)
#define MAX_CAMID_LEN 4
#define SENSOR_DRV_ENTRY_IMPL_END_EX(Name,LinearEntry,HdrSefEntry,HdrLefEntry,PrivateDataType)\
static PrivateDataType* g_pData[2][MAX_CAMID_LEN] = {{0,0,0,0}, {0,0,0,0}};\
static PrivateDataType g_PrivData[2][MAX_CAMID_LEN];\
int Name##_init_driver(unsigned char chmap)\
{\
int nCamID=0;\
/*To avoid compile warning*/\
void* p0 = LinearEntry;\
void* p1 = HdrSefEntry;\
void* p2 = HdrLefEntry;\
for(nCamID=0;nCamID<MAX_CAMID_LEN;++nCamID)\
{\
if((chmap>>nCamID)&0x1)\
{\
if(p0){\
/*void* pData = CamOsMemAlloc(sizeof(PrivateDataType));*/\
void* pData = &g_PrivData[0][nCamID];/*Change private data to static var*/\
memset(pData,0,sizeof(PrivateDataType));\
DrvRegisterSensorDriverEx(nCamID, LinearEntry,pData);\
DrvRegisterSensorI2CSlaveID(nCamID, (_SENSOR_SLAVE_ID_>>(nCamID*8))&0xFF);\
SENSOR_DMSG("Connect %s linear to sensor pad %d\n",__FUNCTION__, nCamID);\
g_pData[0][nCamID] = pData;\
}\
if(p1||p2){\
/*void* pData = CamOsMemAlloc(sizeof(PrivateDataType));*/\
void* pData = &g_PrivData[1][nCamID];/*Change private data to static var*/\
memset(pData,0,sizeof(PrivateDataType));\
if(p1){\
DrvRegisterPlaneDriverEx(nCamID, 1, HdrSefEntry,pData);\
DrvRegisterPlaneI2CSlaveID(nCamID, 1, (_SENSOR_SLAVE_ID_>>(nCamID*8))&0xFF);\
SENSOR_DMSG("Connect %s SEF to vif sensor pad %d\n",__FUNCTION__, nCamID);\
}\
if(p2){\
DrvRegisterPlaneDriverEx(nCamID, 0, HdrLefEntry,pData);\
DrvRegisterPlaneI2CSlaveID(nCamID, 0, (_SENSOR_SLAVE_ID_>>(nCamID*8))&0xFF);\
SENSOR_DMSG("Connect %s LEF to sensor pad %d\n",__FUNCTION__, nCamID);\
}\
g_pData[1][nCamID] = pData;\
}\
DrvSensorEarlyInitSync(nCamID);\
}\
}\
return 0;\
}\
\
int Name##_deinit_driver(unsigned char chmap)\
{\
int nCamID=0;\
for(nCamID=0;nCamID<MAX_CAMID_LEN;++nCamID)\
{\
if((chmap>>nCamID)&0x1)\
{\
if(g_pData[0][nCamID] || g_pData[1][nCamID])\
{\
DrvUnregisterSensorDriverEx(nCamID);\
if(g_pData[0][nCamID]){\
/*CamOsMemRelease((void*)g_pData[0][nCamID]);*/\
g_pData[0][nCamID] = 0;\
}\
if(g_pData[1][nCamID]){\
/*CamOsMemRelease((void*)g_pData[1][nCamID]);*/\
g_pData[1][nCamID] = 0;\
}\
}\
}\
}\
return 0;\
}
/******************************************************** LINUX ***********************************************************/
#elif defined(CAM_OS_LINUX_KERNEL)
#include <linux/module.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/string.h>
#include <linux/delay.h>
#define SENSOR_DRV_ENTRY_IMPL_BEGIN(Name) \
int chmap = 0;\
module_param(chmap, int, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP);\
MODULE_PARM_DESC(chmap, "VIF channel mapping");\
char *mclk = "use default parameter";\
module_param(mclk, charp, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP);\
MODULE_PARM_DESC(mclk, "Assign MCLK");
int lane_num = 2;\
module_param(lane_num, int, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP);\
MODULE_PARM_DESC(lane_num, "sensor output lane number");
int hdr_lane_num = 4;\
module_param(hdr_lane_num, int, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP);\
MODULE_PARM_DESC(hdr_lane_num, "sensor output lane number");
int i2c_slave_id = 0;\
module_param(i2c_slave_id, int, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP);\
MODULE_PARM_DESC(i2c_slave_id, "sensor i2c slave id");
#define SENSOR_DRV_ENTRY_IMPL_END(Name,LinearEntry,HdrSefEntry,HdrLefEntry) \
static int __init Name##_init_driver(void)\
{\
int nCamID=0;\
void* p0 = LinearEntry;\
void* p1 = HdrSefEntry;\
void* p2 = HdrLefEntry;\
if(DrvSensorHandleVer(CUS_CAMSENSOR_HANDLE_MAJ_VER, CUS_CAMSENSOR_HANDLE_MIN_VER)==FAIL)\
return FAIL;\
if(DrvSensorIFVer(CUS_CAMSENSORIF_MAJ_VER, CUS_CAMSENSORIF_MIN_VER)==FAIL)\
return FAIL;\
if(DrvSensorI2CVer(CUS_CAMSENSOR_I2C_MAJ_VER, CUS_CAMSENSOR_I2C_MIN_VER)==FAIL)\
return FAIL;\
for(nCamID=0;nCamID<4;++nCamID)\
{\
if((chmap>>nCamID)&0x1)\
{\
if(p0){ DrvRegisterSensorDriver(nCamID, LinearEntry);\
DrvRegisterSensorI2CSlaveID(nCamID, (i2c_slave_id>>(nCamID*8))&0xFF);\
pr_info("Connect %s linear to sensor pad %d\n",__FUNCTION__, nCamID);\
}\
if(p1){ DrvRegisterPlaneDriver(nCamID, 1, HdrSefEntry);\
DrvRegisterPlaneI2CSlaveID(nCamID, 1, (i2c_slave_id>>(nCamID*8))&0xFF);\
pr_info("Connect %s SEF to vif sensor pad %d\n",__FUNCTION__, nCamID);\
}\
if(p2){ DrvRegisterPlaneDriver(nCamID, 0, HdrLefEntry);\
DrvRegisterPlaneI2CSlaveID(nCamID, 0, (i2c_slave_id>>(nCamID*8))&0xFF);\
pr_info("Connect %s LEF to sensor pad %d\n",__FUNCTION__, nCamID);\
}\
}\
}\
return 0;\
}\
static void __exit Name##_exit_driver(void)\
{\
pr_info("sensordrv exit");\
}\
subsys_initcall(Name##_init_driver);\
module_exit(Name##_exit_driver);\
MODULE_DESCRIPTION("Sensor_"#Name);\
MODULE_AUTHOR("SigmaStar");\
MODULE_LICENSE("Proprietary");
#define SENSOR_DRV_PARAM_MCLK() (mclk)
#define SENSOR_USLEEP_(us) CamOsUsSleep(us)
#define SENSOR_MSLEEP_(ms) CamOsMsSleep(ms)
/*Extension version*/
#define SENSOR_DRV_ENTRY_IMPL_BEGIN_EX(Name) SENSOR_DRV_ENTRY_IMPL_BEGIN(Name)
#define MAX_CAMID_LEN 4
#define SENSOR_DRV_ENTRY_IMPL_END_EX(Name,LinearEntry,HdrSefEntry,HdrLefEntry,PrivateDataType) \
static PrivateDataType* g_pData[2][MAX_CAMID_LEN] = {{0,0,0,0}, {0,0,0,0}};\
static int __init Name##_init_driver(void)\
{\
int nCamID=0;\
void* p0 = LinearEntry;\
void* p1 = HdrSefEntry;\
void* p2 = HdrLefEntry;\
if(DrvSensorHandleVer(CUS_CAMSENSOR_HANDLE_MAJ_VER, CUS_CAMSENSOR_HANDLE_MIN_VER)==FAIL)\
return FAIL;\
if(DrvSensorIFVer(CUS_CAMSENSORIF_MAJ_VER, CUS_CAMSENSORIF_MIN_VER)==FAIL)\
return FAIL;\
if(DrvSensorI2CVer(CUS_CAMSENSOR_I2C_MAJ_VER, CUS_CAMSENSOR_I2C_MIN_VER)==FAIL)\
return FAIL;\
for(nCamID=0;nCamID<MAX_CAMID_LEN;++nCamID)\
{\
if((chmap>>nCamID)&0x1)\
{\
if(p0){\
void* pData = CamOsMemAlloc(sizeof(PrivateDataType));\
memset(pData,0,sizeof(PrivateDataType));\
DrvRegisterSensorDriverEx(nCamID, LinearEntry,pData);\
DrvRegisterSensorI2CSlaveID(nCamID, (i2c_slave_id>>(nCamID*8))&0xFF);\
pr_info("Connect %s linear to sensor pad %d\n",__FUNCTION__, nCamID);\
g_pData[0][nCamID] = pData;\
}\
if(p1||p2){\
void* pData = CamOsMemAlloc(sizeof(PrivateDataType));\
memset(pData,0,sizeof(PrivateDataType));\
if(p1){\
DrvRegisterPlaneDriverEx(nCamID, 1, HdrSefEntry,pData);\
DrvRegisterPlaneI2CSlaveID(nCamID, 1, (i2c_slave_id>>(nCamID*8))&0xFF);\
pr_info("Connect %s SEF to vif sensor pad %d\n",__FUNCTION__, nCamID);\
}\
if(p2){\
DrvRegisterPlaneDriverEx(nCamID, 0, HdrLefEntry,pData);\
DrvRegisterPlaneI2CSlaveID(nCamID, 0, (i2c_slave_id>>(nCamID*8))&0xFF);\
pr_info("Connect %s LEF to sensor pad %d\n",__FUNCTION__, nCamID);\
}\
g_pData[1][nCamID] = pData;\
}\
}\
}\
return 0;\
}\
static void __exit Name##_exit_driver(void)\
{\
int nCamID=0;\
for(nCamID=0;nCamID<MAX_CAMID_LEN;++nCamID)\
{\
if((chmap>>nCamID)&0x1)\
{\
if(g_pData[0][nCamID] || g_pData[1][nCamID])\
{\
DrvUnregisterSensorDriverEx(nCamID);\
if(g_pData[0][nCamID]){\
CamOsMemRelease((void*)g_pData[0][nCamID]);\
g_pData[0][nCamID] = 0;\
}\
if(g_pData[1][nCamID]){\
CamOsMemRelease((void*)g_pData[1][nCamID]);\
g_pData[1][nCamID] = 0;\
}\
}\
}\
}\
}\
subsys_initcall(Name##_init_driver);\
module_exit(Name##_exit_driver);\
MODULE_DESCRIPTION("Sensor_"#Name);\
MODULE_AUTHOR("SigmaStar");\
MODULE_LICENSE("Proprietary");
//define 3 ch AHD application impl
#define SENSOR_DRV_ENTRY_3CHAHD_IMPL_END_EX(Name,LinearEntry,AhdCh0Entry,AhdCh1Entry, AhdCh2Entry,PrivateDataType)\
static PrivateDataType* g_pData[2][MAX_CAMID_LEN] = {{0,0,0,0}, {0,0,0,0}};\
static int __init Name##_init_driver(void)\
{\
int nCamID=0;\
void* p0 = LinearEntry;\
void* p1 = AhdCh0Entry;\
void* p2 = AhdCh1Entry;\
void* p3 = AhdCh2Entry;\
if(DrvSensorHandleVer(CUS_CAMSENSOR_HANDLE_MAJ_VER, CUS_CAMSENSOR_HANDLE_MIN_VER)==FAIL)\
return FAIL;\
if(DrvSensorIFVer(CUS_CAMSENSORIF_MAJ_VER, CUS_CAMSENSORIF_MIN_VER)==FAIL)\
return FAIL;\
if(DrvSensorI2CVer(CUS_CAMSENSOR_I2C_MAJ_VER, CUS_CAMSENSOR_I2C_MIN_VER)==FAIL)\
return FAIL;\
for(nCamID=0;nCamID<MAX_CAMID_LEN;++nCamID)\
{\
if((chmap>>nCamID)&0x1)\
{\
if(p0){\
void* pData = CamOsMemAlloc(sizeof(PrivateDataType));\
memset(pData,0,sizeof(PrivateDataType));\
DrvRegisterSensorDriverEx(nCamID, LinearEntry,pData);\
DrvRegisterSensorI2CSlaveID(nCamID, (i2c_slave_id>>(nCamID*8))&0xFF);\
pr_info("Connect %s linear to sensor pad %d\n",__FUNCTION__, nCamID);\
g_pData[0][nCamID] = pData;\
}\
if(p1||p2||p3){\
void* pData = CamOsMemAlloc(sizeof(PrivateDataType));\
memset(pData,0,sizeof(PrivateDataType));\
if(p1){\
DrvRegisterPlaneDriverEx(nCamID, 0, AhdCh0Entry,pData);\
DrvRegisterPlaneI2CSlaveID(nCamID, 0, (i2c_slave_id>>(nCamID*8))&0xFF);\
pr_info("Connect %s AHD0 to vif sensor pad %d\n",__FUNCTION__, nCamID);\
}\
if(p2){\
DrvRegisterPlaneDriverEx(nCamID, 1, AhdCh1Entry,pData);\
DrvRegisterPlaneI2CSlaveID(nCamID, 1, (i2c_slave_id>>(nCamID*8))&0xFF);\
pr_info("Connect %s AHD1 to sensor pad %d\n",__FUNCTION__, nCamID);\
}\
if(p3){\
DrvRegisterPlaneDriverEx(nCamID, 2, AhdCh2Entry,pData);\
DrvRegisterPlaneI2CSlaveID(nCamID, 2, (i2c_slave_id>>(nCamID*8))&0xFF);\
pr_info("Connect %s AHD2 to sensor pad %d\n",__FUNCTION__, nCamID);\
}\
g_pData[1][nCamID] = pData;\
}\
}\
}\
return 0;\
}\
static void __exit Name##_exit_driver(void)\
{\
int nCamID=0;\
for(nCamID=0;nCamID<MAX_CAMID_LEN;++nCamID)\
{\
if((chmap>>nCamID)&0x1)\
{\
if(g_pData[0][nCamID] || g_pData[1][nCamID])\
{\
DrvUnregisterSensorDriverEx(nCamID);\
if(g_pData[0][nCamID]){\
CamOsMemRelease((void*)g_pData[0][nCamID]);\
g_pData[0][nCamID] = 0;\
}\
if(g_pData[1][nCamID]){\
CamOsMemRelease((void*)g_pData[1][nCamID]);\
g_pData[1][nCamID] = 0;\
}\
}\
}\
}\
}\
subsys_initcall(Name##_init_driver);\
module_exit(Name##_exit_driver);\
MODULE_DESCRIPTION("Sensor_"#Name);\
MODULE_AUTHOR("SigmaStar");\
MODULE_LICENSE("Proprietary");
#endif //end of CAM_OS_LINUX_KERNEL
#endif //endif _SENSOR_OS_WRAPPER_H_

View File

@ -0,0 +1,114 @@
/* Copyright (c) 2018-2019 Sigmastar Technology Corp.
All rights reserved.
Unless otherwise stipulated in writing, any and all information contained
herein regardless in any format shall remain the sole proprietary of
Sigmastar Technology Corp. and be kept in strict confidence
(Sigmastar Confidential Information) by the recipient.
Any unauthorized act including without limitation unauthorized disclosure,
copying, use, reproduction, sale, distribution, modification, disassembling,
reverse engineering and compiling of the contents of Sigmastar Confidential
Information is unlawful and strictly prohibited. Sigmastar hereby reserves the
rights to any and all damages, losses, costs and expenses resulting therefrom.
*/
#ifndef _DRV_SENSOR_INIT_H_
#define _DRV_SENSOR_INIT_H_
//#define SENSOR_INIT_CMDQ_MODE
#define SENSOR_INIT_DRV_MODE
/* for sensor driver */
#define I2C_1A1B_W(reg,val) {(reg),(val)}
#define CMDQ_DELAY_MS(ms) {(0xFFFF),(ms)}
#define I2CM_1A1D_W(slave_addr,reg,val) \
{(reg),(val)}
#define I2CM_1A1D_W_BURST2(slave_addr,reg,d0,d1) \
{(reg),(d0)},\
{(reg)+1,(d1)}
#define I2CM_1A1D_W_BURST3(slave_addr,reg,d0,d1,d2) \
{(reg),(d0)},\
{(reg)+1,(d1)},\
{(reg)+2,(d2)}
#define I2CM_1A1D_W_BURST4(slave_addr,reg,d0,d1,d2,d3) \
{(reg),(d0)},\
{(reg)+1,(d1)},\
{(reg)+2,(d2)},\
{(reg)+3,(d3)}
#define I2CM_1A1D_W_BURST5(slave_addr,reg,d0,d1,d2,d3,d4) \
{(reg),(d0)},\
{(reg)+1,(d1)},\
{(reg)+2,(d2)},\
{(reg)+3,(d3)},\
{(reg)+4,(d4)}
#define I2CM_1A1D_W_BURST6(slave_addr,reg,d0,d1,d2,d3,d4,d5) \
{(reg),(d0)},\
{(reg)+1,(d1)},\
{(reg)+2,(d2)},\
{(reg)+3,(d3)},\
{(reg)+4,(d4)},\
{(reg)+5,(d5)}
#define I2CM_1A1D_W_BURST7(slave_addr,reg,d0,d1,d2,d3,d4,d5,d6) \
{(reg),(d0)},\
{(reg)+1,(d1)},\
{(reg)+2,(d2)},\
{(reg)+3,(d3)},\
{(reg)+4,(d4)},\
{(reg)+5,(d5)},\
{(reg)+6,(d6)}
#define I2CM_2A1D_W(slave_addr,reg,val) \
{(reg),(val)}
#define I2CM_2A1D_W_BURST2(slave_addr,reg,d0,d1) \
{(reg),(d0)},\
{(reg)+1,(d1)}
#define I2CM_2A1D_W_BURST3(slave_addr,reg,d0,d1,d2) \
{(reg),(d0)},\
{(reg)+1,(d1)},\
{(reg)+2,(d2)}
#define I2CM_2A1D_W_BURST4(slave_addr,reg,d0,d1,d2,d3) \
{(reg),(d0)},\
{(reg)+1,(d1)},\
{(reg)+2,(d2)},\
{(reg)+3,(d3)}
#define I2CM_2A1D_W_BURST5(slave_addr,reg,d0,d1,d2,d3,d4) \
{(reg),(d0)},\
{(reg)+1,(d1)},\
{(reg)+2,(d2)},\
{(reg)+3,(d3)},\
{(reg)+4,(d4)}
#define I2CM_2A1D_W_BURST6(slave_addr,reg,d0,d1,d2,d3,d4,d5) \
{(reg),(d0)},\
{(reg)+1,(d1)},\
{(reg)+2,(d2)},\
{(reg)+3,(d3)},\
{(reg)+4,(d4)},\
{(reg)+5,(d5)}
#define I2CM_2A2D_W(slave_addr,reg,val) \
{(reg),(val)}
#define I2CM_2A2D_W_BURST2(slave_addr,reg,d0,d1) \
{(reg),(d0)},\
{(reg)+1,(d1)}
#define I2CM_2A2D_W_BURST3(slave_addr,reg,d0,d1,d2) \
{(reg),(d0)},\
{(reg)+1,(d1)},\
{(reg)+2,(d2)}
#define SENSOR_INIT_TABLE I2C_ARRAY
#endif

View File

@ -0,0 +1,168 @@
/* Copyright (c) 2018-2019 Sigmastar Technology Corp.
All rights reserved.
Unless otherwise stipulated in writing, any and all information contained
herein regardless in any format shall remain the sole proprietary of
Sigmastar Technology Corp. and be kept in strict confidence
(Sigmastar Confidential Information) by the recipient.
Any unauthorized act including without limitation unauthorized disclosure,
copying, use, reproduction, sale, distribution, modification, disassembling,
reverse engineering and compiling of the contents of Sigmastar Confidential
Information is unlawful and strictly prohibited. Sigmastar hereby reserves the
rights to any and all damages, losses, costs and expenses resulting therefrom.
*/
/*! @file isp_i2c_api.h
@brief This file contains Infinity ISP I2C basic API.
*/
/** @defgroup group1 ISP I2C API
* @{
*/
#ifndef ISP_I2C_API_H
#define ISP_I2C_API_H
#define SENSOR_I2C_SUCCESS (0)
#define SENSOR_I2C_FAIL (-1)
#define SENSOR_I2C_NOT_SUPPORT (-2)
/**@brief handle version info */
typedef struct _version_info{
u16 major;
u16 minor;
}__attribute__((packed, aligned(1))) version_info;
/*! @brief I2C API handle.*/
struct __i2c_handle_t;
/*! @brief I2C batch read/write data.*/
typedef struct _I2C_ARRAY{
u16 reg; /**< Register address.*/
u16 data; /**< Data.*/
} I2C_ARRAY;
/*! @brief I2C burst read/write data.*/
typedef struct _I2C_ARRAY_BURST{
u16 reg; /**< Register address.*/
u16 *data; /**< Data.*/
} I2C_ARRAY_BURST;
/*! @brief I2C data direction*/
typedef enum {
I2C_RW_R, /**< Data direction read.*/
I2C_RW_W,/**< Data direction write.*/
} I2C_RW;
/*! @brief Use for i2c_array_rw only */
typedef struct _I2C_CPX_ARRAY{
I2C_RW rw; /**< Data direction */
u16 reg; /**< Device register address */
u16 data; /**< Data write to device or read from device*/
}__attribute__((packed, aligned(1))) I2C_CPX_ARRAY;
/*! @brief Internal use for I2C API*/
typedef enum {
I2C_FMT_A8D8, /**< 8 bits Address, 8 bits Data */
I2C_FMT_A16D8,/**< 16 bits Address 8 bits Data */
I2C_FMT_A8D16,/**< 8 bits Address 16 bits Data */
I2C_FMT_A16D16,/**< 16 bits Address 16 bits Data */
I2C_FMT_END/**< Reserved */
} ISP_I2C_FMT;
/*! @brief ISP_I2C_MODE Internal use for I2C API*/
typedef enum {
I2C_LEGACY_MODE, /**< Do not use */
I2C_NORMAL_MODE /**< Sensor driver can only use I2C_NORMAL_MODE */
} ISP_I2C_MODE;
/*! @brief app_i2c_cfg I2C setting for sensor and bus.*/
typedef struct _app_i2c_cfg{
ISP_I2C_MODE mode; //!< I2C_NORMAL_MODE only
ISP_I2C_FMT fmt; //!< I2C data format
u32 speed; //!< I2C clock in Hz
u16 address; //!< Sensor slave address , bit[7~1] are available, bit[0] user don't care
u16 reserved;
}__attribute__((packed, aligned(1))) app_i2c_cfg;
/*! @brief The interface of I2C APIs export to user*/
typedef struct _i2c_handle_t {
//int version;
version_info version;
void *pdata; //i2c_private_data
u32 nSensorID;
/** @brief Open isp i2c port. This function must be called before using isp I2C APIs.
Call i2c_close to close isp i2c port and allocated resource.
@param[in] handle Handle to isp i2c api.
@param[in] cfg I2C initial configuration.
@retval SENSOR_I2C_SUCCESS or SENSOR_I2C_FAIL if error occurs.
*/
int (*i2c_open)(struct _i2c_handle_t* handle, app_i2c_cfg *cfg);
/** @brief Close isp I2C port. Call this functon to release resource which allocated form i2c_open.
@param[in] handle Handle to isp i2c api.
@param[in] cfg I2C configuration mode and spped are necessary in this stage.
@retval SENSOR_I2C_SUCCESS or SENSOR_I2C_FAIL if error occurs.
*/
int (*i2c_close)(struct _i2c_handle_t* handle );
/** @brief Write single data to device.
@param[in] handle Handle to isp i2c api.
@param[in] cfg I2C config, fmd and address are necessary in this stage.
@param[in] reg Device register address address width depend on cfg->fmt.
@param[in] data Data to write, data width depend on cfg->fmt.
@retval SENSOR_I2C_SUCCESS or SENSOR_I2C_FAIL if error occurs.
*/
int (*i2c_tx)(struct _i2c_handle_t* handle , app_i2c_cfg *cfg, u16 reg, u16 data);
/** @brief Read single data from device.
@param[in] handle Handle to isp i2c api.
@param[in] cfg I2C config, fmd and address are necessary in this stage.
@param[in] reg Device register address address width depend on cfg->fmt.
@param[out] data Data buffer for read, data width depend on cfg->fmt.
@retval SENSOR_I2C_SUCCESS or SENSOR_I2C_FAIL if error occurs.
*/
int (*i2c_rx)(struct _i2c_handle_t* handle, app_i2c_cfg *cfg, u16 reg, volatile u16 *data);
/** @brief Batch write to device.
@param[in] handle Handle to isp i2c api.
@param[in] cfg I2C config, fmd and address are necessary in this stage.
@param[in] pdata Data array.
@param[in] len Array size.
@retval SENSOR_I2C_SUCCESS or SENSOR_I2C_FAIL if error occurs.
*/
int (*i2c_array_tx)(struct _i2c_handle_t* handle, app_i2c_cfg *cfg, I2C_ARRAY *pdata, u32 len);
/** @brief Burst write to device.
@param[in] handle Handle to isp i2c api.
@param[in] cfg I2C config, fmd and address are necessary in this stage.
@param[in] pdata Data array.
@param[in] len Array size.
@retval SENSOR_I2C_SUCCESS or SENSOR_I2C_FAIL if error occurs.
*/
int (*i2c_burst_tx)(struct _i2c_handle_t* handle, app_i2c_cfg *cfg, I2C_ARRAY_BURST *pdata, u32 len);
int (*i2c_burst_rx)(struct _i2c_handle_t* handle, app_i2c_cfg *cfg, I2C_ARRAY_BURST *pdata, u32 len);
/** @brief Batch read from device.
@param[in] handle Handle to isp i2c api.
@param[in] cfg I2C config, fmd and address are necessary in this stage.
@param[out] pdata Data array.
@param[in] len Array size.
@retval SENSOR_I2C_SUCCESS or SENSOR_I2C_FAIL if error occurs.
*/
int (*i2c_array_rx)(struct _i2c_handle_t* handle, app_i2c_cfg *cfg, I2C_ARRAY *pdata, u32 len);
/** @brief Composite batch read/write
@param[in] handle Handle to isp i2c api.
@param[in] cfg I2C config, fmd and address are necessary in this stage.
@param[in][out] pdata Data description array.
@param[in] len Array size.
@retval SENSOR_I2C_SUCCESS or SENSOR_I2C_FAIL if error occurs.
*/
int (*i2c_array_rw)(struct _i2c_handle_t* handle, app_i2c_cfg *cfg, I2C_CPX_ARRAY *pdata, u32 len);
} i2c_handle_t;
/** @} */ // end of ISP I2C API
#endif