3.3. API Reference

The MMF system control implements various functions, including system initialization, system binding and unbinding, video block pool initialization, video block pool creation, obtaining the MMF version number, and obtaining the ID of the current processor.

The function module provides the following APIs:

3.3.1. CVI_MSG_Init

【Description】

Initialize the dual-core information communication, only dual OS SDK supports.

【Syntax】

CVI_S32 CVI_MSG_Init(CVI_VOID);

【Parameter】

None.

【Return Value】

Return Value

Description

0

Success.

Non 0

Failure. For details, please refer to Error Codes.

【Requirement】

  • Header files: cvi_msg_client.h

  • Library files: libmsg.a

【Note】

  • In a dual system, the first call to this API.

  • Cannot be called multiple times.

【Example】

None.

【Related Topic】

3.3.2. CVI_MSG_Deinit

【Description】

Deinitialize the dual-core information communication, only dual OS SDK supports.

【Syntax】

CVI_S32 CVI_MSG_Deinit(CVI_VOID);

【Parameter】

None.

【Return Value】

Return Value

Description

0

Success.

Non 0

Failure. For details, please refer to Error Codes.

【Requirement】

  • Header files: cvi_msg_client.h

  • Library files: libmsg.a

【Note】

  • In a dual system, the last call to this API.

【Example】

None.

【Related Topic】

3.3.3. CVI_SYS_Init

【Description】

Initializing the system, including modules such as video Input/Output, video encoding/decoding, video overlay regions, video processing, audio Input/Output, etc.

【Syntax】

CVI_S32 CVI_SYS_Init(CVI_VOID);

【Parameter】

None.

【Return Value】

Return Value

Description

0

Success.

Non 0

Failure. For details, please refer to Error Codes.

【Requirement】

  • Header files: cvi_sys.h, cvi_comm_sys.h

  • Library files: libsys.a

【Note】

  • Since the normal operation of MMF system depends on the buffer pool, it is necessary to call CVI_VB_Init to initialize the buffer pool first, and then initialize the MMF system, otherwise the function will run abnormally.

  • If the initialization is repeated before it is called for initialization, Success is still returned. In fact, the system has no impact on the running status of the MMF..

【Example】

 CVI_S32 s32Ret = CVI_FAILURE;

CVI_SYS_Exit();
CVI_VB_Exit();

if (pstVbConfig == NULL) {
  SAMPLE_PRT("input parameter is null, it is invaild!\n");
  return CVI_FAILURE;
}

s32Ret = CVI_VB_SetConfig(pstVbConfig);

if (s32Ret != CVI_SUCCESS) {
  SAMPLE_PRT("CVI_VB_SetConf failed!\n");
  return CVI_FAILURE;
}

s32Ret = CVI_VB_Init();

if (s32Ret != CVI_SUCCESS) {
  SAMPLE_PRT("CVI_VB_Init failed!\n");
  return CVI_FAILURE;
}

s32Ret = CVI_SYS_Init();

if (s32Ret != CVI_SUCCESS) {
  SAMPLE_PRT("CVI_SYS_Init failed!\n");
  CVI_VB_Exit();
  return CVI_FAILURE;
}

【Related Topic】

3.3.4. CVI_SYS_Exit

【Description】

De-initialize the system. Functions modules including video input and output, video codec, video overlay area, video processing, audio input and output will be destroyed or disabled.

【Syntax】

CVI_S32 CVI_SYS_Exit(CVI_VOID);

【Parameter】

None.

【Return Value】

Return Value

Description

0

Success.

Non 0

Failure. For details, please refer to Error Codes.

【Requirement】

  • Header files: cvi_sys.h, cvi_comm_sys.h

  • Library files: libsys.a

【Note】

During de-initialization, if there is a user process blocking MMF, de-initialization will fail. If all calls blocked on MMF return, the de-initialization is successful.

【Example】

Please refer to the example of CVI_SYS_Init.

【Related Topic】

3.3.5. CVI_SYS_Bind

【Description】

Binding the data source to the data receiver.

【Syntax】

CVI_S32 CVI_SYS_Bind(const MMF_CHN_S *pstSrcChn, const MMF_CHN_S *pstDestChn);

