11bd4fe43Sopenharmony_ci/* 21bd4fe43Sopenharmony_ci * Copyright (c) 2022 HiSilicon (Shanghai) Technologies CO., LIMITED. 31bd4fe43Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 41bd4fe43Sopenharmony_ci * you may not use this file except in compliance with the License. 51bd4fe43Sopenharmony_ci * You may obtain a copy of the License at 61bd4fe43Sopenharmony_ci * 71bd4fe43Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 81bd4fe43Sopenharmony_ci * 91bd4fe43Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 101bd4fe43Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 111bd4fe43Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 121bd4fe43Sopenharmony_ci * See the License for the specific language governing permissions and 131bd4fe43Sopenharmony_ci * limitations under the License. 141bd4fe43Sopenharmony_ci */ 151bd4fe43Sopenharmony_ci 161bd4fe43Sopenharmony_ci#ifndef __MPI_SYS_H__ 171bd4fe43Sopenharmony_ci#define __MPI_SYS_H__ 181bd4fe43Sopenharmony_ci 191bd4fe43Sopenharmony_ci#include "hi_type.h" 201bd4fe43Sopenharmony_ci#include "hi_common.h" 211bd4fe43Sopenharmony_ci#include "hi_comm_sys.h" 221bd4fe43Sopenharmony_ci 231bd4fe43Sopenharmony_ci#ifdef __cplusplus 241bd4fe43Sopenharmony_ciextern "C" { 251bd4fe43Sopenharmony_ci#endif /* End of #ifdef __cplusplus */ 261bd4fe43Sopenharmony_ci 271bd4fe43Sopenharmony_ciHI_S32 HI_MPI_SYS_Init(HI_VOID); 281bd4fe43Sopenharmony_ciHI_S32 HI_MPI_SYS_Exit(HI_VOID); 291bd4fe43Sopenharmony_ci 301bd4fe43Sopenharmony_ciHI_S32 HI_MPI_SYS_SetConfig(const MPP_SYS_CONFIG_S *pstSysConfig); 311bd4fe43Sopenharmony_ciHI_S32 HI_MPI_SYS_GetConfig(MPP_SYS_CONFIG_S *pstSysConfig); 321bd4fe43Sopenharmony_ci 331bd4fe43Sopenharmony_ciHI_S32 HI_MPI_SYS_Bind(const MPP_CHN_S *pstSrcChn, const MPP_CHN_S *pstDestChn); 341bd4fe43Sopenharmony_ciHI_S32 HI_MPI_SYS_UnBind(const MPP_CHN_S *pstSrcChn, const MPP_CHN_S *pstDestChn); 351bd4fe43Sopenharmony_ciHI_S32 HI_MPI_SYS_GetBindbyDest(const MPP_CHN_S *pstDestChn, MPP_CHN_S *pstSrcChn); 361bd4fe43Sopenharmony_ciHI_S32 HI_MPI_SYS_GetBindbySrc(const MPP_CHN_S *pstSrcChn, MPP_BIND_DEST_S *pstBindDest); 371bd4fe43Sopenharmony_ci 381bd4fe43Sopenharmony_ciHI_S32 HI_MPI_SYS_GetVersion(MPP_VERSION_S *pstVersion); 391bd4fe43Sopenharmony_ci 401bd4fe43Sopenharmony_ciHI_S32 HI_MPI_SYS_GetChipId(HI_U32 *pu32ChipId); 411bd4fe43Sopenharmony_ciHI_S32 HI_MPI_SYS_GetUniqueId(HI_UNIQUE_ID_S *pstUniqueId); 421bd4fe43Sopenharmony_ci 431bd4fe43Sopenharmony_ciHI_S32 HI_MPI_SYS_GetCustomCode(HI_U32 *pu32CustomCode); 441bd4fe43Sopenharmony_ci 451bd4fe43Sopenharmony_ci/* 461bd4fe43Sopenharmony_ci * u64Base is the global PTS of the system. 471bd4fe43Sopenharmony_ci * ADVICE: 481bd4fe43Sopenharmony_ci * 1. Better to call HI_MPI_SYS_GetCurPTS on the host board to get u64Base. 491bd4fe43Sopenharmony_ci * 2. When os start up, call HI_MPI_SYS_InitPTSBase to set the init PTS. 501bd4fe43Sopenharmony_ci * 3. When media bussines is running, synchronize the PTS one time per minute 511bd4fe43Sopenharmony_ci * by calling HI_MPI_SYS_SyncPTS. 521bd4fe43Sopenharmony_ci */ 531bd4fe43Sopenharmony_ciHI_S32 HI_MPI_SYS_GetCurPTS(HI_U64 *pu64CurPTS); 541bd4fe43Sopenharmony_ciHI_S32 HI_MPI_SYS_InitPTSBase(HI_U64 u64PTSBase); 551bd4fe43Sopenharmony_ciHI_S32 HI_MPI_SYS_SyncPTS(HI_U64 u64PTSBase); 561bd4fe43Sopenharmony_ci 571bd4fe43Sopenharmony_ci/* alloc mmz memory in user context */ 581bd4fe43Sopenharmony_ciHI_S32 HI_MPI_SYS_MmzAlloc(HI_U64 *pu64PhyAddr, HI_VOID **ppVirAddr, 591bd4fe43Sopenharmony_ci const HI_CHAR *strMmb, const HI_CHAR *strZone, HI_U32 u32Len); 601bd4fe43Sopenharmony_ci 611bd4fe43Sopenharmony_ci/* alloc mmz memory with cache */ 621bd4fe43Sopenharmony_ciHI_S32 HI_MPI_SYS_MmzAlloc_Cached(HI_U64 *pu64PhyAddr, HI_VOID **ppVirAddr, 631bd4fe43Sopenharmony_ci const HI_CHAR *pstrMmb, const HI_CHAR *pstrZone, HI_U32 u32Len); 641bd4fe43Sopenharmony_ci 651bd4fe43Sopenharmony_ci/* free mmz memory in user context */ 661bd4fe43Sopenharmony_ciHI_S32 HI_MPI_SYS_MmzFree(HI_U64 u64PhyAddr, HI_VOID *pVirAddr); 671bd4fe43Sopenharmony_ci 681bd4fe43Sopenharmony_ci/* fulsh cache */ 691bd4fe43Sopenharmony_ciHI_S32 HI_MPI_SYS_MmzFlushCache(HI_U64 u64PhyAddr, HI_VOID *pVirAddr, HI_U32 u32Size); 701bd4fe43Sopenharmony_ci 711bd4fe43Sopenharmony_ci/* 721bd4fe43Sopenharmony_ci * Call the mmap function to map physical address to virtual address 731bd4fe43Sopenharmony_ci * The system function mmap is too complicated, so we packge it. 741bd4fe43Sopenharmony_ci */ 751bd4fe43Sopenharmony_ciHI_VOID *HI_MPI_SYS_Mmap(HI_U64 u64PhyAddr, HI_U32 u32Size); 761bd4fe43Sopenharmony_ciHI_VOID *HI_MPI_SYS_MmapCache(HI_U64 u64PhyAddr, HI_U32 u32Size); 771bd4fe43Sopenharmony_ciHI_S32 HI_MPI_SYS_Munmap(HI_VOID *pVirAddr, HI_U32 u32Size); 781bd4fe43Sopenharmony_ciHI_S32 HI_MPI_SYS_MflushCache(HI_U64 u64PhyAddr, HI_VOID *pVirAddr, HI_U32 u32Size); 791bd4fe43Sopenharmony_ci 801bd4fe43Sopenharmony_ciHI_S32 HI_MPI_SYS_SetMemConfig(const MPP_CHN_S *pstMppChn, const HI_CHAR *pcMmzName); 811bd4fe43Sopenharmony_ciHI_S32 HI_MPI_SYS_GetMemConfig(const MPP_CHN_S *pstMppChn, HI_CHAR *pcMmzName); 821bd4fe43Sopenharmony_ci 831bd4fe43Sopenharmony_ci/* Close all the FD which is used by sys module */ 841bd4fe43Sopenharmony_ciHI_S32 HI_MPI_SYS_CloseFd(HI_VOID); 851bd4fe43Sopenharmony_ci 861bd4fe43Sopenharmony_ci/* Get virtual meminfo according to virtual addr, should be in one process */ 871bd4fe43Sopenharmony_ciHI_S32 HI_MPI_SYS_GetVirMemInfo(const void *pVirAddr, SYS_VIRMEM_INFO_S *pstMemInfo); 881bd4fe43Sopenharmony_ci 891bd4fe43Sopenharmony_ci/* Set/get Scale coefficient level for VPSS/VGS */ 901bd4fe43Sopenharmony_ciHI_S32 HI_MPI_SYS_SetScaleCoefLevel(const SCALE_RANGE_S *pstScaleRange, 911bd4fe43Sopenharmony_ci const SCALE_COEFF_LEVEL_S *pstScaleCoeffLevel); 921bd4fe43Sopenharmony_ciHI_S32 HI_MPI_SYS_GetScaleCoefLevel(const SCALE_RANGE_S *pstScaleRange, SCALE_COEFF_LEVEL_S *pstScaleCoeffLevel); 931bd4fe43Sopenharmony_ci 941bd4fe43Sopenharmony_ci/* Set/Get local timezone, range: [-86400, 86400] seconds (that is: [-24, 24] hours) */ 951bd4fe43Sopenharmony_ciHI_S32 HI_MPI_SYS_SetTimeZone(HI_S32 s32TimeZone); 961bd4fe43Sopenharmony_ciHI_S32 HI_MPI_SYS_GetTimeZone(HI_S32 *ps32TimeZone); 971bd4fe43Sopenharmony_ci 981bd4fe43Sopenharmony_ciHI_S32 HI_MPI_SYS_SetGPSInfo(const GPS_INFO_S *pstGPSInfo); 991bd4fe43Sopenharmony_ciHI_S32 HI_MPI_SYS_GetGPSInfo(GPS_INFO_S *pstGPSInfo); 1001bd4fe43Sopenharmony_ci 1011bd4fe43Sopenharmony_ciHI_S32 HI_MPI_SYS_SetTuningConnect(HI_S32 s32Connect); 1021bd4fe43Sopenharmony_ciHI_S32 HI_MPI_SYS_GetTuningConnect(HI_S32 *ps32Connect); 1031bd4fe43Sopenharmony_ci 1041bd4fe43Sopenharmony_ciHI_S32 HI_MPI_SYS_SetVIVPSSMode(const VI_VPSS_MODE_S *pstVIVPSSMode); 1051bd4fe43Sopenharmony_ciHI_S32 HI_MPI_SYS_GetVIVPSSMode(VI_VPSS_MODE_S *pstVIVPSSMode); 1061bd4fe43Sopenharmony_ci 1071bd4fe43Sopenharmony_ciHI_S32 HI_MPI_SYS_GetVPSSVENCWrapBufferLine(VPSS_VENC_WRAP_PARAM_S *pWrapParam, HI_U32 *pu32BufLine); 1081bd4fe43Sopenharmony_ci 1091bd4fe43Sopenharmony_ciHI_S32 HI_MPI_LOG_SetLevelConf(LOG_LEVEL_CONF_S *pstConf); 1101bd4fe43Sopenharmony_ciHI_S32 HI_MPI_LOG_GetLevelConf(LOG_LEVEL_CONF_S *pstConf); 1111bd4fe43Sopenharmony_ci 1121bd4fe43Sopenharmony_ciHI_S32 HI_MPI_SYS_SetRawFrameCompressParam(const RAW_FRAME_COMPRESS_PARAM_S *pstCompressParam); 1131bd4fe43Sopenharmony_ciHI_S32 HI_MPI_SYS_GetRawFrameCompressParam(RAW_FRAME_COMPRESS_PARAM_S *pstCompressParam); 1141bd4fe43Sopenharmony_ci 1151bd4fe43Sopenharmony_ciHI_S32 HI_MPI_LOG_SetWaitFlag(HI_BOOL bWait); 1161bd4fe43Sopenharmony_ci 1171bd4fe43Sopenharmony_ciHI_S32 HI_MPI_LOG_Read(HI_CHAR *pBuf, HI_U32 u32Size); 1181bd4fe43Sopenharmony_ci 1191bd4fe43Sopenharmony_ciHI_VOID HI_MPI_LOG_Close(HI_VOID); 1201bd4fe43Sopenharmony_ci 1211bd4fe43Sopenharmony_ci#ifdef __cplusplus 1221bd4fe43Sopenharmony_ci} 1231bd4fe43Sopenharmony_ci#endif /* End of #ifdef __cplusplus */ 1241bd4fe43Sopenharmony_ci 1251bd4fe43Sopenharmony_ci#endif /* __MPI_SYS_H__ */ 126