1 /* 2 * Copyright (c) 2020 HiSilicon (Shanghai) Technologies CO., LIMITED. 3 * 4 * This program is free software; you can redistribute it and/or modify it 5 * under the terms of the GNU General Public License as published by the 6 * Free Software Foundation; either version 2 of the License, or (at your 7 * option) any later version. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program. If not, see <http://www.gnu.org/licenses/>. 16 * 17 */ 18 19 #ifndef __HI_COMMON_H__ 20 #define __HI_COMMON_H__ 21 22 #include "hi_type.h" 23 #include "hi_defines.h" 24 #ifndef __KERNEL__ 25 #include "securec.h" 26 #endif 27 28 29 #ifdef __cplusplus 30 #if __cplusplus 31 extern "C" { 32 #endif 33 #endif /* end of #ifdef __cplusplus */ 34 35 #ifndef VER_X 36 #define VER_X 1 37 #endif 38 39 #ifndef VER_Y 40 #define VER_Y 0 41 #endif 42 43 #ifndef VER_Z 44 #define VER_Z 0 45 #endif 46 47 #ifndef VER_P 48 #define VER_P 0 49 #endif 50 51 #ifndef VER_B 52 #define VER_B 0 53 #endif 54 55 #ifdef HI_DEBUG 56 #define VER_D " Debug" 57 #else 58 #define VER_D " Release" 59 #endif 60 61 #define HI_COMPAT_POINTER(ptr, type) \ 62 do { \ 63 hi_ulong ulAddr = (hi_ulong)ptr; \ 64 hi_u32 u32Addr = (hi_u32)ulAddr; \ 65 ptr = (type)(hi_ulong)u32Addr; \ 66 } while (0) 67 68 #define __MK_VERSION(x, y, z, p, b) #x "." #y "." #z "." #p " B0" #b 69 #define MK_VERSION(x, y, z, p, b) __MK_VERSION(x, y, z, p, b) 70 #define HI_MPP_VERSION HI_CHIP_NAME HI_MPP_VER_PRIX MK_VERSION(VER_X, VER_Y, VER_Z, VER_P, VER_B) VER_D 71 72 73 #define HI_MAX_VERSION_NAME_LEN 64 74 #define HI_INVALID_CHN (-1) 75 #define HI_INVALID_WAY (-1) 76 #define HI_INVALID_LAYER (-1) 77 #define HI_INVALID_DEV (-1) 78 #define HI_INVALID_HANDLE (-1) 79 #define HI_INVALID_VALUE (-1) 80 #define HI_INVALID_TYPE (-1) 81 82 #define HI_MPP_MOD_VI "vi" 83 #define HI_MPP_MOD_VO "vo" 84 #define HI_MPP_MOD_AVS "avs" 85 #define HI_MPP_MOD_HDMI "hdmi" 86 #define HI_MPP_MOD_VGS "vgs" 87 #define HI_MPP_MOD_GDC "gdc" 88 #define HI_MPP_MOD_DIS "dis" 89 #define HI_MPP_MOD_GYRODIS "gyrodis" 90 #define HI_MPP_MOD_CHNL "chnl" 91 #define HI_MPP_MOD_VENC "venc" 92 #define HI_MPP_MOD_VPSS "vpss" 93 #define HI_MPP_MOD_RGN "rgn" 94 #define HI_MPP_MOD_IVE "ive" 95 #define HI_MPP_MOD_FD "fd" 96 #define HI_MPP_MOD_MD "md" 97 #define HI_MPP_MOD_IVP "ivp" 98 #define HI_MPP_MOD_SVP "svp" 99 #define HI_MPP_MOD_SVP_NNIE "nnie" 100 #define HI_MPP_MOD_SVP_DSP "dsp" 101 #define HI_MPP_MOD_SVP_ALG "svp_alg" 102 #define HI_MPP_MOD_DPU_RECT "rect" 103 #define HI_MPP_MOD_DPU_MATCH "match" 104 #define HI_MPP_MOD_SVP_MAU "mau" 105 #define HI_MPP_MOD_H264E "h264e" 106 #define HI_MPP_MOD_H265E "h265e" 107 #define HI_MPP_MOD_JPEGE "jpege" 108 #define HI_MPP_MOD_MPEG4E "mpeg4e" 109 #define HI_MPP_MOD_VEDU "vedu" 110 #define HI_MPP_MOD_PRORES "prores" 111 #define HI_MPP_MOD_VDEC "vdec" 112 #define HI_MPP_MOD_H264D "h264d" 113 #define HI_MPP_MOD_JPEGD "jpegd" 114 #define HI_MPP_MOD_AI "ai" 115 #define HI_MPP_MOD_AO "ao" 116 #define HI_MPP_MOD_AENC "aenc" 117 #define HI_MPP_MOD_ADEC "adec" 118 #define HI_MPP_MOD_AIO "aio" 119 #define HI_MPP_MOD_ACODEC "acodec" 120 #define HI_MPP_MOD_VB "vb" 121 #define HI_MPP_MOD_SYS "sys" 122 #define HI_MPP_MOD_CMPI "cmpi" 123 #define HI_MPP_MOD_PCIV "pciv" 124 #define HI_MPP_MOD_PCIVFMW "pcivfmw" 125 #define HI_MPP_MOD_PROC "proc" 126 #define HI_MPP_MOD_LOG "logmpp" 127 #define HI_MPP_MOD_FB "fb" 128 #define HI_MPP_MOD_RC "rc" 129 #define HI_MPP_MOD_TDE "tde" 130 #define HI_MPP_MOD_ISP "isp" 131 #define HI_MPP_MOD_USR "usr" 132 #define HI_MPP_MOD_MCF "mcf" 133 #define HI_MPP_MOD_PM "pm" 134 #define HI_MPP_MOD_MFUSION "motionfusion" 135 #define HI_MPP_MOD_VDA "vda" 136 137 typedef struct { 138 hi_char version[HI_MAX_VERSION_NAME_LEN]; 139 } hi_mpp_version; 140 141 typedef hi_s32 hi_ai_chn; 142 typedef hi_s32 hi_ao_chn; 143 typedef hi_s32 hi_aenc_chn; 144 typedef hi_s32 hi_adec_chn; 145 typedef hi_s32 hi_audio_dev; 146 typedef hi_s32 hi_vi_dev; 147 typedef hi_s32 hi_vi_pipe; 148 typedef hi_s32 hi_vi_way; 149 typedef hi_s32 hi_vi_chn; 150 typedef hi_s32 hi_vo_dev; 151 typedef hi_s32 hi_vo_layer; 152 typedef hi_s32 hi_vo_chn; 153 typedef hi_s32 hi_vo_wbc; 154 typedef hi_s32 hi_gfx_layer; 155 typedef hi_s32 hi_venc_chn; 156 typedef hi_s32 hi_vdec_chn; 157 typedef hi_s32 hi_ive_handle; 158 typedef hi_s32 hi_fd_chn; 159 typedef hi_s32 hi_md_chn; 160 typedef hi_s32 hi_sensor_id; 161 typedef hi_s32 hi_mipi_dev; 162 typedef hi_s32 hi_slave_dev; 163 typedef hi_s32 hi_svp_nnie_handle; 164 typedef hi_s32 hi_svp_dsp_handle; 165 typedef hi_s32 hi_svp_alg_chn; 166 typedef hi_s32 hi_svp_mau_handle; 167 typedef hi_s32 hi_vpss_grp; 168 typedef hi_s32 hi_vpss_grp_pipe; 169 typedef hi_s32 hi_vpss_chn; 170 typedef hi_s32 hi_avs_grp; 171 typedef hi_s32 hi_avs_pipe; 172 typedef hi_s32 hi_avs_chn; 173 typedef hi_s32 hi_mcf_grp; 174 typedef hi_s32 hi_mcf_pipe; 175 typedef hi_s32 hi_mcf_chn; 176 typedef hi_s32 hi_vda_chn; 177 typedef hi_s32 hi_pciv_chn; 178 179 typedef enum { 180 HI_ID_CMPI = 0, 181 HI_ID_VB = 1, 182 HI_ID_SYS = 2, 183 HI_ID_RGN = 3, 184 HI_ID_CHNL = 4, 185 HI_ID_VDEC = 5, 186 HI_ID_AVS = 6, 187 HI_ID_VPSS = 7, 188 HI_ID_VENC = 8, 189 HI_ID_SVP = 9, 190 HI_ID_H264E = 10, 191 HI_ID_JPEGE = 11, 192 HI_ID_H265E = 13, 193 HI_ID_JPEGD = 14, 194 HI_ID_VO = 15, 195 HI_ID_VI = 16, 196 HI_ID_DIS = 17, 197 HI_ID_VALG = 18, 198 HI_ID_RC = 19, 199 HI_ID_AIO = 20, 200 HI_ID_AI = 21, 201 HI_ID_AO = 22, 202 HI_ID_AENC = 23, 203 HI_ID_ADEC = 24, 204 HI_ID_VPU = 25, 205 HI_ID_PCIV = 26, 206 HI_ID_PCIVFMW = 27, 207 HI_ID_ISP = 28, 208 HI_ID_IVE = 29, 209 HI_ID_USER = 30, 210 HI_ID_PROC = 33, 211 HI_ID_LOG = 34, 212 HI_ID_VFMW = 35, 213 HI_ID_GDC = 37, 214 HI_ID_PHOTO = 38, 215 HI_ID_FB = 39, 216 HI_ID_HDMI = 40, 217 HI_ID_VOIE = 41, 218 HI_ID_TDE = 42, 219 HI_ID_HDR = 43, 220 HI_ID_PRORES = 44, 221 HI_ID_VGS = 45, 222 HI_ID_FD = 47, 223 HI_ID_OD = 48, 224 HI_ID_LPR = 50, 225 HI_ID_SVP_NNIE = 51, 226 HI_ID_SVP_DSP = 52, 227 HI_ID_DPU_RECT = 53, 228 HI_ID_DPU_MATCH = 54, 229 230 HI_ID_MOTIONSENSOR = 55, 231 HI_ID_MOTIONFUSION = 56, 232 233 HI_ID_GYRODIS = 57, 234 HI_ID_PM = 58, 235 HI_ID_SVP_ALG = 59, 236 HI_ID_IVP = 60, 237 HI_ID_MCF = 61, 238 HI_ID_SVP_MAU = 62, 239 HI_ID_VDA = 63, 240 241 HI_ID_BUTT, 242 } hi_mod_id; 243 244 typedef struct { 245 hi_mod_id mod_id; 246 hi_s32 dev_id; 247 hi_s32 chn_id; 248 } hi_mpp_chn; 249 250 /* We just coyp this value of payload type from RTP/RTSP definition */ 251 typedef enum { 252 HI_PT_PCMU = 0, 253 HI_PT_1016 = 1, 254 HI_PT_G721 = 2, 255 HI_PT_GSM = 3, 256 HI_PT_G723 = 4, 257 HI_PT_DVI4_8K = 5, 258 HI_PT_DVI4_16K = 6, 259 HI_PT_LPC = 7, 260 HI_PT_PCMA = 8, 261 HI_PT_G722 = 9, 262 HI_PT_S16BE_STEREO = 10, 263 HI_PT_S16BE_MONO = 11, 264 HI_PT_QCELP = 12, 265 HI_PT_CN = 13, 266 HI_PT_MPEGAUDIO = 14, 267 HI_PT_G728 = 15, 268 HI_PT_DVI4_3 = 16, 269 HI_PT_DVI4_4 = 17, 270 HI_PT_G729 = 18, 271 HI_PT_G711A = 19, 272 HI_PT_G711U = 20, 273 HI_PT_G726 = 21, 274 HI_PT_G729A = 22, 275 HI_PT_LPCM = 23, 276 HI_PT_CelB = 25, 277 HI_PT_JPEG = 26, 278 HI_PT_CUSM = 27, 279 HI_PT_NV = 28, 280 HI_PT_PICW = 29, 281 HI_PT_CPV = 30, 282 HI_PT_H261 = 31, 283 HI_PT_MPEGVIDEO = 32, 284 HI_PT_MPEG2TS = 33, 285 HI_PT_H263 = 34, 286 HI_PT_SPEG = 35, 287 HI_PT_MPEG2VIDEO = 36, 288 HI_PT_AAC = 37, 289 HI_PT_WMA9STD = 38, 290 HI_PT_HEAAC = 39, 291 HI_PT_PCM_VOICE = 40, 292 HI_PT_PCM_AUDIO = 41, 293 HI_PT_MP3 = 43, 294 HI_PT_ADPCMA = 49, 295 HI_PT_AEC = 50, 296 HI_PT_X_LD = 95, 297 HI_PT_H264 = 96, 298 HI_PT_D_GSM_HR = 200, 299 HI_PT_D_GSM_EFR = 201, 300 HI_PT_D_L8 = 202, 301 HI_PT_D_RED = 203, 302 HI_PT_D_VDVI = 204, 303 HI_PT_D_BT656 = 220, 304 HI_PT_D_H263_1998 = 221, 305 HI_PT_D_MP1S = 222, 306 HI_PT_D_MP2P = 223, 307 HI_PT_D_BMPEG = 224, 308 HI_PT_MP4VIDEO = 230, 309 HI_PT_MP4AUDIO = 237, 310 HI_PT_VC1 = 238, 311 HI_PT_JVC_ASF = 255, 312 HI_PT_D_AVI = 256, 313 HI_PT_DIVX3 = 257, 314 HI_PT_AVS = 258, 315 HI_PT_REAL8 = 259, 316 HI_PT_REAL9 = 260, 317 HI_PT_VP6 = 261, 318 HI_PT_VP6F = 262, 319 HI_PT_VP6A = 263, 320 HI_PT_SORENSON = 264, 321 HI_PT_H265 = 265, 322 HI_PT_VP8 = 266, 323 HI_PT_MVC = 267, 324 HI_PT_PNG = 268, 325 /* add by hisilicon */ 326 HI_PT_AMR = 1001, 327 HI_PT_MJPEG = 1002, 328 HI_PT_AMRWB = 1003, 329 HI_PT_PRORES = 1006, 330 HI_PT_OPUS = 1007, 331 HI_PT_BUTT 332 } hi_payload_type; 333 334 #ifdef __cplusplus 335 #if __cplusplus 336 } 337 #endif 338 #endif /* end of #ifdef __cplusplus */ 339 340 #endif /* __HI_COMMON_H__ */ 341 342