【Parameter】

Parameter

Description

Input/Output

pstSrcChn

Source channel pointer

Input

pstDestChn

Destination channel pointer

Input

【Return Value】

Return Value

Description

0

Success.

Non 0

Failure. For details, please refer to Error Codes.

【Requirement】

  • Header files: cvi_sys.h, cvi_comm_sys.h

  • Library files: libsys.a

【Note】

  • Please refer to table 3-2 for the binding relationships currently supported by the system.

  • Only one data source can be bound to the same data receiver.

  • Binding refers to the association between data source and data receiver. After binding, the data generated by the data source will be automatically sent to the receiver.

  • VI and VDEC, as data sources, send data to other modules through channels. The user sets the device number to 0, and the SDK does not check the input device number.

  • When VPSS serves as the data receiver, the device (GROUP) serves as the receiver to receive data from other modules. The user sets the channel ID to 0

  • In other cases, device number and channel number should be specified.

【Example】

None.

【Related Topic】

3.3.6. CVI_SYS_UnBind

【Description】

Data source to data receiver unbinding interface.

【Syntax】

CVI_S32 CVI_SYS_UnBind(const MMF_CHN_S *pstSrcChn, const MMF_CHN_S *pstDestChn);

【Parameter】

Parameter

Description

Input/Output

pstSrcChn

Source channel pointer

Input

pstDestChn

Destination channel pointer

Input

【Return Value】

Return Value

Description

0

Success.

Non 0

Failure. For details, please refer to Error Codes.

【Requirement】

  • Header files: cvi_sys.h, cvi_comm_sys.h

  • Library files: libsys.a

【Note】

pstDestChn will directly return Success if the source channel cannot be found. If the bound source channel is found, but the bound source channel does not match the pstSrcChn, a failure is returned.

【Example】

None.

【Related Topic】

3.3.7. CVI_SYS_GetBindbyDest

【Description】

Get the bound data source based on the data receiver.

【Syntax】

CVI_S32 CVI_SYS_GetBindbyDest(const MMF_CHN_S *pstDestChn, MMF_CHN_S *pstSrcChn);

【Parameter】

Parameter

Description

Input/Output

pstDestChn

Destination channel pointer

Input

pstSrcChn

Source channel pointer

Output

【Return Value】

Return Value

Description

0

Success.

Non 0

Failure. For details, please refer to Error Codes.

【Requirement】

  • Header files: cvi_sys.h, cvi_comm_sys.h

  • Library files: libsys.a

【Note】

None.

【Example】

None.

【Related Topic】

3.3.8. CVI_SYS_GetBindbySrc

【Description】

Get the bound data receiver based on the data source.

【Syntax】

CVI_S32 CVI_SYS_GetBindbySrc(const MMF_CHN_S *pstSrcChn, MMF_BIND_DEST_S *pstBindDest);

【Parameter】

Parameter

Description

Input/Output

pstSrcChn

Source channel pointer

Input

pstBindDest

Bound destination channel pointer

Output

【Return Value】

Return Value

Description

0

Success.

Non 0

Failure. For details, please refer to Error Codes.

【Requirement】

  • Header files: cvi_sys.h, cvi_comm_sys.h

  • Library files: libsys.a

【Note】

None.

【Example】

None.

【Related Topic】

3.3.9. CVI_SYS_GetVersion

【Description】

Get the version number of the current MMF software.

【Syntax】

CVI_S32 CVI_SYS_Get Version(MMF_VERSION_S *pstVersion);

【Parameter】

Parameter

Description

Input/Output

pstVersion

Version number of MMF software

Output

【Return Value】

Return Value

Description

0

Success.

Non 0

Failure. For details, please refer to Error Codes.

【Requirement】

  • Header files: cvi_sys.h, cvi_comm_sys.h

  • Library files: libsys.a

【Note】

None.

【Example】

None.

【Related Topic】

None.

3.3.10. CVI_SYS_GetChipId

【Description】

Get the ID of the current processor.

【Syntax】

CVI_S32 CVI_SYS_GetChipId(CVI_U32 *pu32ChipId);

