add sifarsdk source code.
This commit is contained in:
parent
66ab3359d5
commit
a586e32967
10
code/application/sifarsdk/.gitignore
vendored
Normal file
10
code/application/sifarsdk/.gitignore
vendored
Normal file
|
@ -0,0 +1,10 @@
|
|||
.vscode
|
||||
cmake-shell-linux/
|
||||
external/gtest/googletest-release-1.11.0/
|
||||
external/openssl/openssl-1.1.1s/
|
||||
external/openssl/openssl-3.1.0/
|
||||
external/openssl/build/
|
||||
external/curl/curl-8.1.2/
|
||||
test/testReport/allTest
|
||||
test/testReport/allTest.html
|
||||
out/
|
19
code/application/sifarsdk/333DE/333DE_design.md
Normal file
19
code/application/sifarsdk/333DE/333DE_design.md
Normal file
|
@ -0,0 +1,19 @@
|
|||
# 1. Sigmastart平台333DE芯片设计文档
|
||||
|
||||
## 1.1. 概述
|
||||
   在SifarSDK的基础上,进行跨平台的代码适配设计和开发。
|
||||
|
||||
## 1.2. UML类图
|
||||
|
||||
## 1.3. 双核机制
|
||||
|
||||
### 1.3.1. rtos的参数怎么传递给linux?
|
||||
一共有3种类型的宏定义
|
||||
1. CONFIG_IOCTL_MSYS_GET_MODULE_HW_PHY//配置此参数可传给linux(是否配置此功能);kernel\drivers\sstar\msys,ms_msys.c里定义
|
||||
2. IOCTL_MSYS_GET_MODULE_DATA,2处需要定义(内存地址的标识号)
|
||||
alkaid/kernel/drivers/sstar/include/mdrv_msys_io.h;
|
||||
alkaid/sdk/verify/Cardvimpl/cardv/inc/module_common.h
|
||||
ms_msys.c使用,linux下module_video.cpp使用
|
||||
1. INTEROS_SC_R2L_MODULE_HW_PHY,2处需要定义(共享内存的地址)
|
||||
kernel\drivers\sstar\msys,ms_msys.c 里定义和使用
|
||||
rtk\proj\sc\application\rtos_preload,rtos_preload.c 里定义和使用
|
14
code/application/sifarsdk/333DE/CMakeLists.txt
Normal file
14
code/application/sifarsdk/333DE/CMakeLists.txt
Normal file
|
@ -0,0 +1,14 @@
|
|||
|
||||
# cmake_minimum_required(VERSION 2.8.0)
|
||||
|
||||
link_directories(
|
||||
${LIBS_OUTPUT_PATH}
|
||||
${PLATFORM_PATH}/lib/mi_libs/static
|
||||
${PLATFORM_PATH}/lib/ex_libs/static
|
||||
)
|
||||
|
||||
add_subdirectory(application)
|
||||
add_subdirectory(hal)
|
||||
add_subdirectory(test)
|
||||
|
||||
|
9
code/application/sifarsdk/333DE/Makefile
Normal file
9
code/application/sifarsdk/333DE/Makefile
Normal file
|
@ -0,0 +1,9 @@
|
|||
cmake:
|
||||
$(MAKE) -C ./build/cmake all
|
||||
all:cmake
|
||||
$(MAKE) -C ../cmake-shell-linux all
|
||||
sf_cs_app:cmake
|
||||
$(MAKE) -C ../cmake-shell-linux sf_cs_app
|
||||
$(MAKE) -C ../cmake-shell-linux SifarSDK_libs
|
||||
clean:
|
||||
$(MAKE) -C ../ clean
|
37
code/application/sifarsdk/333DE/README.md
Normal file
37
code/application/sifarsdk/333DE/README.md
Normal file
|
@ -0,0 +1,37 @@
|
|||
# 1. 333DE芯片平台代码工程
|
||||
|
||||
## 1.1. 概述
|
||||
   该目录存放333DE芯片平台的代码,主要是依赖原厂SDK接口的适配代码。该目录必须依赖SifarSDK源码目录才能完成项目构建。
|
||||
|
||||
|
||||
   详见333DE_design.md
|
||||
|
||||
|
||||
## 1.2. 编译:
|
||||
工程师在开发应用程序时使用下述指令进行编译。在333DE目录下执行命令:
|
||||
|
||||
make cmake
|
||||
|
||||
cd ../cmake-shell-linux/
|
||||
|
||||
make
|
||||
|
||||
## 1.3. 一键编译并拷贝输出文件
|
||||
|
||||
芯片SDK依赖SifarSDK构建烧录文件时,遵循下述流程:
|
||||
1. 拉取SifarSDK源码,在SDK的存放目录没有限制;
|
||||
2. 需要在合适的编译环节编译SifarSDK,在cmake-shell-linux目录执行make sf_cs_app即可;此时生成sf_cs_app可执行文件在out/bin/目录下;
|
||||
3. 芯片SDK拷贝out/bin/sf_cs_app到打包目录,并根据芯片打包脚本进行烧录文件打包;
|
||||
|
||||
Makefile解析:
|
||||
```
|
||||
cmake:
|
||||
$(MAKE) -C ./build/cmake all
|
||||
all:cmake
|
||||
$(MAKE) -C ../cmake-shell-linux all
|
||||
sf_cs_app:cmake // 芯片SDK可编译此目标完成可执行文件和依赖库的输出
|
||||
$(MAKE) -C ../cmake-shell-linux sf_cs_app
|
||||
$(MAKE) -C ../cmake-shell-linux SifarSDK_libs
|
||||
clean:
|
||||
$(MAKE) -C ../ clean
|
||||
```
|
|
@ -0,0 +1,5 @@
|
|||
|
||||
# cmake_minimum_required(VERSION 2.8.0)
|
||||
add_subdirectory(main)
|
||||
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
include(${CMAKE_SOURCE_DIR}/build/global_config.cmake)
|
||||
set(EXECUTABLE_OUTPUT_PATH ${EXEC_OUTPUT_PATH})
|
||||
set(LIBRARY_OUTPUT_PATH ${LIBS_OUTPUT_PATH})
|
||||
|
||||
set(MAIN_INCLUDE_PATH "${MAIN_INCLUDE_PATH};${PLATFORM_PATH}/application/main/src" CACHE STRING INTERNAL FORCE)
|
||||
set(MAIN_INCLUDE_PATH "${MAIN_INCLUDE_PATH};${PLATFORM_PATH}/hal/include" CACHE STRING INTERNAL FORCE)
|
||||
include_directories(
|
||||
${MAIN_INCLUDE_PATH}
|
||||
)
|
||||
|
||||
link_directories(
|
||||
${LIBS_OUTPUT_PATH}
|
||||
${PLATFORM_PATH}/lib/mi_libs/static
|
||||
)
|
||||
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
|
||||
aux_source_directory(./ SRC_FILES)
|
||||
|
||||
file(GLOB_RECURSE MAIN_SRC_FILE_THIS src/*.cpp src/*.c)
|
||||
set(MAIN_SRC_FILE "${MAIN_SRC_FILE};${MAIN_SRC_FILE_THIS}" CACHE STRING INTERNAL FORCE)
|
||||
|
||||
set(TARGET_NAME hunting_333DE)
|
||||
add_executable(${TARGET_NAME} ${SRC_FILES} ${MAIN_SRC_FILE})
|
||||
|
||||
# set(LINK_LIB HalChipBoard)
|
||||
set(MAIN_LINK_LIB "${MAIN_LINK_LIB};${LINK_LIB}" CACHE STRING INTERNAL FORCE)
|
||||
target_link_libraries(${TARGET_NAME} ${MAIN_LINK_LIB} HalChipBoard)
|
||||
|
||||
add_custom_target(
|
||||
sf_cs_app
|
||||
COMMAND echo "Make sf_cs_app."
|
||||
DEPENDS hunting_333DE
|
||||
COMMAND arm-linux-gnueabihf-9.1.0-strip ${EXEC_OUTPUT_PATH}/*
|
||||
COMMAND cp ${EXEC_OUTPUT_PATH}/hunting_333DE ${EXEC_OUTPUT_PATH}/sf_cs_app
|
||||
WORKING_DIRECTORY ${PROJECT_ROOT_PATH}/
|
||||
)
|
25
code/application/sifarsdk/333DE/application/main/main.cpp
Normal file
25
code/application/sifarsdk/333DE/application/main/main.cpp
Normal file
|
@ -0,0 +1,25 @@
|
|||
#include "MainThread.h"
|
||||
#include "Log.h"
|
||||
#include "ChipBoardMainThread.h"
|
||||
#include <thread>
|
||||
#include <dlfcn.h>
|
||||
|
||||
static void OpenCustomizationMainThread(void)
|
||||
{
|
||||
}
|
||||
static void ReleaseCustomizationMainThread(void)
|
||||
{
|
||||
}
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
std::shared_ptr<MainThread> mainThread = std::make_shared<ChipBoardMainThread>();
|
||||
MainThread::GetInstance(&mainThread);
|
||||
|
||||
OpenCustomizationMainThread();
|
||||
MainThread::GetInstance()->Init();
|
||||
LogInfo("333DE start.\n");
|
||||
MainThread::GetInstance()->Runing();
|
||||
MainThread::GetInstance()->UnInit();
|
||||
ReleaseCustomizationMainThread();
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
#include "ChipBoardMainThread.h"
|
||||
#include "IHal333DE.h"
|
||||
void ChipBoardMainThread::CustomizationInit(void)
|
||||
{
|
||||
Hal333DEMakePtrOverride();
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
#ifndef CHIP_BOARD_MAIN_THREAD_H
|
||||
#define CHIP_BOARD_MAIN_THREAD_H
|
||||
#include "MainThread.h"
|
||||
class ChipBoardMainThread : public MainThread
|
||||
{
|
||||
public:
|
||||
ChipBoardMainThread() = default;
|
||||
~ChipBoardMainThread() = default;
|
||||
void CustomizationInit(void) override;
|
||||
};
|
||||
#endif // !CHIP_BOARD_MAIN_THREAD_H
|
3
code/application/sifarsdk/333DE/build/README.md
Normal file
3
code/application/sifarsdk/333DE/build/README.md
Normal file
|
@ -0,0 +1,3 @@
|
|||
# cmake编译配置
|
||||
## 目录
|
||||
./toolchain:配置交叉编译工具链
|
8
code/application/sifarsdk/333DE/build/cmake/Makefile
Normal file
8
code/application/sifarsdk/333DE/build/cmake/Makefile
Normal file
|
@ -0,0 +1,8 @@
|
|||
all:
|
||||
@mkdir -p ../../../cmake-shell-linux;\
|
||||
cd ../../../cmake-shell-linux;\
|
||||
pwd;\
|
||||
cmake -DCMAKE_TOOLCHAIN_FILE="./333DE/build/cmake/toolchain/sigmastart_333DE.toolchain.cmake" ..;\
|
||||
cd ..
|
||||
clean:
|
||||
rm -rf ../../cmake-shell-linux
|
2
code/application/sifarsdk/333DE/build/cmake/README.md
Normal file
2
code/application/sifarsdk/333DE/build/cmake/README.md
Normal file
|
@ -0,0 +1,2 @@
|
|||
# cmake
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
|
||||
INCLUDE(CMakeForceCompiler)
|
||||
|
||||
set(CMAKE_C_COMPILER arm-linux-gnueabihf-9.1.0-gcc)
|
||||
set(CMAKE_CXX_COMPILER arm-linux-gnueabihf-9.1.0-g++)
|
||||
# set(CMAKE_C_COMPILER gcc)
|
||||
# set(CMAKE_CXX_COMPILER g++)
|
||||
|
||||
|
||||
# path to compiler and utilities
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
||||
|
||||
|
||||
|
||||
|
||||
# Name of the target platform
|
||||
set(CMAKE_SYSTEM_NAME Linux)
|
||||
set(CMAKE_SYSTEM_PROCESSOR arm)
|
||||
|
||||
# Version of the system
|
||||
set(CMAKE_SYSTEM_VERSION 1)
|
||||
|
||||
|
||||
add_definitions(-Wall -O2 -Os)
|
||||
add_definitions(-Wno-unused-local-typedefs)
|
||||
add_definitions(-Wstrict-aliasing -Wwrite-strings)
|
||||
|
||||
|
||||
set(TOOLCHAIN_NAME arm-linux-gnueabihf)
|
||||
|
||||
set(PROJECT_333DE_PATH "${CMAKE_SOURCE_DIR}")
|
||||
set(TARGET_PLATFORM "sigmastart_333DE")
|
||||
# set(TARGET_PLATFORM "linux")
|
||||
set(PLATFORM_PATH "${CMAKE_SOURCE_DIR}/333DE")
|
||||
set(AT_COMMAND_PATH "${CMAKE_SOURCE_DIR}/at-command/eg91")
|
||||
set(COVERAGE_ON "false")
|
||||
set(LIVE_PLATFORM_SRC_PATH "ali_live")
|
||||
set(AT_COMMAND_SRC_PATH "eg91")
|
||||
set(CONFIG_FILE_PATH "/misc/sfSysParm.bin")
|
||||
set(CONFIG_FILE_STATIC_PATH "/mnt/mmc/DCIM/THUMB/sfStatisticsParm.bin")
|
||||
set(SF_DCF_EXT_PHOTO "jpg")
|
||||
set(SF_DCF_EXT_MOV "mp4")
|
||||
set(SF_SD_ROOT "/mnt/mmc/")
|
||||
set(SF_DCF_DIR_NAME_SUFFIX "SYCAM")
|
||||
set(SF_DCF_ROOT_DIR_NAME "DCIM")
|
||||
set(SF_DCF_THM_DIR_NAME "THUMB")
|
||||
set(SF_DCF_FILE_NAME_PREFIX "HRTP")
|
||||
|
||||
|
||||
# ------------ build curl + openssl ------------ start
|
||||
set(CROSS_COMPILE_PREFIX "arm-linux-gnueabihf-9.1.0-")
|
||||
set(CURL_OPENSSL_LIB_SHARED_ENABLE "false")
|
||||
set(CURL_SHARED_LIBS_PATH "/mnt/mmc")
|
||||
# ------------ build curl + openssl ------------ end
|
31
code/application/sifarsdk/333DE/build_333de.sh
Executable file
31
code/application/sifarsdk/333DE/build_333de.sh
Executable file
|
@ -0,0 +1,31 @@
|
|||
#!/bin/bash
|
||||
# 编译打猎相机并拷贝输出文件到指定目录
|
||||
# 用法:./build_333de.sh + path
|
||||
# example: ./build_333de.sh /home/xiaojiazhu/project_codes/sifarsdk
|
||||
# CP_PATH=$1
|
||||
# echo "Compile 333DE, target will copy to = $CP_PATH."
|
||||
export ROOT_PATH=$PWD
|
||||
make clean;
|
||||
make cmake;
|
||||
cd ../cmake-shell-linux;
|
||||
make sf_cs_app -j8;
|
||||
make SifarSDK_libs
|
||||
# SIFARSDK_OUT=$CP_PATH/SifarSDK_output
|
||||
# SIFARSDK_INCLUDE=$SIFARSDK_OUT/include
|
||||
# SIFARSDK_CONFIG=$SIFARSDK_OUT/Config
|
||||
# SIFARSDK_LIBS=$SIFARSDK_OUT/libs
|
||||
# SIFARSDK_BIN=$SIFARSDK_OUT/bin
|
||||
# mkdir $SIFARSDK_OUT
|
||||
# mkdir $SIFARSDK_INCLUDE
|
||||
# mkdir $SIFARSDK_CONFIG
|
||||
# mkdir $SIFARSDK_LIBS
|
||||
# mkdir $SIFARSDK_BIN
|
||||
# cp ../out/bin/sf_cs_app $SIFARSDK_BIN
|
||||
# cp ../out/libs/libReturnCode.a $SIFARSDK_LIBS
|
||||
# cp ../out/libs/libLog.a $SIFARSDK_LIBS
|
||||
# cp ../out/libs/libConfig.a $SIFARSDK_LIBS
|
||||
# cp ../component/Config/include/* $SIFARSDK_INCLUDE
|
||||
# cp ../component/Config/README.md $SIFARSDK_CONFIG
|
||||
cd $ROOT_PATH
|
||||
# echo "Target was copied to = $CP_PATH."
|
||||
echo "Exit build_gtest.sh."
|
29
code/application/sifarsdk/333DE/hal/CMakeLists.txt
Normal file
29
code/application/sifarsdk/333DE/hal/CMakeLists.txt
Normal file
|
@ -0,0 +1,29 @@
|
|||
|
||||
include(${CMAKE_SOURCE_DIR}/build/global_config.cmake)
|
||||
set(EXECUTABLE_OUTPUT_PATH ${EXEC_OUTPUT_PATH})
|
||||
set(LIBRARY_OUTPUT_PATH ${LIBS_OUTPUT_PATH})
|
||||
|
||||
include_directories(
|
||||
./
|
||||
${HAL_SOURCE_PATH}
|
||||
${HAL_SOURCE_PATH}/include
|
||||
${COMPONENT_SOURCE_PATH}/ReturnCode/include
|
||||
${COMPONENT_SOURCE_PATH}/Log/include
|
||||
${COMPONENT_SOURCE_PATH}/Common/include
|
||||
${COMPONENT_SOURCE_PATH}/utils/include
|
||||
${PLATFORM_PATH}/lib/mi_libs/include
|
||||
)
|
||||
#do not rely on any other library
|
||||
link_directories(
|
||||
${PLATFORM_PATH}/lib/mi_libs/static
|
||||
)
|
||||
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
|
||||
aux_source_directory(./ SRC_FILES)
|
||||
|
||||
set(TARGET_NAME HalChipBoard)
|
||||
add_library(${TARGET_NAME} STATIC ${SRC_FILES})
|
||||
|
||||
target_link_libraries(${TARGET_NAME} Hal ReturnCode Log -Wl,--gc-sections -Wl,--start-group mi_venc mi_sys mi_ai cam_os_wrapper cam_fs_wrapper -Wl,--end-group)
|
393
code/application/sifarsdk/333DE/hal/CameraChip333DE.cpp
Normal file
393
code/application/sifarsdk/333DE/hal/CameraChip333DE.cpp
Normal file
|
@ -0,0 +1,393 @@
|
|||
#include "CameraChip333DE.h"
|
||||
#include "IHalCommon.h"
|
||||
#include "Log.h"
|
||||
#include "SfTypeDefine.h"
|
||||
#include <thread>
|
||||
#include <string.h>
|
||||
CameraChip333DE::CameraChip333DE() : ShareMem("/tmp/sf_file")
|
||||
{
|
||||
pThumbFileCfg = nullptr;
|
||||
mOwnerStartedTask = false;
|
||||
mAudioRuning = false;
|
||||
mVideoRuning = false;
|
||||
}
|
||||
void CameraChip333DE::Init(void)
|
||||
{
|
||||
ShareMem::Create(sizeof(SF_SRCFILE_ATTR_S));
|
||||
pThumbFileCfg = (SF_SRCFILE_ATTR_S *)ShareMem::Get();
|
||||
if (!pThumbFileCfg)
|
||||
{
|
||||
LogError("Creat share mem failed!!!\n");
|
||||
}
|
||||
Message333DE::GetInstance()->SetCameraMessageHandle(shared_from_this());
|
||||
}
|
||||
void CameraChip333DE::UnInit(void)
|
||||
{
|
||||
ShareMem::Destory();
|
||||
}
|
||||
void CameraChip333DE::CameraTaskMessageResponse(void)
|
||||
{
|
||||
std::vector<CameraFileMessage> files;
|
||||
if (pThumbFileCfg)
|
||||
{
|
||||
LogInfo("Count = %d.\n", pThumbFileCfg->filecnt);
|
||||
for (int i = 0; i < pThumbFileCfg->filecnt; i++)
|
||||
{
|
||||
CameraFileMessage file;
|
||||
LogInfo("enFileTye = %d.\n", pThumbFileCfg->stfileattr[i].enFileTye);
|
||||
file.enFileTye = pThumbFileCfg->stfileattr[i].enFileTye;
|
||||
file.mThumbFileName = pThumbFileCfg->stfileattr[i].thumbfileName;
|
||||
file.mThumbFilePath = pThumbFileCfg->stfileattr[i].thumbfilePath;
|
||||
files.push_back(file);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LogError("pThumbFileCfg is nullptr.\n");
|
||||
return;
|
||||
}
|
||||
if (!GetTaskRuning())
|
||||
{
|
||||
LogInfo("Camera upload files spontaneously without owner send task.");
|
||||
AddSpontaneousFiles(files);
|
||||
return;
|
||||
}
|
||||
auto owner = mOwner.lock();
|
||||
if (!owner)
|
||||
{
|
||||
LogWarning("Owner is nullptr.\n");
|
||||
return;
|
||||
}
|
||||
if (mOwner.expired())
|
||||
{
|
||||
LogWarning("Owner shared ptr expired failed.\n");
|
||||
return;
|
||||
}
|
||||
TaskFinshed();
|
||||
owner->CameraFinshTask(files);
|
||||
}
|
||||
RETURN_CODE CameraChip333DE::SetCameraOwner(std::shared_ptr<VCameraHalOwner> &owner)
|
||||
{
|
||||
mOwner = owner;
|
||||
return VReturnCode::NewCode(VReturnCodeDefine::OK);
|
||||
}
|
||||
RETURN_CODE CameraChip333DE::StartSingleTask(const CameraTaskData &data)
|
||||
{
|
||||
if (!SetTaskRuning())
|
||||
{
|
||||
LogWarning("CameraChip333DE only run single task, please retry later.\n");
|
||||
return VReturnCode::NewCode(VReturnCodeDefine::NOT_OK_UNDEFINE_REASON);
|
||||
}
|
||||
int result = -1;
|
||||
// SF_MESSAGE_BUF_S stMessageBuf = {0};
|
||||
// stMessageBuf.cmdId = 0x0112;
|
||||
// stMessageBuf.arg1 = data.mIsNight;
|
||||
// Message333DE::GetInstance()->MessageQueueSend(&stMessageBuf);
|
||||
signed char isNight = data.mIsNight;
|
||||
Message333DE::GetInstance()->sf_cardv_message_send(0x0112, &(isNight), sizeof(isNight));
|
||||
switch (data.mType)
|
||||
{
|
||||
case CameraTaskType::PICTURE:
|
||||
{
|
||||
LogInfo("Camera task PICTURE\n");
|
||||
if (data.mMultiShot <= 1)
|
||||
{
|
||||
result = system("echo rtkmode 0 > /tmp/cardv_fifo");
|
||||
LogInfo("system result = %d\n", result);
|
||||
}
|
||||
else
|
||||
{
|
||||
result = system("echo rtkmode 2 > /tmp/cardv_fifo");
|
||||
LogInfo("system result = %d\n", result);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case CameraTaskType::VIDEO:
|
||||
{
|
||||
LogInfo("Camera task VIDEO\n");
|
||||
result = system("echo rtkmode 3 > /tmp/cardv_fifo");
|
||||
LogInfo("system result = %d\n", result);
|
||||
break;
|
||||
}
|
||||
case CameraTaskType::PICTURE_AND_VIDEO:
|
||||
{
|
||||
LogInfo("Camera task PICTURE_AND_VIDEO\n");
|
||||
if (data.mMultiShot <= 1)
|
||||
{
|
||||
result = system("echo rtkmode 4 > /tmp/cardv_fifo");
|
||||
LogInfo("system result = %d\n", result);
|
||||
}
|
||||
else
|
||||
{
|
||||
result = system("echo rtkmode 6 > /tmp/cardv_fifo");
|
||||
LogInfo("system result = %d\n", result);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return VReturnCode::NewCode(VReturnCodeDefine::OK);
|
||||
}
|
||||
bool CameraChip333DE::SetTaskRuning(void)
|
||||
{
|
||||
std::lock_guard<std::mutex> locker(mMutex);
|
||||
if (mOwnerStartedTask)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
mOwnerStartedTask = true;
|
||||
return true;
|
||||
}
|
||||
bool CameraChip333DE::GetTaskRuning(void)
|
||||
{
|
||||
std::lock_guard<std::mutex> locker(mMutex);
|
||||
return mOwnerStartedTask;
|
||||
}
|
||||
void CameraChip333DE::TaskFinshed(void)
|
||||
{
|
||||
std::lock_guard<std::mutex> locker(mMutex);
|
||||
mOwnerStartedTask = false;
|
||||
}
|
||||
void CameraChip333DE::AddSpontaneousFiles(const std::vector<CameraFileMessage> &files)
|
||||
{
|
||||
std::lock_guard<std::mutex> locker(mMutex);
|
||||
std::copy(files.begin(), files.end(), std::back_inserter(mSpontaneousFiles));
|
||||
}
|
||||
void CameraChip333DE::CheckSpontaneousFilesToUpload(void)
|
||||
{
|
||||
std::lock_guard<std::mutex> locker(mMutex);
|
||||
if (mSpontaneousFiles.size() == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
auto owner = mOwner.lock();
|
||||
if (!owner)
|
||||
{
|
||||
LogWarning("Owner is nullptr.\n");
|
||||
return;
|
||||
}
|
||||
if (mOwner.expired())
|
||||
{
|
||||
LogWarning("Owner shared ptr expired failed.\n");
|
||||
return;
|
||||
}
|
||||
LogInfo("Camera upload spontaneous files.\n");
|
||||
owner->SpontaneousTaskFromCamera(mSpontaneousFiles);
|
||||
mSpontaneousFiles.clear();
|
||||
}
|
||||
RETURN_CODE CameraChip333DE::StopTask(void)
|
||||
{
|
||||
// SF_MESSAGE_BUF_S stMessageBuf = {0};
|
||||
// stMessageBuf.cmdId = 0x0111;
|
||||
// Message333DE::GetInstance()->MessageQueueSend(&stMessageBuf);
|
||||
Message333DE::GetInstance()->sf_cardv_message_send(0x0111, nullptr, 0);
|
||||
return VReturnCode::NewCode(VReturnCodeDefine::OK);
|
||||
}
|
||||
RETURN_CODE CameraChip333DE::SetNightMode(const bool &isNight)
|
||||
{
|
||||
constexpr int IS_NIGHT = 1;
|
||||
constexpr int IS_NOT_NIGHT = 0;
|
||||
// SF_MESSAGE_BUF_S stMessageBuf = {0};
|
||||
// stMessageBuf.cmdId = 0x0112;
|
||||
// stMessageBuf.arg1 = isNight ? IS_NIGHT : IS_NOT_NIGHT;
|
||||
// Message333DE::GetInstance()->MessageQueueSend(&stMessageBuf);
|
||||
signed char param = isNight ? IS_NIGHT : IS_NOT_NIGHT;
|
||||
Message333DE::GetInstance()->sf_cardv_message_send(0x0112, &(param), sizeof(param));
|
||||
return VReturnCode::NewCode(VReturnCodeDefine::OK);
|
||||
}
|
||||
RETURN_CODE CameraChip333DE::HalBeReadyForLive(void)
|
||||
{
|
||||
system("echo p2p 1 > /tmp/cardv_fifo");
|
||||
return VReturnCode::NewCode(VReturnCodeDefine::OK);
|
||||
}
|
||||
void CameraChip333DE::sf_venc_stream_start(void)
|
||||
{
|
||||
auto videoStart = [](std::shared_ptr<CameraChip333DE> camera)
|
||||
{
|
||||
camera->_VideoUserGetFrame();
|
||||
};
|
||||
mVideoRuning = true;
|
||||
mVideoThread = std::thread(videoStart, shared_from_this());
|
||||
}
|
||||
void CameraChip333DE::sf_venc_stream_stop(void)
|
||||
{
|
||||
mVideoRuning = false;
|
||||
if (mVideoThread.joinable())
|
||||
{
|
||||
mVideoThread.join();
|
||||
}
|
||||
}
|
||||
void CameraChip333DE::sf_audio_stream_start(void)
|
||||
{
|
||||
auto audioStart = [](std::shared_ptr<CameraChip333DE> camera)
|
||||
{
|
||||
camera->_VideoUserGetFrame();
|
||||
};
|
||||
mAudioRuning = true;
|
||||
mAudioThread = std::thread(audioStart, shared_from_this());
|
||||
}
|
||||
void CameraChip333DE::sf_audio_stream_stop(void)
|
||||
{
|
||||
mAudioRuning = false;
|
||||
if (mAudioThread.joinable())
|
||||
{
|
||||
mAudioThread.join();
|
||||
}
|
||||
}
|
||||
MI_S32 CameraChip333DE::_VideoUserGetFrame(void)
|
||||
{
|
||||
auto owner = mOwner.lock();
|
||||
if (!owner)
|
||||
{
|
||||
LogWarning("Owner is nullptr.\n");
|
||||
return -1;
|
||||
}
|
||||
if (mOwner.expired())
|
||||
{
|
||||
LogWarning("Owner shared ptr expired failed.\n");
|
||||
return -1;
|
||||
}
|
||||
MI_S32 _s32VencChn = 0;
|
||||
MI_VENC_DupChn(_s32VencChn);
|
||||
MI_VENC_ChnStat_t stStat;
|
||||
MI_VENC_Stream_t *pstStream = NULL;
|
||||
MI_S32 s32Ret;
|
||||
MI_U32 u32FrameSize;
|
||||
while (mVideoRuning)
|
||||
{
|
||||
memset(&stStat, 0, sizeof(MI_VENC_ChnStat_t));
|
||||
s32Ret = MI_VENC_Query(_s32VencChn, &stStat);
|
||||
if (MI_SUCCESS != s32Ret || stStat.u32CurPacks == 0)
|
||||
{
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
||||
continue;
|
||||
}
|
||||
|
||||
pstStream = (MI_VENC_Stream_t *)malloc(sizeof(MI_VENC_Stream_t));
|
||||
if (pstStream == NULL)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
pstStream->u32PackCount = STREAM_PACK_CNT;
|
||||
pstStream->pstPack = (MI_VENC_Pack_t *)malloc(sizeof(MI_VENC_Pack_t) * STREAM_PACK_CNT);
|
||||
if (pstStream->pstPack == NULL)
|
||||
{
|
||||
free(pstStream);
|
||||
pstStream = NULL;
|
||||
break;
|
||||
}
|
||||
memset(pstStream->pstPack, 0, sizeof(MI_VENC_Pack_t) * STREAM_PACK_CNT);
|
||||
|
||||
s32Ret = MI_VENC_GetStream(_s32VencChn, pstStream, 0);
|
||||
if (MI_SUCCESS == s32Ret)
|
||||
{
|
||||
// stStat.u32CurPacks is from first frame in ring pool,
|
||||
// but we need get current frame info here, and we maybe already get more than one frame here.
|
||||
// so we need to calculate current frame packet count.
|
||||
pstStream->u32PackCount = 0;
|
||||
while (pstStream->pstPack[pstStream->u32PackCount++].bFrameEnd == 0)
|
||||
{
|
||||
if (pstStream->u32PackCount == STREAM_PACK_CNT)
|
||||
{
|
||||
printf("STREAM_PACK_CNT not enough\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
u32FrameSize = 0;
|
||||
for (int i = 0; i < STREAM_PACK_CNT; i++)
|
||||
{
|
||||
u32FrameSize += pstStream->pstPack[i].u32Len;
|
||||
}
|
||||
|
||||
// VideoUserGetFrame(pstStream->pstPack, u32FrameSize, pstStream->pstPack[pstStream->u32PackCount - 1].u64PTS);
|
||||
for (int i = 0; i < STREAM_PACK_CNT && pstStream->pstPack[i].u32Len; i++)
|
||||
{
|
||||
// sf_ipc_live_VideoStream_write((char *)pstPack[i].pu8Addr, pstPack[i].u32Len, framePts, pstPack[i].stDataType.eH265EType);
|
||||
owner->VideoStream_write((char *)pstStream->pstPack[i].pu8Addr, pstStream->pstPack[i].u32Len, u32FrameSize, pstStream->pstPack[i].stDataType.eH265EType);
|
||||
}
|
||||
|
||||
MI_VENC_ReleaseStream(_s32VencChn, pstStream);
|
||||
free(pstStream->pstPack);
|
||||
free(pstStream);
|
||||
pstStream->pstPack = NULL;
|
||||
pstStream = NULL;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
void CameraChip333DE::VideoUserGetFrame(MI_VENC_Pack_t *pstPack, MI_U32 u32FrameSize, MI_U64 framePts) // TODO: delete
|
||||
{
|
||||
// Customers TODO:
|
||||
// Customers need to implement this function according to their own need.
|
||||
// Note that the function runs as short as possible, or it maybe drops frame!
|
||||
// Here SigmaStar just dump 300 frames to file for demo.
|
||||
for (int i = 0; i < STREAM_PACK_CNT && pstPack[i].u32Len; i++)
|
||||
{
|
||||
// sf_ipc_live_VideoStream_write((char *)pstPack[i].pu8Addr, pstPack[i].u32Len, framePts, pstPack[i].stDataType.eH265EType);
|
||||
}
|
||||
}
|
||||
MI_S32 CameraChip333DE::_AudioUserGetFrame(void)
|
||||
{
|
||||
MI_AI_CHN AiChn = 0;
|
||||
MI_AUDIO_DEV AiDevId = 0;
|
||||
sf_audio_frame_get(AiChn, AiDevId);
|
||||
|
||||
return 0;
|
||||
}
|
||||
SINT32 CameraChip333DE::sf_audio_frame_get(UINT8 AiDevId, UINT8 AiChn)
|
||||
{
|
||||
auto owner = mOwner.lock();
|
||||
if (!owner)
|
||||
{
|
||||
LogWarning("Owner is nullptr.\n");
|
||||
return -1;
|
||||
}
|
||||
if (mOwner.expired())
|
||||
{
|
||||
LogWarning("Owner shared ptr expired failed.\n");
|
||||
return -1;
|
||||
}
|
||||
MI_S32 ret;
|
||||
MI_AUDIO_Frame_t stAiChFrame;
|
||||
MI_AUDIO_AecFrame_t stAecFrame;
|
||||
|
||||
MI_AI_DupChn(AiDevId, AiChn);
|
||||
|
||||
while (mAudioRuning)
|
||||
{
|
||||
ret = MI_AI_GetFrame(AiDevId, AiChn, &stAiChFrame, &stAecFrame, 0);
|
||||
if (MI_SUCCESS != ret)
|
||||
continue;
|
||||
|
||||
if (0 < stAiChFrame.u32Len[0])
|
||||
{
|
||||
// sf_audioInUserGetFrame(&stAiChFrame, &stAecFrame);
|
||||
owner->AudioStream_write((char *)(&stAiChFrame)->apVirAddr[0], (&stAiChFrame)->u32Len[0], (&stAiChFrame)->u64TimeStamp);
|
||||
MI_AI_ReleaseFrame(AiDevId, AiChn, &stAiChFrame, &stAecFrame);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
void CameraChip333DE::sf_audioInUserGetFrame(MI_AUDIO_Frame_t *pstAudioFrame, MI_AUDIO_AecFrame_t *pstAecFrame) // TODO: delete
|
||||
{
|
||||
sf_ipc_live_AudioStream_write((char *)pstAudioFrame->apVirAddr[0], pstAudioFrame->u32Len[0], pstAudioFrame->u64TimeStamp);
|
||||
}
|
||||
int CameraChip333DE::sf_ipc_live_AudioStream_write(char *pu8Addr, UINT32 u32Len, UINT32 TimeStamp) // TODO: delete
|
||||
{
|
||||
auto owner = mOwner.lock(); // TODO: 影响效率
|
||||
if (!owner)
|
||||
{
|
||||
LogWarning("Owner is nullptr.\n");
|
||||
return -1;
|
||||
}
|
||||
if (mOwner.expired())
|
||||
{
|
||||
LogWarning("Owner shared ptr expired failed.\n");
|
||||
return -1;
|
||||
}
|
||||
owner->AudioStream_write(pu8Addr, u32Len, TimeStamp);
|
||||
return SF_SUCCESS;
|
||||
}
|
57
code/application/sifarsdk/333DE/hal/CameraChip333DE.h
Normal file
57
code/application/sifarsdk/333DE/hal/CameraChip333DE.h
Normal file
|
@ -0,0 +1,57 @@
|
|||
#ifndef CAMER_CHIP_333DE_H
|
||||
#define CAMER_CHIP_333DE_H
|
||||
#include "IHal.h"
|
||||
#include "MessageQueue.h"
|
||||
#include "ShareMem.h"
|
||||
#include "CameraHal.h"
|
||||
#include "Message333DE.h"
|
||||
#include "mi_venc.h"
|
||||
#include "mi_ai.h"
|
||||
#include <mutex>
|
||||
#include <thread>
|
||||
constexpr int STREAM_PACK_CNT = 2;
|
||||
class CameraChip333DE : public CameraHal, public ShareMem, public VCameraMessageHandle, public std::enable_shared_from_this<CameraChip333DE>
|
||||
{
|
||||
public:
|
||||
CameraChip333DE();
|
||||
virtual ~CameraChip333DE() = default;
|
||||
void Init(void) override;
|
||||
void UnInit(void) override;
|
||||
RETURN_CODE SetCameraOwner(std::shared_ptr<VCameraHalOwner> &owner) override;
|
||||
RETURN_CODE StartSingleTask(const CameraTaskData &data) override;
|
||||
void CameraTaskMessageResponse(void) override;
|
||||
void CheckSpontaneousFilesToUpload(void) override;
|
||||
RETURN_CODE StopTask(void) override;
|
||||
RETURN_CODE SetNightMode(const bool &isNight) override;
|
||||
RETURN_CODE HalBeReadyForLive(void) override;
|
||||
void sf_venc_stream_start(void) override;
|
||||
void sf_venc_stream_stop(void) override;
|
||||
void sf_audio_stream_start(void) override;
|
||||
void sf_audio_stream_stop(void) override;
|
||||
|
||||
private:
|
||||
bool SetTaskRuning(void);
|
||||
bool GetTaskRuning(void);
|
||||
void TaskFinshed(void);
|
||||
void AddSpontaneousFiles(const std::vector<CameraFileMessage> &files);
|
||||
|
||||
private:
|
||||
MI_S32 _VideoUserGetFrame(void);
|
||||
MI_S32 _AudioUserGetFrame(void);
|
||||
SINT32 sf_audio_frame_get(UINT8 AiDevId, UINT8 AiChn);
|
||||
void sf_audioInUserGetFrame(MI_AUDIO_Frame_t *pstAudioFrame, MI_AUDIO_AecFrame_t *pstAecFrame);
|
||||
int sf_ipc_live_AudioStream_write(char *pu8Addr, UINT32 u32Len, UINT32 TimeStamp);
|
||||
void VideoUserGetFrame(MI_VENC_Pack_t *pstPack, MI_U32 u32FrameSize, MI_U64 framePts);
|
||||
|
||||
private:
|
||||
SF_SRCFILE_ATTR_S *pThumbFileCfg;
|
||||
std::weak_ptr<VCameraHalOwner> mOwner;
|
||||
std::mutex mMutex;
|
||||
bool mOwnerStartedTask;
|
||||
std::vector<CameraFileMessage> mSpontaneousFiles;
|
||||
std::thread mAudioThread;
|
||||
std::thread mVideoThread;
|
||||
bool mAudioRuning;
|
||||
bool mVideoRuning;
|
||||
};
|
||||
#endif // !CAMER_CHIP_333DE_H
|
0
code/application/sifarsdk/333DE/hal/CameraHal.cpp
Normal file
0
code/application/sifarsdk/333DE/hal/CameraHal.cpp
Normal file
12
code/application/sifarsdk/333DE/hal/CameraHal.h
Normal file
12
code/application/sifarsdk/333DE/hal/CameraHal.h
Normal file
|
@ -0,0 +1,12 @@
|
|||
#ifndef CAMERA_HAL_H
|
||||
#define CAMERA_HAL_H
|
||||
#include "IHal.h"
|
||||
class CameraHal : public VCameraHal
|
||||
{
|
||||
public:
|
||||
CameraHal() = default;
|
||||
virtual ~CameraHal() = default;
|
||||
virtual void Init(void) {}
|
||||
virtual void UnInit(void) {}
|
||||
};
|
||||
#endif // !CAMERA_HAL_H
|
109
code/application/sifarsdk/333DE/hal/Gpio.cpp
Normal file
109
code/application/sifarsdk/333DE/hal/Gpio.cpp
Normal file
|
@ -0,0 +1,109 @@
|
|||
#include "Gpio.h"
|
||||
#include "Log.h"
|
||||
#include "linux_api.h"
|
||||
#include <string.h>
|
||||
|
||||
const char *GPIO_EXPORT = "/sys/class/gpio/export";
|
||||
const char *GPIO_EXPORT_MODE = "w";
|
||||
const char *GPIO_ID_DIR = "/sys/class/gpio/gpio%d/direction";
|
||||
const char *GPIO_DIR_MODE = "rb+";
|
||||
const char *GPIO_ID_VALUE = "/sys/class/gpio/gpio%d/value";
|
||||
const char *GPIO_UNEXPORT = "/sys/class/gpio/unexport";
|
||||
|
||||
SINT32 Gpio::GpioInit(const U32 &pinNum, const char *dir)
|
||||
{
|
||||
FILE *fp = nullptr;
|
||||
char file_name[64] = {0};
|
||||
if (dir == NULL)
|
||||
{
|
||||
LogError("pointer is NULL\n");
|
||||
return SF_FAILURE;
|
||||
}
|
||||
|
||||
fp = fopen(GPIO_EXPORT, GPIO_EXPORT_MODE);
|
||||
if (fp == NULL)
|
||||
{
|
||||
LogError("Cannot open %s.\n", GPIO_EXPORT);
|
||||
return SF_FAILURE;
|
||||
}
|
||||
|
||||
fprintf_gpio(fp, pinNum);
|
||||
linux_fclose(fp);
|
||||
sprintf(file_name, GPIO_ID_DIR, pinNum);
|
||||
fp = fopen(file_name, GPIO_DIR_MODE);
|
||||
if (fp == NULL)
|
||||
{
|
||||
LogError("Cannot open %s\n", file_name);
|
||||
return SF_FAILURE;
|
||||
}
|
||||
|
||||
fprintf_dir(fp, dir);
|
||||
|
||||
linux_fclose(fp);
|
||||
return SF_SUCCESS;
|
||||
}
|
||||
SINT32 Gpio::GpioSet(const U32 &pinNum, const U32 &nval)
|
||||
{
|
||||
FILE *fp = nullptr;
|
||||
char file_name[64] = {0};
|
||||
U8 buf[10] = {0};
|
||||
|
||||
sprintf(file_name, GPIO_ID_VALUE, pinNum);
|
||||
fp = fopen(file_name, "rb+");
|
||||
if (fp == NULL)
|
||||
{
|
||||
LogError("Cannot open %s.\n", file_name);
|
||||
return SF_FAILURE;
|
||||
}
|
||||
|
||||
if (nval == 0)
|
||||
strcpy((char *)buf, "0");
|
||||
else
|
||||
strcpy((char *)buf, "1");
|
||||
|
||||
fwrite(buf, sizeof(char), sizeof(buf) - 1, fp);
|
||||
linux_fclose(fp);
|
||||
|
||||
return SF_SUCCESS;
|
||||
}
|
||||
SINT32 Gpio::GpioGet(const U32 &pinNum, SINT8 &nval)
|
||||
{
|
||||
FILE *fp = nullptr;
|
||||
char file_name[64] = {0};
|
||||
U8 buf[10] = {0};
|
||||
int snval = 0;
|
||||
int nret = 0;
|
||||
|
||||
sprintf(file_name, GPIO_ID_VALUE, pinNum);
|
||||
fp = fopen(file_name, GPIO_DIR_MODE);
|
||||
if (fp == NULL)
|
||||
{
|
||||
LogError("Cannot open %s.\n", file_name);
|
||||
return SF_FAILURE;
|
||||
}
|
||||
nret = linux_fread(buf, sizeof(char), sizeof(buf) - 1, fp);
|
||||
linux_fclose(fp);
|
||||
|
||||
if (nret > 0)
|
||||
{
|
||||
snval = atoi((char *)&buf[0]);
|
||||
nval = (SINT8)snval;
|
||||
}
|
||||
else
|
||||
return SF_FAILURE;
|
||||
|
||||
return SF_SUCCESS;
|
||||
}
|
||||
SINT32 Gpio::GpioDeinit(const U32 &pinNum)
|
||||
{
|
||||
FILE *fp = nullptr;
|
||||
fp = fopen(GPIO_UNEXPORT, GPIO_EXPORT_MODE);
|
||||
if (fp == NULL)
|
||||
{
|
||||
LogError("no export gpio[%d]\n", pinNum);
|
||||
return SF_FAILURE;
|
||||
}
|
||||
fprintf_gpio(fp, pinNum);
|
||||
linux_fclose(fp);
|
||||
return SF_SUCCESS;
|
||||
}
|
67
code/application/sifarsdk/333DE/hal/Gpio.h
Normal file
67
code/application/sifarsdk/333DE/hal/Gpio.h
Normal file
|
@ -0,0 +1,67 @@
|
|||
#ifndef GPIO_H
|
||||
#define GPIO_H
|
||||
#include "IHal.h"
|
||||
#include "SfTypeDefine.h"
|
||||
#include <map>
|
||||
// class GpioKeyContrl : public VKeyContrl
|
||||
// {
|
||||
// };
|
||||
typedef enum sfHAL_LED_GPIO_IDX_E
|
||||
{
|
||||
SF_HAL_LED_IDX_0 = 0, /**<led index 0*/
|
||||
SF_HAL_LED_IDX_1,
|
||||
SF_HAL_LED_STATUS_G = 45,
|
||||
SF_HAL_LED_WIFI = 45,
|
||||
|
||||
SF_HAL_LED_SD_G = 76,
|
||||
SF_HAL_LED_SD_R = 77,
|
||||
|
||||
SF_HAL_LED_BAT_G = 62,
|
||||
SF_HAL_LED_BAT_R = 63,
|
||||
|
||||
SF_HAL_LED_SIG1_R = 65,
|
||||
SF_HAL_LED_SIG1_G = 64,
|
||||
|
||||
SF_HAL_LED_USERBIND_R = 47,
|
||||
SF_HAL_LED_USERBIND_G = 46,
|
||||
SF_HAL_LED_IDX_BUIT
|
||||
} SF_LED_GPIO_IDX_E;
|
||||
typedef enum sfHAL_LED_STATE_E
|
||||
{
|
||||
SF_HAL_LED_STATE_OFF = 0, /**<led off state*/
|
||||
SF_HAL_LED_STATE_ON, /**<led on state*/
|
||||
SF_HAL_LED_STATE_BUIT
|
||||
} SF_HAL_LED_STATE_E;
|
||||
typedef enum sfBATTERY_LEVEL_E
|
||||
{
|
||||
SF_BATT_LEVEL_0 = 0,
|
||||
SF_BATT_LEVEL_1 = 1, /* 1/3 */
|
||||
SF_BATT_LEVEL_2 = 2, /* 2/3 */
|
||||
SF_BATT_LEVEL_3 = 3,
|
||||
SF_BATT_LEVEL_4 = 4, /* battery full */
|
||||
SF_BATT_LEVEL_0_1 = 5, /* battery empty */
|
||||
SF_BATT_LEVEL_TOTAL,
|
||||
} SF_BATTERY_LEVEL_E;
|
||||
typedef enum sf_KEY_PIN_E
|
||||
{
|
||||
SF_KEY_PIN_RESET = 69,
|
||||
SF_KEY_PIN_SYNC = 7,
|
||||
SF_KEY_PIN_FORMAT = 66,
|
||||
SF_KEY_PIN_DATAREADY = 6,
|
||||
SF_KEY_PIN_FILESTATUS = 128, /*virtual key*/
|
||||
} SF_KEY_PIN_E;
|
||||
#define GPIO_DIR_OUT "out"
|
||||
#define GPIO_DIR_IN "in"
|
||||
constexpr U32 GPIO_PIN_HIGHT = 1;
|
||||
constexpr U32 GPIO_PIN_LOW = 0;
|
||||
class Gpio
|
||||
{
|
||||
public:
|
||||
Gpio() = default;
|
||||
~Gpio() = default;
|
||||
SINT32 GpioInit(const U32 &gpioNum, const char *dir);
|
||||
SINT32 GpioSet(const U32 &gpioNum, const U32 &nval);
|
||||
SINT32 GpioGet(const U32 &gpioNum, SINT8 &nval);
|
||||
SINT32 GpioDeinit(const U32 &gpioNum);
|
||||
};
|
||||
#endif // !GPIO_h
|
41
code/application/sifarsdk/333DE/hal/GpioInputHandle.cpp
Normal file
41
code/application/sifarsdk/333DE/hal/GpioInputHandle.cpp
Normal file
|
@ -0,0 +1,41 @@
|
|||
#include "GpioInputHandle.h"
|
||||
#include "Log.h"
|
||||
GpioInputHandle::GpioInputHandle(const GpioPin &gpio, const unsigned int &pin, const signed char invalidInput)
|
||||
: mGpio(gpio), mPin(pin), mInvalidInput(invalidInput)
|
||||
{
|
||||
mContext = nullptr;
|
||||
mLastPinValue = mInvalidInput;
|
||||
}
|
||||
void GpioInputHandle::Init(void)
|
||||
{
|
||||
GpioInit(mPin, GPIO_DIR_IN);
|
||||
}
|
||||
void GpioInputHandle::UnInit(void)
|
||||
{
|
||||
GpioDeinit(mPin);
|
||||
}
|
||||
void GpioInputHandle::SetInputMonitor(std::shared_ptr<VGpioInputMonitor> monitor, void *context)
|
||||
{
|
||||
mInputMonitor = monitor;
|
||||
mContext = context;
|
||||
}
|
||||
void GpioInputHandle::CheckInputValue(void)
|
||||
{
|
||||
auto monitor = mInputMonitor.lock();
|
||||
if (mInputMonitor.expired())
|
||||
{
|
||||
return;
|
||||
}
|
||||
SINT8 pinValue = 0;
|
||||
GpioGet(mPin, pinValue);
|
||||
// LogInfo("GpioInputHandle::CheckInputValue pin = %d, pinValue = %d\n", mPin, pinValue);
|
||||
if (pinValue == mInvalidInput && mInvalidInput != mLastPinValue)
|
||||
{
|
||||
monitor->InputTransform(mGpio, GpioInputValue::INVALID, mContext);
|
||||
}
|
||||
if (pinValue != mInvalidInput && mInvalidInput == mLastPinValue)
|
||||
{
|
||||
monitor->InputTransform(mGpio, GpioInputValue::VALID, mContext);
|
||||
}
|
||||
mLastPinValue = pinValue;
|
||||
}
|
22
code/application/sifarsdk/333DE/hal/GpioInputHandle.h
Normal file
22
code/application/sifarsdk/333DE/hal/GpioInputHandle.h
Normal file
|
@ -0,0 +1,22 @@
|
|||
#ifndef GPIO_INPUT_HANDLE_H
|
||||
#define GPIO_INPUT_HANDLE_H
|
||||
#include "Gpio.h"
|
||||
class GpioInputHandle : public VGpioInputHandle, public Gpio
|
||||
{
|
||||
public:
|
||||
GpioInputHandle(const GpioPin &gpio, const unsigned int &pin, const signed char invalidInput);
|
||||
virtual ~GpioInputHandle() = default;
|
||||
void Init(void) override;
|
||||
void UnInit(void) override;
|
||||
void SetInputMonitor(std::shared_ptr<VGpioInputMonitor> monitor, void *context) override;
|
||||
void CheckInputValue(void);
|
||||
|
||||
private:
|
||||
const GpioPin mGpio;
|
||||
const unsigned int mPin;
|
||||
const signed char mInvalidInput;
|
||||
SINT8 mLastPinValue;
|
||||
std::weak_ptr<VGpioInputMonitor> mInputMonitor;
|
||||
void *mContext;
|
||||
};
|
||||
#endif // !GPIO_INPUT_HANDLE_H
|
241
code/application/sifarsdk/333DE/hal/Hal333DE.cpp
Normal file
241
code/application/sifarsdk/333DE/hal/Hal333DE.cpp
Normal file
|
@ -0,0 +1,241 @@
|
|||
#include "Hal333DE.h"
|
||||
#include "CameraChip333DE.h"
|
||||
#include "Log.h"
|
||||
#include "KeyContrl.h"
|
||||
#include <unistd.h>
|
||||
static void GpioHandleThread(std::shared_ptr<Hal333DE> halManager)
|
||||
{
|
||||
while (halManager->IsHalRuning())
|
||||
{
|
||||
halManager->CheckAllPins();
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(PERIPHERAL_CHECK_PERIOD_MS));
|
||||
}
|
||||
}
|
||||
Hal333DE::Hal333DE()
|
||||
{
|
||||
mHalRuning = false;
|
||||
mMainCamera = std::make_shared<CameraHal>();
|
||||
mSdCardHal = std::make_shared<VSDCardHal>();
|
||||
}
|
||||
RETURN_CODE Hal333DE::Init(void)
|
||||
{
|
||||
LogInfo("hal 333DE.\n");
|
||||
auto loadDrivers = [](std::shared_ptr<Hal333DE> hal)
|
||||
{
|
||||
hal->LoadDrivers();
|
||||
};
|
||||
std::thread func(loadDrivers, shared_from_this());
|
||||
if (func.joinable())
|
||||
{
|
||||
func.join();
|
||||
}
|
||||
InitAllLeds();
|
||||
InitAllKeys();
|
||||
InitCameras();
|
||||
InitAllGpios();
|
||||
std::dynamic_pointer_cast<Hal333DEMakePtr>(HalX86MakePtr::GetInstance())->CreateSdCardHal(mSdCardHal);
|
||||
mHalRuning = true;
|
||||
mGpioHandle = std::thread(GpioHandleThread, shared_from_this());
|
||||
std::shared_ptr<VSDCardMessageHandle> tmp = std::dynamic_pointer_cast<VSDCardMessageHandle>(mSdCardHal);
|
||||
Message333DE::GetInstance()->SetSDCardMessageHandle(tmp);
|
||||
Message333DE::GetInstance()->Init();
|
||||
HalX86::Init();
|
||||
return VReturnCode::NewCode(VReturnCodeDefine::OK);
|
||||
}
|
||||
RETURN_CODE Hal333DE::UnInit(void)
|
||||
{
|
||||
HalX86::UnInit();
|
||||
Message333DE::GetInstance()->UnInit();
|
||||
mHalRuning = false;
|
||||
if (mGpioHandle.joinable())
|
||||
{
|
||||
mGpioHandle.join();
|
||||
}
|
||||
UnInitAllLeds();
|
||||
UnInitAllKeys();
|
||||
UnInitCameras();
|
||||
UnInitAllGpios();
|
||||
mSdCardHal.reset();
|
||||
return VReturnCode::NewCode(VReturnCodeDefine::OK);
|
||||
}
|
||||
RETURN_CODE Hal333DE::GetKeyContrlHandle(const SfKeyDefine &key, std::shared_ptr<VKeyContrl> &keyContrl)
|
||||
{
|
||||
keyContrl = mKeys[key];
|
||||
return VReturnCode::NewCode(VReturnCodeDefine::OK);
|
||||
}
|
||||
RETURN_CODE Hal333DE::GetGpioInputHandle(const GpioPin &gpio, std::shared_ptr<VGpioInputHandle> &gpioHandle)
|
||||
{
|
||||
gpioHandle = mGpios[gpio];
|
||||
return VReturnCode::NewCode(VReturnCodeDefine::OK);
|
||||
}
|
||||
RETURN_CODE Hal333DE::GetLedContrlHandle(const SfLedIndex &led, std::shared_ptr<VLedContrl> &ledContrl)
|
||||
{
|
||||
ledContrl = mLeds[led];
|
||||
return VReturnCode::NewCode(VReturnCodeDefine::OK);
|
||||
}
|
||||
RETURN_CODE Hal333DE::GetCameraHal(const CameraType &type, std::shared_ptr<VCameraHal> &camera)
|
||||
{
|
||||
camera = mMainCamera;
|
||||
return VReturnCode::NewCode(VReturnCodeDefine::OK);
|
||||
}
|
||||
const char *RTC_DEVICE = "/dev/rtc0";
|
||||
const RtcDevice &Hal333DE::GetRtcDevice(void)
|
||||
{
|
||||
static RtcDevice rtc(RTC_DEVICE, RtcDeviceSupport::SUPPORT);
|
||||
return rtc;
|
||||
}
|
||||
void Hal333DE::InitAllLeds(void)
|
||||
{
|
||||
for (int i = 0; i < static_cast<int>(SfLedIndex::SF_LED_END); i++)
|
||||
{
|
||||
auto ledHandle = std::make_shared<VLedContrl>();
|
||||
std::dynamic_pointer_cast<Hal333DEMakePtr>(HalX86MakePtr::GetInstance())->CreateGpioLedContrlInstance(static_cast<SfLedIndex>(i), ledHandle);
|
||||
ledHandle->Init();
|
||||
mLeds[static_cast<SfLedIndex>(i)] = ledHandle;
|
||||
}
|
||||
}
|
||||
void Hal333DE::UnInitAllLeds(void)
|
||||
{
|
||||
if (mLeds.empty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < static_cast<int>(SfLedIndex::SF_LED_END); i++)
|
||||
{
|
||||
mLeds[static_cast<SfLedIndex>(i)]->UnInit();
|
||||
}
|
||||
mLeds.clear();
|
||||
}
|
||||
void Hal333DE::InitAllKeys(void)
|
||||
{
|
||||
for (int i = 0; i < static_cast<int>(SfKeyDefine::KEY_PIN_END); i++)
|
||||
{
|
||||
auto keyHandle = std::make_shared<VKeyContrl>();
|
||||
std::dynamic_pointer_cast<Hal333DEMakePtr>(HalX86MakePtr::GetInstance())->CreateGpioKeyContrlInstance(static_cast<SfKeyDefine>(i), keyHandle);
|
||||
keyHandle->Init();
|
||||
mKeys[static_cast<SfKeyDefine>(i)] = keyHandle;
|
||||
}
|
||||
}
|
||||
void Hal333DE::UnInitAllKeys(void)
|
||||
{
|
||||
if (mKeys.empty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < static_cast<int>(SfKeyDefine::KEY_PIN_END); i++)
|
||||
{
|
||||
mKeys[static_cast<SfKeyDefine>(i)]->UnInit();
|
||||
}
|
||||
mKeys.clear();
|
||||
}
|
||||
void Hal333DE::InitCameras(void)
|
||||
{
|
||||
std::dynamic_pointer_cast<Hal333DEMakePtr>(HalX86MakePtr::GetInstance())->CreateCameraChip(CameraType::MAIN_CAMERA, mMainCamera);
|
||||
if (!mMainCamera)
|
||||
{
|
||||
LogError("Camera init failed.\n");
|
||||
return;
|
||||
}
|
||||
mMainCamera->Init();
|
||||
LogInfo("Camera init succeed.\n");
|
||||
}
|
||||
void Hal333DE::UnInitCameras(void)
|
||||
{
|
||||
mMainCamera->UnInit();
|
||||
}
|
||||
void Hal333DE::InitAllGpios(void)
|
||||
{
|
||||
for (int i = 0; i < static_cast<int>(GpioPin::END); i++)
|
||||
{
|
||||
std::shared_ptr<VGpioInputHandle> gpio;
|
||||
std::dynamic_pointer_cast<Hal333DEMakePtr>(HalX86MakePtr::GetInstance())->CreateGpioInputInstance(static_cast<GpioPin>(i), gpio);
|
||||
gpio->Init();
|
||||
mGpios[static_cast<GpioPin>(i)] = gpio;
|
||||
}
|
||||
}
|
||||
void Hal333DE::UnInitAllGpios(void)
|
||||
{
|
||||
if (mGpios.empty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < static_cast<int>(GpioPin::END); i++)
|
||||
{
|
||||
mGpios[static_cast<GpioPin>(i)]->UnInit();
|
||||
}
|
||||
mGpios.clear();
|
||||
}
|
||||
RETURN_CODE Hal333DE::GetLightWeightCPU(std::shared_ptr<VLightWeightCPU> &lcpu)
|
||||
{
|
||||
auto code =
|
||||
std::dynamic_pointer_cast<Hal333DEMakePtr>(HalX86MakePtr::GetInstance())->CreateLightWeightCPU(lcpu);
|
||||
return code;
|
||||
}
|
||||
const char *SERIAL_DEVICE_PATH = "/dev/ttyS2";
|
||||
const McuDeviceInformation Hal333DE::GetMcuDeviceInformation(void)
|
||||
{
|
||||
LogInfo("Get mcu serial = %s\n", SERIAL_DEVICE_PATH);
|
||||
McuDeviceInformation info(SERIAL_DEVICE_PATH, 115200, 'N', 8, 1, 'N');
|
||||
return info;
|
||||
}
|
||||
void Hal333DE::DoSomethingBeforPowerOff(void)
|
||||
{
|
||||
int result = -1;
|
||||
result = system("umount misc");
|
||||
result = system("echo cli sycmd -wpara > /proc/dualos/rtos");
|
||||
LogInfo("system result = %d\n", result);
|
||||
}
|
||||
RETURN_CODE Hal333DE::GetSDCardHal(std::shared_ptr<VSDCardHal> &sdCardHal)
|
||||
{
|
||||
sdCardHal = mSdCardHal;
|
||||
return VReturnCode::NewCode(VReturnCodeDefine::OK);
|
||||
}
|
||||
const NetWorkUpgradeResult Hal333DE::NetworkModuleUpgrade(void)
|
||||
{
|
||||
if ((access("/mnt/mmc/EG95", F_OK) == 0))
|
||||
{
|
||||
system("/customer/QFirehose -f /mnt/mmc/EG95");
|
||||
// app_system_poweroff(SF_POWEROFF_REBOOT);
|
||||
NetWorkUpgradeResult info(NETWORK_MODULE_UPGRADE_RESULT::SUCCEED);
|
||||
return info;
|
||||
}
|
||||
else
|
||||
{
|
||||
NetWorkUpgradeResult info(NETWORK_MODULE_UPGRADE_RESULT::FAILED);
|
||||
return info;
|
||||
}
|
||||
}
|
||||
void Hal333DE::CheckAllPins(void)
|
||||
{
|
||||
std::shared_ptr<KeyContrl> keyContrl;
|
||||
for (int i = 0; i < static_cast<int>(SfKeyDefine::KEY_PIN_END); i++)
|
||||
{
|
||||
keyContrl = std::dynamic_pointer_cast<KeyContrl>(mKeys[static_cast<SfKeyDefine>(i)]);
|
||||
if (keyContrl)
|
||||
{
|
||||
keyContrl->CheckKeyValue();
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < static_cast<int>(GpioPin::END); i++)
|
||||
{
|
||||
std::dynamic_pointer_cast<GpioInputHandle>(mGpios[static_cast<GpioPin>(i)])->CheckInputValue();
|
||||
}
|
||||
}
|
||||
bool Hal333DE::IsHalRuning(void)
|
||||
{
|
||||
return mHalRuning;
|
||||
}
|
||||
void Hal333DE::LoadDrivers(void)
|
||||
{
|
||||
LogInfo("LoadDrivers.\n");
|
||||
int result = -1;
|
||||
result = system("insmod /config/modules/4.9.84/usb-storage.ko");
|
||||
result = system("insmod /config/modules/4.9.84/usbnet.ko");
|
||||
result = system("insmod /config/modules/4.9.84/cdc_ether.ko");
|
||||
result = system("insmod /config/modules/4.9.84/rndis_host.ko");
|
||||
result = system("insmod /config/modules/4.9.84/usbserial.ko");
|
||||
result = system("insmod /config/modules/4.9.84/usb_wwan.ko");
|
||||
result = system("insmod /config/modules/4.9.84/option.ko");
|
||||
result = system("insmod /customer/GobiNet.ko");
|
||||
LogInfo("LoadDrivers. result = %d\n", result);
|
||||
}
|
54
code/application/sifarsdk/333DE/hal/Hal333DE.h
Normal file
54
code/application/sifarsdk/333DE/hal/Hal333DE.h
Normal file
|
@ -0,0 +1,54 @@
|
|||
#ifndef HAL_333DE_H
|
||||
#define HAL_333DE_H
|
||||
#include "HalX86.h"
|
||||
#include "Hal333DEMakePtr.h"
|
||||
#include "CameraHal.h"
|
||||
#include "GpioInputHandle.h"
|
||||
#include "Message333DE.h"
|
||||
#include <map>
|
||||
#include <thread>
|
||||
class Hal333DE : public HalX86, public std::enable_shared_from_this<Hal333DE>
|
||||
{
|
||||
public:
|
||||
Hal333DE();
|
||||
virtual ~Hal333DE() = default;
|
||||
RETURN_CODE Init(void) override;
|
||||
RETURN_CODE UnInit(void) override;
|
||||
RETURN_CODE GetKeyContrlHandle(const SfKeyDefine &key, std::shared_ptr<VKeyContrl> &keyContrl) override;
|
||||
RETURN_CODE GetGpioInputHandle(const GpioPin &gpio, std::shared_ptr<VGpioInputHandle> &gpioHandle) override;
|
||||
RETURN_CODE GetLedContrlHandle(const SfLedIndex &led, std::shared_ptr<VLedContrl> &ledContrl) override;
|
||||
RETURN_CODE GetCameraHal(const CameraType &type, std::shared_ptr<VCameraHal> &camera) override;
|
||||
const RtcDevice &GetRtcDevice(void) override;
|
||||
RETURN_CODE GetLightWeightCPU(std::shared_ptr<VLightWeightCPU> &lcpu) override;
|
||||
const McuDeviceInformation GetMcuDeviceInformation(void) override;
|
||||
const char *GetSDCardSystemPath(void) override { return "/mnt/mmc/"; }
|
||||
const char *GetPictureThumbPath(void) override { return "/mnt/mmc/DCIM/THUMB/"; }
|
||||
const char *GetVideoStreamPath(void) override { return "/mnt/mmc/DCIM/SMALL/"; }
|
||||
const char *GetSDCardCheckPath(void) override { return "/mnt/mmc/DCIM"; }
|
||||
void DoSomethingBeforPowerOff(void) override;
|
||||
RETURN_CODE GetSDCardHal(std::shared_ptr<VSDCardHal> &sdCardHal) override;
|
||||
const NetWorkUpgradeResult NetworkModuleUpgrade(void) override;
|
||||
virtual void CheckAllPins(void);
|
||||
bool IsHalRuning(void);
|
||||
void LoadDrivers(void);
|
||||
|
||||
private:
|
||||
void InitAllLeds(void);
|
||||
void UnInitAllLeds(void);
|
||||
void InitAllKeys(void);
|
||||
void UnInitAllKeys(void);
|
||||
void InitCameras(void);
|
||||
void UnInitCameras(void);
|
||||
void InitAllGpios(void);
|
||||
void UnInitAllGpios(void);
|
||||
|
||||
private:
|
||||
std::map<SfKeyDefine, std::shared_ptr<VKeyContrl>> mKeys;
|
||||
std::map<SfLedIndex, std::shared_ptr<VLedContrl>> mLeds;
|
||||
std::map<GpioPin, std::shared_ptr<VGpioInputHandle>> mGpios;
|
||||
bool mHalRuning;
|
||||
std::shared_ptr<CameraHal> mMainCamera;
|
||||
std::thread mGpioHandle;
|
||||
std::shared_ptr<VSDCardHal> mSdCardHal;
|
||||
};
|
||||
#endif // !HAL_333DE_H
|
144
code/application/sifarsdk/333DE/hal/Hal333DEMakePtr.cpp
Normal file
144
code/application/sifarsdk/333DE/hal/Hal333DEMakePtr.cpp
Normal file
|
@ -0,0 +1,144 @@
|
|||
#include "Hal333DEMakePtr.h"
|
||||
#include "Hal333DE.h"
|
||||
#include "NetworkModule333DE.h"
|
||||
#include "CameraChip333DE.h"
|
||||
#include "Log.h"
|
||||
#include "Gpio.h"
|
||||
#include "LightWeightCPU.h"
|
||||
#include "GpioInputHandle.h"
|
||||
#include "KeyContrl.h"
|
||||
#include "OneColorLed.h"
|
||||
#include "MultiColorLed.h"
|
||||
#include "SDCardHal.h"
|
||||
void Hal333DEMakePtrOverride(void)
|
||||
{
|
||||
std::shared_ptr<HalX86MakePtr> makePtr = std::make_shared<Hal333DEMakePtr>();
|
||||
HalX86MakePtr::GetInstance(&makePtr);
|
||||
}
|
||||
Hal333DEMakePtr::Hal333DEMakePtr()
|
||||
{
|
||||
mKeyInfo[SfKeyDefine::KEY_PIN_RESET] = {SF_KEY_PIN_RESET, HIGHT_MEANS_KEY_UP};
|
||||
mKeyInfo[SfKeyDefine::KEY_PIN_SYNC] = {SF_KEY_PIN_SYNC, HIGHT_MEANS_KEY_UP};
|
||||
mKeyInfo[SfKeyDefine::KEY_PIN_FORMAT] = {SF_KEY_PIN_FORMAT, HIGHT_MEANS_KEY_UP};
|
||||
mKeyInfo[SfKeyDefine::KEY_PIN_DATAREADY] = {SF_KEY_PIN_DATAREADY, LOW_MEANS_KEY_UP};
|
||||
// mKeyInfo[SfKeyDefine::KEY_PIN_FILESTATUS] = {SF_KEY_PIN_FILESTATUS, HIGHT_MEANS_KEY_UP};
|
||||
}
|
||||
RETURN_CODE Hal333DEMakePtr::CreateHalModuleInstance(std::shared_ptr<IHal> &impl)
|
||||
{
|
||||
LogInfo("Hal333DEMakePtr make ptr.\n");
|
||||
impl = std::make_shared<Hal333DE>();
|
||||
return VReturnCode::NewCode(VReturnCodeDefine::OK);
|
||||
}
|
||||
RETURN_CODE Hal333DEMakePtr::CreateGpioLedContrlInstance(const SfLedIndex &led, std::shared_ptr<VLedContrl> &ledContrl)
|
||||
{
|
||||
switch (led)
|
||||
{
|
||||
case SfLedIndex::SF_LED_STATUS:
|
||||
{
|
||||
LogInfo("Create led of status.\n");
|
||||
auto ledOut = std::make_shared<OneColorLed>(led, SF_HAL_LED_STATUS_G);
|
||||
ledContrl = ledOut;
|
||||
break;
|
||||
}
|
||||
case SfLedIndex::SF_LED_WIFI:
|
||||
{
|
||||
LogInfo("Create led of wifi.\n");
|
||||
auto ledOut = std::make_shared<OneColorLed>(led, SF_HAL_LED_WIFI);
|
||||
ledContrl = ledOut;
|
||||
break;
|
||||
}
|
||||
case SfLedIndex::SF_LED_BAT:
|
||||
{
|
||||
LogInfo("Create led of bat.\n");
|
||||
auto ledOut = std::make_shared<MultiColorLed>(led, SF_HAL_LED_BAT_R, SF_HAL_LED_BAT_G);
|
||||
ledContrl = ledOut;
|
||||
break;
|
||||
}
|
||||
case SfLedIndex::SF_LED_SD:
|
||||
{
|
||||
LogInfo("Create led of sd card.\n");
|
||||
auto ledOut = std::make_shared<MultiColorLed>(led, SF_HAL_LED_SD_R, SF_HAL_LED_SD_G);
|
||||
ledContrl = ledOut;
|
||||
break;
|
||||
}
|
||||
case SfLedIndex::SF_LED_SIG1:
|
||||
{
|
||||
LogInfo("Create led of signal.\n");
|
||||
auto ledOut = std::make_shared<MultiColorLed>(led, SF_HAL_LED_SIG1_R, SF_HAL_LED_SIG1_G);
|
||||
ledContrl = ledOut;
|
||||
break;
|
||||
}
|
||||
case SfLedIndex::SF_LED_USERBIND:
|
||||
{
|
||||
LogInfo("Create led of signal.\n");
|
||||
auto ledOut = std::make_shared<MultiColorLed>(led, SF_HAL_LED_USERBIND_R, SF_HAL_LED_USERBIND_G);
|
||||
ledContrl = ledOut;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return VReturnCode::NewCode(VReturnCodeDefine::OK);
|
||||
}
|
||||
RETURN_CODE Hal333DEMakePtr::CreateGpioKeyContrlInstance(const SfKeyDefine &key, std::shared_ptr<VKeyContrl> &keyContrl)
|
||||
{
|
||||
std::map<SfKeyDefine, SF_KEYMNG_INFO_S>::iterator iter;
|
||||
iter = mKeyInfo.find(key);
|
||||
if (iter == mKeyInfo.end())
|
||||
{
|
||||
LogWarning("Want to create undefine key contrl, failed.key = %d\n", static_cast<int>(key));
|
||||
return VReturnCode::NewCode(VReturnCodeDefine::NOT_OK_UNDEFINE_REASON);
|
||||
}
|
||||
auto keyOut = std::make_shared<KeyContrl>(key, mKeyInfo[key].pinNumber, mKeyInfo[key].valueMeansKeyUp);
|
||||
// keyOut->Init();
|
||||
keyContrl = keyOut;
|
||||
return VReturnCode::NewCode(VReturnCodeDefine::OK);
|
||||
}
|
||||
RETURN_CODE Hal333DEMakePtr::CreateGpioInputInstance(const GpioPin &gpio, std::shared_ptr<VGpioInputHandle> &gpioInput)
|
||||
{
|
||||
constexpr int GPIOID_PIR_TEST = 3;
|
||||
constexpr int GPIOID_USB_INSERT = 61;
|
||||
switch (gpio)
|
||||
{
|
||||
case GpioPin::PIR:
|
||||
{
|
||||
auto impl = std::make_shared<GpioInputHandle>(gpio, GPIOID_PIR_TEST, HIGHT_PIN_MEANS_INVALID);
|
||||
gpioInput = impl;
|
||||
break;
|
||||
}
|
||||
case GpioPin::USB:
|
||||
{
|
||||
auto impl = std::make_shared<GpioInputHandle>(gpio, GPIOID_USB_INSERT, LOW_PIN_MEANS_INVALID);
|
||||
gpioInput = impl;
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return VReturnCode::NewCode(VReturnCodeDefine::OK);
|
||||
}
|
||||
RETURN_CODE Hal333DEMakePtr::CreateCameraChip(const CameraType &type, std::shared_ptr<CameraHal> &camera)
|
||||
{
|
||||
auto tmp = std::make_shared<CameraChip333DE>();
|
||||
camera = tmp;
|
||||
return VReturnCode::NewCode(VReturnCodeDefine::OK);
|
||||
}
|
||||
RETURN_CODE Hal333DEMakePtr::CreateLightWeightCPU(std::shared_ptr<VLightWeightCPU> &lcpu)
|
||||
{
|
||||
auto tmp = std::make_shared<LightWeightCPU>();
|
||||
lcpu = tmp;
|
||||
return VReturnCode::NewCode(VReturnCodeDefine::OK);
|
||||
}
|
||||
RETURN_CODE Hal333DEMakePtr::CreateSdCardHal(std::shared_ptr<VSDCardHal> &sdCardHal)
|
||||
{
|
||||
auto tmp = std::make_shared<SDCardHal>();
|
||||
sdCardHal = tmp;
|
||||
return VReturnCode::NewCode(VReturnCodeDefine::OK);
|
||||
}
|
||||
RETURN_CODE Hal333DEMakePtr::CreateNetworkModuleHandle(std::shared_ptr<VNetWorkHardware> &impl)
|
||||
{
|
||||
LogInfo("CreateNetworkModuleHandle NetworkModule333DE.\n");
|
||||
impl = std::make_shared<NetworkModule333DE>();
|
||||
return VReturnCode::NewCode(VReturnCodeDefine::OK);
|
||||
}
|
34
code/application/sifarsdk/333DE/hal/Hal333DEMakePtr.h
Normal file
34
code/application/sifarsdk/333DE/hal/Hal333DEMakePtr.h
Normal file
|
@ -0,0 +1,34 @@
|
|||
#ifndef HAL_333DE_MAKE_PTR_H
|
||||
#define HAL_333DE_MAKE_PTR_H
|
||||
#include "ReturnCode.h"
|
||||
#include "IHal.h"
|
||||
#include "Gpio.h"
|
||||
#include "HalX86MakePtr.h"
|
||||
#include "CameraHal.h"
|
||||
#include <map>
|
||||
typedef struct SF_KEYMNG_INFO_S
|
||||
{
|
||||
SF_KEY_PIN_E pinNumber; /* serial number*/
|
||||
SF_BOOL valueMeansKeyUp; /* PIN state*/
|
||||
// SINT16 u32keycount; /* Count value*/
|
||||
// SINT16 ShortLongMaxCount; /* Pin number*/
|
||||
// SF_KEY_STATE_E enState; /* Initial state*/
|
||||
} SF_KEYMNG_INFO_S;
|
||||
class Hal333DEMakePtr : public HalX86MakePtr
|
||||
{
|
||||
public:
|
||||
Hal333DEMakePtr();
|
||||
virtual ~Hal333DEMakePtr() = default;
|
||||
RETURN_CODE CreateHalModuleInstance(std::shared_ptr<IHal> &impl) override;
|
||||
RETURN_CODE CreateNetworkModuleHandle(std::shared_ptr<VNetWorkHardware> &impl) override;
|
||||
virtual RETURN_CODE CreateGpioLedContrlInstance(const SfLedIndex &led, std::shared_ptr<VLedContrl> &ledContrl);
|
||||
virtual RETURN_CODE CreateGpioKeyContrlInstance(const SfKeyDefine &key, std::shared_ptr<VKeyContrl> &keyContrl);
|
||||
virtual RETURN_CODE CreateGpioInputInstance(const GpioPin &gpio, std::shared_ptr<VGpioInputHandle> &gpioInput);
|
||||
virtual RETURN_CODE CreateCameraChip(const CameraType &type, std::shared_ptr<CameraHal> &camera);
|
||||
virtual RETURN_CODE CreateLightWeightCPU(std::shared_ptr<VLightWeightCPU> &lcpu);
|
||||
virtual RETURN_CODE CreateSdCardHal(std::shared_ptr<VSDCardHal> &sdCardHal);
|
||||
|
||||
private:
|
||||
std::map<SfKeyDefine, SF_KEYMNG_INFO_S> mKeyInfo;
|
||||
};
|
||||
#endif // !HAL_333DE_MAKE_PTR_H
|
48
code/application/sifarsdk/333DE/hal/KeyContrl.cpp
Normal file
48
code/application/sifarsdk/333DE/hal/KeyContrl.cpp
Normal file
|
@ -0,0 +1,48 @@
|
|||
#include "KeyContrl.h"
|
||||
#include "Log.h"
|
||||
KeyContrl::KeyContrl(const SfKeyDefine &key, const SF_KEY_PIN_E &pin, const SF_BOOL &valueMeansKeyUp)
|
||||
: mKey(key), mPin(pin), mValueMeansKeyUp(valueMeansKeyUp)
|
||||
{
|
||||
mEventContext = nullptr;
|
||||
mLastPinValue = valueMeansKeyUp;
|
||||
LogInfo("mLastPinValue = %d\n", mLastPinValue);
|
||||
mKeyMonitor = std::make_shared<VKeyEventMonitor>();
|
||||
}
|
||||
KeyContrl::~KeyContrl()
|
||||
{
|
||||
}
|
||||
void KeyContrl::Init(void)
|
||||
{
|
||||
LogInfo("KeyContrl::Init pin = %d\n", mPin);
|
||||
GpioInit(mPin, GPIO_DIR_IN);
|
||||
}
|
||||
void KeyContrl::UnInit(void)
|
||||
{
|
||||
GpioDeinit(mPin);
|
||||
mKeyMonitor.reset();
|
||||
}
|
||||
void KeyContrl::SetKeyEventMonitor(std::shared_ptr<VKeyEventMonitor> monitor, void *context)
|
||||
{
|
||||
mKeyMonitor = monitor;
|
||||
mEventContext = context;
|
||||
}
|
||||
void KeyContrl::CheckKeyValue(void)
|
||||
{
|
||||
auto monitor = mKeyMonitor.lock();
|
||||
if (mKeyMonitor.expired())
|
||||
{
|
||||
return;
|
||||
}
|
||||
SINT8 pinValue = 0;
|
||||
GpioGet(mPin, pinValue);
|
||||
// LogInfo("KeyContrl::CheckKeyValue pin = %d, pinValue = %d\n", mPin, pinValue);
|
||||
if (pinValue == mValueMeansKeyUp && mValueMeansKeyUp != mLastPinValue)
|
||||
{
|
||||
monitor->HalKeyEventHappened(mKey, SfKeyEvent::KEY_EVENT_UN_PRESSED, mEventContext);
|
||||
}
|
||||
if (pinValue != mValueMeansKeyUp && mValueMeansKeyUp == mLastPinValue)
|
||||
{
|
||||
monitor->HalKeyEventHappened(mKey, SfKeyEvent::KEY_EVENT_PRESSED, mEventContext);
|
||||
}
|
||||
mLastPinValue = pinValue;
|
||||
}
|
29
code/application/sifarsdk/333DE/hal/KeyContrl.h
Normal file
29
code/application/sifarsdk/333DE/hal/KeyContrl.h
Normal file
|
@ -0,0 +1,29 @@
|
|||
#ifndef KEY_CONTRL_H
|
||||
#define KEY_CONTRL_H
|
||||
#include "Gpio.h"
|
||||
constexpr SINT8 INVALID_PIN_VALUE = -1;
|
||||
constexpr SINT8 PIN_VALUE_HIGHT = 1;
|
||||
constexpr SINT8 PIN_VALUE_LOW = 0;
|
||||
constexpr SF_BOOL HIGHT_MEANS_KEY_UP = 1;
|
||||
constexpr SF_BOOL LOW_MEANS_KEY_UP = 0;
|
||||
constexpr SINT8 LOW_PIN_MEANS_INVALID = 0;
|
||||
constexpr SINT8 HIGHT_PIN_MEANS_INVALID = 1;
|
||||
class KeyContrl : public VKeyContrl, public Gpio
|
||||
{
|
||||
public:
|
||||
KeyContrl(const SfKeyDefine &key, const SF_KEY_PIN_E &pin, const SF_BOOL &valueMeansKeyUp);
|
||||
~KeyContrl();
|
||||
void Init(void) override;
|
||||
void UnInit(void) override;
|
||||
void SetKeyEventMonitor(std::shared_ptr<VKeyEventMonitor> monitor, void *context) override;
|
||||
void CheckKeyValue(void);
|
||||
|
||||
private:
|
||||
const SfKeyDefine mKey;
|
||||
const SF_KEY_PIN_E mPin;
|
||||
std::weak_ptr<VKeyEventMonitor> mKeyMonitor;
|
||||
void *mEventContext;
|
||||
SINT8 mLastPinValue;
|
||||
const SF_BOOL mValueMeansKeyUp;
|
||||
};
|
||||
#endif // !KEY_CONTRL_H
|
81
code/application/sifarsdk/333DE/hal/LightWeightCPU.cpp
Normal file
81
code/application/sifarsdk/333DE/hal/LightWeightCPU.cpp
Normal file
|
@ -0,0 +1,81 @@
|
|||
#include "LightWeightCPU.h"
|
||||
#include "SfTypeDefine.h"
|
||||
#include "Log.h"
|
||||
#include <thread>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
#define MSYS_IOCTL_MAGIC 'S'
|
||||
#define IOCTL_MSYS_GET_SY_RTOS_DATA _IO(MSYS_IOCTL_MAGIC, 0x97)
|
||||
#define IOCTL_MSYS_SET_RTOS_CMD _IO(MSYS_IOCTL_MAGIC, 0x98)
|
||||
typedef struct ONLY_FOR_GET_DATA
|
||||
{
|
||||
// unsigned int test1;
|
||||
// unsigned int test2;
|
||||
// unsigned int test3;
|
||||
// unsigned int IsNight;
|
||||
// unsigned int BatPer;
|
||||
// unsigned int Fctemp;
|
||||
// unsigned short McuVer;
|
||||
// unsigned char McuSubVer;
|
||||
// unsigned int rtosBootTime;
|
||||
unsigned int test1;
|
||||
unsigned int test2;
|
||||
unsigned int test3;
|
||||
unsigned int IsNight;
|
||||
unsigned int BatPer;
|
||||
unsigned int LiveBatPer;
|
||||
unsigned int currentBatvalue;
|
||||
unsigned int recorddone;
|
||||
unsigned int Fctemp;
|
||||
unsigned short McuVer;
|
||||
unsigned char McuSubVer;
|
||||
unsigned int rtosBootTime;
|
||||
} ONLY_FOR_GET_DATA;
|
||||
bool LightWeightCPU::Read(char *readBuf, const unsigned int length)
|
||||
{
|
||||
SINT32 nMsysFd = SF_FAILURE;
|
||||
ONLY_FOR_GET_DATA info = {0};
|
||||
for (SINT32 cnt = 0; cnt < 100; cnt++)
|
||||
{
|
||||
if (0 > (nMsysFd = open("/dev/msys", O_RDONLY | O_SYNC)))
|
||||
{
|
||||
LogError("open /dev/msys failed!!\n");
|
||||
usleep(20000);
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
ioctl(nMsysFd, IOCTL_MSYS_GET_SY_RTOS_DATA, &info);
|
||||
memcpy(readBuf, &info, sizeof(ONLY_FOR_GET_DATA));
|
||||
close(nMsysFd);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
LogError("LightWeightCPU::Read failed.\n");
|
||||
return false;
|
||||
}
|
||||
bool LightWeightCPU::Write(const char *writeBuf, const unsigned length)
|
||||
{
|
||||
SINT32 nMsysFd = -1;
|
||||
SINT32 ret = -1;
|
||||
for (SINT32 cnt = 0; cnt < 10; cnt++)
|
||||
{
|
||||
if (0 > (nMsysFd = open("/dev/msys", O_RDONLY | O_SYNC)))
|
||||
{
|
||||
LogError("%s open /dev/msys failed!!\n", __FUNCTION__);
|
||||
// usleep(20000);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(20));
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = ioctl(nMsysFd, IOCTL_MSYS_SET_RTOS_CMD, &writeBuf);
|
||||
close(nMsysFd);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
12
code/application/sifarsdk/333DE/hal/LightWeightCPU.h
Normal file
12
code/application/sifarsdk/333DE/hal/LightWeightCPU.h
Normal file
|
@ -0,0 +1,12 @@
|
|||
#ifndef LIGHTWEIGHT_CPU_H
|
||||
#define LIGHTWEIGHT_CPU_H
|
||||
#include "IHal.h"
|
||||
class LightWeightCPU : public VLightWeightCPU
|
||||
{
|
||||
public:
|
||||
LightWeightCPU() = default;
|
||||
~LightWeightCPU() = default;
|
||||
bool Read(char *readBuf, const unsigned int length) override;
|
||||
bool Write(const char *writeBuf, const unsigned length) override;
|
||||
};
|
||||
#endif // !LIGHTWEIGHT_CPU_H
|
107
code/application/sifarsdk/333DE/hal/Message333DE.cpp
Normal file
107
code/application/sifarsdk/333DE/hal/Message333DE.cpp
Normal file
|
@ -0,0 +1,107 @@
|
|||
#include "Message333DE.h"
|
||||
#include "SfTypeDefine.h"
|
||||
#include "Log.h"
|
||||
#include <string.h>
|
||||
Message333DE::Message333DE() : MessageQueue("/tmp/sf_message")
|
||||
{
|
||||
pThumbFileCfg = nullptr;
|
||||
mRecvThreadRuning = false;
|
||||
mCameraHandle = std::make_shared<VCameraMessageHandle>();
|
||||
mSDCardHandle = std::make_shared<VSDCardMessageHandle>();
|
||||
}
|
||||
std::shared_ptr<Message333DE> &Message333DE::GetInstance(std::shared_ptr<Message333DE> *impl)
|
||||
{
|
||||
static auto instance = std::make_shared<Message333DE>();
|
||||
if (impl)
|
||||
{
|
||||
instance = *impl;
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
void Message333DE::Init(void)
|
||||
{
|
||||
MessageQueueCreate();
|
||||
auto recvThread = [](std::shared_ptr<Message333DE> message)
|
||||
{
|
||||
message->RecvThread();
|
||||
};
|
||||
mMessageHandle = std::thread(recvThread, shared_from_this());
|
||||
}
|
||||
void Message333DE::UnInit(void)
|
||||
{
|
||||
mRecvThreadRuning = false;
|
||||
if (mMessageHandle.joinable())
|
||||
{
|
||||
mMessageHandle.join();
|
||||
}
|
||||
mCameraHandle.reset();
|
||||
}
|
||||
SINT32 Message333DE::sf_cardv_message_send(SINT32 cmdId, SINT8 *param, SINT32 paramLen)
|
||||
{
|
||||
SF_MESSAGE_BUF_S stMessagebuf = {0};
|
||||
memset(&stMessagebuf, 0, sizeof(SF_MESSAGE_BUF_S));
|
||||
stMessagebuf.mtype = 1;
|
||||
stMessagebuf.cmdId = cmdId;
|
||||
stMessagebuf.paramLen = paramLen;
|
||||
if (param)
|
||||
{
|
||||
memcpy(stMessagebuf.paramBuf, param, paramLen);
|
||||
}
|
||||
MessageQueue::MessageQueueSend(&stMessagebuf);
|
||||
return 0;
|
||||
}
|
||||
void Message333DE::RecvThread(void)
|
||||
{
|
||||
LogInfo("Camera recv from queue.\n");
|
||||
SINT32 ret = 0;
|
||||
SF_MESSAGE_BUF_S stMessagebuf = {0};
|
||||
mRecvThreadRuning = true;
|
||||
while (mRecvThreadRuning)
|
||||
{
|
||||
memset(&stMessagebuf, 0, sizeof(SF_MESSAGE_BUF_S));
|
||||
ret = MessageQueueRecv(&stMessagebuf);
|
||||
if (ret != SF_SUCCESS)
|
||||
{
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(100)); // TODO: Use select to handle??
|
||||
mCameraHandle->CheckSpontaneousFilesToUpload();
|
||||
continue;
|
||||
}
|
||||
LogInfo("cmdId:[%#x,%s]\n", stMessagebuf.cmdId, AppProcessMessageGetstatusstring(static_cast<SF_MESSAGE_TYPE_E>(stMessagebuf.cmdId)));
|
||||
switch (stMessagebuf.cmdId & CMD_SERIES_FIX)
|
||||
{
|
||||
case CMD_FILE:
|
||||
mCameraHandle->CameraTaskMessageResponse();
|
||||
break;
|
||||
case CMD_SD:
|
||||
app_process_cmd_SD(&stMessagebuf);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
const SF_CHAR *Message333DE::AppProcessMessageGetstatusstring(const SF_MESSAGE_TYPE_E &enType)
|
||||
{
|
||||
switch (enType)
|
||||
{
|
||||
case CMD_KEY:
|
||||
return "CMD_KEY";
|
||||
case CMD_SD:
|
||||
return "CMD_SD";
|
||||
case CMD_LED:
|
||||
return "CMD_LED";
|
||||
case CMD_FILE:
|
||||
return "CMD_FILE";
|
||||
case CMD_POWEROFF:
|
||||
return "CMD_POWEROFF";
|
||||
case CMD_VENC:
|
||||
return "CMD_VENC";
|
||||
default:
|
||||
return "Unknown";
|
||||
}
|
||||
}
|
||||
SINT32 Message333DE::app_process_cmd_SD(SF_MESSAGE_BUF_S *pMessageBuf)
|
||||
{
|
||||
mSDCardHandle->SetSDCardMessage(static_cast<SF_MESSAGE_CMD_SD_E>(pMessageBuf->cmdId)); // TODO:
|
||||
return SF_SUCCESS;
|
||||
}
|
70
code/application/sifarsdk/333DE/hal/Message333DE.h
Normal file
70
code/application/sifarsdk/333DE/hal/Message333DE.h
Normal file
|
@ -0,0 +1,70 @@
|
|||
#ifndef MESSAGE_333DE_H
|
||||
#define MESSAGE_333DE_H
|
||||
#include "MessageQueue.h"
|
||||
#include "IHal.h"
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <vector>
|
||||
#include <thread>
|
||||
#define SF_MAX_PATH_LEN 128
|
||||
#define SF_MAX_PIC_LEN 64
|
||||
#define SF_SRCFILE_MAX 4
|
||||
#define SF_THUMB_FILE_MAX_LEN 20
|
||||
typedef struct sf_FILE_ATTR_S
|
||||
{
|
||||
SF_FILE_TYPE_E enFileTye;
|
||||
SF_CHAR thumbfileName[SF_MAX_PIC_LEN];
|
||||
SF_CHAR thumbfilePath[SF_MAX_PATH_LEN];
|
||||
SF_CHAR txtfilePath[SF_MAX_PATH_LEN];
|
||||
SF_CHAR txtfileName[SF_MAX_PIC_LEN];
|
||||
UINT32 thumbfileSize;
|
||||
|
||||
} SF_FILE_ATTR_S;
|
||||
typedef struct sf_SRCFILE_ATTR_S
|
||||
{
|
||||
UINT8 filecnt;
|
||||
SF_FILE_ATTR_S stfileattr[SF_SRCFILE_MAX];
|
||||
} SF_SRCFILE_ATTR_S;
|
||||
class VCameraMessageHandle
|
||||
{
|
||||
public:
|
||||
VCameraMessageHandle() = default;
|
||||
virtual ~VCameraMessageHandle() = default;
|
||||
virtual void CameraTaskMessageResponse(void) {}
|
||||
virtual void CheckSpontaneousFilesToUpload(void) {}
|
||||
};
|
||||
class VSDCardMessageHandle
|
||||
{
|
||||
public:
|
||||
VSDCardMessageHandle() = default;
|
||||
virtual ~VSDCardMessageHandle() = default;
|
||||
virtual void SetSDCardMessage(const SF_MESSAGE_CMD_SD_E &message) {}
|
||||
};
|
||||
class Message333DE : public MessageQueue, public std::enable_shared_from_this<Message333DE>
|
||||
{
|
||||
public:
|
||||
Message333DE();
|
||||
~Message333DE() = default;
|
||||
static std::shared_ptr<Message333DE> &GetInstance(std::shared_ptr<Message333DE> *impl = nullptr);
|
||||
void Init(void);
|
||||
void UnInit(void);
|
||||
void SetCameraMessageHandle(const std::shared_ptr<VCameraMessageHandle> &handle) { mCameraHandle = handle; }
|
||||
void SetSDCardMessageHandle(const std::shared_ptr<VSDCardMessageHandle> &handle) { mSDCardHandle = handle; }
|
||||
SINT32 sf_cardv_message_send(SINT32 cmdId, SINT8 *param, SINT32 paramLen);
|
||||
|
||||
private:
|
||||
void RecvThread(void);
|
||||
// void CheckSpontaneousFilesToUpload(void);
|
||||
const SF_CHAR *AppProcessMessageGetstatusstring(const SF_MESSAGE_TYPE_E &enType);
|
||||
SINT32 app_process_cmd_SD(SF_MESSAGE_BUF_S *pMessageBuf);
|
||||
|
||||
private:
|
||||
std::mutex mMutex;
|
||||
SF_SRCFILE_ATTR_S *pThumbFileCfg;
|
||||
bool mRecvThreadRuning;
|
||||
std::thread mMessageHandle;
|
||||
std::vector<CameraFileMessage> mSpontaneousFiles;
|
||||
std::shared_ptr<VCameraMessageHandle> mCameraHandle;
|
||||
std::shared_ptr<VSDCardMessageHandle> mSDCardHandle;
|
||||
};
|
||||
#endif // !MESSAGE_333DE_H
|
63
code/application/sifarsdk/333DE/hal/MessageQueue.cpp
Normal file
63
code/application/sifarsdk/333DE/hal/MessageQueue.cpp
Normal file
|
@ -0,0 +1,63 @@
|
|||
#include "MessageQueue.h"
|
||||
#include "Log.h"
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/ipc.h>
|
||||
#include <sys/msg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
MessageQueue::MessageQueue(const SF_CHAR *path) : pathname(path)
|
||||
{
|
||||
pMsgQueueId = -1;
|
||||
}
|
||||
SINT32 MessageQueue::MessageQueueCreate(void)
|
||||
{
|
||||
key_t key;
|
||||
SF_CHAR touchPath[128] = {0};
|
||||
if (access(pathname, F_OK) != 0)
|
||||
{
|
||||
sprintf(touchPath, "%s %s", "touch", pathname);
|
||||
system(touchPath);
|
||||
}
|
||||
if ((key = ftok(pathname, 'z')) < 0)
|
||||
{
|
||||
LogInfo("ftok error");
|
||||
return SF_FAILURE;
|
||||
}
|
||||
if ((pMsgQueueId = msgget(key, IPC_CREAT | 0660)) == -1)
|
||||
{
|
||||
LogError("MsgQueueId = %#x\n", pMsgQueueId);
|
||||
LogError("msgget failed errno.%02d is: %s\n", errno, strerror(errno));
|
||||
return SF_FAILURE;
|
||||
}
|
||||
LogInfo("MsgQueueId = %#x\n", pMsgQueueId);
|
||||
return SF_SUCCESS;
|
||||
}
|
||||
SINT32 MessageQueue::MessageQueueRecv(SF_MESSAGE_BUF_S *pMessageBuf)
|
||||
{
|
||||
// size_t msgsz = sizeof(pMessageBuf->cmdId) + sizeof(pMessageBuf->s32Wait) + sizeof(pMessageBuf->arg1) + sizeof(pMessageBuf->arg2) + sizeof(pMessageBuf->arg3);
|
||||
size_t msgsz = sizeof(pMessageBuf->cmdId) + sizeof(pMessageBuf->s32Wait) + sizeof(pMessageBuf->paramLen) + QUEUE_BUF_LENGTH;
|
||||
if (msgrcv(pMsgQueueId, pMessageBuf, msgsz, 0, IPC_NOWAIT) == -1)
|
||||
{
|
||||
return SF_FAILURE;
|
||||
}
|
||||
return SF_SUCCESS;
|
||||
}
|
||||
SINT32 MessageQueue::MessageQueueSend(SF_MESSAGE_BUF_S *pMessageBuf)
|
||||
{
|
||||
if (!pMessageBuf)
|
||||
{
|
||||
LogError("pMessageBuf is nullptr.\n");
|
||||
return SF_FAILURE;
|
||||
}
|
||||
pMessageBuf->mtype = 1;
|
||||
// size_t msgsz = sizeof(pMessageBuf->cmdId) + sizeof(pMessageBuf->s32Wait) + sizeof(pMessageBuf->arg1) + sizeof(pMessageBuf->arg2) + sizeof(pMessageBuf->arg3);
|
||||
size_t msgsz = sizeof(pMessageBuf->cmdId) + sizeof(pMessageBuf->s32Wait) + sizeof(pMessageBuf->paramLen) + pMessageBuf->paramLen;
|
||||
if (msgsnd(pMsgQueueId, pMessageBuf, msgsz, 0) == -1)
|
||||
{
|
||||
return SF_FAILURE;
|
||||
}
|
||||
return SF_SUCCESS;
|
||||
}
|
50
code/application/sifarsdk/333DE/hal/MessageQueue.h
Normal file
50
code/application/sifarsdk/333DE/hal/MessageQueue.h
Normal file
|
@ -0,0 +1,50 @@
|
|||
#ifndef MESSAGE_QUEUE_H
|
||||
#define MESSAGE_QUEUE_H
|
||||
#include "SfTypeDefine.h"
|
||||
constexpr int QUEUE_BUF_LENGTH = 256;
|
||||
constexpr signed int CMD_SERIES_FIX = 0xFF00;
|
||||
typedef struct sf_MESSAGE_Buf_S
|
||||
{
|
||||
long mtype;
|
||||
SINT32 cmdId;
|
||||
SINT32 s32Wait;
|
||||
SINT32 paramLen;
|
||||
SINT8 paramBuf[QUEUE_BUF_LENGTH];
|
||||
} SF_MESSAGE_BUF_S;
|
||||
typedef enum sf_MESSAGE_TYPE_E
|
||||
{
|
||||
CMD_KEY = 0x1A00,
|
||||
CMD_SD = 0x1B00,
|
||||
CMD_LED = 0x1C00,
|
||||
CMD_FILE = 0x1D00,
|
||||
CMD_POWEROFF = 0x1E00,
|
||||
CMD_VENC = 0x1F00,
|
||||
} SF_MESSAGE_TYPE_E;
|
||||
typedef enum sf_MESSAGE_CMD_SD_e
|
||||
{
|
||||
// CMD_SD_MOUNT_SUCCESS = 0x01,
|
||||
// CMD_SD_ERROR = 0x02,
|
||||
// CMD_SD_OUT = 0x03,
|
||||
// CMD_SD_FULL = 0x04,
|
||||
// CMD_SD_MOUNT_FAILURE = 0x05,
|
||||
CMD_SD_MOUNT_SUCCESS = 0x01 | CMD_SD,
|
||||
CMD_SD_ERROR = 0x02 | CMD_SD,
|
||||
CMD_SD_OUT = 0x03 | CMD_SD,
|
||||
CMD_SD_FULL = 0x04 | CMD_SD,
|
||||
CMD_SF_SD_FORMAT = 0x05 | CMD_SD,
|
||||
} SF_MESSAGE_CMD_SD_E;
|
||||
constexpr int PATH_NAME_LENGTH = 256;
|
||||
class MessageQueue
|
||||
{
|
||||
public:
|
||||
MessageQueue(const SF_CHAR *path);
|
||||
virtual ~MessageQueue() = default;
|
||||
SINT32 MessageQueueCreate(void);
|
||||
SINT32 MessageQueueRecv(SF_MESSAGE_BUF_S *pMessageBuf);
|
||||
SINT32 MessageQueueSend(SF_MESSAGE_BUF_S *pMessageBuf);
|
||||
|
||||
private:
|
||||
SINT32 pMsgQueueId;
|
||||
const SF_CHAR *pathname;
|
||||
};
|
||||
#endif // !MESSAGE_QUEUE_H
|
46
code/application/sifarsdk/333DE/hal/MultiColorLed.cpp
Normal file
46
code/application/sifarsdk/333DE/hal/MultiColorLed.cpp
Normal file
|
@ -0,0 +1,46 @@
|
|||
#include "MultiColorLed.h"
|
||||
|
||||
MultiColorLed::MultiColorLed(const SfLedIndex &led, const SF_LED_GPIO_IDX_E &pinRed, const SF_LED_GPIO_IDX_E &pinGreen)
|
||||
: mLed(led), mPinRed(pinRed), mPinGreen(pinGreen)
|
||||
{
|
||||
}
|
||||
MultiColorLed::~MultiColorLed()
|
||||
{
|
||||
// UnInit();
|
||||
}
|
||||
void MultiColorLed::Init(void)
|
||||
{
|
||||
GpioInit(mPinRed, GPIO_DIR_OUT);
|
||||
GpioInit(mPinGreen, GPIO_DIR_OUT);
|
||||
}
|
||||
void MultiColorLed::UnInit(void)
|
||||
{
|
||||
GpioDeinit(mPinRed);
|
||||
GpioDeinit(mPinGreen);
|
||||
}
|
||||
bool MultiColorLed::SetLedState(const SfLedState &state)
|
||||
{
|
||||
switch (state)
|
||||
{
|
||||
case SfLedState::SF_LED_STATE_GREEN:
|
||||
GpioSet(mPinRed, SF_HAL_LED_STATE_OFF);
|
||||
GpioSet(mPinGreen, SF_HAL_LED_STATE_ON);
|
||||
break;
|
||||
case SfLedState::SF_LED_STATE_RED:
|
||||
GpioSet(mPinGreen, SF_HAL_LED_STATE_OFF);
|
||||
GpioSet(mPinRed, SF_HAL_LED_STATE_ON);
|
||||
break;
|
||||
case SfLedState::SF_LED_STATE_YELLOW:
|
||||
GpioSet(mPinGreen, SF_HAL_LED_STATE_ON);
|
||||
GpioSet(mPinRed, SF_HAL_LED_STATE_ON);
|
||||
break;
|
||||
case SfLedState::SF_LED_STATE_OFF:
|
||||
GpioSet(mPinGreen, SF_HAL_LED_STATE_OFF);
|
||||
GpioSet(mPinRed, SF_HAL_LED_STATE_OFF);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
19
code/application/sifarsdk/333DE/hal/MultiColorLed.h
Normal file
19
code/application/sifarsdk/333DE/hal/MultiColorLed.h
Normal file
|
@ -0,0 +1,19 @@
|
|||
#ifndef MULTI_COLOR_LED_H
|
||||
#define MULTI_COLOR_LED_H
|
||||
#include "Gpio.h"
|
||||
class MultiColorLed : public VLedContrl, public Gpio
|
||||
{
|
||||
public:
|
||||
MultiColorLed() = default;
|
||||
MultiColorLed(const SfLedIndex &led, const SF_LED_GPIO_IDX_E &pinRed, const SF_LED_GPIO_IDX_E &pinGreen);
|
||||
~MultiColorLed();
|
||||
void Init(void) override;
|
||||
void UnInit(void) override;
|
||||
bool SetLedState(const SfLedState &state) override;
|
||||
|
||||
private:
|
||||
const SfLedIndex mLed; // This member variable cannot be changed.
|
||||
const SF_LED_GPIO_IDX_E mPinRed;
|
||||
const SF_LED_GPIO_IDX_E mPinGreen;
|
||||
};
|
||||
#endif // !MULTI_COLOR_LED_H
|
85
code/application/sifarsdk/333DE/hal/NetworkModule333DE.cpp
Normal file
85
code/application/sifarsdk/333DE/hal/NetworkModule333DE.cpp
Normal file
|
@ -0,0 +1,85 @@
|
|||
#include "NetworkModule333DE.h"
|
||||
#include "SfTypeDefine.h"
|
||||
#include "Log.h"
|
||||
#include <unistd.h>
|
||||
#include <thread>
|
||||
constexpr U32 GPIOID_SIM_INSRET = 4;
|
||||
constexpr U32 GPIOID_USB_MUX1 = 16;
|
||||
|
||||
RETURN_CODE NetworkModule333DE::Init(void)
|
||||
{
|
||||
LogInfo("NetworkModule333DE::Init.\n");
|
||||
GpioInit(GPIOID_SIM_INSRET, GPIO_DIR_IN);
|
||||
GpioInit(GPIOID_USB_MUX1, GPIO_DIR_OUT);
|
||||
GpioSet(GPIOID_USB_MUX1, GPIO_PIN_HIGHT);
|
||||
NetworkModule::Init();
|
||||
return VReturnCode::NewCode(VReturnCodeDefine::OK);
|
||||
}
|
||||
|
||||
RETURN_CODE NetworkModule333DE::UnInit(void)
|
||||
{
|
||||
NetworkModule::UnInit();
|
||||
GpioDeinit(GPIOID_SIM_INSRET);
|
||||
GpioDeinit(GPIOID_USB_MUX1);
|
||||
return VReturnCode::NewCode(VReturnCodeDefine::OK);
|
||||
}
|
||||
RETURN_CODE NetworkModule333DE::IsHardwareSupport(void)
|
||||
{
|
||||
LogInfo("NetworkModule333DE::IsHardwareSupport.\n");
|
||||
SINT8 regValue = 0;
|
||||
// TODO: Multi thread safe?
|
||||
// GpioInit(GPIOID_SIM_INSRET, GPIO_DIR_IN);
|
||||
GpioGet(GPIOID_SIM_INSRET, regValue);
|
||||
// GpioDeinit(GPIOID_SIM_INSRET);
|
||||
if (regValue & 0xFF)
|
||||
{
|
||||
return VReturnCode::NewCode(VReturnCodeDefine::OK);
|
||||
}
|
||||
LogError("Don't support usd network module.\n");
|
||||
return VReturnCode::NewCode(VReturnCodeDefine::NOT_OK_UNDEFINE_REASON);
|
||||
}
|
||||
RETURN_CODE NetworkModule333DE::NetDriverLoad(void)
|
||||
{
|
||||
constexpr int CMD_BUF_LENGTH = 128;
|
||||
char cmd[CMD_BUF_LENGTH] = {0};
|
||||
int ret = SF_FAILURE;
|
||||
for (UINT8 i = 0; i < 40; i++)
|
||||
{
|
||||
if (access("/dev/qcqmi0", F_OK) == SF_SUCCESS)
|
||||
{
|
||||
ret = SF_SUCCESS;
|
||||
LogInfo("usb net ko exist!\n");
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
usleep(100 * 1000);
|
||||
}
|
||||
}
|
||||
if (ret == SF_SUCCESS)
|
||||
{
|
||||
sprintf(cmd, "/customer/quectel-CM -n %d&", E_PDP_INDEX);
|
||||
int resutl = system(cmd);
|
||||
LogInfo("system function result = %d\n", resutl);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1000 * 5));
|
||||
return VReturnCode::NewCode(VReturnCodeDefine::OK);
|
||||
}
|
||||
return VReturnCode::NewCode(VReturnCodeDefine::NOT_OK_UNDEFINE_REASON);
|
||||
}
|
||||
unsigned int NetworkModule333DE::GetPdpIndex(void)
|
||||
{
|
||||
return E_PDP_INDEX;
|
||||
}
|
||||
const char *USB_NODE = "/dev/ttyUSB2";
|
||||
SF_SERIAL_DATA_FRAME_TYPE_S NetworkModule333DE::GetUsbNode(void)
|
||||
{
|
||||
SF_SERIAL_DATA_FRAME_TYPE_S node = {
|
||||
USB_NODE,
|
||||
'N',
|
||||
'N',
|
||||
8,
|
||||
1,
|
||||
460800};
|
||||
// LogInfo("Get 333DE node message.\n");
|
||||
return node;
|
||||
}
|
20
code/application/sifarsdk/333DE/hal/NetworkModule333DE.h
Normal file
20
code/application/sifarsdk/333DE/hal/NetworkModule333DE.h
Normal file
|
@ -0,0 +1,20 @@
|
|||
#ifndef NETWORK_MODULE_333DE_H
|
||||
#define NETWORK_MODULE_333DE_H
|
||||
#include "NetworkModule.h"
|
||||
#include "Gpio.h"
|
||||
#define E_PDP_INDEX 7
|
||||
#define V_PDP_INDEX 3
|
||||
#define A_PDP_INDEX 1
|
||||
class NetworkModule333DE : public NetworkModule, public Gpio
|
||||
{
|
||||
public:
|
||||
NetworkModule333DE() = default;
|
||||
virtual ~NetworkModule333DE() = default;
|
||||
RETURN_CODE Init(void) override;
|
||||
RETURN_CODE UnInit(void) override;
|
||||
RETURN_CODE IsHardwareSupport(void) override;
|
||||
RETURN_CODE NetDriverLoad(void) override;
|
||||
unsigned int GetPdpIndex(void) override;
|
||||
SF_SERIAL_DATA_FRAME_TYPE_S GetUsbNode(void) override;
|
||||
};
|
||||
#endif // !NETWORK_MODULE_333DE_H
|
35
code/application/sifarsdk/333DE/hal/OneColorLed.cpp
Normal file
35
code/application/sifarsdk/333DE/hal/OneColorLed.cpp
Normal file
|
@ -0,0 +1,35 @@
|
|||
#include "OneColorLed.h"
|
||||
#include "Log.h"
|
||||
OneColorLed::OneColorLed(const SfLedIndex &led, const SF_LED_GPIO_IDX_E &pin)
|
||||
: mLed(led), mPin(pin)
|
||||
{
|
||||
}
|
||||
OneColorLed::~OneColorLed()
|
||||
{
|
||||
// UnInit();
|
||||
}
|
||||
void OneColorLed::Init(void)
|
||||
{
|
||||
GpioInit(mPin, GPIO_DIR_OUT);
|
||||
}
|
||||
void OneColorLed::UnInit(void)
|
||||
{
|
||||
GpioDeinit(mPin);
|
||||
}
|
||||
bool OneColorLed::SetLedState(const SfLedState &state)
|
||||
{
|
||||
// LogInfo("SetLedState, PIN = %d\n", mPin);
|
||||
switch (state)
|
||||
{
|
||||
case SfLedState::SF_LED_STATE_ON:
|
||||
GpioSet(mPin, SF_HAL_LED_STATE_ON);
|
||||
break;
|
||||
case SfLedState::SF_LED_STATE_OFF:
|
||||
GpioSet(mPin, SF_HAL_LED_STATE_OFF);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
18
code/application/sifarsdk/333DE/hal/OneColorLed.h
Normal file
18
code/application/sifarsdk/333DE/hal/OneColorLed.h
Normal file
|
@ -0,0 +1,18 @@
|
|||
#ifndef ONE_COLOR_LED_H
|
||||
#define ONE_COLOR_LED_H
|
||||
#include "Gpio.h"
|
||||
class OneColorLed : public VLedContrl, public Gpio
|
||||
{
|
||||
public:
|
||||
OneColorLed() = default;
|
||||
OneColorLed(const SfLedIndex &led, const SF_LED_GPIO_IDX_E &pin);
|
||||
~OneColorLed();
|
||||
void Init(void);
|
||||
void UnInit(void);
|
||||
bool SetLedState(const SfLedState &state) override;
|
||||
|
||||
private:
|
||||
const SfLedIndex mLed; // This member variable cannot be changed.
|
||||
const SF_LED_GPIO_IDX_E mPin;
|
||||
};
|
||||
#endif // !ONE_COLOR_LED_H
|
65
code/application/sifarsdk/333DE/hal/SDCardHal.cpp
Normal file
65
code/application/sifarsdk/333DE/hal/SDCardHal.cpp
Normal file
|
@ -0,0 +1,65 @@
|
|||
#include "SDCardHal.h"
|
||||
#include "Log.h"
|
||||
SDCardHal::SDCardHal()
|
||||
{
|
||||
mState = SdCardEvent::END;
|
||||
mSDCardMessageConvert[CMD_SD_MOUNT_SUCCESS] = SdCardEvent::MOUNT_SUCCEED;
|
||||
mSDCardMessageConvert[CMD_SF_SD_FORMAT] = SdCardEvent::MOUNT_FAILED; // TODO:
|
||||
mSDCardMessageConvert[CMD_SD_ERROR] = SdCardEvent::SD_ERROR;
|
||||
mSDCardMessageConvert[CMD_SD_OUT] = SdCardEvent::SD_OUT;
|
||||
mSDCardMessageConvert[CMD_SD_FULL] = SdCardEvent::SD_FULL;
|
||||
}
|
||||
RETURN_CODE SDCardHal::GetSdCardState(SdCardEvent &state)
|
||||
{
|
||||
state = mState;
|
||||
return VReturnCode::NewCode(VReturnCodeDefine::OK);
|
||||
}
|
||||
RETURN_CODE SDCardHal::SetOwner(const std::shared_ptr<VSDCardOwner> &owner)
|
||||
{
|
||||
mOwner = owner;
|
||||
return VReturnCode::NewCode(VReturnCodeDefine::OK);
|
||||
}
|
||||
void SDCardHal::SetSDCardMessage(const SF_MESSAGE_CMD_SD_E &message)
|
||||
{
|
||||
std::map<SF_MESSAGE_CMD_SD_E, SdCardEvent>::iterator iter;
|
||||
iter = mSDCardMessageConvert.find(message);
|
||||
if (iter != mSDCardMessageConvert.end())
|
||||
{
|
||||
LogInfo("SetSDCardMessage = %d\n", static_cast<int>(message));
|
||||
mState = mSDCardMessageConvert[message];
|
||||
ReportMessageToOwner(mState);
|
||||
return;
|
||||
}
|
||||
LogError("SF_MESSAGE_CMD_SD_E wrong = %d.\n", static_cast<int>(message));
|
||||
}
|
||||
RETURN_CODE SDCardHal::Format(void)
|
||||
{
|
||||
system("echo format > /tmp/cardv_fifo");
|
||||
return VReturnCode::NewCode(VReturnCodeDefine::OK);
|
||||
}
|
||||
RETURN_CODE SDCardHal::MsdcMode(void)
|
||||
{
|
||||
system("/customer/gadget/udc-msdc.sh");
|
||||
return VReturnCode::NewCode(VReturnCodeDefine::OK);
|
||||
}
|
||||
RETURN_CODE SDCardHal::UvcMode(void)
|
||||
{
|
||||
system("echo uvc 1 > /tmp/cardv_fifo");
|
||||
return VReturnCode::NewCode(VReturnCodeDefine::OK);
|
||||
}
|
||||
void SDCardHal::ReportMessageToOwner(const SdCardEvent &message)
|
||||
{
|
||||
auto owner = mOwner.lock();
|
||||
if (!owner)
|
||||
{
|
||||
LogWarning("Owner is nullptr.\n");
|
||||
return;
|
||||
}
|
||||
if (mOwner.expired())
|
||||
{
|
||||
LogWarning("Owner shared ptr expired failed.\n");
|
||||
return;
|
||||
}
|
||||
LogInfo("ReportMessageToOwner.\n");
|
||||
owner->SDCardHalEvent(message);
|
||||
}
|
26
code/application/sifarsdk/333DE/hal/SDCardHal.h
Normal file
26
code/application/sifarsdk/333DE/hal/SDCardHal.h
Normal file
|
@ -0,0 +1,26 @@
|
|||
#ifndef SD_CARD_HAL_H
|
||||
#define SD_CARD_HAL_H
|
||||
#include "IHal.h"
|
||||
#include "Message333DE.h"
|
||||
#include <map>
|
||||
class SDCardHal : public VSDCardHal, public VSDCardMessageHandle
|
||||
{
|
||||
public:
|
||||
SDCardHal();
|
||||
~SDCardHal() = default;
|
||||
RETURN_CODE GetSdCardState(SdCardEvent &state) override;
|
||||
RETURN_CODE SetOwner(const std::shared_ptr<VSDCardOwner> &owner) override;
|
||||
void SetSDCardMessage(const SF_MESSAGE_CMD_SD_E &message) override;
|
||||
RETURN_CODE Format(void) override;
|
||||
RETURN_CODE MsdcMode(void) override;
|
||||
RETURN_CODE UvcMode(void) override;
|
||||
|
||||
private:
|
||||
void ReportMessageToOwner(const SdCardEvent &message);
|
||||
|
||||
private:
|
||||
SdCardEvent mState;
|
||||
std::map<SF_MESSAGE_CMD_SD_E, SdCardEvent> mSDCardMessageConvert;
|
||||
std::weak_ptr<VSDCardOwner> mOwner;
|
||||
};
|
||||
#endif // !SD_CARD_HAL_H
|
51
code/application/sifarsdk/333DE/hal/ShareMem.cpp
Normal file
51
code/application/sifarsdk/333DE/hal/ShareMem.cpp
Normal file
|
@ -0,0 +1,51 @@
|
|||
#include "ShareMem.h"
|
||||
#include <unistd.h>
|
||||
// #include <sys/types.h>
|
||||
// #include <sys/ipc.h>
|
||||
// #include <sys/msg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <sys/ipc.h>
|
||||
#include <sys/shm.h>
|
||||
|
||||
ShareMem::ShareMem(const SF_CHAR *path) : pathname(path)
|
||||
{
|
||||
mSharMemId = -1;
|
||||
}
|
||||
int ShareMem::Create(int size)
|
||||
{
|
||||
SF_CHAR touchPath[128] = {0};
|
||||
if (access(pathname, F_OK) != 0)
|
||||
{
|
||||
sprintf(touchPath, "%s %s", "touch", pathname);
|
||||
system(touchPath);
|
||||
}
|
||||
key_t key = ftok(pathname, 111);
|
||||
if (key < 0)
|
||||
{
|
||||
perror("ftok");
|
||||
return SF_FAILURE;
|
||||
}
|
||||
mSharMemId = shmget(key, size, IPC_CREAT | 0666);
|
||||
if (mSharMemId == -1)
|
||||
{
|
||||
perror("shmget");
|
||||
return SF_FAILURE;
|
||||
}
|
||||
return SF_SUCCESS;
|
||||
}
|
||||
int ShareMem::Destory(void)
|
||||
{
|
||||
if (shmctl(mSharMemId, IPC_RMID, NULL) < 0)
|
||||
{
|
||||
perror("shmctl");
|
||||
return SF_FAILURE;
|
||||
}
|
||||
return SF_SUCCESS;
|
||||
}
|
||||
void *ShareMem::Get(void)
|
||||
{
|
||||
return shmat(mSharMemId, NULL, 0);
|
||||
}
|
17
code/application/sifarsdk/333DE/hal/ShareMem.h
Normal file
17
code/application/sifarsdk/333DE/hal/ShareMem.h
Normal file
|
@ -0,0 +1,17 @@
|
|||
#ifndef SHARE_MEM_H
|
||||
#define SHARE_MEM_H
|
||||
#include "SfTypeDefine.h"
|
||||
class ShareMem
|
||||
{
|
||||
public:
|
||||
ShareMem(const SF_CHAR *path);
|
||||
virtual ~ShareMem() = default;
|
||||
int Create(int size);
|
||||
int Destory(void);
|
||||
void *Get(void);
|
||||
|
||||
private:
|
||||
const SF_CHAR *pathname;
|
||||
int mSharMemId;
|
||||
};
|
||||
#endif // !SHARE_MEM_H
|
4
code/application/sifarsdk/333DE/hal/include/IHal333DE.h
Normal file
4
code/application/sifarsdk/333DE/hal/include/IHal333DE.h
Normal file
|
@ -0,0 +1,4 @@
|
|||
#ifndef I_HAL_333DE_H
|
||||
#define I_HAL_333DE_H
|
||||
void Hal333DEMakePtrOverride(void);
|
||||
#endif // !I_HAL_333DE_H
|
2
code/application/sifarsdk/333DE/lib/README.MD
Normal file
2
code/application/sifarsdk/333DE/lib/README.MD
Normal file
|
@ -0,0 +1,2 @@
|
|||
# 依赖库目录
|
||||
   用于存放三方的依赖库中间文件。
|
2
code/application/sifarsdk/333DE/lib/README.md
Normal file
2
code/application/sifarsdk/333DE/lib/README.md
Normal file
|
@ -0,0 +1,2 @@
|
|||
# 依赖库目录
|
||||
   用于存放三方的依赖库中间文件。
|
|
@ -0,0 +1,12 @@
|
|||
/*
|
||||
* http://www.kurims.kyoto-u.ac.jp/~ooura/fft.html
|
||||
* Copyright Takuya OOURA, 1996-2001
|
||||
*
|
||||
* You may use, copy, modify and distribute this code for any purpose (include
|
||||
* commercial use) and without fee. Please refer to this package when you modify
|
||||
* this code.
|
||||
*
|
||||
* Changes:
|
||||
* Trivial type modifications by the WebRTC authors.
|
||||
* Trivial type modifications by the MSTAR authors.
|
||||
*/
|
|
@ -0,0 +1,29 @@
|
|||
Copyright (c) 2011, The WebRTC project authors. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in
|
||||
the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
|
||||
* Neither the name of Google nor the names of its contributors may
|
||||
be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@ -0,0 +1,12 @@
|
|||
/*
|
||||
* http://www.kurims.kyoto-u.ac.jp/~ooura/fft.html
|
||||
* Copyright Takuya OOURA, 1996-2001
|
||||
*
|
||||
* You may use, copy, modify and distribute this code for any purpose (include
|
||||
* commercial use) and without fee. Please refer to this package when you modify
|
||||
* this code.
|
||||
*
|
||||
* Changes:
|
||||
* Trivial type modifications by the WebRTC authors.
|
||||
* Trivial type modifications by the MSTAR authors.
|
||||
*/
|
|
@ -0,0 +1,29 @@
|
|||
Copyright (c) 2011, The WebRTC project authors. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in
|
||||
the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
|
||||
* Neither the name of Google nor the names of its contributors may
|
||||
be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,12 @@
|
|||
/*
|
||||
* http://www.kurims.kyoto-u.ac.jp/~ooura/fft.html
|
||||
* Copyright Takuya OOURA, 1996-2001
|
||||
*
|
||||
* You may use, copy, modify and distribute this code for any purpose (include
|
||||
* commercial use) and without fee. Please refer to this package when you modify
|
||||
* this code.
|
||||
*
|
||||
* Changes:
|
||||
* Trivial type modifications by the WebRTC authors.
|
||||
* Trivial type modifications by the MSTAR authors.
|
||||
*/
|
|
@ -0,0 +1,29 @@
|
|||
Copyright (c) 2011, The WebRTC project authors. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in
|
||||
the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
|
||||
* Neither the name of Google nor the names of its contributors may
|
||||
be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@ -0,0 +1,12 @@
|
|||
/*
|
||||
* http://www.kurims.kyoto-u.ac.jp/~ooura/fft.html
|
||||
* Copyright Takuya OOURA, 1996-2001
|
||||
*
|
||||
* You may use, copy, modify and distribute this code for any purpose (include
|
||||
* commercial use) and without fee. Please refer to this package when you modify
|
||||
* this code.
|
||||
*
|
||||
* Changes:
|
||||
* Trivial type modifications by the WebRTC authors.
|
||||
* Trivial type modifications by the MSTAR authors.
|
||||
*/
|
|
@ -0,0 +1,29 @@
|
|||
Copyright (c) 2011, The WebRTC project authors. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in
|
||||
the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
|
||||
* Neither the name of Google nor the names of its contributors may
|
||||
be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@ -0,0 +1,69 @@
|
|||
/* 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 _CUSEARLYINIT_PARA_H_
|
||||
#define _CUSEARLYINIT_PARA_H_
|
||||
|
||||
enum {
|
||||
EARLYINIT_PARAM_TYPE_MASTER,
|
||||
EARLYINIT_PARAM_TYPE_CUST_ROSE
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned short u16SnrEarlyFps;
|
||||
unsigned short u16SnrEarlyFlicker;
|
||||
unsigned long u32SnrEarlyShutter;
|
||||
unsigned long u32SnrEarlyGainX1024;
|
||||
unsigned long u32SnrEarlyDGain;
|
||||
unsigned long u32SnrEarlyShutterShort;
|
||||
unsigned long u32SnrEarlyGainX1024Short;
|
||||
unsigned long u32SnrEarlyDGainShort;
|
||||
unsigned short u16SnrEarlyAwbRGain;
|
||||
unsigned short u16SnrEarlyAwbGGain;
|
||||
unsigned short u16SnrEarlyAwbBGain;
|
||||
} __attribute__ ((packed)) MasterEarlyInitParam_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned short u16SnrEarlyFps;
|
||||
unsigned short u16SnrEarlyFlicker;
|
||||
unsigned long u32SnrEarlyShutter;
|
||||
unsigned long u32SnrEarlyGainX1024;
|
||||
unsigned long u32SnrEarlyDGain;
|
||||
unsigned long u32DeBugLevel_AWB_PERIOD;
|
||||
unsigned long u32DeBugLevel_AeEarlyStageCnt;
|
||||
unsigned short u16SnrEarlyAwbRGain;
|
||||
unsigned short u16SnrEarlyAwbGGain;
|
||||
unsigned short u16SnrEarlyAwbBGain;
|
||||
} __attribute__ ((packed)) CusEarlyInitParam_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned long u32Revision;
|
||||
unsigned long u32Size;
|
||||
|
||||
union
|
||||
{
|
||||
MasterEarlyInitParam_t tMasSnrEarlyInitParam;
|
||||
|
||||
// Add customize early-init parameter here, if any
|
||||
CusEarlyInitParam_t tCusSnrEarlyInitParam;
|
||||
|
||||
unsigned char u8Data[64];
|
||||
} u;
|
||||
|
||||
} IspSensorEarlyInitParam_t;
|
||||
|
||||
#endif // _CUSEARLYINIT_PARA_H_
|
|
@ -0,0 +1,977 @@
|
|||
/* 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 drv_ms_cus_sensor.h
|
||||
@brief This file contains Infinity ISP sensor driver interface.
|
||||
*/
|
||||
|
||||
/** @defgroup group1 ISP Sensor Driver Interface
|
||||
* @{
|
||||
*/
|
||||
|
||||
#ifndef DRV_MS_CUS_SENSOR_H_
|
||||
#define DRV_MS_CUS_SENSOR_H_
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include <sensor_i2c_api.h>
|
||||
|
||||
#define I2C_RETRYTIME (5)
|
||||
|
||||
#ifndef SUCCESS
|
||||
#define FAIL (-1)
|
||||
#define SUCCESS 0
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define EXPORT_CUS extern "C"
|
||||
#else
|
||||
#define EXPORT_CUS
|
||||
#endif
|
||||
|
||||
#define CUS_MSTART_CAMSENSOR_CAP_VERSION 0x0001
|
||||
|
||||
//#define usleep(usec) CamOsMsSleep(usec*1000);
|
||||
//#define usleep(usec) udelay(usec)
|
||||
//#define ARRAY_SIZE(a) (sizeof(a)/sizeof(a[0]))
|
||||
|
||||
#define SENSOR_DRIVER_MODE_NOT_SUUPORT (0xFFFF)
|
||||
|
||||
struct __ms_cus_sensor; /**< Sensor driver handle */
|
||||
//struct __ISensorAPI; /**< Sensor to ISP control interface */
|
||||
|
||||
/*! @brief Resolution descriptor*/
|
||||
typedef struct _cus_camsensor_res{
|
||||
u32 width; /**< Image crop width */
|
||||
u32 height; /**< Image crop height */
|
||||
u32 max_fps; /**< Max fps in this resolution */
|
||||
u32 min_fps; /**< Min fps in this resolution*/
|
||||
u32 crop_start_x;
|
||||
u32 crop_start_y;
|
||||
u32 nOutputWidth; /**< Sensor actual output width */
|
||||
u32 nOutputHeight; /**< Sensor actual output height */
|
||||
char strResDesc[32];
|
||||
} __attribute__((packed, aligned(4))) cus_camsensor_res;
|
||||
|
||||
/*! @brief Resolution list*/
|
||||
typedef struct _cus_camsensor_res_list
|
||||
{
|
||||
u32 num_res; /**< number of sensor resolution in list */
|
||||
u32 ulcur_res; /**< current sensor resolution*/
|
||||
cus_camsensor_res res[12]; /**< resolution list */
|
||||
} __attribute__((packed, aligned(4))) cus_camsensor_res_list;
|
||||
|
||||
|
||||
/*! @brief Select sensor type */
|
||||
typedef enum {
|
||||
ISP_SOC, /**< Not support */
|
||||
ISP_EXT /**< sensor without built-in ISP */
|
||||
} CUS_CAMSENSOR_ISPTYPE;
|
||||
|
||||
/*! @brief Sensor bayer raw pixel order */
|
||||
typedef enum {
|
||||
CUS_BAYER_RG = 0, /**< bayer data start with R channel */
|
||||
CUS_BAYER_GR, /**< bayer data start with Gr channel */
|
||||
CUS_BAYER_BG, /**< bayer data start with B channel */
|
||||
CUS_BAYER_GB /**< bayer data start with Gb channel */
|
||||
} CUS_SEN_BAYER;
|
||||
|
||||
typedef enum {
|
||||
CUS_RGBIR_R0 = 0,
|
||||
CUS_RGBIR_G0 = 1,
|
||||
CUS_RGBIR_B0 = 2,
|
||||
CUS_RGBIR_G1 = 3,
|
||||
CUS_RGBIR_G2 = 4,
|
||||
CUS_RGBIR_I0 = 5,
|
||||
CUS_RGBIR_G3 = 6,
|
||||
CUS_RGBIR_I1 = 7,
|
||||
CUS_RGBIR_NONE = 8
|
||||
} CUS_SEN_RGBIR;
|
||||
|
||||
/*! @brief Set sensor image mirror and flip.*/
|
||||
typedef enum {
|
||||
CUS_ORIT_M0F0, /**< mirror, flip unchanged */
|
||||
CUS_ORIT_M1F0, /**< mirror changed, flip unchanged */
|
||||
CUS_ORIT_M0F1, /**< mirror unchanged, flip changed */
|
||||
CUS_ORIT_M1F1, /**< mirror and flip changed */
|
||||
} CUS_CAMSENSOR_ORIT;
|
||||
|
||||
|
||||
/*! @brief Get input source type.*/
|
||||
typedef enum {
|
||||
CUS_SNR_ANADEC_SRC_NO_READY, /**< input no ready */
|
||||
CUS_SNR_ANADEC_SRC_PAL, /**< input type is PAL */
|
||||
CUS_SNR_ANADEC_SRC_NTSC, /**< input type is NTSC */
|
||||
CUS_SNR_ANADEC_SRC_HD, /**< input source type is HD */
|
||||
CUS_SNR_ANADEC_SRC_FHD, /**< input source type is FHD */
|
||||
CUS_SNR_ANADEC_SRC_DISCNT, /**< input disconnect */
|
||||
CUS_SNR_ANADEC_SRC_MAX, /**< input num max */
|
||||
}CUS_SNR_ANADEC_SRC_TYPE;
|
||||
|
||||
|
||||
/*! @brief ISP AE event notifycation*/
|
||||
typedef enum {
|
||||
CUS_FRAME_INACTIVE = 0, /**< Frame end */
|
||||
CUS_FRAME_ACTIVE = 1,/**< Frame start */
|
||||
} CUS_CAMSENSOR_AE_STATUS_NOTIFY;
|
||||
|
||||
/*! @brief Sensor bayer raw (8/10 bits) to 12bits mode control */
|
||||
typedef enum {
|
||||
CUS_SEN_8TO12_7074, /**< Do not use*/
|
||||
CUS_SEN_8TO12_7000, /**< Sensor bayer raw is 8 bits*/
|
||||
CUS_SEN_8TO12_114118, /**< Do not use*/
|
||||
CUS_SEN_8TO12_11400, /**< Do not use*/
|
||||
CUS_SEN_10TO12_9098, /**< Do not use*/
|
||||
CUS_SEN_10TO12_9000, /**< Sensor bayer raw is 10 bits*/
|
||||
CUS_SEN_10TO12_1121110, /**< Do not use*/
|
||||
CUS_SEN_10TO12_11200 /**< Do not use*/
|
||||
} CUS_SEN_FMT_CONV_MODE;
|
||||
|
||||
/*! @brief Sensor input raw data precision */
|
||||
typedef enum {
|
||||
CUS_DATAPRECISION_8 = 0, /**< raw data precision is 8bits */
|
||||
CUS_DATAPRECISION_10 = 1, /**< raw data precision is 10bits */
|
||||
CUS_DATAPRECISION_16 = 2, /**< raw data precision is 16bits */
|
||||
CUS_DATAPRECISION_12 = 3, /**< raw data precision is 12bits */
|
||||
CUS_DATAPRECISION_14 = 4, /**< raw data precision is 14bits */
|
||||
} CUS_DATAPRECISION;
|
||||
|
||||
/*! @brief Select sensor data intarface */
|
||||
typedef enum {
|
||||
CUS_SENIF_BUS_PARL = 0, /**< sensor data bus is parallel bus */
|
||||
CUS_SENIF_BUS_MIPI = 1, /**< sensor data bus is mipi */
|
||||
CUS_SENIF_BUS_BT601 = 2,
|
||||
CUS_SENIF_BUS_BT656 = 3,
|
||||
CUS_SENIF_BUS_BT1120 = 4,
|
||||
} CUS_SENIF_BUS;
|
||||
|
||||
typedef enum {
|
||||
CUS_SEN_INPUT_FORMAT_YUV422,
|
||||
CUS_SEN_INPUT_FORMAT_RGB,
|
||||
} CUS_SEN_INPUT_FORMAT;
|
||||
|
||||
/*! @brief Select pin polarity */
|
||||
typedef enum {
|
||||
CUS_CLK_POL_POS = 0, /**< High active */
|
||||
CUS_CLK_POL_NEG /**< Low active */
|
||||
} CUS_CLK_POL;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
CUS_SENSOR_YUV_ORDER_CY = 0,
|
||||
CUS_SENSOR_YUV_ORDER_YC = 1,
|
||||
}CUS_SENSOR_YUV_ORDER;
|
||||
|
||||
/*! @brief Sensor master clock select */
|
||||
typedef enum {
|
||||
CUS_CMU_CLK_27MHZ,
|
||||
CUS_CMU_CLK_21P6MHZ,
|
||||
CUS_CMU_CLK_12MHZ,
|
||||
CUS_CMU_CLK_5P4MHZ,
|
||||
CUS_CMU_CLK_36MHZ,
|
||||
CUS_CMU_CLK_54MHZ,
|
||||
CUS_CMU_CLK_43P2MHZ,
|
||||
CUS_CMU_CLK_61P7MHZ,
|
||||
CUS_CMU_CLK_72MHZ,
|
||||
CUS_CMU_CLK_48MHZ,
|
||||
CUS_CMU_CLK_24MHZ,
|
||||
CUS_CMU_CLK_37P125MHZ,
|
||||
CUS_CMU_CLK_LPLL_DIV1,
|
||||
CUS_CMU_CLK_LPLL_DIV2,
|
||||
CUS_CMU_CLK_LPLL_DIV4,
|
||||
CUS_CMU_CLK_LPLL_DIV8,
|
||||
} CUS_MCLK_FREQ; //Depends on chip.
|
||||
|
||||
//Depends on chip definition.
|
||||
typedef enum {
|
||||
CUS_SR0_PAR_DISABLE,
|
||||
CUS_SR0_PAR_MODE_1,
|
||||
CUS_SR0_PAR_MODE_2,
|
||||
} CUS_SR0_PAR_MODE;
|
||||
|
||||
//Depends on chip definition.
|
||||
typedef enum {
|
||||
CUS_SR0_BT656_DISABLE,
|
||||
CUS_SR0_BT656_MODE_1,
|
||||
CUS_SR0_BT656_MODE_2,
|
||||
CUS_SR0_BT656_MODE_3,
|
||||
CUS_SR0_BT656_MODE_4,
|
||||
} CUS_SR0_BT656_MODE;
|
||||
|
||||
//Depends on chip definition.
|
||||
typedef enum {
|
||||
CUS_SR1_BT656_DISABLE,
|
||||
CUS_SR1_BT656_MODE_1,
|
||||
} CUS_SR1_BT656_MODE;
|
||||
|
||||
//Depends on chip definition.
|
||||
typedef enum {
|
||||
CUS_SR0_BT601_DISABLE,
|
||||
CUS_SR0_BT601_MODE_1,
|
||||
CUS_SR0_BT601_MODE_2,
|
||||
CUS_SR0_BT601_MODE_3,
|
||||
CUS_SR0_BT601_MODE_4,
|
||||
} CUS_SR0_BT601_MODE;
|
||||
|
||||
//Depends on chip definition.
|
||||
typedef enum {
|
||||
CUS_SR0_MIPI_DISABLE,
|
||||
CUS_SR0_MIPI_MODE_1,
|
||||
CUS_SR0_MIPI_MODE_2,
|
||||
} CUS_SR0_MIPI_MODE;
|
||||
|
||||
//Depends on chip definition.
|
||||
typedef enum {
|
||||
CUS_SR1_MIPI_DISABLE,
|
||||
CUS_SR1_MIPI_MODE_1,
|
||||
CUS_SR1_MIPI_MODE_2,
|
||||
CUS_SR1_MIPI_MODE_3,
|
||||
CUS_SR1_MIPI_MODE_4,
|
||||
} CUS_SR1_MIPI_MODE;
|
||||
|
||||
//Depends on chip definition.
|
||||
typedef enum
|
||||
{
|
||||
CUS_VIF_BT656_EAV_DETECT = 0,
|
||||
CUS_VIF_BT656_SAV_DETECT = 1,
|
||||
}CUS_VIF_BT656_CHANNEL_SELECT;
|
||||
|
||||
//Depends on chip definition.
|
||||
typedef enum
|
||||
{
|
||||
CUS_VIF_BT656_VSYNC_DELAY_1LINE = 0,
|
||||
CUS_VIF_BT656_VSYNC_DELAY_2LINE = 1,
|
||||
CUS_VIF_BT656_VSYNC_DELAY_0LINE = 2,
|
||||
CUS_VIF_BT656_VSYNC_DELAY_AUTO = 3,
|
||||
}CUS_VIF_BT656_VSYNC_DELAY;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
CUS_SENSOR_FUNC_DISABLE = 0,
|
||||
CUS_SENSOR_FUNC_ENABLE = 1,
|
||||
}CUS_SENSOR_FUNC;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
CUS_SENSOR_PAD_GROUP_A = 0,
|
||||
CUS_SENSOR_PAD_GROUP_B = 1,
|
||||
}CUS_SENSOR_PAD_GROUP;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
CUS_SENSOR_CHANNEL_MODE_REALTIME_NORMAL = 0,
|
||||
CUS_SENSOR_CHANNEL_MODE_REALTIME_HDR = 1,
|
||||
CUS_SENSOR_CHANNEL_MODE_RAW_STORE = 2,
|
||||
CUS_SENSOR_CHANNEL_MODE_RAW_STORE_HDR = 3,
|
||||
}CUS_SENSOR_CHANNEL_MODE;
|
||||
|
||||
typedef struct {
|
||||
unsigned int gain;
|
||||
unsigned int offset;
|
||||
} CUS_GAIN_GAP_ARRAY;
|
||||
|
||||
//////////////////////////////////////
|
||||
// sensor functions
|
||||
//////////////////////////////////////
|
||||
|
||||
typedef struct {
|
||||
u32 length; //header length
|
||||
u32 version; //version
|
||||
}CUS_CAMSENSOR_CAP;
|
||||
|
||||
/////////////////// ISP for SENSOR API ///////////////////
|
||||
typedef enum {
|
||||
CUS_INT_TASK_AE = (1<<0),
|
||||
CUS_INT_TASK_AWB = (1<<1),
|
||||
CUS_INT_TASK_AF = (1<<2),
|
||||
CUS_INT_TASK_VS = (1<<3),
|
||||
CUS_INT_TASK_VDOS = (1<<4),
|
||||
} CUS_INT_TASK_TYPE;
|
||||
|
||||
#define MAX_RUN_ORDER 16
|
||||
typedef struct {
|
||||
u8 RunLength;
|
||||
u8 Orders[MAX_RUN_ORDER];
|
||||
u8 CurTaskType;
|
||||
} CUS_INT_TASK_ORDER;
|
||||
|
||||
/////////////////// Shutter Info ///////////////////////
|
||||
/*! @brief Report shutter information */
|
||||
typedef struct {
|
||||
u32 length; /**< struct size */
|
||||
u32 max; /**< maximun shutter in us*/
|
||||
u32 min; /**< minimum shutter in us*/
|
||||
u32 step; /**< shutter in step us*/
|
||||
} CUS_SHUTTER_INFO;
|
||||
|
||||
////////////////// CSI CLOCK ////////////////////////
|
||||
/*! @brief Select MIPI clock*/
|
||||
typedef enum {
|
||||
CUS_CSI_CLK_DISABLE = -1, /**< Disable MIPI clock*/
|
||||
CUS_CSI_CLK_108M = 0, /**< MIPI pixel rate 864Mbps (1-lane)*/
|
||||
CUS_CSI_CLK_86M = 1, /**< MIPI pixel rate 344Mbps(1-lane)*/
|
||||
CUS_CSI_CLK_144M = 2, /**< MIPI pixel rate 1152Mbps(1-lane)*/
|
||||
CUS_CSI_CLK_172M = 3,
|
||||
CUS_CSI_CLK_216M = 4,
|
||||
CUS_CSI_CLK_288M = 5,
|
||||
CUS_CSI_CLK_40M = 6,
|
||||
CUS_CSI_CLK_24M = 7,
|
||||
CUS_CSI_CLK_12M = 8,
|
||||
CUS_CSI_CLK_123M = 9
|
||||
}CUS_CSI_CLK;
|
||||
|
||||
///////////////// SENSOR PIN CONFIG/////////////////
|
||||
/*! @brief Sensor pin assignment*/
|
||||
typedef enum {
|
||||
CUS_SR_PAD_CFG_1 = 1, /**< Pin config for MIPI 1/2 lanes*/
|
||||
CUS_SR_PAD_CFG_MIPI = 1, /**< Pin config for MIPI 1/2 lanes*/
|
||||
CUS_SR_PAD_CFG_2 = 2, /**< Reserved */
|
||||
CUS_SR_PAD_CFG_3 = 3, /**< Reserved */
|
||||
CUS_SR_PAD_CFG_10BITS = 4, /**< Pin config for parallel interface 10 bits */
|
||||
CUS_SR_PAD_CFG_4 = 4, /**< Pin config for parallel interface 12 bits */
|
||||
CUS_SR_PAD_CFG_12BITS = 5, /**< Pin config for parallel interface 12 bits */
|
||||
CUS_SR_PAD_CFG_5 = 5, /**< Pin config for parallel interface 12 bits */
|
||||
CUS_SR_PAD_CFG_6 = 6 /**< Pin config for parallel interface 12 bits */
|
||||
}CUS_SR_PAD_CFG;
|
||||
|
||||
/*! @brief virtual channel0 hsync. mode */
|
||||
typedef enum
|
||||
{
|
||||
PACKET_HEADER_EDGE1 = 0, /**< packet header edge */
|
||||
PACKET_HEADER_EDGE2 = 1, /**< line end edge */
|
||||
PACKET_HEADER_EDGE3 = 2, /**< line start edge */
|
||||
PACKET_FOOTER_EDGE = 3, /**< packet footer edge */
|
||||
}CUS_CSI_VC_HS_MODE;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
CUS_HDR_MODE_NONE = 0,
|
||||
CUS_HDR_MODE_SONY_DOL = 1,
|
||||
CUS_HDR_MODE_DCG = 2,
|
||||
CUS_HDR_MODE_EMBEDDED_RAW8 = 3,
|
||||
CUS_HDR_MODE_EMBEDDED_RAW10 = 4,
|
||||
CUS_HDR_MODE_EMBEDDED_RAW12 = 5,
|
||||
CUS_HDR_MODE_EMBEDDED_RAW16 = 6, //Only for OV2718?
|
||||
CUS_HDR_MODE_LI = 7,
|
||||
CUS_HDR_MODE_MULTI_VC = 8,
|
||||
}CUS_HDR_MODE;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
// Index 0
|
||||
SENSOR_DRIVER_MODE_VGA_30P_RESOLUTION, // 640*360 30P
|
||||
SENSOR_DRIVER_MODE_VGA_50P_RESOLUTION, // 640*360 50P
|
||||
SENSOR_DRIVER_MODE_VGA_60P_RESOLUTION, // 640*360 60P
|
||||
SENSOR_DRIVER_MODE_VGA_100P_RESOLUTION, // 640*360 100P
|
||||
SENSOR_DRIVER_MODE_VGA_120P_RESOLUTION, // 640*360 120P
|
||||
|
||||
// Index 5
|
||||
SENSOR_DRIVER_MODE_HD_24P_RESOLUTION, // 1280*720 24P
|
||||
SENSOR_DRIVER_MODE_HD_30P_RESOLUTION, // 1280*720 30P
|
||||
SENSOR_DRIVER_MODE_HD_50P_RESOLUTION, // 1280*720 50P
|
||||
SENSOR_DRIVER_MODE_HD_60P_RESOLUTION, // 1280*720 60P
|
||||
SENSOR_DRIVER_MODE_HD_100P_RESOLUTION, // 1280*720 100P
|
||||
|
||||
// Index 10
|
||||
SENSOR_DRIVER_MODE_HD_120P_RESOLUTION, // 1280*720 120P
|
||||
SENSOR_DRIVER_MODE_1600x900_30P_RESOLUTION, // 1600*900 30P
|
||||
SENSOR_DRIVER_MODE_FULL_HD_15P_RESOLUTION, // 1920*1080 15P
|
||||
SENSOR_DRIVER_MODE_FULL_HD_24P_RESOLUTION, // 1920*1080 24P
|
||||
SENSOR_DRIVER_MODE_FULL_HD_25P_RESOLUTION, // 1920*1080 25P
|
||||
|
||||
// Index 15
|
||||
SENSOR_DRIVER_MODE_FULL_HD_30P_RESOLUTION, // 1920*1080 30P
|
||||
SENSOR_DRIVER_MODE_FULL_HD_50P_RESOLUTION, // 1920*1080 50P
|
||||
SENSOR_DRIVER_MODE_FULL_HD_60P_RESOLUTION, // 1920*1080 60P
|
||||
SENSOR_DRIVER_MODE_SUPER_HD_30P_RESOLUTION, // 2304*1296 30P
|
||||
SENSOR_DRIVER_MODE_SUPER_HD_25P_RESOLUTION, // 2304*1296 25P
|
||||
|
||||
// Index 20
|
||||
SENSOR_DRIVER_MODE_SUPER_HD_24P_RESOLUTION, // 2304*1296 24P
|
||||
SENSOR_DRIVER_MODE_1440_30P_RESOLUTION, // 2560*1440 30P
|
||||
SENSOR_DRIVER_MODE_2D7K_15P_RESOLUTION, // 2704*1524 15P
|
||||
SENSOR_DRIVER_MODE_2D7K_30P_RESOLUTION, // 2704*1524 30P
|
||||
SENSOR_DRIVER_MODE_4K2K_15P_RESOLUTION, // 3840*2160 15P
|
||||
|
||||
// Index 25
|
||||
SENSOR_DRIVER_MODE_4K2K_30P_RESOLUTION, // 3840*2160 30P
|
||||
SENSOR_DRIVER_MODE_4TO3_VGA_30P_RESOLUTION, // 640*480 30P
|
||||
SENSOR_DRIVER_MODE_4TO3_1D2M_30P_RESOLUTION, // 1280*960 30P
|
||||
SENSOR_DRIVER_MODE_4TO3_1D5M_30P_RESOLUTION, // 1440*1080 30P
|
||||
SENSOR_DRIVER_MODE_4TO3_3M_15P_RESOLUTION, // 2048*1536 15P
|
||||
|
||||
// Index 30
|
||||
SENSOR_DRIVER_MODE_4TO3_3M_30P_RESOLUTION, // 2048*1536 30P
|
||||
SENSOR_DRIVER_MODE_4TO3_5M_15P_RESOLUTION, // 2560*1920 15P
|
||||
SENSOR_DRIVER_MODE_4TO3_5M_30P_RESOLUTION, // 2560*1920 30P
|
||||
SENSOR_DRIVER_MODE_4TO3_8M_15P_RESOLUTION, // 3264*2448 15P
|
||||
SENSOR_DRIVER_MODE_4TO3_8M_30P_RESOLUTION, // 3264*2448 30P
|
||||
|
||||
// Index 35
|
||||
SENSOR_DRIVER_MODE_4TO3_10M_15P_RESOLUTION, // 3648*2736 15P
|
||||
SENSOR_DRIVER_MODE_4TO3_10M_30P_RESOLUTION, // 3648*2736 30P
|
||||
SENSOR_DRIVER_MODE_4TO3_12M_15P_RESOLUTION, // 4032*3024 15P
|
||||
SENSOR_DRIVER_MODE_4TO3_12M_30P_RESOLUTION, // 4032*3024 30P
|
||||
SENSOR_DRIVER_MODE_4TO3_14M_15P_RESOLUTION, // 4352*3264 15P
|
||||
|
||||
// Index 40
|
||||
SENSOR_DRIVER_MODE_4TO3_14M_30P_RESOLUTION, // 4352*3264 30P
|
||||
SENSOR_DRIVER_MODE_4K2K_24P_RESOLUTION,
|
||||
SENSOR_DRIVER_MODE_PAL_25P_RESOLUTION,
|
||||
SENSOR_DRIVER_MODE_NTSC_30P_RESOLUTION,
|
||||
|
||||
// For Camera Preview
|
||||
SENSOR_DRIVER_MODE_BEST_CAMERA_PREVIEW_RESOLUTION,
|
||||
SENSOR_DRIVER_MODE_BEST_CAMERA_CAPTURE_16TO9_RESOLUTION,
|
||||
SENSOR_DRIVER_MODE_BEST_CAMERA_CAPTURE_4TO3_RESOLUTION,
|
||||
SENSOR_DRIVER_MODE_FULL_HD_30P_RESOLUTION_HDR,
|
||||
} CUS_SNR_RESOLUTION;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
/**@brief ISP sensor interface control API */
|
||||
typedef struct __ISensorIfAPI //isp sensor interface API
|
||||
{
|
||||
/**@brief Reserved */
|
||||
void* pdata;
|
||||
|
||||
/** @brief Set sensor power down pin.
|
||||
@param[in] idx Sensor pad ID.
|
||||
@param[in] pol pin polarity.
|
||||
@retval SUCCESS or FAIL if error occurs.
|
||||
*/
|
||||
int (*PowerOff)(u32 idx, CUS_CLK_POL pol);
|
||||
|
||||
/** @brief Set sensor power reset pin.
|
||||
@param[in] idx Sensor pad ID.
|
||||
@param[in] pol pin polarity.
|
||||
@retval SUCCESS or FAIL if error occurs.
|
||||
*/
|
||||
int (*Reset)(u32 idx, CUS_CLK_POL pol);
|
||||
|
||||
/** @brief Configure sensor master clock.
|
||||
@param[in] idx Sensor pad ID.
|
||||
@param[in] bONOFF Clock ON/OFF control.
|
||||
@param[in] mclk Clock frequency Hz.
|
||||
@retval SUCCESS or FAIL if error occurs.
|
||||
*/
|
||||
int (*MCLK)(u32 idx, u8 bONOFF, CUS_MCLK_FREQ mclk);
|
||||
|
||||
/** @brief Query sensor master clock.
|
||||
@param[in] idx Sensor pad ID.
|
||||
@param[in] mclk Query if clock frequency Hz is available.
|
||||
@retval SUCCESS or FAIL if error occurs.
|
||||
*/
|
||||
int (*QueryMCLK)(u32 idx, CUS_MCLK_FREQ mclk);
|
||||
|
||||
/** @brief Query MIPI lane number.
|
||||
@param[in] idx Sensor pad ID.
|
||||
@param[in] lane_num Query max lane number.
|
||||
@retval SUCCESS or FAIL if error occurs.
|
||||
*/
|
||||
int (*QueryLaneNum)(u32 idx, u8 *max_lane);
|
||||
#if 0
|
||||
/** @brief Select pixel clock source
|
||||
@remarks Parallel interface only
|
||||
@param[in] handle Handle to sensor driver.
|
||||
@param[in] pclk_source Clock source.
|
||||
@retval SUCCESS or FAIL if error occurs.
|
||||
*/
|
||||
int (*PCLK)(CUS_PCLK_SOURCE pclk_source); //senect sensor
|
||||
|
||||
/** @brief Configure HSYNC pin polarity.
|
||||
@remarks Parallel interface only
|
||||
@param[in] handle Handle to sensor driver.
|
||||
@param[in] pol pin polarity.
|
||||
@retval SUCCESS or FAIL if error occurs.
|
||||
*/
|
||||
int (*HsyncPol)(CUS_CLK_POL pol);
|
||||
|
||||
/** @brief [parallel interface only] Configure VSYNC pin polarity.
|
||||
@param[in] handle Handle to sensor driver.
|
||||
@param[in] pol pin polarity.
|
||||
@retval SUCCESS or FAIL if error occurs.
|
||||
*/
|
||||
int (*VsyncPol)(CUS_CLK_POL pol);
|
||||
|
||||
/** @brief Configure PCLK pin polarity.
|
||||
@param[in] handle Handle to sensor driver.
|
||||
@param[in] pol pin polarity.
|
||||
@retval SUCCESS or FAIL if error occurs.
|
||||
*/
|
||||
int (*ClkPol)(CUS_CLK_POL pol);
|
||||
|
||||
/** @brief Configure sensor bayer raw pixel order
|
||||
@param[in] handle Handle to sensor driver.
|
||||
@param[in] bayer_id Select pixel order
|
||||
@retval SUCCESS or FAIL if error occurs.
|
||||
*/
|
||||
int (*BayerFmt)(CUS_SEN_BAYER bayer_id);
|
||||
|
||||
/** @brief Configure sensor RGBIR (8 or 10bits) convert to 12bit bits isp input, This config will be ignore for 12/16 bits sensor bayer raw input.
|
||||
@param[in] handle Handle to sensor driver.
|
||||
@param[in] mode Mode select
|
||||
@retval SUCCESS or FAIL if error occurs.
|
||||
*/
|
||||
int (*FmtConv)(CUS_SEN_FMT_CONV_MODE mode);
|
||||
|
||||
/** @brief Select sensor image data interface
|
||||
@param[in] handle Handle to sensor driver.
|
||||
@param[in] bus Sensor interface
|
||||
@retval SUCCESS or FAIL if error occurs.
|
||||
*/
|
||||
int (*DataBus)(CUS_SENIF_BUS bus);
|
||||
|
||||
/** @brief Configure sensor bayer raw pixel bits
|
||||
@param[in] handle Handle to sensor driver.
|
||||
@param[in] prec Select pixel bits
|
||||
@retval SUCCESS or FAIL if error occurs.
|
||||
*/
|
||||
int (*DataPrecision)(CUS_DATAPRECISION prec);
|
||||
|
||||
/** @brief Wait isp frame start event
|
||||
@param[in] handle Handle to sensor driver.
|
||||
@param[in] ms Max timeout in ms
|
||||
@retval SUCCESS or FAIL if error occurs.
|
||||
*/
|
||||
int (*WaitVStart)(int ms);
|
||||
|
||||
/** @brief Wait isp frame end event
|
||||
@param[in] handle Handle to sensor driver.
|
||||
@param[in] ms Max timeout in ms
|
||||
@retval SUCCESS or FAIL if error occurs.
|
||||
*/
|
||||
int (*WaitVEnd)(int ms);
|
||||
|
||||
/** @brief Configure 3A task order table
|
||||
@param[in] handle Handle to sensor driver.
|
||||
@param[in] tasks Task order table
|
||||
@retval SUCCESS or FAIL if error occurs.
|
||||
*/
|
||||
int (*Set3ATaskOrder)(CUS_INT_TASK_ORDER tasks);
|
||||
#endif
|
||||
/** @brief Select sensor IO pin assignment
|
||||
@param[in] idx Sensor pad ID.
|
||||
@param[in] ulSnrType Interface type.
|
||||
@param[in] ulSnrPadCfg Pin config.
|
||||
@retval SUCCESS or FAIL if error occurs.
|
||||
*/
|
||||
int (*SetIOPad)(u32 idx, CUS_SENIF_BUS ulSnrType, u32 ulSnrPadCfg);
|
||||
|
||||
//FOR CSI
|
||||
|
||||
/** @brief Set maximum mipi data rate (amount of all lans)
|
||||
@remarks MIPI interface only.
|
||||
@param[in] idx Sensor pad ID.
|
||||
@param[in] clk Max data rate.
|
||||
@retval SUCCESS or FAIL if error occurs.
|
||||
*/
|
||||
int (*SetCSI_Clk)(u32 idx, CUS_CSI_CLK clk);
|
||||
|
||||
/** @brief Set number of MIPI lanes
|
||||
@remarks MIPI interface only.
|
||||
@param[in] idx Sensor pad ID.
|
||||
@param[in] num_lan Number of lanes.
|
||||
@param[in] bon_off Clock ON/OFF control.
|
||||
@retval SUCCESS or FAIL if error occurs.
|
||||
*/
|
||||
int (*SetCSI_Lane)(u32 idx, u16 num_lan, u8 bon_off);
|
||||
|
||||
/** @brief Enable long packet type
|
||||
@remarks MIPI interface only
|
||||
@param[in] idx Sensor pad ID.
|
||||
@param[in] ctl_cfg0_15 Control flag bit[0:15]
|
||||
@param[in] ctl_cfg16_31 Control flag bit[16:31]
|
||||
@param[in] ctl_cfg32_47 Control flag bit[32:47]
|
||||
@retval SUCCESS or FAIL if error occurs.
|
||||
*/
|
||||
int (*SetCSI_LongPacketType)(u32 idx, u16 ctl_cfg0_15, u16 ctl_cfg16_31, u16 ctl_cfg32_47);
|
||||
|
||||
/** @brief Virtual channel0 hsync mode
|
||||
@remarks MIPI interface only
|
||||
@param[in] idx Sensor pad ID.
|
||||
@param[in] mode HSYNC mode.
|
||||
@retval SUCCESS or FAIL if error occurs.
|
||||
*/
|
||||
int (*SetCSI_VC0HSmode)(CUS_CSI_VC_HS_MODE mode);
|
||||
|
||||
/** @brief Configure MIPI capture start timing
|
||||
@remarks MIPI interface only
|
||||
@param[in] idx Sensor pad ID.
|
||||
@param[in] rx_clk_skip_ns
|
||||
@param[in] rx_data_skip_ns
|
||||
@retval SUCCESS or FAIL if error occurs.
|
||||
*/
|
||||
int (*SetCSI_clk_data_skip)(u32 idx, u8 rx_clk_skip_ns,u8 rx_data_skip_ns);
|
||||
|
||||
/** @brief Configure MIPI hdr mode
|
||||
@remarks MIPI interface only
|
||||
@param[in] idx Sensor pad ID.
|
||||
@param[in] hdr_mode HDR mode.
|
||||
@param[in] bon_off Clock ON/OFF control.
|
||||
@retval SUCCESS or FAIL if error occurs.
|
||||
*/
|
||||
int (*SetCSI_hdr_mode)(u32 idx, CUS_HDR_MODE hdr_mode, u8 bon_off);
|
||||
|
||||
#if 0
|
||||
/** @brief Configure sensor RGBIR raw pixel order
|
||||
@param[in] handle Handle to sensor driver.
|
||||
@param[in] bayer_id Select pixel order
|
||||
@retval SUCCESS or FAIL if error occurs.
|
||||
*/
|
||||
int (*RGBIRFmt)(CUS_SEN_RGBIR RGBIR_id);
|
||||
|
||||
/** @brief Skip input frame
|
||||
@param[in] handle Handle to sensor driver.
|
||||
@param[in] number of frames to skip
|
||||
@retval SUCCESS or FAIL if error occurs.
|
||||
*/
|
||||
int (*SetSkipFrame)(int cnt);
|
||||
#endif
|
||||
}ISensorIfAPI;
|
||||
|
||||
typedef union {
|
||||
//Parallel sensor
|
||||
struct {
|
||||
u32 parallel_reserved; //No additional attribute.
|
||||
} attr_parallel;
|
||||
|
||||
//MIPI sensor
|
||||
struct {
|
||||
u32 mipi_lane_num;
|
||||
u32 mipi_data_format; //0: YUV 422 format. 1: RGB pattern.
|
||||
u32 mipi_yuv_order; //YUYV or UYVY
|
||||
u32 mipi_hsync_mode;
|
||||
u32 mipi_sampling_delay; /** < MIPI start sampling delay */ /*bit 0~7: clk_skip_ns. bit 8~15: data_skip_ns*/
|
||||
CUS_HDR_MODE mipi_hdr_mode;
|
||||
u32 mipi_hdr_virtual_channel_num;
|
||||
} attr_mipi;
|
||||
|
||||
//BT656 sensor
|
||||
struct {
|
||||
u32 bt656_total_ch;
|
||||
u32 bt656_cur_ch;
|
||||
u32 bt656_ch_det_en;
|
||||
CUS_VIF_BT656_CHANNEL_SELECT bt656_ch_det_sel;
|
||||
u32 bt656_bit_swap;
|
||||
u32 bt656_8bit_mode;
|
||||
CUS_VIF_BT656_VSYNC_DELAY bt656_vsync_delay;
|
||||
u32 bt656_hsync_inv;
|
||||
u32 bt656_vsync_inv;
|
||||
u32 bt656_clamp_en;
|
||||
} attr_bt656;
|
||||
} InterfaceAttr_u;
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////
|
||||
|
||||
/** @brief Sensor driver interface \n
|
||||
The function here are implemented by sensor driver.
|
||||
*/
|
||||
typedef struct __ms_cus_sensor{
|
||||
short lib_idx; /**< Reserved , Do not use */
|
||||
char model_id[32]; /**< Please fill the sensor modle id string here then libcamera user can read model_id by using cameraGetSensorModelID() .*/
|
||||
void *sen_handle; /**< Reserved , Do not use */
|
||||
void *private_data;/**< sensor driver dependent variables should store in private_data and free when release */
|
||||
|
||||
app_i2c_cfg i2c_cfg; /**< Sensor i2c setting */
|
||||
i2c_handle_t *i2c_bus; /**< Handle to sensor i2c API. */
|
||||
ISensorIfAPI sensor_if_api; /**< sensor interface API */
|
||||
// ae parameters
|
||||
int ae_gain_delay; /**< How many frame delay from writing AE gain to take effect*/
|
||||
int ae_shutter_delay;/**< How many frame delay from writing AE shutter to take effect*/
|
||||
|
||||
int ae_gain_ctrl_num;
|
||||
int ae_shutter_ctrl_num;
|
||||
|
||||
// polarity
|
||||
CUS_CLK_POL reset_POLARITY; /** < Sensor REST pin polarity */
|
||||
CUS_CLK_POL pwdn_POLARITY; /** < Sensor Power Down pin polarity */
|
||||
CUS_CLK_POL VSYNC_POLARITY; /** < Sensor VSYNC polarity */
|
||||
CUS_CLK_POL HSYNC_POLARITY; /** < Sensor HSYNC pin polarity */
|
||||
CUS_CLK_POL PCLK_POLARITY; //** < Sensor Plxel Clock pin polarity */
|
||||
|
||||
// sensor data
|
||||
CUS_CAMSENSOR_ISPTYPE isp_type; /** < Always use ISP_EXT */
|
||||
CUS_SEN_BAYER bayer_id; /** < Sensor bayer raw pixel order */
|
||||
CUS_SEN_RGBIR RGBIR_id; /** < Sensor bayer raw pixel order */
|
||||
CUS_SENIF_BUS sif_bus; /** < Select sensor interface */
|
||||
CUS_DATAPRECISION data_prec; /** < Raw data bits */
|
||||
CUS_SEN_FMT_CONV_MODE data_mode; /** < Data convert mode*/
|
||||
CUS_CAMSENSOR_ORIT orient; /** < Sensor mirror/flip */
|
||||
u32 mclk; /** < Sensor master clock frequency */
|
||||
|
||||
cus_camsensor_res_list video_res_supported; /** < Resolution list */
|
||||
//sensor calibration
|
||||
u32 sat_mingain; /**< Minimum AE gain */
|
||||
|
||||
CUS_SENSOR_PAD_GROUP snr_pad_group;
|
||||
u32 channel_num; //Which VIF/ISP channel is occupied.
|
||||
u32 channel_mode; //real-time, RAW store, HDR...
|
||||
|
||||
InterfaceAttr_u interface_attr;
|
||||
|
||||
////////////////////////////////////////////////
|
||||
// system functions
|
||||
////////////////////////////////////////////////
|
||||
|
||||
/** @brief Sensor power on sequence, I2C must be ready after calling this function
|
||||
@param[in] handle Handle to sensor driver.
|
||||
@remark Following configuration need to set up at this stage \n
|
||||
@ref __ISensorIfAPI::Reset Reset sensor \n
|
||||
@ref __ISensorIfAPI::PowerOff Sensor power down pin \n
|
||||
@ref __ISensorIfAPI::MCLK Sensor master clock \n
|
||||
@ref __ISensorIfAPI::SetIOPad ISP sensor IO \n
|
||||
@ref __ISensorIfAPI::SetCSI_Clk [MIPI sensor only] MIPI clock\n
|
||||
@ref __ISensorIfAPI::HsyncPol Hsync polarity\n
|
||||
@ref __ISensorIfAPI::VsyncPol Vsync polarity\n
|
||||
@ref __ISensorIfAPI::ClkPol [Parallel sensor only] Pixel clock polarity\n
|
||||
@ref __ISensorIfAPI::BayerFmt Raw data format\n
|
||||
@ref __ISensorIfAPI::DataPrecision Raw data pixel bits\n
|
||||
@ref __ISensorIfAPI::FmtConv Raw data to ISP pixel convert\n
|
||||
@retval SUCCESS or FAIL if error occurs.
|
||||
*/
|
||||
int (*pCus_sensor_poweron)(struct __ms_cus_sensor* handle, u32 idx);
|
||||
|
||||
/** @brief Sensor power off
|
||||
@param[in] handle Handle to sensor driver.
|
||||
@retval SUCCESS or FAIL if error occurs.
|
||||
*/
|
||||
int (*pCus_sensor_poweroff)(struct __ms_cus_sensor* handle, u32 idx);
|
||||
|
||||
/** @brief Sensor initialization
|
||||
@param[in] handle Handle to sensor driver.
|
||||
@retval SUCCESS or FAIL if error occurs.
|
||||
@remark Fill sensor initial table here, Sensor beginning to output raw images after calling this function .
|
||||
*/
|
||||
int (*pCus_sensor_init)(struct __ms_cus_sensor* handle);
|
||||
|
||||
/** @brief Release resources those allocated in cus_camsensor_init_handle()
|
||||
@param[in] handle Handle to sensor driver.
|
||||
@retval SUCCESS or FAIL if error occurs.
|
||||
@remark Release resource allocated in \ref cus_camsensor_init_handle
|
||||
*/
|
||||
int (*pCus_sensor_release)(struct __ms_cus_sensor* handle);
|
||||
|
||||
/** @brief Enter sensor suspend mode
|
||||
@param[in] handle Handle to sensor driver.
|
||||
@retval SUCCESS or FAIL if error occurs.
|
||||
@remark ISP call this function before enter power saving mode
|
||||
*/
|
||||
int (*pCus_sensor_suspend)(struct __ms_cus_sensor* handle);
|
||||
|
||||
/** @brief Sensor wakeup
|
||||
@param[in] handle Handle to sensor driver.
|
||||
@retval SUCCESS or FAIL if error occurs.
|
||||
@remark ISP call this function after exit power saving mode
|
||||
*/
|
||||
int (*pCus_sensor_resume)(struct __ms_cus_sensor* handle);
|
||||
|
||||
/** @brief Enable sensor pattern mode if sensor hardward supported
|
||||
@param[in] handle Handle to sensor driver.
|
||||
@param[in] mode Pattern select, if 0 disable pattern mode.
|
||||
@retval SUCCESS or FAIL if error occurs.
|
||||
@remark This function is optional
|
||||
*/
|
||||
int (*pCus_sensor_SetPatternMode)(struct __ms_cus_sensor* handle,u32 mode);
|
||||
|
||||
// Normal
|
||||
|
||||
/** @brief Check sensor ID and report to ISP sensor match or not
|
||||
@param[in] handle Handle to sensor driver.
|
||||
@param[out] id Receive 4 bytes customer defined sensor ID.
|
||||
@retval Return SUCCESS if sensor matched or Retuen FAIL if sensor mismatch.
|
||||
@remark Read sensor ID through I2C
|
||||
*/
|
||||
int (*pCus_sensor_GetSensorID)(struct __ms_cus_sensor* handle, u32 *id);
|
||||
|
||||
/** @brief Get resolution list
|
||||
@param[in] handle Handle to sensor driver.
|
||||
@param[out] id Receive supported resolution list
|
||||
@retval Return SUCCESS or FAIL if error occurs.
|
||||
*/
|
||||
int (*pCus_sensor_GetVideoRes)(struct __ms_cus_sensor* handle, u32 res_idx, cus_camsensor_res **res);
|
||||
|
||||
/** @brief Get resolution list
|
||||
@param[in] handle Handle to sensor driver.
|
||||
@param[out] id Receive supported resolution list
|
||||
@retval Return SUCCESS or FAIL if error occurs.
|
||||
*/
|
||||
int (*pCus_sensor_GetCurVideoRes)(struct __ms_cus_sensor* handle, u32 *cur_idx, cus_camsensor_res **res);
|
||||
|
||||
/** @brief Select a sensor output resolution sensor list
|
||||
@param[in] handle Handle to sensor driver.
|
||||
@param[in] res_id Resolution id
|
||||
@retval Return SUCCESS or FAIL if error occurs.
|
||||
*/
|
||||
int (*pCus_sensor_SetVideoRes)(struct __ms_cus_sensor* handle, u32 res_id);
|
||||
|
||||
/** @brief Get sensor current mirror flip setting
|
||||
@param[in] handle Handle to sensor driver.
|
||||
@param[out] ori Receive Mirror/Flip setting.
|
||||
@retval Return SUCCESS or FAIL if error occurs.
|
||||
*/
|
||||
int (*pCus_sensor_GetOrien)(struct __ms_cus_sensor* handle, CUS_CAMSENSOR_ORIT *ori);
|
||||
|
||||
/** @brief Select a sensor mirror flip
|
||||
@param[in] handle Handle to sensor driver.
|
||||
@param[in] ori Mirror/Flip configuration.
|
||||
@retval Return SUCCESS or FAIL if error occurs.
|
||||
*/
|
||||
int (*pCus_sensor_SetOrien)(struct __ms_cus_sensor* handle, CUS_CAMSENSOR_ORIT ori);
|
||||
|
||||
/** @brief Get sensor capability
|
||||
@param[in] handle Handle to sensor driver.
|
||||
@param[out] cap Receive sensor capability
|
||||
@retval Return SUCCESS or FAIL if error occurs.
|
||||
*/
|
||||
int (*pCus_sensor_GetSensorCap)(struct __ms_cus_sensor* handle, CUS_CAMSENSOR_CAP *cap);
|
||||
|
||||
///////////////////////////////////////////////////////
|
||||
// AE
|
||||
///////////////////////////////////////////////////////
|
||||
// unit: micro seconds
|
||||
|
||||
/** @brief AE/Frame status change notification
|
||||
@param[in] handle Handle to sensor driver.
|
||||
@param[in] status Current status
|
||||
@retval Return SUCCESS or FAIL if error occurs.
|
||||
*/
|
||||
int (*pCus_sensor_AEStatusNotify)(struct __ms_cus_sensor* handle, CUS_CAMSENSOR_AE_STATUS_NOTIFY status);
|
||||
|
||||
/** @brief Get sensor shutter setting in us
|
||||
@param[in] handle Handle to sensor driver.
|
||||
@param[out] us Receive current shutter setting
|
||||
@retval Return SUCCESS or FAIL if error occurs.
|
||||
*/
|
||||
int (*pCus_sensor_GetAEUSecs)(struct __ms_cus_sensor* handle, u32 *us);
|
||||
|
||||
/** @brief Set sensor shutter in us
|
||||
@param[in] handle Handle to sensor driver.
|
||||
@param[in] us Shutter setting in us
|
||||
@retval Return SUCCESS or FAIL if error occurs.
|
||||
*/
|
||||
int (*pCus_sensor_SetAEUSecs)(struct __ms_cus_sensor* handle, u32 us);
|
||||
|
||||
// Gain: 1x = 1024
|
||||
/** @brief Get sensor current AE gain
|
||||
@param[in] handle Handle to sensor driver.
|
||||
@param[out] gain Receive current AE gain
|
||||
@retval Return SUCCESS or FAIL if error occurs.
|
||||
@remark gain: 1x = 1024
|
||||
*/
|
||||
int (*pCus_sensor_GetAEGain)(struct __ms_cus_sensor* handle, u32* gain);
|
||||
|
||||
/** @brief Set sensor AE gain
|
||||
@param[in] handle Handle to sensor driver.
|
||||
@param[in] gain AE gain
|
||||
@retval Return SUCCESS or FAIL if error occurs.
|
||||
@remark gain: 1x = 1024
|
||||
*/
|
||||
int (*pCus_sensor_SetAEGain)(struct __ms_cus_sensor* handle, u32 gain);
|
||||
|
||||
/** @brief Get supported shutter range
|
||||
@param[in] handle Handle to sensor driver.
|
||||
@param[out] min Receive minimum shutter which sensor can supported
|
||||
@param[out] min Receive maxiimum shutter which sensor can supported
|
||||
@retval Return SUCCESS or FAIL if error occurs.
|
||||
@remark gain: 1x = 1024
|
||||
*/
|
||||
int (*pCus_sensor_GetAEMinMaxUSecs)(struct __ms_cus_sensor* handle, u32 *min, u32 *max);
|
||||
|
||||
/** @brief Get supported AE gain range
|
||||
@param[in] handle Handle to sensor driver.
|
||||
@param[out] min Receive minimum gain which sensor can supported
|
||||
@param[out] min Receive maxiimum gain which sensor can supported
|
||||
@retval Return SUCCESS or FAIL if error occurs.
|
||||
@remark gain: 1x = 1024
|
||||
*/
|
||||
int (*pCus_sensor_GetAEMinMaxGain)(struct __ms_cus_sensor* handle, u32 *min, u32 *max);
|
||||
|
||||
// frame rate control
|
||||
/** @brief Get current fps
|
||||
@param[in] handle Handle to sensor driver.
|
||||
@retval Return current frame rate per second
|
||||
*/
|
||||
int (*pCus_sensor_GetFPS)(struct __ms_cus_sensor* handle);
|
||||
|
||||
/** @brief Set sensor output fps
|
||||
@param[in] handle Handle to sensor driver.
|
||||
@param[in] fps
|
||||
@retval Return SUCCESS or FAIL if fps is out of range.
|
||||
*/
|
||||
int (*pCus_sensor_SetFPS)(struct __ms_cus_sensor* handle, u32 fps);
|
||||
|
||||
//[OPTIONAL] sensor calibration
|
||||
/** @brief Optional function */
|
||||
int (*pCus_sensor_SetAEGain_cal)(struct __ms_cus_sensor* handle, u32);
|
||||
|
||||
/** @brief Optional function */
|
||||
int (*pCus_sensor_setCaliData_gain_linearity)(struct __ms_cus_sensor* handle, CUS_GAIN_GAP_ARRAY* pArray ,u32 num);
|
||||
|
||||
//Get shutter information
|
||||
/** @brief Get shutter information
|
||||
@param[in] handle Handle to sensor driver.
|
||||
@param[out] info return shutter information.
|
||||
@retval Return current frame rate per second
|
||||
*/
|
||||
int (*pCus_sensor_GetShutterInfo)(struct __ms_cus_sensor* handle,CUS_SHUTTER_INFO *info);
|
||||
|
||||
/** @brief Get resolution list number
|
||||
@param[in] handle Handle to sensor driver.
|
||||
@param[out] ulres_num resolution list number
|
||||
@retval Return SUCCESS or FAIL if error occurs.
|
||||
*/
|
||||
int (*pCus_sensor_GetVideoResNum)(struct __ms_cus_sensor* handle, u32 *ulres_num);
|
||||
|
||||
//Get shutter information
|
||||
/** @brief Sensor vendor command
|
||||
@param[in] handle Handle to sensor driver.
|
||||
@param[in] reserved
|
||||
@param[in] param Command input
|
||||
@param[out] out Command output
|
||||
@retval Return SUCCESS or FAIL if error occurs.
|
||||
*/
|
||||
int (*pCus_sensor_CustDefineFunction)(struct __ms_cus_sensor* handle,u32 cmd_id, void *param);
|
||||
|
||||
//Get Source Type
|
||||
/** @brief Get Source Type
|
||||
@param[in] handle Handle to sensor driver.
|
||||
@param[out] psrc_type info
|
||||
@retval Return SUCCESS or FAIL if error occurs.
|
||||
*/
|
||||
int (*pCus_sensor_GetSrcType)(struct __ms_cus_sensor* handle, CUS_SNR_ANADEC_SRC_TYPE *psrc_type);
|
||||
|
||||
} ms_cus_sensor;
|
||||
|
||||
/** @brief Sensor driver entry. ISP call this function before start using sensor driver. \n
|
||||
ISP pass \ref ms_cus_sensor struct to obtain the driver information and function entries. \n
|
||||
And all allocated resources here should be released at \ref __ms_cus_sensor::pCus_sensor_release.
|
||||
Every sensor driver must implement this api.
|
||||
@param[in] drv_handle A uninitialized \ref ms_cus_sensor struct from ISP, Sensor driver fill the driver information and function entries to drv_handle.
|
||||
@retval SUCCESS or FAIL if error occurs.
|
||||
*/
|
||||
|
||||
typedef int (*SensorInitHandle)(ms_cus_sensor* handle);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* DRV_MS_CUS_SENSOR_H_ */
|
||||
/** @} */ // end of ISP Sensor Driver Interface
|
|
@ -0,0 +1,161 @@
|
|||
/* 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 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;
|
||||
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, short reg, short 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, short reg, volatile short *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, int 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, int 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, int 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, int len);
|
||||
} i2c_handle_t;
|
||||
|
||||
/** @} */ // end of ISP I2C API
|
||||
|
||||
#endif
|
|
@ -0,0 +1,66 @@
|
|||
/* SigmaStar trade secret */
|
||||
/* Copyright (c) [2019~2020] SigmaStar Technology.
|
||||
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 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 _MI_IPU_H_
|
||||
#define _MI_IPU_H_
|
||||
|
||||
#include "mi_common.h"
|
||||
#include "mi_common_datatype.h"
|
||||
#include "mi_sys_datatype.h"
|
||||
#include "cam_os_wrapper.h"
|
||||
#include "mi_ipu_datatype.h"
|
||||
|
||||
//#define PERFORMANCE_DEBUG
|
||||
//#define IPU_DEBUG
|
||||
#define ipu_err(fmt, args...) CamOsPrintf(fmt, ##args)
|
||||
|
||||
#ifdef IPU_DEBUG
|
||||
#define ipu_info(fmt, args...) CamOsPrintf(fmt,##args)
|
||||
#else
|
||||
#define ipu_info(fmt, args...)
|
||||
#endif
|
||||
|
||||
|
||||
#define IPU_MAJOR_VERSION 1
|
||||
#define IPU_SUB_VERSION 0
|
||||
#define MACRO_TO_STR(macro) #macro
|
||||
#define IPU_VERSION_STR(major_version,sub_version) ({char *tmp = sub_version/100 ? \
|
||||
"mi_ipu_version_" MACRO_TO_STR(major_version)"." MACRO_TO_STR(sub_version) : sub_version/10 ? \
|
||||
"mi_ipu_version_" MACRO_TO_STR(major_version)".0" MACRO_TO_STR(sub_version) : \
|
||||
"mi_ipu_version_" MACRO_TO_STR(major_version)".00" MACRO_TO_STR(sub_version);tmp;})
|
||||
#define MI_IPU_API_VERSION IPU_VERSION_STR(IPU_MAJOR_VERSION,IPU_SUB_VERSION)
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
MI_S32 MI_IPU_CreateDevice(MI_IPU_DevAttr_t *pstIPUDevAttr, SerializedReadFunc pReadFunc, char *pReadCtx, MI_U32 FWSize);
|
||||
MI_S32 MI_IPU_DestroyDevice(void);
|
||||
MI_S32 MI_IPU_CreateCHN(MI_IPU_CHN *ptChnId, MI_IPUChnAttr_t *pstIPUChnAttr,SerializedReadFunc pReadFunc, char *pReadCtx);
|
||||
MI_S32 MI_IPU_DestroyCHN(MI_IPU_CHN u32ChnId);
|
||||
MI_S32 MI_IPU_GetInOutTensorDesc(MI_IPU_CHN u32ChnId, MI_IPU_SubNet_InputOutputDesc_t *pstDesc);
|
||||
MI_S32 MI_IPU_GetInputTensors(MI_IPU_CHN u32ChnId, MI_IPU_TensorVector_t *pstInputTensorVector);
|
||||
MI_S32 MI_IPU_PutInputTensors(MI_IPU_CHN u32ChnId, MI_IPU_TensorVector_t *pstInputTensorVector);
|
||||
MI_S32 MI_IPU_GetOutputTensors(MI_IPU_CHN u32ChnId, MI_IPU_TensorVector_t *pstInputTensorVector);
|
||||
MI_S32 MI_IPU_PutOutputTensors(MI_IPU_CHN u32ChnId, MI_IPU_TensorVector_t *pstInputTensorVector);
|
||||
MI_S32 MI_IPU_Invoke(MI_IPU_CHN u32ChnId, MI_IPU_TensorVector_t *pstInputTensorVector, MI_IPU_TensorVector_t *pstOuputTensorVector);
|
||||
MI_S32 MI_IPU_GetOfflineModeStaticInfo(SerializedReadFunc pReadFunc, char *pReadCtx, MI_IPU_OfflineModelStaticInfo_t *pStaticInfo);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -0,0 +1,134 @@
|
|||
/* SigmaStar trade secret */
|
||||
/* Copyright (c) [2019~2020] SigmaStar Technology.
|
||||
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 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 _MI_IPU_DATATYPE_H_
|
||||
#define _MI_IPU_DATATYPE_H_
|
||||
|
||||
|
||||
#define MI_IPU_MAX_TENSOR_DIM 8
|
||||
#define MI_IPU_CHN_MAX 48
|
||||
#define MI_IPU_MAX_INPUT_TENSOR_CNT 61
|
||||
#define MI_IPU_MAX_OUTPUT_TENSOR_CNT 61
|
||||
#define MI_IPU_MAX_TENSOR_CNT \
|
||||
((MI_IPU_MAX_INPUT_TENSOR_CNT>MI_IPU_MAX_OUTPUT_TENSOR_CNT)? \
|
||||
MI_IPU_MAX_INPUT_TENSOR_CNT:MI_IPU_MAX_OUTPUT_TENSOR_CNT)
|
||||
|
||||
#define MAX_TENSOR_NAME_LEN 256
|
||||
#define MAX_IPU_INPUT_OUTPUT_BUF_DEPTH 3
|
||||
#define MI_IPU_MAX_TIMEOUT (20*1000) //20 seconds
|
||||
#define MI_IPU_BOOT_MAX_TIMEOUT (5*1000) //5 seconds
|
||||
|
||||
#define YUV420_W_PITCH_ALIGNMENT 16
|
||||
#define YUV420_H_PITCH_ALIGNMENT 2
|
||||
#define XRGB_W_PITCH_ALIGNMENT 16
|
||||
|
||||
|
||||
typedef MI_U32 MI_IPU_CHN;
|
||||
typedef int (*SerializedReadFunc)(void *dst_buf,int offset, int size, char *ctx);
|
||||
|
||||
typedef enum
|
||||
{
|
||||
MI_IPU_FORMAT_U8,
|
||||
MI_IPU_FORMAT_NV12,
|
||||
MI_IPU_FORMAT_INT16,
|
||||
MI_IPU_FORMAT_INT32,
|
||||
MI_IPU_FORMAT_INT8,
|
||||
MI_IPU_FORMAT_FP32,
|
||||
MI_IPU_FORMAT_UNKNOWN,
|
||||
MI_IPU_FORMAT_ARGB8888,
|
||||
MI_IPU_FORMAT_ABGR8888,
|
||||
} MI_IPU_ELEMENT_FORMAT;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
E_IPU_ERR_INVALID_CHNID = 1, /* invalid channel ID */
|
||||
E_IPU_ERR_CHNID_EXIST, /* channel exists */
|
||||
E_IPU_ERR_CHNID_UNEXIST, /* channel unexists */
|
||||
E_IPU_ERR_NOMEM, /* failure caused by malloc memory */
|
||||
E_IPU_ERR_NOBUF, /* failure caused by malloc buffer */
|
||||
E_IPU_ERR_BADADDR, /* bad address, buffer address doesn't get from IPU buffer allocator */
|
||||
E_IPU_ERR_SYS_TIMEOUT, /* system timeout*/
|
||||
E_IPU_ERR_FILE_OPERATION, /* file cannot be open or read or write */
|
||||
E_IPU_ERR_ILLEGAL_TENSOR_BUFFER_SIZE, /* tensor buffer size cannot meet the requirement, usually less than requirement*/
|
||||
E_IPU_ERR_ILLEGAL_BUFFER_DEPTH, /* input or output buffer depth quantum is more than maximum number */
|
||||
E_IPU_ERR_ILLEGAL_INPUT_OUTPUT_DESC, /* network description is illegal, usually mean input or output buffer quantum is wrong */
|
||||
E_IPU_ERR_ILLEGAL_INPUT_OUTPUT_PARAM, /* user's input or output buffer quantum isn't match network description */
|
||||
E_IPU_ERR_MAP, /* address mapping error */
|
||||
E_IPU_ERR_INIT_FIRMWARE, /* fail to init ipu firmware */
|
||||
E_IPU_ERR_CREATE_CHANNEL, /* fail to create channel */
|
||||
E_IPU_ERR_DESTROY_CHANNEL, /* fail to destroy channel */
|
||||
E_IPU_ERR_INVOKE, /* fail to invoke */
|
||||
E_IPU_ERR_SET_MALLOC_REGION, /* fail to set malloc region for freertos */
|
||||
E_IPU_ERR_SET_IPU_PARAMETER, /* fail to set IPU parameter */
|
||||
E_IPU_ERR_INVALID_PITCH_ALIGNMENT, /* invalid pitch alignment */
|
||||
E_IPU_ERR_NO_CREATED_IPU_DEVICE, /* there is no created IPU device */
|
||||
E_IPU_ERR_GET_IPU_VERSION, /* fail to get ipu version from ipu firmware */
|
||||
E_IPU_ERR_MISMATCH_IPU_HEAD_FILE, /* ipu head files version isn't matching */
|
||||
E_IPU_ERR_NO_SUPPORT_REQ, /* ipu firmware do not support this request */
|
||||
E_IPU_ERR_FAILED, /* unexpected error */
|
||||
E_IPU_ERR_SEND_REQUEST, /* failt to send request to IPU */
|
||||
E_IPU_ERR_GET_FIRMWARE_INFO, /* fail to get ipu firmware information */
|
||||
E_IPU_ERR_NO_AVAILABLE_CHNID = 1<<8, /* there is no available channel */
|
||||
}IPU_ErrCode_e;
|
||||
|
||||
typedef struct MI_IPU_TensorDesc_s {
|
||||
MI_U32 u32TensorDim;
|
||||
MI_IPU_ELEMENT_FORMAT eElmFormat;
|
||||
MI_U32 u32TensorShape[MI_IPU_MAX_TENSOR_DIM]; // 3,299,299
|
||||
char name[MAX_TENSOR_NAME_LEN];
|
||||
MI_U32 u32InnerMostStride;
|
||||
MI_FLOAT fScalar;
|
||||
MI_S64 s64ZeroPoint;
|
||||
MI_S32 s32AlignedBufSize;
|
||||
} MI_IPU_TensorDesc_t;
|
||||
|
||||
typedef struct MI_IPU_SubNet_InputOutputDesc_s {
|
||||
MI_U32 u32InputTensorCount;
|
||||
MI_U32 u32OutputTensorCount;
|
||||
MI_IPU_TensorDesc_t astMI_InputTensorDescs[MI_IPU_MAX_INPUT_TENSOR_CNT];
|
||||
MI_IPU_TensorDesc_t astMI_OutputTensorDescs[MI_IPU_MAX_OUTPUT_TENSOR_CNT];
|
||||
} MI_IPU_SubNet_InputOutputDesc_t;
|
||||
|
||||
typedef struct MI_IPU_Tensor_s {
|
||||
//MI_IPU_TensorShape_t *pstTensorShape;
|
||||
//MI_BOOL bRewiseRGBOrder;//only valid under U8 & C=3,4 or NV12
|
||||
void *ptTensorData[2];
|
||||
MI_PHY phyTensorAddr[2];//notice that this is miu bus addr,not cpu bus addr.
|
||||
} MI_IPU_Tensor_t;
|
||||
|
||||
typedef struct MI_IPU_TensorVector_s {
|
||||
MI_U32 u32TensorCount;
|
||||
MI_IPU_Tensor_t astArrayTensors[MI_IPU_MAX_TENSOR_CNT];
|
||||
} MI_IPU_TensorVector_t;
|
||||
|
||||
typedef struct MI_IPU_DevAttr_s {
|
||||
MI_U32 u32MaxVariableBufSize;
|
||||
MI_U32 u32YUV420_W_Pitch_Alignment; //default is 16
|
||||
MI_U32 u32YUV420_H_Pitch_Alignment; //default is 2
|
||||
MI_U32 u32XRGB_W_Pitch_Alignment; //default is 16
|
||||
} MI_IPU_DevAttr_t;
|
||||
|
||||
typedef struct MI_IPUChnAttr_s {
|
||||
MI_U32 u32SubNetId;
|
||||
MI_U32 u32OutputBufDepth;
|
||||
MI_U32 u32InputBufDepth;
|
||||
} MI_IPUChnAttr_t;
|
||||
|
||||
typedef struct MI_IPU_OfflineModelStaticInfo_s {
|
||||
MI_U32 u32VariableBufferSize;
|
||||
MI_U32 u32OfflineModelSize;
|
||||
} MI_IPU_OfflineModelStaticInfo_t;
|
||||
|
||||
#endif // !_MI_IPU_DATATYPE_H_
|
|
@ -0,0 +1,134 @@
|
|||
/* SigmaStar trade secret */
|
||||
/* Copyright (c) [2019~2020] SigmaStar Technology.
|
||||
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 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 _MI_IPU_DATATYPE_H_
|
||||
#define _MI_IPU_DATATYPE_H_
|
||||
|
||||
|
||||
#define MI_IPU_MAX_TENSOR_DIM 8
|
||||
#define MI_IPU_CHN_MAX 16
|
||||
#define MI_IPU_MAX_INPUT_TENSOR_CNT 61
|
||||
#define MI_IPU_MAX_OUTPUT_TENSOR_CNT 61
|
||||
#define MI_IPU_MAX_TENSOR_CNT \
|
||||
((MI_IPU_MAX_INPUT_TENSOR_CNT>MI_IPU_MAX_OUTPUT_TENSOR_CNT)? \
|
||||
MI_IPU_MAX_INPUT_TENSOR_CNT:MI_IPU_MAX_OUTPUT_TENSOR_CNT)
|
||||
|
||||
#define MAX_TENSOR_NAME_LEN 256
|
||||
#define MAX_IPU_INPUT_OUTPUT_BUF_DEPTH 3
|
||||
#define MI_IPU_MAX_TIMEOUT (20*1000) //20 seconds
|
||||
#define MI_IPU_BOOT_MAX_TIMEOUT (5*1000) //5 seconds
|
||||
|
||||
#define YUV420_W_PITCH_ALIGNMENT 16
|
||||
#define YUV420_H_PITCH_ALIGNMENT 2
|
||||
#define XRGB_W_PITCH_ALIGNMENT 16
|
||||
|
||||
|
||||
typedef MI_U32 MI_IPU_CHN;
|
||||
typedef int (*SerializedReadFunc)(void *dst_buf,int offset, int size, char *ctx);
|
||||
|
||||
typedef enum
|
||||
{
|
||||
MI_IPU_FORMAT_U8,
|
||||
MI_IPU_FORMAT_NV12,
|
||||
MI_IPU_FORMAT_INT16,
|
||||
MI_IPU_FORMAT_INT32,
|
||||
MI_IPU_FORMAT_INT8,
|
||||
MI_IPU_FORMAT_FP32,
|
||||
MI_IPU_FORMAT_UNKNOWN,
|
||||
MI_IPU_FORMAT_ARGB8888,
|
||||
MI_IPU_FORMAT_ABGR8888,
|
||||
} MI_IPU_ELEMENT_FORMAT;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
E_IPU_ERR_INVALID_CHNID = 1, /* invalid channel ID */
|
||||
E_IPU_ERR_CHNID_EXIST, /* channel exists */
|
||||
E_IPU_ERR_CHNID_UNEXIST, /* channel unexists */
|
||||
E_IPU_ERR_NOMEM, /* failure caused by malloc memory */
|
||||
E_IPU_ERR_NOBUF, /* failure caused by malloc buffer */
|
||||
E_IPU_ERR_BADADDR, /* bad address, buffer address doesn't get from IPU buffer allocator */
|
||||
E_IPU_ERR_SYS_TIMEOUT, /* system timeout*/
|
||||
E_IPU_ERR_FILE_OPERATION, /* file cannot be open or read or write */
|
||||
E_IPU_ERR_ILLEGAL_TENSOR_BUFFER_SIZE, /* tensor buffer size cannot meet the requirement, usually less than requirement*/
|
||||
E_IPU_ERR_ILLEGAL_BUFFER_DEPTH, /* input or output buffer depth quantum is more than maximum number */
|
||||
E_IPU_ERR_ILLEGAL_INPUT_OUTPUT_DESC, /* network description is illegal, usually mean input or output buffer quantum is wrong */
|
||||
E_IPU_ERR_ILLEGAL_INPUT_OUTPUT_PARAM, /* user's input or output buffer quantum isn't match network description */
|
||||
E_IPU_ERR_MAP, /* address mapping error */
|
||||
E_IPU_ERR_INIT_FIRMWARE, /* fail to init ipu firmware */
|
||||
E_IPU_ERR_CREATE_CHANNEL, /* fail to create channel */
|
||||
E_IPU_ERR_DESTROY_CHANNEL, /* fail to destroy channel */
|
||||
E_IPU_ERR_INVOKE, /* fail to invoke */
|
||||
E_IPU_ERR_SET_MALLOC_REGION, /* fail to set malloc region for freertos */
|
||||
E_IPU_ERR_SET_IPU_PARAMETER, /* fail to set IPU parameter */
|
||||
E_IPU_ERR_INVALID_PITCH_ALIGNMENT, /* invalid pitch alignment */
|
||||
E_IPU_ERR_NO_CREATED_IPU_DEVICE, /* there is no created IPU device */
|
||||
E_IPU_ERR_GET_IPU_VERSION, /* fail to get ipu version from ipu firmware */
|
||||
E_IPU_ERR_MISMATCH_IPU_HEAD_FILE, /* ipu head files version isn't matching */
|
||||
E_IPU_ERR_NO_SUPPORT_REQ, /* ipu firmware do not support this request */
|
||||
E_IPU_ERR_FAILED, /* unexpected error */
|
||||
E_IPU_ERR_SEND_REQUEST, /* failt to send request to IPU */
|
||||
E_IPU_ERR_GET_FIRMWARE_INFO, /* fail to get ipu firmware information */
|
||||
E_IPU_ERR_NO_AVAILABLE_CHNID = 1<<8, /* there is no available channel */
|
||||
}IPU_ErrCode_e;
|
||||
|
||||
typedef struct MI_IPU_TensorDesc_s {
|
||||
MI_U32 u32TensorDim;
|
||||
MI_IPU_ELEMENT_FORMAT eElmFormat;
|
||||
MI_U32 u32TensorShape[MI_IPU_MAX_TENSOR_DIM]; // 3,299,299
|
||||
char name[MAX_TENSOR_NAME_LEN];
|
||||
MI_U32 u32InnerMostStride;
|
||||
MI_FLOAT fScalar;
|
||||
MI_S64 s64ZeroPoint;
|
||||
MI_S32 s32AlignedBufSize;
|
||||
} MI_IPU_TensorDesc_t;
|
||||
|
||||
typedef struct MI_IPU_SubNet_InputOutputDesc_s {
|
||||
MI_U32 u32InputTensorCount;
|
||||
MI_U32 u32OutputTensorCount;
|
||||
MI_IPU_TensorDesc_t astMI_InputTensorDescs[MI_IPU_MAX_INPUT_TENSOR_CNT];
|
||||
MI_IPU_TensorDesc_t astMI_OutputTensorDescs[MI_IPU_MAX_OUTPUT_TENSOR_CNT];
|
||||
} MI_IPU_SubNet_InputOutputDesc_t;
|
||||
|
||||
typedef struct MI_IPU_Tensor_s {
|
||||
//MI_IPU_TensorShape_t *pstTensorShape;
|
||||
//MI_BOOL bRewiseRGBOrder;//only valid under U8 & C=3,4 or NV12
|
||||
void *ptTensorData[2];
|
||||
MI_PHY phyTensorAddr[2];//notice that this is miu bus addr,not cpu bus addr.
|
||||
} MI_IPU_Tensor_t;
|
||||
|
||||
typedef struct MI_IPU_TensorVector_s {
|
||||
MI_U32 u32TensorCount;
|
||||
MI_IPU_Tensor_t astArrayTensors[MI_IPU_MAX_TENSOR_CNT];
|
||||
} MI_IPU_TensorVector_t;
|
||||
|
||||
typedef struct MI_IPU_DevAttr_s {
|
||||
MI_U32 u32MaxVariableBufSize;
|
||||
MI_U32 u32YUV420_W_Pitch_Alignment; //default is 16
|
||||
MI_U32 u32YUV420_H_Pitch_Alignment; //default is 2
|
||||
MI_U32 u32XRGB_W_Pitch_Alignment; //default is 16
|
||||
} MI_IPU_DevAttr_t;
|
||||
|
||||
typedef struct MI_IPUChnAttr_s {
|
||||
MI_U32 u32SubNetId;
|
||||
MI_U32 u32OutputBufDepth;
|
||||
MI_U32 u32InputBufDepth;
|
||||
} MI_IPUChnAttr_t;
|
||||
|
||||
typedef struct MI_IPU_OfflineModelStaticInfo_s {
|
||||
MI_U32 u32VariableBufferSize;
|
||||
MI_U32 u32OfflineModelSize;
|
||||
} MI_IPU_OfflineModelStaticInfo_t;
|
||||
|
||||
#endif // !_MI_IPU_DATATYPE_H_
|
|
@ -0,0 +1,430 @@
|
|||
/* SigmaStar trade secret */
|
||||
/* Copyright (c) [2019~2020] SigmaStar Technology.
|
||||
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 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* mi_isp_datatype.h
|
||||
*
|
||||
* Created on: June 27, 2018
|
||||
* Author: Jeffrey Chou
|
||||
*/
|
||||
|
||||
#ifndef _MI_ISP_DATATYPE_H_
|
||||
#define _MI_ISP_DATATYPE_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include "mi_common.h"
|
||||
#include "mi_sys_datatype.h"
|
||||
#include "mi_isp_3a_datatype.h"
|
||||
#include "mi_isp_iq_datatype.h"
|
||||
|
||||
/************************************* AF - Define the structure declaration - START *************************************/
|
||||
|
||||
/************************************* AF - Define the structure declaration - END *************************************/
|
||||
|
||||
/************************** Cus3A ***********************/
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_U8 uAvgR;
|
||||
MI_U8 uAvgG;
|
||||
MI_U8 uAvgB;
|
||||
MI_U8 uAvgY;
|
||||
} MI_ISP_AE_AVGS;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_U32 nBlkX;
|
||||
MI_U32 nBlkY;
|
||||
MI_ISP_AE_AVGS nAvg[128*90];
|
||||
}MI_ISP_AE_HW_STATISTICS_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_U8 uAvgR;
|
||||
MI_U8 uAvgG;
|
||||
MI_U8 uAvgB;
|
||||
} MI_ISP_AWB_AVGS;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_U32 nBlkX;
|
||||
MI_U32 nBlkY;
|
||||
MI_ISP_AWB_AVGS nAvg[128*90];
|
||||
} MI_ISP_AWB_HW_STATISTICS_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_U16 nHisto[128];
|
||||
} MI_ISP_HISTO_HW_STATISTICS_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_U16 nHisto[256];
|
||||
} MI_ISP_RGBIR_HISTO_HW_STATISTICS_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_BOOL bAE;
|
||||
MI_BOOL bAWB;
|
||||
MI_BOOL bAF;
|
||||
}Cus3AEnable_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_U32 Size; /**< struct size*/
|
||||
char sensor_id[32]; /**< sensor module id*/
|
||||
MI_U32 shutter; /**< shutter Shutter in ns*/
|
||||
MI_U32 shutter_step; /**< shutter Shutter step ns*/
|
||||
MI_U32 shutter_min; /**< shutter Shutter min us*/
|
||||
MI_U32 shutter_max; /**< shutter Shutter max us*/
|
||||
MI_U32 sensor_gain; /**< sensor_gain Sensor gain, 1X = 1024*/
|
||||
MI_U32 sensor_gain_min; /**< sensor_gain_min Minimum Sensor gain, 1X = 1024*/
|
||||
MI_U32 sensor_gain_max; /**< sensor_gain_max Maximum Sensor gain, 1X = 1024*/
|
||||
MI_U32 isp_gain; /**< isp_gain Isp digital gain , 1X = 1024 */
|
||||
MI_U32 isp_gain_max; /**< isp_gain Maximum Isp digital gain , 1X = 1024 */
|
||||
MI_U32 FNx10; /**< F number * 10*/
|
||||
MI_U32 fps; /**< initial frame per second*/
|
||||
MI_U32 shutterHDRShort_step; /**< shutter Shutter step ns*/
|
||||
MI_U32 shutterHDRShort_min; /**< shutter Shutter min us*/
|
||||
MI_U32 shutterHDRShort_max; /**< shutter Shutter max us*/
|
||||
MI_U32 sensor_gainHDRShort_min; /**< sensor_gain_min Minimum Sensor gain, 1X = 1024*/
|
||||
MI_U32 sensor_gainHDRShort_max; /**< sensor_gain_max Maximum Sensor gain, 1X = 1024*/
|
||||
/*CUS3A v1.1*/
|
||||
MI_U32 AvgBlkX; /**< HW statistics average block number*/
|
||||
MI_U32 AvgBlkY; /**< HW statistics average block number*/
|
||||
}CusAEInitParam_t,CusAeInitParam_t;
|
||||
|
||||
/*! @brief ISP report to AE, hardware statistic */
|
||||
typedef struct
|
||||
{
|
||||
MI_U32 Size; /**< struct size*/
|
||||
void *hist1; /**< HW statistic histogram 1*/
|
||||
void *hist2; /**< HW statistic histogram 2*/
|
||||
MI_U32 AvgBlkX; /**< HW statistics average block number*/
|
||||
MI_U32 AvgBlkY; /**< HW statistics average block number*/
|
||||
void * avgs; /**< HW statistics average block data*/
|
||||
MI_U32 Shutter; /**< Current shutter in ns*/
|
||||
MI_U32 SensorGain; /**< Current Sensor gain, 1X = 1024 */
|
||||
MI_U32 IspGain; /**< Current ISP gain, 1X = 1024*/
|
||||
MI_U32 ShutterHDRShort; /**< Current shutter in ns*/
|
||||
MI_U32 SensorGainHDRShort; /**< Current Sensor gain, 1X = 1024 */
|
||||
MI_U32 IspGainHDRShort; /**< Current ISP gain, 1X = 1024*/
|
||||
/*CUS3A V1.1*/
|
||||
MI_U32 PreAvgY; /**< Previous frame brightness*/
|
||||
MI_U8 HDRCtlMode; /**< 0 = HDR off; */
|
||||
/**< 1 = Separate shutter & Separate sensor gain settings */
|
||||
/**< 2 = Separate shutter & Share sensor gain settings */
|
||||
/**< 3 = Share shutter & Separate sensor gain settings */
|
||||
MI_U32 FNx10; /**< Aperture in FNx10*/
|
||||
MI_U32 CurFPS; /**Current sensor FPS */
|
||||
MI_U32 PreWeightY; /**< Previous frame brightness with ROI weight*/
|
||||
} __attribute__((packed, aligned(1))) CusAEInfo_t, CusAeInput_t;
|
||||
|
||||
/*! @brief ISP ae algorithm result*/
|
||||
typedef struct
|
||||
{
|
||||
MI_U32 Size; /**< struct size*/
|
||||
MI_U32 Change; /**< if true, apply this result to hw register*/
|
||||
MI_U32 Shutter; /**< Shutter in ns */
|
||||
MI_U32 SensorGain; /**< Sensor gain, 1X = 1024 */
|
||||
MI_U32 IspGain; /**< ISP gain, 1X = 1024 */
|
||||
MI_U32 ShutterHdrShort; /**< Shutter in ns */
|
||||
MI_U32 SensorGainHdrShort; /**< Sensor gain, 1X = 1024 */
|
||||
MI_U32 IspGainHdrShort; /**< ISP gain, 1X = 1024 */
|
||||
MI_U32 u4BVx16384; /**< Bv * 16384 in APEX system, EV = Av + Tv = Sv + Bv */
|
||||
MI_U32 AvgY; /**< frame brightness */
|
||||
MI_U32 HdrRatio; /**< hdr ratio, 1X = 1024 */
|
||||
/*CUS3A V1.1*/
|
||||
MI_U32 FNx10; /**< F number * 10*/
|
||||
MI_U32 DebandFPS; /** Target fps when running auto debanding**/
|
||||
MI_U32 WeightY; /**< frame brightness with ROI weight*/
|
||||
}__attribute__((packed, aligned(1))) CusAEResult_t, CusAeOutput_t;
|
||||
|
||||
/*! @brief AWB HW statistics data*/
|
||||
typedef struct
|
||||
{
|
||||
MI_U32 Size; /**< struct size*/
|
||||
MI_U32 AvgBlkX;
|
||||
MI_U32 AvgBlkY;
|
||||
MI_U32 CurRGain;
|
||||
MI_U32 CurGGain;
|
||||
MI_U32 CurBGain;
|
||||
void *avgs; //ISP_AWB_SAMPLE
|
||||
/*CUS3A V1.1*/
|
||||
MI_U8 HDRMode; /**< Noramal or HDR mode*/
|
||||
void* *pAwbStatisShort; /**< Short Shutter AWB statistic data */
|
||||
MI_U32 u4BVx16384; /**< From AE output, Bv * 16384 in APEX system, EV = Av + Tv = Sv + Bv */
|
||||
MI_S32 WeightY; /**< frame brightness with ROI weight*/
|
||||
}__attribute__((packed, aligned(1))) CusAWBInfo_t, CusAWBInput_t;
|
||||
|
||||
/*! @brief AWB algorithm result*/
|
||||
typedef struct
|
||||
{
|
||||
MI_U32 Size; /**< struct size*/
|
||||
MI_U32 Change; /**< if true, apply this result to hw register*/
|
||||
MI_U32 R_gain; /**< AWB gain for R channel*/
|
||||
MI_U32 G_gain; /**< AWB gain for G channel*/
|
||||
MI_U32 B_gain; /**< AWB gain for B channel*/
|
||||
MI_U32 ColorTmp; /**< Return color temperature*/
|
||||
}CusAWBResult_t, CusAwbOutput_t;;
|
||||
|
||||
typedef enum __attribute__ ((aligned (1)))
|
||||
{
|
||||
SS_AE_16x24 = 0,
|
||||
SS_AE_32x24,
|
||||
SS_AE_64x48,
|
||||
SS_AE_64x45,
|
||||
SS_AE_128x80,
|
||||
SS_AE_128x90,
|
||||
SS_AE_32x32
|
||||
} MS_CUST_AE_WIN_BLOCK_NUM_TYPE_e;
|
||||
|
||||
typedef struct {
|
||||
MI_U16 u2Stawin_x_offset;
|
||||
MI_U16 u2Stawin_x_size;
|
||||
MI_U16 u2Stawin_y_offset;
|
||||
MI_U16 u2Stawin_y_size;
|
||||
MI_U16 u2WinIdx;
|
||||
} CusAEHistWin_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_U32 SizeX;
|
||||
MI_U32 SizeY;
|
||||
MI_U32 IncRatio;
|
||||
}CusAWBSample_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_U16 CropX; // 0~1023
|
||||
MI_U16 CropY; // 0~1023
|
||||
MI_U16 CropW; // 0~1023
|
||||
MI_U16 CropH; // 0~1023
|
||||
}CusAEAWBCropSize_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_U8 iir_1[5*16]; //[5]: iir 35bit, use 5*u8 datatype, [16]: 16wins
|
||||
MI_U8 iir_2[5*16]; //[5]: iir 35bit, use 5*u8 datatype, [16]: 16wins
|
||||
MI_U8 luma[4*16]; //[4]: luma 32bit, use 4*u8 datatype, [16]: 16wins
|
||||
MI_U8 fir_v[5*16]; //[5]: fir 35bit, use 5*u8 datatype, [16]: 16wins
|
||||
MI_U8 fir_h[5*16]; //[5]: fir 35bit, use 5*u8 datatype, [16]: 16wins
|
||||
MI_U8 ysat[3*16]; //[3]: ysat 22bit, use 3*u8 datatype, [16]: 16wins
|
||||
} AF_STATS_PARAM_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
AF_STATS_PARAM_t stParaAPI[16];
|
||||
} CusAFStats_t;
|
||||
|
||||
typedef struct AF_WINDOW_PARAM_s
|
||||
{
|
||||
MI_U32 u32StartX; /*range : 0~1023*/
|
||||
MI_U32 u32StartY; /*range : 0~1023*/
|
||||
MI_U32 u32EndX; /*range : 0~1023*/
|
||||
MI_U32 u32EndY; /*range : 0~1023*/
|
||||
} AF_WINDOW_PARAM_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_U8 u8WindowIndex;
|
||||
AF_WINDOW_PARAM_t stParaAPI;
|
||||
} CusAFWin_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_U16 u16IIR1_a0;
|
||||
MI_U16 u16IIR1_a1;
|
||||
MI_U16 u16IIR1_a2;
|
||||
MI_U16 u16IIR1_b1;
|
||||
MI_U16 u16IIR1_b2;
|
||||
MI_U16 u16IIR1_1st_low_clip;
|
||||
MI_U16 u16IIR1_1st_high_clip;
|
||||
MI_U16 u16IIR1_2nd_low_clip;
|
||||
MI_U16 u16IIR1_2nd_high_clip;
|
||||
MI_U16 u16IIR2_a0;
|
||||
MI_U16 u16IIR2_a1;
|
||||
MI_U16 u16IIR2_a2;
|
||||
MI_U16 u16IIR2_b1;
|
||||
MI_U16 u16IIR2_b2;
|
||||
MI_U16 u16IIR2_1st_low_clip;
|
||||
MI_U16 u16IIR2_1st_high_clip;
|
||||
MI_U16 u16IIR2_2nd_low_clip;
|
||||
MI_U16 u16IIR2_2nd_high_clip;
|
||||
|
||||
MI_U16 u16IIR1_e1_en;
|
||||
MI_U16 u16IIR1_e1_a0;
|
||||
MI_U16 u16IIR1_e1_a1;
|
||||
MI_U16 u16IIR1_e1_a2;
|
||||
MI_U16 u16IIR1_e1_b1;
|
||||
MI_U16 u16IIR1_e1_b2;
|
||||
MI_U16 u16IIR1_e2_en;
|
||||
MI_U16 u16IIR1_e2_a0;
|
||||
MI_U16 u16IIR1_e2_a1;
|
||||
MI_U16 u16IIR1_e2_a2;
|
||||
MI_U16 u16IIR1_e2_b1;
|
||||
MI_U16 u16IIR1_e2_b2;
|
||||
|
||||
MI_U16 u16IIR2_e1_en;
|
||||
MI_U16 u16IIR2_e1_a0;
|
||||
MI_U16 u16IIR2_e1_a1;
|
||||
MI_U16 u16IIR2_e1_a2;
|
||||
MI_U16 u16IIR2_e1_b1;
|
||||
MI_U16 u16IIR2_e1_b2;
|
||||
MI_U16 u16IIR2_e2_en;
|
||||
MI_U16 u16IIR2_e2_a0;
|
||||
MI_U16 u16IIR2_e2_a1;
|
||||
MI_U16 u16IIR2_e2_a2;
|
||||
MI_U16 u16IIR2_e2_b1;
|
||||
MI_U16 u16IIR2_e2_b2;
|
||||
} CusAFFilter_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_U16 u16Coeff[70];
|
||||
} CusAFFilter_Geo_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_BOOL bSobelYSatEn;
|
||||
MI_U16 u16SobelYThd;
|
||||
|
||||
MI_BOOL bIIRSquareAccEn;
|
||||
MI_BOOL bSobelSquareAccEn;
|
||||
|
||||
MI_U16 u16IIR1Thd;
|
||||
MI_U16 u16IIR2Thd;
|
||||
MI_U16 u16SobelHThd;
|
||||
MI_U16 u16SobelVThd;
|
||||
MI_U8 u8AFTblX[12];
|
||||
MI_U16 u16AFTblY[13];
|
||||
} CusAFFilterSq_t;
|
||||
|
||||
|
||||
typedef enum __attribute__ ((aligned (1)))
|
||||
{
|
||||
AF_ROI_MODE_NORMAL,
|
||||
AF_ROI_MODE_MATRIX
|
||||
} ISP_AF_ROI_MODE_e;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
ISP_AF_ROI_MODE_e mode;
|
||||
MI_U32 u32_vertical_block_number;
|
||||
} CusAFRoiMode_t;
|
||||
|
||||
/* Raw store control */
|
||||
typedef enum
|
||||
{
|
||||
eRawStoreNode_P0HEAD = 0, /* Control by VIF, Do not use */
|
||||
eRawStoreNode_P1HEAD = 1, /* Control by VIF, Do not use */
|
||||
eRawStoreNode_P0TAIL = 2,
|
||||
eRawStoreNode_P1TAIL = 3,
|
||||
eRawStoreNode_ISPOUT = 4,
|
||||
eRawStoreNode_VDOS = 5,
|
||||
eRawStoreNode_ISPOUT_BEFORE_YEE = 6,
|
||||
eRawStoreNode_RGBIR_IR_ONLY = 7
|
||||
}CameraRawStoreNode_e;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_U32 u32image_width;
|
||||
MI_U32 u32image_height;
|
||||
MI_U32 u32Node;
|
||||
MI_U32 u32PixelDepth;
|
||||
} CusImageResolution_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_U32 u32enable;
|
||||
MI_U32 u32image_width;
|
||||
MI_U32 u32image_height;
|
||||
MI_U32 u32physical_address;
|
||||
MI_U32 u32Node;
|
||||
} CusISPOutImage_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_U32 u32enable;
|
||||
MI_U32 u32image_width;
|
||||
MI_U32 u32image_height;
|
||||
MI_U32 u32physical_address;
|
||||
MI_U32 u32Node;
|
||||
MI_U32 u32PixelDepth;
|
||||
} CusHdrRawImage_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_U64 u64Pts; /** frame PTS */
|
||||
MI_U32 u32Shutter; /**< Shutter in us */
|
||||
MI_U32 u32SensorGain; /**< Sensor gain, 1X = 1024 */
|
||||
MI_U32 u32ColorTmp; /**< Return color temperature*/
|
||||
} IspFrameMetaInfo_t;
|
||||
|
||||
/*! @brief ISP report to AF, hardware status */
|
||||
typedef struct
|
||||
{
|
||||
MI_U32 Size; /**< struct size*/
|
||||
MI_U32 MinPos; /**< Maximum position of AF motor */
|
||||
MI_U32 MaxPos; /**< Minimum position of AF motor */
|
||||
MI_U32 CurPos; /**< Current position of AF motor */
|
||||
} __attribute__((packed, aligned(1))) CusAFInfo_t, CusAfInput_t;
|
||||
|
||||
/*! @brief AF algorithm result*/
|
||||
typedef struct
|
||||
{
|
||||
MI_U32 Size; /**< struct size*/
|
||||
MI_U32 Change; /**< if true, apply this result to hw register*/
|
||||
MI_U32 NextPos; /**< Next absolute position of AF motor */
|
||||
}__attribute__((packed, aligned(1))) CusAfResult_t, CusAfOutput_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_U32 u32SlaveAddr; //sensor slave address
|
||||
MI_U32 u32RegLen; //sensor register length , 1 or 2 bytes
|
||||
MI_U32 u32DataLen; //sensor register data length, 1 or 2 bytes
|
||||
MI_U32 u32I2cSpeed; //i2c speed , 100/200/300/400 KHz
|
||||
MI_U32 u32Reg; //sensor register address
|
||||
MI_U32 u32Data; //sensor register data
|
||||
}CusSensorI2cParam_t;
|
||||
|
||||
/***************************** end of Cus3A ****************************/
|
||||
|
||||
// COMMON API
|
||||
typedef struct MI_ISP_API_CHANNEL_ID_TYPE_s
|
||||
{
|
||||
MI_U32 u32ChannelID;
|
||||
} MI_ISP_API_CHANNEL_ID_TYPE_t;
|
||||
|
||||
typedef struct MI_ISP_API_USERSPACE3A_ATTR_s
|
||||
{
|
||||
MI_SYS_PixelFormat_e ePixelFmt;
|
||||
MI_U32 eSensorBindId;
|
||||
} MI_ISP_API_USERSPACE3A_ATTR_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_S8 strIspRoot[64];
|
||||
} MI_ISP_ROOT_PATH_T;
|
||||
|
||||
#ifdef __cplusplus
|
||||
} //end of extern C
|
||||
#endif
|
||||
|
||||
#endif //_MI_ISP_DATATYPE_H_
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,430 @@
|
|||
/* SigmaStar trade secret */
|
||||
/* Copyright (c) [2019~2020] SigmaStar Technology.
|
||||
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 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* mi_isp_datatype.h
|
||||
*
|
||||
* Created on: June 27, 2018
|
||||
* Author: Jeffrey Chou
|
||||
*/
|
||||
|
||||
#ifndef _MI_ISP_DATATYPE_H_
|
||||
#define _MI_ISP_DATATYPE_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include "mi_common.h"
|
||||
#include "mi_sys_datatype.h"
|
||||
#include "mi_isp_3a_datatype.h"
|
||||
#include "mi_isp_iq_datatype.h"
|
||||
|
||||
/************************************* AF - Define the structure declaration - START *************************************/
|
||||
|
||||
/************************************* AF - Define the structure declaration - END *************************************/
|
||||
|
||||
/************************** Cus3A ***********************/
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_U8 uAvgR;
|
||||
MI_U8 uAvgG;
|
||||
MI_U8 uAvgB;
|
||||
MI_U8 uAvgY;
|
||||
} MI_ISP_AE_AVGS;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_U32 nBlkX;
|
||||
MI_U32 nBlkY;
|
||||
MI_ISP_AE_AVGS nAvg[128*90];
|
||||
}MI_ISP_AE_HW_STATISTICS_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_U8 uAvgR;
|
||||
MI_U8 uAvgG;
|
||||
MI_U8 uAvgB;
|
||||
} MI_ISP_AWB_AVGS;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_U32 nBlkX;
|
||||
MI_U32 nBlkY;
|
||||
MI_ISP_AWB_AVGS nAvg[128*90];
|
||||
} MI_ISP_AWB_HW_STATISTICS_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_U16 nHisto[128];
|
||||
} MI_ISP_HISTO_HW_STATISTICS_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_U16 nHisto[256];
|
||||
} MI_ISP_RGBIR_HISTO_HW_STATISTICS_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_BOOL bAE;
|
||||
MI_BOOL bAWB;
|
||||
MI_BOOL bAF;
|
||||
}Cus3AEnable_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_U32 Size; /**< struct size*/
|
||||
char sensor_id[32]; /**< sensor module id*/
|
||||
MI_U32 shutter; /**< shutter Shutter in ns*/
|
||||
MI_U32 shutter_step; /**< shutter Shutter step ns*/
|
||||
MI_U32 shutter_min; /**< shutter Shutter min us*/
|
||||
MI_U32 shutter_max; /**< shutter Shutter max us*/
|
||||
MI_U32 sensor_gain; /**< sensor_gain Sensor gain, 1X = 1024*/
|
||||
MI_U32 sensor_gain_min; /**< sensor_gain_min Minimum Sensor gain, 1X = 1024*/
|
||||
MI_U32 sensor_gain_max; /**< sensor_gain_max Maximum Sensor gain, 1X = 1024*/
|
||||
MI_U32 isp_gain; /**< isp_gain Isp digital gain , 1X = 1024 */
|
||||
MI_U32 isp_gain_max; /**< isp_gain Maximum Isp digital gain , 1X = 1024 */
|
||||
MI_U32 FNx10; /**< F number * 10*/
|
||||
MI_U32 fps; /**< initial frame per second*/
|
||||
MI_U32 shutterHDRShort_step; /**< shutter Shutter step ns*/
|
||||
MI_U32 shutterHDRShort_min; /**< shutter Shutter min us*/
|
||||
MI_U32 shutterHDRShort_max; /**< shutter Shutter max us*/
|
||||
MI_U32 sensor_gainHDRShort_min; /**< sensor_gain_min Minimum Sensor gain, 1X = 1024*/
|
||||
MI_U32 sensor_gainHDRShort_max; /**< sensor_gain_max Maximum Sensor gain, 1X = 1024*/
|
||||
/*CUS3A v1.1*/
|
||||
MI_U32 AvgBlkX; /**< HW statistics average block number*/
|
||||
MI_U32 AvgBlkY; /**< HW statistics average block number*/
|
||||
}CusAEInitParam_t,CusAeInitParam_t;
|
||||
|
||||
/*! @brief ISP report to AE, hardware statistic */
|
||||
typedef struct
|
||||
{
|
||||
MI_U32 Size; /**< struct size*/
|
||||
void *hist1; /**< HW statistic histogram 1*/
|
||||
void *hist2; /**< HW statistic histogram 2*/
|
||||
MI_U32 AvgBlkX; /**< HW statistics average block number*/
|
||||
MI_U32 AvgBlkY; /**< HW statistics average block number*/
|
||||
void * avgs; /**< HW statistics average block data*/
|
||||
MI_U32 Shutter; /**< Current shutter in ns*/
|
||||
MI_U32 SensorGain; /**< Current Sensor gain, 1X = 1024 */
|
||||
MI_U32 IspGain; /**< Current ISP gain, 1X = 1024*/
|
||||
MI_U32 ShutterHDRShort; /**< Current shutter in ns*/
|
||||
MI_U32 SensorGainHDRShort; /**< Current Sensor gain, 1X = 1024 */
|
||||
MI_U32 IspGainHDRShort; /**< Current ISP gain, 1X = 1024*/
|
||||
/*CUS3A V1.1*/
|
||||
MI_U32 PreAvgY; /**< Previous frame brightness*/
|
||||
MI_U8 HDRCtlMode; /**< 0 = HDR off; */
|
||||
/**< 1 = Separate shutter & Separate sensor gain settings */
|
||||
/**< 2 = Separate shutter & Share sensor gain settings */
|
||||
/**< 3 = Share shutter & Separate sensor gain settings */
|
||||
MI_U32 FNx10; /**< Aperture in FNx10*/
|
||||
MI_U32 CurFPS; /**Current sensor FPS */
|
||||
MI_U32 PreWeightY; /**< Previous frame brightness with ROI weight*/
|
||||
} __attribute__((packed, aligned(1))) CusAEInfo_t, CusAeInput_t;
|
||||
|
||||
/*! @brief ISP ae algorithm result*/
|
||||
typedef struct
|
||||
{
|
||||
MI_U32 Size; /**< struct size*/
|
||||
MI_U32 Change; /**< if true, apply this result to hw register*/
|
||||
MI_U32 Shutter; /**< Shutter in ns */
|
||||
MI_U32 SensorGain; /**< Sensor gain, 1X = 1024 */
|
||||
MI_U32 IspGain; /**< ISP gain, 1X = 1024 */
|
||||
MI_U32 ShutterHdrShort; /**< Shutter in ns */
|
||||
MI_U32 SensorGainHdrShort; /**< Sensor gain, 1X = 1024 */
|
||||
MI_U32 IspGainHdrShort; /**< ISP gain, 1X = 1024 */
|
||||
MI_U32 u4BVx16384; /**< Bv * 16384 in APEX system, EV = Av + Tv = Sv + Bv */
|
||||
MI_U32 AvgY; /**< frame brightness */
|
||||
MI_U32 HdrRatio; /**< hdr ratio, 1X = 1024 */
|
||||
/*CUS3A V1.1*/
|
||||
MI_U32 FNx10; /**< F number * 10*/
|
||||
MI_U32 DebandFPS; /** Target fps when running auto debanding**/
|
||||
MI_U32 WeightY; /**< frame brightness with ROI weight*/
|
||||
}__attribute__((packed, aligned(1))) CusAEResult_t, CusAeOutput_t;
|
||||
|
||||
/*! @brief AWB HW statistics data*/
|
||||
typedef struct
|
||||
{
|
||||
MI_U32 Size; /**< struct size*/
|
||||
MI_U32 AvgBlkX;
|
||||
MI_U32 AvgBlkY;
|
||||
MI_U32 CurRGain;
|
||||
MI_U32 CurGGain;
|
||||
MI_U32 CurBGain;
|
||||
void *avgs; //ISP_AWB_SAMPLE
|
||||
/*CUS3A V1.1*/
|
||||
MI_U8 HDRMode; /**< Noramal or HDR mode*/
|
||||
void* *pAwbStatisShort; /**< Short Shutter AWB statistic data */
|
||||
MI_U32 u4BVx16384; /**< From AE output, Bv * 16384 in APEX system, EV = Av + Tv = Sv + Bv */
|
||||
MI_S32 WeightY; /**< frame brightness with ROI weight*/
|
||||
}__attribute__((packed, aligned(1))) CusAWBInfo_t, CusAWBInput_t;
|
||||
|
||||
/*! @brief AWB algorithm result*/
|
||||
typedef struct
|
||||
{
|
||||
MI_U32 Size; /**< struct size*/
|
||||
MI_U32 Change; /**< if true, apply this result to hw register*/
|
||||
MI_U32 R_gain; /**< AWB gain for R channel*/
|
||||
MI_U32 G_gain; /**< AWB gain for G channel*/
|
||||
MI_U32 B_gain; /**< AWB gain for B channel*/
|
||||
MI_U32 ColorTmp; /**< Return color temperature*/
|
||||
}CusAWBResult_t, CusAwbOutput_t;;
|
||||
|
||||
typedef enum __attribute__ ((aligned (1)))
|
||||
{
|
||||
SS_AE_16x24 = 0,
|
||||
SS_AE_32x24,
|
||||
SS_AE_64x48,
|
||||
SS_AE_64x45,
|
||||
SS_AE_128x80,
|
||||
SS_AE_128x90,
|
||||
SS_AE_32x32
|
||||
} MS_CUST_AE_WIN_BLOCK_NUM_TYPE_e;
|
||||
|
||||
typedef struct {
|
||||
MI_U16 u2Stawin_x_offset;
|
||||
MI_U16 u2Stawin_x_size;
|
||||
MI_U16 u2Stawin_y_offset;
|
||||
MI_U16 u2Stawin_y_size;
|
||||
MI_U16 u2WinIdx;
|
||||
} CusAEHistWin_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_U32 SizeX;
|
||||
MI_U32 SizeY;
|
||||
MI_U32 IncRatio;
|
||||
}CusAWBSample_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_U16 CropX; // 0~1023
|
||||
MI_U16 CropY; // 0~1023
|
||||
MI_U16 CropW; // 0~1023
|
||||
MI_U16 CropH; // 0~1023
|
||||
}CusAEAWBCropSize_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_U8 iir_1[5*16]; //[5]: iir 35bit, use 5*u8 datatype, [16]: 16wins
|
||||
MI_U8 iir_2[5*16]; //[5]: iir 35bit, use 5*u8 datatype, [16]: 16wins
|
||||
MI_U8 luma[4*16]; //[4]: luma 32bit, use 4*u8 datatype, [16]: 16wins
|
||||
MI_U8 fir_v[5*16]; //[5]: fir 35bit, use 5*u8 datatype, [16]: 16wins
|
||||
MI_U8 fir_h[5*16]; //[5]: fir 35bit, use 5*u8 datatype, [16]: 16wins
|
||||
MI_U8 ysat[3*16]; //[3]: ysat 22bit, use 3*u8 datatype, [16]: 16wins
|
||||
} AF_STATS_PARAM_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
AF_STATS_PARAM_t stParaAPI[16];
|
||||
} CusAFStats_t;
|
||||
|
||||
typedef struct AF_WINDOW_PARAM_s
|
||||
{
|
||||
MI_U32 u32StartX; /*range : 0~1023*/
|
||||
MI_U32 u32StartY; /*range : 0~1023*/
|
||||
MI_U32 u32EndX; /*range : 0~1023*/
|
||||
MI_U32 u32EndY; /*range : 0~1023*/
|
||||
} AF_WINDOW_PARAM_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_U8 u8WindowIndex;
|
||||
AF_WINDOW_PARAM_t stParaAPI;
|
||||
} CusAFWin_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_U16 u16IIR1_a0;
|
||||
MI_U16 u16IIR1_a1;
|
||||
MI_U16 u16IIR1_a2;
|
||||
MI_U16 u16IIR1_b1;
|
||||
MI_U16 u16IIR1_b2;
|
||||
MI_U16 u16IIR1_1st_low_clip;
|
||||
MI_U16 u16IIR1_1st_high_clip;
|
||||
MI_U16 u16IIR1_2nd_low_clip;
|
||||
MI_U16 u16IIR1_2nd_high_clip;
|
||||
MI_U16 u16IIR2_a0;
|
||||
MI_U16 u16IIR2_a1;
|
||||
MI_U16 u16IIR2_a2;
|
||||
MI_U16 u16IIR2_b1;
|
||||
MI_U16 u16IIR2_b2;
|
||||
MI_U16 u16IIR2_1st_low_clip;
|
||||
MI_U16 u16IIR2_1st_high_clip;
|
||||
MI_U16 u16IIR2_2nd_low_clip;
|
||||
MI_U16 u16IIR2_2nd_high_clip;
|
||||
|
||||
MI_U16 u16IIR1_e1_en;
|
||||
MI_U16 u16IIR1_e1_a0;
|
||||
MI_U16 u16IIR1_e1_a1;
|
||||
MI_U16 u16IIR1_e1_a2;
|
||||
MI_U16 u16IIR1_e1_b1;
|
||||
MI_U16 u16IIR1_e1_b2;
|
||||
MI_U16 u16IIR1_e2_en;
|
||||
MI_U16 u16IIR1_e2_a0;
|
||||
MI_U16 u16IIR1_e2_a1;
|
||||
MI_U16 u16IIR1_e2_a2;
|
||||
MI_U16 u16IIR1_e2_b1;
|
||||
MI_U16 u16IIR1_e2_b2;
|
||||
|
||||
MI_U16 u16IIR2_e1_en;
|
||||
MI_U16 u16IIR2_e1_a0;
|
||||
MI_U16 u16IIR2_e1_a1;
|
||||
MI_U16 u16IIR2_e1_a2;
|
||||
MI_U16 u16IIR2_e1_b1;
|
||||
MI_U16 u16IIR2_e1_b2;
|
||||
MI_U16 u16IIR2_e2_en;
|
||||
MI_U16 u16IIR2_e2_a0;
|
||||
MI_U16 u16IIR2_e2_a1;
|
||||
MI_U16 u16IIR2_e2_a2;
|
||||
MI_U16 u16IIR2_e2_b1;
|
||||
MI_U16 u16IIR2_e2_b2;
|
||||
} CusAFFilter_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_U16 u16Coeff[70];
|
||||
} CusAFFilter_Geo_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_BOOL bSobelYSatEn;
|
||||
MI_U16 u16SobelYThd;
|
||||
|
||||
MI_BOOL bIIRSquareAccEn;
|
||||
MI_BOOL bSobelSquareAccEn;
|
||||
|
||||
MI_U16 u16IIR1Thd;
|
||||
MI_U16 u16IIR2Thd;
|
||||
MI_U16 u16SobelHThd;
|
||||
MI_U16 u16SobelVThd;
|
||||
MI_U8 u8AFTblX[12];
|
||||
MI_U16 u16AFTblY[13];
|
||||
} CusAFFilterSq_t;
|
||||
|
||||
|
||||
typedef enum __attribute__ ((aligned (1)))
|
||||
{
|
||||
AF_ROI_MODE_NORMAL,
|
||||
AF_ROI_MODE_MATRIX
|
||||
} ISP_AF_ROI_MODE_e;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
ISP_AF_ROI_MODE_e mode;
|
||||
MI_U32 u32_vertical_block_number;
|
||||
} CusAFRoiMode_t;
|
||||
|
||||
/* Raw store control */
|
||||
typedef enum
|
||||
{
|
||||
eRawStoreNode_P0HEAD = 0, /* Control by VIF, Do not use */
|
||||
eRawStoreNode_P1HEAD = 1, /* Control by VIF, Do not use */
|
||||
eRawStoreNode_P0TAIL = 2,
|
||||
eRawStoreNode_P1TAIL = 3,
|
||||
eRawStoreNode_ISPOUT = 4,
|
||||
eRawStoreNode_VDOS = 5,
|
||||
eRawStoreNode_ISPOUT_BEFORE_YEE = 6,
|
||||
eRawStoreNode_RGBIR_IR_ONLY = 7
|
||||
}CameraRawStoreNode_e;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_U32 u32image_width;
|
||||
MI_U32 u32image_height;
|
||||
MI_U32 u32Node;
|
||||
MI_U32 u32PixelDepth;
|
||||
} CusImageResolution_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_U32 u32enable;
|
||||
MI_U32 u32image_width;
|
||||
MI_U32 u32image_height;
|
||||
MI_U32 u32physical_address;
|
||||
MI_U32 u32Node;
|
||||
} CusISPOutImage_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_U32 u32enable;
|
||||
MI_U32 u32image_width;
|
||||
MI_U32 u32image_height;
|
||||
MI_U32 u32physical_address;
|
||||
MI_U32 u32Node;
|
||||
MI_U32 u32PixelDepth;
|
||||
} CusHdrRawImage_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_U64 u64Pts; /** frame PTS */
|
||||
MI_U32 u32Shutter; /**< Shutter in us */
|
||||
MI_U32 u32SensorGain; /**< Sensor gain, 1X = 1024 */
|
||||
MI_U32 u32ColorTmp; /**< Return color temperature*/
|
||||
} IspFrameMetaInfo_t;
|
||||
|
||||
/*! @brief ISP report to AF, hardware status */
|
||||
typedef struct
|
||||
{
|
||||
MI_U32 Size; /**< struct size*/
|
||||
MI_U32 MinPos; /**< Maximum position of AF motor */
|
||||
MI_U32 MaxPos; /**< Minimum position of AF motor */
|
||||
MI_U32 CurPos; /**< Current position of AF motor */
|
||||
} __attribute__((packed, aligned(1))) CusAFInfo_t, CusAfInput_t;
|
||||
|
||||
/*! @brief AF algorithm result*/
|
||||
typedef struct
|
||||
{
|
||||
MI_U32 Size; /**< struct size*/
|
||||
MI_U32 Change; /**< if true, apply this result to hw register*/
|
||||
MI_U32 NextPos; /**< Next absolute position of AF motor */
|
||||
}__attribute__((packed, aligned(1))) CusAfResult_t, CusAfOutput_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_U32 u32SlaveAddr; //sensor slave address
|
||||
MI_U32 u32RegLen; //sensor register length , 1 or 2 bytes
|
||||
MI_U32 u32DataLen; //sensor register data length, 1 or 2 bytes
|
||||
MI_U32 u32I2cSpeed; //i2c speed , 100/200/300/400 KHz
|
||||
MI_U32 u32Reg; //sensor register address
|
||||
MI_U32 u32Data; //sensor register data
|
||||
}CusSensorI2cParam_t;
|
||||
|
||||
/***************************** end of Cus3A ****************************/
|
||||
|
||||
// COMMON API
|
||||
typedef struct MI_ISP_API_CHANNEL_ID_TYPE_s
|
||||
{
|
||||
MI_U32 u32ChannelID;
|
||||
} MI_ISP_API_CHANNEL_ID_TYPE_t;
|
||||
|
||||
typedef struct MI_ISP_API_USERSPACE3A_ATTR_s
|
||||
{
|
||||
MI_SYS_PixelFormat_e ePixelFmt;
|
||||
MI_U32 eSensorBindId;
|
||||
} MI_ISP_API_USERSPACE3A_ATTR_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_S8 strIspRoot[64];
|
||||
} MI_ISP_ROOT_PATH_T;
|
||||
|
||||
#ifdef __cplusplus
|
||||
} //end of extern C
|
||||
#endif
|
||||
|
||||
#endif //_MI_ISP_DATATYPE_H_
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,404 @@
|
|||
/* SigmaStar trade secret */
|
||||
/* Copyright (c) [2019~2020] SigmaStar Technology.
|
||||
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 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* mi_isp_datatype.h
|
||||
*
|
||||
* Created on: June 27, 2018
|
||||
* Author: Jeffrey Chou
|
||||
*/
|
||||
|
||||
#ifndef _MI_ISP_DATATYPE_H_
|
||||
#define _MI_ISP_DATATYPE_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include "mi_common.h"
|
||||
#include "mi_sys_datatype.h"
|
||||
#include "mi_isp_3a_datatype.h"
|
||||
#include "mi_isp_iq_datatype.h"
|
||||
|
||||
/************************************* AF - Define the structure declaration - START *************************************/
|
||||
|
||||
/************************************* AF - Define the structure declaration - END *************************************/
|
||||
|
||||
/************************** Cus3A ***********************/
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_U8 uAvgR;
|
||||
MI_U8 uAvgG;
|
||||
MI_U8 uAvgB;
|
||||
MI_U8 uAvgY;
|
||||
} MI_ISP_AE_AVGS;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_U32 nBlkX;
|
||||
MI_U32 nBlkY;
|
||||
MI_ISP_AE_AVGS nAvg[128*90];
|
||||
}MI_ISP_AE_HW_STATISTICS_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_U8 uAvgR;
|
||||
MI_U8 uAvgG;
|
||||
MI_U8 uAvgB;
|
||||
} MI_ISP_AWB_AVGS;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_U32 nBlkX;
|
||||
MI_U32 nBlkY;
|
||||
MI_ISP_AWB_AVGS nAvg[128*90];
|
||||
} MI_ISP_AWB_HW_STATISTICS_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_U16 nHisto[128];
|
||||
} MI_ISP_HISTO_HW_STATISTICS_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_U16 nHisto[256];
|
||||
} MI_ISP_RGBIR_HISTO_HW_STATISTICS_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_BOOL bAE;
|
||||
MI_BOOL bAWB;
|
||||
MI_BOOL bAF;
|
||||
}Cus3AEnable_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_U32 Size; /**< struct size*/
|
||||
char sensor_id[32]; /**< sensor module id*/
|
||||
MI_U32 shutter; /**< shutter Shutter in ns*/
|
||||
MI_U32 shutter_step; /**< shutter Shutter step ns*/
|
||||
MI_U32 shutter_min; /**< shutter Shutter min us*/
|
||||
MI_U32 shutter_max; /**< shutter Shutter max us*/
|
||||
MI_U32 sensor_gain; /**< sensor_gain Sensor gain, 1X = 1024*/
|
||||
MI_U32 sensor_gain_min; /**< sensor_gain_min Minimum Sensor gain, 1X = 1024*/
|
||||
MI_U32 sensor_gain_max; /**< sensor_gain_max Maximum Sensor gain, 1X = 1024*/
|
||||
MI_U32 isp_gain; /**< isp_gain Isp digital gain , 1X = 1024 */
|
||||
MI_U32 isp_gain_max; /**< isp_gain Maximum Isp digital gain , 1X = 1024 */
|
||||
MI_U32 FNx10; /**< F number * 10*/
|
||||
MI_U32 fps; /**< initial frame per second*/
|
||||
MI_U32 shutterHDRShort_step; /**< shutter Shutter step ns*/
|
||||
MI_U32 shutterHDRShort_min; /**< shutter Shutter min us*/
|
||||
MI_U32 shutterHDRShort_max; /**< shutter Shutter max us*/
|
||||
MI_U32 sensor_gainHDRShort_min; /**< sensor_gain_min Minimum Sensor gain, 1X = 1024*/
|
||||
MI_U32 sensor_gainHDRShort_max; /**< sensor_gain_max Maximum Sensor gain, 1X = 1024*/
|
||||
/*CUS3A v1.1*/
|
||||
MI_U32 AvgBlkX; /**< HW statistics average block number*/
|
||||
MI_U32 AvgBlkY; /**< HW statistics average block number*/
|
||||
}CusAEInitParam_t,CusAeInitParam_t;
|
||||
|
||||
/*! @brief ISP report to AE, hardware statistic */
|
||||
typedef struct
|
||||
{
|
||||
MI_U32 Size; /**< struct size*/
|
||||
void *hist1; /**< HW statistic histogram 1*/
|
||||
void *hist2; /**< HW statistic histogram 2*/
|
||||
MI_U32 AvgBlkX; /**< HW statistics average block number*/
|
||||
MI_U32 AvgBlkY; /**< HW statistics average block number*/
|
||||
void * avgs; /**< HW statistics average block data*/
|
||||
MI_U32 Shutter; /**< Current shutter in ns*/
|
||||
MI_U32 SensorGain; /**< Current Sensor gain, 1X = 1024 */
|
||||
MI_U32 IspGain; /**< Current ISP gain, 1X = 1024*/
|
||||
MI_U32 ShutterHDRShort; /**< Current shutter in ns*/
|
||||
MI_U32 SensorGainHDRShort; /**< Current Sensor gain, 1X = 1024 */
|
||||
MI_U32 IspGainHDRShort; /**< Current ISP gain, 1X = 1024*/
|
||||
/*CUS3A V1.1*/
|
||||
MI_U32 PreAvgY; /**< Previous frame brightness*/
|
||||
MI_U8 HDRCtlMode; /**< 0 = HDR off; */
|
||||
/**< 1 = Separate shutter & Separate sensor gain settings */
|
||||
/**< 2 = Separate shutter & Share sensor gain settings */
|
||||
/**< 3 = Share shutter & Separate sensor gain settings */
|
||||
MI_U32 FNx10; /**< Aperture in FNx10*/
|
||||
MI_U32 CurFPS; /**Current sensor FPS */
|
||||
MI_U32 PreWeightY; /**< Previous frame brightness with ROI weight*/
|
||||
} __attribute__((packed, aligned(1))) CusAEInfo_t, CusAeInput_t;
|
||||
|
||||
/*! @brief ISP ae algorithm result*/
|
||||
typedef struct
|
||||
{
|
||||
MI_U32 Size; /**< struct size*/
|
||||
MI_U32 Change; /**< if true, apply this result to hw register*/
|
||||
MI_U32 Shutter; /**< Shutter in ns */
|
||||
MI_U32 SensorGain; /**< Sensor gain, 1X = 1024 */
|
||||
MI_U32 IspGain; /**< ISP gain, 1X = 1024 */
|
||||
MI_U32 ShutterHdrShort; /**< Shutter in ns */
|
||||
MI_U32 SensorGainHdrShort; /**< Sensor gain, 1X = 1024 */
|
||||
MI_U32 IspGainHdrShort; /**< ISP gain, 1X = 1024 */
|
||||
MI_U32 u4BVx16384; /**< Bv * 16384 in APEX system, EV = Av + Tv = Sv + Bv */
|
||||
MI_U32 AvgY; /**< frame brightness */
|
||||
MI_U32 HdrRatio; /**< hdr ratio, 1X = 1024 */
|
||||
/*CUS3A V1.1*/
|
||||
MI_U32 FNx10; /**< F number * 10*/
|
||||
MI_U32 DebandFPS; /** Target fps when running auto debanding**/
|
||||
MI_U32 WeightY; /**< frame brightness with ROI weight*/
|
||||
}__attribute__((packed, aligned(1))) CusAEResult_t, CusAeOutput_t;
|
||||
|
||||
/*! @brief AWB HW statistics data*/
|
||||
typedef struct
|
||||
{
|
||||
MI_U32 Size; /**< struct size*/
|
||||
MI_U32 AvgBlkX;
|
||||
MI_U32 AvgBlkY;
|
||||
MI_U32 CurRGain;
|
||||
MI_U32 CurGGain;
|
||||
MI_U32 CurBGain;
|
||||
void *avgs; //ISP_AWB_SAMPLE
|
||||
/*CUS3A V1.1*/
|
||||
MI_U8 HDRMode; /**< Noramal or HDR mode*/
|
||||
void* *pAwbStatisShort; /**< Short Shutter AWB statistic data */
|
||||
MI_U32 u4BVx16384; /**< From AE output, Bv * 16384 in APEX system, EV = Av + Tv = Sv + Bv */
|
||||
MI_S32 WeightY; /**< frame brightness with ROI weight*/
|
||||
}__attribute__((packed, aligned(1))) CusAWBInfo_t, CusAWBInput_t;
|
||||
|
||||
/*! @brief AWB algorithm result*/
|
||||
typedef struct
|
||||
{
|
||||
MI_U32 Size; /**< struct size*/
|
||||
MI_U32 Change; /**< if true, apply this result to hw register*/
|
||||
MI_U32 R_gain; /**< AWB gain for R channel*/
|
||||
MI_U32 G_gain; /**< AWB gain for G channel*/
|
||||
MI_U32 B_gain; /**< AWB gain for B channel*/
|
||||
MI_U32 ColorTmp; /**< Return color temperature*/
|
||||
}CusAWBResult_t, CusAwbOutput_t;;
|
||||
|
||||
typedef enum __attribute__ ((aligned (1)))
|
||||
{
|
||||
SS_AE_16x24 = 0,
|
||||
SS_AE_32x24,
|
||||
SS_AE_64x48,
|
||||
SS_AE_64x45,
|
||||
SS_AE_128x80,
|
||||
SS_AE_128x90,
|
||||
SS_AE_32x32
|
||||
} MS_CUST_AE_WIN_BLOCK_NUM_TYPE_e;
|
||||
|
||||
typedef struct {
|
||||
MI_U16 u2Stawin_x_offset;
|
||||
MI_U16 u2Stawin_x_size;
|
||||
MI_U16 u2Stawin_y_offset;
|
||||
MI_U16 u2Stawin_y_size;
|
||||
MI_U16 u2WinIdx;
|
||||
} CusAEHistWin_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_U32 SizeX;
|
||||
MI_U32 SizeY;
|
||||
MI_U32 IncRatio;
|
||||
}CusAWBSample_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_U16 CropX; // 0~1023
|
||||
MI_U16 CropY; // 0~1023
|
||||
MI_U16 CropW; // 0~1023
|
||||
MI_U16 CropH; // 0~1023
|
||||
}CusAEAWBCropSize_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_U8 iir_1[5*16]; //[5]: iir 35bit, use 5*u8 datatype, [16]: 16wins
|
||||
MI_U8 iir_2[5*16]; //[5]: iir 35bit, use 5*u8 datatype, [16]: 16wins
|
||||
MI_U8 luma[4*16]; //[4]: luma 32bit, use 4*u8 datatype, [16]: 16wins
|
||||
MI_U8 fir_v[5*16]; //[5]: fir 35bit, use 5*u8 datatype, [16]: 16wins
|
||||
MI_U8 fir_h[5*16]; //[5]: fir 35bit, use 5*u8 datatype, [16]: 16wins
|
||||
MI_U8 ysat[3*16]; //[3]: ysat 22bit, use 3*u8 datatype, [16]: 16wins
|
||||
} AF_STATS_PARAM_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
AF_STATS_PARAM_t stParaAPI[16];
|
||||
} CusAFStats_t;
|
||||
|
||||
typedef struct AF_WINDOW_PARAM_s
|
||||
{
|
||||
MI_U32 u32StartX; /*range : 0~1023*/
|
||||
MI_U32 u32StartY; /*range : 0~1023*/
|
||||
MI_U32 u32EndX; /*range : 0~1023*/
|
||||
MI_U32 u32EndY; /*range : 0~1023*/
|
||||
} AF_WINDOW_PARAM_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_U8 u8WindowIndex;
|
||||
AF_WINDOW_PARAM_t stParaAPI;
|
||||
} CusAFWin_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_U16 u16IIR1_a0;
|
||||
MI_U16 u16IIR1_a1;
|
||||
MI_U16 u16IIR1_a2;
|
||||
MI_U16 u16IIR1_b1;
|
||||
MI_U16 u16IIR1_b2;
|
||||
MI_U16 u16IIR1_1st_low_clip;
|
||||
MI_U16 u16IIR1_1st_high_clip;
|
||||
MI_U16 u16IIR1_2nd_low_clip;
|
||||
MI_U16 u16IIR1_2nd_high_clip;
|
||||
MI_U16 u16IIR2_a0;
|
||||
MI_U16 u16IIR2_a1;
|
||||
MI_U16 u16IIR2_a2;
|
||||
MI_U16 u16IIR2_b1;
|
||||
MI_U16 u16IIR2_b2;
|
||||
MI_U16 u16IIR2_1st_low_clip;
|
||||
MI_U16 u16IIR2_1st_high_clip;
|
||||
MI_U16 u16IIR2_2nd_low_clip;
|
||||
MI_U16 u16IIR2_2nd_high_clip;
|
||||
} CusAFFilter_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_U16 u16Coeff[70];
|
||||
} CusAFFilter_Geo_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_BOOL bSobelYSatEn;
|
||||
MI_U16 u16SobelYThd;
|
||||
|
||||
MI_BOOL bIIRSquareAccEn;
|
||||
MI_BOOL bSobelSquareAccEn;
|
||||
|
||||
MI_U16 u16IIR1Thd;
|
||||
MI_U16 u16IIR2Thd;
|
||||
MI_U16 u16SobelHThd;
|
||||
MI_U16 u16SobelVThd;
|
||||
MI_U8 u8AFTblX[12];
|
||||
MI_U16 u16AFTblY[13];
|
||||
} CusAFFilterSq_t;
|
||||
|
||||
|
||||
typedef enum __attribute__ ((aligned (1)))
|
||||
{
|
||||
AF_ROI_MODE_NORMAL,
|
||||
AF_ROI_MODE_MATRIX
|
||||
} ISP_AF_ROI_MODE_e;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
ISP_AF_ROI_MODE_e mode;
|
||||
MI_U32 u32_vertical_block_number;
|
||||
} CusAFRoiMode_t;
|
||||
|
||||
/* Raw store control */
|
||||
typedef enum
|
||||
{
|
||||
eRawStoreNode_P0HEAD = 0, /* Control by VIF, Do not use */
|
||||
eRawStoreNode_P1HEAD = 1, /* Control by VIF, Do not use */
|
||||
eRawStoreNode_P0TAIL = 2,
|
||||
eRawStoreNode_P1TAIL = 3,
|
||||
eRawStoreNode_ISPOUT = 4,
|
||||
eRawStoreNode_VDOS = 5,
|
||||
eRawStoreNode_ISPOUT_BEFORE_YEE = 6,
|
||||
eRawStoreNode_RGBIR_IR_ONLY = 7
|
||||
}CameraRawStoreNode_e;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_U32 u32image_width;
|
||||
MI_U32 u32image_height;
|
||||
MI_U32 u32Node;
|
||||
MI_U32 u32PixelDepth;
|
||||
} CusImageResolution_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_U32 u32enable;
|
||||
MI_U32 u32image_width;
|
||||
MI_U32 u32image_height;
|
||||
MI_U32 u32physical_address;
|
||||
MI_U32 u32Node;
|
||||
} CusISPOutImage_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_U32 u32enable;
|
||||
MI_U32 u32image_width;
|
||||
MI_U32 u32image_height;
|
||||
MI_U32 u32physical_address;
|
||||
MI_U32 u32Node;
|
||||
MI_U32 u32PixelDepth;
|
||||
} CusHdrRawImage_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_U64 u64Pts; /** frame PTS */
|
||||
MI_U32 u32Shutter; /**< Shutter in us */
|
||||
MI_U32 u32SensorGain; /**< Sensor gain, 1X = 1024 */
|
||||
MI_U32 u32ColorTmp; /**< Return color temperature*/
|
||||
} IspFrameMetaInfo_t;
|
||||
|
||||
/*! @brief ISP report to AF, hardware status */
|
||||
typedef struct
|
||||
{
|
||||
MI_U32 Size; /**< struct size*/
|
||||
MI_U32 MinPos; /**< Maximum position of AF motor */
|
||||
MI_U32 MaxPos; /**< Minimum position of AF motor */
|
||||
MI_U32 CurPos; /**< Current position of AF motor */
|
||||
} __attribute__((packed, aligned(1))) CusAFInfo_t, CusAfInput_t;
|
||||
|
||||
/*! @brief AF algorithm result*/
|
||||
typedef struct
|
||||
{
|
||||
MI_U32 Size; /**< struct size*/
|
||||
MI_U32 Change; /**< if true, apply this result to hw register*/
|
||||
MI_U32 NextPos; /**< Next absolute position of AF motor */
|
||||
}__attribute__((packed, aligned(1))) CusAfResult_t, CusAfOutput_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_U32 u32SlaveAddr; //sensor slave address
|
||||
MI_U32 u32RegLen; //sensor register length , 1 or 2 bytes
|
||||
MI_U32 u32DataLen; //sensor register data length, 1 or 2 bytes
|
||||
MI_U32 u32I2cSpeed; //i2c speed , 100/200/300/400 KHz
|
||||
MI_U32 u32Reg; //sensor register address
|
||||
MI_U32 u32Data; //sensor register data
|
||||
}CusSensorI2cParam_t;
|
||||
|
||||
/***************************** end of Cus3A ****************************/
|
||||
|
||||
// COMMON API
|
||||
typedef struct MI_ISP_API_CHANNEL_ID_TYPE_s
|
||||
{
|
||||
MI_U32 u32ChannelID;
|
||||
} MI_ISP_API_CHANNEL_ID_TYPE_t;
|
||||
|
||||
typedef struct MI_ISP_API_USERSPACE3A_ATTR_s
|
||||
{
|
||||
MI_SYS_PixelFormat_e ePixelFmt;
|
||||
MI_U32 eSensorBindId;
|
||||
} MI_ISP_API_USERSPACE3A_ATTR_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_S8 strIspRoot[64];
|
||||
} MI_ISP_ROOT_PATH_T;
|
||||
|
||||
#ifdef __cplusplus
|
||||
} //end of extern C
|
||||
#endif
|
||||
|
||||
#endif //_MI_ISP_DATATYPE_H_
|
File diff suppressed because it is too large
Load Diff
116
code/application/sifarsdk/333DE/lib/mi_libs/include/isp/mi_isp.h
Normal file
116
code/application/sifarsdk/333DE/lib/mi_libs/include/isp/mi_isp.h
Normal file
|
@ -0,0 +1,116 @@
|
|||
/* SigmaStar trade secret */
|
||||
/* Copyright (c) [2019~2020] SigmaStar Technology.
|
||||
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 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* mi_isp.h
|
||||
*
|
||||
* Created on: June 27, 2018
|
||||
* Author: Jeffrey Chou
|
||||
*/
|
||||
|
||||
#ifndef _MI_ISP_H_
|
||||
#define _MI_ISP_H_
|
||||
//#include <pthread.h>
|
||||
|
||||
#include "mi_common.h"
|
||||
#include "mi_isp_datatype.h"
|
||||
#include "mi_vpe_datatype.h"
|
||||
#include "mi_isp_iq.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#define MI_ISP_OK (0)
|
||||
#define MI_ISP_NOT_SUPPORT (1)
|
||||
#define MI_ISP_FAILURE (-1)
|
||||
#define MI_ISP_API_MAX_PARM_NUMBRE (6)
|
||||
#define MI_ISP_API_ISPMID_NOT_SUPPORT (5)
|
||||
|
||||
/************************************* Customer 3A API ***********************************/
|
||||
MI_S32 MI_ISP_AE_GetAeHwAvgStats(MI_U32 Channel, MI_ISP_AE_HW_STATISTICS_t *data);
|
||||
MI_S32 MI_ISP_AWB_GetAwbHwAvgStats(MI_U32 Channel, MI_ISP_AWB_HW_STATISTICS_t *data);
|
||||
MI_S32 MI_ISP_AWB_GetAwbHwAvgStatsShort(MI_U32 Channel, MI_ISP_AWB_HW_STATISTICS_t *data);
|
||||
MI_S32 MI_ISP_AE_GetHisto0HwStats(MI_U32 Channel, MI_ISP_HISTO_HW_STATISTICS_t *data);
|
||||
MI_S32 MI_ISP_AE_GetHisto1HwStats(MI_U32 Channel, MI_ISP_HISTO_HW_STATISTICS_t *data);
|
||||
MI_S32 MI_ISP_AE_GetRgbIrHistoHwStats(MI_U32 Channel, MI_ISP_RGBIR_HISTO_HW_STATISTICS_t *data);
|
||||
MI_S32 MI_ISP_CUS3A_Enable(MI_U32 Channel, Cus3AEnable_t *data);
|
||||
MI_S32 MI_ISP_CUS3A_GetAeInitStatus(MI_U32 Channel, CusAEInitParam_t *data);
|
||||
MI_S32 MI_ISP_CUS3A_GetAeStatus(MI_U32 Channel, CusAEInfo_t *data);
|
||||
MI_S32 MI_ISP_CUS3A_SetAeParam(MI_U32 Channel, CusAEResult_t *data);
|
||||
MI_S32 MI_ISP_CUS3A_GetAwbStatus(MI_U32 Channel, CusAWBInfo_t *data);
|
||||
MI_S32 MI_ISP_CUS3A_SetAwbParam(MI_U32 Channel, CusAWBResult_t *data);
|
||||
MI_S32 MI_ISP_CUS3A_SetAEWindowBlockNumber(MI_U32 Channel, MS_CUST_AE_WIN_BLOCK_NUM_TYPE_e *data);
|
||||
MI_S32 MI_ISP_CUS3A_SetAEHistogramWindow(MI_U32 Channel, CusAEHistWin_t*data);
|
||||
MI_S32 MI_ISP_CUS3A_SetAWBSampling(MI_U32 Channel, CusAWBSample_t *data);
|
||||
MI_S32 MI_ISP_CUS3A_SetAECropSize(MI_U32 Channel, CusAEAWBCropSize_t *data);
|
||||
MI_S32 MI_ISP_CUS3A_SetAWBCropSize(MI_U32 Channel, CusAEAWBCropSize_t *data);
|
||||
|
||||
MI_S32 MI_ISP_CUS3A_GetAFStats(MI_U32 Channel, CusAFStats_t *data);
|
||||
MI_S32 MI_ISP_CUS3A_SetAFWindow(MI_U32 Channel, CusAFWin_t *data);
|
||||
MI_S32 MI_ISP_CUS3A_GetAFWindow(MI_U32 Channel, CusAFWin_t *data);
|
||||
MI_S32 MI_ISP_CUS3A_SetAFFilter(MI_U32 Channel, CusAFFilter_t *data);
|
||||
MI_S32 MI_ISP_CUS3A_GetAFFilter(MI_U32 Channel, CusAFFilter_t *data);
|
||||
MI_S32 MI_ISP_CUS3A_SetAFFilter_Geo(MI_U32 Channel, CusAFFilter_Geo_t *data);
|
||||
MI_S32 MI_ISP_CUS3A_GetAFFilter_Geo(MI_U32 Channel, CusAFFilter_Geo_t *data);
|
||||
MI_S32 MI_ISP_CUS3A_SetAFFilterSq(MI_U32 Channel, CusAFFilterSq_t *data);
|
||||
MI_S32 MI_ISP_CUS3A_GetAFFilterSq(MI_U32 Channel, CusAFFilterSq_t *data);
|
||||
MI_S32 MI_ISP_CUS3A_SetAFRoiMode(MI_U32 Channel, CusAFRoiMode_t *data);
|
||||
MI_S32 MI_ISP_CUS3A_GetAFRoiMode(MI_U32 Channel, CusAFRoiMode_t *data);
|
||||
MI_S32 MI_ISP_CUS3A_GetAfStatus(MI_U32 Channel, CusAFInfo_t *data);
|
||||
MI_S32 MI_ISP_CUS3A_SetAfParam(MI_U32 Channel, CusAfResult_t *data);
|
||||
|
||||
MI_S32 MI_ISP_CUS3A_GetImageResolution(MI_U32 Channel, CusImageResolution_t *data);
|
||||
MI_S32 MI_ISP_CUS3A_EnableISPOutImage(MI_U32 Channel, CusISPOutImage_t *data);
|
||||
MI_S32 MI_ISP_CUS3A_GetISPOutImageCount(MI_U32 Channel, MI_U32 *data);
|
||||
MI_S32 MI_ISP_CUS3A_CaptureHdrRawImage(MI_U32 Channel, CusHdrRawImage_t *data);
|
||||
MI_S32 MI_ISP_GetFrameMetaInfo(MI_U32 Channel, IspFrameMetaInfo_t *data);
|
||||
MI_S32 MI_ISP_ReadSensorData(MI_U32 Channel, CusSensorI2cParam_t *data);
|
||||
MI_S32 MI_ISP_WriteSensorData(MI_U32 Channel, CusSensorI2cParam_t *data);
|
||||
/************************************* Customer 3A API END********************************/
|
||||
/************************************* Debug API ***********************************/
|
||||
MI_S32 MI_ISP_SetDebugLevel_AE(MI_U32 Channel, MI_S32 *data);
|
||||
MI_S32 MI_ISP_GetDebugLevel_AE(MI_U32 Channel, MI_S32 *data);
|
||||
MI_S32 MI_ISP_SetDebugLevel_AWB(MI_U32 Channel, MI_S32 *data);
|
||||
MI_S32 MI_ISP_GetDebugLevel_AWB(MI_U32 Channel, MI_S32 *data);
|
||||
/************************************* Debug API END********************************/
|
||||
|
||||
MI_S32 MI_ISP_SET_ALL(int Channel, MI_U16 ApiId, MI_U32 ApiLen, MI_U8* pApiBuf);
|
||||
MI_S32 MI_ISP_GET_ALL(int Channel, MI_U16 ApiId, MI_U32* ApiLen, MI_U8* pApiBuf);
|
||||
|
||||
MI_S32 MI_ISP_API_CmdLoadBinFile(MI_U32 Channel, char* filepath, MI_U32 user_key);
|
||||
MI_S32 MI_ISP_API_CmdLoadCaliData(MI_U32 Channel, MI_ISP_CALI_ITEM_e eCaliItem, char* filepath);
|
||||
|
||||
typedef MI_S32 (*MI_ISP_ApiAgent_fp)(MI_VPE_IspApiHeader_t *pstData, void* pData);
|
||||
|
||||
/*Api agent for SigmaStar user space 3A library*/
|
||||
MI_S32 MI_ISP_RegisterIspApiAgent(MI_U32 Channel, MI_ISP_ApiAgent_fp fpApiSet, MI_ISP_ApiAgent_fp fpApiGet);
|
||||
#if !defined(DUAL_OS) && !defined(__RTOS__) //for pure linux
|
||||
MI_S32 MI_ISP_EnableUserspace3A(MI_U32 Channel,MI_ISP_API_USERSPACE3A_ATTR_t *pAttr);
|
||||
MI_S32 MI_ISP_DisableUserspace3A(MI_U32 Channel);
|
||||
#else //for DualOS-Linux , RTK
|
||||
inline MI_S32 MI_ISP_EnableUserspace3A(MI_U32 Channel,MI_ISP_API_USERSPACE3A_ATTR_t *pAttr) {return 0;}
|
||||
inline MI_S32 MI_ISP_DisableUserspace3A(MI_U32 Channel) {return 0;}
|
||||
#endif
|
||||
|
||||
/*Common API, get isp root path*/
|
||||
MI_S32 MI_ISP_GetIspRoot(MI_U32 Channel, MI_ISP_ROOT_PATH_T *data);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} //end of extern C
|
||||
#endif
|
||||
|
||||
#endif //_MI_ISP_H_
|
|
@ -0,0 +1,532 @@
|
|||
/* SigmaStar trade secret */
|
||||
/* Copyright (c) [2019~2020] SigmaStar Technology.
|
||||
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 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 _MI_ISP_3A_DATATYPE_H_
|
||||
#define _MI_ISP_3A_DATATYPE_H_
|
||||
|
||||
typedef enum __attribute__ ((aligned (4)))
|
||||
{
|
||||
SS_FALSE = 0,
|
||||
SS_TRUE = !SS_FALSE,
|
||||
SS_BOOL_MAX
|
||||
} MI_ISP_BOOL_e;
|
||||
|
||||
typedef enum __attribute__ ((aligned (4)))
|
||||
{
|
||||
SS_OP_TYP_AUTO = 0,
|
||||
SS_OP_TYP_MANUAL = !SS_OP_TYP_AUTO,
|
||||
SS_OP_TYP_MODE_MAX
|
||||
} MI_ISP_OP_TYPE_e;
|
||||
|
||||
/************************************* AE - Define the structure declaration - START *************************************/
|
||||
|
||||
typedef enum __attribute__ ((aligned (4)))
|
||||
{
|
||||
SS_ISP_STATE_NORMAL = 0,
|
||||
SS_ISP_STATE_PAUSE = 1,
|
||||
SS_ISP_STATE_MAX
|
||||
} MI_ISP_SM_STATE_TYPE_e;
|
||||
|
||||
|
||||
typedef enum __attribute__ ((aligned (4)))
|
||||
{
|
||||
SS_AE_MODE_A, // auto
|
||||
SS_AE_MODE_AV, // aperture priority
|
||||
SS_AE_MODE_SV,
|
||||
SS_AE_MODE_TV, // shutter priority
|
||||
SS_AE_MODE_M, // manual mode
|
||||
SS_AE_MODE_MAX
|
||||
} MI_ISP_AE_MODE_TYPE_e;
|
||||
|
||||
typedef enum __attribute__ ((aligned (4)))
|
||||
{
|
||||
SS_AE_WEIGHT_AVERAGE = 0,
|
||||
SS_AE_WEIGHT_CENTER,
|
||||
SS_AE_WEIGHT_SPOT,
|
||||
SS_AE_WEIGHT_MAX
|
||||
} MI_ISP_AE_WIN_WEIGHT_MODE_TYPE_e;
|
||||
|
||||
typedef enum __attribute__ ((aligned (4)))
|
||||
{
|
||||
SS_AE_FLICKER_TYPE_DISABLE = 0,
|
||||
SS_AE_FLICKER_TYPE_60HZ = 1,
|
||||
SS_AE_FLICKER_TYPE_50HZ = 2,
|
||||
SS_AE_FLICKER_TYPE_AUTO = 3,
|
||||
//SS_AE_FLICKER_TYPE_DETECT_60HZ = 4,
|
||||
//SS_AE_FLICKER_TYPE_DETECT_50HZ = 5,
|
||||
SS_AE_FLICKER_TYPE_MAX
|
||||
} MI_ISP_AE_FLICKER_TYPE_e;
|
||||
|
||||
typedef enum __attribute__ ((aligned (4)))
|
||||
{
|
||||
SS_AE_FLICKER_TYPE_DETECT_60HZ = 0,
|
||||
SS_AE_FLICKER_TYPE_DETECT_50HZ = 1,
|
||||
SS_AE_FLICKER_TYPE_DETECT_MAX
|
||||
} MI_ISP_AE_FLICKER_DETECT_TYPE_e;
|
||||
|
||||
//typedef struct MI_ISP_AE_FLICKER_INFO_TYPE_s
|
||||
//{
|
||||
// MI_ISP_BOOL_e bIsEffective;
|
||||
// MI_ISP_AE_FLICKER_TYPE_e eFlickerType;
|
||||
// MI_U16 u16Score;
|
||||
//} MI_ISP_AE_FLICKER_INFO_TYPE_t;
|
||||
|
||||
typedef struct MI_ISP_AE_FLICKER_EX_TYPE_s
|
||||
{
|
||||
MI_ISP_BOOL_e bEnable; // 0 ~ 1
|
||||
MI_ISP_OP_TYPE_e enOpType; // M_AUTO ~ (M_MODMAX-1)
|
||||
MI_U8 u8AmpSensitivity; // 1 ~ 100
|
||||
MI_U8 u8ScoreThd; // 1 ~ 100
|
||||
MI_U8 uRefreshCycles; // 1 ~ 10
|
||||
MI_U8 u8ValidTimesThd; // 1 ~ 10
|
||||
MI_ISP_AE_FLICKER_DETECT_TYPE_e eFlickerType; // 60Hz = 0, 50Hz = 1
|
||||
} MI_ISP_AE_FLICKER_EX_TYPE_t;
|
||||
|
||||
typedef struct MI_ISP_AE_FLICKER_EX_INFO_TYPE_s
|
||||
{
|
||||
MI_ISP_BOOL_e bIsEffective;
|
||||
MI_ISP_AE_FLICKER_DETECT_TYPE_e eFlickerType;
|
||||
MI_U16 u16Score;
|
||||
} MI_ISP_AE_FLICKER_EX_INFO_TYPE_t;
|
||||
|
||||
typedef enum __attribute__ ((aligned (4)))
|
||||
{
|
||||
SS_AE_STRATEGY_BRIGHTTONE,
|
||||
SS_AE_STRATEGY_DARKTONE,
|
||||
SS_AE_STRATEGY_AUTO,
|
||||
SS_AE_STRATEGY_MAX
|
||||
} MI_ISP_AE_STRATEGY_TYPE_e;
|
||||
|
||||
typedef struct MI_ISP_AE_HIST_WEIGHT_Y_TYPE_s
|
||||
{
|
||||
MI_U32 u32LumY;
|
||||
MI_U32 u32AvgY;
|
||||
MI_U32 u32Hits[128];
|
||||
} MI_ISP_AE_HIST_WEIGHT_Y_TYPE_t;
|
||||
|
||||
typedef struct MI_ISP_AE_EXPO_VALUE_TYPE_s
|
||||
{
|
||||
MI_U32 u32FNx10;
|
||||
MI_U32 u32SensorGain;
|
||||
MI_U32 u32ISPGain;
|
||||
MI_U32 u32US;
|
||||
} MI_ISP_AE_EXPO_VALUE_TYPE_t;
|
||||
|
||||
typedef struct MI_ISP_AE_EXPO_INFO_TYPE_s
|
||||
{
|
||||
MI_ISP_BOOL_e bIsStable;
|
||||
MI_ISP_BOOL_e bIsReachBoundary;
|
||||
MI_ISP_AE_EXPO_VALUE_TYPE_t stExpoValueLong;
|
||||
MI_ISP_AE_EXPO_VALUE_TYPE_t stExpoValueShort;
|
||||
MI_ISP_AE_HIST_WEIGHT_Y_TYPE_t stHistWeightY;
|
||||
MI_U32 u32LVx10;
|
||||
MI_S32 s32BV;
|
||||
MI_U32 u32SceneTarget;
|
||||
} MI_ISP_AE_EXPO_INFO_TYPE_t;
|
||||
|
||||
typedef struct MI_ISP_AE_EV_COMP_TYPE_s
|
||||
{
|
||||
MI_S32 s32EV;
|
||||
MI_U32 u32Grad;
|
||||
} MI_ISP_AE_EV_COMP_TYPE_t;
|
||||
|
||||
typedef struct MI_ISP_AE_INTP_LUT_TYPE_s
|
||||
{
|
||||
MI_U16 u16NumOfPoints;
|
||||
MI_U32 u32Y[16];
|
||||
MI_U32 u32X[16];
|
||||
} MI_ISP_AE_INTP_LUT_TYPE_t;
|
||||
|
||||
typedef struct CONV_SPEED_PARAM_s
|
||||
{
|
||||
MI_U32 u32SpeedX[4];
|
||||
MI_U32 u32SpeedY[4];
|
||||
} CONV_SPEED_PARAM_t;
|
||||
|
||||
typedef struct CONV_THD_PARAM_s
|
||||
{
|
||||
MI_U32 u32InThd;
|
||||
MI_U32 u32OutThd;
|
||||
} CONV_THD_PARAM_t;
|
||||
|
||||
typedef struct MI_ISP_AE_CONV_CONDITON_TYPE_s
|
||||
{
|
||||
CONV_THD_PARAM_t stConvThrd;
|
||||
CONV_SPEED_PARAM_t stConvSpeed;
|
||||
} MI_ISP_AE_CONV_CONDITON_TYPE_t;
|
||||
|
||||
typedef struct MI_ISP_AE_EXPO_LIMIT_TYPE_s
|
||||
{
|
||||
MI_U32 u32MinShutterUS;
|
||||
MI_U32 u32MaxShutterUS;
|
||||
MI_U32 u32MinFNx10;
|
||||
MI_U32 u32MaxFNx10;
|
||||
MI_U32 u32MinSensorGain;
|
||||
MI_U32 u32MinISPGain;
|
||||
MI_U32 u32MaxSensorGain;
|
||||
MI_U32 u32MaxISPGain;
|
||||
} MI_ISP_AE_EXPO_LIMIT_TYPE_t;
|
||||
|
||||
typedef struct EXPO_POINT_PARAM_s
|
||||
{
|
||||
MI_U32 u32FNumx10;
|
||||
MI_U32 u32Shutter;
|
||||
MI_U32 u32TotalGain;
|
||||
MI_U32 u32SensorGain;
|
||||
} EXPO_POINT_PARAM_t;
|
||||
|
||||
typedef struct MI_ISP_AE_EXPO_TABLE_TYPE_s
|
||||
{
|
||||
MI_U32 u32NumPoints;
|
||||
EXPO_POINT_PARAM_t stExpoTbl[16]; // LV from High to Low
|
||||
} MI_ISP_AE_EXPO_TABLE_TYPE_t;
|
||||
|
||||
typedef struct WIN_WEIGHT_PARAM_s
|
||||
{
|
||||
MI_U8 u8AverageTbl[32*32];
|
||||
MI_U8 u8CenterTbl[32*32];
|
||||
MI_U8 u8SpotTbl[32*32];
|
||||
} WIN_WEIGHT_PARAM_t;
|
||||
|
||||
typedef struct MI_ISP_AE_WIN_WEIGHT_TYPE_s
|
||||
{
|
||||
MI_ISP_AE_WIN_WEIGHT_MODE_TYPE_e eTypeID;
|
||||
WIN_WEIGHT_PARAM_t stParaAPI;
|
||||
} MI_ISP_AE_WIN_WEIGHT_TYPE_t;
|
||||
|
||||
typedef struct MI_ISP_AE_STRATEGY_TYPE_s
|
||||
{
|
||||
MI_ISP_AE_STRATEGY_TYPE_e eAEStrategyMode;
|
||||
MI_U32 u32Weighting;
|
||||
MI_ISP_AE_INTP_LUT_TYPE_t stUpperOffset;
|
||||
MI_ISP_AE_INTP_LUT_TYPE_t stLowerOffset;
|
||||
MI_U32 u32BrightToneStrength;
|
||||
MI_U32 u32BrightToneSensitivity;
|
||||
MI_U32 u32DarkToneStrength;
|
||||
MI_U32 u32DarkToneSensitivity;
|
||||
MI_U32 u32AutoStrength;
|
||||
MI_U32 u32AutoSensitivity;
|
||||
} MI_ISP_AE_STRATEGY_TYPE_t;
|
||||
|
||||
typedef enum __attribute__ ((aligned (4)))
|
||||
{
|
||||
SS_AE_STRATEGY_EX_BRIGHTTONE,
|
||||
SS_AE_STRATEGY_EX_DARKTONE,
|
||||
} MI_ISP_AE_STRATEGY_EX_PRIORITY_e;
|
||||
|
||||
typedef enum __attribute__ ((aligned (4)))
|
||||
{
|
||||
SS_AE_STRATEGY_EX_COUNT,
|
||||
SS_AE_STRATEGY_EX_TARGET,
|
||||
} MI_ISP_AE_STRATEGY_EX_MODE_e;
|
||||
|
||||
typedef struct MI_ISP_AE_STRATEGY_EX_TYPE_s
|
||||
{
|
||||
MI_ISP_BOOL_e bEnable;
|
||||
MI_ISP_AE_STRATEGY_EX_MODE_e eMode;
|
||||
MI_ISP_AE_STRATEGY_EX_PRIORITY_e ePriority;
|
||||
MI_U16 u16BT_NodeNum;
|
||||
MI_S32 u32BT_NodeBV[16];
|
||||
MI_U32 u32BT_ThdY[16];
|
||||
MI_U32 u32BT_Percentx10[16];
|
||||
MI_U32 u32BT_TargetYx10[16];
|
||||
MI_U32 u32BT_MaxOffsetDown[16];
|
||||
MI_U16 u16DT_NodeNum;
|
||||
MI_S32 u32DT_NodeBV[16];
|
||||
MI_U32 u32DT_ThdY[16];
|
||||
MI_U32 u32DT_Percentx10[16];
|
||||
MI_U32 u32DT_TargetYx10[16];
|
||||
MI_U32 u32DT_MaxOffsetUp[16];
|
||||
} MI_ISP_AE_STRATEGY_EX_TYPE_t;
|
||||
|
||||
typedef struct MI_ISP_AE_STRATEGY_EX_INFO_TYPE_s
|
||||
{
|
||||
MI_U16 u16GMBlendRatio;
|
||||
MI_U16 u16UpperLimitTargetx10;
|
||||
MI_U16 u16LowerLimitTargetx10;
|
||||
MI_U16 u16BTCntPcntx10;
|
||||
MI_U16 u16DTCntPcntx10;
|
||||
MI_U16 u16BTYx10;
|
||||
MI_U16 u16DTYx10;
|
||||
} MI_ISP_AE_STRATEGY_EX_INFO_TYPE_t;
|
||||
|
||||
typedef struct MI_ISP_AE_RGBIR_AE_TYPE_s
|
||||
{
|
||||
MI_ISP_BOOL_e bEnable;
|
||||
MI_U16 u16MaxYWithIR;
|
||||
MI_U16 u16MinISPGainCompRatio;
|
||||
} MI_ISP_AE_RGBIR_AE_TYPE_t;
|
||||
|
||||
typedef struct MI_ISP_AE_HDR_TYPE_s
|
||||
{
|
||||
MI_ISP_AE_INTP_LUT_TYPE_t stAeHdrRatio;
|
||||
} MI_ISP_AE_HDR_TYPE_t;
|
||||
|
||||
typedef struct MI_ISP_AE_STABILIZER_TYPE_s
|
||||
{
|
||||
MI_ISP_BOOL_e bEnable;
|
||||
MI_U16 u16DiffThd;
|
||||
MI_U16 u16Percent;
|
||||
} MI_ISP_AE_STABILIZER_TYPE_t;
|
||||
|
||||
/************************************* AE - Define the structure declaration - END *************************************/
|
||||
|
||||
/************************************* AWB - Define the structure declaration - START *************************************/
|
||||
|
||||
#define MI_ISP_AWB_LV_CT_TBL_NUM (18)
|
||||
#define MI_ISP_AWB_CT_TBL_NUM (10)
|
||||
#define MI_ISP_AWB_WEIGHT_WIN_NUM (81)
|
||||
|
||||
typedef struct MI_ISP_AWB_QUERY_INFO_TYPE_s
|
||||
{
|
||||
MI_ISP_BOOL_e bIsStable;
|
||||
MI_U16 u16Rgain;
|
||||
MI_U16 u16Grgain;
|
||||
MI_U16 u16Gbgain;
|
||||
MI_U16 u16Bgain;
|
||||
MI_U16 u16ColorTemp;
|
||||
MI_U8 u8WPInd;
|
||||
MI_ISP_BOOL_e bMultiLSDetected;
|
||||
MI_U8 u8FirstLSInd;
|
||||
MI_U8 u8SecondLSInd;
|
||||
} MI_ISP_AWB_QUERY_INFO_TYPE_t;
|
||||
|
||||
typedef enum __attribute__ ((aligned (4)))
|
||||
{
|
||||
SS_AWB_MODE_AUTO,
|
||||
SS_AWB_MODE_MANUAL,
|
||||
SS_AWB_MODE_CTMANUAL,
|
||||
SS_AWB_MODE_MAX
|
||||
} MI_ISP_AWB_MODE_TYPE_e;
|
||||
|
||||
typedef enum __attribute__ ((aligned (4)))
|
||||
{
|
||||
SS_AWB_ALG_GRAYWORLD = 0,
|
||||
SS_AWB_ALG_NORMAL = 1,
|
||||
SS_AWB_ALG_BALANCE = 2,
|
||||
SS_AWB_ALG_FOCUS = 3,
|
||||
SS_AWB_ALG_MAX = 0xffffffff
|
||||
} MI_ISP_AWB_ALG_TYPE_e;
|
||||
|
||||
typedef enum __attribute__ ((aligned (4)))
|
||||
{
|
||||
SS_AWB_ADV_DEFAULT = 0,
|
||||
SS_AWB_ADV_ADVANCE = 1,
|
||||
SS_AWB_ADV_MAX = 0xffffffff
|
||||
} MI_ISP_AWB_ADV_TYPE_e;
|
||||
|
||||
typedef struct CT_LIMIT_PARAM_s
|
||||
{
|
||||
MI_U16 u16MaxRgain; //RW, Maximum RGain, Range: [0, 8191]
|
||||
MI_U16 u16MinRgain; //RW, Miniimum RGain, Range: [0, 8191]
|
||||
MI_U16 u16MaxBgain; //RW, Maximum BGain, Range: [0, 8191]
|
||||
MI_U16 u16MinBgain; //RW, Miniimum BGain, Range: [0, 8191]
|
||||
} CT_LIMIT_PARAM_t;
|
||||
|
||||
typedef struct CT_WEIGHT_PARAM_s
|
||||
{
|
||||
MI_U16 u16Weight[MI_ISP_AWB_CT_TBL_NUM]; //RW, Light CT Weight, Range: [1, 255]
|
||||
} CT_WEIGHT_PARAM_t;
|
||||
|
||||
typedef struct CT_RATIO_PARAM_s
|
||||
{
|
||||
MI_U16 u16Ratio[MI_ISP_AWB_CT_TBL_NUM]; //RW, CT Prefer Ratio, Range: [1, 255]
|
||||
} CT_RATIO_PARAM_t;
|
||||
|
||||
typedef struct AWB_ATTR_PARAM_s
|
||||
{
|
||||
MI_U8 u8Speed; //RW, AWB converging speed, Range: [0x1, 0x64]
|
||||
MI_U8 u8ConvInThd; //RW, AWB converging threshold, Range:[0, 255], Recommended: [32]
|
||||
MI_U8 u8ConvOutThd; //RW, AWB converging threshold, Range:[0, 255], Recommended: [64]
|
||||
MI_ISP_AWB_ALG_TYPE_e eAlgType; //RW, AWB 0:GrayWorld, 1:Normal, 2:Balance 3,Focus
|
||||
MI_ISP_AWB_ADV_TYPE_e eAdvType; //RW, AWB advance mode type
|
||||
MI_U8 u8RGStrength; //RW, AWB adjust RG ratio, Range:[0, 255]
|
||||
MI_U8 u8BGStrength; //RW, AWB adjust BG ratio, Range:[0, 255]
|
||||
CT_LIMIT_PARAM_t stCTLimit; //RW, AWB limitation when envirnoment ct is out of boundary
|
||||
CT_WEIGHT_PARAM_t stLvWeight[MI_ISP_AWB_LV_CT_TBL_NUM]; //RW, AWB Lv Ct Weight, Range: [0, 255]
|
||||
CT_RATIO_PARAM_t stPreferRRatio[MI_ISP_AWB_LV_CT_TBL_NUM]; //RW, AWB prefer R gain, Range: [0, 255]
|
||||
CT_RATIO_PARAM_t stPreferBRatio[MI_ISP_AWB_LV_CT_TBL_NUM]; //RW, AWB prefer B gain, Range: [0, 255]
|
||||
MI_U16 u16WpWeight[MI_ISP_AWB_CT_TBL_NUM];
|
||||
MI_U32 u32WeightWin[MI_ISP_AWB_WEIGHT_WIN_NUM]; //RW, AWB region gain, Range: [0, 16]
|
||||
} AWB_ATTR_PARAM_t;
|
||||
|
||||
typedef struct MWB_ATTR_PARAM_s
|
||||
{
|
||||
MI_U16 u16Rgain; //RW, Multiplier for R color channel, Range: [0, 0x2000]
|
||||
MI_U16 u16Grgain; //RW, Multiplier for Gr color channel, Range: [0, 0x2000]
|
||||
MI_U16 u16Gbgain; //RW, Multiplier for Gb color channel, Range: [0, 0x2000]
|
||||
MI_U16 u16Bgain; //RW, Multiplier for B color channel, Range: [0, 0x2000]
|
||||
} MWB_ATTR_PARAM_t;
|
||||
|
||||
typedef struct MI_ISP_AWB_ATTR_TYPE_s
|
||||
{
|
||||
MI_ISP_SM_STATE_TYPE_e eState;
|
||||
MI_ISP_AWB_MODE_TYPE_e eOpType;
|
||||
MWB_ATTR_PARAM_t stManualParaAPI;
|
||||
AWB_ATTR_PARAM_t stAutoParaAPI;
|
||||
} MI_ISP_AWB_ATTR_TYPE_t;
|
||||
|
||||
typedef struct AWB_ATTR_EXTRA_LIGHTSOURCE_PARAM_s
|
||||
{
|
||||
MI_U16 u16WhiteRgain; //RW, RGain of white Point Location , Range: [256, 4095]
|
||||
MI_U16 u16WhiteBgain; //RW, RGain of white Point Location , Range: [256, 4095]
|
||||
MI_U8 u8AreaSize; //RW, Light Area Size , Range: [1, 32]
|
||||
MI_ISP_BOOL_e bExclude; //RW, Include or exclude Uaer light Area, 0: include, 1:exclude
|
||||
} AWB_ATTR_EXTRA_LIGHTSOURCE_PARAM_t;
|
||||
|
||||
typedef struct MI_ISP_AWB_ATTR_EX_TYPE_s
|
||||
{
|
||||
MI_ISP_BOOL_e bExtraLightEn;
|
||||
AWB_ATTR_EXTRA_LIGHTSOURCE_PARAM_t stLightInfo[4];
|
||||
} MI_ISP_AWB_ATTR_EX_TYPE_t;
|
||||
|
||||
typedef struct MI_ISP_AWB_MULTILS_LS_TYPE_s
|
||||
{
|
||||
MI_ISP_BOOL_e bEnable;
|
||||
MI_U8 u8Sensitive;
|
||||
MI_U8 u8CaliStrength;
|
||||
MI_U16 u16CcmForLow[9];
|
||||
MI_U16 u16CcmForHigh[9];
|
||||
} MI_ISP_AWB_MULTILS_LS_TYPE_t;
|
||||
|
||||
typedef struct MI_ISP_AWB_CT_WEIGHT_TYPE_s
|
||||
{
|
||||
MI_U16 u16LvIndex;
|
||||
CT_WEIGHT_PARAM_t stParaAPI;
|
||||
} MI_ISP_AWB_CT_WEIGHT_TYPE_t;
|
||||
|
||||
typedef struct MI_ISP_AWB_CT_CALI_TYPE_s
|
||||
{
|
||||
MI_U16 u16StartIdx; //RW, Light area start index, Range: [0, u2EndIdx]
|
||||
MI_U16 u16EndIdx; //RW, Light area end index, Range: [u2StartIdx, 9]
|
||||
MI_U16 u16CtParams[40]; //RW, Color temperature of calibration paramters , Range: [1, 1000]
|
||||
} MI_ISP_AWB_CT_CALI_TYPE_t;
|
||||
|
||||
typedef struct MI_ISP_AWB_CUR_CT_CALI_TYPE_s
|
||||
{
|
||||
MI_U16 u16CtParams[40]; //RW, Color temperature of calibration paramters , Range: [1, 1000]
|
||||
} MI_ISP_AWB_CUR_CT_CALI_TYPE_t;
|
||||
|
||||
typedef struct MI_ISP_AWB_CT_STATISTICS_TYPE_s
|
||||
{
|
||||
MI_U16 u16Width; //RW, Effective range
|
||||
MI_U16 u16Height; //RW, Effective range
|
||||
MI_U16 u16StatisX[5760]; //RW, Color Temperature Curve Domain Statistics X, max is 64x90
|
||||
MI_U16 u16StatisY[5760]; //RW, Color Temperature Curve Domain Statistics Y, max is 64x90
|
||||
} MI_ISP_AWB_CT_STATISTICS_TYPE_t;
|
||||
|
||||
typedef struct MI_ISP_AWB_HW_STATISTICS_TYPE_s
|
||||
{
|
||||
MI_U8 u8AwbBuffer[34560]; // 128 * 90 * 3
|
||||
} MI_ISP_AWB_HW_STATISTICS_TYPE_t;
|
||||
|
||||
typedef struct MI_ISP_AWB_CTMWB_PARAM_s
|
||||
{
|
||||
MI_U32 u32CT;
|
||||
} MI_ISP_AWB_CTMWB_PARAM_t;
|
||||
|
||||
/************************************* AWB - Define the structure declaration - END *************************************/
|
||||
|
||||
/************************************* AF - Define the structure declaration - START *************************************/
|
||||
|
||||
typedef enum __attribute__ ((aligned (4)))
|
||||
{
|
||||
SS_AF_ALGO_ONESHOT = 0,
|
||||
SS_AF_ALGO_CONTINUOUS = 1
|
||||
} MI_ISP_AF_ALGO_TYPE_e;
|
||||
|
||||
typedef enum __attribute__ ((aligned (4)))
|
||||
{
|
||||
SS_AF_ACC_IIRH = 0,
|
||||
SS_AF_ACC_IIRL = 1,
|
||||
SS_AF_ACC_SBLV = 2,
|
||||
SS_AF_ACC_SBLH = 3,
|
||||
SS_AF_ACC_LUMA = 4,
|
||||
SS_AF_ACC_MAX = 0xffffffff
|
||||
} MI_ISP_AF_ACC_SEL_TYPE_e;
|
||||
|
||||
typedef struct MI_ISP_AF_ATTR_TYPE_s
|
||||
{
|
||||
MI_ISP_SM_STATE_TYPE_e eState; // 0~1
|
||||
MI_ISP_OP_TYPE_e eType; // 0~1
|
||||
MI_U16 u16ManualMotorPos; // 0~1023?
|
||||
MI_ISP_AF_ALGO_TYPE_e eAlgo; // 0~1
|
||||
} MI_ISP_AF_ATTR_TYPE_t;
|
||||
|
||||
typedef struct MI_ISP_AF_MOTOR_TYPE_s
|
||||
{
|
||||
MI_U16 u16MinMotorPos; // 0~1023?
|
||||
MI_U16 u16MaxMotorPos; // 0~1023?
|
||||
MI_U16 u16MinMotorStep; // 0~1023?
|
||||
MI_U16 u16MaxMotorStep; // 0~1023?
|
||||
} MI_ISP_AF_MOTOR_TYPE_t;
|
||||
|
||||
typedef struct MI_ISP_AF_ACC_WEIGHT_TYPE_s
|
||||
{
|
||||
MI_U8 u8WinNumX; // 1~16
|
||||
MI_U8 u8WinNumY; // 1~16
|
||||
MI_ISP_BOOL_e bEqualWinWgt; // 0~1
|
||||
MI_U8 u8WinWgt[256]; // 0~255
|
||||
MI_ISP_BOOL_e bIIRHBlendEn; // 0~1
|
||||
MI_U8 u8IIRHWgt_FirstBlendIIRL; // 0~255
|
||||
MI_U8 u8IIRHWgt_SecondBlendSBLV; // 0~255
|
||||
MI_U8 u8IIRHWgt_ThirdBlendSBLH; // 0~255
|
||||
} MI_ISP_AF_ACC_WEIGHT_TYPE_t;
|
||||
|
||||
typedef struct MI_ISP_AF_ONESHOT_TYPE_s
|
||||
{
|
||||
MI_ISP_AF_ACC_SEL_TYPE_e eAccSel; // 0~3
|
||||
MI_U16 u16MotorStep; // 0~1023?
|
||||
} MI_ISP_AF_ONESHOT_TYPE_t;
|
||||
|
||||
typedef struct MI_ISP_AF_SCENE_CHANGE_TYPE_s
|
||||
{
|
||||
MI_ISP_AF_ACC_SEL_TYPE_e ePreAfAccSel; // 0~3
|
||||
MI_U8 u8PreAeAccDiffThOft; // 0~100, unit: %
|
||||
MI_U8 u8PreAeAccDiffThSlp; // 0~100, unit: %
|
||||
MI_U8 u8PreAeAccCntThOft; // 0~100, unit: %
|
||||
MI_U8 u8PreAeAccCntThSlp; // 0~100, unit: %
|
||||
MI_U8 u8PreAfAccDiffThOft; // 0~100, unit: %
|
||||
MI_U8 u8PreAfAccDiffThSlp; // 0~100, unit: %
|
||||
MI_U8 u8PreAfAccCntThOft; // 0~100, unit: %
|
||||
MI_U8 u8PreAfAccCntThSlp; // 0~100, unit: %
|
||||
MI_ISP_AF_ACC_SEL_TYPE_e eFocusAfAccSel; // 0~3
|
||||
MI_U8 u8FocusAeAccDiffTh; // 0~100, unit: %
|
||||
MI_U8 u8FocusAeAccCntTh; // 0~100, unit: %
|
||||
MI_U8 u8FocusAfAccDiffTh; // 0~100, unit: %
|
||||
MI_U8 u8FocusAfAccCntTh; // 0~100, unit: %
|
||||
MI_U8 u8StableCntTh; // 0~255
|
||||
} MI_ISP_AF_SCENE_CHANGE_TYPE_t;
|
||||
|
||||
typedef struct MI_ISP_AF_SEARCH_START_TYPE_s
|
||||
{
|
||||
MI_U16 u16SearchMotorStep; // 0~1023?
|
||||
MI_U16 u16SearchMotorDirByPosTh; // 0~1023?
|
||||
MI_ISP_AF_ACC_SEL_TYPE_e eSearchAccSel; // 0~3
|
||||
} MI_ISP_AF_SEARCH_START_TYPE_t;
|
||||
|
||||
typedef struct MI_ISP_AF_SEARCH_TYPE_s
|
||||
{
|
||||
MI_U8 u8MinMaxAccRatioPeakThOft; // 0~100, unit: %
|
||||
MI_U8 u8MinMaxAccRatioPeakThSlp; // 0~100, unit: %
|
||||
MI_U8 u8AccDecCntPeakTh; // 0~255
|
||||
MI_U8 u8NowFakeMaxAccRatioPeakTh; // 0~100, unit: %
|
||||
MI_U8 u8AccDecCntWrongDirTh; // 0~255
|
||||
MI_U8 u8NowFakeMaxAccRatioWrongDirTh; // 0~100, unit: %
|
||||
} MI_ISP_AF_SEARCH_TYPE_t;
|
||||
|
||||
/************************************* AF - Define the structure declaration - END *************************************/
|
||||
|
||||
#endif //_MI_ISP_3A_DATATYPE_H_
|
|
@ -0,0 +1,333 @@
|
|||
/* SigmaStar trade secret */
|
||||
/* Copyright (c) [2019~2020] SigmaStar Technology.
|
||||
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 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* mi_isp_api_id.h
|
||||
*
|
||||
* Created on: June 27, 2018
|
||||
* Author: Jeffrey Chou
|
||||
*/
|
||||
|
||||
#ifndef _TUNINGSERVER_API_ID_H_
|
||||
#define _TUNINGSERVER_API_ID_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
#define ID_API_COMMON_BASE (0x0000)
|
||||
#define ID_API_COMMON_END (0x0FFF)
|
||||
|
||||
#if 0
|
||||
#define ID_API_ISP_BASE (0x1000)
|
||||
#define ID_API_ISP_END (0x1FFF)
|
||||
|
||||
#define ID_API_CALIBRATION_20_BASE (0x2000)
|
||||
#define ID_API_CALIBRATION_20_END (0x22FF)
|
||||
|
||||
#define ID_API_MAINTOOL_BASE (0x2300)
|
||||
#define ID_API_MAINTOOL_END (0x25FF)
|
||||
|
||||
#define ID_API_PLUGIN_BASE (0x2600)
|
||||
#define ID_API_PLUGIN_END (0x28FF)
|
||||
#else
|
||||
#define ID_API_ISP_IQ_BASE (0x1000)
|
||||
#define ID_API_ISP_IQ_END (0x13FF)
|
||||
|
||||
#define ID_API_ISP_AE_BASE (0x1400)
|
||||
#define ID_API_ISP_AE_END (0x17FF)
|
||||
|
||||
#define ID_API_ISP_AWB_BASE (0x1800)
|
||||
#define ID_API_ISP_AWB_END (0x1BFF)
|
||||
|
||||
#define ID_API_ISP_AF_BASE (0x1C00)
|
||||
#define ID_API_ISP_AF_END (0x1FFF)
|
||||
|
||||
#define ID_API_ISP_OTHER_BASE (0x2000)
|
||||
#define ID_API_ISP_OTHER_END (0x23FF)
|
||||
|
||||
#define ID_API_CALIBRATION_20_BASE (0x2400)
|
||||
#define ID_API_CALIBRATION_20_END (0x27FF)
|
||||
|
||||
#define ID_API_MAINTOOL_BASE (0x2800)
|
||||
#define ID_API_MAINTOOL_END (0x2BFF)
|
||||
|
||||
#define ID_API_PLUGIN_BASE (0x2C00)
|
||||
#define ID_API_PLUGIN_END (0x2DFF)
|
||||
|
||||
#define ID_API_CUS3A_BASE (0x2E00)
|
||||
#define ID_API_CUS3A_END (0x2FFF)
|
||||
|
||||
#define ID_API_DEBUG_LEVEL_BASE (0x2FFF)
|
||||
#define ID_API_DEBUG_LEVEL_END (0x3100)
|
||||
|
||||
#define ID_API_VIDEO_ENCODE_BASE (0x3101)
|
||||
#define ID_API_VIDEO_ENCODE_END (0x31FF)
|
||||
|
||||
#define ID_API_RESERVED_BASE (0x3200)
|
||||
#define ID_API_RESERVED_END (0x3FFF)
|
||||
|
||||
#endif
|
||||
|
||||
#define ID_CHIP_I1 (0x6d65031B)
|
||||
#define ID_CHIP_I3 (0x6d65031C)
|
||||
#define ID_CHIP_I2 (0x6d65031D)
|
||||
#define ID_CHIP_I5 (0x6d65031E)
|
||||
#define ID_CHIP_I6 (0x6d650320)
|
||||
#define ID_CHIP_I6E (0x6d650321)
|
||||
#define ID_CHIP_I6B0 (0x6d650322)
|
||||
#define ID_CHIP_M6 (0x6d650323)
|
||||
#define ID_CHIP_P3 (0x6d650324)
|
||||
|
||||
//================================================================
|
||||
// ID Defined : Common API
|
||||
//================================================================
|
||||
#define ID_API_COMMON_I2C_ACCESS ( ID_API_COMMON_BASE + 32 ) //SET_API_ID_MI_ISP_WriteI2C
|
||||
//#define ID_API_COMMON_QuerySensorInfo ( ID_API_COMMON_BASE + 33 ) //GET_API_ID_MI_ISP_QuerySensorInfo
|
||||
#define ID_API_COMMON_MIRROR ( ID_API_COMMON_BASE + 34 )
|
||||
#define ID_API_COMMON_ROTATE ( ID_API_COMMON_BASE + 35 )
|
||||
#define ID_API_COMMON_SENSOR_ID ( ID_API_COMMON_BASE + 36 )
|
||||
|
||||
#define ID_API_COMMON_FileID ( ID_API_COMMON_BASE + 100 ) //I1 or I3 or I2 or I5 ...
|
||||
#define ID_API_COMMON_CHANNEL_ID ( ID_API_COMMON_BASE + 101 )
|
||||
#define ID_API_COMMON_ISPROOT ( ID_API_COMMON_BASE + 102 )
|
||||
|
||||
//#define ID_API_COMMON_AVAILABLE_MEMINFO ( ID_API_COMMON_BASE + 103 )
|
||||
//#define ID_API_COMMON_DEVICE_ID ( ID_API_COMMON_BASE + 104 )
|
||||
#define ID_API_COMMON_REOPEN ( ID_API_COMMON_BASE + 105 )//Ispmid reopen
|
||||
|
||||
//================================================================
|
||||
// ID Defined : ISP API
|
||||
//================================================================
|
||||
#define ID_API_ISP_IQ_VERSION_INFO ( ID_API_ISP_IQ_BASE + 1 ) // 1. 4097
|
||||
#define ID_API_ISP_IQ_PARAM_INIT_STATUS ( ID_API_ISP_IQ_BASE + 2 ) // 2. 4098
|
||||
#define ID_API_ISP_IQ_FAST_MODE ( ID_API_ISP_IQ_BASE + 3 ) // 3. 4099
|
||||
#define ID_API_ISP_IQ_COLORTOGRAY ( ID_API_ISP_IQ_BASE + 4 ) // 4. 4100
|
||||
#define ID_API_ISP_IQ_CONTRAST ( ID_API_ISP_IQ_BASE + 5 ) // 5. 4101
|
||||
#define ID_API_ISP_IQ_BRIGHTNESS ( ID_API_ISP_IQ_BASE + 6 ) // 6. 4102
|
||||
#define ID_API_ISP_IQ_LIGHTNESS ( ID_API_ISP_IQ_BASE + 7 ) // 7. 4103
|
||||
#define ID_API_ISP_IQ_RGBGAMMA ( ID_API_ISP_IQ_BASE + 8 ) // 8. 4104
|
||||
#define ID_API_ISP_IQ_YUVGAMMA ( ID_API_ISP_IQ_BASE + 9 ) // 9. 4105
|
||||
#define ID_API_ISP_IQ_SATURATION ( ID_API_ISP_IQ_BASE + 10 ) // 10. 4106
|
||||
#define ID_API_ISP_IQ_DEFOG ( ID_API_ISP_IQ_BASE + 11 ) // 11. 4107
|
||||
#define ID_API_ISP_IQ_CCM ( ID_API_ISP_IQ_BASE + 12 ) // 12. 4108
|
||||
#define ID_API_ISP_IQ_ANTI_FALSE_COLOR ( ID_API_ISP_IQ_BASE + 13 ) // 13. 4109
|
||||
#define ID_API_ISP_IQ_NR3D ( ID_API_ISP_IQ_BASE + 14 ) // 14. 4110
|
||||
#define ID_API_ISP_IQ_NR2D_DESPIKE ( ID_API_ISP_IQ_BASE + 15 ) // 15. 4111
|
||||
#define ID_API_ISP_IQ_NR2D_LUMA ( ID_API_ISP_IQ_BASE + 16 ) // 16. 4112
|
||||
#define ID_API_ISP_IQ_NR2D_CHROMA ( ID_API_ISP_IQ_BASE + 17 ) // 17. 4113
|
||||
#define ID_API_ISP_IQ_SHARPNESS ( ID_API_ISP_IQ_BASE + 18 ) // 18. 4114
|
||||
#define ID_API_ISP_IQ_CROSSTALK ( ID_API_ISP_IQ_BASE + 19 ) // 19. 4115
|
||||
#define ID_API_ISP_IQ_BLACK_LEVEL ( ID_API_ISP_IQ_BASE + 20 ) // 20. 4116
|
||||
#define ID_API_ISP_IQ_BLACK_LEVEL_P1 ( ID_API_ISP_IQ_BASE + 21 ) // 21. 4117
|
||||
#define ID_API_ISP_IQ_WDR ( ID_API_ISP_IQ_BASE + 22 ) // 22. 4118
|
||||
#define ID_API_ISP_IQ_DEFECT_PIXEL ( ID_API_ISP_IQ_BASE + 23 ) // 23. 4119
|
||||
#define ID_API_ISP_IQ_HSV ( ID_API_ISP_IQ_BASE + 24 ) // 24. 4120
|
||||
#define ID_API_ISP_IQ_RGBIR ( ID_API_ISP_IQ_BASE + 25 ) // 25. 4121
|
||||
#define ID_API_ISP_IQ_FPN ( ID_API_ISP_IQ_BASE + 26 ) // 26. 4122
|
||||
#define ID_API_ISP_IQ_PFC ( ID_API_ISP_IQ_BASE + 27 ) // 27. 4123
|
||||
#define ID_API_ISP_IQ_DM ( ID_API_ISP_IQ_BASE + 28 ) // 28. 4124
|
||||
#define ID_API_ISP_IQ_COLOR_TRANSFORM ( ID_API_ISP_IQ_BASE + 29 ) // 29. 4125
|
||||
#define ID_API_ISP_IQ_HDR ( ID_API_ISP_IQ_BASE + 30 ) // 30. 4126
|
||||
#define ID_API_ISP_IQ_EFFECT ( ID_API_ISP_IQ_BASE + 31 ) // 31. 4127
|
||||
#define ID_API_ISP_IQ_SYS_MCNR_MEMORY ( ID_API_ISP_IQ_BASE + 32 ) // 32. 4128
|
||||
#define ID_API_ISP_IQ_LSC ( ID_API_ISP_IQ_BASE + 33 ) // 33. 4129
|
||||
#define ID_API_ISP_IQ_PARAM_MODE ( ID_API_ISP_IQ_BASE + 34 ) // 34. 4130
|
||||
#define ID_API_ISP_IQ_LinearityLUT ( ID_API_ISP_IQ_BASE + 35 ) // 35. 4131 //Get Gamma data for CCM calibration
|
||||
#define ID_API_ISP_IQ_OBCCALIB ( ID_API_ISP_IQ_BASE + 36 ) // 36. 4132 //Get OB data for Gamma or CCM calibration
|
||||
#define ID_API_ISP_IQ_NR3D_P1 ( ID_API_ISP_IQ_BASE + 37 ) // 37. 4133
|
||||
#define ID_API_ISP_IQ_WDR_FC_CURVE ( ID_API_ISP_IQ_BASE + 38 ) // 38. 4134
|
||||
#define ID_API_ISP_IQ_R2Y ( ID_API_ISP_IQ_BASE + 39 ) // 39. 4135
|
||||
#define ID_API_ISP_IQ_ALSC ( ID_API_ISP_IQ_BASE + 40 ) // 40. 4136
|
||||
#define ID_API_ISP_IQ_LSC_CTRL ( ID_API_ISP_IQ_BASE + 41 ) // 41. 4137
|
||||
#define ID_API_ISP_IQ_ALSC_CTRL ( ID_API_ISP_IQ_BASE + 42 ) // 42. 4138
|
||||
#define ID_API_ISP_IQ_DEFECT_PIXEL_CLUSTER ( ID_API_ISP_IQ_BASE + 43 ) // 43. 4139
|
||||
#define ID_API_ISP_IQ_QUERY_CCM_INFO ( ID_API_ISP_IQ_BASE + 44 ) // 44. 4140
|
||||
#define ID_API_ISP_IQ_NR2D_LUMA_ADV ( ID_API_ISP_IQ_BASE + 45 ) // 45. 4141
|
||||
#define ID_API_ISP_IQ_NR2D_CHROMA_ADV ( ID_API_ISP_IQ_BASE + 46 ) // 46. 4142
|
||||
#define ID_API_ISP_IQ_PFC_EX ( ID_API_ISP_IQ_BASE + 47 ) // 47. 4143
|
||||
#define ID_API_ISP_IQ_HDR_EX ( ID_API_ISP_IQ_BASE + 48 ) // 48. 4144
|
||||
#define ID_API_ISP_IQ_SHP_EX ( ID_API_ISP_IQ_BASE + 49 ) // 49. 4145
|
||||
#define ID_API_ISP_IQ_NR_3D_EX ( ID_API_ISP_IQ_BASE + 50 ) // 50. 4146
|
||||
#define ID_API_ISP_IQ_DUMMY ( ID_API_ISP_IQ_BASE + 51 ) // 51. 4147
|
||||
#define ID_API_ISP_IQ_DUMMY_EX ( ID_API_ISP_IQ_BASE + 52 ) // 52. 4148
|
||||
#define ID_API_ISP_IQ_WDR_FC_CURVE_FULL ( ID_API_ISP_IQ_BASE + 53 ) // 53. 4149
|
||||
#define ID_API_ISP_IQ_ADAPTIVE_GAMMA ( ID_API_ISP_IQ_BASE + 54 ) // 54. 4150
|
||||
#define ID_API_ISP_IQ_NR2D_CHROMA_PRE ( ID_API_ISP_IQ_BASE + 55 ) // 55. 4151
|
||||
#define ID_API_ISP_IQ_TEMP ( ID_API_ISP_IQ_BASE + 56 ) // 56. 4152
|
||||
#define ID_API_ISP_IQ_TEMP_INFO ( ID_API_ISP_IQ_BASE + 57 ) // 57. 4153
|
||||
|
||||
#define ID_API_ISP_AE_HIST_WEIGHT_Y ( ID_API_ISP_AE_BASE + 1 ) // 1. 5121
|
||||
#define ID_API_ISP_AE_QUERY_EXPOSURE_INFO ( ID_API_ISP_AE_BASE + 2 ) // 2. 5122
|
||||
#define ID_API_ISP_AE_EV_COMP ( ID_API_ISP_AE_BASE + 3 ) // 3. 5123
|
||||
#define ID_API_ISP_AE_EXPO_MODE ( ID_API_ISP_AE_BASE + 4 ) // 4. 5124
|
||||
#define ID_API_ISP_AE_MANUAL_EXPO ( ID_API_ISP_AE_BASE + 5 ) // 5. 5125
|
||||
#define ID_API_ISP_AE_STATE ( ID_API_ISP_AE_BASE + 6 ) // 6. 5126
|
||||
#define ID_API_ISP_AE_TARGET ( ID_API_ISP_AE_BASE + 7 ) // 7. 5127
|
||||
#define ID_API_ISP_AE_CONVERGE ( ID_API_ISP_AE_BASE + 8 ) // 8. 5128
|
||||
#define ID_API_ISP_AE_EXPOSURE_LIMIT ( ID_API_ISP_AE_BASE + 9 ) // 9. 5129
|
||||
#define ID_API_ISP_AE_PLAIN_LONG_EXPO_TABLE ( ID_API_ISP_AE_BASE + 10 ) // 10. 5130
|
||||
#define ID_API_ISP_AE_PLAIN_SHORT_EXPO_TABLE ( ID_API_ISP_AE_BASE + 11 ) // 11. 5131
|
||||
#define ID_API_ISP_AE_WINDOW_WGT_MODE ( ID_API_ISP_AE_BASE + 12 ) // 12. 5132
|
||||
#define ID_API_ISP_AE_WINDOW_WGT ( ID_API_ISP_AE_BASE + 13 ) // 13. 5133
|
||||
#define ID_API_ISP_AE_FLICKER ( ID_API_ISP_AE_BASE + 14 ) // 14. 5134
|
||||
#define ID_API_ISP_AE_STRATEGY ( ID_API_ISP_AE_BASE + 15 ) // 15. 5135
|
||||
#define ID_API_ISP_AE_RGBIRExposureAttr ( ID_API_ISP_AE_BASE + 16 ) // 16. 5136
|
||||
#define ID_API_ISP_AE_HDR ( ID_API_ISP_AE_BASE + 17 ) // 17. 5137
|
||||
#define ID_API_ISP_AE_MANUAL_EXPO_SHORT ( ID_API_ISP_AE_BASE + 18 ) // 18. 5138
|
||||
#define ID_API_ISP_AE_FLICKER_EX ( ID_API_ISP_AE_BASE + 19 ) // 19. 5139
|
||||
#define ID_API_ISP_AE_QUERY_FLICKER_EX_INFO ( ID_API_ISP_AE_BASE + 20 ) // 20. 5140
|
||||
#define ID_API_ISP_AE_STABILIZER ( ID_API_ISP_AE_BASE + 21 ) // 21. 5141
|
||||
#define ID_API_ISP_AE_STRATEGY_EX ( ID_API_ISP_AE_BASE + 22 ) // 22. 5142
|
||||
#define ID_API_ISP_AE_QUERY_STRATEGY_EX_INFO ( ID_API_ISP_AE_BASE + 23 ) // 24. 5143
|
||||
|
||||
#define ID_API_ISP_AWB_QUERY_WHITE_BALANCE_INFO ( ID_API_ISP_AWB_BASE + 1 ) // 1. 6145
|
||||
#define ID_API_ISP_AWB_ATTR ( ID_API_ISP_AWB_BASE + 2 ) // 2. 6146
|
||||
#define ID_API_ISP_AWB_ATTR_EX ( ID_API_ISP_AWB_BASE + 3 ) // 3. 6147
|
||||
#define ID_API_ISP_AWB_MULTI_LS_ATTR ( ID_API_ISP_AWB_BASE + 4 ) // 4. 6148
|
||||
#define ID_API_ISP_AWB_CT_WEIGHT ( ID_API_ISP_AWB_BASE + 5 ) // 5. 6149
|
||||
#define ID_API_ISP_AWB_CTMWB ( ID_API_ISP_AWB_BASE + 6 ) // 5. 6150
|
||||
|
||||
#define ID_API_ISP_AF_HW_ROI_MODE ( ID_API_ISP_AF_BASE + 1 ) // 1. 7169
|
||||
#define ID_API_ISP_AF_HW_WIN ( ID_API_ISP_AF_BASE + 2 ) // 2. 7170
|
||||
#define ID_API_ISP_AF_HW_FILTER_ATTR ( ID_API_ISP_AF_BASE + 3 ) // 3. 7171
|
||||
#define ID_API_ISP_AF_HW_FILTERSQ ( ID_API_ISP_AF_BASE + 4 ) // 4. 7172
|
||||
#define ID_API_ISP_AF_ATTR ( ID_API_ISP_AF_BASE + 41 ) // 41. 7209
|
||||
#define ID_API_ISP_AF_MOTOR ( ID_API_ISP_AF_BASE + 42 ) // 42. 7210
|
||||
#define ID_API_ISP_AF_ACC_WEIGHT ( ID_API_ISP_AF_BASE + 43 ) // 43. 7211
|
||||
#define ID_API_ISP_AF_ONESHOT ( ID_API_ISP_AF_BASE + 44 ) // 44. 7212
|
||||
#define ID_API_ISP_AF_SCENE_CHANGE ( ID_API_ISP_AF_BASE + 45 ) // 45. 7213
|
||||
#define ID_API_ISP_AF_SEARCH_START ( ID_API_ISP_AF_BASE + 46 ) // 46. 7214
|
||||
#define ID_API_ISP_AF_SEARCH ( ID_API_ISP_AF_BASE + 47 ) // 47. 7215
|
||||
|
||||
//#define ID_API_VENC_RcParamEx ( ID_API_ISP_OTHER_BASE + 1 ) // 1. 8193 --> old ( ID_API_ISP_BASE + 35 ) //35. 4131
|
||||
//#define ID_API_VI_SensorFrameRate ( ID_API_ISP_OTHER_BASE + 2 ) // 2. 8194 --> old ( ID_API_ISP_BASE + 36 ) //36. 4132
|
||||
//#define ID_API_VENC_Resolution ( ID_API_ISP_OTHER_BASE + 3 ) // 3. 8195 --> old ( ID_API_ISP_BASE + 37 ) //37. 4133
|
||||
|
||||
//================================================================
|
||||
// ID Defined : Calibration 2.0 API
|
||||
//================================================================
|
||||
#define ID_API_CALIBRATION_20_CaliBVAV ( ID_API_CALIBRATION_20_BASE + 1) // 1. 9217 //SET_API_ID_CALIBRATION_CaliBVAV = 61,
|
||||
#define ID_API_CALIBRATION_20_Apply ( ID_API_CALIBRATION_20_BASE + 2) // 2. 9218 //SET_API_ID_CALIBRATION_ApplyBVAV = 62,
|
||||
#define ID_API_CALIBRATION_20_CaliData ( ID_API_CALIBRATION_20_BASE + 3) // 3. 9219 //SET_API_ID_CALIBRATION_SetCaliData = 63,
|
||||
#define ID_API_CALIBRATION_20_CaliPath ( ID_API_CALIBRATION_20_BASE + 4) // 4. 9220 //SET_API_ID_CALIBRATION_SetCaliPath = 64,
|
||||
#define ID_API_CALIBRATION_20_CaliDBPath ( ID_API_CALIBRATION_20_BASE + 5) // 5. 9221 //SET_API_ID_CALIBRATION_SetCaliDBPath
|
||||
#define ID_API_CALIBRATION_20_CaliInfo ( ID_API_CALIBRATION_20_BASE + 6) // 6. 9222 //GET_API_ID_CALIBRATION_GetCaliInfo
|
||||
|
||||
#define ID_API_CALIBRATION_20_CaliAWB ( ID_API_CALIBRATION_20_BASE + 7) // 7. 9223
|
||||
#define ID_API_CALIBRATION_20_CaliOB ( ID_API_CALIBRATION_20_BASE + 8) // 8. 9224
|
||||
#define ID_API_CALIBRATION_20_CaliMinGain ( ID_API_CALIBRATION_20_BASE + 9) // 9. 9225
|
||||
#define ID_API_CALIBRATION_20_CaliShutterLinearity ( ID_API_CALIBRATION_20_BASE + 10) // 10. 9226
|
||||
#define ID_API_CALIBRATION_20_CaliGainLinearity ( ID_API_CALIBRATION_20_BASE + 11) // 11 9227
|
||||
#define ID_API_CALIBRATION_20_CaliDPC ( ID_API_CALIBRATION_20_BASE + 12) // 12. 9228
|
||||
#define ID_API_CALIBRATION_20_CaliALSC ( ID_API_CALIBRATION_20_BASE + 13) // 13. 9229
|
||||
#define ID_API_CALIBRATION_20_CaliFPN ( ID_API_CALIBRATION_20_BASE + 14) // 14. 9230
|
||||
|
||||
#define ID_API_CALIBRATION_30_ApplyAWB ( ID_API_CALIBRATION_20_BASE + 15) // 15. 9231
|
||||
#define ID_API_CALIBRATION_30_ApplyOBC ( ID_API_CALIBRATION_20_BASE + 16) // 16. 9232
|
||||
#define ID_API_CALIBRATION_30_ApplyMinGain ( ID_API_CALIBRATION_20_BASE + 17) // 17. 9233
|
||||
#define ID_API_CALIBRATION_30_ApplyShutterLinearity ( ID_API_CALIBRATION_20_BASE + 18) // 18. 9234
|
||||
#define ID_API_CALIBRATION_30_ApplyGainLinearity ( ID_API_CALIBRATION_20_BASE + 19) // 19 9235
|
||||
#define ID_API_CALIBRATION_30_ApplySDC ( ID_API_CALIBRATION_20_BASE + 20) // 20. 9236
|
||||
#define ID_API_CALIBRATION_30_ApplyALSC ( ID_API_CALIBRATION_20_BASE + 21) // 21. 9237
|
||||
#define ID_API_CALIBRATION_30_ApplyFPN ( ID_API_CALIBRATION_20_BASE + 22) // 22. 9238
|
||||
#define ID_API_CALIBRATION_30_ApplyLSC ( ID_API_CALIBRATION_20_BASE + 23) // 21. 9239
|
||||
|
||||
//================================================================
|
||||
// ID Defined : MainTool API
|
||||
//================================================================
|
||||
#define ID_API_MAINTOOL_QUERY_SENSOR_INFO ( ID_API_MAINTOOL_BASE + 1 ) // 1. 10241
|
||||
#define ID_API_MAINTOOL_IQ_INDEX ( ID_API_MAINTOOL_BASE + 2 ) // 2. 10242
|
||||
#define ID_API_MAINTOOL_BYPASS ( ID_API_MAINTOOL_BASE + 3 ) // 3. 10243
|
||||
|
||||
//================================================================
|
||||
// ID Defined : Plugin API
|
||||
//================================================================
|
||||
#define ID_API_PLUGIN_I2C_ACCESS ( ID_API_PLUGIN_BASE + 1 ) // 1. 11265 //SET_API_ID_MI_ISP_WriteI2C
|
||||
#define ID_API_PLUGIN_WBCT ( ID_API_PLUGIN_BASE + 3 ) // 3. 11267 //SetWBCTCaliAttr
|
||||
#define ID_API_PLUGIN_AWBCTStats ( ID_API_PLUGIN_BASE + 4 ) // 4. 11268
|
||||
#define ID_API_PLUGIN_AWBHWStats ( ID_API_PLUGIN_BASE + 5 ) // 5. 11269
|
||||
#define ID_API_PLUGIN_CUR_WBCT ( ID_API_PLUGIN_BASE + 6 ) // 6. 11270 //GetCurCTCaliAttr
|
||||
|
||||
//================================================================
|
||||
// ID Defined : Cus3A API
|
||||
//================================================================
|
||||
#define ID_API_CUS_AE_HW_AVG_STATS ( ID_API_CUS3A_BASE + 1 ) // 1. 11777
|
||||
#define ID_API_CUS_AE_HW_HISTO_0_STATS ( ID_API_CUS3A_BASE + 2 ) // 2. 11778
|
||||
#define ID_API_CUS_AE_HW_HISTO_1_STATS ( ID_API_CUS3A_BASE + 3 ) // 3. 11779
|
||||
#define ID_API_CUS_AE_GET_INIT_STATUS ( ID_API_CUS3A_BASE + 4 ) // 4. 11780
|
||||
#define ID_API_CUS_AE_GET_CUR_STATUS ( ID_API_CUS3A_BASE + 5 ) // 5. 11781
|
||||
#define ID_API_CUS_AE_SET_PARAM ( ID_API_CUS3A_BASE + 6 ) // 6. 11782
|
||||
#define ID_API_CUS_AWB_HW_AVG_STATS ( ID_API_CUS3A_BASE + 7 ) // 7. 11783
|
||||
#define ID_API_CUS_3A_ENABLE ( ID_API_CUS3A_BASE + 8 ) // 8. 11784
|
||||
#define ID_API_CUS_AWB_GET_CUR_STATUS ( ID_API_CUS3A_BASE + 9 ) // 9. 11785
|
||||
#define ID_API_CUS_AWB_SET_PARAM ( ID_API_CUS3A_BASE + 10) //10. 11786
|
||||
#define ID_API_CUS_AE_WINDOW_BLOCK_NUMBER ( ID_API_CUS3A_BASE + 11 )//11. 11787
|
||||
#define ID_API_CUS_AWB_SAMPLING ( ID_API_CUS3A_BASE + 12 )//12. 11788
|
||||
#define ID_API_CUS_AF_STATS ( ID_API_CUS3A_BASE + 13 )//13. 11789
|
||||
#define ID_API_CUS_AF_WINDOW ( ID_API_CUS3A_BASE + 14 )//14. 11790
|
||||
#define ID_API_CUS_AF_FILTER ( ID_API_CUS3A_BASE + 15 )//15. 11791
|
||||
#define ID_API_CUS_AF_FILTER_SQUARE ( ID_API_CUS3A_BASE + 16 )//16. 11792
|
||||
#define ID_API_CUS_AF_MODE ( ID_API_CUS3A_BASE + 17 )//17. 11793
|
||||
#define ID_API_CUS_AE_HISTOGRAM_WINDOW ( ID_API_CUS3A_BASE + 18 )//18. 11794
|
||||
#define ID_API_CUS_GET_IMAGE_RESOLUTION ( ID_API_CUS3A_BASE + 19 )//19. 11795
|
||||
#define ID_API_CUS_ENABLE_ISP_OUT_IMAGE ( ID_API_CUS3A_BASE + 20 )//20. 11796
|
||||
#define ID_API_CUS_GET_ISP_OUT_IMAGE_COUNT ( ID_API_CUS3A_BASE + 21 )//21. 11797
|
||||
#define ID_API_CUS_CAPTURE_HDR_RAW_IMAGE ( ID_API_CUS3A_BASE + 22 )//22. 11798
|
||||
#define ID_API_CUS_FRAME_META_INFO ( ID_API_CUS3A_BASE + 23 )//23. 11799
|
||||
#define ID_API_CUS_I2C_ACCESS ( ID_API_CUS3A_BASE + 24 )//24. 11800
|
||||
#define ID_API_CUS_AWB_HW_AVG_STATS_SHORT ( ID_API_CUS3A_BASE + 25 ) // 25. 11801
|
||||
#define ID_API_CUS_CAPTURE_RAW_IMAGE ( ID_API_CUS3A_BASE + 26 )//26. 11802
|
||||
#define ID_API_CUS_CUSTOMER_AE_CTRL ( ID_API_CUS3A_BASE + 27 )//27. 11803 , Customer defined AE control only
|
||||
#define ID_API_CUS_CUSTOMER_AWB_CTRL ( ID_API_CUS3A_BASE + 28 )//28. 11804 , Customer defined AWB control only
|
||||
#define ID_API_CUS_CUSTOMER_AF_CTRL ( ID_API_CUS3A_BASE + 29 )//29. 11805 , Customer defined AF control only
|
||||
#define ID_API_CUS_AE_HW_RGBIR_HISTO_STATS ( ID_API_CUS3A_BASE + 30 ) // 30. 11806
|
||||
#ifdef ENABLE_EARLY_AE_DONE
|
||||
#define ID_API_CUS_AE_DONE_RATIO ( ID_API_CUS3A_BASE + 31 )//31. 11807
|
||||
#endif
|
||||
#define ID_API_CUS_AF_GET_CUR_STATUS ( ID_API_CUS3A_BASE + 32 )//32. 11808 , Customer defined AF control only
|
||||
#define ID_API_CUS_AF_SET_PARAM ( ID_API_CUS3A_BASE + 33 )//33. 11809 , Customer defined AF control only
|
||||
#define ID_API_CUS_AE_CROP_SIZE ( ID_API_CUS3A_BASE + 34 )//34. 11810
|
||||
#define ID_API_CUS_AWB_CROP_SIZE ( ID_API_CUS3A_BASE + 35 )//35. 11811
|
||||
//#define ID_API_CUS_AF_YPARAM ( ID_API_CUS3A_BASE + 36 )//36. 11812
|
||||
//#define ID_API_CUS_AF_SOURCE ( ID_API_CUS3A_BASE + 37 )//37. 11813
|
||||
//#define ID_API_CUS_AF_PRE_FILTER ( ID_API_CUS3A_BASE + 38 )//38. 11814
|
||||
//#define ID_API_CUS_AF_YMAP ( ID_API_CUS3A_BASE + 39 )//39. 11815
|
||||
//#define ID_API_CUS_AF_LDG ( ID_API_CUS3A_BASE + 40 )//40. 11816
|
||||
|
||||
//================================================================
|
||||
// ID Defined : Debug Level API
|
||||
//================================================================
|
||||
#define ID_API_ISP_DeBugLevel_AE ( ID_API_DEBUG_LEVEL_BASE + 1 ) // 1. 12288
|
||||
#define ID_API_ISP_DeBugLevel_AWB ( ID_API_DEBUG_LEVEL_BASE + 2 ) // 2. 12289
|
||||
#define ID_API_ISP_DeBugLevel_AWB_PERIOD ( ID_API_DEBUG_LEVEL_BASE + 3 ) // 3. 12290
|
||||
#define ID_API_ISP_DeBugLevel_AF ( ID_API_DEBUG_LEVEL_BASE + 4 ) // 4. 12291
|
||||
|
||||
|
||||
//================================================================
|
||||
// ID Defined : ENCODE API
|
||||
//================================================================
|
||||
#define ID_API_VIDEO_CHANNEL_ID ( ID_API_VIDEO_ENCODE_BASE + 1 ) // 1. 12546
|
||||
#define ID_API_VIDEO_RATE_CONTROL_ATTR ( ID_API_VIDEO_ENCODE_BASE + 2 ) // 2. 12547
|
||||
#define ID_API_VIDEO_RATE_CONTROL_PARAM ( ID_API_VIDEO_ENCODE_BASE + 3 ) // 2. 12548
|
||||
|
||||
#define ID_API_REGISTER_API_SET_CB ( ID_API_RESERVED_BASE + 1) //1. register API_SET callback
|
||||
#define ID_API_REGISTER_API_GET_CB ( ID_API_RESERVED_BASE + 2) //2. register API_GET callback
|
||||
|
||||
#ifdef __cplusplus
|
||||
} //end of extern C
|
||||
#endif
|
||||
|
||||
#endif //_TUNINGSERVER_API_ID_H_
|
|
@ -0,0 +1,188 @@
|
|||
/* SigmaStar trade secret */
|
||||
/* Copyright (c) [2019~2020] SigmaStar Technology.
|
||||
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 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* mi_isp.h
|
||||
*
|
||||
* Created on: June 27, 2018
|
||||
* Author: Jeffrey Chou
|
||||
*/
|
||||
|
||||
#ifndef _MI_ISP_GENERAL_H_
|
||||
#define _MI_ISP_GENERAL_H_
|
||||
|
||||
#include "mi_syscall.h"
|
||||
#include "mi_vpe_datatype.h"
|
||||
#include "mi_common.h"
|
||||
#include "mi_isp.h"
|
||||
#include "mi_isp_datatype.h"
|
||||
|
||||
#ifdef CAM_OS_LINUX_USER
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#ifdef LINUX_FLOW_ON_DUAL_OS
|
||||
#define DUAL_OS_RUN_ON_LINUX 1
|
||||
#define DUAL_OS_RUN_ON_RTOS 0
|
||||
#else
|
||||
#ifdef __RTOS__
|
||||
#define DUAL_OS_RUN_ON_LINUX 0
|
||||
#define DUAL_OS_RUN_ON_RTOS 1
|
||||
#else
|
||||
#define DUAL_OS_RUN_ON_LINUX 0
|
||||
#define DUAL_OS_RUN_ON_RTOS 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define MI_ISP_MSG(args...) printf(args)
|
||||
#define MI_ISP_DMSG(args...) do{}while(0)
|
||||
#define MI_ISP_EMSG(args...) printf(args)
|
||||
#define MI_ISP_VMSG(args...) do{}while(0)
|
||||
|
||||
#define MI_ISP_CALLOC calloc
|
||||
#define MI_ISP_FREE free
|
||||
|
||||
extern MI_S32 MI_VPE_GetIspApiData(MI_VPE_IspApiHeader_t *pstIspDataHeader, void *pVirData);
|
||||
extern MI_S32 MI_VPE_SetIspApiData(MI_VPE_IspApiHeader_t *pstIspDataHeader, void *pVirData);
|
||||
|
||||
MI_S32 _MI_ISP_SetIspApiData(MI_VPE_IspApiHeader_t *pstIspDataHeader, void *pVirData);
|
||||
MI_S32 _MI_ISP_GetIspApiData(MI_VPE_IspApiHeader_t *pstIspDataHeader, void *pVirData);
|
||||
|
||||
#if (DUAL_OS_RUN_ON_LINUX)
|
||||
#define MI_GETAPI(Channel, APIFuncID, PARAM_t, PtrData)\
|
||||
MI_S32 s32Ret = MI_ISP_OK;\
|
||||
MI_VPE_IspApiHeader_t stIspApiHeader;\
|
||||
PARAM_t *pIspBuffer = NULL;\
|
||||
MI_VPE_Alloc_IspDataBuf(sizeof(PARAM_t), &pIspBuffer);\
|
||||
memcpy(pIspBuffer, PtrData, sizeof(PARAM_t));\
|
||||
stIspApiHeader.u32HeadSize = sizeof(MI_VPE_IspApiHeader_t);\
|
||||
stIspApiHeader.u32DataLen = sizeof(PARAM_t);\
|
||||
stIspApiHeader.u32CtrlID = APIFuncID;\
|
||||
stIspApiHeader.u32Channel = Channel;\
|
||||
stIspApiHeader.s32Ret = 0;\
|
||||
MI_SYS_FlushInvCache((void *)pIspBuffer, sizeof(PARAM_t));\
|
||||
s32Ret = stIspApiHeader.s32Ret = MI_VPE_GetIspApiData(&stIspApiHeader, pIspBuffer);\
|
||||
memcpy(PtrData, pIspBuffer, sizeof(PARAM_t));\
|
||||
MI_VPE_Free_IspDataBuf(pIspBuffer);\
|
||||
return s32Ret;\
|
||||
|
||||
#define MI_SETAPI(Channel, APIFuncID, PARAM_t, PtrData)\
|
||||
MI_S32 s32Ret = MI_ISP_OK;\
|
||||
MI_VPE_IspApiHeader_t stIspApiHeader;\
|
||||
PARAM_t *pIspBuffer = NULL;\
|
||||
MI_VPE_Alloc_IspDataBuf(sizeof(PARAM_t), &pIspBuffer);\
|
||||
stIspApiHeader.u32HeadSize = sizeof(MI_VPE_IspApiHeader_t);\
|
||||
stIspApiHeader.u32DataLen = sizeof(PARAM_t);\
|
||||
stIspApiHeader.u32CtrlID = APIFuncID;\
|
||||
stIspApiHeader.u32Channel = Channel;\
|
||||
stIspApiHeader.s32Ret = 0;\
|
||||
memcpy(pIspBuffer, PtrData, sizeof(PARAM_t));\
|
||||
MI_SYS_FlushInvCache((void *)pIspBuffer, sizeof(PARAM_t));\
|
||||
s32Ret = stIspApiHeader.s32Ret = MI_VPE_SetIspApiData(&stIspApiHeader, pIspBuffer);\
|
||||
MI_VPE_Free_IspDataBuf(pIspBuffer);\
|
||||
return s32Ret;\
|
||||
|
||||
#define MI_CALI_SETAPI(Channel, APIFuncID, PARAM_t, DataSize, PtrData)\
|
||||
MI_VPE_IspApiHeader_t stIspApiHeader;\
|
||||
char *pIspBuffer = NULL;\
|
||||
MI_VPE_Alloc_IspDataBuf(DataSize, &pIspBuffer);\
|
||||
stIspApiHeader.u32HeadSize = sizeof(MI_VPE_IspApiHeader_t);\
|
||||
stIspApiHeader.u32DataLen = DataSize;\
|
||||
stIspApiHeader.u32CtrlID = APIFuncID;\
|
||||
stIspApiHeader.u32Channel = Channel;\
|
||||
stIspApiHeader.s32Ret = 0;\
|
||||
memcpy(pIspBuffer, PtrData, DataSize);\
|
||||
MI_SYS_FlushInvCache((void *)pIspBuffer, DataSize);\
|
||||
stIspApiHeader.s32Ret = MI_VPE_SetIspApiData(&stIspApiHeader, pIspBuffer);\
|
||||
MI_VPE_Free_IspDataBuf(pIspBuffer);\
|
||||
|
||||
#else
|
||||
#define MI_GETAPI(Channel, APIFuncID, PARAM_t, PtrData)\
|
||||
MI_S32 s32Ret = MI_ISP_OK;\
|
||||
MI_VPE_IspApiHeader_t stIspApiHeader;\
|
||||
stIspApiHeader.u32HeadSize = sizeof(MI_VPE_IspApiHeader_t);\
|
||||
stIspApiHeader.u32DataLen = sizeof(PARAM_t);\
|
||||
stIspApiHeader.u32CtrlID = APIFuncID;\
|
||||
stIspApiHeader.u32Channel = Channel;\
|
||||
stIspApiHeader.s32Ret = 0;\
|
||||
/*s32Ret = stIspApiHeader.s32Ret = MI_VPE_GetIspApiData(&stIspApiHeader, PtrData);*/\
|
||||
s32Ret = stIspApiHeader.s32Ret = _MI_ISP_GetIspApiData(&stIspApiHeader, PtrData);\
|
||||
MI_ISP_DMSG("[%s] - (Channel,CtrlID, DataLenght, HeadSize) = (%d,%d,%d,%d)\n", __FUNCTION__, stIspApiHeader.u32Channel, stIspApiHeader.u32CtrlID, stIspApiHeader.u32DataLen, stIspApiHeader.u32HeadSize);\
|
||||
return s32Ret;\
|
||||
|
||||
#define MI_SETAPI(Channel, APIFuncID, PARAM_t, PtrData)\
|
||||
MI_S32 s32Ret = MI_ISP_OK;\
|
||||
MI_VPE_IspApiHeader_t stIspApiHeader;\
|
||||
stIspApiHeader.u32HeadSize = sizeof(MI_VPE_IspApiHeader_t);\
|
||||
stIspApiHeader.u32DataLen = sizeof(PARAM_t);\
|
||||
stIspApiHeader.u32CtrlID = APIFuncID;\
|
||||
stIspApiHeader.u32Channel = Channel;\
|
||||
stIspApiHeader.s32Ret = 0;\
|
||||
/*s32Ret = stIspApiHeader.s32Ret = MI_VPE_SetIspApiData(&stIspApiHeader, PtrData);*/\
|
||||
s32Ret = stIspApiHeader.s32Ret = _MI_ISP_SetIspApiData(&stIspApiHeader, PtrData);\
|
||||
MI_ISP_DMSG("[%s] - (Channel,CtrlID, DataLenght, HeadSize) = (%d,%d,%d,%d)\n", __FUNCTION__, stIspApiHeader.u32Channel, stIspApiHeader.u32CtrlID, stIspApiHeader.u32DataLen, stIspApiHeader.u32HeadSize);\
|
||||
return s32Ret;\
|
||||
|
||||
#define MI_CALI_SETAPI(Channel, APIFuncID, PARAM_t, DataSize, PtrData)\
|
||||
MI_VPE_IspApiHeader_t stIspApiHeader;\
|
||||
stIspApiHeader.u32HeadSize = sizeof(MI_VPE_IspApiHeader_t);\
|
||||
stIspApiHeader.u32DataLen = DataSize;\
|
||||
stIspApiHeader.u32CtrlID = APIFuncID;\
|
||||
stIspApiHeader.u32Channel = Channel;\
|
||||
stIspApiHeader.s32Ret = 0;\
|
||||
s32Ret = stIspApiHeader.s32Ret = MI_VPE_SetIspApiData(&stIspApiHeader, PtrData);\
|
||||
MI_ISP_DMSG("[%s] - (Channel,CtrlID, DataLenght, HeadSize) = (%d,%d,%d,%d)\n", __FUNCTION__, stIspApiHeader->u32Channel, stIspApiHeader->u32CtrlID, stIspApiHeader->u32DataLen, stIspApiHeader->u32HeadSize);\
|
||||
|
||||
#endif
|
||||
|
||||
#define MI_ISP_SET(APIFunc, PARAM_t) \
|
||||
if(ApiLen != sizeof(PARAM_t)) \
|
||||
{ \
|
||||
MI_ISP_MSG("[%s][%s] APIID:%d error param \n", __FILE__, __func__, ApiId); \
|
||||
break; \
|
||||
} \
|
||||
ret = APIFunc(Channel, (PARAM_t*)pApiBuf); \
|
||||
|
||||
#define MI_ISP_GET(APIFunc, PARAM_t) \
|
||||
*ApiLen = sizeof(PARAM_t); \
|
||||
ret = APIFunc(Channel, (PARAM_t*)pApiBuf); \
|
||||
|
||||
#define MI_CALL_SETAPI(Channel, APIFunc, PARAM_t)\
|
||||
MI_S32 s32Ret = MI_ISP_OK;\
|
||||
PARAM_t *stParam = MI_ISP_CALLOC(1, sizeof(PARAM_t));\
|
||||
memcpy(stParam, param_ary[0], sizeof(PARAM_t));\
|
||||
s32Ret = APIFunc(Channel, stParam);\
|
||||
MI_ISP_DMSG("[%s][%s] param_num = %d\n", __FILE__, __FUNCTION__, param_num);\
|
||||
MI_ISP_FREE(stParam);\
|
||||
return s32Ret;\
|
||||
|
||||
#define MI_RESET_API(Channel, APIFunc, PARAM_t)\
|
||||
PARAM_t *stParam = MI_ISP_CALLOC(1, sizeof(PARAM_t));\
|
||||
memset(stParam, 0x00, sizeof(PARAM_t));\
|
||||
s32Ret = APIFunc(Channel, stParam);\
|
||||
MI_ISP_DMSG("[%s][%s] param_num = %d\n", __FILE__, __FUNCTION__, param_num);\
|
||||
MI_ISP_FREE(stParam);\
|
||||
|
||||
#ifdef __cplusplus
|
||||
} //end of extern C
|
||||
#endif
|
||||
|
||||
#endif //_MI_ISP_GENERAL_H_
|
|
@ -0,0 +1,298 @@
|
|||
/* SigmaStar trade secret */
|
||||
/* Copyright (c) [2019~2020] SigmaStar Technology.
|
||||
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 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* mi_isp.h
|
||||
*
|
||||
* Created on: June 27, 2018
|
||||
* Author: Jeffrey Chou
|
||||
*/
|
||||
|
||||
#ifndef _MI_ISP_IQ_H_
|
||||
#define _MI_ISP_IQ_H_
|
||||
|
||||
#include "mi_isp_3a_datatype.h"
|
||||
#include "mi_isp_iq_datatype.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#if 1
|
||||
/************************************* IQ API START *************************************/
|
||||
MI_S32 MI_ISP_IQ_GetVersionInfo(MI_U32 Channel, MI_ISP_IQ_VERSION_INFO_TYPE_t *data);
|
||||
MI_S32 MI_ISP_IQ_SetVersionInfo(MI_U32 Channel, MI_ISP_IQ_VERSION_INFO_TYPE_t *data);
|
||||
MI_S32 MI_ISP_IQ_GetParaInitStatus(MI_U32 Channel, MI_ISP_IQ_PARAM_INIT_INFO_TYPE_t *data);
|
||||
MI_S32 MI_ISP_IQ_SetColorToGray(MI_U32 Channel, MI_ISP_IQ_COLORTOGRAY_TYPE_t *data);
|
||||
MI_S32 MI_ISP_IQ_GetColorToGray(MI_U32 Channel, MI_ISP_IQ_COLORTOGRAY_TYPE_t *data);
|
||||
MI_S32 MI_ISP_IQ_SetContrast(MI_U32 Channel, MI_ISP_IQ_CONTRAST_TYPE_t *data);
|
||||
MI_S32 MI_ISP_IQ_GetContrast(MI_U32 Channel, MI_ISP_IQ_CONTRAST_TYPE_t *data);
|
||||
MI_S32 MI_ISP_IQ_SetBrightness(MI_U32 Channel, MI_ISP_IQ_BRIGHTNESS_TYPE_t *data);
|
||||
MI_S32 MI_ISP_IQ_GetBrightness(MI_U32 Channel, MI_ISP_IQ_BRIGHTNESS_TYPE_t *data);
|
||||
MI_S32 MI_ISP_IQ_SetLightness(MI_U32 Channel, MI_ISP_IQ_LIGHTNESS_TYPE_t *data);
|
||||
MI_S32 MI_ISP_IQ_GetLightness(MI_U32 Channel, MI_ISP_IQ_LIGHTNESS_TYPE_t *data);
|
||||
MI_S32 MI_ISP_IQ_SetRGBGamma(MI_U32 Channel, MI_ISP_IQ_RGBGAMMA_TYPE_t *data);
|
||||
MI_S32 MI_ISP_IQ_GetRGBGamma(MI_U32 Channel, MI_ISP_IQ_RGBGAMMA_TYPE_t *data);
|
||||
MI_S32 MI_ISP_IQ_SetYUVGamma(MI_U32 Channel, MI_ISP_IQ_YUVGAMMA_TYPE_t *data);
|
||||
MI_S32 MI_ISP_IQ_GetYUVGamma(MI_U32 Channel, MI_ISP_IQ_YUVGAMMA_TYPE_t *data);
|
||||
MI_S32 MI_ISP_IQ_SetSaturation(MI_U32 Channel, MI_ISP_IQ_SATURATION_TYPE_t *data);
|
||||
MI_S32 MI_ISP_IQ_GetSaturation(MI_U32 Channel, MI_ISP_IQ_SATURATION_TYPE_t *data);
|
||||
MI_S32 MI_ISP_IQ_SetDefog(MI_U32 Channel, MI_ISP_IQ_DEFOG_TYPE_t *data);
|
||||
MI_S32 MI_ISP_IQ_GetDefog(MI_U32 Channel, MI_ISP_IQ_DEFOG_TYPE_t *data);
|
||||
MI_S32 MI_ISP_IQ_SetRGBMatrix(MI_U32 Channel, MI_ISP_IQ_RGBMATRIX_TYPE_t *data);
|
||||
MI_S32 MI_ISP_IQ_GetRGBMatrix(MI_U32 Channel, MI_ISP_IQ_RGBMATRIX_TYPE_t *data);
|
||||
MI_S32 MI_ISP_IQ_SetFalseColor(MI_U32 Channel, MI_ISP_IQ_FALSECOLOR_TYPE_t *data);
|
||||
MI_S32 MI_ISP_IQ_GetFalseColor(MI_U32 Channel, MI_ISP_IQ_FALSECOLOR_TYPE_t *data);
|
||||
MI_S32 MI_ISP_IQ_SetNR3D(MI_U32 Channel, MI_ISP_IQ_NR3D_TYPE_t *data);
|
||||
MI_S32 MI_ISP_IQ_GetNR3D(MI_U32 Channel, MI_ISP_IQ_NR3D_TYPE_t *data);
|
||||
MI_S32 MI_ISP_IQ_SetNR3D_P1(MI_U32 Channel, MI_ISP_IQ_NR3D_P1_TYPE_t *data); //[not support chip] macaron, pudding, ispahan, tiramisu, ikayaki
|
||||
MI_S32 MI_ISP_IQ_GetNR3D_P1(MI_U32 Channel, MI_ISP_IQ_NR3D_P1_TYPE_t *data); //[not support chip] macaron, pudding, ispahan, tiramisu, ikayaki
|
||||
MI_S32 MI_ISP_IQ_SetNRDeSpike(MI_U32 Channel, MI_ISP_IQ_NRDESPIKE_TYPE_t *data);
|
||||
MI_S32 MI_ISP_IQ_GetNRDeSpike(MI_U32 Channel, MI_ISP_IQ_NRDESPIKE_TYPE_t *data);
|
||||
MI_S32 MI_ISP_IQ_SetNRLuma(MI_U32 Channel, MI_ISP_IQ_NRLUMA_TYPE_t *data);
|
||||
MI_S32 MI_ISP_IQ_GetNRLuma(MI_U32 Channel, MI_ISP_IQ_NRLUMA_TYPE_t *data);
|
||||
MI_S32 MI_ISP_IQ_SetNRChroma(MI_U32 Channel, MI_ISP_IQ_NRChroma_TYPE_t *data);
|
||||
MI_S32 MI_ISP_IQ_GetNRChroma(MI_U32 Channel, MI_ISP_IQ_NRChroma_TYPE_t *data);
|
||||
MI_S32 MI_ISP_IQ_SetSharpness(MI_U32 Channel, MI_ISP_IQ_SHARPNESS_TYPE_t *data);
|
||||
MI_S32 MI_ISP_IQ_GetSharpness(MI_U32 Channel, MI_ISP_IQ_SHARPNESS_TYPE_t *data);
|
||||
MI_S32 MI_ISP_IQ_SetCrossTalk(MI_U32 Channel, MI_ISP_IQ_CROSSTALK_TYPE_t *data);
|
||||
MI_S32 MI_ISP_IQ_GetCrossTalk(MI_U32 Channel, MI_ISP_IQ_CROSSTALK_TYPE_t *data);
|
||||
MI_S32 MI_ISP_IQ_SetOBC(MI_U32 Channel, MI_ISP_IQ_OBC_TYPE_t *data);
|
||||
MI_S32 MI_ISP_IQ_GetOBC(MI_U32 Channel, MI_ISP_IQ_OBC_TYPE_t *data);
|
||||
MI_S32 MI_ISP_IQ_SetOBC_P1(MI_U32 Channel, MI_ISP_IQ_OBC_TYPE_t *data); //[not support chip] ikayaki
|
||||
MI_S32 MI_ISP_IQ_GetOBC_P1(MI_U32 Channel, MI_ISP_IQ_OBC_TYPE_t *data); //[not support chip] ikayaki
|
||||
MI_S32 MI_ISP_IQ_SetWDR(MI_U32 Channel, MI_ISP_IQ_WDR_TYPE_t *data);
|
||||
MI_S32 MI_ISP_IQ_GetWDR(MI_U32 Channel, MI_ISP_IQ_WDR_TYPE_t *data);
|
||||
MI_S32 MI_ISP_IQ_SetWDRCurveAdv(MI_U32 Channel, MI_ISP_IQ_WDRCurveAdv_TYPE_t *data);
|
||||
MI_S32 MI_ISP_IQ_GetWDRCurveAdv(MI_U32 Channel, MI_ISP_IQ_WDRCurveAdv_TYPE_t *data);
|
||||
MI_S32 MI_ISP_IQ_SetWDRCurveFull(MI_U32 Channel, MI_ISP_IQ_WDRCurveFull_TYPE_t *data); //[not support chip] tiramisu
|
||||
MI_S32 MI_ISP_IQ_GetWDRCurveFull(MI_U32 Channel, MI_ISP_IQ_WDRCurveFull_TYPE_t *data); //[not support chip] tiramisu
|
||||
MI_S32 MI_ISP_IQ_SetDynamicDP(MI_U32 Channel, MI_ISP_IQ_DYNAMIC_DP_TYPE_t *data);
|
||||
MI_S32 MI_ISP_IQ_GetDynamicDP(MI_U32 Channel, MI_ISP_IQ_DYNAMIC_DP_TYPE_t *data);
|
||||
MI_S32 MI_ISP_IQ_SetDynamicDP_CLUSTER(MI_U32 Channel, MI_ISP_IQ_DYNAMIC_DP_CLUSTER_TYPE_t *data);
|
||||
MI_S32 MI_ISP_IQ_GetDynamicDP_CLUSTER(MI_U32 Channel, MI_ISP_IQ_DYNAMIC_DP_CLUSTER_TYPE_t *data);
|
||||
MI_S32 MI_ISP_IQ_SetHSV(MI_U32 Channel, MI_ISP_IQ_HSV_TYPE_t *data);
|
||||
MI_S32 MI_ISP_IQ_GetHSV(MI_U32 Channel, MI_ISP_IQ_HSV_TYPE_t *data);
|
||||
MI_S32 MI_ISP_IQ_SetRGBIR(MI_U32 Channel, MI_ISP_IQ_RGBIR_TYPE_t *data);
|
||||
MI_S32 MI_ISP_IQ_GetRGBIR(MI_U32 Channel, MI_ISP_IQ_RGBIR_TYPE_t *data);
|
||||
MI_S32 MI_ISP_IQ_SetFPN(MI_U32 Channel, MI_ISP_IQ_FPN_TYPE_t *data); //[not support chip] macaron, pudding, ispahan, tiramisu, ikayaki
|
||||
MI_S32 MI_ISP_IQ_GetFPN(MI_U32 Channel, MI_ISP_IQ_FPN_TYPE_t *data); //[not support chip] macaron, pudding, ispahan, tiramisu, ikayaki
|
||||
MI_S32 MI_ISP_IQ_SetPFC(MI_U32 Channel, MI_ISP_IQ_PFC_TYPE_t *data); //[not support chip] macaron
|
||||
MI_S32 MI_ISP_IQ_GetPFC(MI_U32 Channel, MI_ISP_IQ_PFC_TYPE_t *data); //[not support chip] macaron
|
||||
MI_S32 MI_ISP_IQ_SetDEMOSAIC(MI_U32 Channel, MI_ISP_IQ_DEMOSAIC_TYPE_t *data);
|
||||
MI_S32 MI_ISP_IQ_GetDEMOSAIC(MI_U32 Channel, MI_ISP_IQ_DEMOSAIC_TYPE_t *data);
|
||||
MI_S32 MI_ISP_IQ_SetR2Y(MI_U32 Channel, MI_ISP_IQ_R2Y_TYPE_t *data);
|
||||
MI_S32 MI_ISP_IQ_GetR2Y(MI_U32 Channel, MI_ISP_IQ_R2Y_TYPE_t *data);
|
||||
MI_S32 MI_ISP_IQ_SetCOLORTRANS(MI_U32 Channel, MI_ISP_IQ_COLORTRANS_TYPE_t *data);
|
||||
MI_S32 MI_ISP_IQ_GetCOLORTRANS(MI_U32 Channel, MI_ISP_IQ_COLORTRANS_TYPE_t *data);
|
||||
MI_S32 MI_ISP_IQ_SetHDR(MI_U32 Channel, MI_ISP_IQ_HDR_TYPE_t *data); //[not support chip] ikayaki
|
||||
MI_S32 MI_ISP_IQ_GetHDR(MI_U32 Channel, MI_ISP_IQ_HDR_TYPE_t *data); //[not support chip] ikayaki
|
||||
MI_S32 MI_ISP_IQ_SetLSC(MI_U32 Channel, MI_ISP_IQ_LSC_TYPE_t *data);
|
||||
MI_S32 MI_ISP_IQ_GetLSC(MI_U32 Channel, MI_ISP_IQ_LSC_TYPE_t *data);
|
||||
MI_S32 MI_ISP_IQ_SetLSC_CTRL(MI_U32 Channel, MI_ISP_IQ_LSC_CTRL_TYPE_t *data);
|
||||
MI_S32 MI_ISP_IQ_GetLSC_CTRL(MI_U32 Channel, MI_ISP_IQ_LSC_CTRL_TYPE_t *data);
|
||||
MI_S32 MI_ISP_IQ_SetALSC(MI_U32 Channel, MI_ISP_IQ_ALSC_TYPE_t *data);
|
||||
MI_S32 MI_ISP_IQ_GetALSC(MI_U32 Channel, MI_ISP_IQ_ALSC_TYPE_t *data);
|
||||
MI_S32 MI_ISP_IQ_SetALSC_CTRL(MI_U32 Channel, MI_ISP_IQ_ALSC_CTRL_TYPE_t *data);
|
||||
MI_S32 MI_ISP_IQ_GetALSC_CTRL(MI_U32 Channel, MI_ISP_IQ_ALSC_CTRL_TYPE_t *data);
|
||||
MI_S32 MI_ISP_IQ_SetNRLuma_Adv(MI_U32 Channel, MI_ISP_IQ_NRLuma_Adv_TYPE_t *data); //[not support chip] macaron
|
||||
MI_S32 MI_ISP_IQ_GetNRLuma_Adv(MI_U32 Channel, MI_ISP_IQ_NRLuma_Adv_TYPE_t *data); //[not support chip] macaron
|
||||
MI_S32 MI_ISP_IQ_SetNRChroma_Adv(MI_U32 Channel, MI_ISP_IQ_NRChroma_Adv_TYPE_t *data); //[not support chip] macaron
|
||||
MI_S32 MI_ISP_IQ_GetNRChroma_Adv(MI_U32 Channel, MI_ISP_IQ_NRChroma_Adv_TYPE_t *data); //[not support chip] macaron
|
||||
MI_S32 MI_ISP_IQ_SetNRChroma_Pre(MI_U32 Channel, MI_ISP_IQ_NRChroma_Pre_TYPE_t *data); //[not support chip] macaron, pudding, ispahan, ikayaki
|
||||
MI_S32 MI_ISP_IQ_GetNRChroma_Pre(MI_U32 Channel, MI_ISP_IQ_NRChroma_Pre_TYPE_t *data); //[not support chip] macaron, pudding, ispahan, ikayaki
|
||||
MI_S32 MI_ISP_IQ_SetPFC_EX(MI_U32 Channel, MI_ISP_IQ_PFC_EX_TYPE_t *data); //[not support chip] macaron
|
||||
MI_S32 MI_ISP_IQ_GetPFC_EX(MI_U32 Channel, MI_ISP_IQ_PFC_EX_TYPE_t *data); //[not support chip] macaron
|
||||
MI_S32 MI_ISP_IQ_SetHDR_EX(MI_U32 Channel, MI_ISP_IQ_HDR_EX_TYPE_t *data); //[not support chip] macaron
|
||||
MI_S32 MI_ISP_IQ_GetHDR_EX(MI_U32 Channel, MI_ISP_IQ_HDR_EX_TYPE_t *data); //[not support chip] macaron
|
||||
MI_S32 MI_ISP_IQ_SetSHP_EX(MI_U32 Channel, MI_ISP_IQ_SHARPNESS_EX_TYPE_t *data); //[not support chip] macaron
|
||||
MI_S32 MI_ISP_IQ_GetSHP_EX(MI_U32 Channel, MI_ISP_IQ_SHARPNESS_EX_TYPE_t *data); //[not support chip] macaron
|
||||
MI_S32 MI_ISP_IQ_SetNR3D_EX(MI_U32 Channel, MI_ISP_IQ_NR3D_EX_TYPE_t *data); //[not support chip] macaron
|
||||
MI_S32 MI_ISP_IQ_GetNR3D_EX(MI_U32 Channel, MI_ISP_IQ_NR3D_EX_TYPE_t *data); //[not support chip] macaron
|
||||
MI_S32 MI_ISP_IQ_SetDUMMY(MI_U32 Channel, MI_ISP_IQ_DUMMY_TYPE_t *data);
|
||||
MI_S32 MI_ISP_IQ_GetDUMMY(MI_U32 Channel, MI_ISP_IQ_DUMMY_TYPE_t *data);
|
||||
MI_S32 MI_ISP_IQ_SetDUMMY_EX(MI_U32 Channel, MI_ISP_IQ_DUMMY_EX_TYPE_t *data);
|
||||
MI_S32 MI_ISP_IQ_GetDUMMY_EX(MI_U32 Channel, MI_ISP_IQ_DUMMY_EX_TYPE_t *data);
|
||||
MI_S32 MI_ISP_IQ_SetIQMode(MI_U32 Channel, MI_ISP_IQ_PARAM_MODE_e *data);
|
||||
MI_S32 MI_ISP_IQ_GetIQMode(MI_U32 Channel, MI_ISP_IQ_PARAM_MODE_e *data);
|
||||
MI_S32 MI_ISP_IQ_GetIQind(MI_U32 Channel, MI_ISP_IQ_INDEX_e *data);
|
||||
MI_S32 MI_ISP_IQ_SetAPIBypassMode(MI_U32 Channel, MI_ISP_API_BYPASS_TYPE_t *data);
|
||||
MI_S32 MI_ISP_IQ_GetAPIBypassMode(MI_U32 Channel, MI_ISP_API_BYPASS_TYPE_t *data);
|
||||
MI_S32 MI_ISP_IQ_QueryCCMInfo(MI_U32 Channel, MI_ISP_IQ_CCM_INFO_TYPE_t *data);
|
||||
MI_S32 MI_ISP_IQ_SetAdaptiveGamma(MI_U32 Channel, MI_ISP_IQ_ADAPTIVE_GAMMA_TYPE_t *data);
|
||||
MI_S32 MI_ISP_IQ_GetAdaptiveGamma(MI_U32 Channel, MI_ISP_IQ_ADAPTIVE_GAMMA_TYPE_t *data);
|
||||
MI_S32 MI_ISP_IQ_SetTEMP(MI_U32 Channel, MI_ISP_IQ_TEMP_TYPE_t *data);
|
||||
MI_S32 MI_ISP_IQ_GetTEMP(MI_U32 Channel, MI_ISP_IQ_TEMP_TYPE_t *data);
|
||||
MI_S32 MI_ISP_IQ_GetTEMP_INFO(MI_U32 Channel, MI_ISP_IQ_TEMP_INFO_TYPE_t *data);
|
||||
/************************************* IQ API END *************************************/
|
||||
|
||||
/************************************* AE API START *************************************/
|
||||
MI_S32 MI_ISP_AE_GetHistoWghtY(MI_U32 Channel, MI_ISP_AE_HIST_WEIGHT_Y_TYPE_t *data);
|
||||
MI_S32 MI_ISP_AE_QueryExposureInfo(MI_U32 Channel, MI_ISP_AE_EXPO_INFO_TYPE_t *data);
|
||||
MI_S32 MI_ISP_AE_SetEVComp(MI_U32 Channel, MI_ISP_AE_EV_COMP_TYPE_t *data);
|
||||
MI_S32 MI_ISP_AE_GetEVComp(MI_U32 Channel, MI_ISP_AE_EV_COMP_TYPE_t *data);
|
||||
MI_S32 MI_ISP_AE_SetExpoMode(MI_U32 Channel, MI_ISP_AE_MODE_TYPE_e *data);
|
||||
MI_S32 MI_ISP_AE_GetExpoMode(MI_U32 Channel, MI_ISP_AE_MODE_TYPE_e *data);
|
||||
MI_S32 MI_ISP_AE_SetManualExpo(MI_U32 Channel, MI_ISP_AE_EXPO_VALUE_TYPE_t *data);
|
||||
MI_S32 MI_ISP_AE_GetManualExpo(MI_U32 Channel, MI_ISP_AE_EXPO_VALUE_TYPE_t *data);
|
||||
MI_S32 MI_ISP_AE_SetManualShortExpo(MI_U32 Channel, MI_ISP_AE_EXPO_VALUE_TYPE_t *data);
|
||||
MI_S32 MI_ISP_AE_GetManualShortExpo(MI_U32 Channel, MI_ISP_AE_EXPO_VALUE_TYPE_t *data);
|
||||
MI_S32 MI_ISP_AE_SetState(MI_U32 Channel, MI_ISP_SM_STATE_TYPE_e *data); // Pause, Resume
|
||||
MI_S32 MI_ISP_AE_GetState(MI_U32 Channel, MI_ISP_SM_STATE_TYPE_e *data);
|
||||
MI_S32 MI_ISP_AE_SetTarget(MI_U32 Channel, MI_ISP_AE_INTP_LUT_TYPE_t *data);
|
||||
MI_S32 MI_ISP_AE_GetTarget(MI_U32 Channel, MI_ISP_AE_INTP_LUT_TYPE_t *data);
|
||||
MI_S32 MI_ISP_AE_SetConverge(MI_U32 Channel, MI_ISP_AE_CONV_CONDITON_TYPE_t *data);
|
||||
MI_S32 MI_ISP_AE_GetConverge(MI_U32 Channel, MI_ISP_AE_CONV_CONDITON_TYPE_t *data);
|
||||
MI_S32 MI_ISP_AE_SetExposureLimit(MI_U32 Channel, MI_ISP_AE_EXPO_LIMIT_TYPE_t *data);
|
||||
MI_S32 MI_ISP_AE_GetExposureLimit(MI_U32 Channel, MI_ISP_AE_EXPO_LIMIT_TYPE_t *data);
|
||||
MI_S32 MI_ISP_AE_SetPlainLongExpoTable(MI_U32 Channel, MI_ISP_AE_EXPO_TABLE_TYPE_t *data);
|
||||
MI_S32 MI_ISP_AE_GetPlainLongExpoTable(MI_U32 Channel, MI_ISP_AE_EXPO_TABLE_TYPE_t *data);
|
||||
MI_S32 MI_ISP_AE_SetPlainShortExpoTable(MI_U32 Channel, MI_ISP_AE_EXPO_TABLE_TYPE_t *data);
|
||||
MI_S32 MI_ISP_AE_GetPlainShortExpoTable(MI_U32 Channel, MI_ISP_AE_EXPO_TABLE_TYPE_t *data);
|
||||
MI_S32 MI_ISP_AE_SetWinWgtType(MI_U32 Channel, MI_ISP_AE_WIN_WEIGHT_MODE_TYPE_e *data);
|
||||
MI_S32 MI_ISP_AE_GetWinWgtType(MI_U32 Channel, MI_ISP_AE_WIN_WEIGHT_MODE_TYPE_e *data);
|
||||
MI_S32 MI_ISP_AE_SetWinWgt(MI_U32 Channel, MI_ISP_AE_WIN_WEIGHT_TYPE_t *data);
|
||||
MI_S32 MI_ISP_AE_GetWinWgt(MI_U32 Channel, MI_ISP_AE_WIN_WEIGHT_TYPE_t *data);
|
||||
MI_S32 MI_ISP_AE_SetFlicker(MI_U32 Channel, MI_ISP_AE_FLICKER_TYPE_e *data);
|
||||
MI_S32 MI_ISP_AE_GetFlicker(MI_U32 Channel, MI_ISP_AE_FLICKER_TYPE_e *data);
|
||||
MI_S32 MI_ISP_AE_SetFlickerEX(MI_U32 Channel, MI_ISP_AE_FLICKER_EX_TYPE_t *data);
|
||||
MI_S32 MI_ISP_AE_GetFlickerEX(MI_U32 Channel, MI_ISP_AE_FLICKER_EX_TYPE_t *data);
|
||||
MI_S32 MI_ISP_AE_SetStrategy(MI_U32 Channel, MI_ISP_AE_STRATEGY_TYPE_t *data);
|
||||
MI_S32 MI_ISP_AE_GetStrategy(MI_U32 Channel, MI_ISP_AE_STRATEGY_TYPE_t *data);
|
||||
MI_S32 MI_ISP_AE_SetStrategyEX(MI_U32 Channel, MI_ISP_AE_STRATEGY_EX_TYPE_t *data);
|
||||
MI_S32 MI_ISP_AE_GetStrategyEX(MI_U32 Channel, MI_ISP_AE_STRATEGY_EX_TYPE_t *data);
|
||||
MI_S32 MI_ISP_AE_SetRGBIRAE(MI_U32 Channel, MI_ISP_AE_RGBIR_AE_TYPE_t *data);
|
||||
MI_S32 MI_ISP_AE_GetRGBIRAE(MI_U32 Channel, MI_ISP_AE_RGBIR_AE_TYPE_t *data);
|
||||
MI_S32 MI_ISP_AE_SetHDR(MI_U32 Channel, MI_ISP_AE_HDR_TYPE_t *data);
|
||||
MI_S32 MI_ISP_AE_GetHDR(MI_U32 Channel, MI_ISP_AE_HDR_TYPE_t *data);
|
||||
MI_S32 MI_ISP_AE_SetStabilizer(MI_U32 Channel, MI_ISP_AE_STABILIZER_TYPE_t *data);
|
||||
MI_S32 MI_ISP_AE_GetStabilizer(MI_U32 Channel, MI_ISP_AE_STABILIZER_TYPE_t *data);
|
||||
/************************************* AE API END *************************************/
|
||||
|
||||
/************************************* AWB API START *************************************/
|
||||
MI_S32 MI_ISP_AWB_QueryInfo(MI_U32 Channel, MI_ISP_AWB_QUERY_INFO_TYPE_t *data);
|
||||
MI_S32 MI_ISP_AWB_SetAttr(MI_U32 Channel, MI_ISP_AWB_ATTR_TYPE_t *data);
|
||||
MI_S32 MI_ISP_AWB_GetAttr(MI_U32 Channel, MI_ISP_AWB_ATTR_TYPE_t *data);
|
||||
MI_S32 MI_ISP_AWB_SetAttrEx(MI_U32 Channel, MI_ISP_AWB_ATTR_EX_TYPE_t *data);
|
||||
MI_S32 MI_ISP_AWB_GetAttrEx(MI_U32 Channel, MI_ISP_AWB_ATTR_EX_TYPE_t *data);
|
||||
MI_S32 MI_ISP_AWB_SetMultiLSAttr(MI_U32 Channel, MI_ISP_AWB_MULTILS_LS_TYPE_t *data);
|
||||
MI_S32 MI_ISP_AWB_GetMultiLSAttr(MI_U32 Channel, MI_ISP_AWB_MULTILS_LS_TYPE_t *data);
|
||||
MI_S32 MI_ISP_AWB_SetCTWeight(MI_U32 Channel, MI_ISP_AWB_CT_WEIGHT_TYPE_t *data); //Not works now, please use MI_ISP_AWB_SetAttr to set LvWeight indstead.
|
||||
MI_S32 MI_ISP_AWB_GetCTWeight(MI_U32 Channel, MI_ISP_AWB_CT_WEIGHT_TYPE_t *data); //Not works now, please use MI_ISP_AWB_GetAttr to set LvWeight indstead.
|
||||
|
||||
MI_S32 MI_ISP_AWB_SetCTCaliAttr(MI_U32 Channel, MI_ISP_AWB_CT_CALI_TYPE_t *data);
|
||||
MI_S32 MI_ISP_AWB_GetCTCaliAttr(MI_U32 Channel, MI_ISP_AWB_CT_CALI_TYPE_t *data);
|
||||
MI_S32 MI_ISP_AWB_GetCurCTCaliAttr(MI_U32 Channel, MI_ISP_AWB_CUR_CT_CALI_TYPE_t *data);
|
||||
MI_S32 MI_ISP_AWB_GetCTStats(MI_U32 Channel, MI_ISP_AWB_CT_STATISTICS_TYPE_t *data);
|
||||
MI_S32 MI_ISP_AWB_GetHWStats(MI_U32 Channel, MI_ISP_AWB_HW_STATISTICS_TYPE_t *data);//Not works now, please use MI_ISP_AWB_GetAwbHwAvgStats in mi_isp.h
|
||||
MI_S32 MI_ISP_AWB_SetCTMwbAttr(MI_U32 Channel, MI_ISP_AWB_CTMWB_PARAM_t *data);
|
||||
MI_S32 MI_ISP_AWB_GetCTMwbAttr(MI_U32 Channel, MI_ISP_AWB_CTMWB_PARAM_t *data);
|
||||
|
||||
/************************************* AF API START *************************************/
|
||||
MI_S32 MI_ISP_AF_SetHWRoiMode(MI_U32 Channel, MI_ISP_AF_HW_ROI_MODE_TYPE_t *data);
|
||||
MI_S32 MI_ISP_AF_GetHWRoiMode(MI_U32 Channel, MI_ISP_AF_HW_ROI_MODE_TYPE_t *data);
|
||||
MI_S32 MI_ISP_AF_SetHWWin(MI_U32 Channel, MI_ISP_AF_HW_WIN_TYPE_t *data);
|
||||
MI_S32 MI_ISP_AF_GetHWWin(MI_U32 Channel, MI_ISP_AF_HW_WIN_TYPE_t *data);
|
||||
MI_S32 MI_ISP_AF_SetHWFilterAttr(MI_U32 Channel, MI_ISP_AF_HW_FILTER_ATTR_TYPE_t *data);
|
||||
MI_S32 MI_ISP_AF_GetHWFilterAttr(MI_U32 Channel, MI_ISP_AF_HW_FILTER_ATTR_TYPE_t *data);
|
||||
MI_S32 MI_ISP_AF_SetHWFilterSq(MI_U32 Channel, MI_ISP_AF_HW_FILTERSQ_TYPE_t *data);
|
||||
MI_S32 MI_ISP_AF_GetHWFilterSq(MI_U32 Channel, MI_ISP_AF_HW_FILTERSQ_TYPE_t *data);
|
||||
MI_S32 MI_ISP_AF_SetAttr(MI_U32 Channel, MI_ISP_AF_ATTR_TYPE_t *data);
|
||||
MI_S32 MI_ISP_AF_GetAttr(MI_U32 Channel, MI_ISP_AF_ATTR_TYPE_t *data);
|
||||
MI_S32 MI_ISP_AF_SetMotor(MI_U32 Channel, MI_ISP_AF_MOTOR_TYPE_t *data);
|
||||
MI_S32 MI_ISP_AF_GetMotor(MI_U32 Channel, MI_ISP_AF_MOTOR_TYPE_t *data);
|
||||
MI_S32 MI_ISP_AF_SetAccWeight(MI_U32 Channel, MI_ISP_AF_ACC_WEIGHT_TYPE_t *data);
|
||||
MI_S32 MI_ISP_AF_GetAccWeight(MI_U32 Channel, MI_ISP_AF_ACC_WEIGHT_TYPE_t *data);
|
||||
MI_S32 MI_ISP_AF_SetOneShot(MI_U32 Channel, MI_ISP_AF_ONESHOT_TYPE_t *data);
|
||||
MI_S32 MI_ISP_AF_GetOneShot(MI_U32 Channel, MI_ISP_AF_ONESHOT_TYPE_t *data);
|
||||
MI_S32 MI_ISP_AF_SetSceneChange(MI_U32 Channel, MI_ISP_AF_SCENE_CHANGE_TYPE_t *data);
|
||||
MI_S32 MI_ISP_AF_GetSceneChange(MI_U32 Channel, MI_ISP_AF_SCENE_CHANGE_TYPE_t *data);
|
||||
MI_S32 MI_ISP_AF_SetSearchStart(MI_U32 Channel, MI_ISP_AF_SEARCH_START_TYPE_t *data);
|
||||
MI_S32 MI_ISP_AF_GetSearchStart(MI_U32 Channel, MI_ISP_AF_SEARCH_START_TYPE_t *data);
|
||||
MI_S32 MI_ISP_AF_SetSearch(MI_U32 Channel, MI_ISP_AF_SEARCH_TYPE_t *data);
|
||||
MI_S32 MI_ISP_AF_GetSearch(MI_U32 Channel, MI_ISP_AF_SEARCH_TYPE_t *data);
|
||||
/************************************* AF API END *************************************/
|
||||
|
||||
MI_S32 MI_ISP_ALGO_SET_ALL(int Channel, MI_U16 ApiId, MI_U32 ApiLen, MI_U8* pApiBuf);
|
||||
MI_S32 MI_ISP_ALGO_GET_ALL(int Channel, MI_U16 ApiId, MI_U32* ApiLen, MI_U8* pApiBuf);
|
||||
|
||||
#endif
|
||||
|
||||
#if 1
|
||||
|
||||
typedef struct MI_ISP_EXCUTE_CMD_ARRAY_s
|
||||
{
|
||||
MI_U32 u32CmdType;
|
||||
MI_U16 u16APIID;
|
||||
MI_S32 (*callback)(MI_U32 Channel, MI_U8 *param_ary[], MI_U8 param_num);
|
||||
} MI_ISP_EXCUTE_CMD_ARRAY_t;
|
||||
|
||||
typedef enum __attribute__ ((aligned (1)))
|
||||
{
|
||||
MI_ISP_CAMERA_CMD_SET = 0,
|
||||
MI_ISP_CAMERA_CMD_GET,
|
||||
MI_ISP_CAMERA_CMD_SET_MODE ,
|
||||
MI_ISP_CAMERA_CMD_GET_MODE,
|
||||
MI_ISP_CAMERA_CMD_GET_PIC,
|
||||
MI_ISP_CAMERA_CMD_SET_API,
|
||||
MI_ISP_CAMERA_CMD_GET_API,
|
||||
MI_ISP_CAMERA_CMD_UPLOAD_FILE, /* client upload file to server */
|
||||
MI_ISP_CAMERA_CMD_DOWNLOAD_FILE, /* client download file from server*/
|
||||
} MI_ISP_CAMERA_EXT_CMD_TYPE_e;
|
||||
|
||||
typedef struct MI_ISP_CMD_HEADER_s
|
||||
{
|
||||
MI_ISP_CAMERA_EXT_CMD_TYPE_e CmdType;
|
||||
MI_S32 CmdLen;
|
||||
} MI_ISP_CMD_HEADER_t;
|
||||
|
||||
typedef struct MI_ISP_API_PARAM_s
|
||||
{
|
||||
MI_U32 u32MagicKey;
|
||||
MI_ISP_CMD_HEADER_t sCmdheader;
|
||||
MI_U16 u16APIID;
|
||||
MI_U16 u16ParamNum;
|
||||
} MI_ISP_API_PARAM_t;
|
||||
|
||||
typedef struct MI_ISP_API_BIN_FILE_s
|
||||
{
|
||||
MI_U32 u32FileID;
|
||||
MI_U32 u32ISPVer;
|
||||
MI_U32 u32DataLen;
|
||||
MI_U32 u32Checksum;
|
||||
MI_U32 u32MagicKey;
|
||||
MI_U32 u32Reserved[3];
|
||||
} MI_ISP_API_BIN_FILE_t;
|
||||
|
||||
typedef struct MI_ISP_API_CALI_FILE_s
|
||||
{
|
||||
MI_U32 u32CaliVer;
|
||||
MI_U32 u32DataSize;
|
||||
MI_U32 u32Checksum;
|
||||
MI_U32 u32Reserved[2];
|
||||
} MI_ISP_API_CALI_FILE_t;
|
||||
|
||||
MI_S32 MI_ISP_ALGO_API_DisableAllApi(MI_U32 Channel);
|
||||
MI_S32 MI_ISP_ALGO_API_CmdLoadBinFile(MI_U32 Channel, MI_U8 *bindata_buf, MI_U32 user_key);
|
||||
MI_S32 MI_ISP_ALGO_API_CmdLoadCaliData(MI_U32 Channel, MI_U8 *bindata_buf, MI_U32 BIN_BUF_MAX_LEN, MI_ISP_CALI_ITEM_e eCaliItem);
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
} //end of extern C
|
||||
#endif
|
||||
|
||||
#endif //_MI_ISP_IQ_H_
|
|
@ -0,0 +1,430 @@
|
|||
/* SigmaStar trade secret */
|
||||
/* Copyright (c) [2019~2020] SigmaStar Technology.
|
||||
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 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* mi_isp_datatype.h
|
||||
*
|
||||
* Created on: June 27, 2018
|
||||
* Author: Jeffrey Chou
|
||||
*/
|
||||
|
||||
#ifndef _MI_ISP_DATATYPE_H_
|
||||
#define _MI_ISP_DATATYPE_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include "mi_common.h"
|
||||
#include "mi_sys_datatype.h"
|
||||
#include "mi_isp_3a_datatype.h"
|
||||
#include "mi_isp_iq_datatype.h"
|
||||
|
||||
/************************************* AF - Define the structure declaration - START *************************************/
|
||||
|
||||
/************************************* AF - Define the structure declaration - END *************************************/
|
||||
|
||||
/************************** Cus3A ***********************/
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_U8 uAvgR;
|
||||
MI_U8 uAvgG;
|
||||
MI_U8 uAvgB;
|
||||
MI_U8 uAvgY;
|
||||
} MI_ISP_AE_AVGS;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_U32 nBlkX;
|
||||
MI_U32 nBlkY;
|
||||
MI_ISP_AE_AVGS nAvg[128*90];
|
||||
}MI_ISP_AE_HW_STATISTICS_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_U8 uAvgR;
|
||||
MI_U8 uAvgG;
|
||||
MI_U8 uAvgB;
|
||||
} MI_ISP_AWB_AVGS;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_U32 nBlkX;
|
||||
MI_U32 nBlkY;
|
||||
MI_ISP_AWB_AVGS nAvg[128*90];
|
||||
} MI_ISP_AWB_HW_STATISTICS_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_U16 nHisto[128];
|
||||
} MI_ISP_HISTO_HW_STATISTICS_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_U16 nHisto[256];
|
||||
} MI_ISP_RGBIR_HISTO_HW_STATISTICS_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_BOOL bAE;
|
||||
MI_BOOL bAWB;
|
||||
MI_BOOL bAF;
|
||||
}Cus3AEnable_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_U32 Size; /**< struct size*/
|
||||
char sensor_id[32]; /**< sensor module id*/
|
||||
MI_U32 shutter; /**< shutter Shutter in ns*/
|
||||
MI_U32 shutter_step; /**< shutter Shutter step ns*/
|
||||
MI_U32 shutter_min; /**< shutter Shutter min us*/
|
||||
MI_U32 shutter_max; /**< shutter Shutter max us*/
|
||||
MI_U32 sensor_gain; /**< sensor_gain Sensor gain, 1X = 1024*/
|
||||
MI_U32 sensor_gain_min; /**< sensor_gain_min Minimum Sensor gain, 1X = 1024*/
|
||||
MI_U32 sensor_gain_max; /**< sensor_gain_max Maximum Sensor gain, 1X = 1024*/
|
||||
MI_U32 isp_gain; /**< isp_gain Isp digital gain , 1X = 1024 */
|
||||
MI_U32 isp_gain_max; /**< isp_gain Maximum Isp digital gain , 1X = 1024 */
|
||||
MI_U32 FNx10; /**< F number * 10*/
|
||||
MI_U32 fps; /**< initial frame per second*/
|
||||
MI_U32 shutterHDRShort_step; /**< shutter Shutter step ns*/
|
||||
MI_U32 shutterHDRShort_min; /**< shutter Shutter min us*/
|
||||
MI_U32 shutterHDRShort_max; /**< shutter Shutter max us*/
|
||||
MI_U32 sensor_gainHDRShort_min; /**< sensor_gain_min Minimum Sensor gain, 1X = 1024*/
|
||||
MI_U32 sensor_gainHDRShort_max; /**< sensor_gain_max Maximum Sensor gain, 1X = 1024*/
|
||||
/*CUS3A v1.1*/
|
||||
MI_U32 AvgBlkX; /**< HW statistics average block number*/
|
||||
MI_U32 AvgBlkY; /**< HW statistics average block number*/
|
||||
}CusAEInitParam_t,CusAeInitParam_t;
|
||||
|
||||
/*! @brief ISP report to AE, hardware statistic */
|
||||
typedef struct
|
||||
{
|
||||
MI_U32 Size; /**< struct size*/
|
||||
void *hist1; /**< HW statistic histogram 1*/
|
||||
void *hist2; /**< HW statistic histogram 2*/
|
||||
MI_U32 AvgBlkX; /**< HW statistics average block number*/
|
||||
MI_U32 AvgBlkY; /**< HW statistics average block number*/
|
||||
void * avgs; /**< HW statistics average block data*/
|
||||
MI_U32 Shutter; /**< Current shutter in ns*/
|
||||
MI_U32 SensorGain; /**< Current Sensor gain, 1X = 1024 */
|
||||
MI_U32 IspGain; /**< Current ISP gain, 1X = 1024*/
|
||||
MI_U32 ShutterHDRShort; /**< Current shutter in ns*/
|
||||
MI_U32 SensorGainHDRShort; /**< Current Sensor gain, 1X = 1024 */
|
||||
MI_U32 IspGainHDRShort; /**< Current ISP gain, 1X = 1024*/
|
||||
/*CUS3A V1.1*/
|
||||
MI_U32 PreAvgY; /**< Previous frame brightness*/
|
||||
MI_U8 HDRCtlMode; /**< 0 = HDR off; */
|
||||
/**< 1 = Separate shutter & Separate sensor gain settings */
|
||||
/**< 2 = Separate shutter & Share sensor gain settings */
|
||||
/**< 3 = Share shutter & Separate sensor gain settings */
|
||||
MI_U32 FNx10; /**< Aperture in FNx10*/
|
||||
MI_U32 CurFPS; /**Current sensor FPS */
|
||||
MI_U32 PreWeightY; /**< Previous frame brightness with ROI weight*/
|
||||
} __attribute__((packed, aligned(1))) CusAEInfo_t, CusAeInput_t;
|
||||
|
||||
/*! @brief ISP ae algorithm result*/
|
||||
typedef struct
|
||||
{
|
||||
MI_U32 Size; /**< struct size*/
|
||||
MI_U32 Change; /**< if true, apply this result to hw register*/
|
||||
MI_U32 Shutter; /**< Shutter in ns */
|
||||
MI_U32 SensorGain; /**< Sensor gain, 1X = 1024 */
|
||||
MI_U32 IspGain; /**< ISP gain, 1X = 1024 */
|
||||
MI_U32 ShutterHdrShort; /**< Shutter in ns */
|
||||
MI_U32 SensorGainHdrShort; /**< Sensor gain, 1X = 1024 */
|
||||
MI_U32 IspGainHdrShort; /**< ISP gain, 1X = 1024 */
|
||||
MI_U32 u4BVx16384; /**< Bv * 16384 in APEX system, EV = Av + Tv = Sv + Bv */
|
||||
MI_U32 AvgY; /**< frame brightness */
|
||||
MI_U32 HdrRatio; /**< hdr ratio, 1X = 1024 */
|
||||
/*CUS3A V1.1*/
|
||||
MI_U32 FNx10; /**< F number * 10*/
|
||||
MI_U32 DebandFPS; /** Target fps when running auto debanding**/
|
||||
MI_U32 WeightY; /**< frame brightness with ROI weight*/
|
||||
}__attribute__((packed, aligned(1))) CusAEResult_t, CusAeOutput_t;
|
||||
|
||||
/*! @brief AWB HW statistics data*/
|
||||
typedef struct
|
||||
{
|
||||
MI_U32 Size; /**< struct size*/
|
||||
MI_U32 AvgBlkX;
|
||||
MI_U32 AvgBlkY;
|
||||
MI_U32 CurRGain;
|
||||
MI_U32 CurGGain;
|
||||
MI_U32 CurBGain;
|
||||
void *avgs; //ISP_AWB_SAMPLE
|
||||
/*CUS3A V1.1*/
|
||||
MI_U8 HDRMode; /**< Noramal or HDR mode*/
|
||||
void* *pAwbStatisShort; /**< Short Shutter AWB statistic data */
|
||||
MI_U32 u4BVx16384; /**< From AE output, Bv * 16384 in APEX system, EV = Av + Tv = Sv + Bv */
|
||||
MI_S32 WeightY; /**< frame brightness with ROI weight*/
|
||||
}__attribute__((packed, aligned(1))) CusAWBInfo_t, CusAWBInput_t;
|
||||
|
||||
/*! @brief AWB algorithm result*/
|
||||
typedef struct
|
||||
{
|
||||
MI_U32 Size; /**< struct size*/
|
||||
MI_U32 Change; /**< if true, apply this result to hw register*/
|
||||
MI_U32 R_gain; /**< AWB gain for R channel*/
|
||||
MI_U32 G_gain; /**< AWB gain for G channel*/
|
||||
MI_U32 B_gain; /**< AWB gain for B channel*/
|
||||
MI_U32 ColorTmp; /**< Return color temperature*/
|
||||
}CusAWBResult_t, CusAwbOutput_t;;
|
||||
|
||||
typedef enum __attribute__ ((aligned (1)))
|
||||
{
|
||||
SS_AE_16x24 = 0,
|
||||
SS_AE_32x24,
|
||||
SS_AE_64x48,
|
||||
SS_AE_64x45,
|
||||
SS_AE_128x80,
|
||||
SS_AE_128x90,
|
||||
SS_AE_32x32
|
||||
} MS_CUST_AE_WIN_BLOCK_NUM_TYPE_e;
|
||||
|
||||
typedef struct {
|
||||
MI_U16 u2Stawin_x_offset;
|
||||
MI_U16 u2Stawin_x_size;
|
||||
MI_U16 u2Stawin_y_offset;
|
||||
MI_U16 u2Stawin_y_size;
|
||||
MI_U16 u2WinIdx;
|
||||
} CusAEHistWin_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_U32 SizeX;
|
||||
MI_U32 SizeY;
|
||||
MI_U32 IncRatio;
|
||||
}CusAWBSample_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_U16 CropX; // 0~1023
|
||||
MI_U16 CropY; // 0~1023
|
||||
MI_U16 CropW; // 0~1023
|
||||
MI_U16 CropH; // 0~1023
|
||||
}CusAEAWBCropSize_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_U8 iir_1[5*16]; //[5]: iir 35bit, use 5*u8 datatype, [16]: 16wins
|
||||
MI_U8 iir_2[5*16]; //[5]: iir 35bit, use 5*u8 datatype, [16]: 16wins
|
||||
MI_U8 luma[4*16]; //[4]: luma 32bit, use 4*u8 datatype, [16]: 16wins
|
||||
MI_U8 fir_v[5*16]; //[5]: fir 35bit, use 5*u8 datatype, [16]: 16wins
|
||||
MI_U8 fir_h[5*16]; //[5]: fir 35bit, use 5*u8 datatype, [16]: 16wins
|
||||
MI_U8 ysat[3*16]; //[3]: ysat 22bit, use 3*u8 datatype, [16]: 16wins
|
||||
} AF_STATS_PARAM_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
AF_STATS_PARAM_t stParaAPI[16];
|
||||
} CusAFStats_t;
|
||||
|
||||
typedef struct AF_WINDOW_PARAM_s
|
||||
{
|
||||
MI_U32 u32StartX; /*range : 0~1023*/
|
||||
MI_U32 u32StartY; /*range : 0~1023*/
|
||||
MI_U32 u32EndX; /*range : 0~1023*/
|
||||
MI_U32 u32EndY; /*range : 0~1023*/
|
||||
} AF_WINDOW_PARAM_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_U8 u8WindowIndex;
|
||||
AF_WINDOW_PARAM_t stParaAPI;
|
||||
} CusAFWin_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_U16 u16IIR1_a0;
|
||||
MI_U16 u16IIR1_a1;
|
||||
MI_U16 u16IIR1_a2;
|
||||
MI_U16 u16IIR1_b1;
|
||||
MI_U16 u16IIR1_b2;
|
||||
MI_U16 u16IIR1_1st_low_clip;
|
||||
MI_U16 u16IIR1_1st_high_clip;
|
||||
MI_U16 u16IIR1_2nd_low_clip;
|
||||
MI_U16 u16IIR1_2nd_high_clip;
|
||||
MI_U16 u16IIR2_a0;
|
||||
MI_U16 u16IIR2_a1;
|
||||
MI_U16 u16IIR2_a2;
|
||||
MI_U16 u16IIR2_b1;
|
||||
MI_U16 u16IIR2_b2;
|
||||
MI_U16 u16IIR2_1st_low_clip;
|
||||
MI_U16 u16IIR2_1st_high_clip;
|
||||
MI_U16 u16IIR2_2nd_low_clip;
|
||||
MI_U16 u16IIR2_2nd_high_clip;
|
||||
|
||||
MI_U16 u16IIR1_e1_en;
|
||||
MI_U16 u16IIR1_e1_a0;
|
||||
MI_U16 u16IIR1_e1_a1;
|
||||
MI_U16 u16IIR1_e1_a2;
|
||||
MI_U16 u16IIR1_e1_b1;
|
||||
MI_U16 u16IIR1_e1_b2;
|
||||
MI_U16 u16IIR1_e2_en;
|
||||
MI_U16 u16IIR1_e2_a0;
|
||||
MI_U16 u16IIR1_e2_a1;
|
||||
MI_U16 u16IIR1_e2_a2;
|
||||
MI_U16 u16IIR1_e2_b1;
|
||||
MI_U16 u16IIR1_e2_b2;
|
||||
|
||||
MI_U16 u16IIR2_e1_en;
|
||||
MI_U16 u16IIR2_e1_a0;
|
||||
MI_U16 u16IIR2_e1_a1;
|
||||
MI_U16 u16IIR2_e1_a2;
|
||||
MI_U16 u16IIR2_e1_b1;
|
||||
MI_U16 u16IIR2_e1_b2;
|
||||
MI_U16 u16IIR2_e2_en;
|
||||
MI_U16 u16IIR2_e2_a0;
|
||||
MI_U16 u16IIR2_e2_a1;
|
||||
MI_U16 u16IIR2_e2_a2;
|
||||
MI_U16 u16IIR2_e2_b1;
|
||||
MI_U16 u16IIR2_e2_b2;
|
||||
} CusAFFilter_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_U16 u16Coeff[70];
|
||||
} CusAFFilter_Geo_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_BOOL bSobelYSatEn;
|
||||
MI_U16 u16SobelYThd;
|
||||
|
||||
MI_BOOL bIIRSquareAccEn;
|
||||
MI_BOOL bSobelSquareAccEn;
|
||||
|
||||
MI_U16 u16IIR1Thd;
|
||||
MI_U16 u16IIR2Thd;
|
||||
MI_U16 u16SobelHThd;
|
||||
MI_U16 u16SobelVThd;
|
||||
MI_U8 u8AFTblX[12];
|
||||
MI_U16 u16AFTblY[13];
|
||||
} CusAFFilterSq_t;
|
||||
|
||||
|
||||
typedef enum __attribute__ ((aligned (1)))
|
||||
{
|
||||
AF_ROI_MODE_NORMAL,
|
||||
AF_ROI_MODE_MATRIX
|
||||
} ISP_AF_ROI_MODE_e;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
ISP_AF_ROI_MODE_e mode;
|
||||
MI_U32 u32_vertical_block_number;
|
||||
} CusAFRoiMode_t;
|
||||
|
||||
/* Raw store control */
|
||||
typedef enum
|
||||
{
|
||||
eRawStoreNode_P0HEAD = 0, /* Control by VIF, Do not use */
|
||||
eRawStoreNode_P1HEAD = 1, /* Control by VIF, Do not use */
|
||||
eRawStoreNode_P0TAIL = 2,
|
||||
eRawStoreNode_P1TAIL = 3,
|
||||
eRawStoreNode_ISPOUT = 4,
|
||||
eRawStoreNode_VDOS = 5,
|
||||
eRawStoreNode_ISPOUT_BEFORE_YEE = 6,
|
||||
eRawStoreNode_RGBIR_IR_ONLY = 7
|
||||
}CameraRawStoreNode_e;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_U32 u32image_width;
|
||||
MI_U32 u32image_height;
|
||||
MI_U32 u32Node;
|
||||
MI_U32 u32PixelDepth;
|
||||
} CusImageResolution_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_U32 u32enable;
|
||||
MI_U32 u32image_width;
|
||||
MI_U32 u32image_height;
|
||||
MI_U32 u32physical_address;
|
||||
MI_U32 u32Node;
|
||||
} CusISPOutImage_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_U32 u32enable;
|
||||
MI_U32 u32image_width;
|
||||
MI_U32 u32image_height;
|
||||
MI_U32 u32physical_address;
|
||||
MI_U32 u32Node;
|
||||
MI_U32 u32PixelDepth;
|
||||
} CusHdrRawImage_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_U64 u64Pts; /** frame PTS */
|
||||
MI_U32 u32Shutter; /**< Shutter in us */
|
||||
MI_U32 u32SensorGain; /**< Sensor gain, 1X = 1024 */
|
||||
MI_U32 u32ColorTmp; /**< Return color temperature*/
|
||||
} IspFrameMetaInfo_t;
|
||||
|
||||
/*! @brief ISP report to AF, hardware status */
|
||||
typedef struct
|
||||
{
|
||||
MI_U32 Size; /**< struct size*/
|
||||
MI_U32 MinPos; /**< Maximum position of AF motor */
|
||||
MI_U32 MaxPos; /**< Minimum position of AF motor */
|
||||
MI_U32 CurPos; /**< Current position of AF motor */
|
||||
} __attribute__((packed, aligned(1))) CusAFInfo_t, CusAfInput_t;
|
||||
|
||||
/*! @brief AF algorithm result*/
|
||||
typedef struct
|
||||
{
|
||||
MI_U32 Size; /**< struct size*/
|
||||
MI_U32 Change; /**< if true, apply this result to hw register*/
|
||||
MI_U32 NextPos; /**< Next absolute position of AF motor */
|
||||
}__attribute__((packed, aligned(1))) CusAfResult_t, CusAfOutput_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_U32 u32SlaveAddr; //sensor slave address
|
||||
MI_U32 u32RegLen; //sensor register length , 1 or 2 bytes
|
||||
MI_U32 u32DataLen; //sensor register data length, 1 or 2 bytes
|
||||
MI_U32 u32I2cSpeed; //i2c speed , 100/200/300/400 KHz
|
||||
MI_U32 u32Reg; //sensor register address
|
||||
MI_U32 u32Data; //sensor register data
|
||||
}CusSensorI2cParam_t;
|
||||
|
||||
/***************************** end of Cus3A ****************************/
|
||||
|
||||
// COMMON API
|
||||
typedef struct MI_ISP_API_CHANNEL_ID_TYPE_s
|
||||
{
|
||||
MI_U32 u32ChannelID;
|
||||
} MI_ISP_API_CHANNEL_ID_TYPE_t;
|
||||
|
||||
typedef struct MI_ISP_API_USERSPACE3A_ATTR_s
|
||||
{
|
||||
MI_SYS_PixelFormat_e ePixelFmt;
|
||||
MI_U32 eSensorBindId;
|
||||
} MI_ISP_API_USERSPACE3A_ATTR_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_S8 strIspRoot[64];
|
||||
} MI_ISP_ROOT_PATH_T;
|
||||
|
||||
#ifdef __cplusplus
|
||||
} //end of extern C
|
||||
#endif
|
||||
|
||||
#endif //_MI_ISP_DATATYPE_H_
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,430 @@
|
|||
/* SigmaStar trade secret */
|
||||
/* Copyright (c) [2019~2020] SigmaStar Technology.
|
||||
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 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* mi_isp_datatype.h
|
||||
*
|
||||
* Created on: June 27, 2018
|
||||
* Author: Jeffrey Chou
|
||||
*/
|
||||
|
||||
#ifndef _MI_ISP_DATATYPE_H_
|
||||
#define _MI_ISP_DATATYPE_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include "mi_common.h"
|
||||
#include "mi_sys_datatype.h"
|
||||
#include "mi_isp_3a_datatype.h"
|
||||
#include "mi_isp_iq_datatype.h"
|
||||
|
||||
/************************************* AF - Define the structure declaration - START *************************************/
|
||||
|
||||
/************************************* AF - Define the structure declaration - END *************************************/
|
||||
|
||||
/************************** Cus3A ***********************/
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_U8 uAvgR;
|
||||
MI_U8 uAvgG;
|
||||
MI_U8 uAvgB;
|
||||
MI_U8 uAvgY;
|
||||
} MI_ISP_AE_AVGS;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_U32 nBlkX;
|
||||
MI_U32 nBlkY;
|
||||
MI_ISP_AE_AVGS nAvg[128*90];
|
||||
}MI_ISP_AE_HW_STATISTICS_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_U8 uAvgR;
|
||||
MI_U8 uAvgG;
|
||||
MI_U8 uAvgB;
|
||||
} MI_ISP_AWB_AVGS;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_U32 nBlkX;
|
||||
MI_U32 nBlkY;
|
||||
MI_ISP_AWB_AVGS nAvg[128*90];
|
||||
} MI_ISP_AWB_HW_STATISTICS_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_U16 nHisto[128];
|
||||
} MI_ISP_HISTO_HW_STATISTICS_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_U16 nHisto[256];
|
||||
} MI_ISP_RGBIR_HISTO_HW_STATISTICS_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_BOOL bAE;
|
||||
MI_BOOL bAWB;
|
||||
MI_BOOL bAF;
|
||||
}Cus3AEnable_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_U32 Size; /**< struct size*/
|
||||
char sensor_id[32]; /**< sensor module id*/
|
||||
MI_U32 shutter; /**< shutter Shutter in ns*/
|
||||
MI_U32 shutter_step; /**< shutter Shutter step ns*/
|
||||
MI_U32 shutter_min; /**< shutter Shutter min us*/
|
||||
MI_U32 shutter_max; /**< shutter Shutter max us*/
|
||||
MI_U32 sensor_gain; /**< sensor_gain Sensor gain, 1X = 1024*/
|
||||
MI_U32 sensor_gain_min; /**< sensor_gain_min Minimum Sensor gain, 1X = 1024*/
|
||||
MI_U32 sensor_gain_max; /**< sensor_gain_max Maximum Sensor gain, 1X = 1024*/
|
||||
MI_U32 isp_gain; /**< isp_gain Isp digital gain , 1X = 1024 */
|
||||
MI_U32 isp_gain_max; /**< isp_gain Maximum Isp digital gain , 1X = 1024 */
|
||||
MI_U32 FNx10; /**< F number * 10*/
|
||||
MI_U32 fps; /**< initial frame per second*/
|
||||
MI_U32 shutterHDRShort_step; /**< shutter Shutter step ns*/
|
||||
MI_U32 shutterHDRShort_min; /**< shutter Shutter min us*/
|
||||
MI_U32 shutterHDRShort_max; /**< shutter Shutter max us*/
|
||||
MI_U32 sensor_gainHDRShort_min; /**< sensor_gain_min Minimum Sensor gain, 1X = 1024*/
|
||||
MI_U32 sensor_gainHDRShort_max; /**< sensor_gain_max Maximum Sensor gain, 1X = 1024*/
|
||||
/*CUS3A v1.1*/
|
||||
MI_U32 AvgBlkX; /**< HW statistics average block number*/
|
||||
MI_U32 AvgBlkY; /**< HW statistics average block number*/
|
||||
}CusAEInitParam_t,CusAeInitParam_t;
|
||||
|
||||
/*! @brief ISP report to AE, hardware statistic */
|
||||
typedef struct
|
||||
{
|
||||
MI_U32 Size; /**< struct size*/
|
||||
void *hist1; /**< HW statistic histogram 1*/
|
||||
void *hist2; /**< HW statistic histogram 2*/
|
||||
MI_U32 AvgBlkX; /**< HW statistics average block number*/
|
||||
MI_U32 AvgBlkY; /**< HW statistics average block number*/
|
||||
void * avgs; /**< HW statistics average block data*/
|
||||
MI_U32 Shutter; /**< Current shutter in ns*/
|
||||
MI_U32 SensorGain; /**< Current Sensor gain, 1X = 1024 */
|
||||
MI_U32 IspGain; /**< Current ISP gain, 1X = 1024*/
|
||||
MI_U32 ShutterHDRShort; /**< Current shutter in ns*/
|
||||
MI_U32 SensorGainHDRShort; /**< Current Sensor gain, 1X = 1024 */
|
||||
MI_U32 IspGainHDRShort; /**< Current ISP gain, 1X = 1024*/
|
||||
/*CUS3A V1.1*/
|
||||
MI_U32 PreAvgY; /**< Previous frame brightness*/
|
||||
MI_U8 HDRCtlMode; /**< 0 = HDR off; */
|
||||
/**< 1 = Separate shutter & Separate sensor gain settings */
|
||||
/**< 2 = Separate shutter & Share sensor gain settings */
|
||||
/**< 3 = Share shutter & Separate sensor gain settings */
|
||||
MI_U32 FNx10; /**< Aperture in FNx10*/
|
||||
MI_U32 CurFPS; /**Current sensor FPS */
|
||||
MI_U32 PreWeightY; /**< Previous frame brightness with ROI weight*/
|
||||
} __attribute__((packed, aligned(1))) CusAEInfo_t, CusAeInput_t;
|
||||
|
||||
/*! @brief ISP ae algorithm result*/
|
||||
typedef struct
|
||||
{
|
||||
MI_U32 Size; /**< struct size*/
|
||||
MI_U32 Change; /**< if true, apply this result to hw register*/
|
||||
MI_U32 Shutter; /**< Shutter in ns */
|
||||
MI_U32 SensorGain; /**< Sensor gain, 1X = 1024 */
|
||||
MI_U32 IspGain; /**< ISP gain, 1X = 1024 */
|
||||
MI_U32 ShutterHdrShort; /**< Shutter in ns */
|
||||
MI_U32 SensorGainHdrShort; /**< Sensor gain, 1X = 1024 */
|
||||
MI_U32 IspGainHdrShort; /**< ISP gain, 1X = 1024 */
|
||||
MI_U32 u4BVx16384; /**< Bv * 16384 in APEX system, EV = Av + Tv = Sv + Bv */
|
||||
MI_U32 AvgY; /**< frame brightness */
|
||||
MI_U32 HdrRatio; /**< hdr ratio, 1X = 1024 */
|
||||
/*CUS3A V1.1*/
|
||||
MI_U32 FNx10; /**< F number * 10*/
|
||||
MI_U32 DebandFPS; /** Target fps when running auto debanding**/
|
||||
MI_U32 WeightY; /**< frame brightness with ROI weight*/
|
||||
}__attribute__((packed, aligned(1))) CusAEResult_t, CusAeOutput_t;
|
||||
|
||||
/*! @brief AWB HW statistics data*/
|
||||
typedef struct
|
||||
{
|
||||
MI_U32 Size; /**< struct size*/
|
||||
MI_U32 AvgBlkX;
|
||||
MI_U32 AvgBlkY;
|
||||
MI_U32 CurRGain;
|
||||
MI_U32 CurGGain;
|
||||
MI_U32 CurBGain;
|
||||
void *avgs; //ISP_AWB_SAMPLE
|
||||
/*CUS3A V1.1*/
|
||||
MI_U8 HDRMode; /**< Noramal or HDR mode*/
|
||||
void* *pAwbStatisShort; /**< Short Shutter AWB statistic data */
|
||||
MI_U32 u4BVx16384; /**< From AE output, Bv * 16384 in APEX system, EV = Av + Tv = Sv + Bv */
|
||||
MI_S32 WeightY; /**< frame brightness with ROI weight*/
|
||||
}__attribute__((packed, aligned(1))) CusAWBInfo_t, CusAWBInput_t;
|
||||
|
||||
/*! @brief AWB algorithm result*/
|
||||
typedef struct
|
||||
{
|
||||
MI_U32 Size; /**< struct size*/
|
||||
MI_U32 Change; /**< if true, apply this result to hw register*/
|
||||
MI_U32 R_gain; /**< AWB gain for R channel*/
|
||||
MI_U32 G_gain; /**< AWB gain for G channel*/
|
||||
MI_U32 B_gain; /**< AWB gain for B channel*/
|
||||
MI_U32 ColorTmp; /**< Return color temperature*/
|
||||
}CusAWBResult_t, CusAwbOutput_t;;
|
||||
|
||||
typedef enum __attribute__ ((aligned (1)))
|
||||
{
|
||||
SS_AE_16x24 = 0,
|
||||
SS_AE_32x24,
|
||||
SS_AE_64x48,
|
||||
SS_AE_64x45,
|
||||
SS_AE_128x80,
|
||||
SS_AE_128x90,
|
||||
SS_AE_32x32
|
||||
} MS_CUST_AE_WIN_BLOCK_NUM_TYPE_e;
|
||||
|
||||
typedef struct {
|
||||
MI_U16 u2Stawin_x_offset;
|
||||
MI_U16 u2Stawin_x_size;
|
||||
MI_U16 u2Stawin_y_offset;
|
||||
MI_U16 u2Stawin_y_size;
|
||||
MI_U16 u2WinIdx;
|
||||
} CusAEHistWin_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_U32 SizeX;
|
||||
MI_U32 SizeY;
|
||||
MI_U32 IncRatio;
|
||||
}CusAWBSample_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_U16 CropX; // 0~1023
|
||||
MI_U16 CropY; // 0~1023
|
||||
MI_U16 CropW; // 0~1023
|
||||
MI_U16 CropH; // 0~1023
|
||||
}CusAEAWBCropSize_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_U8 iir_1[5*16]; //[5]: iir 35bit, use 5*u8 datatype, [16]: 16wins
|
||||
MI_U8 iir_2[5*16]; //[5]: iir 35bit, use 5*u8 datatype, [16]: 16wins
|
||||
MI_U8 luma[4*16]; //[4]: luma 32bit, use 4*u8 datatype, [16]: 16wins
|
||||
MI_U8 fir_v[5*16]; //[5]: fir 35bit, use 5*u8 datatype, [16]: 16wins
|
||||
MI_U8 fir_h[5*16]; //[5]: fir 35bit, use 5*u8 datatype, [16]: 16wins
|
||||
MI_U8 ysat[3*16]; //[3]: ysat 22bit, use 3*u8 datatype, [16]: 16wins
|
||||
} AF_STATS_PARAM_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
AF_STATS_PARAM_t stParaAPI[16];
|
||||
} CusAFStats_t;
|
||||
|
||||
typedef struct AF_WINDOW_PARAM_s
|
||||
{
|
||||
MI_U32 u32StartX; /*range : 0~1023*/
|
||||
MI_U32 u32StartY; /*range : 0~1023*/
|
||||
MI_U32 u32EndX; /*range : 0~1023*/
|
||||
MI_U32 u32EndY; /*range : 0~1023*/
|
||||
} AF_WINDOW_PARAM_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_U8 u8WindowIndex;
|
||||
AF_WINDOW_PARAM_t stParaAPI;
|
||||
} CusAFWin_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_U16 u16IIR1_a0;
|
||||
MI_U16 u16IIR1_a1;
|
||||
MI_U16 u16IIR1_a2;
|
||||
MI_U16 u16IIR1_b1;
|
||||
MI_U16 u16IIR1_b2;
|
||||
MI_U16 u16IIR1_1st_low_clip;
|
||||
MI_U16 u16IIR1_1st_high_clip;
|
||||
MI_U16 u16IIR1_2nd_low_clip;
|
||||
MI_U16 u16IIR1_2nd_high_clip;
|
||||
MI_U16 u16IIR2_a0;
|
||||
MI_U16 u16IIR2_a1;
|
||||
MI_U16 u16IIR2_a2;
|
||||
MI_U16 u16IIR2_b1;
|
||||
MI_U16 u16IIR2_b2;
|
||||
MI_U16 u16IIR2_1st_low_clip;
|
||||
MI_U16 u16IIR2_1st_high_clip;
|
||||
MI_U16 u16IIR2_2nd_low_clip;
|
||||
MI_U16 u16IIR2_2nd_high_clip;
|
||||
|
||||
MI_U16 u16IIR1_e1_en;
|
||||
MI_U16 u16IIR1_e1_a0;
|
||||
MI_U16 u16IIR1_e1_a1;
|
||||
MI_U16 u16IIR1_e1_a2;
|
||||
MI_U16 u16IIR1_e1_b1;
|
||||
MI_U16 u16IIR1_e1_b2;
|
||||
MI_U16 u16IIR1_e2_en;
|
||||
MI_U16 u16IIR1_e2_a0;
|
||||
MI_U16 u16IIR1_e2_a1;
|
||||
MI_U16 u16IIR1_e2_a2;
|
||||
MI_U16 u16IIR1_e2_b1;
|
||||
MI_U16 u16IIR1_e2_b2;
|
||||
|
||||
MI_U16 u16IIR2_e1_en;
|
||||
MI_U16 u16IIR2_e1_a0;
|
||||
MI_U16 u16IIR2_e1_a1;
|
||||
MI_U16 u16IIR2_e1_a2;
|
||||
MI_U16 u16IIR2_e1_b1;
|
||||
MI_U16 u16IIR2_e1_b2;
|
||||
MI_U16 u16IIR2_e2_en;
|
||||
MI_U16 u16IIR2_e2_a0;
|
||||
MI_U16 u16IIR2_e2_a1;
|
||||
MI_U16 u16IIR2_e2_a2;
|
||||
MI_U16 u16IIR2_e2_b1;
|
||||
MI_U16 u16IIR2_e2_b2;
|
||||
} CusAFFilter_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_U16 u16Coeff[70];
|
||||
} CusAFFilter_Geo_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_BOOL bSobelYSatEn;
|
||||
MI_U16 u16SobelYThd;
|
||||
|
||||
MI_BOOL bIIRSquareAccEn;
|
||||
MI_BOOL bSobelSquareAccEn;
|
||||
|
||||
MI_U16 u16IIR1Thd;
|
||||
MI_U16 u16IIR2Thd;
|
||||
MI_U16 u16SobelHThd;
|
||||
MI_U16 u16SobelVThd;
|
||||
MI_U8 u8AFTblX[12];
|
||||
MI_U16 u16AFTblY[13];
|
||||
} CusAFFilterSq_t;
|
||||
|
||||
|
||||
typedef enum __attribute__ ((aligned (1)))
|
||||
{
|
||||
AF_ROI_MODE_NORMAL,
|
||||
AF_ROI_MODE_MATRIX
|
||||
} ISP_AF_ROI_MODE_e;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
ISP_AF_ROI_MODE_e mode;
|
||||
MI_U32 u32_vertical_block_number;
|
||||
} CusAFRoiMode_t;
|
||||
|
||||
/* Raw store control */
|
||||
typedef enum
|
||||
{
|
||||
eRawStoreNode_P0HEAD = 0, /* Control by VIF, Do not use */
|
||||
eRawStoreNode_P1HEAD = 1, /* Control by VIF, Do not use */
|
||||
eRawStoreNode_P0TAIL = 2,
|
||||
eRawStoreNode_P1TAIL = 3,
|
||||
eRawStoreNode_ISPOUT = 4,
|
||||
eRawStoreNode_VDOS = 5,
|
||||
eRawStoreNode_ISPOUT_BEFORE_YEE = 6,
|
||||
eRawStoreNode_RGBIR_IR_ONLY = 7
|
||||
}CameraRawStoreNode_e;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_U32 u32image_width;
|
||||
MI_U32 u32image_height;
|
||||
MI_U32 u32Node;
|
||||
MI_U32 u32PixelDepth;
|
||||
} CusImageResolution_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_U32 u32enable;
|
||||
MI_U32 u32image_width;
|
||||
MI_U32 u32image_height;
|
||||
MI_U32 u32physical_address;
|
||||
MI_U32 u32Node;
|
||||
} CusISPOutImage_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_U32 u32enable;
|
||||
MI_U32 u32image_width;
|
||||
MI_U32 u32image_height;
|
||||
MI_U32 u32physical_address;
|
||||
MI_U32 u32Node;
|
||||
MI_U32 u32PixelDepth;
|
||||
} CusHdrRawImage_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_U64 u64Pts; /** frame PTS */
|
||||
MI_U32 u32Shutter; /**< Shutter in us */
|
||||
MI_U32 u32SensorGain; /**< Sensor gain, 1X = 1024 */
|
||||
MI_U32 u32ColorTmp; /**< Return color temperature*/
|
||||
} IspFrameMetaInfo_t;
|
||||
|
||||
/*! @brief ISP report to AF, hardware status */
|
||||
typedef struct
|
||||
{
|
||||
MI_U32 Size; /**< struct size*/
|
||||
MI_U32 MinPos; /**< Maximum position of AF motor */
|
||||
MI_U32 MaxPos; /**< Minimum position of AF motor */
|
||||
MI_U32 CurPos; /**< Current position of AF motor */
|
||||
} __attribute__((packed, aligned(1))) CusAFInfo_t, CusAfInput_t;
|
||||
|
||||
/*! @brief AF algorithm result*/
|
||||
typedef struct
|
||||
{
|
||||
MI_U32 Size; /**< struct size*/
|
||||
MI_U32 Change; /**< if true, apply this result to hw register*/
|
||||
MI_U32 NextPos; /**< Next absolute position of AF motor */
|
||||
}__attribute__((packed, aligned(1))) CusAfResult_t, CusAfOutput_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_U32 u32SlaveAddr; //sensor slave address
|
||||
MI_U32 u32RegLen; //sensor register length , 1 or 2 bytes
|
||||
MI_U32 u32DataLen; //sensor register data length, 1 or 2 bytes
|
||||
MI_U32 u32I2cSpeed; //i2c speed , 100/200/300/400 KHz
|
||||
MI_U32 u32Reg; //sensor register address
|
||||
MI_U32 u32Data; //sensor register data
|
||||
}CusSensorI2cParam_t;
|
||||
|
||||
/***************************** end of Cus3A ****************************/
|
||||
|
||||
// COMMON API
|
||||
typedef struct MI_ISP_API_CHANNEL_ID_TYPE_s
|
||||
{
|
||||
MI_U32 u32ChannelID;
|
||||
} MI_ISP_API_CHANNEL_ID_TYPE_t;
|
||||
|
||||
typedef struct MI_ISP_API_USERSPACE3A_ATTR_s
|
||||
{
|
||||
MI_SYS_PixelFormat_e ePixelFmt;
|
||||
MI_U32 eSensorBindId;
|
||||
} MI_ISP_API_USERSPACE3A_ATTR_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_S8 strIspRoot[64];
|
||||
} MI_ISP_ROOT_PATH_T;
|
||||
|
||||
#ifdef __cplusplus
|
||||
} //end of extern C
|
||||
#endif
|
||||
|
||||
#endif //_MI_ISP_DATATYPE_H_
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,460 @@
|
|||
/* SigmaStar trade secret */
|
||||
/* Copyright (c) [2019~2020] SigmaStar Technology.
|
||||
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 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 _ISP_CUS3A_IF_H_
|
||||
#define _ISP_CUS3A_IF_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#define CUS3A_VER_STR "CUS3A_V1.1"
|
||||
#define CUS3A_VER_MAJOR 1
|
||||
#define CUS3A_VER_MINOR 1
|
||||
|
||||
#include "cam_os_wrapper.h"
|
||||
#include "mi_isp_datatype.h"
|
||||
|
||||
#if 0
|
||||
typedef unsigned char u8;
|
||||
//typedef signed char s8;
|
||||
typedef unsigned short u16;
|
||||
//typedef signed short s16;
|
||||
typedef unsigned int u32;
|
||||
//typedef signed int s32;
|
||||
typedef unsigned long long u64;
|
||||
//typedef signed long long s64;
|
||||
#endif
|
||||
|
||||
#define MV_WIN_NUM 25
|
||||
#define CAM20_AUTO_NUM 16
|
||||
#define CAM20_SDC_CTRL_ITEM_NUMBER 2
|
||||
#define AWB_LV_CT_TBL_NUM 18
|
||||
#define AWB_CT_TBL_NUM 10
|
||||
|
||||
#define MS_GAMMA_TBL 256
|
||||
#define MS_ALSC_TBL_W 61
|
||||
#define MS_ALSC_TBL_H 69
|
||||
#define MS_ALSC_TBL 4209
|
||||
#define MS_SDC_TBL 1024
|
||||
#define MS_FPN_TBL 4000 //infinity5
|
||||
#define MS_YUVGAMA_Y_TBL 256
|
||||
#define MS_YUVGAMA_VU_TBL 128
|
||||
#define MS_WDR_LOC_TBL 88
|
||||
|
||||
#define MS_CAM_AF_MAX_WIN_NUM 16 //
|
||||
#define MAX_CUST_3A_CHINFO_NUM (16)
|
||||
|
||||
/*------AE/AWB interface--------*/
|
||||
/*! @brief API error code*/
|
||||
typedef enum CUS_3A_ERR_CODE
|
||||
{
|
||||
CUS_3A_SUCCESS = 0, /**< operation successful */
|
||||
CUS_3A_ERROR = -1, /**< unspecified failure */
|
||||
}CUS3A_ERR_CODE;
|
||||
|
||||
#define _3A_ROW (128) /**< number of 3A statistic blocks in a row */
|
||||
#define _3A_COL (90) /**< number of 3A statistic blocks in a column */
|
||||
#define _3A_HIST_BIN0 (40) /**< histogram type0 resolution*/
|
||||
#define _3A_HIST_BINX (128) /**< histogram type1 resolution*/
|
||||
#define _3A_IR_HIST_BIN (256) /**< histogram type2 resolution*/
|
||||
|
||||
typedef enum
|
||||
{
|
||||
E_ISP_CH_0 = 0,
|
||||
E_ISP_CH_1,
|
||||
E_ISP_CH_2,
|
||||
E_ISP_CH_3,
|
||||
E_ISP_CH_4,
|
||||
E_ISP_CH_5,
|
||||
E_ISP_CH_6,
|
||||
E_ISP_CH_7,
|
||||
E_ISP_CH_8,
|
||||
E_ISP_CH_9,
|
||||
E_ISP_CH_10,
|
||||
E_ISP_CH_11,
|
||||
E_ISP_CH_12,
|
||||
E_ISP_CH_13,
|
||||
E_ISP_CH_14,
|
||||
E_ISP_CH_15,
|
||||
E_ISP_CH_MAX
|
||||
}CUS3A_ISP_CH_e;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
E_ALGO_TYPE_AE = 0x0,
|
||||
E_ALGO_TYPE_AWB,
|
||||
E_ALGO_TYPE_AF,
|
||||
E_ALGO_TYPE_MAX
|
||||
}CUS3A_ALGO_TYPE_e;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
E_ALGO_ADAPTOR_NATIVE = 0x0,
|
||||
E_ALGO_ADAPTOR_1,
|
||||
E_ALGO_ADAPTOR_MAX
|
||||
}CUS3A_ALGO_ADAPTOR_e;
|
||||
|
||||
// AWB statistic , one sample
|
||||
typedef struct
|
||||
{
|
||||
u8 r;
|
||||
u8 g;
|
||||
u8 b;
|
||||
} __attribute__((packed, aligned(1))) ISP_AWB_SAMPLE;
|
||||
|
||||
#if 0
|
||||
/*! @brief AWB HW statistics data*/
|
||||
typedef struct
|
||||
{
|
||||
//ISP_AWB_SAMPLE data[_3A_ROW*_3A_COL];
|
||||
u32 AvgBlkX;
|
||||
u32 AvgBlkY;
|
||||
ISP_AWB_SAMPLE *avgs;
|
||||
} __attribute__((packed, aligned(1))) ISP_AWB_INFO;
|
||||
#else
|
||||
/*! @brief AWB HW statistics data*/
|
||||
typedef struct
|
||||
{
|
||||
u32 Size; /**< struct size*/
|
||||
u32 AvgBlkX;
|
||||
u32 AvgBlkY;
|
||||
u32 CurRGain;
|
||||
u32 CurGGain;
|
||||
u32 CurBGain;
|
||||
ISP_AWB_SAMPLE *avgs; /*awb statis for linear frame or HDR long frame*/
|
||||
/*CUS3A V1.1*/
|
||||
u8 HDRMode; /**< Noramal or HDR mode*/
|
||||
ISP_AWB_SAMPLE* pAwbStatisShort; /**<awb statis for HDR short Shutter AWB statistic data */
|
||||
u32 u4BVx16384; /**< From AE output, Bv * 16384 in APEX system, EV = Av + Tv = Sv + Bv */
|
||||
u32 WeightY; /**< frame brightness with ROI weight*/
|
||||
} ISP_AWB_INFO;
|
||||
#endif
|
||||
|
||||
|
||||
/*! @brief AWB algorithm result*/
|
||||
typedef struct isp_awb_result
|
||||
{
|
||||
u32 Size; /**< struct size*/
|
||||
u32 Change; /**< if true, apply this result to hw register*/
|
||||
u32 R_gain; /**< AWB gain for R channel*/
|
||||
u32 G_gain; /**< AWB gain for G channel*/
|
||||
u32 B_gain; /**< AWB gain for B channel*/
|
||||
u32 ColorTmp; /**< Return color temperature*/
|
||||
} ISP_AWB_RESULT;
|
||||
|
||||
// AE statistics data
|
||||
typedef struct
|
||||
{
|
||||
u8 r;
|
||||
u8 g;
|
||||
u8 b;
|
||||
u8 y;
|
||||
} __attribute__((packed, aligned(1))) ISP_AE_SAMPLE;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
u16 u2HistY[_3A_HIST_BINX];
|
||||
} __attribute__((packed, aligned(1))) ISP_HISTX;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
u16 u2IRHist[_3A_IR_HIST_BIN];
|
||||
} __attribute__((packed, aligned(1))) ISP_IR_HISTX;
|
||||
|
||||
/*! @brief ISP report to AE, hardware statistic */
|
||||
typedef struct
|
||||
{
|
||||
u32 Size; /**< struct size*/
|
||||
ISP_HISTX *hist1; /**< HW statistic histogram 1*/
|
||||
ISP_HISTX *hist2; /**< HW statistic histogram 2*/
|
||||
u32 AvgBlkX; /**< HW statistics average block number*/
|
||||
u32 AvgBlkY; /**< HW statistics average block number*/
|
||||
ISP_AE_SAMPLE * avgs; /**< HW statistics average block data*/
|
||||
u32 Shutter; /**< Current shutter in us*/
|
||||
u32 SensorGain; /**< Current Sensor gain, 1X = 1024 */
|
||||
u32 IspGain; /**< Current ISP gain, 1X = 1024*/
|
||||
u32 ShutterHDRShort; /**< Current shutter in us*/
|
||||
u32 SensorGainHDRShort; /**< Current Sensor gain, 1X = 1024 */
|
||||
u32 IspGainHDRShort; /**< Current ISP gain, 1X = 1024*/
|
||||
|
||||
/*CUS3A V1.1*/
|
||||
u32 PreAvgY; /**< Previous frame brightness*/
|
||||
u8 HDRCtlMode; /**< 0 = Separate shutter/sensor gain settings; */
|
||||
/**< 1 = Separate shutter & Share sensor gain settings */
|
||||
u32 FNx10; /**< Aperture in FNx10*/
|
||||
u32 CurFPS; /**Current sensor FPS */
|
||||
u32 PreWeightY; /**< Previous frame brightness with ROI weight*/
|
||||
/*CUS3A V1.2*/
|
||||
ISP_IR_HISTX *histIR; /**< HW statistic histogram IR*/
|
||||
} ISP_AE_INFO;
|
||||
|
||||
//AE algorithm result
|
||||
/*! @brief ISP ae algorithm result*/
|
||||
typedef struct
|
||||
{
|
||||
u32 Size; /**< struct size*/
|
||||
u32 Change; /**< if true, apply this result to hw register*/
|
||||
u32 Shutter; /**< Shutter in us */
|
||||
u32 SensorGain; /**< Sensor gain, 1X = 1024 */
|
||||
u32 IspGain; /**< ISP gain, 1X = 1024 */
|
||||
u32 ShutterHdrShort; /**< Shutter in us */
|
||||
u32 SensorGainHdrShort; /**< Sensor gain, 1X = 1024 */
|
||||
u32 IspGainHdrShort; /**< ISP gain, 1X = 1024 */
|
||||
u32 u4BVx16384; /**< Bv * 16384 in APEX system, EV = Av + Tv = Sv + Bv */
|
||||
u32 AvgY; /**< frame brightness */
|
||||
u32 HdrRatio; /**< hdr ratio, 1X = 1024 */
|
||||
/*CUS3A V1.1*/
|
||||
u32 FNx10; /**< F number * 10*/
|
||||
u32 DebandFPS; /** Target fps when running auto debanding**/
|
||||
u32 WeightY; /**< frame brightness with ROI weight*/
|
||||
/*CUS3A v1.3*/
|
||||
u16 GMBlendRatio; /**< Adaptive Gamma Blending Ratio from AE**/
|
||||
} ISP_AE_RESULT;
|
||||
|
||||
/*! @brief ISP initial status*/
|
||||
typedef struct _isp_ae_init_param
|
||||
{
|
||||
u32 Size; /**< struct size*/
|
||||
char sensor_id[32]; /**< sensor module id*/
|
||||
u32 shutter; /**< shutter Shutter in us*/
|
||||
u32 shutter_step; /**< shutter Shutter step ns*/
|
||||
u32 shutter_min; /**< shutter Shutter min us*/
|
||||
u32 shutter_max; /**< shutter Shutter max us*/
|
||||
u32 sensor_gain; /**< sensor_gain Sensor gain, 1X = 1024*/
|
||||
u32 sensor_gain_min; /**< sensor_gain_min Minimum Sensor gain, 1X = 1024*/
|
||||
u32 sensor_gain_max; /**< sensor_gain_max Maximum Sensor gain, 1X = 1024*/
|
||||
u32 isp_gain; /**< isp_gain Isp digital gain , 1X = 1024 */
|
||||
u32 isp_gain_max; /**< isp_gain Maximum Isp digital gain , 1X = 1024 */
|
||||
u32 FNx10; /**< F number * 10*/
|
||||
u32 fps; /**< initial frame per second*/
|
||||
u32 shutterHDRShort_step; /**< shutter Shutter step ns*/
|
||||
u32 shutterHDRShort_min; /**< shutter Shutter min us*/
|
||||
u32 shutterHDRShort_max; /**< shutter Shutter max us*/
|
||||
u32 sensor_gainHDRShort_min; /**< sensor_gain_min Minimum Sensor gain, 1X = 1024*/
|
||||
u32 sensor_gainHDRShort_max; /**< sensor_gain_max Maximum Sensor gain, 1X = 1024*/
|
||||
u32 AvgBlkX; /**< HW statistics average block number*/
|
||||
u32 AvgBlkY; /**< HW statistics average block number*/
|
||||
} ISP_AE_INIT_PARAM;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
ISP_AE_FPS_SET, /**< ISP notify AE sensor FPS has changed*/
|
||||
} ISP_AE_CTRL_CMD;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
u32 start_x; /*range : 0~1023*/
|
||||
u32 start_y; /*range : 0~1023*/
|
||||
u32 end_x; /*range : 0~1023*/
|
||||
u32 end_y; /*range : 0~1023*/
|
||||
} ISP_AF_RECT;
|
||||
|
||||
/*! @brief ISP initial status*/
|
||||
typedef struct _isp_af_init_param
|
||||
{
|
||||
u32 Size; /**< struct size*/
|
||||
ISP_AF_RECT af_stats_win[16];
|
||||
/*CUS3A v1.3*/
|
||||
u32 CurPos; //motor current position
|
||||
u32 MinPos; //motor minimum position
|
||||
u32 MaxPos; //motor maximum position
|
||||
u32 MinStep;//motor minimum step
|
||||
u32 MaxStep;//motor maximum step
|
||||
} ISP_AF_INIT_PARAM;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
ISP_AF_CMD_MAX,
|
||||
} ISP_AF_CTRL_CMD;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
u8 high_iir[5*16];
|
||||
u8 low_iir[5*16];
|
||||
u8 luma[4*16];
|
||||
u8 sobel_v[5*16];
|
||||
u8 sobel_h[5*16];
|
||||
u8 ysat[3*16];
|
||||
} ISP_AF_INFO_STATS_PARAM_t;
|
||||
//Infinity5. Sync with ISP_AF_STATS
|
||||
|
||||
typedef struct
|
||||
{
|
||||
ISP_AF_INFO_STATS_PARAM_t stParaAPI[MS_CAM_AF_MAX_WIN_NUM];
|
||||
} ISP_AF_INFO_STATS;
|
||||
|
||||
/*! @brief ISP report to AF, hardware statistic */
|
||||
typedef struct
|
||||
{
|
||||
u32 Size; /**< struct size*/
|
||||
ISP_AF_INFO_STATS *pStats; /**< AF statistic*/
|
||||
/*CUS3A v1.3*/
|
||||
u32 CurPos; //motor current position
|
||||
u32 MinPos; //motor minimum position
|
||||
u32 MaxPos; //motor maximum position
|
||||
} ISP_AF_INFO;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
u32 Size; /**< struct size*/
|
||||
u32 Change; /**< if true, apply this result to hw*/
|
||||
u32 NextPos; /**< Next position*/
|
||||
/*CUS3A v1.3*/
|
||||
u32 ChangeParam; /** if true, apply the following 4 results to hw register **/
|
||||
CusAFRoiMode_t ROIMode; /** roi mode configuration**/
|
||||
CusAFWin_t Window[16]; /** AF statistics window position **/
|
||||
CusAFFilter_Geo_t Filter; /** AF filter paramater**/
|
||||
CusAFFilterSq_t FilterSq; /** AF filter square parameter**/
|
||||
} ISP_AF_RESULT;
|
||||
|
||||
/**@brief ISP AE interface*/
|
||||
typedef struct isp_ae_interface
|
||||
{
|
||||
void *pdata; /**< Private data for AE algorithm.*/
|
||||
|
||||
/** @brief AE algorithm init callback
|
||||
@param[in] pdata AE algorithm private data
|
||||
@param[in] init_state ISP initial status.
|
||||
@retval CUS_3A_SUCCESS or CUS_3A_ERROR if error occurs.
|
||||
@remark ISP call this function when AE algorithm initialize.
|
||||
*/
|
||||
int (*init)(void* pdata, ISP_AE_INIT_PARAM *init_state);
|
||||
|
||||
/** @brief AE algorithm close
|
||||
@param[in] pdata AE algorithm private data
|
||||
@remark ISP call this function when AE close.
|
||||
*/
|
||||
void (*release)(void* pdata);
|
||||
|
||||
/** @brief AE algorithm run
|
||||
@param[in] pdata AE algorithm private data
|
||||
@param[in] info ISP HW statistics
|
||||
@param[out] result AE algorithm return calculated result.
|
||||
@remark ISP call this function when AE close.
|
||||
*/
|
||||
void (*run)(void* pdata, const ISP_AE_INFO *info, ISP_AE_RESULT *result);
|
||||
|
||||
/** @brief AE algorithm control
|
||||
@param[in] pdata AE algorithm private data
|
||||
@param[in] cmd Control ID
|
||||
@param[in out] param Control parameter.
|
||||
@retval CUS_3A_SUCCESS or CUS_3A_ERROR if error occurs.
|
||||
@remark ISP call this function to change parameter
|
||||
*/
|
||||
int (*ctrl)(void* pdata, ISP_AE_CTRL_CMD cmd, void* param);
|
||||
} ISP_AE_INTERFACE;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
ISP_AWB_MODE_SET,
|
||||
} ISP_AWB_CTRL_CMD;
|
||||
/**@brief ISP AWB interface*/
|
||||
|
||||
typedef struct isp_awb_interface
|
||||
{
|
||||
void *pdata; /**< Private data for AE algorithm.*/
|
||||
|
||||
/** @brief AWB algorithm init callback
|
||||
@param[in] pdata Algorithm private data
|
||||
@retval CUS_3A_SUCCESS or CUS_3A_ERROR if error occurs.
|
||||
@remark ISP call this function when AE algorithm initialize.
|
||||
*/
|
||||
int (*init)(void *pdata);
|
||||
|
||||
/** @brief AWB algorithm close
|
||||
@param[in] pdata Algorithm private data
|
||||
@remark ISP call this function when AE close.
|
||||
*/
|
||||
void (*release)(void *pdata);
|
||||
|
||||
/** @brief AWB algorithm run
|
||||
@param[in] pdata Algorithm private data
|
||||
@param[in] info ISP HW statistics
|
||||
@param[out] result AWB algorithm return calculated result.
|
||||
@remark ISP call this function when AE close.
|
||||
*/
|
||||
void (*run)(void *pdata, const ISP_AWB_INFO *awb_info, ISP_AWB_RESULT *result);
|
||||
|
||||
/** @brief AWB algorithm control
|
||||
@param[in] pdata Algorithm private data
|
||||
@param[in] cmd Control ID
|
||||
@param[in out] param Control parameter.
|
||||
@retval CUS_3A_SUCCESS or CUS_3A_ERROR if error occurs.
|
||||
@remark ISP call this function to change parameter
|
||||
*/
|
||||
int (*ctrl)(void *pdata, ISP_AWB_CTRL_CMD cmd, void* param);
|
||||
} ISP_AWB_INTERFACE;
|
||||
|
||||
/**@brief ISP AF interface*/
|
||||
typedef struct isp_af_interface
|
||||
{
|
||||
void *pdata; /**< Private data for AF algorithm.*/
|
||||
|
||||
/** @brief AF algorithm init callback
|
||||
@param[in] pdata Algorithm private data
|
||||
@retval CUS_3A_SUCCESS or CUS_3A_ERROR if error occurs.
|
||||
@remark ISP call this function when AF algorithm initialize.
|
||||
*/
|
||||
int (*init)(void *pdata, ISP_AF_INIT_PARAM *param);
|
||||
|
||||
/** @brief AF algorithm close
|
||||
@param[in] pdata Algorithm private data
|
||||
@remark ISP call this function when AF close.
|
||||
*/
|
||||
void (*release)(void *pdata);
|
||||
|
||||
/** @brief AF algorithm run
|
||||
@param[in] pdata Algorithm private data
|
||||
@param[in] info ISP HW statistics
|
||||
@param[out] result AF algorithm return calculated result.
|
||||
@remark ISP call this function when AF close.
|
||||
*/
|
||||
void (*run)(void *pdata, const ISP_AF_INFO *af_info, ISP_AF_RESULT *result);
|
||||
|
||||
/** @brief AF algorithm control
|
||||
@param[in] pdata Algorithm private data
|
||||
@param[in] cmd Control ID
|
||||
@param[in out] param Control parameter.
|
||||
@retval CUS_3A_SUCCESS or CUS_3A_ERROR if error occurs.
|
||||
@remark ISP call this function to change parameter
|
||||
*/
|
||||
int (*ctrl)(void *pdata, ISP_AF_CTRL_CMD cmd, void* param);
|
||||
} ISP_AF_INTERFACE;
|
||||
|
||||
|
||||
unsigned int CUS3A_GetVersion(char* pVerStr);
|
||||
int CUS3A_Init(void);
|
||||
void CUS3A_Release(void);
|
||||
int CUS3A_RegInterface(u32 nCh,ISP_AE_INTERFACE *pAE,ISP_AWB_INTERFACE *pAWB,ISP_AF_INTERFACE *pAF); /*This function is deprecated, use CUS3A_RegInterfaceEX instead*/
|
||||
int CUS3A_AERegInterface(u32 nCh,ISP_AE_INTERFACE *pAE); /*This function is deprecated, use CUS3A_RegInterfaceEX instead*/
|
||||
int CUS3A_AWBRegInterface(u32 nCh,ISP_AWB_INTERFACE *pAWB); /*This function is deprecated, use CUS3A_RegInterfaceEX instead*/
|
||||
int CUS3A_AFRegInterface(u32 nCh,ISP_AF_INTERFACE *pAF); /*This function is deprecated, use CUS3A_RegInterfaceEX instead*/
|
||||
int CUS3A_RegInterfaceEX(u32 nCh ,CUS3A_ALGO_ADAPTOR_e eAdaptor, CUS3A_ALGO_TYPE_e eType, void* pAlgo);
|
||||
int CUS3A_SetAlgoAdaptor(CUS3A_ISP_CH_e nCh, CUS3A_ALGO_ADAPTOR_e eAdaptor, CUS3A_ALGO_TYPE_e eType);
|
||||
int CUS3A_GetAlgoAdaptor(CUS3A_ISP_CH_e nCh, CUS3A_ALGO_TYPE_e eType);
|
||||
|
||||
void* pAllocDmaBuffer(const char* pName, u32 nReqSize, u32 *pPhysAddr, u32 *pMiuAddr, u8 bCache); /*Do not use, This function is for SStar internal use only*/
|
||||
int FreeDmaBuffer(const char* pName, u32 u32MiuAddr, void *pVirtAddr, u32 u32FreeSize); /*Do not use, This function is for SStar internal use only*/
|
||||
int Cus3AOpenIspFrameSync(int *fd0, int *fd1);
|
||||
int Cus3ACloseIspFrameSync(int fd0, int fd1);
|
||||
unsigned int Cus3AWaitIspFrameSync(int fd0, int fd1, int timeout);
|
||||
int CUS3A_AeAvgDownSample(const ISP_AE_SAMPLE *pInBuf, ISP_AE_SAMPLE *pOutBuf, unsigned int nInBlkX, unsigned int nInBlkY, unsigned int nOutBlkX, unsigned int nOutBlkY);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -0,0 +1,58 @@
|
|||
/* SigmaStar trade secret */
|
||||
/* Copyright (c) [2019~2020] SigmaStar Technology.
|
||||
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 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.
|
||||
*/
|
||||
|
||||
/* SigmaStar 3A extension api */
|
||||
#ifndef ISP_SIGMA3A_EXT_H
|
||||
#define ISP_SIGMA3A_EXT_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include "mi_vpe_datatype.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_U32 u32HeadSize; //Size of MIIspApiHeader_t
|
||||
MI_U32 u32DataLen; //Data length;
|
||||
MI_U32 u32CtrlID; //Function ID
|
||||
MI_U32 u32Channel; //Isp channel number
|
||||
MI_U32 u32Dir; //Command direction, 1: Set, 2: Get
|
||||
MI_S32 s32Ret; //Isp api retuen value
|
||||
} MI_CUS3A_IspApiHeader_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_CUS3A_IspApiHeader_t stHeader;
|
||||
MI_U8 u8Data[0];
|
||||
}MI_CUS3A_IspApiCmd_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_U32 u32Dir; // 0: Set, 1: Get
|
||||
//MI_VPE_IspApiData_t stApiData;
|
||||
MI_VPE_IspApiHeader_t stApiHeader;
|
||||
void* pData;
|
||||
}MI_CUS3A_CtrlCmd_t;
|
||||
|
||||
MI_S32 Cus3A_GetIspApiData(MI_VPE_IspApiHeader_t *pCmd, void *pstData);
|
||||
MI_S32 Cus3A_SetIspApiData(MI_VPE_IspApiHeader_t *pCmd, void *pstData);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
116
code/application/sifarsdk/333DE/lib/mi_libs/include/mi_ai.h
Normal file
116
code/application/sifarsdk/333DE/lib/mi_libs/include/mi_ai.h
Normal file
|
@ -0,0 +1,116 @@
|
|||
/* SigmaStar trade secret */
|
||||
/* Copyright (c) [2019~2020] SigmaStar Technology.
|
||||
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 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 __MI_AI_H__
|
||||
#define __MI_AI_H__
|
||||
|
||||
#include "mi_aio_datatype.h"
|
||||
#include "mi_ai_datatype.h"
|
||||
|
||||
|
||||
#define AI_MAJOR_VERSION 2
|
||||
#define AI_SUB_VERSION 17
|
||||
#define MACRO_TO_STR(macro) #macro
|
||||
#define AI_VERSION_STR(major_version,sub_version) ({char *tmp = sub_version/100 ? \
|
||||
"mi_ai_version_" MACRO_TO_STR(major_version)"." MACRO_TO_STR(sub_version) : sub_version/10 ? \
|
||||
"mi_ai_version_" MACRO_TO_STR(major_version)".0" MACRO_TO_STR(sub_version) : \
|
||||
"mi_ai_version_" MACRO_TO_STR(major_version)".00" MACRO_TO_STR(sub_version);tmp;})
|
||||
#define MI_AI_API_VERSION AI_VERSION_STR(AI_MAJOR_VERSION,AI_SUB_VERSION)
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
//=============================================================================
|
||||
// Include files
|
||||
//=============================================================================
|
||||
|
||||
|
||||
//=============================================================================
|
||||
// Extern definition
|
||||
//=============================================================================
|
||||
|
||||
//=============================================================================
|
||||
// Macro definition
|
||||
//=============================================================================
|
||||
|
||||
|
||||
//=============================================================================
|
||||
// Data type definition
|
||||
//=============================================================================
|
||||
|
||||
|
||||
//=============================================================================
|
||||
// Variable definition
|
||||
//=============================================================================
|
||||
|
||||
|
||||
//=============================================================================
|
||||
// Global function definition
|
||||
//=============================================================================
|
||||
MI_S32 MI_AI_SetPubAttr(MI_AUDIO_DEV AiDevId, MI_AUDIO_Attr_t *pstAttr);
|
||||
MI_S32 MI_AI_GetPubAttr(MI_AUDIO_DEV AiDevId, MI_AUDIO_Attr_t*pstAttr);
|
||||
MI_S32 MI_AI_Enable(MI_AUDIO_DEV AiDevId);
|
||||
MI_S32 MI_AI_Disable(MI_AUDIO_DEV AiDevId);
|
||||
MI_S32 MI_AI_EnableChn(MI_AUDIO_DEV AiDevId, MI_AI_CHN AiChn);
|
||||
MI_S32 MI_AI_DisableChn(MI_AUDIO_DEV AiDevId, MI_AI_CHN AiChn);
|
||||
MI_S32 MI_AI_GetFrame(MI_AUDIO_DEV AiDevId, MI_AI_CHN AiChn, MI_AUDIO_Frame_t*pstFrm, MI_AUDIO_AecFrame_t *pstAecFrm , MI_S32 s32MilliSec);
|
||||
MI_S32 MI_AI_ReleaseFrame(MI_AUDIO_DEV AiDevId, MI_AI_CHN AiChn, MI_AUDIO_Frame_t *pstFrm, MI_AUDIO_AecFrame_t *pstAecFrm);
|
||||
MI_S32 MI_AI_SetChnParam(MI_AUDIO_DEV AiDevId, MI_AI_CHN AiChn, MI_AI_ChnParam_t *pstChnParam);
|
||||
MI_S32 MI_AI_GetChnParam(MI_AUDIO_DEV AiDevId, MI_AI_CHN AiChn, MI_AI_ChnParam_t *pstChnParam);
|
||||
MI_S32 MI_AI_EnableReSmp(MI_AUDIO_DEV AiDevId, MI_AI_CHN AiChn, MI_AUDIO_SampleRate_e eOutSampleRate);
|
||||
MI_S32 MI_AI_DisableReSmp(MI_AUDIO_DEV AiDevId, MI_AI_CHN AiChn);
|
||||
MI_S32 MI_AI_SetVqeAttr(MI_AUDIO_DEV AiDevId, MI_AI_CHN AiChn, MI_AUDIO_DEV AoDevId, MI_AO_CHN AoChn, MI_AI_VqeConfig_t *pstVqeConfig);
|
||||
MI_S32 MI_AI_GetVqeAttr(MI_AUDIO_DEV AiDevId, MI_AI_CHN AiChn, MI_AI_VqeConfig_t *pstVqeConfig);
|
||||
MI_S32 MI_AI_EnableVqe(MI_AUDIO_DEV AiDevId, MI_AI_CHN AiChn);
|
||||
MI_S32 MI_AI_DisableVqe(MI_AUDIO_DEV AiDevId, MI_AI_CHN AiChn);
|
||||
MI_S32 MI_AI_ClrPubAttr(MI_AUDIO_DEV AiDevId);
|
||||
MI_S32 MI_AI_SaveFile(MI_AUDIO_DEV AiDevId, MI_AI_CHN AiChn,MI_AUDIO_SaveFileInfo_t *pstSaveFileInfo);
|
||||
MI_S32 MI_AI_SetVqeVolume(MI_AUDIO_DEV AiDevId, MI_AI_CHN AiChn, MI_S32 s32VolumeDb);
|
||||
MI_S32 MI_AI_GetVqeVolume(MI_AUDIO_DEV AiDevId, MI_AI_CHN AiChn, MI_S32 *ps32VolumeDb);
|
||||
MI_S32 MI_AI_SetAencAttr(MI_AUDIO_DEV AiDevId, MI_AI_CHN AiChn, MI_AI_AencConfig_t * pstAencConfig);
|
||||
MI_S32 MI_AI_GetAencAttr(MI_AUDIO_DEV AiDevId, MI_AI_CHN AiChn, MI_AI_AencConfig_t * pstAencConfig);
|
||||
MI_S32 MI_AI_EnableAenc(MI_AUDIO_DEV AiDevId, MI_AI_CHN AiChn);
|
||||
MI_S32 MI_AI_DisableAenc(MI_AUDIO_DEV AiDevId, MI_AI_CHN AiChn);
|
||||
MI_S32 MI_AI_DupChn(MI_AUDIO_DEV AiDevId, MI_AI_CHN AiChn);
|
||||
MI_S32 MI_AI_SetAedAttr(MI_AUDIO_DEV AiDevId, MI_AI_CHN AiChn, MI_AI_AedConfig_t *pstAedConfig);
|
||||
MI_S32 MI_AI_GetAedAttr(MI_AUDIO_DEV AiDevId, MI_AI_CHN AiChn, MI_AI_AedConfig_t *pstAedConfig);
|
||||
MI_S32 MI_AI_EnableAed(MI_AUDIO_DEV AiDevId, MI_AI_CHN AiChn);
|
||||
MI_S32 MI_AI_DisableAed(MI_AUDIO_DEV AiDevId, MI_AI_CHN AiChn);
|
||||
MI_S32 MI_AI_GetAedResult(MI_AUDIO_DEV AiDevId, MI_AI_CHN AiChn, MI_AI_AedResult_t *pstAedResult);
|
||||
MI_S32 MI_AI_SetExtAecChn(MI_AUDIO_DEV AiDevId, MI_AI_CHN AiChn, MI_AI_CHN AiAECSndChn);
|
||||
MI_S32 MI_AI_SetSslInitAttr(MI_AUDIO_DEV AiDevId, MI_AI_CHN AiChn, MI_AI_SslInitAttr_t* pstSslInitAttr);
|
||||
MI_S32 MI_AI_GetSslInitAttr(MI_AUDIO_DEV AiDevId, MI_AI_CHN AiChn, MI_AI_SslInitAttr_t* pstSslInitAttr);
|
||||
MI_S32 MI_AI_SetSslConfigAttr(MI_AUDIO_DEV AiDevId, MI_AI_CHN AiChn, MI_AI_SslConfigAttr_t* pstSslConfigAttr);
|
||||
MI_S32 MI_AI_GetSslConfigAttr(MI_AUDIO_DEV AiDevId, MI_AI_CHN AiChn, MI_AI_SslConfigAttr_t* pstSslConfigAttr);
|
||||
MI_S32 MI_AI_EnableSsl(MI_AUDIO_DEV AiDevId, MI_AI_CHN AiChn);
|
||||
MI_S32 MI_AI_DisableSsl(MI_AUDIO_DEV AiDevId, MI_AI_CHN AiChn);
|
||||
MI_S32 MI_AI_GetSslDoa(MI_AUDIO_DEV AiDevId, MI_AI_CHN AiChn, MI_S32 *ps32SslDoa);
|
||||
MI_S32 MI_AI_SetBfInitAttr(MI_AUDIO_DEV AiDevId, MI_AI_CHN AiChn, MI_AI_BfInitAttr_t* pstBfInitAttr);
|
||||
MI_S32 MI_AI_GetBfInitAttr(MI_AUDIO_DEV AiDevId, MI_AI_CHN AiChn, MI_AI_BfInitAttr_t* pstBfInitAttr);
|
||||
MI_S32 MI_AI_SetBfConfigAttr(MI_AUDIO_DEV AiDevId, MI_AI_CHN AiChn, MI_AI_BfConfigAttr_t* pstBfConfigAttr);
|
||||
MI_S32 MI_AI_GetBfConfigAttr(MI_AUDIO_DEV AiDevId, MI_AI_CHN AiChn, MI_AI_BfConfigAttr_t* pstBfConfigAttr);
|
||||
MI_S32 MI_AI_EnableBf(MI_AUDIO_DEV AiDevId, MI_AI_CHN AiChn);
|
||||
MI_S32 MI_AI_DisableBf(MI_AUDIO_DEV AiDevId, MI_AI_CHN AiChn);
|
||||
MI_S32 MI_AI_SetBfAngle(MI_AUDIO_DEV AiDevId, MI_AI_CHN AiChn, MI_S32 s32BfAngle);
|
||||
MI_S32 MI_AI_SetMute(MI_AUDIO_DEV AiDevId, MI_AI_CHN AiChn, MI_BOOL bMute);
|
||||
MI_S32 MI_AI_GetMute(MI_AUDIO_DEV AiDevId, MI_AI_CHN AiChn, MI_BOOL *pbMute);
|
||||
MI_S32 MI_AI_InitDev(MI_AI_InitParam_t *pstInitParam);
|
||||
MI_S32 MI_AI_DeInitDev(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif ///__MI_AI_H__
|
|
@ -0,0 +1,222 @@
|
|||
/* SigmaStar trade secret */
|
||||
/* Copyright (c) [2019~2020] SigmaStar Technology.
|
||||
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 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 __MI_AI_DATATYPE_H__
|
||||
#define __MI_AI_DATATYPE_H__
|
||||
|
||||
#include "mi_common_datatype.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
//=============================================================================
|
||||
// Include files
|
||||
//=============================================================================
|
||||
|
||||
|
||||
//=============================================================================
|
||||
// Extern definition
|
||||
//=============================================================================
|
||||
|
||||
//=============================================================================
|
||||
// Macro definition
|
||||
//=============================================================================
|
||||
#define _AEC_BAND_NUM (7)
|
||||
|
||||
#define MI_AI_ERR_INVALID_DEVID (MI_DEF_ERR( E_MI_MODULE_ID_AI, E_MI_ERR_LEVEL_ERROR, E_MI_ERR_INVALID_DEVID))
|
||||
#define MI_AI_ERR_ILLEGAL_PARAM (MI_DEF_ERR( E_MI_MODULE_ID_AI, E_MI_ERR_LEVEL_ERROR, E_MI_ERR_ILLEGAL_PARAM))
|
||||
#define MI_AI_ERR_NOT_ENABLED (MI_DEF_ERR( E_MI_MODULE_ID_AI, E_MI_ERR_LEVEL_ERROR, E_MI_ERR_NOT_ENABLE))
|
||||
#define MI_AI_ERR_NULL_PTR (MI_DEF_ERR( E_MI_MODULE_ID_AI, E_MI_ERR_LEVEL_ERROR, E_MI_ERR_NULL_PTR))
|
||||
#define MI_AI_ERR_INVALID_CHNID (MI_DEF_ERR( E_MI_MODULE_ID_AI, E_MI_ERR_LEVEL_ERROR, E_MI_ERR_INVALID_CHNID))
|
||||
#define MI_AI_ERR_NOT_CONFIG (MI_DEF_ERR( E_MI_MODULE_ID_AI, E_MI_ERR_LEVEL_ERROR, E_MI_ERR_NOT_CONFIG))
|
||||
#define MI_AI_ERR_NOT_SUPPORT (MI_DEF_ERR( E_MI_MODULE_ID_AI, E_MI_ERR_LEVEL_ERROR, E_MI_ERR_NOT_SUPPORT))
|
||||
#define MI_AI_ERR_NOT_PERM (MI_DEF_ERR( E_MI_MODULE_ID_AI, E_MI_ERR_LEVEL_ERROR, E_MI_ERR_NOT_PERM))
|
||||
#define MI_AI_ERR_NOMEM (MI_DEF_ERR( E_MI_MODULE_ID_AI, E_MI_ERR_LEVEL_ERROR, E_MI_ERR_NOMEM))
|
||||
#define MI_AI_ERR_NOBUF (MI_DEF_ERR( E_MI_MODULE_ID_AI, E_MI_ERR_LEVEL_ERROR, E_MI_ERR_NOBUF))
|
||||
#define MI_AI_ERR_BUF_EMPTY (MI_DEF_ERR( E_MI_MODULE_ID_AI, E_MI_ERR_LEVEL_ERROR, E_MI_ERR_BUF_EMPTY))
|
||||
#define MI_AI_ERR_BUF_FULL (MI_DEF_ERR( E_MI_MODULE_ID_AI, E_MI_ERR_LEVEL_ERROR, E_MI_ERR_BUF_FULL))
|
||||
#define MI_AI_ERR_SYS_NOTREADY (MI_DEF_ERR( E_MI_MODULE_ID_AI, E_MI_ERR_LEVEL_ERROR, E_MI_ERR_SYS_NOTREADY))
|
||||
#define MI_AI_ERR_BUSY (MI_DEF_ERR( E_MI_MODULE_ID_AI, E_MI_ERR_LEVEL_ERROR, E_MI_ERR_BUSY))
|
||||
#define MI_AI_ERR_VQE_ERR (MI_DEF_ERR( E_MI_MODULE_ID_AI, E_MI_ERR_LEVEL_ERROR, E_MI_AI_VQE_ERR))
|
||||
#define MI_AI_ERR_AENC_ERR (MI_DEF_ERR( E_MI_MODULE_ID_AI, E_MI_ERR_LEVEL_ERROR, E_MI_AI_AENC_ERR))
|
||||
#define MI_AI_ERR_AED_ERR (MI_DEF_ERR( E_MI_MODULE_ID_AI, E_MI_ERR_LEVEL_ERROR, E_MI_AI_AED_ERR))
|
||||
#define MI_AI_ERR_SSL_ERR (MI_DEF_ERR( E_MI_MODULE_ID_AI, E_MI_ERR_LEVEL_ERROR, E_MI_AI_SSL_ERR))
|
||||
#define MI_AI_ERR_BF_ERR (MI_DEF_ERR( E_MI_MODULE_ID_AI, E_MI_ERR_LEVEL_ERROR, E_MI_AI_BF_ERR))
|
||||
|
||||
//=============================================================================
|
||||
// Data type definition
|
||||
//=============================================================================
|
||||
typedef enum
|
||||
{
|
||||
E_MI_AI_VQE_ERR = MI_AI_INITIAL_ERROR_CODE, /* VQE of AI error */
|
||||
E_MI_AI_AENC_ERR,
|
||||
E_MI_AI_AED_ERR,
|
||||
E_MI_AI_SSL_ERR,
|
||||
E_MI_AI_BF_ERR,
|
||||
} MI_AI_ErrCode_e;
|
||||
|
||||
typedef struct MI_AI_ChnGainConfig_s
|
||||
{
|
||||
MI_BOOL bEnableGainSet;
|
||||
MI_S16 s16FrontGain;
|
||||
MI_S16 s16RearGain;
|
||||
} MI_AI_ChnGainConfig_t;
|
||||
|
||||
typedef struct MI_AI_ChnParam_s
|
||||
{
|
||||
MI_AI_ChnGainConfig_t stChnGain;
|
||||
MI_U32 u32Reserved;
|
||||
} MI_AI_ChnParam_t;
|
||||
|
||||
typedef struct MI_AI_AecConfig_s
|
||||
{
|
||||
MI_BOOL bComfortNoiseEnable;
|
||||
MI_S16 s16DelaySample;
|
||||
MI_U32 u32AecSupfreq[_AEC_BAND_NUM-1];
|
||||
MI_U32 u32AecSupIntensity[_AEC_BAND_NUM];
|
||||
MI_S32 s32Reserved;
|
||||
} MI_AI_AecConfig_t;
|
||||
|
||||
typedef struct MI_AI_VqeConfig_s
|
||||
{
|
||||
MI_BOOL bHpfOpen;
|
||||
MI_BOOL bAecOpen;
|
||||
MI_BOOL bAnrOpen;
|
||||
MI_BOOL bAgcOpen;
|
||||
MI_BOOL bEqOpen;
|
||||
MI_U32 u32ChnNum;
|
||||
MI_S32 s32WorkSampleRate;
|
||||
MI_S32 s32FrameSample;
|
||||
MI_AUDIO_HpfConfig_t stHpfCfg;
|
||||
MI_AI_AecConfig_t stAecCfg;
|
||||
MI_AUDIO_AnrConfig_t stAnrCfg;
|
||||
MI_AUDIO_AgcConfig_t stAgcCfg;
|
||||
MI_AUDIO_EqConfig_t stEqCfg;
|
||||
} MI_AI_VqeConfig_t;
|
||||
|
||||
|
||||
typedef enum{
|
||||
E_MI_AUDIO_AENC_TYPE_G711A = 0,
|
||||
E_MI_AUDIO_AENC_TYPE_G711U,
|
||||
E_MI_AUDIO_AENC_TYPE_G726,
|
||||
E_MI_AUDIO_AENC_TYPE_INVALID,
|
||||
} MI_AUDIO_AencType_e;
|
||||
|
||||
|
||||
typedef struct MI_AUDIO_AencG711Config_s{
|
||||
MI_AUDIO_SampleRate_e eSamplerate;
|
||||
MI_AUDIO_SoundMode_e eSoundmode;
|
||||
} MI_AUDIO_AencG711Config_t;
|
||||
|
||||
typedef struct MI_AUDIO_AencG726Config_s{
|
||||
MI_AUDIO_SampleRate_e eSamplerate;
|
||||
MI_AUDIO_SoundMode_e eSoundmode;
|
||||
MI_AUDIO_G726Mode_e eG726Mode;
|
||||
} MI_AUDIO_AencG726Config_t;
|
||||
|
||||
typedef struct MI_AI_AencConfig_s{
|
||||
MI_AUDIO_AencType_e eAencType;
|
||||
union
|
||||
{
|
||||
MI_AUDIO_AencG711Config_t stAencG711Cfg;
|
||||
MI_AUDIO_AencG726Config_t stAencG726Cfg;
|
||||
};
|
||||
} MI_AI_AencConfig_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
E_MI_AUDIO_BABYCRY_SEN_LOW,
|
||||
E_MI_AUDIO_BABYCRY_SEN_MID,
|
||||
E_MI_AUDIO_BABYCRY_SEN_HIGH,
|
||||
E_MI_AUDIO_BABYCRY_SEN_INVALID,
|
||||
} MI_AUDIO_BabyCrySensitivity_e;
|
||||
|
||||
typedef struct MI_AI_BabyCryConfig_s
|
||||
{
|
||||
MI_BOOL bEnableNr;
|
||||
MI_AUDIO_BabyCrySensitivity_e eSensitivity;
|
||||
MI_S32 s32OperatingPoint;
|
||||
MI_S32 s32VadThresholdDb;
|
||||
} MI_AI_BabyCryConfig_t;
|
||||
|
||||
typedef struct MI_AI_LsdConfig_s
|
||||
{
|
||||
MI_S32 s32LsdThresholdDb;
|
||||
} MI_AI_LsdConfig_t;
|
||||
|
||||
typedef struct MI_AI_AedConfig_s
|
||||
{
|
||||
MI_BOOL bEnableBabyCry;
|
||||
MI_AI_BabyCryConfig_t stBabyCryConfig;
|
||||
MI_BOOL bEnableLsd;
|
||||
MI_AI_LsdConfig_t stLsdConfig;
|
||||
} MI_AI_AedConfig_t;
|
||||
|
||||
typedef struct MI_AI_AedResult_s
|
||||
{
|
||||
MI_BOOL bAcousticEventDetected;
|
||||
MI_BOOL bLoudSoundDetected;
|
||||
} MI_AI_AedResult_t;
|
||||
|
||||
typedef struct MI_AI_SslInitAttr_s
|
||||
{
|
||||
MI_U32 u32MicDistance;
|
||||
MI_BOOL bBfMode;
|
||||
} MI_AI_SslInitAttr_t;
|
||||
|
||||
typedef struct MI_AI_SslConfigAttr_s
|
||||
{
|
||||
MI_S32 s32Temperature;
|
||||
MI_S32 s32NoiseGateDbfs;
|
||||
MI_S32 s32DirectionFrameNum;
|
||||
|
||||
} MI_AI_SslConfigAttr_t;
|
||||
|
||||
typedef struct MI_AI_BfInitAttr_s
|
||||
{
|
||||
MI_U32 u32MicDistance;
|
||||
MI_U32 u32ChanCnt;
|
||||
} MI_AI_BfInitAttr_t;
|
||||
|
||||
typedef struct MI_AI_BfConfigAttr_s
|
||||
{
|
||||
MI_S32 s32Temperature;
|
||||
MI_S32 s32NoiseGateDbfs;
|
||||
MI_S32 s32NoiseSupressionMode;
|
||||
MI_S32 s32NoiseEstimation;
|
||||
MI_FLOAT outputGain;
|
||||
} MI_AI_BfConfigAttr_t;
|
||||
|
||||
typedef struct MI_AI_InitParam_s
|
||||
{
|
||||
MI_U32 u32DevId;
|
||||
MI_U8 *u8Data;
|
||||
} MI_AI_InitParam_t;
|
||||
|
||||
//=============================================================================
|
||||
// Variable definition
|
||||
//=============================================================================
|
||||
|
||||
|
||||
//=============================================================================
|
||||
// Global function definition
|
||||
//=============================================================================
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif //__MI_AI_DATATYPE_H__
|
50
code/application/sifarsdk/333DE/lib/mi_libs/include/mi_aio.h
Normal file
50
code/application/sifarsdk/333DE/lib/mi_libs/include/mi_aio.h
Normal file
|
@ -0,0 +1,50 @@
|
|||
/* SigmaStar trade secret */
|
||||
/* Copyright (c) [2019~2020] SigmaStar Technology.
|
||||
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 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 _MI_AIO_DEP_H_
|
||||
#define _MI_AIO_DEP_H_
|
||||
|
||||
|
||||
//=============================================================================
|
||||
// Include files
|
||||
//=============================================================================
|
||||
|
||||
|
||||
//=============================================================================
|
||||
// Extern definition
|
||||
//=============================================================================
|
||||
|
||||
//=============================================================================
|
||||
// Macro definition
|
||||
//=============================================================================
|
||||
|
||||
|
||||
//=============================================================================
|
||||
// Data type definition
|
||||
//=============================================================================
|
||||
|
||||
|
||||
|
||||
|
||||
//=============================================================================
|
||||
// Variable definition
|
||||
//=============================================================================
|
||||
|
||||
|
||||
//=============================================================================
|
||||
// Global function definition
|
||||
//=============================================================================
|
||||
|
||||
|
||||
#endif // _MI_AIO_DEP_H_
|
|
@ -0,0 +1,227 @@
|
|||
/* SigmaStar trade secret */
|
||||
/* Copyright (c) [2019~2020] SigmaStar Technology.
|
||||
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 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 _MI_AIO_DEP_DATATYPE_H_
|
||||
#define _MI_AIO_DEP_DATATYPE_H_
|
||||
|
||||
#include "mi_sys_datatype.h"
|
||||
|
||||
//=============================================================================
|
||||
// Include files
|
||||
//=============================================================================
|
||||
|
||||
|
||||
//=============================================================================
|
||||
// Extern definition
|
||||
//=============================================================================
|
||||
|
||||
//=============================================================================
|
||||
// Macro definition
|
||||
//=============================================================================
|
||||
#define MI_AUDIO_MAX_CHN_NUM (16)
|
||||
#define _NR_BAND_NUM (7)
|
||||
#define _EQ_BAND_NUM (129)
|
||||
#define _AGC_BAND_NUM (7)
|
||||
|
||||
//=============================================================================
|
||||
// Data type definition
|
||||
//=============================================================================
|
||||
typedef enum
|
||||
{
|
||||
E_MI_AUDIO_ALGORITHM_MODE_DEFAULT,
|
||||
E_MI_AUDIO_ALGORITHM_MODE_USER,
|
||||
E_MI_AUDIO_ALGORITHM_MODE_MUSIC,
|
||||
E_MI_AUDIO_ALGORITHM_MODE_INVALID,
|
||||
}MI_AUDIO_AlgorithmMode_e;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
E_MI_AUDIO_SAMPLE_RATE_8000 = 8000, /* 8kHz sampling rate */
|
||||
E_MI_AUDIO_SAMPLE_RATE_11025 = 11025, /* 11.025kHz sampling rate */
|
||||
E_MI_AUDIO_SAMPLE_RATE_12000 = 12000, /* 12kHz sampling rate */
|
||||
E_MI_AUDIO_SAMPLE_RATE_16000 = 16000, /* 16kHz sampling rate */
|
||||
E_MI_AUDIO_SAMPLE_RATE_22050 = 22050, /* 22.05kHz sampling rate */
|
||||
E_MI_AUDIO_SAMPLE_RATE_24000 = 24000, /* 24kHz sampling rate */
|
||||
E_MI_AUDIO_SAMPLE_RATE_32000 = 32000, /* 32kHz sampling rate */
|
||||
E_MI_AUDIO_SAMPLE_RATE_44100 = 44100, /* 44.1kHz sampling rate */
|
||||
E_MI_AUDIO_SAMPLE_RATE_48000 = 48000, /* 48kHz sampling rate */
|
||||
E_MI_AUDIO_SAMPLE_RATE_96000 = 96000, /* 96kHz sampling rate */
|
||||
E_MI_AUDIO_SAMPLE_RATE_INVALID,
|
||||
}MI_AUDIO_SampleRate_e;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
E_MI_AUDIO_BIT_WIDTH_16 =0, /* 16bit width */
|
||||
E_MI_AUDIO_BIT_WIDTH_24 =1, /* 24bit width */
|
||||
E_MI_AUDIO_BIT_WIDTH_MAX,
|
||||
}MI_AUDIO_BitWidth_e;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
E_MI_AUDIO_MODE_I2S_MASTER, /* I2S master mode */
|
||||
E_MI_AUDIO_MODE_I2S_SLAVE, /* I2S slave mode */
|
||||
E_MI_AUDIO_MODE_TDM_MASTER, /* TDM master mode */
|
||||
E_MI_AUDIO_MODE_TDM_SLAVE, /* TDM slave mode */
|
||||
E_MI_AUDIO_MODE_MAX,
|
||||
}MI_AUDIO_Mode_e;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
E_MI_AUDIO_SOUND_MODE_MONO = 0, /* mono */
|
||||
E_MI_AUDIO_SOUND_MODE_STEREO = 1, /* stereo */
|
||||
E_MI_AUDIO_SOUND_MODE_QUEUE = 2, /* all data in One chn */
|
||||
E_MI_AUDIO_SOUND_MODE_MAX,
|
||||
}MI_AUDIO_SoundMode_e;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
E_MI_AUDIO_HPF_FREQ_80 = 80, /* 80Hz */
|
||||
E_MI_AUDIO_HPF_FREQ_120 = 120, /* 120Hz */
|
||||
E_MI_AUDIO_HPF_FREQ_150 = 150, /* 150Hz */
|
||||
E_MI_AUDIO_HPF_FREQ_INVALID,
|
||||
}MI_AUDIO_HpfFreq_e;
|
||||
|
||||
typedef enum {
|
||||
E_MI_AUDIO_NR_SPEED_LOW,
|
||||
E_MI_AUDIO_NR_SPEED_MID,
|
||||
E_MI_AUDIO_NR_SPEED_HIGH
|
||||
}MI_AUDIO_NrSpeed_e;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
E_MI_AUDIO_I2S_FMT_I2S_MSB,
|
||||
E_MI_AUDIO_I2S_FMT_LEFT_JUSTIFY_MSB,
|
||||
}MI_AUDIO_I2sFmt_e;
|
||||
|
||||
typedef enum{
|
||||
E_MI_AUDIO_I2S_MCLK_0, //not enable
|
||||
E_MI_AUDIO_I2S_MCLK_12_288M, //12.288M
|
||||
E_MI_AUDIO_I2S_MCLK_16_384M, //16.384M
|
||||
E_MI_AUDIO_I2S_MCLK_18_432M, //18.432M
|
||||
E_MI_AUDIO_I2S_MCLK_24_576M, //24.576M
|
||||
E_MI_AUDIO_I2S_MCLK_24M, // 24MHz
|
||||
E_MI_AUDIO_I2S_MCLK_48M, // 48MHz
|
||||
}MI_AUDIO_I2sMclk_e;
|
||||
|
||||
typedef struct MI_AUDIO_I2sConfig_s
|
||||
{
|
||||
MI_AUDIO_I2sFmt_e eFmt;
|
||||
MI_AUDIO_I2sMclk_e eMclk;
|
||||
MI_BOOL bSyncClock; //I2s Tx BCLK, Rx BCLK use the same clock source
|
||||
}MI_AUDIO_I2sConfig_t;
|
||||
|
||||
typedef struct MI_AUDIO_Attr_s
|
||||
{
|
||||
MI_AUDIO_SampleRate_e eSamplerate; /* sample rate */
|
||||
MI_AUDIO_BitWidth_e eBitwidth; /* bitwidth */
|
||||
MI_AUDIO_Mode_e eWorkmode; /* I2s master or slave mode */
|
||||
MI_AUDIO_SoundMode_e eSoundmode; /* mono or stereo */
|
||||
MI_U32 u32FrmNum; /* frame num in buffer */
|
||||
MI_U32 u32PtNumPerFrm; /* number of samples */
|
||||
MI_U32 u32CodecChnCnt; /* channel number on Codec */
|
||||
MI_U32 u32ChnCnt;
|
||||
union{
|
||||
MI_AUDIO_I2sConfig_t stI2sConfig;
|
||||
}WorkModeSetting;
|
||||
|
||||
}MI_AUDIO_Attr_t;
|
||||
|
||||
typedef struct MI_AUDIO_Frame_s
|
||||
{
|
||||
MI_AUDIO_BitWidth_e eBitwidth; /* audio frame bitwidth */
|
||||
MI_AUDIO_SoundMode_e eSoundmode; /* audio frame momo or stereo mode */
|
||||
void *apVirAddr[MI_AUDIO_MAX_CHN_NUM];
|
||||
MI_U64 u64TimeStamp; /* audio frame timestamp */
|
||||
MI_U32 u32Seq; /* audio frame seq */
|
||||
MI_U32 u32Len[MI_AUDIO_MAX_CHN_NUM]; /* data lenth per channel in frame */
|
||||
MI_U32 au32PoolId[2];
|
||||
/* Only use for Ai */
|
||||
void *apSrcPcmVirAddr[MI_AUDIO_MAX_CHN_NUM]; /* Ai original pcm data from ai channel */
|
||||
MI_U32 u32SrcPcmLen[MI_AUDIO_MAX_CHN_NUM]; /* length of Ai original pcm data */
|
||||
|
||||
}MI_AUDIO_Frame_t;
|
||||
|
||||
typedef struct MI_AUDIO_AecFrame_s
|
||||
{
|
||||
MI_AUDIO_Frame_t stRefFrame; /* aec reference audio frame */
|
||||
MI_BOOL bValid; /* whether frame is valid */
|
||||
}MI_AUDIO_AecFrame_t;
|
||||
|
||||
typedef struct MI_AUDIO_SaveFileInfo_s
|
||||
{
|
||||
MI_BOOL bCfg;
|
||||
MI_U8 szFilePath[256];
|
||||
MI_U32 u32FileSize; /*in KB*/
|
||||
}MI_AUDIO_SaveFileInfo_t;
|
||||
|
||||
typedef struct MI_AUDIO_HpfConfig_s
|
||||
{
|
||||
MI_AUDIO_AlgorithmMode_e eMode;
|
||||
MI_AUDIO_HpfFreq_e eHpfFreq; /*freq to be processed*/
|
||||
}MI_AUDIO_HpfConfig_t;
|
||||
|
||||
typedef struct MI_AUDIO_AnrConfig_s
|
||||
{
|
||||
MI_AUDIO_AlgorithmMode_e eMode;
|
||||
MI_U32 u32NrIntensityBand[_NR_BAND_NUM - 1];
|
||||
MI_U32 u32NrIntensity[_NR_BAND_NUM];
|
||||
MI_U32 u32NrSmoothLevel;
|
||||
MI_AUDIO_NrSpeed_e eNrSpeed;
|
||||
}MI_AUDIO_AnrConfig_t;
|
||||
|
||||
typedef struct AgcGainInfo_s{
|
||||
MI_S32 s32GainMax;
|
||||
MI_S32 s32GainMin;
|
||||
MI_S32 s32GainInit;
|
||||
}AgcGainInfo_t;
|
||||
|
||||
typedef struct MI_AUDIO_AgcConfig_s
|
||||
{
|
||||
MI_AUDIO_AlgorithmMode_e eMode;
|
||||
AgcGainInfo_t stAgcGainInfo;
|
||||
MI_U32 u32DropGainMax;
|
||||
MI_U32 u32AttackTime;
|
||||
MI_U32 u32ReleaseTime;
|
||||
MI_S16 s16Compression_ratio_input[_AGC_BAND_NUM];
|
||||
MI_S16 s16Compression_ratio_output[_AGC_BAND_NUM];
|
||||
MI_S32 s32DropGainThreshold;
|
||||
MI_S32 s32NoiseGateDb;
|
||||
MI_U32 u32NoiseGateAttenuationDb;
|
||||
}MI_AUDIO_AgcConfig_t;
|
||||
|
||||
typedef struct MI_AUDIO_EqConfig_s
|
||||
{
|
||||
MI_AUDIO_AlgorithmMode_e eMode;
|
||||
MI_S16 s16EqGainDb[_EQ_BAND_NUM];
|
||||
}MI_AUDIO_EqConfig_t;
|
||||
|
||||
typedef enum{
|
||||
E_MI_AUDIO_G726_MODE_16 = 0,
|
||||
E_MI_AUDIO_G726_MODE_24,
|
||||
E_MI_AUDIO_G726_MODE_32,
|
||||
E_MI_AUDIO_G726_MODE_40,
|
||||
E_MI_AUDIO_G726_MODE_INVALID,
|
||||
}MI_AUDIO_G726Mode_e;
|
||||
|
||||
//=============================================================================
|
||||
// Variable definition
|
||||
//=============================================================================
|
||||
|
||||
|
||||
//=============================================================================
|
||||
// Global function definition
|
||||
//=============================================================================
|
||||
|
||||
|
||||
#endif // _MI_AIO_DEP_DATATYPE_H_
|
97
code/application/sifarsdk/333DE/lib/mi_libs/include/mi_ao.h
Normal file
97
code/application/sifarsdk/333DE/lib/mi_libs/include/mi_ao.h
Normal file
|
@ -0,0 +1,97 @@
|
|||
/* SigmaStar trade secret */
|
||||
/* Copyright (c) [2019~2020] SigmaStar Technology.
|
||||
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 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 __MI_AO_H__
|
||||
#define __MI_AO_H__
|
||||
|
||||
#include "mi_aio_datatype.h"
|
||||
#include "mi_ao_datatype.h"
|
||||
|
||||
#define AO_MAJOR_VERSION 2
|
||||
#define AO_SUB_VERSION 16
|
||||
#define MACRO_TO_STR(macro) #macro
|
||||
#define AO_VERSION_STR(major_version,sub_version) ({char *tmp = sub_version/100 ? \
|
||||
"mi_ao_version_" MACRO_TO_STR(major_version)"." MACRO_TO_STR(sub_version) : sub_version/10 ? \
|
||||
"mi_ao_version_" MACRO_TO_STR(major_version)".0" MACRO_TO_STR(sub_version) : \
|
||||
"mi_ao_version_" MACRO_TO_STR(major_version)".00" MACRO_TO_STR(sub_version);tmp;})
|
||||
#define MI_AO_API_VERSION AO_VERSION_STR(AO_MAJOR_VERSION,AO_SUB_VERSION)
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
//=============================================================================
|
||||
// Include files
|
||||
//=============================================================================
|
||||
|
||||
|
||||
//=============================================================================
|
||||
// Extern definition
|
||||
//=============================================================================
|
||||
|
||||
//=============================================================================
|
||||
// Macro definition
|
||||
//=============================================================================
|
||||
|
||||
|
||||
//=============================================================================
|
||||
// Data type definition
|
||||
//=============================================================================
|
||||
|
||||
|
||||
//=============================================================================
|
||||
// Variable definition
|
||||
//=============================================================================
|
||||
|
||||
|
||||
//=============================================================================
|
||||
// Global function definition
|
||||
//=============================================================================
|
||||
MI_S32 MI_AO_SetPubAttr(MI_AUDIO_DEV AoDevId, MI_AUDIO_Attr_t *pstAttr);
|
||||
MI_S32 MI_AO_GetPubAttr(MI_AUDIO_DEV AoDevId, MI_AUDIO_Attr_t *pstAttr);
|
||||
MI_S32 MI_AO_Enable(MI_AUDIO_DEV AoDevId);
|
||||
MI_S32 MI_AO_Disable(MI_AUDIO_DEV AoDevId);
|
||||
MI_S32 MI_AO_EnableChn(MI_AUDIO_DEV AoDevId, MI_AO_CHN AoChn);
|
||||
MI_S32 MI_AO_DupChn(MI_AUDIO_DEV AoDevId, MI_AO_CHN AoChn);
|
||||
MI_S32 MI_AO_DisableChn(MI_AUDIO_DEV AoDevId, MI_AO_CHN AoChn);
|
||||
MI_S32 MI_AO_SendFrame(MI_AUDIO_DEV AoDevId, MI_AO_CHN AoChn, MI_AUDIO_Frame_t *pstData, MI_S32 s32MilliSec);
|
||||
MI_S32 MI_AO_EnableReSmp(MI_AUDIO_DEV AoDevId, MI_AO_CHN AoChn, MI_AUDIO_SampleRate_e eInSampleRate);
|
||||
MI_S32 MI_AO_DisableReSmp(MI_AUDIO_DEV AiDevId, MI_AO_CHN AoChn);
|
||||
MI_S32 MI_AO_PauseChn(MI_AUDIO_DEV AoDevId, MI_AO_CHN AoChn);
|
||||
MI_S32 MI_AO_ResumeChn(MI_AUDIO_DEV AoDevId, MI_AO_CHN AoChn);
|
||||
MI_S32 MI_AO_ClearChnBuf(MI_AUDIO_DEV AoDevId, MI_AO_CHN AoChn);
|
||||
MI_S32 MI_AO_QueryChnStat(MI_AUDIO_DEV AoDevId , MI_AO_CHN AoChn, MI_AO_ChnState_t *pstStatus);
|
||||
MI_S32 MI_AO_SetVolume(MI_AUDIO_DEV AoDevId, MI_AO_CHN AoChn, MI_S32 s32VolumeDb, MI_AO_GainFading_e eFading);
|
||||
MI_S32 MI_AO_GetVolume(MI_AUDIO_DEV AoDevId, MI_AO_CHN AoChn, MI_S32 *ps32VolumeDb);
|
||||
MI_S32 MI_AO_SetMute(MI_AUDIO_DEV AoDevId, MI_AO_CHN AoChn, MI_BOOL bEnable);
|
||||
MI_S32 MI_AO_GetMute(MI_AUDIO_DEV AoDevId, MI_AO_CHN AoChn, MI_BOOL *pbEnable);
|
||||
MI_S32 MI_AO_ClrPubAttr(MI_AUDIO_DEV AoDevId);
|
||||
MI_S32 MI_AO_SetVqeAttr(MI_AUDIO_DEV AoDevId, MI_AO_CHN AoChn, MI_AO_VqeConfig_t *pstVqeConfig);
|
||||
MI_S32 MI_AO_GetVqeAttr(MI_AUDIO_DEV AoDevId, MI_AO_CHN AoChn, MI_AO_VqeConfig_t *pstVqeConfig);
|
||||
MI_S32 MI_AO_EnableVqe(MI_AUDIO_DEV AoDevId, MI_AO_CHN AoChn);
|
||||
MI_S32 MI_AO_DisableVqe(MI_AUDIO_DEV AoDevId, MI_AO_CHN AoChn);
|
||||
MI_S32 MI_AO_SetAdecAttr(MI_AUDIO_DEV AoDevId, MI_AO_CHN AoChn, MI_AO_AdecConfig_t *pstAdecConfig);
|
||||
MI_S32 MI_AO_GetAdecAttr(MI_AUDIO_DEV AoDevId, MI_AO_CHN AoChn, MI_AO_AdecConfig_t *pstAdecConfig);
|
||||
MI_S32 MI_AO_EnableAdec(MI_AUDIO_DEV AoDevId, MI_AO_CHN AoChn);
|
||||
MI_S32 MI_AO_DisableAdec(MI_AUDIO_DEV AoDevId, MI_AO_CHN AoChn);
|
||||
MI_S32 MI_AO_SetChnParam(MI_AUDIO_DEV AoDevId, MI_AO_CHN AoChn, MI_AO_ChnParam_t *pstChnParam);
|
||||
MI_S32 MI_AO_GetChnParam(MI_AUDIO_DEV AoDevId, MI_AO_CHN AoChn, MI_AO_ChnParam_t *pstChnParam);
|
||||
MI_S32 MI_AO_SetSrcGain(MI_AUDIO_DEV AoDevId, MI_S32 s32VolumeDb);
|
||||
MI_S32 MI_AO_InitDev(MI_AO_InitParam_t *pstInitParam);
|
||||
MI_S32 MI_AO_DeInitDev(void);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif///__MI_AO_H__
|
|
@ -0,0 +1,156 @@
|
|||
/* SigmaStar trade secret */
|
||||
/* Copyright (c) [2019~2020] SigmaStar Technology.
|
||||
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 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 __MI_AO_DATATYPE_H__
|
||||
#define __MI_AO_DATATYPE_H__
|
||||
|
||||
#include "mi_common_datatype.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
//=============================================================================
|
||||
// Include files
|
||||
//=============================================================================
|
||||
|
||||
|
||||
//=============================================================================
|
||||
// Extern definition
|
||||
//=============================================================================
|
||||
|
||||
//=============================================================================
|
||||
// Macro definition
|
||||
//=============================================================================
|
||||
|
||||
#define MI_AO_ERR_INVALID_DEVID (MI_DEF_ERR( E_MI_MODULE_ID_AO, E_MI_ERR_LEVEL_ERROR, E_MI_ERR_INVALID_DEVID))
|
||||
#define MI_AO_ERR_ILLEGAL_PARAM (MI_DEF_ERR( E_MI_MODULE_ID_AO, E_MI_ERR_LEVEL_ERROR, E_MI_ERR_ILLEGAL_PARAM))
|
||||
#define MI_AO_ERR_NOT_ENABLED (MI_DEF_ERR( E_MI_MODULE_ID_AO, E_MI_ERR_LEVEL_ERROR, E_MI_ERR_NOT_ENABLE))
|
||||
#define MI_AO_ERR_NULL_PTR (MI_DEF_ERR( E_MI_MODULE_ID_AO, E_MI_ERR_LEVEL_ERROR, E_MI_ERR_NULL_PTR))
|
||||
#define MI_AO_ERR_INVALID_CHNID (MI_DEF_ERR( E_MI_MODULE_ID_AO, E_MI_ERR_LEVEL_ERROR, E_MI_ERR_INVALID_CHNID))
|
||||
#define MI_AO_ERR_NOT_CONFIG (MI_DEF_ERR( E_MI_MODULE_ID_AO, E_MI_ERR_LEVEL_ERROR, E_MI_ERR_NOT_CONFIG))
|
||||
#define MI_AO_ERR_NOT_SUPPORT (MI_DEF_ERR( E_MI_MODULE_ID_AO, E_MI_ERR_LEVEL_ERROR, E_MI_ERR_NOT_SUPPORT))
|
||||
#define MI_AO_ERR_NOT_PERM (MI_DEF_ERR( E_MI_MODULE_ID_AO, E_MI_ERR_LEVEL_ERROR, E_MI_ERR_NOT_PERM))
|
||||
#define MI_AO_ERR_NOMEM (MI_DEF_ERR( E_MI_MODULE_ID_AO, E_MI_ERR_LEVEL_ERROR, E_MI_ERR_NOMEM))
|
||||
#define MI_AO_ERR_NOBUF (MI_DEF_ERR( E_MI_MODULE_ID_AO, E_MI_ERR_LEVEL_ERROR, E_MI_ERR_NOBUF))
|
||||
#define MI_AO_ERR_BUF_EMPTY (MI_DEF_ERR( E_MI_MODULE_ID_AO, E_MI_ERR_LEVEL_ERROR, E_MI_ERR_BUF_EMPTY))
|
||||
#define MI_AO_ERR_BUF_FULL (MI_DEF_ERR( E_MI_MODULE_ID_AO, E_MI_ERR_LEVEL_ERROR, E_MI_ERR_BUF_FULL))
|
||||
#define MI_AO_ERR_SYS_NOTREADY (MI_DEF_ERR( E_MI_MODULE_ID_AO, E_MI_ERR_LEVEL_ERROR, E_MI_ERR_SYS_NOTREADY))
|
||||
#define MI_AO_ERR_BUSY (MI_DEF_ERR( E_MI_MODULE_ID_AO, E_MI_ERR_LEVEL_ERROR, E_MI_ERR_BUSY))
|
||||
#define MI_AO_ERR_VQE_ERR (MI_DEF_ERR( E_MI_MODULE_ID_AO, E_MI_ERR_LEVEL_ERROR, E_MI_AO_VQE_ERR))
|
||||
#define MI_AO_ERR_ADEC_ERR (MI_DEF_ERR( E_MI_MODULE_ID_AO, E_MI_ERR_LEVEL_ERROR, E_MI_AO_ADEC_ERR))
|
||||
//=============================================================================
|
||||
// Data type definition
|
||||
//=============================================================================
|
||||
typedef enum
|
||||
{
|
||||
E_MI_AO_VQE_ERR = MI_AO_INITIAL_ERROR_CODE, /* VQE of AO error */
|
||||
E_MI_AO_ADEC_ERR, //ADEC of AO error
|
||||
}MI_AO_ErrCode_e;
|
||||
|
||||
|
||||
typedef struct MI_AO_ChnState_s
|
||||
{
|
||||
MI_U32 u32ChnTotalNum;
|
||||
MI_U32 u32ChnFreeNum;
|
||||
MI_U32 u32ChnBusyNum;
|
||||
} MI_AO_ChnState_t;
|
||||
|
||||
typedef struct MI_AO_VqeConfig_s
|
||||
{
|
||||
MI_BOOL bHpfOpen;
|
||||
MI_BOOL bAnrOpen;
|
||||
MI_BOOL bAgcOpen;
|
||||
MI_BOOL bEqOpen;
|
||||
MI_S32 s32WorkSampleRate;
|
||||
MI_S32 s32FrameSample;
|
||||
MI_AUDIO_HpfConfig_t stHpfCfg;
|
||||
MI_AUDIO_AnrConfig_t stAnrCfg;
|
||||
MI_AUDIO_AgcConfig_t stAgcCfg;
|
||||
MI_AUDIO_EqConfig_t stEqCfg;
|
||||
}MI_AO_VqeConfig_t;
|
||||
|
||||
typedef enum{
|
||||
E_MI_AUDIO_ADEC_TYPE_G711A = 0,
|
||||
E_MI_AUDIO_ADEC_TYPE_G711U,
|
||||
E_MI_AUDIO_ADEC_TYPE_G726,
|
||||
E_MI_AUDIO_ADEC_TYPE_INVALID,
|
||||
}MI_AUDIO_AdecType_e;
|
||||
|
||||
|
||||
typedef struct MI_AUDIO_AdecG711Config_s{
|
||||
MI_AUDIO_SampleRate_e eSamplerate;
|
||||
MI_AUDIO_SoundMode_e eSoundmode;
|
||||
}MI_AUDIO_AdecG711Config_t;
|
||||
|
||||
typedef struct MI_AUDIO_AdecG726Config_s{
|
||||
MI_AUDIO_SampleRate_e eSamplerate;
|
||||
MI_AUDIO_SoundMode_e eSoundmode;
|
||||
MI_AUDIO_G726Mode_e eG726Mode;
|
||||
}MI_AUDIO_AdecG726Config_t;
|
||||
|
||||
typedef struct MI_AO_AdecConfig_s{
|
||||
MI_AUDIO_AdecType_e eAdecType;
|
||||
union
|
||||
{
|
||||
MI_AUDIO_AdecG711Config_t stAdecG711Cfg;
|
||||
MI_AUDIO_AdecG726Config_t stAdecG726Cfg;
|
||||
};
|
||||
}MI_AO_AdecConfig_t;
|
||||
|
||||
typedef enum{
|
||||
E_MI_AO_GAIN_FADING_OFF = 0,
|
||||
E_MI_AO_GAIN_FADING_1_SAMPLE,
|
||||
E_MI_AO_GAIN_FADING_2_SAMPLE,
|
||||
E_MI_AO_GAIN_FADING_4_SAMPLE,
|
||||
E_MI_AO_GAIN_FADING_8_SAMPLE,
|
||||
E_MI_AO_GAIN_FADING_16_SAMPLE,
|
||||
E_MI_AO_GAIN_FADING_32_SAMPLE,
|
||||
E_MI_AO_GAIN_FADING_64_SAMPLE,
|
||||
}MI_AO_GainFading_e;
|
||||
|
||||
typedef struct MI_AO_ChnGainConfig_s
|
||||
{
|
||||
MI_BOOL bEnableGainSet;
|
||||
MI_S16 s16Gain;
|
||||
MI_AO_GainFading_e eFading;
|
||||
}MI_AO_ChnGainConfig_t;
|
||||
|
||||
typedef struct MI_AO_ChnParam_s
|
||||
{
|
||||
MI_AO_ChnGainConfig_t stChnGain;
|
||||
MI_U32 u32Reserved;
|
||||
} MI_AO_ChnParam_t;
|
||||
|
||||
typedef struct MI_AO_InitParam_s
|
||||
{
|
||||
MI_U32 u32DevId;
|
||||
MI_U8 *u8Data;
|
||||
} MI_AO_InitParam_t;
|
||||
|
||||
//=============================================================================
|
||||
// Variable definition
|
||||
//=============================================================================
|
||||
|
||||
|
||||
//=============================================================================
|
||||
// Global function definition
|
||||
//=============================================================================
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif //__MI_AO_DATATYPE_H__
|
|
@ -0,0 +1,56 @@
|
|||
/* 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
|
||||
(<EFBFBD><EFBFBD>Sigmastar Confidential Information<EFBFBD><EFBFBD>) 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 _MI_CIPHER_H_
|
||||
#define _MI_CIPHER_H_
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "mi_common.h"
|
||||
#include "mi_cipher_datatype.h"
|
||||
|
||||
#define CIPHER_MAJOR_VERSION 2
|
||||
#define CIPHER_SUB_VERSION 3
|
||||
#define MACRO_TO_STR(macro) #macro
|
||||
#define CIPHER_VERSION_STR(major_version,sub_version) ({char *tmp = sub_version/100 ? \
|
||||
"mi_cipher_version_" MACRO_TO_STR(major_version)"." MACRO_TO_STR(sub_version) : sub_version/10 ? \
|
||||
"mi_cipher_version_" MACRO_TO_STR(major_version)".0" MACRO_TO_STR(sub_version) : \
|
||||
"mi_cipher_version_" MACRO_TO_STR(major_version)".00" MACRO_TO_STR(sub_version);tmp;})
|
||||
#define MI_CIPHER_API_VERSION CIPHER_VERSION_STR(CIPHER_MAJOR_VERSION,CIPHER_SUB_VERSION)
|
||||
|
||||
MI_S32 MI_CIPHER_Init(void);
|
||||
MI_S32 MI_CIPHER_Uninit (void);
|
||||
MI_S32 MI_CIPHER_CreateHandle(MI_HANDLE *phandle);
|
||||
MI_S32 MI_CIPHER_DestroyHandle(MI_HANDLE handle);
|
||||
MI_S32 MI_CIPHER_ConfigHandle(MI_HANDLE handle, MI_CIPHER_Config_t *pconfig);
|
||||
MI_S32 MI_CIPHER_Encrypt(MI_HANDLE handle, void* srcAddr, void* dstAddr , MI_U32 u32ByteLen, MI_U32 *pu32dstByteLen);
|
||||
MI_S32 MI_CIPHER_Decrypt(MI_HANDLE handle, void* srcAddr, void* dstAddr, MI_U32 u32ByteLen, MI_U32 *pu32dstByteLen);
|
||||
MI_S32 MI_CIPHER_HashInit(MI_CIPHER_HASH_ALGO_e eHashAlgoType, MI_HANDLE *pHashHandle);
|
||||
MI_S32 MI_CIPHER_HashUnInit(MI_HANDLE hHashHandle);
|
||||
MI_S32 MI_CIPHER_HashUpdate(MI_HANDLE hHashHandle , MI_U8 *pu8InputData, MI_U32 u32IDataLen);
|
||||
MI_S32 MI_CIPHER_HashFinal(MI_HANDLE hHashHandle, MI_U8 *pu8OutputHash, MI_U32 *pu32OutputHashLen);
|
||||
MI_S32 MI_CIPHER_RsaPublicEncrypt(MI_CIPHER_RSA_PUB_ENC_t *pstRsa, MI_U8 *pu8Input, MI_U32 u32InLen, MI_U8 *pu8Output, MI_U32 *pu32OutLen);
|
||||
MI_S32 MI_CIPHER_RsaPrivateDecrypt(MI_CIPHER_RSA_PRI_ENC_t *pstRsa, MI_U8 *pu8Input, MI_U32 u32InLen, MI_U8 *pu8Output, MI_U32 *pu32OutLen);
|
||||
MI_S32 MI_CIPHER_RsaPrivateEncrypt(MI_CIPHER_RSA_PRI_ENC_t *pstRsa, MI_U8 *pu8Input, MI_U32 u32InLen, MI_U8 *pu8Output, MI_U32 *pu32OutLen);
|
||||
MI_S32 MI_CIPHER_RsaPublicDecrypt(MI_CIPHER_RSA_PUB_ENC_t *pstRsa, MI_U8 *pu8Input, MI_U32 u32InLen, MI_U8 *pu8Output, MI_U32 *pu32OutLen);
|
||||
MI_S32 MI_CIPHER_RsaSign(MI_CIPHER_RSA_SIGN_t *pstRsaSign, MI_U8 *pu8InHashData, MI_U32 u32HashDataLen, MI_U8 *pu8OutSign, MI_U32 *pu32OutSignLen);
|
||||
MI_S32 MI_CIPHER_RsaVerify(MI_CIPHER_RSA_VERIFY_t *pstRsaVerify, MI_U8 *pu8InHashData, MI_U32 u32HashDataLen, MI_U8 *pu8InSign, MI_U32 u32InSignLen);
|
||||
MI_S32 MI_CIPHER_InitDev(MI_CIPHER_InitParam_t *pstInitParam);
|
||||
MI_S32 MI_CIPHER_DeInitDev(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif ///_MI_CIPHER_H_
|
|
@ -0,0 +1,164 @@
|
|||
/* 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
|
||||
(<EFBFBD><EFBFBD>Sigmastar Confidential Information<EFBFBD><EFBFBD>) 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 _MI_CIPHER_DATATYPE_H_
|
||||
#define _MI_CIPHER_DATATYPE_H_
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "mi_common.h"
|
||||
#include "mi_common_datatype.h"
|
||||
|
||||
/* min length of encrypt, unit: byte*/
|
||||
#define MI_CIPHER_MIN_CRYPT_LEN 8
|
||||
|
||||
/*max length of encrypt, unit: byte*/
|
||||
#define MI_CIPHER_MAX_CRYPT_LEN 0xfffff
|
||||
|
||||
#define MI_CIPHER_KEY_SIZE_MAX 32
|
||||
#define MI_CIPHER_AES_BLOCK_SIZE 16
|
||||
#define MI_CIPHER_MAX_DEVICE_NUM 1
|
||||
#define CIPHER_MAX_RSA_KEY_LEN (512)
|
||||
#define DRV_MAX_RSA_KEY_LEN (128)
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------------------------------
|
||||
* Enum
|
||||
------------------------------------------------------------------------------------------------*/
|
||||
/*cipher work mode*/
|
||||
typedef enum
|
||||
{
|
||||
MI_CIPHER_ALG_AES_ECB = 0,
|
||||
MI_CIPHER_ALG_AES_CBC,
|
||||
MI_CIPHER_ALG_AES_CTR,
|
||||
} MI_CIPHER_ALG_e;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
MI_CIPHER_HASH_ALG_SHA1,
|
||||
MI_CIPHER_HASH_ALG_SHA256,
|
||||
MI_CIPHER_HASH_TYPE_BUTT,
|
||||
} MI_CIPHER_HASH_ALGO_e;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
MI_CIPHER_RSA_ENC_SCHEME_NO_PADDING, /**< without padding */
|
||||
MI_CIPHER_RSA_ENC_SCHEME_RSAES_OAEP_SHA1, /**< PKCS#1 RSAES-OAEP-SHA1 padding*/
|
||||
MI_CIPHER_RSA_ENC_SCHEME_RSAES_OAEP_SHA256, /**< PKCS#1 RSAES-OAEP-SHA256 padding*/
|
||||
MI_CIPHER_RSA_ENC_SCHEME_RSAES_PKCS1_V1_5, /**< PKCS#1 RSAES-PKCS1_V1_5 padding*/
|
||||
MI_CIPHER_RSA_ENC_SCHEME_BUTT,
|
||||
}MI_CIPHER_RSA_ENC_SCHEME_E;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
MI_CIPHER_RSA_SIGN_SCHEME_RSASSA_PKCS1_V15_SHA1 = 0x100, /**< PKCS#1 RSASSA_PKCS1_V15_SHA1 signature*/
|
||||
MI_CIPHER_RSA_SIGN_SCHEME_RSASSA_PKCS1_V15_SHA256, /**< PKCS#1 RSASSA_PKCS1_V15_SHA256 signature*/
|
||||
MI_CIPHER_RSA_SIGN_SCHEME_RSASSA_PKCS1_PSS_SHA1, /**< PKCS#1 RSASSA_PKCS1_PSS_SHA1 signature*/
|
||||
MI_CIPHER_RSA_SIGN_SCHEME_RSASSA_PKCS1_PSS_SHA256, /**< PKCS#1 RSASSA_PKCS1_PSS_SHA256 signature*/
|
||||
MI_CIPHER_RSA_SIGN_SCHEME_BUTT,
|
||||
}MI_CIPHER_RSA_SIGN_SCHEME_E;
|
||||
|
||||
/*-------------------------------------------------------------------------------------------------
|
||||
* Defines
|
||||
------------------------------------------------------------------------------------------------*/
|
||||
|
||||
/* CIPHER Module ErrorCode */
|
||||
#define MI_CIPHER_ERR_INVALID_DEVID (MI_DEF_ERR( E_MI_MODULE_ID_CIPHER, E_MI_ERR_LEVEL_ERROR, E_MI_ERR_INVALID_DEVID))
|
||||
#define MI_CIPHER_ERR_ILLEGAL_PARAM (MI_DEF_ERR( E_MI_MODULE_ID_CIPHER, E_MI_ERR_LEVEL_ERROR, E_MI_ERR_ILLEGAL_PARAM))
|
||||
#define MI_CIPHER_ERR_NOT_ENABLED (MI_DEF_ERR( E_MI_MODULE_ID_CIPHER, E_MI_ERR_LEVEL_ERROR, E_MI_ERR_NOT_ENABLE))
|
||||
#define MI_CIPHER_ERR_NOT_DISABLED (MI_DEF_ERR( E_MI_MODULE_ID_CIPHER, E_MI_ERR_LEVEL_ERROR, E_MI_ERR_NOT_DISABLE))
|
||||
#define MI_CIPHER_ERR_NULL_PTR (MI_DEF_ERR( E_MI_MODULE_ID_CIPHER, E_MI_ERR_LEVEL_ERROR, E_MI_ERR_NULL_PTR))
|
||||
#define MI_CIPHER_ERR_INVALID_CHNID (MI_DEF_ERR( E_MI_MODULE_ID_CIPHER, E_MI_ERR_LEVEL_ERROR, E_MI_ERR_INVALID_CHNID))
|
||||
#define MI_CIPHER_ERR_NOT_CONFIG (MI_DEF_ERR( E_MI_MODULE_ID_CIPHER, E_MI_ERR_LEVEL_ERROR, E_MI_ERR_NOT_CONFIG))
|
||||
#define MI_CIPHER_ERR_NOT_SUPPORT (MI_DEF_ERR( E_MI_MODULE_ID_CIPHER, E_MI_ERR_LEVEL_ERROR, E_MI_ERR_NOT_SUPPORT))
|
||||
#define MI_CIPHER_ERR_NOT_PERM (MI_DEF_ERR( E_MI_MODULE_ID_CIPHER, E_MI_ERR_LEVEL_ERROR, E_MI_ERR_NOT_PERM))
|
||||
#define MI_CIPHER_ERR_NOMEM (MI_DEF_ERR( E_MI_MODULE_ID_CIPHER, E_MI_ERR_LEVEL_ERROR, E_MI_ERR_NOMEM))
|
||||
#define MI_CIPHER_ERR_NOBUF (MI_DEF_ERR( E_MI_MODULE_ID_CIPHER, E_MI_ERR_LEVEL_ERROR, E_MI_ERR_NOBUF))
|
||||
#define MI_CIPHER_ERR_BUF_EMPTY (MI_DEF_ERR( E_MI_MODULE_ID_CIPHER, E_MI_ERR_LEVEL_ERROR, E_MI_ERR_BUF_EMPTY))
|
||||
#define MI_CIPHER_ERR_BUF_FULL (MI_DEF_ERR( E_MI_MODULE_ID_CIPHER, E_MI_ERR_LEVEL_ERROR, E_MI_ERR_BUF_FULL))
|
||||
#define MI_CIPHER_ERR_SYS_NOTREADY (MI_DEF_ERR( E_MI_MODULE_ID_CIPHER, E_MI_ERR_LEVEL_ERROR, E_MI_ERR_SYS_NOTREADY))
|
||||
#define MI_CIPHER_ERR_BUSY (MI_DEF_ERR( E_MI_MODULE_ID_CIPHER, E_MI_ERR_LEVEL_ERROR, E_MI_ERR_BUSY))
|
||||
#define MI_CIPHER_ERR_MOD_NOTINIT (MI_DEF_ERR( E_MI_MODULE_ID_CIPHER, E_MI_ERR_LEVEL_ERROR, E_MI_ERR_NOT_INIT))
|
||||
#define MI_CIPHER_ERR_MOD_INITED (MI_DEF_ERR( E_MI_MODULE_ID_CIPHER, E_MI_ERR_LEVEL_ERROR, E_MI_ERR_INITED))
|
||||
#define MI_CIPHER_ERR_FAILED (MI_DEF_ERR( E_MI_MODULE_ID_CIPHER, E_MI_ERR_LEVEL_ERROR, E_MI_ERR_FAILED))
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------------------------------
|
||||
* Structures
|
||||
------------------------------------------------------------------------------------------------*/
|
||||
// bits
|
||||
typedef enum {
|
||||
E_MI_CIPHER_KEY_SIZE_128 = 0,
|
||||
E_MI_CIPHER_KEY_SIZE_192,
|
||||
E_MI_CIPHER_KEY_SIZE_256,
|
||||
} MI_CIPHER_KeySize_e;
|
||||
|
||||
typedef struct MI_CIPHER_Config_s
|
||||
{
|
||||
MI_CIPHER_KeySize_e eKeySize;
|
||||
MI_U8 key[MI_CIPHER_KEY_SIZE_MAX];
|
||||
MI_U8 iv[MI_CIPHER_AES_BLOCK_SIZE];
|
||||
MI_CIPHER_ALG_e eAlg;
|
||||
} MI_CIPHER_Config_t;
|
||||
|
||||
typedef struct MI_CIPHER_RSA_PUB_Key_s
|
||||
{
|
||||
MI_U8* pu8ExpE;
|
||||
MI_U8* pu8ModN;
|
||||
MI_U32 expSize;
|
||||
MI_U32 modSize;
|
||||
} MI_CIPHER_RSA_PUB_Key_t;
|
||||
|
||||
typedef struct MI_CIPHER_RSA_PRI_Key_s
|
||||
{
|
||||
MI_U8* pu8ExpD;
|
||||
MI_U8* pu8ModN;
|
||||
MI_U32 expSize;
|
||||
MI_U32 modSize;
|
||||
} MI_CIPHER_RSA_PRI_Key_t;
|
||||
|
||||
typedef struct MI_CIPHER_RSA_PUB_ENC_s
|
||||
{
|
||||
MI_CIPHER_RSA_ENC_SCHEME_E eRsaAlgoType;
|
||||
MI_CIPHER_RSA_PUB_Key_t stPubKey;
|
||||
} MI_CIPHER_RSA_PUB_ENC_t;
|
||||
|
||||
typedef struct MI_CIPHER_RSA_PRI_ENC_s
|
||||
{
|
||||
MI_CIPHER_RSA_ENC_SCHEME_E eRsaAlgoType;
|
||||
MI_CIPHER_RSA_PRI_Key_t stPriKey;
|
||||
} MI_CIPHER_RSA_PRI_ENC_t;
|
||||
|
||||
typedef struct MI_CIPHER_RSA_SIGN_s
|
||||
{
|
||||
MI_CIPHER_RSA_SIGN_SCHEME_E eRsaAlgoType;
|
||||
MI_CIPHER_RSA_PRI_Key_t stPriKey;
|
||||
} MI_CIPHER_RSA_SIGN_t;
|
||||
|
||||
typedef struct MI_CIPHER_RSA_VERIFY_s
|
||||
{
|
||||
MI_CIPHER_RSA_SIGN_SCHEME_E eRsaAlgoType;
|
||||
MI_CIPHER_RSA_PUB_Key_t stPubKey;
|
||||
} MI_CIPHER_RSA_VERIFY_t;
|
||||
|
||||
typedef struct MI_CIPHER_InitParam_s
|
||||
{
|
||||
MI_U32 u32DevId;
|
||||
MI_U8 *u8Data;
|
||||
} MI_CIPHER_InitParam_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif //_MI_CIPHER_DATATYPE_H_
|
|
@ -0,0 +1,29 @@
|
|||
/* SigmaStar trade secret */
|
||||
/* Copyright (c) [2019~2020] SigmaStar Technology.
|
||||
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 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 _MI_COMMON_H_
|
||||
#define _MI_COMMON_H_
|
||||
|
||||
#include "mi_common_datatype.h"
|
||||
|
||||
#define COMMON_MAJOR_VERSION 2
|
||||
#define COMMON_SUB_VERSION 3
|
||||
#define MACRO_TO_STR(macro) #macro
|
||||
#define COMMON_VERSION_STR(major_version,sub_version) ({char *tmp = sub_version/100 ? \
|
||||
"mi_common_version_" MACRO_TO_STR(major_version)"." MACRO_TO_STR(sub_version) : sub_version/10 ? \
|
||||
"mi_common_version_" MACRO_TO_STR(major_version)".0" MACRO_TO_STR(sub_version) : \
|
||||
"mi_common_version_" MACRO_TO_STR(major_version)".00" MACRO_TO_STR(sub_version);tmp;})
|
||||
#define MI_COMMON_API_VERSION COMMON_VERSION_STR(COMMON_MAJOR_VERSION,COMMON_SUB_VERSION)
|
||||
|
||||
#endif///_MI_COMMON_H_
|
|
@ -0,0 +1,271 @@
|
|||
/* SigmaStar trade secret */
|
||||
/* Copyright (c) [2019~2020] SigmaStar Technology.
|
||||
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 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 _MI_COMMON_DATATYPE_H_
|
||||
#define _MI_COMMON_DATATYPE_H_
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
// System Data Type
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
/// data type unsigned char, data length 1 byte
|
||||
typedef unsigned char MI_U8; // 1 byte
|
||||
/// data type unsigned short, data length 2 byte
|
||||
typedef unsigned short MI_U16; // 2 bytes
|
||||
/// data type unsigned int, data length 4 byte
|
||||
typedef unsigned int MI_U32; // 4 bytes
|
||||
/// data type unsigned int, data length 8 byte
|
||||
typedef unsigned long long MI_U64; // 8 bytes
|
||||
/// data type signed char, data length 1 byte
|
||||
typedef signed char MI_S8; // 1 byte
|
||||
/// data type signed short, data length 2 byte
|
||||
typedef signed short MI_S16; // 2 bytes
|
||||
/// data type signed int, data length 4 byte
|
||||
typedef signed int MI_S32; // 4 bytes
|
||||
/// data type signed int, data length 8 byte
|
||||
typedef signed long long MI_S64; // 8 bytes
|
||||
/// data type float, data length 4 byte
|
||||
typedef float MI_FLOAT; // 4 bytes
|
||||
/// data type 64bit physical address
|
||||
typedef unsigned long long MI_PHY; // 8 bytes
|
||||
/// data type pointer content
|
||||
typedef unsigned long MI_VIRT; // 4 bytes when 32bit toolchain, 8 bytes when 64bit toolchain.
|
||||
|
||||
typedef unsigned char MI_BOOL;
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
// Moudle common type
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
typedef MI_S32 MI_AI_CHN;
|
||||
typedef MI_S32 MI_AO_CHN;
|
||||
typedef MI_S32 MI_AUDIO_DEV;
|
||||
typedef MI_S32 MI_VIF_DEV;
|
||||
typedef MI_S32 MI_DISP_DEV;
|
||||
typedef MI_S32 MI_DISP_LAYER;
|
||||
typedef MI_S32 MI_DISP_CHN;
|
||||
typedef MI_S32 MI_VENC_CHN;
|
||||
typedef MI_S32 MI_VDEC_CHN;
|
||||
typedef MI_S32 MI_IVE_HANDLE;
|
||||
typedef MI_S32 MI_VPE_DEV;
|
||||
typedef MI_S32 MI_DIVP_CHN;
|
||||
typedef MI_U32 MI_RGN_HANDLE;
|
||||
typedef MI_U32 MI_SED_CHN;
|
||||
typedef MI_S32 MI_HANDLE;
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
// Macros
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
#define INIT_ST(st) do { \
|
||||
memset(&st, 0, sizeof(st));\
|
||||
st.u16SizeofStructure = sizeof(st);\
|
||||
}while(0)
|
||||
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
// Defines
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
#define MI_HANDLE_NULL (0)
|
||||
#define MI_SUCCESS (0)
|
||||
#define MI_BIT(_bit_) (1 << (_bit_))
|
||||
#define MI_ERR_ID (0x80000000L + 0x20000000L)
|
||||
#define MI_IVE_INITIAL_ERROR_CODE (0x80)
|
||||
#define MI_VDF_INITIAL_ERROR_CODE (0xA0)
|
||||
#define MI_VENC_INITIAL_ERROR_CODE (0xC0)
|
||||
#define MI_RGN_INITIAL_ERROR_CODE (0xE0)
|
||||
#define MI_AI_INITIAL_ERROR_CODE (0x100)
|
||||
#define MI_AO_INITIAL_ERROR_CODE (0x120)
|
||||
#define MI_VIF_INITIAL_ERROR_CODE (0x140)
|
||||
#define MI_VPE_INITIAL_ERROR_CODE (0x160)
|
||||
#define MI_VDEC_INITIAL_ERROR_CODE (0x180)
|
||||
#define MI_SYS_INITIAL_ERROR_CODE (0x1A0)
|
||||
#define MI_FB_INITIAL_ERROR_CODE (0x1C0)
|
||||
#define MI_HDMI_INITIAL_ERROR_CODE (0x1E0)
|
||||
#define MI_DIVP_INITIAL_ERROR_CODE (0x200)
|
||||
#define MI_GFX_INITIAL_ERROR_CODE (0x220)
|
||||
#define MI_VDISP_INITIAL_ERROR_CODE (0x240)
|
||||
#define MI_DISP_INITIAL_ERROR_CODE (0x260)
|
||||
#define MI_WARP_INITIAL_ERROR_CODE (0x280)
|
||||
#define MI_CV_INITIAL_ERROR_CODE (0x2A0)
|
||||
#define MI_CEVA_INITIAL_ERROR_CODE (0x2C0)
|
||||
#define MI_UAC_INITIAL_ERROR_CODE (0x2E0)
|
||||
#define MI_LDC_INITIAL_ERROR_CODE (0x300)
|
||||
|
||||
#ifndef UNUSED
|
||||
#define UNUSED(var) (void)((var) = (var))
|
||||
#endif
|
||||
|
||||
/******************************************************************************
|
||||
|----------------------------------------------------------------|
|
||||
| 1 | APP_ID | MOD_ID | ERR_LEVEL | ERR_ID |
|
||||
|----------------------------------------------------------------|
|
||||
|<--><--7bits----><----8bits---><--4bits---><------12bits------->|
|
||||
******************************************************************************/
|
||||
|
||||
#define MI_DEF_ERR( module, level, errid) \
|
||||
((MI_S32)( (MI_ERR_ID) | ((module) << 16 ) | ((level)<<12) | (errid) ))
|
||||
|
||||
|
||||
#ifndef __KERNEL__
|
||||
/// data type null pointer
|
||||
#ifdef NULL
|
||||
#undef NULL
|
||||
#endif
|
||||
#define NULL 0
|
||||
|
||||
|
||||
#if !defined(__cplusplus)
|
||||
#ifndef true
|
||||
/// definition for true
|
||||
#define true 1
|
||||
/// definition for false
|
||||
#define false 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined(TRUE) && !defined(FALSE)
|
||||
/// definition for TRUE
|
||||
#define TRUE 1
|
||||
/// definition for FALSE
|
||||
#define FALSE 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define TO_STR_NATIVE(e) #e
|
||||
#define TO_STR_PROXY(m, e) m(e)
|
||||
#define MACRO_TO_STRING(e) TO_STR_PROXY(TO_STR_NATIVE, e)
|
||||
#define COMPILE_DATE_TIME() __DATE__ __TIME__
|
||||
|
||||
///ASCII color code
|
||||
#define ASCII_COLOR_RED "\033[1;31m"
|
||||
#define ASCII_COLOR_WHITE "\033[1;37m"
|
||||
#define ASCII_COLOR_YELLOW "\033[1;33m"
|
||||
#define ASCII_COLOR_BLUE "\033[1;36m"
|
||||
#define ASCII_COLOR_GREEN "\033[1;32m"
|
||||
#define ASCII_COLOR_END "\033[0m"
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
// Structures
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
// Enum
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
typedef enum
|
||||
{
|
||||
E_MI_MODULE_ID_IVE = 0,
|
||||
E_MI_MODULE_ID_VDF = 1,
|
||||
E_MI_MODULE_ID_VENC = 2,
|
||||
E_MI_MODULE_ID_RGN = 3,
|
||||
E_MI_MODULE_ID_AI = 4,
|
||||
E_MI_MODULE_ID_AO = 5,
|
||||
E_MI_MODULE_ID_VIF = 6,
|
||||
E_MI_MODULE_ID_VPE = 7,
|
||||
E_MI_MODULE_ID_VDEC = 8,
|
||||
E_MI_MODULE_ID_SYS = 9,
|
||||
E_MI_MODULE_ID_FB = 10,
|
||||
E_MI_MODULE_ID_HDMI = 11,
|
||||
E_MI_MODULE_ID_DIVP = 12,
|
||||
E_MI_MODULE_ID_GFX = 13,
|
||||
E_MI_MODULE_ID_VDISP = 14,
|
||||
E_MI_MODULE_ID_DISP = 15,
|
||||
E_MI_MODULE_ID_OS = 16,
|
||||
E_MI_MODULE_ID_IAE = 17,
|
||||
E_MI_MODULE_ID_MD = 18,
|
||||
E_MI_MODULE_ID_OD = 19,
|
||||
E_MI_MODULE_ID_SHADOW = 20,
|
||||
E_MI_MODULE_ID_WARP = 21,
|
||||
E_MI_MODULE_ID_UAC = 22,
|
||||
E_MI_MODULE_ID_LDC = 23,
|
||||
E_MI_MODULE_ID_SD = 24,
|
||||
E_MI_MODULE_ID_PANEL = 25,
|
||||
E_MI_MODULE_ID_CIPHER = 26,
|
||||
E_MI_MODULE_ID_SNR = 27,
|
||||
E_MI_MODULE_ID_WLAN =28,
|
||||
E_MI_MODULE_ID_IPU = 29,
|
||||
E_MI_MODULE_ID_MIPITX = 30,
|
||||
E_MI_MODULE_ID_GYRO = 31,
|
||||
E_MI_MODULE_ID_JPD = 32,
|
||||
//E_MI_MODULE_ID_SED = 29,
|
||||
E_MI_MODULE_ID_MAX,
|
||||
} MI_ModuleId_e;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
E_MI_ERR_LEVEL_INFO, /* informational */
|
||||
E_MI_ERR_LEVEL_WARNING, /* warning conditions */
|
||||
E_MI_ERR_LEVEL_ERROR, /* error conditions */
|
||||
E_MI_ERR_LEVEL_BUTT
|
||||
} MI_ErrLevel_e;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
E_MI_ERR_INVALID_DEVID = 1, /* invlalid device ID */
|
||||
E_MI_ERR_INVALID_CHNID = 2, /* invlalid channel ID */
|
||||
E_MI_ERR_ILLEGAL_PARAM = 3, /* at lease one parameter is illagal
|
||||
** eg, an illegal enumeration value */
|
||||
E_MI_ERR_EXIST = 4, /* resource exists */
|
||||
E_MI_ERR_UNEXIST = 5,/* resource unexists */
|
||||
E_MI_ERR_NULL_PTR = 6, /* using a NULL point */
|
||||
E_MI_ERR_NOT_CONFIG = 7, /* try to enable or initialize system, device
|
||||
** or channel, before configing attribute */
|
||||
E_MI_ERR_NOT_SUPPORT = 8, /* operation or type is not supported by NOW */
|
||||
E_MI_ERR_NOT_PERM = 9, /* operation is not permitted
|
||||
** eg, try to change static attribute */
|
||||
E_MI_ERR_NOMEM = 12,/* failure caused by malloc memory */
|
||||
E_MI_ERR_NOBUF = 13,/* failure caused by malloc buffer */
|
||||
E_MI_ERR_BUF_EMPTY = 14,/* no data in buffer */
|
||||
E_MI_ERR_BUF_FULL = 15,/* no buffer for new data */
|
||||
E_MI_ERR_SYS_NOTREADY = 16,/* System is not ready,maybe not initialed or
|
||||
** loaded. Returning the error code when opening
|
||||
** a device file failed. */
|
||||
E_MI_ERR_BADADDR = 17,/* bad address,
|
||||
** eg. used for copy_from_user & copy_to_user */
|
||||
E_MI_ERR_BUSY = 18,/* resource is busy,
|
||||
** eg. destroy a venc chn without unregister it */
|
||||
E_MI_ERR_CHN_NOT_STARTED = 19,/* channel not start*/
|
||||
E_MI_ERR_CHN_NOT_STOPED = 20,/* channel not stop*/
|
||||
E_MI_ERR_NOT_INIT = 21,/* module not init before use it*/
|
||||
E_MI_ERR_INITED = 22,/* module already init*/
|
||||
E_MI_ERR_NOT_ENABLE = 23,/* device channel or port not enable*/
|
||||
E_MI_ERR_NOT_DISABLE = 24,/* device channel or port not disable*/
|
||||
E_MI_ERR_SYS_TIMEOUT = 25,/* sys timeout*/
|
||||
E_MI_ERR_DEV_NOT_STARTED = 26,/* device not started*/
|
||||
E_MI_ERR_DEV_NOT_STOPED = 27,/* device not stoped*/
|
||||
E_MI_ERR_CHN_NO_CONTENT = 28,/* there is no content in the channel.*/
|
||||
E_MI_ERR_NOVASPACE = 29,/* failure caused by va mmap */
|
||||
E_MI_ERR_NOITEM = 30,/* no item record in ringpool */
|
||||
E_MI_ERR_FAILED ,/* unexpected error */
|
||||
|
||||
E_MI_ERR_MAX = 127,/* maxium code, private error code of all modules
|
||||
** must be greater than it */
|
||||
}MI_ErrCode_e;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
MI_DBG_NONE = 0,
|
||||
MI_DBG_ERR,
|
||||
MI_DBG_WRN,
|
||||
MI_DBG_API,
|
||||
MI_DBG_KMSG,
|
||||
MI_DBG_INFO,
|
||||
MI_DBG_DEBUG,
|
||||
MI_DBG_TRACE,
|
||||
MI_DBG_ALL
|
||||
}MI_DBG_LEVEL_e;
|
||||
|
||||
#ifndef __KERNEL__
|
||||
__attribute__((weak)) char sstar_mi_so_version_string[] = MACRO_TO_STRING(SIGMASTAR_MODULE_VERSION);
|
||||
#endif
|
||||
#endif///_MI_COMMON_DATATYPE_H_
|
|
@ -0,0 +1,85 @@
|
|||
/* SigmaStar trade secret */
|
||||
/* Copyright (c) [2019~2020] SigmaStar Technology.
|
||||
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 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 _MI_DISP_H_
|
||||
#define _MI_DISP_H_
|
||||
|
||||
#include "mi_disp_datatype.h"
|
||||
|
||||
#define DISP_MAJOR_VERSION 2
|
||||
#define DISP_SUB_VERSION 7
|
||||
#define MACRO_TO_STR(macro) #macro
|
||||
#define DISP_VERSION_STR(major_version,sub_version) ({char *tmp = sub_version/100 ? \
|
||||
"mi_disp_version_" MACRO_TO_STR(major_version)"." MACRO_TO_STR(sub_version) : sub_version/10 ? \
|
||||
"mi_disp_version_" MACRO_TO_STR(major_version)".0" MACRO_TO_STR(sub_version) : \
|
||||
"mi_disp_version_" MACRO_TO_STR(major_version)".00" MACRO_TO_STR(sub_version);tmp;})
|
||||
#define MI_DISP_API_VERSION DISP_VERSION_STR(DISP_MAJOR_VERSION,DISP_SUB_VERSION)
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
MI_S32 MI_DISP_Enable(MI_DISP_DEV DispDev);
|
||||
MI_S32 MI_DISP_Disable(MI_DISP_DEV DispDev);
|
||||
MI_S32 MI_DISP_SetPubAttr(MI_DISP_DEV DispDev, const MI_DISP_PubAttr_t *pstPubAttr);
|
||||
MI_S32 MI_DISP_GetPubAttr(MI_DISP_DEV DispDev, MI_DISP_PubAttr_t *pstPubAttr);
|
||||
MI_S32 MI_DISP_DeviceAttach(MI_DISP_DEV DispSrcDev, MI_DISP_DEV DispDstDev);
|
||||
MI_S32 MI_DISP_DeviceDetach(MI_DISP_DEV DispSrcDev, MI_DISP_DEV DispDstDev);
|
||||
MI_S32 MI_DISP_EnableVideoLayer(MI_DISP_LAYER DispLayer);
|
||||
MI_S32 MI_DISP_DisableVideoLayer(MI_DISP_LAYER DispLayer);
|
||||
MI_S32 MI_DISP_SetVideoLayerAttr(MI_DISP_LAYER DispLayer, const MI_DISP_VideoLayerAttr_t *pstLayerAttr);
|
||||
MI_S32 MI_DISP_GetVideoLayerAttr(MI_DISP_LAYER DispLayer, MI_DISP_VideoLayerAttr_t *pstLayerAttr);
|
||||
MI_S32 MI_DISP_BindVideoLayer(MI_DISP_LAYER DispLayer, MI_DISP_DEV DispDev);
|
||||
MI_S32 MI_DISP_UnBindVideoLayer(MI_DISP_LAYER DispLayer, MI_DISP_DEV DispDev);
|
||||
MI_S32 MI_DISP_SetPlayToleration(MI_DISP_LAYER DispLayer, MI_U32 u32Toleration);
|
||||
MI_S32 MI_DISP_GetPlayToleration(MI_DISP_LAYER DispLayer, MI_U32 *pu32Toleration);
|
||||
MI_S32 MI_DISP_GetScreenFrame(MI_DISP_LAYER DispLayer, MI_DISP_VideoFrame_t *pstVFrame);
|
||||
MI_S32 MI_DISP_ReleaseScreenFrame(MI_DISP_LAYER DispLayer, MI_DISP_VideoFrame_t *pstVFrame);
|
||||
MI_S32 MI_DISP_SetVideoLayerAttrBegin(MI_DISP_LAYER DispLayer);
|
||||
MI_S32 MI_DISP_SetVideoLayerAttrEnd(MI_DISP_LAYER DispLayer);
|
||||
MI_S32 MI_DISP_SetInputPortAttr(MI_DISP_LAYER DispLayer, MI_DISP_INPUTPORT LayerInputPort, const MI_DISP_InputPortAttr_t *pstInputPortAttr);
|
||||
MI_S32 MI_DISP_GetInputPortAttr(MI_DISP_LAYER DispLayer, MI_DISP_INPUTPORT LayerInputPort, MI_DISP_InputPortAttr_t *pstInputPortAttr);
|
||||
MI_S32 MI_DISP_EnableInputPort (MI_DISP_LAYER DispLayer, MI_DISP_INPUTPORT LayerInputPort);
|
||||
MI_S32 MI_DISP_DisableInputPort(MI_DISP_LAYER DispLayer, MI_DISP_INPUTPORT LayerInputPort);
|
||||
MI_S32 MI_DISP_SetInputPortDispPos(MI_DISP_LAYER DispLayer, MI_DISP_INPUTPORT LayerInputPort, const MI_DISP_Position_t *pstDispPos);
|
||||
MI_S32 MI_DISP_GetInputPortDispPos(MI_DISP_LAYER DispLayer, MI_DISP_INPUTPORT LayerInputPort, MI_DISP_Position_t *pstDispPos);
|
||||
MI_S32 MI_DISP_PauseInputPort (MI_DISP_LAYER DispLayer, MI_DISP_INPUTPORT LayerInputPort);
|
||||
MI_S32 MI_DISP_ResumeInputPort (MI_DISP_LAYER DispLayer, MI_DISP_INPUTPORT LayerInputPort);
|
||||
MI_S32 MI_DISP_StepInputPort(MI_DISP_LAYER DispLayer, MI_DISP_INPUTPORT LayerInputPort);
|
||||
MI_S32 MI_DISP_ShowInputPort(MI_DISP_LAYER DispLayer, MI_DISP_INPUTPORT LayerInputPort);
|
||||
MI_S32 MI_DISP_HideInputPort(MI_DISP_LAYER DispLayer, MI_DISP_INPUTPORT LayerInputPort);
|
||||
MI_S32 MI_DISP_SetInputPortSyncMode (MI_DISP_LAYER DispLayer, MI_DISP_INPUTPORT LayerInputPort, MI_DISP_SyncMode_e eMode);
|
||||
MI_S32 MI_DISP_QueryInputPortStat(MI_DISP_LAYER DispLayer, MI_DISP_INPUTPORT LayerInputPort, MI_DISP_QueryChannelStatus_t *pstStatus);
|
||||
MI_S32 MI_DISP_SetZoomInWindow(MI_DISP_LAYER DispLayer, MI_DISP_INPUTPORT LayerInputPort, MI_DISP_VidWinRect_t* pstZoomRect);
|
||||
MI_S32 MI_DISP_GetVgaParam(MI_DISP_DEV DispDev, MI_DISP_VgaParam_t *pstVgaParam);
|
||||
MI_S32 MI_DISP_SetVgaParam(MI_DISP_DEV DispDev, MI_DISP_VgaParam_t *pstVgaParam);
|
||||
MI_S32 MI_DISP_GetHdmiParam(MI_DISP_DEV DispDev, MI_DISP_HdmiParam_t *pstHdmiParam);
|
||||
MI_S32 MI_DISP_SetHdmiParam(MI_DISP_DEV DispDev, MI_DISP_HdmiParam_t *pstHdmiParam);
|
||||
MI_S32 MI_DISP_GetLcdParam(MI_DISP_DEV DispDev, MI_DISP_LcdParam_t *pstLcdParam);
|
||||
MI_S32 MI_DISP_SetLcdParam(MI_DISP_DEV DispDev, MI_DISP_LcdParam_t *pstLcdParam);
|
||||
MI_S32 MI_DISP_GetCvbsParam(MI_DISP_DEV DispDev, MI_DISP_CvbsParam_t *pstCvbsParam);
|
||||
MI_S32 MI_DISP_SetCvbsParam(MI_DISP_DEV DispDev, MI_DISP_CvbsParam_t *pstCvbsParam);
|
||||
MI_S32 MI_DISP_DeviceSetColorTempeture(MI_DISP_DEV DispDev, MI_DISP_ColorTemperature_t *pstColorTempInfo);
|
||||
MI_S32 MI_DISP_DeviceGetColorTempeture(MI_DISP_DEV DispDev, MI_DISP_ColorTemperature_t *pstColorTempInfo);
|
||||
MI_S32 MI_DISP_DeviceSetGammaParam(MI_DISP_DEV DispDev, MI_DISP_GammaParam_t * pstGammaParam);
|
||||
MI_S32 MI_DISP_ClearInputPortBuffer(MI_DISP_LAYER DispLayer, MI_DISP_INPUTPORT LayerInputPort, MI_BOOL bClrAll);
|
||||
MI_S32 MI_DISP_SetVideoLayerRotateMode(MI_DISP_LAYER DispLayer, MI_DISP_RotateConfig_t *pstRotateConfig);
|
||||
MI_S32 MI_DISP_InitDev(MI_DISP_InitParam_t *pstInitParam);
|
||||
MI_S32 MI_DISP_DeInitDev(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif///_MI_DISP_H_
|
|
@ -0,0 +1,335 @@
|
|||
/* SigmaStar trade secret */
|
||||
/* Copyright (c) [2019~2020] SigmaStar Technology.
|
||||
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 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 _MI_DISP_DATATYPE_H_
|
||||
#define _MI_DISP_DATATYPE_H_
|
||||
#include "mi_sys_datatype.h"
|
||||
|
||||
#define MI_DISP_SUCCESS (0)
|
||||
#define MI_DISP_FAIL (1)
|
||||
#define MI_ERR_DISP_INVALID_DEVID (0xA00F8001) //The device ID does not fall within the value range.
|
||||
#define MI_ERR_DISP_INVALID_CHNID (0xA00F8002) //The channel ID does not fall within the value range.
|
||||
#define MI_ERR_DISP_ILLEGAL_PARAM (0xA00F8003) //The parameter value does not fall within the value range.
|
||||
#define MI_ERR_DISP_NULL_PTR (0xA00F8006) //The pointer is null.
|
||||
#define MI_ERR_DISP_NOT_SUPPORT (0xA00F8008) //The operation is not supported.
|
||||
#define MI_ERR_DISP_NOT_PERMIT (0xA00F8009) //The operation is forbidden.
|
||||
#define MI_ERR_DISP_NO_MEM (0xA00F800C) //The memory is insufficient.
|
||||
#define MI_ERR_DISP_SYS_NOTREADY (0xA00F8010) //The system is not initialized.
|
||||
#define MI_ERR_DISP_BUSY (0xA00F8012) //The resources are unavailable.
|
||||
#define MI_ERR_DISP_DEV_NOT_CONFIG (0xA00F8040) //The MI_DISP device is not configured.
|
||||
#define MI_ERR_DISP_DEV_NOT_ENABLE (0xA00F8041) //The MI_DISP device is not enabled.
|
||||
#define MI_ERR_DISP_DEV_HAS_ENABLED (0xA00F8042) //The MI_DISP device has been enabled.
|
||||
#define MI_ERR_DISP_DEV_HAS_BINDED (0xA00F8043) //The device has been bound.
|
||||
#define MI_ERR_DISP_DEV_NOT_BINDED (0xA00F8044) //The device is not bound.
|
||||
#define MI_ERR_DISP_VIDEO_NOT_ENABLE (0xA00F8045) //The video layer is not enabled.
|
||||
#define MI_ERR_DISP_VIDEO_NOT_DISABLE (0xA00F8046) //The video layer is not disabled.
|
||||
#define MI_ERR_DISP_VIDEO_NOT_CONFIG (0xA00F8047) //The video layer is not configured.
|
||||
#define MI_ERR_DISP_CHN_NOT_DISABLE (0xA00F8048) //The MI_DISP input port is not disabled.
|
||||
#define MI_ERR_DISP_CHN_NOT_ENABLE (0xA00F8049) //No MI_DISP input port is enabled.
|
||||
#define MI_ERR_DISP_CHN_NOT_CONFIG (0xA00F804A) //The MI_DISP input port is not configured.
|
||||
#define MI_ERR_DISP_CHN_NOT_ALLOC (0xA00F804B) //No MI_DISP input port is allocated.
|
||||
#define MI_ERR_DISP_INVALID_PATTERN (0xA00F804C) //The pattern is invalid.
|
||||
#define MI_ERR_DISP_INVALID_POSITION (0xA00F804D) //The cascade position is invalid.
|
||||
#define MI_ERR_DISP_WAIT_TIMEOUT (0xA00F804E) //Waiting times out.
|
||||
#define MI_ERR_DISP_INVALID_VFRAME (0xA00F804F) //The video frame is invalid.
|
||||
#define MI_ERR_DISP_INVALID_RECT_PARA (0xA00F8050) //The rectangle parameter is invalid.
|
||||
#define MI_ERR_DISP_GFX_NOT_DISABLE (0xA00F8065) //The graphics layer is not disabled.
|
||||
#define MI_ERR_DISP_GFX_NOT_BIND (0xA00F8066) //The graphics layer is not bound.
|
||||
#define MI_ERR_DISP_GFX_NOT_UNBIND (0xA00F8067) //The graphics layer is not unbound.
|
||||
#define MI_ERR_DISP_GFX_INVALID_ID (0xA00F8068) //The graphics layer ID does not fall within the value range.
|
||||
#define MI_ERR_DISP_CHN_AREA_OVERLAP (0xA00F806b) //The MI_DISP input port areas overlap.
|
||||
#define MI_ERR_DISP_INVALID_LAYERID (0xA00F806d) //The video layer ID does not fall within the value range.
|
||||
#define MI_ERR_DISP_VIDEO_HAS_BINDED (0xA00F806e) //The video layer has been bound.
|
||||
#define MI_ERR_DISP_VIDEO_NOT_BINDED (0xA00F806f) //The video layer is not bound
|
||||
|
||||
#define MI_DISP_DEV_MAX 1
|
||||
#define MI_DISP_LAYER_MAX 2
|
||||
#define MI_DISP_INPUTPORT_MAX 16
|
||||
|
||||
//typedef MI_U32 MI_DISP_DEV;
|
||||
//typedef MI_U32 MI_DISP_LAYER;
|
||||
typedef MI_U32 MI_DISP_INPUTPORT;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
E_MI_DISP_INTF_CVBS = 0,
|
||||
E_MI_DISP_INTF_YPBPR,
|
||||
E_MI_DISP_INTF_VGA,
|
||||
E_MI_DISP_INTF_BT656,
|
||||
E_MI_DISP_INTF_BT1120,
|
||||
E_MI_DISP_INTF_HDMI,
|
||||
E_MI_DISP_INTF_LCD,
|
||||
E_MI_DISP_INTF_BT656_H,
|
||||
E_MI_DISP_INTF_BT656_L,
|
||||
E_MI_DISP_INTF_TTL,
|
||||
E_MI_DISP_INTF_MIPIDSI,
|
||||
E_MI_DISP_INTF_MAX,
|
||||
}MI_DISP_Interface_e;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
E_MI_DISP_OUTPUT_PAL = 0,
|
||||
E_MI_DISP_OUTPUT_NTSC,
|
||||
E_MI_DISP_OUTPUT_960H_PAL, /* ITU-R BT.1302 960 x 576 at 50 Hz (interlaced)*/
|
||||
E_MI_DISP_OUTPUT_960H_NTSC, /* ITU-R BT.1302 960 x 480 at 60 Hz (interlaced)*/
|
||||
|
||||
E_MI_DISP_OUTPUT_480i60,
|
||||
E_MI_DISP_OUTPUT_576i50,
|
||||
E_MI_DISP_OUTPUT_480P60,
|
||||
E_MI_DISP_OUTPUT_576P50,
|
||||
E_MI_DISP_OUTPUT_720P50,
|
||||
E_MI_DISP_OUTPUT_720P60,
|
||||
E_MI_DISP_OUTPUT_1080P24,
|
||||
E_MI_DISP_OUTPUT_1080P25,
|
||||
E_MI_DISP_OUTPUT_1080P30,
|
||||
E_MI_DISP_OUTPUT_1080I50,
|
||||
E_MI_DISP_OUTPUT_1080I60,
|
||||
E_MI_DISP_OUTPUT_1080P50,
|
||||
E_MI_DISP_OUTPUT_1080P60,
|
||||
|
||||
E_MI_DISP_OUTPUT_640x480_60, /* VESA 640 x 480 at 60 Hz (non-interlaced) CVT */
|
||||
E_MI_DISP_OUTPUT_800x600_60, /* VESA 800 x 600 at 60 Hz (non-interlaced) */
|
||||
E_MI_DISP_OUTPUT_1024x768_60, /* VESA 1024 x 768 at 60 Hz (non-interlaced) */
|
||||
E_MI_DISP_OUTPUT_1280x1024_60, /* VESA 1280 x 1024 at 60 Hz (non-interlaced) */
|
||||
E_MI_DISP_OUTPUT_1366x768_60, /* VESA 1366 x 768 at 60 Hz (non-interlaced) */
|
||||
E_MI_DISP_OUTPUT_1440x900_60, /* VESA 1440 x 900 at 60 Hz (non-interlaced) CVT Compliant */
|
||||
E_MI_DISP_OUTPUT_1280x800_60, /* 1280*800@60Hz VGA@60Hz*/
|
||||
E_MI_DISP_OUTPUT_1680x1050_60, /* VESA 1680 x 1050 at 60 Hz (non-interlaced) */
|
||||
E_MI_DISP_OUTPUT_1920x2160_30, /* 1920x2160_30 */
|
||||
E_MI_DISP_OUTPUT_1600x1200_60, /* VESA 1600 x 1200 at 60 Hz (non-interlaced) */
|
||||
E_MI_DISP_OUTPUT_1920x1200_60, /* VESA 1920 x 1600 at 60 Hz (non-interlaced) CVT (Reduced Blanking)*/
|
||||
|
||||
E_MI_DISP_OUTPUT_2560x1440_30, /* 2560x1440_30 */
|
||||
E_MI_DISP_OUTPUT_2560x1600_60, /* 2560x1600_60 */
|
||||
E_MI_DISP_OUTPUT_3840x2160_30, /* 3840x2160_30 */
|
||||
E_MI_DISP_OUTPUT_3840x2160_60, /* 3840x2160_60 */
|
||||
E_MI_DISP_OUTPUT_USER,
|
||||
E_MI_DISP_OUTPUT_MAX,
|
||||
} MI_DISP_OutputTiming_e;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
E_MI_DISP_ROTATE_NONE,
|
||||
E_MI_DISP_ROTATE_90,
|
||||
E_MI_DISP_ROTATE_180,
|
||||
E_MI_DISP_ROTATE_270,
|
||||
E_MI_DISP_ROTATE_NUM,
|
||||
}MI_DISP_RotateMode_e;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
E_MI_DISP_CSC_MATRIX_BYPASS = 0, /* do not change color space */
|
||||
|
||||
E_MI_DISP_CSC_MATRIX_BT601_TO_BT709, /* change color space from BT.601 to BT.709 */
|
||||
E_MI_DISP_CSC_MATRIX_BT709_TO_BT601, /* change color space from BT.709 to BT.601 */
|
||||
|
||||
E_MI_DISP_CSC_MATRIX_BT601_TO_RGB_PC, /* change color space from BT.601 to RGB */
|
||||
E_MI_DISP_CSC_MATRIX_BT709_TO_RGB_PC, /* change color space from BT.709 to RGB */
|
||||
|
||||
E_MI_DISP_CSC_MATRIX_RGB_TO_BT601_PC, /* change color space from RGB to BT.601 */
|
||||
E_MI_DISP_CSC_MATRIX_RGB_TO_BT709_PC, /* change color space from RGB to BT.709 */
|
||||
|
||||
E_MI_DISP_CSC_MATRIX_NUM
|
||||
} MI_DISP_CscMattrix_e;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
E_MI_DISP_SYNC_MODE_INVALID = 0,
|
||||
E_MI_DISP_SYNC_MODE_CHECK_PTS,
|
||||
E_MI_DISP_SYNC_MODE_FREE_RUN,
|
||||
E_MI_DISP_SYNC_MODE_NUM,
|
||||
} MI_DISP_SyncMode_e;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
E_MI_LAYER_INPUTPORT_STATUS_INVALID = 0,
|
||||
E_MI_LAYER_INPUTPORT_STATUS_PAUSE,
|
||||
E_MI_LAYER_INPUTPORT_STATUS_RESUME,
|
||||
E_MI_LAYER_INPUTPORT_STATUS_STEP,
|
||||
E_MI_LAYER_INPUTPORT_STATUS_REFRESH,
|
||||
E_MI_LAYER_INPUTPORT_STATUS_SHOW,
|
||||
E_MI_LAYER_INPUTPORT_STATUS_HIDE,
|
||||
E_MI_LAYER_INPUTPORT_STATUS_NUM,
|
||||
} MI_DISP_InputPortStatus_e;
|
||||
|
||||
typedef struct MI_DISP_SyncInfo_s
|
||||
{
|
||||
MI_BOOL bSynm; /* sync mode(0:timing,as BT.656; 1:signal,as LCD) */
|
||||
MI_BOOL bIop; /* interlaced or progressive display(0:i; 1:p) */
|
||||
MI_U8 u8Intfb; /* interlace bit width while output */
|
||||
|
||||
MI_U16 u16Vact ; /* vertical active area */
|
||||
MI_U16 u16Vbb; /* vertical back blank porch */
|
||||
MI_U16 u16Vfb; /* vertical front blank porch */
|
||||
|
||||
MI_U16 u16Hact; /* herizontal active area */
|
||||
MI_U16 u16Hbb; /* herizontal back blank porch */
|
||||
MI_U16 u16Hfb; /* herizontal front blank porch */
|
||||
MI_U16 u16Hmid; /* bottom herizontal active area */
|
||||
|
||||
MI_U16 u16Bvact; /* bottom vertical active area */
|
||||
MI_U16 u16Bvbb; /* bottom vertical back blank porch */
|
||||
MI_U16 u16Bvfb; /* bottom vertical front blank porch */
|
||||
|
||||
MI_U16 u16Hpw; /* horizontal pulse width */
|
||||
MI_U16 u16Vpw; /* vertical pulse width */
|
||||
|
||||
MI_BOOL bIdv; /* inverse data valid of output */
|
||||
MI_BOOL bIhs; /* inverse horizontal synch signal */
|
||||
MI_BOOL bIvs; /* inverse vertical synch signal */
|
||||
MI_U32 u32FrameRate;
|
||||
} MI_DISP_SyncInfo_t;
|
||||
|
||||
|
||||
typedef struct MI_DISP_PubAttr_s
|
||||
{
|
||||
MI_U32 u32BgColor; /* Background color of a device, in RGB format. */
|
||||
MI_DISP_Interface_e eIntfType; /* Type of a VO interface */
|
||||
MI_DISP_OutputTiming_e eIntfSync; /* Type of a VO interface timing */
|
||||
MI_DISP_SyncInfo_t stSyncInfo; /* Information about VO interface timings */
|
||||
} MI_DISP_PubAttr_t;
|
||||
|
||||
typedef struct MI_DISP_CompressAttr_s
|
||||
{
|
||||
MI_BOOL bSupportCompress; /* Whether to support compress */
|
||||
} MI_DISP_CompressAttr_t;
|
||||
|
||||
typedef struct MI_DISP_VidWin_Rect_s
|
||||
{
|
||||
MI_U16 u16X;
|
||||
MI_U16 u16Y;
|
||||
MI_U16 u16Width;
|
||||
MI_U16 u16Height;
|
||||
} MI_DISP_VidWinRect_t;
|
||||
|
||||
typedef struct MI_DISP_VideoLayerSize_s
|
||||
{
|
||||
MI_U32 u16Width;
|
||||
MI_U32 u16Height;
|
||||
} MI_DISP_VideoLayerSize_t;
|
||||
|
||||
typedef struct MI_DISP_VideoLayerAttr_s
|
||||
{
|
||||
MI_DISP_VidWinRect_t stVidLayerDispWin; /* Display resolution */
|
||||
// TODO: dev
|
||||
MI_DISP_VideoLayerSize_t stVidLayerSize; /* Canvas size of the video layer */
|
||||
// TODO: Tommy delete pixel format & doc
|
||||
MI_SYS_PixelFormat_e ePixFormat; /* Pixel format of the video layer */
|
||||
} MI_DISP_VideoLayerAttr_t;
|
||||
|
||||
typedef struct MI_DISP_Csc_s
|
||||
{
|
||||
MI_DISP_CscMattrix_e eCscMatrix;
|
||||
MI_U32 u32Luma; /* luminance: 0 ~ 100 default: 50 */
|
||||
MI_U32 u32Contrast; /* contrast : 0 ~ 100 default: 50 */
|
||||
MI_U32 u32Hue; /* hue : 0 ~ 100 default: 50 */
|
||||
MI_U32 u32Saturation; /* saturation: 0 ~ 100 default: 40 */
|
||||
} MI_DISP_Csc_t;
|
||||
|
||||
typedef struct MI_DISP_VideoFrame_s
|
||||
{
|
||||
MI_U32 u32Width;
|
||||
MI_U32 u32Height;
|
||||
MI_SYS_PixelFormat_e ePixelFormat;
|
||||
MI_PHY aphyAddr;
|
||||
void * pavirAddr;
|
||||
MI_U64 u64pts;
|
||||
MI_U32 u32PrivateData;
|
||||
MI_U32 u32Size;
|
||||
MI_U32 u32Stride;
|
||||
} MI_DISP_VideoFrame_t;
|
||||
/* General Operation of InputPort */
|
||||
typedef struct MI_DISP_InputPortAttr_s
|
||||
{
|
||||
MI_DISP_VidWinRect_t stDispWin; /* rect of video out chn */
|
||||
MI_U16 u16SrcWidth;
|
||||
MI_U16 u16SrcHeight;
|
||||
} MI_DISP_InputPortAttr_t;
|
||||
typedef struct MI_DISP_Position_s
|
||||
{
|
||||
MI_U16 u16X;
|
||||
MI_U16 u16Y;
|
||||
} MI_DISP_Position_t;
|
||||
|
||||
typedef struct MI_DISP_QueryChannelStatus_s
|
||||
{
|
||||
MI_BOOL bEnable;
|
||||
MI_DISP_InputPortStatus_e eStatus;
|
||||
} MI_DISP_QueryChannelStatus_t;
|
||||
|
||||
typedef struct MI_DISP_VgaParam_s
|
||||
{
|
||||
MI_DISP_Csc_t stCsc; /* color space */
|
||||
MI_U32 u32Gain; /* current gain of VGA signals. [0, 64). default:0x30 */
|
||||
MI_U32 u32Sharpness;
|
||||
} MI_DISP_VgaParam_t;
|
||||
|
||||
typedef struct MI_DISP_HdmiParam_s
|
||||
{
|
||||
MI_DISP_Csc_t stCsc; /* color space */
|
||||
MI_U32 u32Gain; /* current gain of HDMI signals. [0, 64). default:0x30 */
|
||||
MI_U32 u32Sharpness;
|
||||
} MI_DISP_HdmiParam_t;
|
||||
|
||||
typedef struct MI_DISP_LcdParam_s
|
||||
{
|
||||
MI_DISP_Csc_t stCsc; /* color space */
|
||||
MI_U32 u32Sharpness;
|
||||
} MI_DISP_LcdParam_t;
|
||||
|
||||
typedef struct MI_DISP_CvbsParam_s
|
||||
{
|
||||
MI_BOOL bEnable;
|
||||
} MI_DISP_CvbsParam_t;
|
||||
|
||||
|
||||
typedef struct MI_DISP_RotateConfig_s
|
||||
{
|
||||
MI_DISP_RotateMode_e eRotateMode;
|
||||
}MI_DISP_RotateConfig_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_U16 u16RedOffset;
|
||||
MI_U16 u16GreenOffset;
|
||||
MI_U16 u16BlueOffset;
|
||||
|
||||
MI_U16 u16RedColor; // 00~FF, 0x80 is no change
|
||||
MI_U16 u16GreenColor;// 00~FF, 0x80 is no change
|
||||
MI_U16 u16BlueColor; // 00~FF, 0x80 is no change
|
||||
}MI_DISP_ColorTemperature_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MI_BOOL bEn;
|
||||
MI_U16 u16EntryNum;
|
||||
MI_U8 *pu8ColorR;
|
||||
MI_U8 *pu8ColorG;
|
||||
MI_U8 *pu8ColorB;
|
||||
}MI_DISP_GammaParam_t;
|
||||
|
||||
typedef struct MI_DISP_InitParam_s
|
||||
{
|
||||
MI_U32 u32DevId;
|
||||
MI_U8 *u8Data;
|
||||
} MI_DISP_InitParam_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif///_MI_DISP_DATATYPE_H_
|
158
code/application/sifarsdk/333DE/lib/mi_libs/include/mi_divp.h
Normal file
158
code/application/sifarsdk/333DE/lib/mi_libs/include/mi_divp.h
Normal file
|
@ -0,0 +1,158 @@
|
|||
/* SigmaStar trade secret */
|
||||
/* Copyright (c) [2019~2020] SigmaStar Technology.
|
||||
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 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 _MI_DIVP_H_
|
||||
#define _MI_DIVP_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "mi_divp_datatype.h"
|
||||
|
||||
#define DIVP_MAJOR_VERSION 2
|
||||
#define DIVP_SUB_VERSION 4
|
||||
#define MACRO_TO_STR(macro) #macro
|
||||
#define DIVP_VERSION_STR(major_version,sub_version) ({char *tmp = sub_version/100 ? \
|
||||
"mi_divp_version_" MACRO_TO_STR(major_version)"." MACRO_TO_STR(sub_version) : sub_version/10 ? \
|
||||
"mi_divp_version_" MACRO_TO_STR(major_version)".0" MACRO_TO_STR(sub_version) : \
|
||||
"mi_divp_version_" MACRO_TO_STR(major_version)".00" MACRO_TO_STR(sub_version);tmp;})
|
||||
#define MI_DIVP_API_VERSION DIVP_VERSION_STR(DIVP_MAJOR_VERSION,DIVP_SUB_VERSION)
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/// @brief create a DIVP channel.
|
||||
/// @param[out] pDivpChn: DIVP channel ID.
|
||||
/// @param[in] pstAttr: Attribute of DIVP channel.
|
||||
/// @return MI_SUCCESS: succeed in creating a channel.
|
||||
/// MI_DIVP_ERR_INVALID_PARAM: invalid input patamter.
|
||||
/// MI_DIVP_ERR_NULL_PTR: NULL poiter error.
|
||||
/// MI_DIVP_ERR_FAILED: Fail to create a channel.
|
||||
/// MI_DIVP_ERR_NO_RESOUCE: there is no resource.
|
||||
//------------------------------------------------------------------------------
|
||||
MI_S32 MI_DIVP_CreateChn (MI_DIVP_CHN DivpChn, MI_DIVP_ChnAttr_t* pstAttr);
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/// @brief deatroy a DIVP channel.
|
||||
/// @param[in] DivpChn: DIVP channel ID.
|
||||
/// @return MI_SUCCESS: succeed in deatroying a DIVP channel.
|
||||
/// MI_DIVP_ERR_INVALID_CHNID: Invalid channel ID.
|
||||
/// MI_DIVP_ERR_FAILED: Fail to deatroy a DIVP channel.
|
||||
/// MI_DIVP_ERR_CHN_BUSY:channel is busy.
|
||||
//------------------------------------------------------------------------------
|
||||
MI_S32 MI_DIVP_DestroyChn(MI_DIVP_CHN DivpChn);
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/// @brief set attribute of DIVP channel.
|
||||
/// @param[in] DivpChn: DIVP channel ID.
|
||||
/// @param[in] pstAttr: Attribute of DIVP channel.
|
||||
/// @return MI_SUCCESS: succeed in setting attribute of DIVP channel.
|
||||
/// MI_DIVP_ERR_INVALID_CHNID: Invalid channel ID.
|
||||
/// MI_DIVP_ERR_INVALID_PARAM: Invalid input patamter.
|
||||
/// MI_DIVP_ERR_NULL_PTR: NULL poiter error.
|
||||
/// MI_DIVP_ERR_CHN_NOT_SUPPORT: not support.
|
||||
/// MI_DIVP_ERR_FAILED: Fail to set attribute of DIVP channel.
|
||||
//------------------------------------------------------------------------------
|
||||
MI_S32 MI_DIVP_SetChnAttr(MI_DIVP_CHN DivpChn, MI_DIVP_ChnAttr_t* pstAttr);
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/// @brief get attribute of DIVP channel.
|
||||
/// @param[in] DivpChn: DIVP channel ID.
|
||||
/// @param[in] pstAttr: Attribute of DIVP channel.
|
||||
/// @return MI_SUCCESS: succeed in getting attribute of DIVP channel.
|
||||
/// MI_DIVP_ERR_INVALID_CHNID: Invalid channel ID.
|
||||
/// MI_DIVP_ERR_NULL_PTR: NULL poiter error.
|
||||
/// MI_DIVP_ERR_FAILED: Fail to get attribute of DIVP channel.
|
||||
//------------------------------------------------------------------------------
|
||||
MI_S32 MI_DIVP_GetChnAttr(MI_DIVP_CHN DivpChn, MI_DIVP_ChnAttr_t* pstAttr);
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/// @brief start a DIVP channel.
|
||||
/// @param[in] DivpChn: DIVP channel ID.
|
||||
/// @return MI_SUCCESS: succeed in starting a DIVP channel.
|
||||
/// MI_DIVP_ERR_INVALID_CHNID: Invalid channel ID.
|
||||
/// MI_DIVP_ERR_FAILED: Fail to start a DIVP channel.
|
||||
//------------------------------------------------------------------------------
|
||||
MI_S32 MI_DIVP_StartChn(MI_DIVP_CHN DivpChn);
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/// @brief stop a DIVP channel.
|
||||
/// @param[in] DivpChn: DIVP channel ID.
|
||||
/// @return MI_SUCCESS: succeed in stopping a DIVP channel.
|
||||
/// MI_DIVP_ERR_INVALID_CHNID: Invalid channel ID.
|
||||
/// MI_DIVP_ERR_FAILED: Fail to stop a DIVP channel.
|
||||
/// MI_DIVP_ERR_CHN_BUSY:channel is busy.
|
||||
//------------------------------------------------------------------------------
|
||||
MI_S32 MI_DIVP_StopChn(MI_DIVP_CHN DivpChn);
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/// @brief set attribute of DIVP channel output port.
|
||||
/// @param[in] DivpChn: DIVP channel ID.
|
||||
/// @param[in] pstOutputPortAttr: DIVP channel output port attribute.
|
||||
/// @return MI_SUCCESS: succeed in setting attribute of DIVP channel output port.
|
||||
/// MI_DIVP_ERR_INVALID_CHNID: Invalid channel ID.
|
||||
/// MI_DIVP_ERR_INVALID_PARAM: Invalid input patamter.
|
||||
/// MI_DIVP_ERR_NULL_PTR: NULL poiter error.
|
||||
/// MI_DIVP_ERR_FAILED: Fail to set attribute of DIVP channel output port.
|
||||
//------------------------------------------------------------------------------
|
||||
MI_S32 MI_DIVP_SetOutputPortAttr (MI_DIVP_CHN DivpChn, MI_DIVP_OutputPortAttr_t * pstOutputPortAttr);
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/// @brief get attribute of DIVP channel output port.
|
||||
/// @param[in] DivpChn: DIVP channel ID.
|
||||
/// @param[out] pstOutputPortAttr: DIVP channel output port attribute.
|
||||
/// @return MI_SUCCESS: succeed in getting attribute of DIVP channel output port.
|
||||
/// MI_DIVP_ERR_FAILED: Fail to get attribute of DIVP channel output port.
|
||||
/// MI_DIVP_ERR_INVALID_CHNID: Invalid channel ID.
|
||||
/// MI_DIVP_ERR_NULL_PTR: NULL poiter error.
|
||||
//------------------------------------------------------------------------------
|
||||
MI_S32 MI_DIVP_GetOutputPortAttr (MI_DIVP_CHN DivpChn, MI_DIVP_OutputPortAttr_t * pstOutputPortAttr);
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/// @brief refresh a DIVP channel.
|
||||
/// @param[in] DivpChn: DIVP channel ID.
|
||||
/// @return MI_SUCCESS: succeed in refreshing a DIVP channel.
|
||||
/// MI_DIVP_ERR_INVALID_CHNID: Invalid channel ID.
|
||||
/// MI_DIVP_ERR_FAILED: Fail to refresh a DIVP channel.
|
||||
//------------------------------------------------------------------------------
|
||||
MI_S32 MI_DIVP_RefreshChn(MI_DIVP_CHN DivpChn);
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/// @brief stretch or crop image in specified memory to target memory
|
||||
/// @param[in] pstSrcBuf: source buff info pointer
|
||||
/// @param[in] pstSrcCrop: crop info pointer
|
||||
/// @param[in] pstDstBuf: dest buff info pointer
|
||||
/// @return MI_SUCCESS: succeed in stretching image
|
||||
/// MI_DIVP_ERR_FAILED: Fail to stretch image
|
||||
//------------------------------------------------------------------------------
|
||||
MI_S32 MI_DIVP_StretchBuf(MI_DIVP_DirectBuf_t *pstSrcBuf, MI_SYS_WindowRect_t *pstSrcCrop, MI_DIVP_DirectBuf_t *pstDstBuf);
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/// @brief Init DIVP module.
|
||||
/// @return MI_SUCCESS: succeed in Init DIVP module.
|
||||
/// MI_DIVP_ERR_FAILED: Fail to Init DIVP module.
|
||||
//------------------------------------------------------------------------------
|
||||
MI_S32 MI_DIVP_InitDev(MI_DIVP_InitParam_t *pstInitParam);
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/// @brief DeInit DIVP module.
|
||||
/// @return MI_SUCCESS: succeed in DeInit DIVP module.
|
||||
/// MI_DIVP_ERR_FAILED: Fail to DeInit DIVP module.
|
||||
//------------------------------------------------------------------------------
|
||||
MI_S32 MI_DIVP_DeInitDev(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -0,0 +1,86 @@
|
|||
/* SigmaStar trade secret */
|
||||
/* Copyright (c) [2019~2020] SigmaStar Technology.
|
||||
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 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 _MI_DIVP_DATATYPE_H_
|
||||
#define _MI_DIVP_DATATYPE_H_
|
||||
#pragma pack(push)
|
||||
#pragma pack(4)
|
||||
|
||||
#define MI_DIVP_ERR_INVALID_DEVID (MI_DEF_ERR( E_MI_MODULE_ID_DIVP, E_MI_ERR_LEVEL_ERROR, E_MI_ERR_INVALID_DEVID))
|
||||
#define MI_DIVP_ERR_INVALID_CHNID (MI_DEF_ERR( E_MI_MODULE_ID_DIVP, E_MI_ERR_LEVEL_ERROR, E_MI_ERR_INVALID_CHNID))
|
||||
#define MI_DIVP_ERR_INVALID_PARAM (MI_DEF_ERR( E_MI_MODULE_ID_DIVP, E_MI_ERR_LEVEL_ERROR, E_MI_ERR_ILLEGAL_PARAM))
|
||||
#define MI_DIVP_ERR_NULL_PTR (MI_DEF_ERR( E_MI_MODULE_ID_DIVP, E_MI_ERR_LEVEL_ERROR, E_MI_ERR_NULL_PTR))
|
||||
#define MI_DIVP_ERR_FAILED (MI_DEF_ERR( E_MI_MODULE_ID_DIVP, E_MI_ERR_LEVEL_ERROR, E_MI_ERR_FAILED))
|
||||
#define MI_DIVP_ERR_CHN_NOT_STARTED (MI_DEF_ERR( E_MI_MODULE_ID_DIVP, E_MI_ERR_LEVEL_ERROR, E_MI_ERR_CHN_NOT_STARTED))
|
||||
#define MI_DIVP_ERR_CHN_NOT_STOPED (MI_DEF_ERR( E_MI_MODULE_ID_DIVP, E_MI_ERR_LEVEL_ERROR, E_MI_ERR_CHN_NOT_STOPED))
|
||||
#define MI_DIVP_ERR_CHN_NOT_SUPPORT (MI_DEF_ERR( E_MI_MODULE_ID_DIVP, E_MI_ERR_LEVEL_ERROR, E_MI_ERR_NOT_SUPPORT))
|
||||
#define MI_DIVP_ERR_NO_RESOUCE (MI_DEF_ERR( E_MI_MODULE_ID_DIVP, E_MI_ERR_LEVEL_ERROR, E_MI_ERR_UNEXIST))
|
||||
#define MI_DIVP_ERR_CHN_BUSY (MI_DEF_ERR( E_MI_MODULE_ID_DIVP, E_MI_ERR_LEVEL_ERROR, E_MI_ERR_BUSY))
|
||||
#define MI_DIVP_ERR_HAS_CREATED (MI_DEF_ERR( E_MI_MODULE_ID_DIVP, E_MI_ERR_LEVEL_ERROR, E_MI_ERR_EXIST))
|
||||
#define MI_DIVP_ERR_NO_CONTENT (MI_DEF_ERR( E_MI_MODULE_ID_DIVP, E_MI_ERR_LEVEL_ERROR, E_MI_ERR_CHN_NO_CONTENT))
|
||||
|
||||
typedef enum
|
||||
{
|
||||
E_MI_DIVP_DI_TYPE_OFF,//off
|
||||
E_MI_DIVP_DI_TYPE_2D,///2.5D DI
|
||||
E_MI_DIVP_DI_TYPE_3D,///3D DI
|
||||
E_MI_DIVP_DI_TYPE_NUM,
|
||||
} MI_DIVP_DiType_e;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
E_MI_DIVP_TNR_LEVEL_OFF,
|
||||
E_MI_DIVP_TNR_LEVEL_LOW,
|
||||
E_MI_DIVP_TNR_LEVEL_MIDDLE,
|
||||
E_MI_DIVP_TNR_LEVEL_HIGH,
|
||||
E_MI_DIVP_TNR_LEVEL_NUM,
|
||||
} MI_DIVP_TnrLevel_e;
|
||||
|
||||
typedef struct MI_DIVP_OutputPortAttr_s
|
||||
{
|
||||
MI_U32 u32Width;//output width
|
||||
MI_U32 u32Height;//output height
|
||||
MI_SYS_PixelFormat_e ePixelFormat;//output pixel format
|
||||
MI_SYS_CompressMode_e eCompMode;//compress mode
|
||||
}MI_DIVP_OutputPortAttr_t;
|
||||
|
||||
typedef struct MI_DIVP_ChnAttr_s
|
||||
{
|
||||
MI_U32 u32MaxWidth;//support max input width
|
||||
MI_U32 u32MaxHeight;//support max input height
|
||||
MI_DIVP_TnrLevel_e eTnrLevel;//TNR level
|
||||
MI_DIVP_DiType_e eDiType;//DI type
|
||||
MI_SYS_Rotate_e eRotateType;//rotate angle
|
||||
MI_SYS_WindowRect_t stCropRect;//crop information
|
||||
MI_BOOL bHorMirror;//horizontal mirror
|
||||
MI_BOOL bVerMirror;//vertical mirror
|
||||
}MI_DIVP_ChnAttr_t;
|
||||
|
||||
typedef struct MI_DIVP_DirectBuf_s
|
||||
{
|
||||
MI_SYS_PixelFormat_e ePixelFormat; //YUV420SP or ARGB888 only
|
||||
MI_U32 u32Width;
|
||||
MI_U32 u32Height;
|
||||
MI_U32 u32Stride[3];
|
||||
MI_PHY phyAddr[3];
|
||||
}MI_DIVP_DirectBuf_t;
|
||||
|
||||
typedef struct MI_DIVP_InitParam_s
|
||||
{
|
||||
MI_U32 u32DevId;
|
||||
MI_U8 *u8Data;
|
||||
} MI_DIVP_InitParam_t;
|
||||
|
||||
#pragma pack(pop)
|
||||
#endif
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user