1/*
2 * Copyright (c) 2022 HiSilicon (Shanghai) Technologies CO., LIMITED.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16#ifndef __MPP_VB_HAL__
17#define __MPP_VB_HAL__
18
19#include "hi_type.h"
20#include "hi_comm_vb.h"
21
22#ifdef __cplusplus
23#if __cplusplus
24extern "C" {
25#endif
26#endif /* __cplusplus */
27
28#define HI_VBS_INVALID_BUF_HANDLE ((HI_U64)-1)
29
30typedef struct {
31    HI_S32 sharefd;
32    HI_U32 size;
33    HI_U64 phy;
34    HI_U64 handle;  /* buffer identification, must be unique in current process. invalid value is
35                       HI_VBS_INVALID_BUF_HANDLE */
36    HI_BOOL filled; /* if buffer is filled with data, or a empty buffer */
37} VBSBufferInfo;
38
39VB_POOL HI_VBS_CreateExtPool(HI_U64 blkSize, HI_U32 blkCnt);
40HI_S32 HI_VBS_DestroyPool(VB_POOL poolId);
41
42HI_S32 HI_VBS_AddBufToExtPool(VB_POOL poolId, VBSBufferInfo *bufInfo);
43HI_S32 HI_VBS_DeleteBufFromExtPool(VB_BLK blockId);
44
45HI_S32 HI_VBS_BufferToVB(VB_POOL poolId, HI_U64 bufHandle);
46HI_U64 HI_VBS_VBToBuffer(HI_S32 blockId);
47
48HI_S32 HI_VBS_ShowServerInfo(HI_VOID);
49
50#ifdef __cplusplus
51#if __cplusplus
52}
53#endif
54#endif /* __cplusplus */
55
56#endif
57