【Parameter】

Parameter

Description

Input/Output

pu32ChipId

Pointer to the processor ID

Output

【Return Value】

Return Value

Description

0

Success.

Non 0

Failure. For details, please refer to Error Codes.

【Requirement】

  • Header files: cvi_sys.h, cvi_comm_sys.h

  • Library files: libsys.a

【Note】

None.

【Example】

CVI_U32 u32ChipId;
CVI_SYS_GetChipId(&u32ChipId);
if (u32ChipId == CVI181x)
...

【Related Topic】

None.

3.3.11. CVI_SYS_Mmap

【Description】

Memory mapping interface.

【Syntax】

void *CVI_SYS_Mmap(CVI_U64 u64PhyAddr, CVI_U32 u32Size);

【Parameter】

Parameter

Description

Input/Output

u64PhyAddr

Starting address of the memory unit to be mapped.

Input

u32Size

Number of bytes to be mapped

Input

【Return Value】

Return Value

Description

Non 0

Success.

0

Failure.

【Requirement】

  • Header files: cvi_sys.h, cvi_comm_sys.h

  • Library files: libsys.a

【Note】

  • The entered address must be a valid physical address.

  • u32Size cannot be 0

【Example】

None.

【Related Topic】

3.3.12. CVI_SYS_MmapCache

【Description】

Memory mapping interface.

【Syntax】

void *CVI_SYS_MmapCache(CVI_U64 u64PhyAddr, CVI_U32 u32Size);

【Parameter】

Parameter

Description

Input/Output

u64PhyAddr

Starting address of the memory unit to be mapped.

Input

u32Size

Number of bytes to be mapped

Input

【Return Value】

Return Value

Description

Non 0

Success.

0

Failure. For details, please refer to Error Codes.

【Requirement】

  • Header files: cvi_sys.h, cvi_comm_sys.h

  • Library files: libsys.a

【Note】

  • The entered address must be a valid physical address.

  • u32Size cannot be 0

  • If the virtual address obtained through this API is shared with HW DMA, user needs to call invalidate before the processor accesses it; If you want HW DMA to read after processor modification, you need to invalidate.

  • This API can only be used to map allocated Cached memory addresses. For example, if the enRemapMode attribute in VB_POOL_CONFIG_S of a certain vb pool is VB_REMAP_MODE_NONE, even if obtained Virtual addresses through this API, it cannot achieve the performance improvement brought by Cached memory when reading or writing to memory blocks.

【Example】

None.

【Related Topic】

3.3.13. CVI_SYS_Munmap

【Description】

Memory Remap Interface

【Syntax】

CVI_S32 CVI_SYS_ Munmap(CVI_VOID *pVirAddr, CVI_U32 u32Size);

【Parameter】

Parameter

Description

Input/Output

pVirAddr

The address returned after mmap

Input

u32Size

Number of bytes to be mapped

Input

【Return Value】

Return Value

Description

0

Success.

Non 0

Failure. For details, please refer to Error Codes.

【Requirement】

  • Header files: cvi_sys.h, cvi_comm_sys.h

  • Library files: libsys.a

【Note】

None.

【Example】

None.

【Related Topic】

3.3.14. CVI_SYS_IonAlloc

【Description】

The user allocates ION memory.

【Syntax】

CVI_S32 CVI_SYS_IonAlloc(CVI_U64 *pu64PhyAddr, CVI_VOID **ppVirAddr, CVI_U32 u32Len);

【Parameter】

Parameter

Description

Input/Output

pu64PhyAddr

Physical address pointer.

Output

ppVirAddr

Pointer to the virtual address. If it is NULL, no mapping will be done.

Output

u32Len

Size.

Input

【Return Value】

Return Value

Description

0

Success.

Non 0

Failure. For details, please refer to Error Codes.

【Requirement】

  • Header files: cvi_sys.h, cvi_comm_sys.h

  • Library files: libsys.a

【Note】

None.

【Example】

  • The memory allocated through this API needs to obtain its virtual address through CVI_SYS_Mmap.

【Related Topic】

3.3.15. CVI_SYS_IonAlloc_Cached

