├── README.md ├── bin └── run.sh ├── data ├── car.jpg ├── cat-dog.jpeg ├── person.jpeg ├── qq-group.jpeg ├── result1.jpg ├── result2.jpg ├── result3.jpg ├── test.jpg └── wechat.jpeg ├── include ├── hisi │ ├── aacdec.h │ ├── aacenc.h │ ├── acodec.h │ ├── autoconf.h │ ├── hi_ae_comm.h │ ├── hi_af_comm.h │ ├── hi_awb_comm.h │ ├── hi_buffer.h │ ├── hi_comm_3a.h │ ├── hi_comm_adec.h │ ├── hi_comm_aenc.h │ ├── hi_comm_ai.h │ ├── hi_comm_aio.h │ ├── hi_comm_ao.h │ ├── hi_comm_dis.h │ ├── hi_comm_gdc.h │ ├── hi_comm_hdmi.h │ ├── hi_comm_isp.h │ ├── hi_comm_ive.h │ ├── hi_comm_rc.h │ ├── hi_comm_region.h │ ├── hi_comm_snap.h │ ├── hi_comm_sns.h │ ├── hi_comm_svp.h │ ├── hi_comm_sys.h │ ├── hi_comm_vb.h │ ├── hi_comm_vdec.h │ ├── hi_comm_venc.h │ ├── hi_comm_vgs.h │ ├── hi_comm_vi.h │ ├── hi_comm_video.h │ ├── hi_comm_vo.h │ ├── hi_comm_vpss.h │ ├── hi_common.h │ ├── hi_debug.h │ ├── hi_defines.h │ ├── hi_errno.h │ ├── hi_i2c.h │ ├── hi_isp_bin.h │ ├── hi_isp_debug.h │ ├── hi_isp_defines.h │ ├── hi_ive.h │ ├── hi_math.h │ ├── hi_md.h │ ├── hi_mipi.h │ ├── hi_nnie.h │ ├── hi_resampler_api.h │ ├── hi_securec.h │ ├── hi_sns_ctrl.h │ ├── hi_spi.h │ ├── hi_ssp.h │ ├── hi_tde_api.h │ ├── hi_tde_errcode.h │ ├── hi_tde_type.h │ ├── hi_type.h │ ├── hi_types.h │ ├── hi_unf_cipher.h │ ├── hifb.h │ ├── hiir.h │ ├── ivs_md.h │ ├── list.h │ ├── mpi_ae.h │ ├── mpi_audio.h │ ├── mpi_awb.h │ ├── mpi_gdc.h │ ├── mpi_hdmi.h │ ├── mpi_isp.h │ ├── mpi_ive.h │ ├── mpi_nnie.h │ ├── mpi_region.h │ ├── mpi_snap.h │ ├── mpi_sys.h │ ├── mpi_vb.h │ ├── mpi_vdec.h │ ├── mpi_venc.h │ ├── mpi_vgs.h │ ├── mpi_vi.h │ ├── mpi_vo.h │ ├── mpi_vpss.h │ ├── sample_comm.h │ ├── sample_comm_ive.h │ ├── sample_comm_nnie.h │ ├── sample_comm_svp.h │ ├── sample_svp_nnie_software.h │ ├── securec.h │ ├── securectype.h │ ├── vdec_exp.h │ ├── vou_exp.h │ └── watchdog.h ├── opencv2 │ ├── core.hpp │ ├── core │ │ ├── affine.hpp │ │ ├── base.hpp │ │ ├── bufferpool.hpp │ │ ├── check.hpp │ │ ├── core.hpp │ │ ├── core_c.h │ │ ├── cuda.hpp │ │ ├── cuda.inl.hpp │ │ ├── cuda │ │ │ ├── block.hpp │ │ │ ├── border_interpolate.hpp │ │ │ ├── color.hpp │ │ │ ├── common.hpp │ │ │ ├── datamov_utils.hpp │ │ │ ├── detail │ │ │ │ ├── color_detail.hpp │ │ │ │ ├── reduce.hpp │ │ │ │ ├── reduce_key_val.hpp │ │ │ │ ├── transform_detail.hpp │ │ │ │ ├── type_traits_detail.hpp │ │ │ │ └── vec_distance_detail.hpp │ │ │ ├── dynamic_smem.hpp │ │ │ ├── emulation.hpp │ │ │ ├── filters.hpp │ │ │ ├── funcattrib.hpp │ │ │ ├── functional.hpp │ │ │ ├── limits.hpp │ │ │ ├── reduce.hpp │ │ │ ├── saturate_cast.hpp │ │ │ ├── scan.hpp │ │ │ ├── simd_functions.hpp │ │ │ ├── transform.hpp │ │ │ ├── type_traits.hpp │ │ │ ├── utility.hpp │ │ │ ├── vec_distance.hpp │ │ │ ├── vec_math.hpp │ │ │ ├── vec_traits.hpp │ │ │ ├── warp.hpp │ │ │ ├── warp_reduce.hpp │ │ │ └── warp_shuffle.hpp │ │ ├── cuda_stream_accessor.hpp │ │ ├── cuda_types.hpp │ │ ├── cv_cpu_dispatch.h │ │ ├── cv_cpu_helper.h │ │ ├── cvdef.h │ │ ├── cvstd.hpp │ │ ├── cvstd.inl.hpp │ │ ├── directx.hpp │ │ ├── eigen.hpp │ │ ├── fast_math.hpp │ │ ├── hal │ │ │ ├── hal.hpp │ │ │ ├── interface.h │ │ │ ├── intrin.hpp │ │ │ ├── intrin_cpp.hpp │ │ │ ├── intrin_neon.hpp │ │ │ ├── intrin_sse.hpp │ │ │ └── intrin_vsx.hpp │ │ ├── ippasync.hpp │ │ ├── mat.hpp │ │ ├── mat.inl.hpp │ │ ├── matx.hpp │ │ ├── neon_utils.hpp │ │ ├── ocl.hpp │ │ ├── ocl_genbase.hpp │ │ ├── opencl │ │ │ ├── ocl_defs.hpp │ │ │ ├── opencl_info.hpp │ │ │ ├── opencl_svm.hpp │ │ │ └── runtime │ │ │ │ ├── autogenerated │ │ │ │ ├── opencl_clamdblas.hpp │ │ │ │ ├── opencl_clamdfft.hpp │ │ │ │ ├── opencl_core.hpp │ │ │ │ ├── opencl_core_wrappers.hpp │ │ │ │ ├── opencl_gl.hpp │ │ │ │ └── opencl_gl_wrappers.hpp │ │ │ │ ├── opencl_clamdblas.hpp │ │ │ │ ├── opencl_clamdfft.hpp │ │ │ │ ├── opencl_core.hpp │ │ │ │ ├── opencl_core_wrappers.hpp │ │ │ │ ├── opencl_gl.hpp │ │ │ │ ├── opencl_gl_wrappers.hpp │ │ │ │ ├── opencl_svm_20.hpp │ │ │ │ ├── opencl_svm_definitions.hpp │ │ │ │ └── opencl_svm_hsa_extension.hpp │ │ ├── opengl.hpp │ │ ├── operations.hpp │ │ ├── optim.hpp │ │ ├── ovx.hpp │ │ ├── persistence.hpp │ │ ├── ptr.inl.hpp │ │ ├── saturate.hpp │ │ ├── softfloat.hpp │ │ ├── sse_utils.hpp │ │ ├── traits.hpp │ │ ├── types.hpp │ │ ├── types_c.h │ │ ├── utility.hpp │ │ ├── utils │ │ │ ├── filesystem.hpp │ │ │ ├── logger.defines.hpp │ │ │ ├── logger.hpp │ │ │ └── trace.hpp │ │ ├── va_intel.hpp │ │ ├── version.hpp │ │ ├── vsx_utils.hpp │ │ └── wimage.hpp │ ├── cvconfig.h │ ├── features2d.hpp │ ├── features2d │ │ ├── features2d.hpp │ │ └── hal │ │ │ └── interface.h │ ├── flann.hpp │ ├── flann │ │ ├── all_indices.h │ │ ├── allocator.h │ │ ├── any.h │ │ ├── autotuned_index.h │ │ ├── composite_index.h │ │ ├── config.h │ │ ├── defines.h │ │ ├── dist.h │ │ ├── dummy.h │ │ ├── dynamic_bitset.h │ │ ├── flann.hpp │ │ ├── flann_base.hpp │ │ ├── general.h │ │ ├── ground_truth.h │ │ ├── hdf5.h │ │ ├── heap.h │ │ ├── hierarchical_clustering_index.h │ │ ├── index_testing.h │ │ ├── kdtree_index.h │ │ ├── kdtree_single_index.h │ │ ├── kmeans_index.h │ │ ├── linear_index.h │ │ ├── logger.h │ │ ├── lsh_index.h │ │ ├── lsh_table.h │ │ ├── matrix.h │ │ ├── miniflann.hpp │ │ ├── nn_index.h │ │ ├── object_factory.h │ │ ├── params.h │ │ ├── random.h │ │ ├── result_set.h │ │ ├── sampling.h │ │ ├── saving.h │ │ ├── simplex_downhill.h │ │ └── timer.h │ ├── fuzzy.hpp │ ├── fuzzy │ │ ├── fuzzy_F0_math.hpp │ │ ├── fuzzy_F1_math.hpp │ │ ├── fuzzy_image.hpp │ │ └── types.hpp │ ├── imgcodecs.hpp │ ├── imgcodecs │ │ ├── imgcodecs.hpp │ │ ├── imgcodecs_c.h │ │ └── ios.h │ ├── imgproc.hpp │ ├── imgproc │ │ ├── detail │ │ │ └── distortion_model.hpp │ │ ├── hal │ │ │ ├── hal.hpp │ │ │ └── interface.h │ │ ├── imgproc.hpp │ │ ├── imgproc_c.h │ │ └── types_c.h │ ├── line_descriptor.hpp │ ├── line_descriptor │ │ └── descriptor.hpp │ ├── ml.hpp │ ├── ml │ │ ├── ml.hpp │ │ └── ml.inl.hpp │ ├── opencv.hpp │ ├── opencv_modules.hpp │ ├── video.hpp │ └── video │ │ ├── background_segm.hpp │ │ ├── tracking.hpp │ │ ├── tracking_c.h │ │ └── video.hpp └── yolov5.h ├── lib ├── hisi │ ├── libVoiceEngine.so │ ├── libdnvqe.so │ ├── libive.so │ ├── libmpi.so │ ├── libnnie.so │ ├── libsecurec.so │ └── libupvqe.so ├── libgomp.so.1 ├── libsdk_yolov5.so ├── libstdc++.so.6 └── opencv │ ├── libopencv_core.so │ ├── libopencv_core.so.3.4 │ ├── libopencv_core.so.3.4.2 │ ├── libopencv_imgcodecs.so │ ├── libopencv_imgcodecs.so.3.4 │ ├── libopencv_imgcodecs.so.3.4.2 │ ├── libopencv_imgproc.so │ ├── libopencv_imgproc.so.3.4 │ ├── libopencv_imgproc.so.3.4.2 │ ├── libopencv_video.so │ ├── libopencv_video.so.3.4 │ ├── libopencv_video.so.3.4.2 │ ├── libopencv_videoio.so │ ├── libopencv_videoio.so.3.4 │ ├── libopencv_videoio.so.3.4.2 │ ├── libopencv_videostab.so │ ├── libopencv_videostab.so.3.4 │ └── libopencv_videostab.so.3.4.2 ├── models └── yolov5-voc.wk └── sample_codes └── yolov5_demo ├── Makefile └── src └── main.cpp /README.md: -------------------------------------------------------------------------------- 1 | ## centerface on nnie 2 | 3 | 训练代码参考yolov5,此代码所用模型进行了重新训练,代码使用C++ opencv方式编写,简洁易用。 4 | 5 | #### 性能 6 | 7 | Hi3516cv500: 8 | 9 | | -- | -- | 10 | | --------- | ---- | 11 | | 416 * 416 | 40ms | 12 | 13 | VOC2007 Test: 14 | 15 | | -- | -- | 16 | | ------ | ---- | 17 | | MAP@0.5 | 84 | 18 | 19 | #### 结果演示: 20 | 21 | ![image](./data/result1.jpg) 22 | 23 | ![image](./data/result2.jpg) 24 | 25 | ![image](./data/result3.jpg) 26 | 27 | 28 | ##### QQ Group:1164802745 29 | 30 | 31 | ![image](./data/qq-group.jpeg) 32 | 33 | 34 | ##### Wechat: xzmh321 35 | 36 | 37 | ![image](./data/wechat.jpeg) 38 | 39 | 40 | 商务合作联系:perry@tevcam.com, pugss@tevcam.com 41 | 42 | -------------------------------------------------------------------------------- /bin/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | export LD_LIBRARY_PATH=../lib:../lib/hisi:../lib/opencv:$LD_LIBRARY_PATH 4 | 5 | ./yolov5_demo $1 6 | 7 | -------------------------------------------------------------------------------- /data/car.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tevcam2020/yolov5-nnie/a5e609eeb17edaee6703656597e7ed6e4ce75083/data/car.jpg -------------------------------------------------------------------------------- /data/cat-dog.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tevcam2020/yolov5-nnie/a5e609eeb17edaee6703656597e7ed6e4ce75083/data/cat-dog.jpeg -------------------------------------------------------------------------------- /data/person.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tevcam2020/yolov5-nnie/a5e609eeb17edaee6703656597e7ed6e4ce75083/data/person.jpeg -------------------------------------------------------------------------------- /data/qq-group.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tevcam2020/yolov5-nnie/a5e609eeb17edaee6703656597e7ed6e4ce75083/data/qq-group.jpeg -------------------------------------------------------------------------------- /data/result1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tevcam2020/yolov5-nnie/a5e609eeb17edaee6703656597e7ed6e4ce75083/data/result1.jpg -------------------------------------------------------------------------------- /data/result2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tevcam2020/yolov5-nnie/a5e609eeb17edaee6703656597e7ed6e4ce75083/data/result2.jpg -------------------------------------------------------------------------------- /data/result3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tevcam2020/yolov5-nnie/a5e609eeb17edaee6703656597e7ed6e4ce75083/data/result3.jpg -------------------------------------------------------------------------------- /data/test.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tevcam2020/yolov5-nnie/a5e609eeb17edaee6703656597e7ed6e4ce75083/data/test.jpg -------------------------------------------------------------------------------- /data/wechat.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tevcam2020/yolov5-nnie/a5e609eeb17edaee6703656597e7ed6e4ce75083/data/wechat.jpeg -------------------------------------------------------------------------------- /include/hisi/hi_af_comm.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | 3 | Copyright (C), 2016, Hisilicon Tech. Co., Ltd. 4 | 5 | ****************************************************************************** 6 | File Name : hi_af_comm.h 7 | Version : Initial Draft 8 | Author : Hisilicon multimedia software group 9 | Created : 2012/12/20 10 | Description : 11 | History : 12 | 1.Date : 2012/12/20 13 | Author : 14 | Modification: Created file 15 | 16 | ******************************************************************************/ 17 | #ifndef __HI_AF_COMM_H__ 18 | #define __HI_AF_COMM_H__ 19 | 20 | #include "hi_type.h" 21 | 22 | #ifdef __cplusplus 23 | #if __cplusplus 24 | extern "C" { 25 | #endif 26 | #endif /* End of #ifdef __cplusplus */ 27 | 28 | #define HI_AF_LIB_NAME "hisi_af_lib" 29 | 30 | #ifdef __cplusplus 31 | #if __cplusplus 32 | } 33 | #endif 34 | #endif /* End of #ifdef __cplusplus */ 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /include/hisi/hi_comm_ai.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | 3 | Copyright (C), 2001-2018, Hisilicon Tech. Co., Ltd. 4 | 5 | ****************************************************************************** 6 | File Name : hi_comm_ai.h 7 | Version : Initial Draft 8 | Author : Hisilicon multimedia software group 9 | Created : 2009/5/5 10 | Description : 11 | History : 12 | 1.Date : 2009/5/5 13 | Author : p00123320 14 | Modification: Created file 15 | ******************************************************************************/ 16 | 17 | 18 | #ifndef __HI_COMM_AI_H__ 19 | #define __HI_COMM_AI_H__ 20 | 21 | #ifdef __cplusplus 22 | #if __cplusplus 23 | extern "C"{ 24 | #endif 25 | #endif /* End of #ifdef __cplusplus */ 26 | 27 | 28 | 29 | #ifdef __cplusplus 30 | #if __cplusplus 31 | } 32 | #endif 33 | #endif /* End of #ifdef __cplusplus */ 34 | 35 | #endif /* End of #ifndef __HI_COMM_AI_H__ */ 36 | 37 | -------------------------------------------------------------------------------- /include/hisi/hi_comm_ao.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | 3 | Copyright (C), 2001-2018, Hisilicon Tech. Co., Ltd. 4 | 5 | ****************************************************************************** 6 | File Name : hi_comm_ao.h 7 | Version : Initial Draft 8 | Author : Hisilicon multimedia software group 9 | Created : 2009/5/5 10 | Description : 11 | History : 12 | 1.Date : 2009/5/5 13 | Author : p00123320 14 | Modification: Created file 15 | ******************************************************************************/ 16 | 17 | 18 | #ifndef __HI_COMM_AO_H__ 19 | #define __HI_COMM_AO_H__ 20 | 21 | #ifdef __cplusplus 22 | #if __cplusplus 23 | extern "C"{ 24 | #endif 25 | #endif /* End of #ifdef __cplusplus */ 26 | 27 | 28 | 29 | 30 | #ifdef __cplusplus 31 | #if __cplusplus 32 | } 33 | #endif 34 | #endif /* End of #ifdef __cplusplus */ 35 | 36 | #endif /* End of #ifndef __HI_COMM_AO_H__ */ 37 | 38 | -------------------------------------------------------------------------------- /include/hisi/hi_comm_snap.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | 3 | Copyright (C), 2017, Hisilicon Tech. Co., Ltd. 4 | 5 | ****************************************************************************** 6 | File Name : hi_comm_snap.h 7 | Version : Initial Draft 8 | Author : Hisilicon multimedia software group 9 | Created : 2017/06/19 10 | Last Modified : 11 | Description : 12 | Function List : 13 | History : 14 | ******************************************************************************/ 15 | 16 | #ifndef __HI_COMM_SNAP_H__ 17 | #define __HI_COMM_SNAP_H__ 18 | 19 | #include "hi_common.h" 20 | #include "hi_comm_video.h" 21 | #include "hi_comm_isp.h" 22 | 23 | #ifdef __cplusplus 24 | #if __cplusplus 25 | extern "C" 26 | { 27 | #endif 28 | #endif /* __cplusplus */ 29 | 30 | typedef enum hiSNAP_TYPE_E 31 | { 32 | SNAP_TYPE_NORMAL, /* ZSL and none-ZSL type */ 33 | SNAP_TYPE_PRO, /* Professional type support HDR, AEB, LongExposure */ 34 | SNAP_TYPE_BUTT 35 | } SNAP_TYPE_E; 36 | 37 | 38 | typedef struct hiSNAP_PRO_MANUAL_PARAM_S 39 | { 40 | HI_U32 au32ManExpTime[PRO_MAX_FRAME_NUM];/*RW; Range: [0x0, 0xFFFFFFFF];sensor exposure time (unit: us ), it's related to the specific sensor */ 41 | HI_U32 au32ManSysgain[PRO_MAX_FRAME_NUM];/*RW; Range : [0x400, 0xFFFFFFFF];system gain (unit: times, 10bit precision) , it's related to the specific sensor and ISP Dgain range */ 42 | } SNAP_PRO_MANUAL_PARAM_S; 43 | 44 | 45 | typedef struct hiSNAP_PRO_AUTO_PARAM_S 46 | { 47 | HI_U16 au16ProExpStep[PRO_MAX_FRAME_NUM];/*RW; Range:[0x0, 0xFFFF];Professional exposure step (unit: times, 8bit precision)*/ 48 | } SNAP_PRO_AUTO_PARAM_S; 49 | 50 | 51 | typedef struct hiSNAP_PRO_PARAM_S 52 | { 53 | OPERATION_MODE_E enOperationMode; 54 | SNAP_PRO_AUTO_PARAM_S stAutoParam; 55 | SNAP_PRO_MANUAL_PARAM_S stManualParam; 56 | } SNAP_PRO_PARAM_S; 57 | 58 | 59 | typedef struct hiSNAP_NORMAL_ATTR_S 60 | { 61 | HI_U32 u32FrameCnt; /* RW;Set capture frame counts */ 62 | HI_U32 u32RepeatSendTimes; /* [0,2]; When FE-BE is offline, the first raw frame that is triggered should be sent repeatedly to the BE. */ 63 | 64 | /* ZSL struct */ 65 | HI_BOOL bZSL; /* RW;statical attrs */ 66 | HI_U32 u32FrameDepth; /* buffer depth */ 67 | HI_U32 u32RollbackMs; /* RW;Rollback time, unit(ms), invalid when bZSL is HI_FALSE */ 68 | HI_U32 u32Interval; /* RW;For continuous capture, select frame every u32Intercal frames */ 69 | } SNAP_NORMAL_ATTR_S; 70 | 71 | typedef struct hiSNAP_PRO_ATTR_S 72 | { 73 | HI_U32 u32FrameCnt; /* [1, PRO_MAX_FRAME_NUM] */ 74 | HI_U32 u32RepeatSendTimes; /* [0,2];When FE-BE is offline, the first raw frame that is triggered should be sent repeatedly to the BE. */ 75 | SNAP_PRO_PARAM_S stProParam; 76 | } SNAP_PRO_ATTR_S; 77 | 78 | 79 | typedef struct hiSNAP_USER_ATTR_S 80 | { 81 | HI_U32 u32FrameDepth; 82 | } SNAP_USER_ATTR_S; 83 | 84 | 85 | typedef struct hiSNAP_ATTR_S 86 | { 87 | SNAP_TYPE_E enSnapType; 88 | HI_BOOL bLoadCCM; /*HI_TRUE:use CCM of SnapIspInfo, HI_FALSE: Algorithm calculate */ 89 | union 90 | { 91 | SNAP_NORMAL_ATTR_S stNormalAttr; 92 | SNAP_PRO_ATTR_S stProAttr; 93 | }; 94 | } SNAP_ATTR_S; 95 | 96 | 97 | typedef struct hiISP_PRO_BNR_PARAM_S 98 | { 99 | HI_BOOL bEnable; 100 | HI_U32 u32ParamNum; 101 | ISP_NR_AUTO_ATTR_S *pastNrAttr; 102 | } ISP_PRO_BNR_PARAM_S; 103 | 104 | typedef struct hiISP_PRO_SHARPEN_PARAM_S 105 | { 106 | HI_BOOL bEnable; 107 | HI_U32 u32ParamNum; 108 | ISP_SHARPEN_AUTO_ATTR_S *pastShpAttr; 109 | } ISP_PRO_SHARPEN_PARAM_S; 110 | 111 | typedef struct hiBNR_DUMP_ATTR_S 112 | { 113 | HI_BOOL bEnable; 114 | HI_U32 u32Depth; 115 | } BNR_DUMP_ATTR_S; 116 | 117 | #ifdef __cplusplus 118 | #if __cplusplus 119 | } 120 | #endif 121 | #endif /* __cplusplus */ 122 | 123 | #endif /* End of #ifndef __HI_COMM_SNAP_H__ */ 124 | 125 | 126 | -------------------------------------------------------------------------------- /include/hisi/hi_comm_vb.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | Copyright (C), 2016, Hisilicon Tech. Co., Ltd. 3 | ****************************************************************************** 4 | File Name : hi_comm_vb.h 5 | Version : Initial Draft 6 | Author : Hisilicon multimedia software group 7 | Created : 2016/07/15 8 | Last Modified : 9 | Description : The common data type defination for VB module. 10 | Function List : 11 | ******************************************************************************/ 12 | #ifndef __HI_COMM_VB_H__ 13 | #define __HI_COMM_VB_H__ 14 | 15 | #include "hi_type.h" 16 | #include "hi_errno.h" 17 | #include "hi_debug.h" 18 | 19 | 20 | #ifdef __cplusplus 21 | #if __cplusplus 22 | extern "C"{ 23 | #endif 24 | #endif /* End of #ifdef __cplusplus */ 25 | 26 | #define VB_INVALID_POOLID (-1U) 27 | #define VB_INVALID_HANDLE (-1U) 28 | 29 | 30 | #define VB_MAX_COMM_POOLS 16 31 | #define VB_MAX_MOD_COMM_POOLS 16 32 | 33 | 34 | /* user ID for VB */ 35 | #define VB_MAX_USER VB_UID_BUTT 36 | 37 | typedef enum hiVB_UID_E 38 | { 39 | VB_UID_VI = 0, 40 | VB_UID_VO = 1, 41 | VB_UID_VGS = 2, 42 | VB_UID_VENC = 3, 43 | VB_UID_VDEC = 4, 44 | VB_UID_H265E = 5, 45 | VB_UID_H264E = 6, 46 | VB_UID_JPEGE = 7, 47 | VB_UID_H264D = 8, 48 | VB_UID_JPEGD = 9, 49 | VB_UID_VPSS = 10, 50 | VB_UID_DIS = 11, 51 | VB_UID_USER = 12, 52 | VB_UID_PCIV = 13, 53 | VB_UID_AI = 14, 54 | VB_UID_AENC = 15, 55 | VB_UID_RC = 16, 56 | VB_UID_VFMW = 17, 57 | VB_UID_GDC = 18, 58 | VB_UID_AVS = 19, 59 | VB_UID_DPU_RECT = 20, 60 | VB_UID_DPU_MATCH = 21, 61 | VB_UID_BUTT = 22, 62 | 63 | } VB_UID_E; 64 | 65 | 66 | 67 | /* Generall common pool use this owner id, module common pool use VB_UID as owner id */ 68 | #define POOL_OWNER_COMMON -1 69 | 70 | /* Private pool use this owner id */ 71 | #define POOL_OWNER_PRIVATE -2 72 | 73 | 74 | 75 | typedef HI_U32 VB_POOL; 76 | typedef HI_U32 VB_BLK; 77 | 78 | #define RESERVE_MMZ_NAME "window" 79 | 80 | typedef enum hiVB_REMAP_MODE_E 81 | { 82 | VB_REMAP_MODE_NONE = 0, /* no remap */ 83 | VB_REMAP_MODE_NOCACHE = 1, /* no cache remap */ 84 | VB_REMAP_MODE_CACHED = 2, /* cache remap, if you use this mode, you should flush cache by yourself */ 85 | VB_REMAP_MODE_BUTT 86 | } VB_REMAP_MODE_E; 87 | 88 | 89 | typedef struct hiVB_POOL_CONFIG_S 90 | { 91 | HI_U64 u64BlkSize; 92 | HI_U32 u32BlkCnt; 93 | VB_REMAP_MODE_E enRemapMode; 94 | HI_CHAR acMmzName[MAX_MMZ_NAME_LEN]; 95 | }VB_POOL_CONFIG_S; 96 | 97 | typedef struct hiVB_CONFIG_S 98 | { 99 | HI_U32 u32MaxPoolCnt; 100 | VB_POOL_CONFIG_S astCommPool[VB_MAX_COMM_POOLS]; 101 | } VB_CONFIG_S; 102 | 103 | 104 | typedef struct hiVB_POOL_STATUS_S 105 | { 106 | HI_U32 bIsCommPool; 107 | HI_U32 u32BlkCnt; 108 | HI_U32 u32FreeBlkCnt; 109 | }VB_POOL_STATUS_S; 110 | 111 | #define VB_SUPPLEMENT_JPEG_MASK 0x1 112 | #define VB_SUPPLEMENT_ISPINFO_MASK 0x2 113 | #define VB_SUPPLEMENT_MOTION_DATA_MASK 0x4 114 | #define VB_SUPPLEMENT_DNG_MASK 0x8 115 | 116 | typedef struct hiVB_SUPPLEMENT_CONFIG_S 117 | { 118 | HI_U32 u32SupplementConfig; 119 | }VB_SUPPLEMENT_CONFIG_S; 120 | 121 | 122 | #define HI_ERR_VB_NULL_PTR HI_DEF_ERR(HI_ID_VB, EN_ERR_LEVEL_ERROR, EN_ERR_NULL_PTR) 123 | #define HI_ERR_VB_NOMEM HI_DEF_ERR(HI_ID_VB, EN_ERR_LEVEL_ERROR, EN_ERR_NOMEM) 124 | #define HI_ERR_VB_NOBUF HI_DEF_ERR(HI_ID_VB, EN_ERR_LEVEL_ERROR, EN_ERR_NOBUF) 125 | #define HI_ERR_VB_UNEXIST HI_DEF_ERR(HI_ID_VB, EN_ERR_LEVEL_ERROR, EN_ERR_UNEXIST) 126 | #define HI_ERR_VB_ILLEGAL_PARAM HI_DEF_ERR(HI_ID_VB, EN_ERR_LEVEL_ERROR, EN_ERR_ILLEGAL_PARAM) 127 | #define HI_ERR_VB_NOTREADY HI_DEF_ERR(HI_ID_VB, EN_ERR_LEVEL_ERROR, EN_ERR_SYS_NOTREADY) 128 | #define HI_ERR_VB_BUSY HI_DEF_ERR(HI_ID_VB, EN_ERR_LEVEL_ERROR, EN_ERR_BUSY) 129 | #define HI_ERR_VB_NOT_PERM HI_DEF_ERR(HI_ID_VB, EN_ERR_LEVEL_ERROR, EN_ERR_NOT_PERM) 130 | #define HI_ERR_VB_SIZE_NOT_ENOUGH HI_DEF_ERR(HI_ID_VB, EN_ERR_LEVEL_ERROR, EN_ERR_SIZE_NOT_ENOUGH) 131 | 132 | #define HI_ERR_VB_2MPOOLS HI_DEF_ERR(HI_ID_VB, EN_ERR_LEVEL_ERROR, EN_ERR_BUTT + 1) 133 | 134 | #define HI_TRACE_VB(level, fmt,...)\ 135 | do{ \ 136 | HI_TRACE(level, HI_ID_VB,"[Func]:%s [Line]:%d [Info]:"fmt,__FUNCTION__, __LINE__,##__VA_ARGS__);\ 137 | }while(0) 138 | 139 | #ifdef __cplusplus 140 | #if __cplusplus 141 | } 142 | #endif 143 | #endif /* __cplusplus */ 144 | 145 | #endif /* __HI_COMM_VB_H_ */ 146 | 147 | -------------------------------------------------------------------------------- /include/hisi/hi_i2c.h: -------------------------------------------------------------------------------- 1 | #ifndef _HI_I2C_H 2 | #define _HI_I2C_H 3 | 4 | 5 | 6 | /* /dev/i2c-X ioctl commands. The ioctl's parameter is always an 7 | * unsigned long, except for: 8 | * - I2C_FUNCS, takes pointer to an unsigned long 9 | * - I2C_RDWR, takes pointer to struct i2c_rdwr_ioctl_data 10 | * - I2C_SMBUS, takes pointer to struct i2c_smbus_ioctl_data 11 | */ 12 | #define I2C_RETRIES 0x0701 /* number of times a device address should 13 | be polled when not acknowledging */ 14 | #define I2C_TIMEOUT 0x0702 /* set timeout in units of 10 ms */ 15 | 16 | /* NOTE: Slave address is 7 or 10 bits, but 10-bit addresses 17 | * are NOT supported! (due to code brokenness) 18 | */ 19 | #define I2C_SLAVE 0x0703 /* Use this slave address */ 20 | #define I2C_SLAVE_FORCE 0x0706 /* Use this slave address, even if it 21 | is already in use by a driver! */ 22 | #define I2C_TENBIT 0x0704 /* 0 for 7 bit addrs, != 0 for 10 bit */ 23 | 24 | #define I2C_FUNCS 0x0705 /* Get the adapter functionality mask */ 25 | 26 | #define I2C_RDWR 0x0707 /* Combined R/W transfer (one STOP only) */ 27 | 28 | #define I2C_PEC 0x0708 /* != 0 to use PEC with SMBus */ 29 | #define I2C_SMBUS 0x0720 /* SMBus transfer */ 30 | #define I2C_16BIT_REG 0x0709 /* 16BIT REG WIDTH */ 31 | #define I2C_16BIT_DATA 0x070a /* 16BIT DATA WIDTH */ 32 | 33 | typedef struct hiI2C_DATA_S 34 | { 35 | unsigned char dev_addr; 36 | unsigned int reg_addr; 37 | unsigned int addr_byte_num; 38 | unsigned int data; 39 | unsigned int data_byte_num; 40 | }I2C_DATA_S; 41 | 42 | #endif 43 | 44 | -------------------------------------------------------------------------------- /include/hisi/hi_isp_bin.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | 3 | Copyright (C), 2016, Hisilicon Tech. Co., Ltd. 4 | 5 | ****************************************************************************** 6 | File Name : hi_isp_bin.h 7 | Version : Initial Draft 8 | Author : Hisilicon multimedia software group 9 | Created : 2015/01/14 10 | Description : 11 | History : 12 | 1.Date : 2015/01/14 13 | Author : 14 | Modification: Created file 15 | 16 | ******************************************************************************/ 17 | 18 | #ifndef __HI_ISP_BIN_H__ 19 | #define __HI_ISP_BIN_H__ 20 | 21 | #include "hi_type.h" 22 | #include "hi_comm_isp.h" 23 | 24 | #ifdef __cplusplus 25 | #if __cplusplus 26 | extern "C" { 27 | #endif 28 | #endif /* End of #ifdef __cplusplus */ 29 | 30 | /**************************************************************************** 31 | * MACRO DEFINITION * 32 | ****************************************************************************/ 33 | #define MAX_BIN_REG_NUM 5 34 | 35 | /**************************************************************************** 36 | * GENERAL STRUCTURES * 37 | ****************************************************************************/ 38 | typedef struct hiISP_BIN_REG_ATTR_S 39 | { 40 | HI_U32 u32Addr; /* register addr */ 41 | HI_U8 u8StartBit; /* start bit of register addr */ 42 | HI_U8 u8EndBit; /* end bit of register addr */ 43 | } ISP_BIN_REG_ATTR_S; 44 | 45 | /*-------------------------------------------* 46 | The base addr of ISP logic register 47 | The base addr of ISP ext register 48 | The base addr of Hisi AE ext register 49 | The base addr of Hisi AWB ext register 50 | *-------------------------------------------*/ 51 | 52 | ISP_BIN_REG_ATTR_S g_astIspBinRegAttr[ISP_MAX_PIPE_NUM][MAX_BIN_REG_NUM] = 53 | { 54 | [0 ... (ISP_MAX_PIPE_NUM - 1)] = {0} 55 | }; 56 | 57 | 58 | #ifdef __cplusplus 59 | #if __cplusplus 60 | } 61 | #endif 62 | #endif /* End of #ifdef __cplusplus */ 63 | 64 | #endif /*__HI_ISP_BIN_H__ */ 65 | -------------------------------------------------------------------------------- /include/hisi/hi_isp_debug.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | 3 | Copyright (C), 2016, Hisilicon Tech. Co., Ltd. 4 | 5 | ****************************************************************************** 6 | File Name : hi_isp_debug.h 7 | Version : Initial Draft 8 | Author : Hisilicon multimedia software group 9 | Created : 2010/08/30 10 | Description : 11 | History : 12 | 1.Date : 2010/08/30 13 | Author : 14 | Modification: Created file 15 | 16 | ******************************************************************************/ 17 | 18 | #ifndef __HI_ISP_DEBUG_H__ 19 | #define __HI_ISP_DEBUG_H__ 20 | 21 | #include "hi_debug.h" 22 | 23 | #if 0 24 | #define PRINT_DEBUG_INFO 25 | #endif 26 | 27 | #if 0 28 | #define PRINT_INFO_2FILE 29 | #endif 30 | 31 | #define ISP_TRACE(level, fmt, ...)\ 32 | do{ \ 33 | HI_TRACE(level, HI_ID_ISP,"[Func]:%s [Line]:%d [Info]:"fmt,__FUNCTION__, __LINE__,##__VA_ARGS__);\ 34 | }while(0) 35 | 36 | /* To avoid divide-0 exception in code. */ 37 | #define DIV_0_TO_1(a) ( (0 == (a)) ? 1 : (a) ) 38 | #define DIV_0_TO_1_FLOAT(a) ((((a) < 1E-10) && ((a) > -1E-10)) ? 1 : (a)) 39 | 40 | #endif /* __HI_ISP_DEBUG_H__ */ 41 | -------------------------------------------------------------------------------- /include/hisi/hi_md.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | 3 | Copyright (C), 2001-2015, Hisilicon Tech. Co., Ltd. 4 | 5 | ****************************************************************************** 6 | File Name : hi_md.h 7 | Version : Initial Draft 8 | Author : Hisilicon multimedia software (IVE) group 9 | Created : 2014/11/10 10 | Description : 11 | History : 12 | 1.Date : 2014/11/10 13 | Author : 14 | Modification: Created file 15 | 2.Date : 2015/11/24 16 | Author : 17 | Modification: Modify MD_ATTR_S 18 | ******************************************************************************/ 19 | #ifndef _HI_MD_H_ 20 | #define _HI_MD_H_ 21 | 22 | #include "hi_ive.h" 23 | 24 | #ifdef __cplusplus 25 | #if __cplusplus 26 | extern "C"{ 27 | #endif 28 | #endif 29 | /* 30 | * Definition md algorithm mode 31 | */ 32 | typedef enum hiMD_ALG_MODE_E 33 | { 34 | MD_ALG_MODE_BG = 0x0,/*Base on background image*/ 35 | MD_ALG_MODE_REF = 0x1,/*Base on reference image*/ 36 | 37 | MD_ALG_MODE_BUTT 38 | }MD_ALG_MODE_E; 39 | /* 40 | * Definition of md attribute 41 | */ 42 | typedef struct hiMD_ATTR_S 43 | { 44 | MD_ALG_MODE_E enAlgMode; /*Md algorithm mode*/ 45 | IVE_SAD_MODE_E enSadMode; /*Sad mode*/ 46 | IVE_SAD_OUT_CTRL_E enSadOutCtrl; /*Sad output ctrl*/ 47 | HI_U32 u32Width; /*Image width*/ 48 | HI_U32 u32Height; /*Image height*/ 49 | HI_U16 u16SadThr; /*Sad thresh*/ 50 | IVE_CCL_CTRL_S stCclCtrl; /*Ccl ctrl*/ 51 | IVE_ADD_CTRL_S stAddCtrl; /*Add ctrl*/ 52 | }MD_ATTR_S; 53 | 54 | #ifdef __cplusplus 55 | #if __cplusplus 56 | } 57 | #endif 58 | #endif 59 | 60 | #endif/*_HI_MD_H_*/ -------------------------------------------------------------------------------- /include/hisi/hi_resampler_api.h: -------------------------------------------------------------------------------- 1 | #ifndef _HI_RESAMPLER_API_H_ 2 | #define _HI_RESAMPLER_API_H_ 3 | 4 | #include "hi_type.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | #define MAXFRAMESIZE 2048 11 | 12 | /************************************************************************************** 13 | * Function: HI_Resampler_Create 14 | * 15 | * Description: allocate memory for platform-specific data 16 | * clear all the user-accessible fields 17 | * 18 | * Inputs: inrate: 8000, 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000 19 | * outrate: 8000, 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000 20 | * chans: 1 or 2 21 | * Outputs: none 22 | * 23 | * Return: handle to Resampler instance, 0 if malloc fails 24 | **************************************************************************************/ 25 | HI_VOID* HI_Resampler_Create(HI_S32 s32Inrate, HI_S32 s32Outrate, HI_S32 s32Chans); 26 | 27 | 28 | /************************************************************************************** 29 | * Function: HI_Resampler_Process 30 | * 31 | * Description: Resample pcm data to specific samplerate, only for interlaced format 32 | * 33 | * Inputs: inst: valid Resampler instance pointer (HResampler) 34 | * inbuf: pointer to inputbuf 35 | * insamps: input number of sample pointers 36 | * Outputs: outbuf: pointer to outputbuf 37 | * 38 | * Return: output sample number per-channel 39 | * Notes: sure insamps < MAXFRAMESIZE 40 | 41 | 42 | **************************************************************************************/ 43 | HI_S32 HI_Resampler_Process(HI_VOID* inst, HI_S16* s16Inbuf, HI_S32 s32Insamps, HI_S16* s16Outbuf); 44 | 45 | 46 | /************************************************************************************** 47 | * Function: HI_Resampler_Destroy 48 | * 49 | * Description: free platform-specific data allocated by ResamplerCreate 50 | * 51 | * Inputs: valid Resampler instance pointer (HResampler) 52 | * Outputs: none 53 | * 54 | * Return: none 55 | **************************************************************************************/ 56 | HI_VOID HI_Resampler_Destroy(HI_VOID* inst); 57 | 58 | 59 | /******************************************************************************* 60 | * Function: HI_Resampler_GetMaxOutputNum 61 | * 62 | * Description: Caculate max output number at specific input number 63 | * 64 | * Inputs: inst: valid Resampler instance pointer (HI_HANDLE) 65 | * insamps: input data number per-channel, insamps must be even 66 | * Outputs: none 67 | * Return: >=0: Success, return the max output number per-channel 68 | * other: Fail, return error code 69 | * Notes: 70 | * 1 if stereo(chans==2), sure insamps%2 == 0 71 | ******************************************************************************/ 72 | HI_S32 HI_Resampler_GetMaxOutputNum(HI_VOID* inst, HI_S32 s32Insamps); 73 | 74 | 75 | #ifdef __cplusplus 76 | } 77 | #endif 78 | 79 | 80 | 81 | #endif 82 | -------------------------------------------------------------------------------- /include/hisi/hi_sns_ctrl.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | 3 | Copyright (C), 2016, Hisilicon Tech. Co., Ltd. 4 | 5 | ****************************************************************************** 6 | File Name : hi_sns_ctrl.h 7 | Version : Initial Draft 8 | Author : Hisilicon multimedia software group 9 | Created : 2011/01/10 10 | Description : 11 | History : 12 | 1.Date : 2011/01/10 13 | Author : 14 | Modification: Created file 15 | 16 | ******************************************************************************/ 17 | 18 | #ifndef __HI_SNS_CTRL_H__ 19 | #define __HI_SNS_CTRL_H__ 20 | 21 | #include "hi_type.h" 22 | #include "hi_comm_3a.h" 23 | 24 | #ifdef __cplusplus 25 | #if __cplusplus 26 | extern "C" { 27 | #endif 28 | #endif /* End of #ifdef __cplusplus */ 29 | 30 | 31 | typedef struct hiISP_SNS_STATE_S 32 | { 33 | HI_BOOL bInit; /* HI_TRUE: Sensor init */ 34 | HI_BOOL bSyncInit; /* HI_TRUE: Sync Reg init */ 35 | HI_U8 u8ImgMode; 36 | HI_U8 u8Hdr; /* HI_TRUE: HDR enbale */ 37 | WDR_MODE_E enWDRMode; 38 | 39 | ISP_SNS_REGS_INFO_S astRegsInfo[2]; /* [0]: Sensor reg info of cur-frame; [1]: Sensor reg info of pre-frame ; */ 40 | 41 | HI_U32 au32FL[2]; /* [0]: FullLines of cur-frame; [1]: Pre FullLines of pre-frame */ 42 | HI_U32 u32FLStd; /* FullLines std */ 43 | HI_U32 au32WDRIntTime[4]; 44 | } ISP_SNS_STATE_S; 45 | 46 | typedef enum hiISP_SNS_MIRRORFLIP_TYPE_E 47 | { 48 | ISP_SNS_NORMAL = 0, 49 | ISP_SNS_MIRROR = 1, 50 | ISP_SNS_FLIP = 2, 51 | ISP_SNS_MIRROR_FLIP = 3, 52 | ISP_SNS_BUTT 53 | }ISP_SNS_MIRRORFLIP_TYPE_E; 54 | 55 | typedef struct hiISP_SNS_OBJ_S 56 | { 57 | HI_S32 (*pfnRegisterCallback)(VI_PIPE ViPipe, ALG_LIB_S *pstAeLib, ALG_LIB_S *pstAwbLib); 58 | HI_S32 (*pfnUnRegisterCallback)(VI_PIPE ViPipe, ALG_LIB_S *pstAeLib, ALG_LIB_S *pstAwbLib); 59 | HI_S32 (*pfnSetBusInfo)(VI_PIPE ViPipe, ISP_SNS_COMMBUS_U unSNSBusInfo); 60 | HI_VOID (*pfnStandby)(VI_PIPE ViPipe); 61 | HI_VOID (*pfnRestart)(VI_PIPE ViPipe); 62 | HI_VOID (*pfnMirrorFlip)(VI_PIPE ViPipe, ISP_SNS_MIRRORFLIP_TYPE_E eSnsMirrorFlip); 63 | HI_S32 (*pfnWriteReg)(VI_PIPE ViPipe, HI_S32 s32Addr, HI_S32 s32Data); 64 | HI_S32 (*pfnReadReg)(VI_PIPE ViPipe, HI_S32 s32Addr); 65 | HI_S32 (*pfnSetInit)(VI_PIPE ViPipe, ISP_INIT_ATTR_S *pstInitAttr); 66 | } ISP_SNS_OBJ_S; 67 | 68 | extern ISP_SNS_OBJ_S stSnsMn34220Obj; 69 | extern ISP_SNS_OBJ_S stSnsImx377Obj; 70 | extern ISP_SNS_OBJ_S stSnsImx299Obj; 71 | extern ISP_SNS_OBJ_S stSnsImx477Obj; 72 | extern ISP_SNS_OBJ_S stSnsImx299SlvsObj; 73 | extern ISP_SNS_OBJ_S stSnsImx290Obj; 74 | extern ISP_SNS_OBJ_S stSnsImx327Obj; 75 | extern ISP_SNS_OBJ_S stSnsImx327_2l_Obj; 76 | extern ISP_SNS_OBJ_S stSnsImx334Obj; 77 | extern ISP_SNS_OBJ_S stSnsOV2718Obj; 78 | extern ISP_SNS_OBJ_S stSnsCmv50000Obj; 79 | extern ISP_SNS_OBJ_S stSnsImx277SlvsObj; 80 | extern ISP_SNS_OBJ_S stSnsImx117Obj; 81 | extern ISP_SNS_OBJ_S stSnsImx290SlaveObj; 82 | extern ISP_SNS_OBJ_S stSnsImx334SlaveObj; 83 | extern ISP_SNS_OBJ_S stSnsImx226Obj; 84 | extern ISP_SNS_OBJ_S stSnsImx335Obj; 85 | extern ISP_SNS_OBJ_S stSnsImx307Obj; 86 | extern ISP_SNS_OBJ_S stSnsImx307_2l_Obj; 87 | extern ISP_SNS_OBJ_S stSnsImx458Obj; 88 | 89 | #define CMOS_CHECK_POINTER(ptr)\ 90 | do {\ 91 | if (HI_NULL == ptr)\ 92 | {\ 93 | ISP_TRACE(HI_DBG_ERR, "Null Pointer!\n");\ 94 | return HI_ERR_ISP_NULL_PTR;\ 95 | }\ 96 | }while(0) 97 | 98 | #define CMOS_CHECK_POINTER_VOID(ptr)\ 99 | do {\ 100 | if (HI_NULL == ptr)\ 101 | {\ 102 | ISP_TRACE(HI_DBG_ERR, "Null Pointer!\n");\ 103 | return;\ 104 | }\ 105 | }while(0) 106 | 107 | #define SENSOR_FREE(ptr)\ 108 | do{\ 109 | if (HI_NULL != ptr)\ 110 | {\ 111 | free(ptr);\ 112 | ptr = HI_NULL;\ 113 | }\ 114 | } while (0) 115 | 116 | 117 | #ifdef __cplusplus 118 | #if __cplusplus 119 | } 120 | #endif 121 | #endif /* End of #ifdef __cplusplus */ 122 | 123 | #endif /* __HI_SNS_CTRL_H__ */ 124 | -------------------------------------------------------------------------------- /include/hisi/hi_spi.h: -------------------------------------------------------------------------------- 1 | #ifndef __HI_SPI_H__ 2 | #define __HI_SPI_H__ 3 | 4 | typedef unsigned long long __u64; 5 | typedef unsigned int __u32; 6 | typedef unsigned short __u16; 7 | typedef unsigned char __u8; 8 | 9 | #ifdef __HuaweiLite__ 10 | #include 11 | #else 12 | 13 | 14 | /* User space versions of kernel symbols for SPI clocking modes, 15 | * matching 16 | */ 17 | 18 | #define SPI_CPHA 0x01 19 | #define SPI_CPOL 0x02 20 | 21 | #define SPI_MODE_0 (0|0) 22 | #define SPI_MODE_1 (0|SPI_CPHA) 23 | #define SPI_MODE_2 (SPI_CPOL|0) 24 | #define SPI_MODE_3 (SPI_CPOL|SPI_CPHA) 25 | 26 | #define SPI_CS_HIGH 0x04 27 | #define SPI_LSB_FIRST 0x08 28 | #define SPI_3WIRE 0x10 29 | #define SPI_LOOP 0x20 30 | #define SPI_NO_CS 0x40 31 | #define SPI_READY 0x80 32 | 33 | /*---------------------------------------------------------------------------*/ 34 | 35 | /* IOCTL commands */ 36 | 37 | #define SPI_IOC_MAGIC 'k' 38 | 39 | /** 40 | * struct spi_ioc_transfer - describes a single SPI transfer 41 | * @tx_buf: Holds pointer to userspace buffer with transmit data, or null. 42 | * If no data is provided, zeroes are shifted out. 43 | * @rx_buf: Holds pointer to userspace buffer for receive data, or null. 44 | * @len: Length of tx and rx buffers, in bytes. 45 | * @speed_hz: Temporary override of the device's bitrate. 46 | * @bits_per_word: Temporary override of the device's wordsize. 47 | * @delay_usecs: If nonzero, how long to delay after the last bit transfer 48 | * before optionally deselecting the device before the next transfer. 49 | * @cs_change: True to deselect device before starting the next transfer. 50 | * 51 | * This structure is mapped directly to the kernel spi_transfer structure; 52 | * the fields have the same meanings, except of course that the pointers 53 | * are in a different address space (and may be of different sizes in some 54 | * cases, such as 32-bit i386 userspace over a 64-bit x86_64 kernel). 55 | * Zero-initialize the structure, including currently unused fields, to 56 | * accommodate potential future updates. 57 | * 58 | * SPI_IOC_MESSAGE gives userspace the equivalent of kernel spi_sync(). 59 | * Pass it an array of related transfers, they'll execute together. 60 | * Each transfer may be half duplex (either direction) or full duplex. 61 | * 62 | * struct spi_ioc_transfer mesg[4]; 63 | * ... 64 | * status = ioctl(fd, SPI_IOC_MESSAGE(4), mesg); 65 | * 66 | * So for example one transfer might send a nine bit command (right aligned 67 | * in a 16-bit word), the next could read a block of 8-bit data before 68 | * terminating that command by temporarily deselecting the chip; the next 69 | * could send a different nine bit command (re-selecting the chip), and the 70 | * last transfer might write some register values. 71 | */ 72 | struct spi_ioc_transfer { 73 | __u64 tx_buf; 74 | __u64 rx_buf; 75 | 76 | __u32 len; 77 | __u32 speed_hz; 78 | 79 | __u16 delay_usecs; 80 | __u8 bits_per_word; 81 | __u8 cs_change; 82 | __u32 pad; 83 | 84 | /* If the contents of 'struct spi_ioc_transfer' ever change 85 | * incompatibly, then the ioctl number (currently 0) must change; 86 | * ioctls with constant size fields get a bit more in the way of 87 | * error checking than ones (like this) where that field varies. 88 | * 89 | * NOTE: struct layout is the same in 64bit and 32bit userspace. 90 | */ 91 | }; 92 | 93 | /* not all platforms use or _IOC_TYPECHECK() ... */ 94 | #define SPI_MSGSIZE(N) \ 95 | ((((N)*(sizeof (struct spi_ioc_transfer))) < (1 << _IOC_SIZEBITS)) \ 96 | ? ((N)*(sizeof (struct spi_ioc_transfer))) : 0) 97 | #define SPI_IOC_MESSAGE(N) _IOW(SPI_IOC_MAGIC, 0, char[SPI_MSGSIZE(N)]) 98 | 99 | 100 | /* Read / Write of SPI mode (SPI_MODE_0..SPI_MODE_3) */ 101 | #define SPI_IOC_RD_MODE _IOR(SPI_IOC_MAGIC, 1, __u8) 102 | #define SPI_IOC_WR_MODE _IOW(SPI_IOC_MAGIC, 1, __u8) 103 | 104 | /* Read / Write SPI bit justification */ 105 | #define SPI_IOC_RD_LSB_FIRST _IOR(SPI_IOC_MAGIC, 2, __u8) 106 | #define SPI_IOC_WR_LSB_FIRST _IOW(SPI_IOC_MAGIC, 2, __u8) 107 | 108 | /* Read / Write SPI device word length (1..N) */ 109 | #define SPI_IOC_RD_BITS_PER_WORD _IOR(SPI_IOC_MAGIC, 3, __u8) 110 | #define SPI_IOC_WR_BITS_PER_WORD _IOW(SPI_IOC_MAGIC, 3, __u8) 111 | 112 | /* Read / Write SPI device default max speed hz */ 113 | #define SPI_IOC_RD_MAX_SPEED_HZ _IOR(SPI_IOC_MAGIC, 4, __u32) 114 | #define SPI_IOC_WR_MAX_SPEED_HZ _IOW(SPI_IOC_MAGIC, 4, __u32) 115 | 116 | #endif 117 | #endif /* __HI_SPI_H__ */ 118 | -------------------------------------------------------------------------------- /include/hisi/hi_ssp.h: -------------------------------------------------------------------------------- 1 | /* 2 | * extdrv/include/hi_ssp.h for Linux . 3 | * 4 | * History: 5 | * 2006-4-11 create this file 6 | */ 7 | 8 | #ifndef __HI_SSP_H__ 9 | #define __HI_SSP_H__ 10 | 11 | #define SSP_READ_ALT 0x1 12 | #define SSP_WRITE_ALT 0X3 13 | 14 | typedef struct hiSPI_DATA_S 15 | { 16 | unsigned int spi_no; 17 | unsigned char dev_addr; 18 | unsigned int dev_byte_num; 19 | unsigned int reg_addr; 20 | unsigned int addr_byte_num; 21 | unsigned int data; 22 | unsigned int data_byte_num; 23 | }SPI_DATA_S; 24 | 25 | 26 | #endif 27 | 28 | -------------------------------------------------------------------------------- /include/hisi/hi_tde_errcode.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | Copyright (C), 2016-2018, Hisilicon Tech. Co., Ltd. 3 | ****************************************************************************** 4 | File Name : tde_errcode.h 5 | Version : Initial Draft 6 | Author : Hisilicon multimedia software group 7 | Created : 8 | Last Modified : 9 | Description : err code define 10 | Function List : 11 | History : May modify the code to errcode.h FOR hi3110 12 | ******************************************************************************/ 13 | #ifndef __TDE_ERRCODE_H__ 14 | #define __TDE_ERRCODE_H__ 15 | 16 | //#include "hi_debug.h" 17 | #include "hi_type.h" 18 | 19 | #ifdef __cplusplus 20 | #if __cplusplus 21 | extern "C" { 22 | #endif 23 | #endif /* __cplusplus */ 24 | 25 | //#define HI_ID_TDE 100 26 | /* tde start err no. */ 27 | #define HI_ERR_TDE_BASE ((HI_S32)( ((0x80UL + 0x20UL)<<24) | (100 << 16 ) | (4 << 13) | 1 )) 28 | 29 | enum 30 | { 31 | HI_ERR_TDE_DEV_NOT_OPEN = HI_ERR_TDE_BASE, /**< tde device not open yet */ 32 | HI_ERR_TDE_DEV_OPEN_FAILED, /**< open tde device failed */ 33 | HI_ERR_TDE_NULL_PTR, /**< input parameters contain null ptr */ 34 | HI_ERR_TDE_NO_MEM, /**< malloc failed */ 35 | HI_ERR_TDE_INVALID_HANDLE, /**< invalid job handle */ 36 | HI_ERR_TDE_INVALID_PARA, /**< invalid parameter */ 37 | HI_ERR_TDE_NOT_ALIGNED, /**< aligned error for position, stride, width */ 38 | HI_ERR_TDE_MINIFICATION, /**< invalid minification */ 39 | HI_ERR_TDE_CLIP_AREA, /**< clip area and operation area have no intersection */ 40 | HI_ERR_TDE_JOB_TIMEOUT, /**< blocked job wait timeout */ 41 | HI_ERR_TDE_UNSUPPORTED_OPERATION, /**< unsupported operation */ 42 | HI_ERR_TDE_QUERY_TIMEOUT, /**< query time out */ 43 | HI_ERR_TDE_INTERRUPT /* blocked job was interrupted */ 44 | }; 45 | 46 | 47 | #ifdef __cplusplus 48 | #if __cplusplus 49 | } 50 | #endif 51 | #endif /* __cplusplus */ 52 | 53 | #endif /* __TDE_ERRCODE_H__*/ 54 | 55 | 56 | -------------------------------------------------------------------------------- /include/hisi/hi_type.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | Copyright (C), 2016, Hisilicon Tech. Co., Ltd. 3 | ****************************************************************************** 4 | File Name : hi_type.h 5 | Version : Initial Draft 6 | Author : Hisilicon multimedia software group 7 | Created : 2016/07/15 8 | Last Modified : 9 | Description : The common data type defination 10 | Function List : 11 | ******************************************************************************/ 12 | #ifndef __HI_TYPE_H__ 13 | #define __HI_TYPE_H__ 14 | 15 | 16 | #ifdef __cplusplus 17 | #if __cplusplus 18 | extern "C"{ 19 | #endif 20 | #endif /* __cplusplus */ 21 | 22 | /*----------------------------------------------* 23 | * The common data type, will be used in the whole project.* 24 | *----------------------------------------------*/ 25 | 26 | typedef unsigned char HI_U8; 27 | typedef unsigned short HI_U16; 28 | typedef unsigned int HI_U32; 29 | 30 | typedef signed char HI_S8; 31 | typedef short HI_S16; 32 | typedef int HI_S32; 33 | 34 | typedef unsigned long HI_UL; 35 | typedef signed long HI_SL; 36 | 37 | typedef float HI_FLOAT; 38 | typedef double HI_DOUBLE; 39 | 40 | #ifndef _M_IX86 41 | typedef unsigned long long HI_U64; 42 | typedef long long HI_S64; 43 | #else 44 | typedef unsigned __int64 HI_U64; 45 | typedef __int64 HI_S64; 46 | #endif 47 | 48 | typedef char HI_CHAR; 49 | #define HI_VOID void 50 | 51 | typedef unsigned int HI_HANDLE; 52 | 53 | /*----------------------------------------------* 54 | * const defination * 55 | *----------------------------------------------*/ 56 | typedef enum { 57 | HI_FALSE = 0, 58 | HI_TRUE = 1, 59 | } HI_BOOL; 60 | 61 | 62 | #ifndef NULL 63 | #define NULL 0L 64 | #endif 65 | 66 | #define HI_NULL 0L 67 | #define HI_SUCCESS 0 68 | #define HI_FAILURE (-1) 69 | 70 | 71 | #ifdef __cplusplus 72 | #if __cplusplus 73 | } 74 | #endif 75 | #endif /* __cplusplus */ 76 | 77 | #endif /* __HI_TYPE_H__ */ 78 | 79 | -------------------------------------------------------------------------------- /include/hisi/hi_types.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | Copyright (C), 2001-2011, Hisilicon Tech. Co., Ltd. 3 | ****************************************************************************** 4 | File Name : hi_type.h 5 | Version : Initial Draft 6 | Author : Hisilicon multimedia software group 7 | Created : 2005/4/23 8 | Last Modified : 9 | Description : Common data types of the system. 10 | Function List : 11 | History : 12 | ******************************************************************************/ 13 | #ifndef __HI_TYPES_H__ 14 | #define __HI_TYPES_H__ 15 | 16 | #include "hi_type.h" 17 | 18 | #ifdef __cplusplus 19 | #if __cplusplus 20 | extern "C"{ 21 | #endif 22 | #endif /* __cplusplus */ 23 | 24 | /*--------------------------------------------------------------------------------------------------------------* 25 | * Defintion of basic data types. The data types are applicable to both the application layer and kernel codes. * 26 | *--------------------------------------------------------------------------------------------------------------*/ 27 | /*************************** Structure Definition ****************************/ 28 | /** \addtogroup Common_TYPE */ 29 | /** @{ */ /** |<--- 8bit --->|<--- 8bit --->| 42 | |--------------------------------------------------------------| 43 | | HI_MOD_ID_E | mod defined data | chnID | 44 | |--------------------------------------------------------------| 45 | 46 | mod defined data: private data define by each module(for example: sub-mod id), usually, set to 0. 47 | */ 48 | 49 | #define HI_HANDLE_MAKEHANDLE(mod, privatedata, chnid) (HI_HANDLE)( (((mod)& 0xffff) << 16) | ((((privatedata)& 0xff) << 8) ) | (((chnid) & 0xff)) ) 50 | 51 | #define HI_HANDLE_GET_MODID(handle) (((handle) >> 16) & 0xffff) 52 | #define HI_HANDLE_GET_PriDATA(handle) (((handle) >> 8) & 0xff) 53 | #define HI_HANDLE_GET_CHNID(handle) (((handle)) & 0xff) 54 | 55 | 56 | /** @} */ /**