xref: /OK3568_Linux_fs/external/rockit/mpi/sdk/include/rk_mpi_sys.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /* GPL-2.0 WITH Linux-syscall-note OR Apache 2.0 */
2 /* Copyright (c) 2021 Fuzhou Rockchip Electronics Co., Ltd */
3 
4 #ifndef INCLUDE_RT_MPI_RK_MPI_SYS_H__
5 #define INCLUDE_RT_MPI_RK_MPI_SYS_H__
6 
7 #include "rk_type.h"
8 #include "rk_debug.h"
9 #include "rk_common.h"
10 #include "rk_comm_sys.h"
11 #include "rk_comm_mb.h"
12 
13 #ifdef __cplusplus
14 #if __cplusplus
15 extern "C" {
16 #endif
17 #endif /* End of #ifdef __cplusplus */
18 
19 RK_S32 RK_MPI_SYS_Init(RK_VOID);
20 RK_S32 RK_MPI_SYS_Exit(RK_VOID);
21 
22 RK_S32 RK_MPI_SYS_Bind(const MPP_CHN_S *pstSrcChn, const MPP_CHN_S *pstDestChn);
23 RK_S32 RK_MPI_SYS_UnBind(const MPP_CHN_S *pstSrcChn, const MPP_CHN_S *pstDestChn);
24 
25 RK_S32 RK_MPI_SYS_GetBindbyDest(const MPP_CHN_S *pstDestChn, MPP_CHN_S *pstSrcChn);
26 RK_S32 RK_MPI_SYS_GetBindbySrc(const MPP_CHN_S *pstSrcChn, MPP_BIND_DEST_S *pstBindDest);
27 
28 /* alloc mmz memory in user context                                         */
29 RK_S32 RK_MPI_SYS_MmzAlloc(MB_BLK *pBlk, const RK_CHAR *pstrMmb, const RK_CHAR *pstrZone, RK_U32 u32Len);
30 
31 /* alloc mmz memory with cache */
32 RK_S32 RK_MPI_SYS_MmzAlloc_Cached(MB_BLK *pBlk, const RK_CHAR *pstrMmb, const RK_CHAR *pstrZone, RK_U32 u32Len);
33 
34 /* alloc mmz memory with flags */
35 RK_S32 RK_MPI_SYS_MmzAllocEx(MB_BLK *pBlk, const RK_CHAR *pstrMmb, const RK_CHAR *pstrZone,
36                                 RK_U32 u32Len, RK_U32 u32HeapFlags);
37 
38 /* free mmz memory in user context                                          */
39 RK_S32 RK_MPI_SYS_MmzFree(MB_BLK blk);
40 
41 /* flush cache */
42 RK_S32 RK_MPI_SYS_MmzFlushCache(MB_BLK blk, RK_BOOL bReadOnly);
43 
44 RK_S32 RK_MPI_SYS_Malloc(MB_BLK *pBlk, RK_U32 u32Len);
45 RK_S32 RK_MPI_SYS_Free(MB_BLK blk);
46 
47 RK_S32 RK_MPI_SYS_CreateMB(MB_BLK *pBlk, MB_EXT_CONFIG_S *pstMbExtConfig);
48 
49 /*
50 ** u64Base is the global PTS of the system.
51 ** ADVICE:
52 ** 1. Better to call RK_MPI_SYS_GetCurPTS on the host board to get u64Base.
53 ** 2. When os start up, call RK_MPI_SYS_InitPTSBase to set the init PTS.
54 ** 3. When media bussines is running, synchronize the PTS one time per minute
55 **    by calling RK_MPI_SYS_SyncPTS.
56 */
57 RK_S32 RK_MPI_SYS_GetCurPTS(RK_U64 *pu64CurPTS);
58 RK_S32 RK_MPI_SYS_InitPTSBase(RK_U64 u64PTSBase);
59 RK_S32 RK_MPI_SYS_SyncPTS(RK_U64 u64PTSBase);
60 
61 /* set mpp channel input stream mode */
62 RK_S32 RK_MPI_SYS_SetChnInputMode(const MPP_CHN_S *pstChn, CHN_INPUT_MODE_E mode);
63 
64 /* log level configuration */
65 RK_S32 RK_MPI_LOG_SetLevelConf(LOG_LEVEL_CONF_S *pstConf);
66 RK_S32 RK_MPI_LOG_GetLevelConf(LOG_LEVEL_CONF_S *pstConf);
67 
68 #ifdef __cplusplus
69 #if __cplusplus
70 }
71 #endif
72 #endif /* End of #ifdef __cplusplus */
73 
74 #endif /* INCLUDE_RT_MPI_RK_MPI_SYS_H__ */
75 
76