【Description】

The user allocated ION memory will be cacheable.

【Syntax】

CVI_S32 CVI_SYS_IonAlloc_Cached(CVI_U64 *pu64PhyAddr, CVI_VOID **ppVirAddr, CVI_U32 u32Len);

【Parameter】

Parameter

Description

Input/Output

pu64PhyAddr

Physical address pointer.

Output

ppVirAddr

Pointer to the virtual address pointer. If it is NULL, no mapping will be done.

Output

u32Len

Size.

Input

【Return Value】

Return Value

Description

0

Success.

Non 0

Failure. For details, please refer to Error Codes.

【Requirement】

  • Header files: cvi_sys.h, cvi_comm_sys.h

  • Library files: libsys.a

【Note】

  • If the virtual address obtained through this API is shared with HW DMA, user needs to call invalidate before the processor accesses it; If you want HW DMA to read after the processor modification, you need to invalidate.

  • The memory allocated through this API needs to obtain its virtual address through CVI_SYS_MmapCache.

【Example】

None.

【Related Topic】

3.3.16. CVI_SYS_IonFlushCache

【Description】

Flush the content in the cache to memory and invalidate the content in the cache.

【Sytax】

CVI_S32 CVI_SYS_IonFlushCache(CVI_U64 u64PhyAddr, CVI_VOID *pVirAddr, CVI_U32 u32Len);

【Parameter】

Parameter

Description

Input/Output

pu64PhyAddr

Physical address pointer.

Input

pVirAddr

Virtual address pointer.

Input

u32Len

Size.

Input

【Return Value】

Return Value

Description

0

Success.

Non 0

Failure. For details, please refer to Error Codes.

【Requirement】

  • Header files: cvi_sys.h, cvi_comm_sys.h

  • Library files: libsys.a

【Note】

This interface should be used with CVI_SYS_IonAlloc_Cached interface.

【Example】

None.

【Related Topic】

3.3.17. CVI_SYS_IonInvalidateCache

【Description】

To invalidate the contents in the cache.

【Syntax】

CVI_S32 CVI_SYS_IonInvalidateCache(CVI_U64 u64PhyAddr, CVI_VOID *pVirAddr, CVI_U32 u32Len);

【Parameter】

Parameter

Description

Input/Output

pu64PhyAddr

Physical address pointer.

Input

pVirAddr

Virtual address pointer.

Input

u32Len

Size.

Input

【Return Value】

Return Value

Description

0

Success.

Non 0

Failure. For details, please refer to Error Codes.

【Requirement】

  • Header files: cvi_sys.h, cvi_comm_sys.h

  • Library files: libsys.a

【Note】

This interface should be used with CVI_SYS_IonAlloc_Cached interface.

【Example】

None.

【Related Topic】

3.3.18. CVI_SYS_IonFree

【Description】

The user releases the ION memory.

【Syntax】

CVI_S32 CVI_SYS_IonFree(CVI_U64 u64PhyAddr, CVI_VOID *pVirAddr);

【Parameter】

Parameter

Description

Input/Output

u64PhyAddr

Physical address pointer.

Input

pVirAddr

Virtual address pointer.

Input

【Return Value】

Return Value

Description

0

Success.

Non 0

Failure. For details, please refer to Error Codes.

【Requirement】

  • Header files: cvi_sys.h, cvi_comm_sys.h

  • Library files: libsys.a

【Note】

None.

【Example】

None.

【Related Topic】

3.3.19. CVI_SYS_SetVIVPSSMode

【Description】

Configure VI & VPSS Operation Mode

【Syntax】

CVI_S32 CVI_SYS_SetVIVPSSMode(const VI_VPSS_MODE_S *pstVIVPSSMode);

【Parameter】

Parameter

Description

Input/Output

pstVIVPSSMode

Working mode of VI and VPSS

Input

【Return Value】

Return Value

Description

0

Success.

Non 0

Failure. For details, please refer to Error Codes.

【Requirement】

  • Header files: cvi_sys.h, cvi_comm_sys.h

  • Library files: libsys.a

【Note】

Must be configured after CVI_SYS_Init and before all VI pipes and VPSS groups are created.

