diff --git a/vendor/hisilicon/build_config.json b/vendor/hisilicon/build_config.json new file mode 100644 index 0000000000000000000000000000000000000000..ddf80995b9e475631147baea6ea3e95d86a56bd7 --- /dev/null +++ b/vendor/hisilicon/build_config.json @@ -0,0 +1,18 @@ +[ + { + "buildTarget": "Pegasus-app", + "relativePath": "demo/helloworld", + "chip": "Hi3403V100", + "buildDef": "CLANG", + "needSmoke": "false", + "description": "测试" + }, + { + "buildTarget": "Pegasus-app", + "relativePath": "demo/helloworld", + "chip": "Hi3403V100", + "buildDef": "GCC", + "needSmoke": "false", + "description": "测试" + } +] diff --git a/vendor/hisilicon/demo/Makefile b/vendor/hisilicon/demo/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..56d52db939ed35521bd2a7cd8cbded6eab19aab0 --- /dev/null +++ b/vendor/hisilicon/demo/Makefile @@ -0,0 +1,28 @@ +LLVM ?= 0 + +ifeq ($(PARAM_FILE), ) + ifeq ($(LLVM), 1) + PARAM_FILE := ../../../platform/ss928v100_clang/smp/a55_linux/mpp/Makefile.param + include $(PARAM_FILE) + else + PARAM_FILE := ../../../platform/ss928v100_gcc/smp/a55_linux/mpp/Makefile.param + include $(PARAM_FILE) + endif +endif + +target=$(shell ls -d */ | sed "s;/;;g" | grep -v "thirdparty") + +target_clean=$(addsuffix _clean,$(target)) + +.PHONY:clean all $(target) $(target_clean) + +all:$(target) + @echo "~~~~~~~~~~~~~~Build All Sample SUCCESS~~~~~~~~~~~~~~" +clean:$(target_clean) + @echo "~~~~~~~~~~~~~~Clean All Sample SUCCESS~~~~~~~~~~~~~~" +$(target): + @echo "~~~~~~~~~~Start build $@~~~~~~~~~~" + @cd $@ && make +$(target_clean): + @echo "~~~~~~~~~~Start clean $(subst _clean,,$@)~~~~~~~~~~" + @cd $(subst _clean,,$@) && make clean diff --git a/vendor/hisilicon/demo/Makefile.param b/vendor/hisilicon/demo/Makefile.param new file mode 100644 index 0000000000000000000000000000000000000000..50984d012fbe10b7b9acc4c1e04c43ab2c3acb6c --- /dev/null +++ b/vendor/hisilicon/demo/Makefile.param @@ -0,0 +1,253 @@ +LLVM ?= 0 + +ifeq ($(PARAM_FILE), ) + ifeq ($(LLVM), 1) + PARAM_FILE := ../../../../platform/ss928v100_clang/smp/a55_linux/mpp/Makefile.param + include $(PARAM_FILE) + else + PARAM_FILE := ../../../../platform/ss928v100_gcc/smp/a55_linux/mpp/Makefile.param + include $(PARAM_FILE) + endif +endif + +ifeq ($(LLVM), 1) + export CXX := $(COMPILER_PATH)/clang++ --target=aarch64-linux-ohos -Wno-unused-command-line-argument --sysroot $(SYSROOT_PATH) +else + export CXX := $(CROSS)g++ +endif + +################# select sensor type for your sample ############################### +#### HY_S0603_MIPI_8M_30FPS_12BIT ################# +#### HY_S0603_MIPI_8M_30FPS_10BIT_WDR2TO1 ################# +#### OV_OS08A20_MIPI_8M_30FPS_12BIT ################# +#### OV_OS08A20_MIPI_8M_30FPS_12BIT_WDR2TO1 ################# +#### SONY_IMX347_SLAVE_MIPI_4M_30FPS_12BIT ################# +#### OV_OS04A10_MIPI_4M_30FPS_12BIT ################# +#### SC450AI_MIPI_4M_30FPS_10BIT ################# +#### SC450AI_MIPI_4M_30FPS_10BIT_WDR2TO1 ################# +#### SC450AI_2L_MIPI_4M_30FPS_10BIT ################# +#### SC450AI_2L_MIPI_2M_30FPS_10BIT ################# +#### SC450AI_2L_MIPI_1344x760_30FPS_10BIT ################# +## change sensor type here. default: hy_s0603 + +SENSOR0_TYPE ?= OV_OS04A10_MIPI_4M_30FPS_12BIT +SENSOR1_TYPE ?= OV_OS04A10_MIPI_4M_30FPS_12BIT +SENSOR2_TYPE ?= OV_OS04A10_MIPI_4M_30FPS_12BIT +SENSOR3_TYPE ?= OV_OS04A10_MIPI_4M_30FPS_12BIT + +MPI_LIBS := $(REL_LIB)/libss_mpi.a + +ifeq ($(CONFIG_OT_ISP_SUPPORT), y) +MPI_LIBS += $(REL_LIB)/libss_ae.a +MPI_LIBS += $(REL_LIB)/libss_isp.a +MPI_LIBS += $(REL_LIB)/libot_isp.a +MPI_LIBS += $(REL_LIB)/libss_awb.a +MPI_LIBS += $(REL_LIB)/libss_dehaze.a +MPI_LIBS += $(REL_LIB)/libss_extend_stats.a +MPI_LIBS += $(REL_LIB)/libss_drc.a +MPI_LIBS += $(REL_LIB)/libss_ldci.a +MPI_LIBS += $(REL_LIB)/libss_crb.a +MPI_LIBS += $(REL_LIB)/libss_bnr.a +MPI_LIBS += $(REL_LIB)/libss_calcflicker.a +MPI_LIBS += $(REL_LIB)/libss_ir_auto.a +MPI_LIBS += $(REL_LIB)/libss_acs.a +MPI_LIBS += $(REL_LIB)/libss_acs.a +MPI_LIBS += $(REL_LIB)/libsns_hy_s0603.a +MPI_LIBS += $(REL_LIB)/libsns_os08a20.a +MPI_LIBS += $(REL_LIB)/libsns_imx347_slave.a +MPI_LIBS += $(REL_LIB)/libsns_os04a10.a +MPI_LIBS += $(REL_LIB)/libsns_sc450ai.a +MPI_LIBS += $(REL_LIB)/libsns_sc450ai_2l.a +endif + + +ifeq ($(CONFIG_OT_AUDIO_SUPPORT), y) +AUDIO_LIBA := $(REL_LIB)/libss_voice_engine.a +AUDIO_LIBA += $(REL_LIB)/libss_upvqe.a +AUDIO_LIBA += $(REL_LIB)/libss_dnvqe.a +AUDIO_LIBA += $(REL_LIB)/libaac_comm.a +AUDIO_LIBA += $(REL_LIB)/libaac_enc.a +AUDIO_LIBA += $(REL_LIB)/libaac_dec.a +AUDIO_LIBA += $(REL_LIB)/libaac_sbr_enc.a +AUDIO_LIBA += $(REL_LIB)/libaac_sbr_dec.a +endif + +COMMON_DIR ?= $(SDK_PATH)/mpp/sample/common +ifeq ($(CONFIG_OT_AUDIO_SUPPORT), y) +AUDIO_ADP_DIR ?= $(SDK_PATH)/mpp/sample/audio/adp +endif + +INC_FLAGS := -I$(REL_INC) +INC_FLAGS += -I$(REL_INC) +INC_FLAGS += -I$(SDK_PATH)/$(EXTDRV)/es8388 +INC_FLAGS += -I$(SDK_PATH)/$(EXTDRV)/lt8618sx + +ISP_VERSION := ISP_V2 + +CFLAGS += -Wall -g $(INC_FLAGS) -D$(OT_ARCH) -D$(OT_FPGA) -lpthread -lm -ldl -D$(ISP_VERSION) +ifeq ($(CONFIG_LIBC_TYPE),glibc) +CFLAGS += -lstdc++ +else +CFLAGS += -lc++ -lc +endif + +CFLAGS += $(LIBS_CFLAGS) +CFLAGS += $(LIBS_EXEC_CFLAGS) +CFLAGS += $(MPP_CFLAGS) +CFLAGS += -DSENSOR0_TYPE=$(SENSOR0_TYPE) +CFLAGS += -DSENSOR1_TYPE=$(SENSOR1_TYPE) +CFLAGS += -DSENSOR2_TYPE=$(SENSOR2_TYPE) +CFLAGS += -DSENSOR3_TYPE=$(SENSOR3_TYPE) + +ifeq ($(MEM_SHARE), y) + CFLAGS += -DSAMPLE_MEM_SHARE_ENABLE +endif + +################ select audio codec type for your sample ################ +#external acodec +#ACODEC_TYPE ?= ACODEC_TYPE_ES8388 +ACODEC_TYPE ?= ACODEC_TYPE_INNER +INNER_HDMI ?= y + +ifeq ($(ACODEC_TYPE), ACODEC_TYPE_ES8388) + CFLAGS += -DOT_ACODEC_TYPE_ES8388 +endif + +ifeq ($(INNER_HDMI), y) + CFLAGS += -DOT_ACODEC_TYPE_HDMI +endif + +ifeq ($(ACODEC_TYPE), ACODEC_TYPE_INNER) + CFLAGS += -DOT_ACODEC_TYPE_INNER +endif + +ifeq ($(CONFIG_OT_AUDIO_SUPPORT), y) +################ select audio module library type for your sample ################ +AUDIO_MODULE_LIB_TYPE ?= AUDIO_LIB_TYPE_STATIC +#AUDIO_MODULE_LIB_TYPE ?= AUDIO_LIB_TYPE_SHARE +ifeq ($(AUDIO_MODULE_LIB_TYPE), AUDIO_LIB_TYPE_STATIC) +##### VQE ##### + CFLAGS += -DOT_VQE_USE_STATIC_MODULE_REGISTER + AUDIO_LIBA += $(REL_LIB)/libvqe_res.a + AUDIO_LIBA += $(REL_LIB)/libvqe_record.a + AUDIO_LIBA += $(REL_LIB)/libvqe_hpf.a + AUDIO_LIBA += $(REL_LIB)/libvqe_anr.a + AUDIO_LIBA += $(REL_LIB)/libvqe_aec.a + AUDIO_LIBA += $(REL_LIB)/libvqe_agc.a + AUDIO_LIBA += $(REL_LIB)/libvqe_eq.a + AUDIO_LIBA += $(REL_LIB)/libvqe_talkv2.a +##### AAC ##### + CFLAGS += -DOT_AAC_USE_STATIC_MODULE_REGISTER + AUDIO_LIBA += $(REL_LIB)/libaac_dec.a + AUDIO_LIBA += $(REL_LIB)/libaac_enc.a + AUDIO_LIBA += $(REL_LIB)/libaac_comm.a + CFLAGS += -DOT_AAC_HAVE_SBR_LIB + AUDIO_LIBA += $(REL_LIB)/libaac_sbr_dec.a + AUDIO_LIBA += $(REL_LIB)/libaac_sbr_enc.a +endif +endif + +################ config gyro dis for your sample ################ +GYRO_DIS ?= n + +ifeq ($(GYRO_DIS), y) + CFLAGS += -DOT_GYRODIS_SUPPORT + MPI_LIBS += $(REL_LIB)/libss_motionfusion.a +endif + +######################################################################### +#COMM_SRC := $(wildcard $(COMMON_DIR)/*.c) +COMM_SRC := $(wildcard $(COMMON_DIR)/sample_comm_sys.c) +COMM_SRC += $(wildcard $(COMMON_DIR)/sample_comm_isp.c) +COMM_SRC += $(wildcard $(COMMON_DIR)/sample_comm_vi.c) +COMM_SRC += $(wildcard $(COMMON_DIR)/sample_comm_vo.c) +COMM_SRC += $(wildcard $(COMMON_DIR)/sample_comm_mipi_tx.c) +COMM_SRC += $(wildcard $(COMMON_DIR)/sample_comm_vpss.c) +COMM_SRC += $(wildcard $(COMMON_DIR)/loadbmp.c) +COMM_SRC += $(wildcard $(COMMON_DIR)/sample_comm_vdec.c) +ifeq ($(CONFIG_OT_AUDIO_SUPPORT), y) +COMM_SRC += $(wildcard $(COMMON_DIR)/sample_comm_audio.c) +endif +COMM_SRC += $(wildcard $(COMMON_DIR)/sample_comm_venc.c) +COMM_SRC += $(wildcard $(COMMON_DIR)/sample_comm_region.c) +COMM_SRC += $(wildcard $(COMMON_DIR)/sample_ipc.c) +ifeq ($(CONFIG_DRIVER_SPACE_TYPE),user_space) +COMM_SRC += $(wildcard $(COMMON_DIR)/sdk_exit.c) +COMM_SRC += $(wildcard $(COMMON_DIR)/sdk_init.c) +endif +COMM_OBJ := $(COMM_SRC:%.c=%.o) +COMM_INC := -I$(COMMON_DIR) +ifeq ($(CONFIG_OT_AUDIO_SUPPORT), y) +COMM_INC += -I$(AUDIO_ADP_DIR) +endif + +MEDIA_MSG_CLIENT_SRC := $(wildcard $(COMMON_DIR)/media_msg/client/*.c) +MEDIA_MSG_CLIENT_OBJ := $(MEDIA_MSG_CLIENT_SRC:%.c=%.o) + +MEDIA_MSG_SERVER_SRC := $(wildcard $(COMMON_DIR)/media_msg/server/*.c) +MEDIA_MSG_SERVER_OBJ := $(MEDIA_MSG_SERVER_SRC:%.c=%.o) + +MEDIA_MSG_INC := -I$(COMMON_DIR)/media_msg/include +MEDIA_MSG_INC += -I$(SDK_PATH)/ot_syslink/ipcmsg/include +MEDIA_MSG_INC += -I$(SDK_PATH)/ot_syslink/datafifo/include + +ifeq ($(CONFIG_DRIVER_SPACE_TYPE),user_space) +MPI_LIBS += $(REL_LIB)/svp_npu/libsvp_acl.a +MPI_LIBS += -L$(REL_LIB)/svp_npu -lprotobuf-c +SDK_LIB_PATH := -L$(REL_LIB) -L$(REL_LIB)/extdrv +SDK_LIB := $(SDK_LIB_PATH) +SDK_LIB += -l$(KO_PREFIX)_osal +SDK_LIB += -l$(KO_PREFIX)_base +SDK_LIB += -l$(KO_PREFIX)_sys +#SDK_LIB += -l$(KO_PREFIX)_vb +SDK_LIB += -l$(KO_PREFIX)_chnl +SDK_LIB += -l$(KO_PREFIX)_rgn +SDK_LIB += -l$(KO_PREFIX)_vpp +SDK_LIB += -l$(KO_PREFIX)_vo +SDK_LIB += -l$(KO_PREFIX)_vgs +SDK_LIB += -l$(KO_PREFIX)_vpss +SDK_LIB += -l$(KO_PREFIX)_vdec +SDK_LIB += -l$(KO_PREFIX)_h265e +SDK_LIB += -l$(KO_PREFIX)_h264e +SDK_LIB += -l$(KO_PREFIX)_jpege +SDK_LIB += -l$(KO_PREFIX)_venc +#SDK_LIB += -l$(KO_PREFIX)_venc_svr +SDK_LIB += -l$(KO_PREFIX)_vedu +SDK_LIB += -l$(KO_PREFIX)_vi +SDK_LIB += -l$(KO_PREFIX)_mpi_isp +SDK_LIB += -l$(KO_PREFIX)_rc +SDK_LIB += -l$(KO_PREFIX)_jpegd +SDK_LIB += $(REL_LIB)/libss_hdmi.a +SDK_LIB += -l$(KO_PREFIX)_vfmw +SDK_LIB += -l$(KO_PREFIX)_gdc +SDK_LIB += -l$(KO_PREFIX)_dis +SDK_LIB += -l$(KO_PREFIX)_irq +SDK_LIB += $(REL_LIB)/libss_dpu_match.a +SDK_LIB += $(REL_LIB)/libss_dpu_rect.a +SDK_LIB += $(REL_LIB)/libss_mau.a +SDK_LIB += $(REL_LIB)/libss_ive.a +SDK_LIB += $(REL_LIB)/libss_pqp.a +#SDK_LIB += -l$(KO_PREFIX)_avs +# SDK_LIB += -l$(KO_PREFIX)_mcf +# SDK_LIB += -l$(KO_PREFIX)_mcf_vi +SDK_LIB += -l$(KO_PREFIX)_sensor_i2c +SDK_LIB += -l$(KO_PREFIX)_sensor_spi +#SDK_LIB += -ltde + +ifeq ($(CONFIG_OT_AUDIO_SUPPORT),y) +SDK_LIB += -l$(KO_PREFIX)_aio +SDK_LIB += -l$(KO_PREFIX)_ai +SDK_LIB += -l$(KO_PREFIX)_ao +SDK_LIB += -l$(KO_PREFIX)_aenc +SDK_LIB += -l$(KO_PREFIX)_adec +SDK_LIB += -l$(KO_PREFIX)_acodec + +MPI_LIBS += $(AUDIO_LIBA) +endif + +ifeq ($(CONFIG_OT_HEIF_SUPPORT),y) +SDK_LIB += -lheif +SDK_LIB += -lfileformat +endif + +endif diff --git a/vendor/hisilicon/demo/helloworld/Makefile b/vendor/hisilicon/demo/helloworld/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..8554887853cf32a65c62010e32ea4c344510f7c4 --- /dev/null +++ b/vendor/hisilicon/demo/helloworld/Makefile @@ -0,0 +1,11 @@ +include ../Makefile.param + +########### SRCS & INC ############ +SMP_SRCS := $(wildcard $(PWD)/*.c) + +TARGET := main + +TARGET_PATH := $(PWD)/out + +# compile linux or LITEOS +include ../smp_linux_user_space.mak \ No newline at end of file diff --git a/vendor/hisilicon/demo/helloworld/helloworld.c b/vendor/hisilicon/demo/helloworld/helloworld.c new file mode 100644 index 0000000000000000000000000000000000000000..3d10c830d6e371ec27edaf7d1cacc70c3c189184 --- /dev/null +++ b/vendor/hisilicon/demo/helloworld/helloworld.c @@ -0,0 +1,280 @@ +/* + * Copyright (c) 2025 HiSilicon (Shanghai) Technologies Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "sample_comm.h" +#include "sdk_module_init.h" +#include "securec.h" + +static volatile sig_atomic_t g_sig_flag = 0; + +#define VB_RAW_CNT_NONE 0 +#define VB_YUV_ROUTE_CNT 10 + +static sample_vo_cfg g_vo_cfg = { + .vo_dev = SAMPLE_VO_DEV_UHD, + .vo_intf_type = OT_VO_INTF_HDMI, + .intf_sync = OT_VO_OUT_1080P60, + .bg_color = COLOR_RGB_BLACK, + .pix_format = OT_PIXEL_FORMAT_YVU_SEMIPLANAR_420, + .disp_rect = {0, 0, 1920, 1080}, + .image_size = {1920, 1080}, + .vo_part_mode = OT_VO_PARTITION_MODE_SINGLE, + .dis_buf_len = 3, /* 3: def buf len for single */ + .dst_dynamic_range = OT_DYNAMIC_RANGE_SDR8, + .vo_mode = VO_MODE_1MUX, + .compress_mode = OT_COMPRESS_MODE_NONE, +}; + +static td_void sample_get_char(td_void) +{ + if (g_sig_flag == 1) { + return; + } + + sample_pause(); +} + +static td_void sample_vi_get_default_vb_config(ot_size *size, ot_vb_cfg *vb_cfg, ot_vi_video_mode video_mode, + td_u32 yuv_cnt, td_u32 raw_cnt) +{ + ot_vb_calc_cfg calc_cfg; + ot_pic_buf_attr buf_attr; + + (td_void)memset_s(vb_cfg, sizeof(ot_vb_cfg), 0, sizeof(ot_vb_cfg)); + vb_cfg->max_pool_cnt = 128; /* 128 blks */ + + /* default YUV pool: SP420 + compress_seg */ + buf_attr.width = size->width; + buf_attr.height = size->height; + buf_attr.align = OT_DEFAULT_ALIGN; + buf_attr.bit_width = OT_DATA_BIT_WIDTH_8; + buf_attr.pixel_format = OT_PIXEL_FORMAT_YVU_SEMIPLANAR_420; + buf_attr.compress_mode = OT_COMPRESS_MODE_SEG; + ot_common_get_pic_buf_cfg(&buf_attr, &calc_cfg); + + vb_cfg->common_pool[0].blk_size = calc_cfg.vb_size; + vb_cfg->common_pool[0].blk_cnt = yuv_cnt; + + /* default raw pool: raw12bpp + compress_line */ + buf_attr.pixel_format = OT_PIXEL_FORMAT_RGB_BAYER_12BPP; + buf_attr.compress_mode = (video_mode == OT_VI_VIDEO_MODE_NORM ? OT_COMPRESS_MODE_LINE : OT_COMPRESS_MODE_NONE); + ot_common_get_pic_buf_cfg(&buf_attr, &calc_cfg); + vb_cfg->common_pool[1].blk_size = calc_cfg.vb_size; + vb_cfg->common_pool[1].blk_cnt = raw_cnt; +} + +static td_s32 sample_vio_sys_init(ot_vi_vpss_mode_type mode_type, ot_vi_video_mode video_mode, + td_u32 yuv_cnt, td_u32 raw_cnt) +{ + td_s32 ret; + ot_size size; + ot_vb_cfg vb_cfg; + td_u32 supplement_config; + sample_sns_type sns_type = SENSOR0_TYPE; + + sample_comm_vi_get_size_by_sns_type(sns_type, &size); + sample_vi_get_default_vb_config(&size, &vb_cfg, video_mode, yuv_cnt, raw_cnt); + + supplement_config = OT_VB_SUPPLEMENT_BNR_MOT_MASK; + ret = sample_comm_sys_init_with_vb_supplement(&vb_cfg, supplement_config); + if (ret != TD_SUCCESS) { + return TD_FAILURE; + } + + ret = sample_comm_vi_set_vi_vpss_mode(mode_type, video_mode); + if (ret != TD_SUCCESS) { + return TD_FAILURE; + } + + return TD_SUCCESS; +} + +static td_s32 sample_vio_start_vpss(ot_vpss_grp grp, ot_size *in_size) +{ + td_s32 ret; + ot_low_delay_info low_delay_info; + ot_vpss_grp_attr grp_attr; + ot_vpss_chn_attr chn_attr; + td_bool chn_enable[OT_VPSS_MAX_PHYS_CHN_NUM] = {TD_TRUE, TD_FALSE, TD_FALSE, TD_FALSE}; + + sample_comm_vpss_get_default_grp_attr(&grp_attr); + grp_attr.max_width = in_size->width; + grp_attr.max_height = in_size->height; + sample_comm_vpss_get_default_chn_attr(&chn_attr); + chn_attr.width = in_size->width; + chn_attr.height = in_size->height; + + ret = sample_common_vpss_start(grp, chn_enable, &grp_attr, &chn_attr, OT_VPSS_MAX_PHYS_CHN_NUM); + if (ret != TD_SUCCESS) { + return ret; + } + + low_delay_info.enable = TD_TRUE; + low_delay_info.line_cnt = 200; /* 200: lowdelay line */ + low_delay_info.one_buf_en = TD_FALSE; + ret = ss_mpi_vpss_set_low_delay_attr(grp, 0, &low_delay_info); + if (ret != TD_SUCCESS) { + sample_common_vpss_stop(grp, chn_enable, OT_VPSS_MAX_PHYS_CHN_NUM); + return ret; + } + + return TD_SUCCESS; +} + +static td_void sample_vio_stop_vpss(ot_vpss_grp grp) +{ + td_bool chn_enable[OT_VPSS_MAX_PHYS_CHN_NUM] = {TD_TRUE, TD_FALSE, TD_FALSE, TD_FALSE}; + + sample_common_vpss_stop(grp, chn_enable, OT_VPSS_MAX_PHYS_CHN_NUM); +} + +static td_s32 sample_vio_start_vo(sample_vo_mode vo_mode) +{ + g_vo_cfg.vo_mode = vo_mode; + + return sample_comm_vo_start_vo(&g_vo_cfg); +} + +static td_void sample_vio_stop_vo(td_void) +{ + sample_comm_vo_stop_vo(&g_vo_cfg); +} + +static td_s32 sample_vio_start_and_bind_vo(ot_vpss_grp vpss_grp[], td_u32 grp_num, const ot_size *in_size) +{ + td_u32 i; + td_s32 ret; + sample_vo_mode vo_mode = VO_MODE_1MUX; + const ot_vpss_chn vpss_chn = 0; + const ot_vo_layer vo_layer = 0; + ot_vo_chn vo_chn[4] = {0, 1, 2, 3}; /* 4: max chn num, 0/1/2/3 chn id */ + + if (grp_num > 1) { + vo_mode = VO_MODE_4MUX; + } + + ret = sample_vio_start_vo(vo_mode); + if (ret != TD_SUCCESS) { + goto start_vo_failed; + } + + + for (i = 0; i < grp_num; i++) { + ret = sample_comm_vpss_bind_vo(vpss_grp[i], vpss_chn, vo_layer, vo_chn[i]); + if (ret != TD_SUCCESS) { + goto vpss_bind_vo_failed; + break; + } + } + return TD_SUCCESS; + +vpss_bind_vo_failed: + sample_vio_stop_vo(); +start_vo_failed: + return TD_FAILURE; +} + +static td_void sample_vio_stop_and_unbind_vo(ot_vpss_grp vpss_grp[], td_u32 grp_num) +{ + td_u32 i; + const ot_vpss_chn vpss_chn = 0; + const ot_vo_layer vo_layer = 0; + ot_vo_chn vo_chn[4] = {0, 1, 2, 3}; /* 4: max chn num, 0/1/2/3 chn id */ + + for (i = 0; i < grp_num; i++) { + sample_comm_vpss_un_bind_vo(vpss_grp[i], vpss_chn, vo_layer, vo_chn[i]); + } + + sample_vio_stop_vo(); +} + +static td_s32 sample_vio_one_sensor(td_void) +{ + td_s32 ret; + td_u32 yuv_cnt = VB_YUV_ROUTE_CNT; + td_u32 raw_cnt = VB_RAW_CNT_NONE; + ot_vi_vpss_mode_type mode_type = OT_VI_ONLINE_VPSS_OFFLINE; + ot_vi_video_mode video_mode = OT_VI_VIDEO_MODE_NORM; + const ot_vi_pipe vi_pipe = 0; + const ot_vi_chn vi_chn = 0; + ot_vpss_grp vpss_grp[1] = {0}; + const td_u32 grp_num = 1; + const ot_vpss_chn vpss_chn = 0; + sample_vi_cfg vi_cfg; + sample_sns_type sns_type; + ot_size in_size; + + ret = sample_vio_sys_init(mode_type, video_mode, yuv_cnt, raw_cnt); + if (ret != TD_SUCCESS) { + goto sys_init_failed; + } + + sns_type = SENSOR0_TYPE; + sample_comm_vi_get_size_by_sns_type(sns_type, &in_size); + sample_comm_vi_get_default_vi_cfg(sns_type, &vi_cfg); + ret = sample_comm_vi_start_vi(&vi_cfg); + if (ret != TD_SUCCESS) { + goto start_vi_failed; + } + + sample_comm_vi_bind_vpss(vi_pipe, vi_chn, vpss_grp[0], vpss_chn); + ret = sample_vio_start_vpss(vpss_grp[0], &in_size); + if (ret != TD_SUCCESS) { + goto start_vpss_failed; + } + + ret = sample_vio_start_and_bind_vo(vpss_grp, grp_num, &in_size); + if (ret != TD_SUCCESS) { + goto start_venc_and_vo_failed; + } + + sample_get_char(); + + sample_vio_stop_and_unbind_vo(vpss_grp, grp_num); + +start_venc_and_vo_failed: + sample_vio_stop_vpss(vpss_grp[0]); +start_vpss_failed: + sample_comm_vi_un_bind_vpss(vi_pipe, vi_chn, vpss_grp[0], vpss_chn); + sample_comm_vi_stop_vi(&vi_cfg); +start_vi_failed: + sample_comm_sys_exit(); +sys_init_failed: + return ret; +} + +td_s32 main(td_void) +{ + td_s32 ret; + SDK_init(); + + ret = sample_vio_one_sensor(); + printf("helloworld exit normally! \n"); + + SDK_exit(); + return ret; +} diff --git a/vendor/hisilicon/demo/smp_linux_user_space.mak b/vendor/hisilicon/demo/smp_linux_user_space.mak new file mode 100644 index 0000000000000000000000000000000000000000..b91a5bb6b10000c3ac8ffb4e6872cd04c6a29caa --- /dev/null +++ b/vendor/hisilicon/demo/smp_linux_user_space.mak @@ -0,0 +1,49 @@ +MKDIRS := $(TARGET_PATH) +TARGET_NAME := $(patsubst %/,%,$(dir $(patsubst %/,%,$(TARGET_PATH)))) + +# target source +OBJS := $(SMP_SRCS:%.c=%.o) +CXX_OBJS := $(CXX_SRCS:%.cpp=%.o) + +CFLAGS += $(COMM_INC) + +MPI_LIBS += $(REL_LIB)/libss_hdmi.a +MPI_LIBS += $(LIBS_LD_CFLAGS) + +.PHONY : clean all + +all: $(TARGET) + +$(TARGET):$(COMM_OBJ) $(OBJS) $(CXX_OBJS) | $(MKDIRS) + @echo ... ld $@ + @echo ... $(TARGET) + @$(CC) $(CFLAGS) -lpthread -lm -o $(TARGET_PATH)/$@ $^ -Wl,--start-group $(MPI_LIBS) $(SDK_LIB) $(SENSOR_LIBS) $(INIPARSER_LIB) $(REL_LIB)/libsecurec.a -Wl,--end-group + @echo ================= $(notdir $(TARGET_NAME)) build success ================= + +$(COMM_OBJ): %.o : %.c + @echo @@@ cc $^ + @$(CC) $(CFLAGS) -c $< -o $@ + +$(OBJS): %.o : %.c + @echo @@@ cc $^ + @$(CC) $(CFLAGS) -c $< -o $@ + +$(CXX_OBJS): %.o : %.cpp + @echo @@@ c++ $^ + @$(CXX) $(CFLAGS) -c $< -o $@ + +$(MKDIRS): + @mkdir -p $(TARGET_PATH) + +clean: + @rm -rf $(TARGET_PATH) + @rm -f $(OBJS) + @rm -f $(COMM_OBJ) + @rm -f $(CXX_OBJS) + +cleanstream: + @rm -f *.h264 + @rm -f *.h265 + @rm -f *.jpg + @rm -f *.mjp + @rm -f *.mp4 diff --git a/vendor/hisilicon/patch_build.sh b/vendor/hisilicon/patch_build.sh new file mode 100755 index 0000000000000000000000000000000000000000..dd70f145105afba6707083431176e7a1fafeefe8 --- /dev/null +++ b/vendor/hisilicon/patch_build.sh @@ -0,0 +1,20 @@ +# !/bin/bash + +################################################################################# +# Copyright (c) 2025 HiSilicon (Shanghai) Technologies Co., Ltd. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +################################################################################# + +cd ../ebaina +./patch_build.sh