fix isp and write bash script for set up ftp server in Hi3516
This commit is contained in:
parent
6159bbb27d
commit
c289d4ee7d
|
@ -1,18 +1,23 @@
|
||||||
# Xmake cache
|
# Xmake cache
|
||||||
.xmake/
|
.xmake
|
||||||
.vscode/
|
.vscode
|
||||||
.devenv/
|
.devenv
|
||||||
.direnv/
|
.direnv
|
||||||
Hi3516CV500_SDK/
|
Hi3516CV500_SDK
|
||||||
toolchains/
|
toolchains
|
||||||
arm-himix200-linux/
|
arm-himix200-linux
|
||||||
build/
|
build
|
||||||
Rouring
|
Rouring
|
||||||
Rouring-Vision
|
Rouring-Vision
|
||||||
smart_trash_bin
|
smart_trash_bin
|
||||||
nnie-yolov3-demo
|
nnie-yolov3-demo
|
||||||
dtof_sensor_driver
|
dtof_sensor_driver
|
||||||
|
|
||||||
|
# Build Cache
|
||||||
|
*.a
|
||||||
|
*.o
|
||||||
|
*.so
|
||||||
|
|
||||||
# MacOS Cache
|
# MacOS Cache
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
# Alias
|
||||||
|
alias a := all
|
||||||
|
alias c := clean
|
||||||
|
alias b := build
|
||||||
|
|
||||||
|
# Default Target
|
||||||
|
default := "CatFeeder"
|
||||||
|
|
||||||
|
config:
|
||||||
|
xmake f -v -c -y
|
||||||
|
|
||||||
|
reload:
|
||||||
|
direnv reload
|
||||||
|
|
||||||
|
build:
|
||||||
|
xmake b {{default}}
|
||||||
|
|
||||||
|
rebuild:
|
||||||
|
xmake b -r {{default}}
|
||||||
|
|
||||||
|
clean:
|
||||||
|
xmake c
|
||||||
|
|
||||||
|
sync:
|
||||||
|
lftp -v -c 'open -e "mirror -R build/cross/arm/ /" ftp://root:@192.168.137.3/'
|
||||||
|
|
||||||
|
ftp:
|
||||||
|
lftp ftp://root:@192.168.137.3/
|
||||||
|
|
||||||
|
ftp-tui:
|
||||||
|
termscp -P "" ftp://root@192.168.137.3:21:/
|
||||||
|
|
||||||
|
tty:
|
||||||
|
minicom -D /dev/ttyUSB0 -b 115200
|
||||||
|
|
||||||
|
all: build sync
|
11
CCPP.nix
11
CCPP.nix
|
@ -18,17 +18,6 @@
|
||||||
clang-tools
|
clang-tools
|
||||||
];
|
];
|
||||||
|
|
||||||
# Enable languages support
|
|
||||||
# languages.cplusplus.enable = true;
|
|
||||||
# env = {
|
|
||||||
# NIX_LD_LIBRARY_PATH = with pkgs;
|
|
||||||
# lib.makeLibraryPath [
|
|
||||||
# stdenv_32bit.cc.cc
|
|
||||||
# glibc_multi
|
|
||||||
# ];
|
|
||||||
# NIX_LD = with pkgs; lib.fileContents "${stdenv_32bit.cc}/nix-support/dynamic-linker";
|
|
||||||
# };
|
|
||||||
|
|
||||||
# When enter shell, exec ...
|
# When enter shell, exec ...
|
||||||
enterShell = ''
|
enterShell = ''
|
||||||
export LD_LIBRARY_PATH=$NIX_LD_LIBRARY_PATH
|
export LD_LIBRARY_PATH=$NIX_LD_LIBRARY_PATH
|
||||||
|
|
|
@ -15,7 +15,8 @@ add_includedirs(
|
||||||
"include/UsageEnvironment"
|
"include/UsageEnvironment"
|
||||||
)
|
)
|
||||||
|
|
||||||
local compile_opts = "COMPILE_OPTS = $(INCLUDES) -I. -O2 -DSOCKLEN_T=socklen_t -D_LARGEFILE_SOURCE=1 -D_FILE_OFFSET_BITS=64 "
|
local compile_opts =
|
||||||
|
"COMPILE_OPTS = $(INCLUDES) -I. -O2 -DSOCKLEN_T=socklen_t -D_LARGEFILE_SOURCE=1 -D_FILE_OFFSET_BITS=64 "
|
||||||
|
|
||||||
local make_scipt = [[
|
local make_scipt = [[
|
||||||
C = c
|
C = c
|
||||||
|
@ -76,4 +77,3 @@ end)
|
||||||
on_test(function(package)
|
on_test(function(package)
|
||||||
assert(package:has_cxxtypes("RTSPServer", { includes = "liveMedia.hh" }))
|
assert(package:has_cxxtypes("RTSPServer", { includes = "liveMedia.hh" }))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
mount /dev/mmcblk0p5 /mnt/sd
|
||||||
|
tcpsvd 0 21 ftpd -w /mnt/sd &
|
||||||
|
cd /mnt/sd
|
13
src/main.cpp
13
src/main.cpp
|
@ -13,14 +13,14 @@ int main(int argc, char** argv) {
|
||||||
|
|
||||||
zlog_category_t *log = nullptr;
|
zlog_category_t *log = nullptr;
|
||||||
|
|
||||||
// init log and check log.conf
|
// Init log and check log.conf
|
||||||
result = zlog_init("log.conf");
|
result = zlog_init("log.conf");
|
||||||
if (result) {
|
if (result) {
|
||||||
std::cout << "zlog init failed! Please check log.conf!\n";
|
std::cout << "zlog init failed! Please check log.conf!\n";
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// get log cat for main to print
|
// Get log cat for main to print
|
||||||
log = zlog_get_category("cat");
|
log = zlog_get_category("cat");
|
||||||
if (!log) {
|
if (!log) {
|
||||||
std::cout << "Main get log failed!\n";
|
std::cout << "Main get log failed!\n";
|
||||||
|
@ -36,10 +36,11 @@ int main(int argc, char** argv) {
|
||||||
zlog_warn(log, "Can't Create log dir FOR %s", file_error.message().c_str());
|
zlog_warn(log, "Can't Create log dir FOR %s", file_error.message().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
// eb3516VideoInit();
|
eb3516VideoInit();
|
||||||
// eb3516VideoStart();
|
eb3516VideoStart();
|
||||||
eb3516Yolov3Init("./coco_yolov3_detect.wk", "./dog_bike_car_416x416.bgr");
|
eb3516VideoStop();
|
||||||
eb3516Yolov3Exit();
|
// eb3516Yolov3Init("./coco_yolov3_detect.wk", "./dog_bike_car_416x416.bgr");
|
||||||
|
// eb3516Yolov3Exit();
|
||||||
|
|
||||||
zlog_fini();
|
zlog_fini();
|
||||||
|
|
||||||
|
|
|
@ -102,8 +102,8 @@ bool eb3516VideoInit(void) {
|
||||||
|
|
||||||
// Get Sensor(VI) Info: picture size , frame rate
|
// Get Sensor(VI) Info: picture size , frame rate
|
||||||
SAMPLE_COMM_VI_GetSensorInfo(&g_stViConfig);
|
SAMPLE_COMM_VI_GetSensorInfo(&g_stViConfig);
|
||||||
SAMPLE_COMM_VI_GetSizeBySensor(
|
SAMPLE_COMM_VI_GetSizeBySensor(g_stViConfig.astViInfo[0].stSnsInfo.enSnsType,
|
||||||
g_stViConfig.astViInfo[0].stSnsInfo.enSnsType, &enPicSize);
|
&enPicSize);
|
||||||
SAMPLE_COMM_SYS_GetPicSize(enPicSize, &stSize);
|
SAMPLE_COMM_SYS_GetPicSize(enPicSize, &stSize);
|
||||||
SAMPLE_COMM_VI_GetFrameRateBySensor(
|
SAMPLE_COMM_VI_GetFrameRateBySensor(
|
||||||
g_stViConfig.astViInfo[0].stSnsInfo.enSnsType, &u32Framerate);
|
g_stViConfig.astViInfo[0].stSnsInfo.enSnsType, &u32Framerate);
|
||||||
|
@ -136,8 +136,7 @@ bool eb3516VideoInit(void) {
|
||||||
g_stViConfig.astViInfo[0].stPipeInfo.aPipe[1] = 1; // snap pipe
|
g_stViConfig.astViInfo[0].stPipeInfo.aPipe[1] = 1; // snap pipe
|
||||||
g_stViConfig.astViInfo[0].stPipeInfo.aPipe[2] = -1;
|
g_stViConfig.astViInfo[0].stPipeInfo.aPipe[2] = -1;
|
||||||
g_stViConfig.astViInfo[0].stPipeInfo.aPipe[3] = -1;
|
g_stViConfig.astViInfo[0].stPipeInfo.aPipe[3] = -1;
|
||||||
g_stViConfig.astViInfo[0].stPipeInfo.enMastPipeMode =
|
g_stViConfig.astViInfo[0].stPipeInfo.enMastPipeMode = VI_OFFLINE_VPSS_OFFLINE;
|
||||||
VI_OFFLINE_VPSS_OFFLINE;
|
|
||||||
// 设置 VI 通道信息
|
// 设置 VI 通道信息
|
||||||
g_stViConfig.astViInfo[0].stChnInfo.ViChn = 0;
|
g_stViConfig.astViInfo[0].stChnInfo.ViChn = 0;
|
||||||
g_stViConfig.astViInfo[0].stChnInfo.enPixFormat =
|
g_stViConfig.astViInfo[0].stChnInfo.enPixFormat =
|
||||||
|
@ -152,8 +151,7 @@ bool eb3516VideoInit(void) {
|
||||||
g_stViConfig.astViInfo[0].stSnapInfo.SnapPipe = 1;
|
g_stViConfig.astViInfo[0].stSnapInfo.SnapPipe = 1;
|
||||||
g_stViConfig.astViInfo[0].stSnapInfo.enVideoPipeMode =
|
g_stViConfig.astViInfo[0].stSnapInfo.enVideoPipeMode =
|
||||||
VI_OFFLINE_VPSS_OFFLINE;
|
VI_OFFLINE_VPSS_OFFLINE;
|
||||||
g_stViConfig.astViInfo[0].stSnapInfo.enSnapPipeMode =
|
g_stViConfig.astViInfo[0].stSnapInfo.enSnapPipeMode = VI_OFFLINE_VPSS_OFFLINE;
|
||||||
VI_OFFLINE_VPSS_OFFLINE;
|
|
||||||
|
|
||||||
// 配置 VPSS
|
// 配置 VPSS
|
||||||
VPSS_GetParams(&g_stVpss0Config, &stSize, false);
|
VPSS_GetParams(&g_stVpss0Config, &stSize, false);
|
||||||
|
@ -224,8 +222,7 @@ bool eb3516VideoStart(void) {
|
||||||
g_stViConfig.astViInfo[0].stPipeInfo.aPipe[1],
|
g_stViConfig.astViInfo[0].stPipeInfo.aPipe[1],
|
||||||
g_stViConfig.astViInfo[0].stChnInfo.ViChn, g_stVpss1Config.s32GrpId);
|
g_stViConfig.astViInfo[0].stChnInfo.ViChn, g_stVpss1Config.s32GrpId);
|
||||||
if (s32Ret != HI_SUCCESS) {
|
if (s32Ret != HI_SUCCESS) {
|
||||||
zlog_error(log_video, "VI Snap Pipe bind VPSS1 failed with %#x!\n",
|
zlog_error(log_video, "VI Snap Pipe bind VPSS1 failed with %#x!\n", s32Ret);
|
||||||
s32Ret);
|
|
||||||
goto EXIT_VPSS_STOP;
|
goto EXIT_VPSS_STOP;
|
||||||
}
|
}
|
||||||
zlog_debug(log_video, "eb3516 VI Bind VPSS1 Success");
|
zlog_debug(log_video, "eb3516 VI Bind VPSS1 Success");
|
||||||
|
@ -235,12 +232,11 @@ bool eb3516VideoStart(void) {
|
||||||
SAMPLE_COMM_VENC_GetGopAttr(VENC_GOPMODE_NORMALP, &stGopAttr);
|
SAMPLE_COMM_VENC_GetGopAttr(VENC_GOPMODE_NORMALP, &stGopAttr);
|
||||||
|
|
||||||
// 编码 h.265 4k
|
// 编码 h.265 4k
|
||||||
s32Ret =
|
s32Ret = SAMPLE_COMM_VENC_Creat(g_VencChn[0], g_CodecTypes[0], g_PicSizes[0],
|
||||||
SAMPLE_COMM_VENC_Creat(g_VencChn[0], g_CodecTypes[0], g_PicSizes[0],
|
|
||||||
SAMPLE_RC_VBR, 0, HI_FALSE, &stGopAttr);
|
SAMPLE_RC_VBR, 0, HI_FALSE, &stGopAttr);
|
||||||
if (s32Ret != HI_SUCCESS) {
|
if (s32Ret != HI_SUCCESS) {
|
||||||
zlog_error(log_video, "Create Venc Chn %d failed with %#x!\n",
|
zlog_error(log_video, "Create Venc Chn %d failed with %#x!\n", g_VencChn[0],
|
||||||
g_VencChn[0], s32Ret);
|
s32Ret);
|
||||||
goto EXIT_VI_VPSS_UNBIND;
|
goto EXIT_VI_VPSS_UNBIND;
|
||||||
}
|
}
|
||||||
zlog_debug(log_video, "eb3516 VENC Start Success...");
|
zlog_debug(log_video, "eb3516 VENC Start Success...");
|
||||||
|
@ -293,15 +289,13 @@ bool eb3516VideoStart(void) {
|
||||||
s32Ret = HI_MPI_SNAP_SetPipeAttr(
|
s32Ret = HI_MPI_SNAP_SetPipeAttr(
|
||||||
g_stViConfig.astViInfo[0].stPipeInfo.aPipe[1], &stSnapAttr);
|
g_stViConfig.astViInfo[0].stPipeInfo.aPipe[1], &stSnapAttr);
|
||||||
if (s32Ret != HI_SUCCESS) {
|
if (s32Ret != HI_SUCCESS) {
|
||||||
zlog_error(log_video, "HI_MPI_SNAP_SetPipeAttr failed with %#x!\n",
|
zlog_error(log_video, "HI_MPI_SNAP_SetPipeAttr failed with %#x!\n", s32Ret);
|
||||||
s32Ret);
|
|
||||||
goto EXIT_VO_STOP;
|
goto EXIT_VO_STOP;
|
||||||
}
|
}
|
||||||
s32Ret =
|
s32Ret =
|
||||||
HI_MPI_SNAP_EnablePipe(g_stViConfig.astViInfo[0].stPipeInfo.aPipe[1]);
|
HI_MPI_SNAP_EnablePipe(g_stViConfig.astViInfo[0].stPipeInfo.aPipe[1]);
|
||||||
if (s32Ret != HI_SUCCESS) {
|
if (s32Ret != HI_SUCCESS) {
|
||||||
zlog_error(log_video, "HI_MPI_SNAP_EnablePipe failed with %#x!\n",
|
zlog_error(log_video, "HI_MPI_SNAP_EnablePipe failed with %#x!\n", s32Ret);
|
||||||
s32Ret);
|
|
||||||
goto EXIT_VO_STOP;
|
goto EXIT_VO_STOP;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -317,11 +311,10 @@ bool eb3516VideoStart(void) {
|
||||||
DCF_DRSCRIPTION_LENGTH);
|
DCF_DRSCRIPTION_LENGTH);
|
||||||
snprintf((char *)stIspDCF.stIspDCFConstInfo.au8Software,
|
snprintf((char *)stIspDCF.stIspDCFConstInfo.au8Software,
|
||||||
DCF_DRSCRIPTION_LENGTH, "CatFeeder snap");
|
DCF_DRSCRIPTION_LENGTH, "CatFeeder snap");
|
||||||
s32Ret = HI_MPI_ISP_SetDCFInfo(
|
s32Ret = HI_MPI_ISP_SetDCFInfo(g_stViConfig.astViInfo[0].stPipeInfo.aPipe[0],
|
||||||
g_stViConfig.astViInfo[0].stPipeInfo.aPipe[0], &stIspDCF);
|
&stIspDCF);
|
||||||
if (s32Ret != HI_SUCCESS) {
|
if (s32Ret != HI_SUCCESS) {
|
||||||
zlog_error(log_video, "HI_MPI_ISP_SetDCFInfo failed with %#x!\n",
|
zlog_error(log_video, "HI_MPI_ISP_SetDCFInfo failed with %#x!\n", s32Ret);
|
||||||
s32Ret);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// // 绑定 VPSS[0,0]->VENC[0]
|
// // 绑定 VPSS[0,0]->VENC[0]
|
||||||
|
@ -372,10 +365,8 @@ EXIT_VI_VPSS_UNBIND:
|
||||||
g_stViConfig.astViInfo[0].stChnInfo.ViChn,
|
g_stViConfig.astViInfo[0].stChnInfo.ViChn,
|
||||||
g_stVpss1Config.s32GrpId);
|
g_stVpss1Config.s32GrpId);
|
||||||
EXIT_VPSS_STOP:
|
EXIT_VPSS_STOP:
|
||||||
SAMPLE_COMM_VPSS_Stop(g_stVpss0Config.s32GrpId,
|
SAMPLE_COMM_VPSS_Stop(g_stVpss0Config.s32GrpId, g_stVpss0Config.abChnEnable);
|
||||||
g_stVpss0Config.abChnEnable);
|
SAMPLE_COMM_VPSS_Stop(g_stVpss1Config.s32GrpId, g_stVpss1Config.abChnEnable);
|
||||||
SAMPLE_COMM_VPSS_Stop(g_stVpss1Config.s32GrpId,
|
|
||||||
g_stVpss1Config.abChnEnable);
|
|
||||||
EXIT_VI_STOP:
|
EXIT_VI_STOP:
|
||||||
SAMPLE_COMM_VI_StopVi(&g_stViConfig);
|
SAMPLE_COMM_VI_StopVi(&g_stViConfig);
|
||||||
EXIT_SYS_STOP:
|
EXIT_SYS_STOP:
|
||||||
|
@ -396,10 +387,8 @@ void eb3516VideoStop(void) {
|
||||||
SAMPLE_COMM_VI_UnBind_VPSS(g_stViConfig.astViInfo[0].stPipeInfo.aPipe[1],
|
SAMPLE_COMM_VI_UnBind_VPSS(g_stViConfig.astViInfo[0].stPipeInfo.aPipe[1],
|
||||||
g_stViConfig.astViInfo[0].stChnInfo.ViChn,
|
g_stViConfig.astViInfo[0].stChnInfo.ViChn,
|
||||||
g_stVpss1Config.s32GrpId);
|
g_stVpss1Config.s32GrpId);
|
||||||
SAMPLE_COMM_VPSS_Stop(g_stVpss0Config.s32GrpId,
|
SAMPLE_COMM_VPSS_Stop(g_stVpss0Config.s32GrpId, g_stVpss0Config.abChnEnable);
|
||||||
g_stVpss0Config.abChnEnable);
|
SAMPLE_COMM_VPSS_Stop(g_stVpss1Config.s32GrpId, g_stVpss1Config.abChnEnable);
|
||||||
SAMPLE_COMM_VPSS_Stop(g_stVpss1Config.s32GrpId,
|
|
||||||
g_stVpss1Config.abChnEnable);
|
|
||||||
SAMPLE_COMM_VI_StopVi(&g_stViConfig);
|
SAMPLE_COMM_VI_StopVi(&g_stViConfig);
|
||||||
SAMPLE_COMM_SYS_Exit();
|
SAMPLE_COMM_SYS_Exit();
|
||||||
|
|
||||||
|
@ -418,6 +407,4 @@ bool eb3516GetPic(void) {
|
||||||
zlog_error(log_video, "Get Pipe Frame Failed");
|
zlog_error(log_video, "Get Pipe Frame Failed");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -9,6 +9,7 @@ extern "C"{
|
||||||
|
|
||||||
bool eb3516VideoInit(void);
|
bool eb3516VideoInit(void);
|
||||||
bool eb3516VideoStart(void);
|
bool eb3516VideoStart(void);
|
||||||
|
void eb3516VideoStop(void);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,11 +12,16 @@ toolchain_end()
|
||||||
-- set_config("sdk", "/opt/hisi-linux/x86-arm/arm-himix200-linux/")
|
-- set_config("sdk", "/opt/hisi-linux/x86-arm/arm-himix200-linux/")
|
||||||
set_toolchains("arm-himix200-linux")
|
set_toolchains("arm-himix200-linux")
|
||||||
set_plat("cross")
|
set_plat("cross")
|
||||||
|
set_arch("arm")
|
||||||
set_languages("c11", "c++14")
|
set_languages("c11", "c++14")
|
||||||
|
|
||||||
--- Add requires and dependencies
|
--- Add requires and dependencies
|
||||||
add_requires("live555 2024.11.28")
|
add_requires(
|
||||||
add_requires("zlog 1.2.17", { system = false })
|
"zlog 1.2.17",
|
||||||
|
"mongoose 7.15",
|
||||||
|
"live555 2024.11.28",
|
||||||
|
{ system = false }
|
||||||
|
)
|
||||||
|
|
||||||
target("ISP")
|
target("ISP")
|
||||||
set_kind("static")
|
set_kind("static")
|
||||||
|
|
Loading…
Reference in New Issue