【Example】

None.

【Related Topic】

3.3.20. CVI_SYS_GetVIVPSSMode

【Description】

Get the working mode of VI and VPSS.

【Syntax】

CVI_S32 CVI_SYS_GetVIVPSSMode(VI_VPSS_MODE_S *pstVIVPSSMode);

【Parameter】

Parameter

Description

Input/Output

pstVIVPSSMode

Working mode of VI and VPSS

Output

【Return Value】

Return Value

Description

0

Success.

Non 0

Failure. For details, please refer to Error Codes.

【Requirement】

  • Header files: cvi_sys.h, cvi_comm_sys.h

  • Library files: libsys.a

【Note】

None.

【Example】

None.

【Related Topic】

3.3.21. CVI_SYS_SetVPSSMode

【Description】

Set the working mode of VPSS.

【Syntax】

CVI_S32 CVI_SYS_SetVPSSMode(VPSS_MODE_E enVPSSMode);

【Parameter】

Parameter

Description

Input/Output

enVPSSMode

VPSS working mode

Input

【Return Value】

Return Value

Description

0

Success.

Non 0

Failure. For details, please refer to Error Codes.

【Requirement】

  • Header files: cvi_sys.h, cvi_comm_sys.h

  • Library files: libsys.a

【Note】

Must be set after CVI_SYS_Init and before all VPSS groups are created.

The default setting is VPSS_MODE_SINGLE.

【Example】

None.

【Related Topic】

3.3.22. CVI_SYS_GetVPSSMode

【Description】

Get the working mode of VPSS.

【Syntax】

VPSS_MODE_E CVI_SYS_GetVPSSMode(CVI_VOID);

【Parameter】

None.

【Return Value】

Return Value

Description

VPSS_MODE_E

Current working mode of VPSS

【Requirement】

  • Header files: cvi_sys.h, cvi_comm_sys.h

  • Library files: libsys.a

【Note】

None.

【Example】

None.

【Related Topic】

3.3.23. CVI_SYS_GetModName

【Description】

Get the corresponding string handle for MOD_ID.

【Syntax】

const CVI_CHAR *CVI_SYS_GetModName(MOD_ID_E id);

【Parameter】

Parameter

Description

Input/Output

id

MOD_ID_E

Input

【Return Value】

Return Value

Description

const CVI_CHAR *

String handle of MOD_ID

NULL

Failure.

【Requirement】

  • Header files: cvi_sys.h, cvi_comm_sys.h

  • Library files: libsys.a

【Note】

None.

【Example】

None.

【Related Topic】

None.

3.3.24. CVI_VB_SetConfig

【Description】

Set properties of MMF video block pool.

【Syntax】

CVI_S32 CVI_VB_SetConfig(const VB_CONFIG_S *pstVbConfig);

【Parameter】

Parameter

Description

Input/Output

pstVbConfig

Pointer to video block pool attributes.

Input

【Return Value】

Return Value

Description

0

Success.

Non 0

Failure. For details, please refer to Error Codes.

【Requirement】

  • Header files: cvi_sys.h, cvi_comm_sys.h

  • Library files: libsys.a

【Note】

  • You can set block pool properties only when the system is in the uninitialized state. Otherwise a failure will be returned.

  • Video buffer configuration varies according to different application scenarios. For details about the configuration rules, please see 2.2.1 Video Block Pool.

  • The size of each block in the public block pool varies according to the current image pixel format and whether the image is compressed or not. Please refer to VB_CONFIG_S structure for specific allocation size.

【Example】

Refer to example of CVI_SYS_Init.

【Related Topic】

3.3.25. CVI_VB_GetConfig

【Description】

Get properties of MMF video block pool.

【Syntax】

CVI_S32 CVI_VB_GetConfig(VB_CONFIG_S *pstVbConfig);

【Parameter】

Parameter

Description

Input/Output

pstVbConfig

Pointer to the video block pool attributes.

Input

【Return Value】

Return Value

Description

0

Success.

Non 0

Failure. For details, please refer to Error Codes.

