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:
CVI_MSG_Init: Initialize the dual-core information communication.
CVI_MSG_Deinit: Deinitialize the dual-core information communication.
CVI_SYS_Init: Initialize the MMF system.
CVI_SYS_IsInited: To check is SYS initialized.
CVI_SYS_Exit : Deinitialize the MMF system.
CVI_SYS_VI_Open : Open vi device.
CVI_SYS_VI_Close : Close vi device.
CVI_SYS_Bind: Binding the data source to the data receiver.
CVI_SYS_UnBind: Debinding data source to data receiver.
CVI_SYS_GetBindbyDest: Get the bound data source according to the data receiver.
CVI_SYS_GetBindbySrc: Get the bound data receiver according to the data source.
CVI_SYS_GetVersion: Obtain the version number of the current MMF software.
CVI_SYS_GetChipId: Obtain the ID of the current processor.
CVI_SYS_Mmap: Memory mapping interface.
CVI_SYS_MmapCache: Memory mapping interface.
CVI_SYS_Munmap: Memory Remap Interface.
CVI_SYS_IonAlloc: User Allocated ION memory.
CVI_SYS_IonAlloc_Cached: The user allocated ION memory will be cacheable.
CVI_SYS_IonFlushCache : Flush the contents of the cache to memory and invalidate the contents of the cache.
CVI_SYS_IonInvalidateCache : Invalidate the contents of the cache.
CVI_SYS_IonFree: User releasing ION memory.
CVI_SYS_IonGetFd: Get ion file descriptor.
CVI_SYS_TDMACopy: memory copy by TPU.
CVI_SYS_TDMACopy2D: 2D memory copy by TPU.
CVI_SYS_SetVIVPSSMode: Set the working mode of VI and VPSS.
CVI_SYS_GetVIVPSSMode: Obtain the working mode of VI and VPSS.
CVI_SYS_SetVPSSMode: Set the working mode of VPSS.
CVI_SYS_GetVPSSMode: Obtain the working mode of VPSS.
CVI_SYS_SetVPSSModeEx: Set the extension working mode of VPSS.
CVI_SYS_GetVPSSModeEx: Obtain the extension working mode of VPSS.
CVI_SYS_GetModName: Obtain the corresponding string handle for MOD_ID.
CVI_SYS_GetChipVersion: Obtain the processor version.
CVI_SYS_GetPowerOnReason: Obtain the reason for the processor power-on.
CVI_SYS_GetCurPTS: Obtain the current timestamp.
CVI_SYS_TraceBegin: Start trace debugging.
CVI_SYS_TraceEnd: End trace debugging.
CVI_SYS_TraceCounter: Record counter values during debugging.
CVI_SYS_RegisterThermalCallback: Register thermal callback.
CVI_SYS_StartThermalThread: Start monitoring system temperature.
CVI_SYS_StopThermalThread: Stop monitoring system temperature.
CVI_VB_SetConfig: Set MMF video block pool properties.
CVI_VB_GetConfig: Obtaining properties of MMF video block pool.
CVI_VB_Init: Initialize the MMF video block pool.
CVI_VB_IsInited: To check is VB initialized.
CVI_VB_Exit: Deinitialize the MMF video block pool.
CVI_VB_GetBlock: Acquire a video block.
CVI_VB_ReleaseBlock: Release a captured video block.
CVI_VB_CreatePool: Creating VB pool dynamically.
CVI_VB_CreateExPool: Creating external VB pool dynamically.
CVI_VB_DestroyPool: Destroy VB pool.
CVI_VB_PhysAddr2Handle: Obtaining the handle of a block by its physical address.
CVI_VB_Handle2PhysAddr: Obtain the physical address of a block.
CVI_VB_Handle2PoolId: Obtain the ID of the block pool where a block resides.
CVI_VB_InquireUserCnt: Query block usage count.
CVI_VB_MmapPool: Mmap the whole pool to get virtual-address.
CVI_VB_MunmapPool: Unmap the whole pool.
CVI_VB_PrintPool: Print pool usage information.
CVI_LOG_SetLevelConf:: Set log level.
CVI_LOG_GetLevelConf: Obtain the log level.
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.
In the multi-process scenario, it needs to be called once per process.
【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_IsInited¶
【Description】
To check is SYS initialized. dual OS SDK doesn’t support.
【Syntax】
CVI_S32 CVI_SYS_Init(CVI_VOID);
【Parameter】
None.
【Return Value】
Return Value |
Description |
---|---|
0 |
Success. Return CVI_TRUE if initialized. |
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.5. 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.6. CVI_SYS_VI_Open¶
【Description】
Open vi device. dual OS SDK doesn’t support.
【Syntax】
CVI_S32 CVI_SYS_VI_Open(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】
None.
【Example】
None.
【Related Topic】
3.3.7. CVI_SYS_VI_Close¶
【Description】
Close vi device. dual OS SDK doesn’t support.
【Syntax】
CVI_S32 CVI_SYS_VI_Close(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】
None.
【Example】
None.
【Related Topic】
3.3.8. 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.9. 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.10. 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.11. 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.12. 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.13. 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.14. 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.15. 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 flush.
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.16. 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.17. CVI_SYS_IonAlloc¶
【Description】
The user allocates ION memory.
【Syntax】
CVI_S32 CVI_SYS_IonAlloc(CVI_U64 *pu64PhyAddr, CVI_VOID **ppVirAddr, const CVI_CHAR *strName, 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 |
strName |
allocated ION memory name. |
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】
None.
【Example】
The memory allocated through this API needs to obtain its virtual address through CVI_SYS_Mmap.
【Related Topic】
3.3.18. 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, const CVI_CHAR *strName, 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 |
strName |
allocated ION memory name. |
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】
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 flush.
The memory allocated through this API needs to obtain its virtual address through CVI_SYS_MmapCache.
【Example】
None.
【Related Topic】
3.3.19. 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.20. 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.21. 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.22. CVI_SYS_IonGetFd¶
【Description】
Get ion file descriptor. dual OS SDK doesn’t support.
【Syntax】
CVI_S32 CVI_SYS_IonGetFd(CVI_VOID);
【Parameter】
None.
【Return Value】
Return Value |
Description |
---|---|
Non -1 |
file descriptor. |
-1 |
Failure. |
【Requirement】
Header files: cvi_sys.h, cvi_comm_sys.h
Library files: libsys.a
【Note】
None.
【Example】
None.
【Related Topic】
None.
3.3.23. CVI_SYS_TDMACopy¶
【Description】
Memory copy by TPU.
【Syntax】
CVI_S32 CVI_SYS_TDMACopy(CVI_U64 u64PhyDst, CVI_U64 u64PhySrc, CVI_U32 u32Len);
【Parameter】
Parameter |
Description |
Input/Output |
---|---|---|
u64PhyDst |
Destination physical address |
Input |
u64PhySrc |
Source physical address |
Input |
u32Len |
Length |
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.24. CVI_SYS_TDMACopy2D¶
【Description】
2D memory copy by TPU.
【Syntax】
CVI_S32 CVI_SYS_TDMACopy2D(CVI_TDMA_2D_S *param);
【Parameter】
Parameter |
Description |
Input/Output |
---|---|---|
param |
2D memory |
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.25. 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.26. 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.27. 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.28. 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.29. CVI_SYS_SetVPSSModeEx¶
【Description】
Set the extension working mode of VPSS.
【Syntax】
CVI_S32 CVI_SYS_SetVPSSModeEx(const VPSS_MODE_S *pstVPSSMode);
【Parameter】
Parameter |
Description |
Input/Output |
---|---|---|
pstVPSSMode |
VPSS extension 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.30. CVI_SYS_GetVPSSModeEx¶
【Description】
Get the extension working mode of VPSS.
【Syntax】
CVI_S32 CVI_SYS_GetVPSSModeEx(VPSS_MODE_S *pstVPSSMode);
【Parameter】
Parameter |
Description |
Input/Output |
---|---|---|
pstVPSSMode |
VPSS extension working mode |
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.31. 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.32. CVI_SYS_GetChipVersion¶
【Description】
Get processor version.
【Syntax】
CVI_S32 CVI_SYS_GetChipVersion(CVI_U32 *pu32ChipVersion);
【Parameter】
Parameter |
Description |
Input/Output |
---|---|---|
pu32ChipVersion |
Processor version |
Output |
【Return Value】
Return Value |
Description |
---|---|
0 |
Success. |
Non 0 |
Failure. For details, please refer to Error Codes. |
【Requirement】
Header files: cvi_sys.h
Library files: libsys.a
【Note】
None.
【Example】
None.
【Related Topic】
3.3.33. CVI_SYS_GetPowerOnReason¶
【Description】
Get power on reason.
【Syntax】
CVI_S32 CVI_SYS_GetPowerOnReason(CVI_U32 *pu32PowerOnReason);
【Parameter】
Parameter |
Description |
Input/Output |
---|---|---|
pu32PowerOnReason |
power on reason |
Output |
【Return Value】
Return Value |
Description |
---|---|
0 |
Success. |
Non 0 |
Failure. For details, please refer to Error Codes. |
【Requirement】
Header files: cvi_sys.h
Library files: libsys.a
【Note】
None.
【Example】
None.
【Related Topic】
None.
3.3.34. CVI_SYS_GetCurPTS¶
【Description】
Get current timestamp.
【Syntax】
CVI_S32 CVI_SYS_GetCurPTS(CVI_U64 *pu64CurPTS);
【Parameter】
Parameter |
Description |
Input/Output |
---|---|---|
pu64CurPTS |
current timestamp |
Output |
【Return Value】
Return Value |
Description |
---|---|
0 |
Success. |
Non 0 |
Failure. For details, please refer to Error Codes. |
【Requirement】
Header files: cvi_sys.h
Library files: libsys.a
【Note】
None.
【Example】
None.
【Related Topic】
None.
3.3.35. CVI_SYS_TraceBegin¶
【Description】
Start trace debugging.
【Syntax】
void CVI_SYS_TraceBegin(const char *name);
【Parameter】
Parameter |
Description |
Input/Output |
---|---|---|
pu32ChipVersion |
Trace debugging flag name |
Input |
【Return Value】
None.
【Requirement】
Header files: cvi_sys.h
Library files: libsys.a
【Note】
None.
【Example】
None.
【Related Topic】
3.3.36. CVI_SYS_TraceEnd¶
【Description】
End trace debugging.
【Syntax】
void CVI_SYS_TraceEnd(void);
【Parameter】
None.
【Return Value】
None.
【Requirement】
Header files: cvi_sys.h
Library files: libsys.a
【Note】
None.
【Example】
None.
【Related Topic】
3.3.37. CVI_SYS_TraceCounter¶
【Description】
Record counter values during debugging.
【Syntax】
void CVI_SYS_TraceCounter(const char *name, signed int value);
【Parameter】
Parameter |
Description |
Input/Output |
---|---|---|
name |
Trace debugging flag name |
Input |
value |
Counter value |
Input |
【Return Value】
None.
【Requirement】
Header files: cvi_sys.h
Library files: libsys.a
【Note】
None.
【Example】
None.
【Related Topic】
3.3.38. CVI_SYS_RegisterThermalCallback¶
【Description】
Register thermal callback.
【Syntax】
void CVI_SYS_RegisterThermalCallback(void (*setFPS)(int));
【Parameter】
Parameter |
Description |
Input/Output |
---|---|---|
setFPS |
Thermal Callback |
Input |
【Return Value】
None.
【Requirement】
Header files: cvi_sys.h
Library files: libsys.a
【Note】
None.
【Example】
None.
【Related Topic】
None.
3.3.39. CVI_SYS_StartThermalThread¶
【Description】
Start monitoring system temperature. dual OS SDK doesn’t support.
【Syntax】
CVI_S32 CVI_SYS_StartThermalThread(void);
【Parameter】
None.
【Return Value】
Return Value |
Description |
---|---|
0 |
Success. |
Non 0 |
Failure. |
【Requirement】
Header files: cvi_sys.h
Library files: libsys.a
【Note】
None.
【Example】
None.
【Related Topic】
3.3.40. CVI_SYS_StopThermalThread¶
【Description】
Stop monitoring system temperature. dual OS SDK doesn’t support.
【Syntax】
CVI_S32 CVI_SYS_StopThermalThread(void);
【Parameter】
None.
【Return Value】
Return Value |
Description |
---|---|
0 |
Success. |
Non 0 |
Failure. |
【Requirement】
Header files: cvi_sys.h
Library files: libsys.a
【Note】
None.
【Example】
None.
【Related Topic】
3.3.41. 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_vb.h, cvi_comm_vb.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.42. 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_vb.h, cvi_comm_vb.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.43. 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_vb.h, cvi_comm_vb.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.44. CVI_VB_IsInited¶
【Description】
To check is VB initialized.
【Syntax】
CVI_S32 CVI_VB_IsInited(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_vb.h, cvi_comm_vb.h
Library files: libsys.a
【Note】
None.
【Example】
None.
【Related Topic】
3.3.45. 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_vb.h, cvi_comm_vb.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.46. 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_vb.h, cvi_comm_vb.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.47. 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_vb.h, cvi_comm_vb.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.48. CVI_VB_CreatePool¶
【Description】
Creating VB pool dynamically.
【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_vb.h, cvi_comm_vb.h
Library files: libsys.a
【Note】
None.
【Example】
None.
【Related Topic】
3.3.49. CVI_VB_CreateExPool¶
【Description】
Creating external VB pool dynamically.
【Syntax】
VB_POOL CVI_VB_CreateExPool(VB_POOL_CONFIG_EX_S *pstVbPoolExCfg);
【Parameter】
Parameter |
Description |
Input/Output |
---|---|---|
pstVbPoolExCfg |
External 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_vb.h, cvi_comm_vb.h
Library files: libsys.a
【Note】
None.
【Example】
None.
【Related Topic】
None.
3.3.50. CVI_VB_DestroyPool¶
【Description】
Destroy VB pool.
【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_vb.h, cvi_comm_vb.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.51. 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_vb.h, cvi_comm_vb.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.52. 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_vb.h, cvi_comm_vb.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.53. 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_vb.h, cvi_comm_vb.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.54. 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_vb.h, cvi_comm_vb.h
Library files: libsys.a
【Note】
None.
【Example】
None.
【Related Topic】
None.
3.3.55. 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_vb.h, cvi_comm_vb.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.56. 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_vb.h, cvi_comm_vb.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.57. 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_vb.h, cvi_comm_vb.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.58. CVI_VB_PrintPool¶
【Description】
Print pool usage information.
【Syntax】
CVI_VOID CVI_VB_PrintPool(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_vb.h, cvi_comm_vb.h
Library files: libsys.a
【Note】
None.
【Example】
None.
【Related Topic】
None.
3.3.59. 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.60. 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】