【Requirement】

  • Header files: cvi_sys.h, cvi_comm_sys.h

  • Libray files: libsys.a

【Note】

You must first call CVI_VB_SetConfig to set the MMF video block pool properties.

【Example】

None.

【Related Topic】

3.3.26. CVI_VB_Init

【Description】

Initialize the MMF video block pool.

【Syntax】

CVI_S32 CVI_VB_Init(CVI_VOID);

【Parameter】

None.

【Return Value】

Return Value

Description

0

Success.

Non 0

Failure. For details, please refer to Error Codes.

【Requirement】

  • Header files: cvi_sys.h, cvi_comm_sys.h

  • Library files: libsys.a

【Note】

  • You must call CVI_VB_SetConfig to configure the block pool properties before initialization, otherwise the initialization will fail.

  • If the initialization is repeated, Success is still returned, but the system has virtually no effect on the running state of the MMF.

【Example】

Refer to example of CVI_SYS_Init.

【Related Topic】

3.3.27. CVI_VB_Exit

【Description】

Deinitialize MMF video block pool.

【Syntax】

CVI_S32 CVI_VB_Exit(CVI_VOID);

【Parameter】

None.

【Return Value】

Return Value

Description

0

Success.

Non 0

Failure. For details, please refer to Error Codes.

【Requirement】

  • Header files: cvi_sys.h, cvi_comm_sys.h

  • Library files: libsys.a

【Note】

  • Must call CVI_SYS_Exit to deinitailize MMF system before de-initializing block pool. Otherwise the system will return failure.

  • The initialization can be repeated without returning a failure

【Example】

Refer to the example of CVI_SYS_Init

【Related Topic】

3.3.28. CVI_VB_GetBlock

【Description】

Get a video block.

【Syntax】

VB_BLK CVI_VB_GetBlock(VB_POOL Pool, CVI_U32 u32BlkSize);

【Parameter】

Parameter

Description

Input/Output

Pool

Block pool ID number. Value range: [0, VB_MAX_POOLS)。

Input

u32BlkSize

Block size. Value range: full range of data types, measured in bytes.

Input

【Return Value】

Return Value

Description

Non VB_INVALID_HANDLE

Valid block handle.

VB_INVALID_HANDLE

Obtainment failed.

【Requirement】

  • Header files: cvi_sys.h, cvi_comm_sys.h

  • Library files: libsys.a

【Note】

  • After creating a block pool, users can call this interface to obtain blocks from the block pool; the second parameter u32BlkSize must be less than or equal to the block size specified when creating the block pool.

  • When the first parameter Pool is set to invalid ID number VB_INVALID_POOLID, a block of specified size will be obtained from any common block pool;

    Otherwise, a block of specified size will be obtained from the specified pool.

    If the specified size does not match, no block will be obtained.

  • The common block pool is mainly used to store the captured images of VPU(VI/VPSS/VO/GDC).

    Because it is shared by multiple modules, improper operation of the common block pool (such as occupying too many blocks) will affect the normal

    operation of the whole MMF system.

【Example】

None.

【Related Topic】

3.3.29. CVI_VB_ReleaseBlock

【Description】

Release a captured video block.

【Syntax】

CVI_S32 CVI_VB_ReleaseBlock(VB_BLK Block);

【Parameter】

Parameter

Description

Input/Output

Block

Block handle

Input

【Return Value】

Return Value

Description

0

Success.

Non 0

Failure. For details, please refer to Error Codes.

【Requirement】

  • Header files: cvi_sys.h, cvi_comm_sys.h

  • Library files: libsys.a

【Note】

This interface should be called to release blocks after the obtained blocks are used.

【Example】

None.

【Related Topic】

3.3.30. CVI_VB_CreatePool

【Description】

Get a video block.

【Syntax】

VB_POOL CVI_VB_CreatePool(VB_POOL_CONFIG_S *pstVbPoolCfg);

【Parameter】

Parameter

Description

Input/Output

pstVbPoolCfg

Block pool configuration attribute parameter pointer.

input

【Return Value】

Return Value

Description

Non VB_INVALID_HANDLE

Valid block pool ID.

VB_INVALID_HANDLE

Failure. For details, please refer to Error Codes.

【Requirement】

  • Header files: cvi_sys.h, cvi_comm_sys.h

  • Library files: libsys.a

【Note】

None.

【Example】

None.

【Related Topic】

3.3.31. CVI_VB_DestroyPool

【Description】

Release a captured video block.

【Syntax】

CVI_S32 CVI_VB_DestroyPool(VB_POOL Pool);

【Parameter】

Parameter

Description

Input/Output

Pool

Block pool ID number. Value range: [0, VB_MAX_POOLS)。

Input

【Return Value】

Return Value

Description

0

Success.

Non 0

Failure. For details, please refer to Error Codes.

【Requirement】

  • Header files: cvi_sys.h, cvi_comm_sys.h

  • Library files: libsys.a

【Note】

  • To destroy a non-existent block pool, return CVI_ERR_VB_ILLEGAL_PARAM.

  • When the MMF block pool is deinitialized, all block pools are destroyed, including user-mode ones.

  • Before exiting the VB pool, ensure that no VB in the VB pool is occupied. Otherwise, you cannot exit.

  • [0, VB_MAX_POOLS) ID of block pools includes ID of public block pools, module public block pools, and module private block pools. Ensure that Pool is the ID of the block pool created by CVI_VB_CreatePool, otherwise a failure will be returned.

  • If the virtual address of the current block pool is mapped using the CVI_VB_MmapPool interface, the mapping must be removed using the CVI_VB_MunmapPool interface before the block pool is destroyed.

【Example】

None.

【Related Topic】

3.3.32. CVI_VB_PhysAddr2Handle

【Description】

Get a handle from an already acquired block physical address

【Syntax】

VB_BLK CVI_VB_PhysAddr2Handle(CVI_U64 u64PhyAddr);

【Parameter】

Parameter

Description

Input/Output

u64PhyAddr

Block physical address

Input

【Return Value】

Return Value

Description

Non VB_INVALID_HANDLE

Valid block handle.

VB_INVALID_HANDLE

Obtainment failed.

【Requirement】

  • Header files: cvi_sys.h, cvi_comm_sys.h

  • Library files: libsys.a

【Note】

The physical address should be the address of the valid block obtained from the MMF video block pool.

【Example】

None.

【Related Topic】

None.

3.3.33. CVI_VB_Handle2PhysAddr

【Description】

Get the physical address from an already acquired block handle

【Syntax】

CVI_U64 CVI_VB_Handle2PhysAddr(VB_BLK Block);

【Parameter】

Parameter

Description

Input/Output

Block

Block handle

Input

【Return Value】

Return Value

Description

Non 0

Valid physical address.

0

Invalid return value, illegal block handle.

【Requirement】

  • Header files: cvi_sys.h, cvi_comm_sys.h

  • Library files: libsys.a

【Note】

Blocks should be valid blocks obtained from the MMF video block pool.

【Example】

None.

【Related Topic】

None.

3.3.34. CVI_VB_Handle2PoolId

【Description】

Get the video block pool ID from an already acquired block handle.

【Syntax】

VB_POOL CVI_VB_Handle2PoolId(VB_BLK Block);

【Parameter】

Parameter

Description

Input/Output

Block

Block handle

Input

【Return Value】

Return Value

Description

Non VB_INVALID_POOLID

Valid video block pool ID.

VB_INVALID_POOLID

Invalid return value, illegal block handle.

【Requirement】

  • Header files: cvi_sys.h, cvi_comm_sys.h

  • Library files: libsys.a

【Note】

Blocks should be valid blocks obtained from the MMF video block pool.

【Example】

None.

【Related Topic】

None.

3.3.35. CVI_VB_InquireUserCnt

【Description】

Get the block usage count from an already acquired block handle.

【Syntax】

CVI_S32 CVI_VB_InquireUserCnt(VB_BLK Block);

【Parameter】

Parameter

Description

Input/Output

Block

Block handle

Input

【Return Value】

Return Value

Description

Nonnegative number

Use count.

Negative number

Invalid return value, illegal block handle.

【Requirement】

  • Header files: cvi_sys.h, cvi_comm_sys.h

  • Library files: libsys.a

【Note】

None.

【Example】

None.

【Related Topic】

None.

3.3.36. CVI_VB_MmapPool

【Description】

Mapping a user-space virtual address for a video block pool.

【Syntax】

CVI_S32 CVI_VB_MmapPool(VB_POOL Pool);

【Parameter】

Parameter

Description

Input/Output

Pool

Block pool ID number. Value range: [0, VB_MAX_POOLS)。

Input

【Return Value】

Return Value

Description

0

Success.

Non 0

Failure. For details, please refer to Error Codes.

【Requirement】

  • Header files: cvi_sys.h, cvi_comm_sys.h, cvi_debug.h

  • Library files: libsys.a

【Note】

  • You must enter a valid video block pool ID.

  • Repeated mappings are considered successful.

【Example】

None.

【Related Topic】

None.

3.3.37. CVI_VB_MunmapPool

【Description】

Unmapping a user-space mapping for a video block pool.

【Syntax】

CVI_S32 CVI_VB_MunmapPool(VB_POOL Pool);

【Parameter】

Parameter

Description

Input/Output

Pool

Block pool ID number. Value range: [0, VB_MAX_POOLS)。

Input

【Return Value】

Return Value

Description

0

Success.

Non 0

Failure. For details, please refer to Error Codes.

【Requirement】

  • Header files: cvi_sys.h, cvi_comm_sys.h, cvi_debug.h

  • Library files: libsys.a

【Note】

  • You must enter a valid video block pool ID.

  • The video block pool must be mapped. If it is not mapped, CVI_ERR_VB_NOTREADY is returned

  • The virtual address must be released before the block pool is destroyed.

【Example】

None.

【Related Topic】

None.

3.3.38. CVI_VB_GetBlockVirAddr

【Description】

Obtaining the user-space virtual address of a block in a video block pool.

【Syntax】

CVI_S32 CVI_VB_GetBlockVirAddr(VB_POOL Pool, VB_BLK Block, void **ppVirAddr);

【Parameter】

Parameter

Description

Input/Output

Pool

Block pool ID number. Value range: [0, VB_MAX_POOLS)。

Input

Block

Block handle

Input

ppVirAddr

User-space virtual address

Output

【Return Value】

Return Value

Description

0

Success.

Non 0

Failure. For details, please refer to Error Codes.

【Requirement】

  • Header files: cvi_sys.h, cvi_comm_sys.h, cvi_debug.h

  • Library files: libsys.a

【Note】

  • You must enter a valid video block pool ID and a valid block handle.

  • The video block pool must be mapped. If it is not mapped, CVI_ERR_VB_NOTREADY is returned

  • If the physical address is not in the current VB pool, CVI_ERR_VB_ILLEGAL_PARAM is returned.

【Example】

None.

【Related Topic】

None.

3.3.39. CVI_LOG_SetLevelConf

【Description】

Set the log level.

【Syntax】

CVI_S32 CVI_LOG_SetLevelConf(LOG_LEVEL_CONF_S *pstConf);

【Parameter】

Parameter

Description

Input/Output

pstConf

Log level information structure

Input

【Return Value】

Return Value

Description

0

Success.

Non 0

Failure. For details, please refer to Error Codes.

【Requirement】

  • Header files: cvi_sys.h, cvi_comm_sys.h, cvi_debug.h

  • Library files: libsys.a

【Note】

None.

【Example】

None.

【Related Topic】

3.3.40. CVI_LOG_GetLevelConf

【Description】

Get the log level.

【Syntax】

CVI_S32 CVI_LOG_GetLevelConf(LOG_LEVEL_CONF_S *pstConf);

【Parameter】

Parameter

Description

Input/Output

pstConf->enModId

Need to get the module ID of log level

Input

pstConf->s32Level

Get the log level

Output

【Return Value】

Return Value

Description

0

Success.

Non 0

Failure. For details, please refer to Error Codes.

【Requirement】

  • Header files: cvi_sys.h, cvi_comm_sys.h, cvi_debug

  • Library files: libsys.a

【Note】

None.

【Example】

None.

【Related Topic】