7.3.3 System Control
Overview
System control is used to initialize and deinitialize the entire media system, and establish relationships between modules through binding interfaces. It provides the VP (Video Pool) module for managing large blocks of physical memory allocation.
Functional Description
Video Pool
The VP (Video Pool) video pool provides large blocks of physical memory and management functions, and is responsible for memory allocation and recovery. The video pool is composed of a group of physically contiguous and equally sized buffer blocks. It needs to be configured and initialized before use. The number of buffer pools and the size of buffer blocks can be configured according to the needs.
Binding Relationship
Note: The binding relationship between modules can be established using the HB_SYS_Bind interface. Once bound, the data processed by the data source will be automatically sent to the data sink.
Operation Mode
Online Mode: The data between modules is directly transferred from the previous module to the next module through the internal bus without the need to read/write DDR. This can reduce latency and save DDR bandwidth.
Offline Mode: The data from the previous module is first written to DDR, and then the next module reads the data from DDR. When multiple sensors are connected, all connected sensors are processed offline.
Mode | VIN_SIF and VIN_ISP | VIN_ISP and VPS | VIN_SIF and VPS |
---|---|---|---|
Online | SIF(RAW) --> ISP | ISP(YUV) --> VPS | SIF(YUV) --> VPS |
Offline | SIF(RAW) --> DDR --> ISP | ISP(YUV) --> DDR --> VPS | SIF(YUV) --> DDR --> ISP |
Note: The HB_SYS_SetVINVPSMode interface is used to set the operation mode between VIN and VPS.
API Reference
- HB_SYS_Init: Initialize the media system (reserved).
- HB_SYS_Exit: Exclude the media system (reserved).
- HB_SYS_Bind: Bind the data source to the data receiver.
- HB_SYS_UnBind: Unbind the data source from the data receiver.
- HB_SYS_SetVINVPSMode: Set the operation mode between VIN and VPS modules.
- HB_SYS_GetVINVPSMode: Get the operation mode between VIN and VPS modules for a specified pipeid.
- HB_VP_SetConfig: Set the properties of the Video Pool video pool.
- HB_VP_GetConfig: Get the properties of the Video Pool video pool.
- HB_VP_Init: Initialize the Video Pool video pool.
- HB_VP_Exit: Deinitialize the Video Pool video pool.
- HB_VP_CreatePool: Create a video buffer pool.
- HB_VP_DestroyPool: Destroy a video buffer pool.
- HB_VP_GetBlock: Get a buffer block.
- HB_VP_ReleaseBlock: Release an acquired buffer block.- HB_VP_PhysAddr2Block: Get the buffer block ID from the physical address of the buffer block.
- HB_VP_Block2PhysAddr: Get the physical address of a buffer block.
- HB_VP_Block2PoolId: Get the ID of the cache pool where a cache block is located.
- HB_VP_MmapPool: Map the user space virtual address for a video cache pool.
- HB_VP_MunmapPool: Unmap the user space virtual address for a video cache pool.
- HB_VP_GetBlockVirAddr: Get the user space virtual address of a cache block in a video cache pool.
- HB_VP_InquireUserCnt: Check if a buffer block is in use.
- HB_VP_SetAuxiliaryConfig: Set additional information for a video buffer pool.
- HB_SYS_Alloc: Allocate memory in user space.
- HB_SYS_Free: Free a memory block.
- HB_SYS_AllocCached: Allocate cached memory in user space.
- HB_SYS_CacheInvalidate: Invalidate the cache of the cached memory.
- HB_SYS_CacheFlush: Flush the cache of the cached memory.
- HB_VP_DmaCopy: Copy physical memory through DMA.
HB_SYS_Init
【Function Declaration】
int HB_SYS_Init(void);
【Function Description】
Reserved interface, currently has no effect.
【Parameter Description】
None
【Return Value】
Return Value | Description |
---|---|
0 | Success |
Non-zero | Failure |
【Notes】
None
【Reference Code】
None
HB_SYS_Exit
【Function Declaration】
int HB_SYS_Exit(void);
【Function Description】
Reserved interface, currently has no effect.
【Parameter Description】
None【Return Value】
Returns | Description |
---|---|
0 | Success |
Non-zero | Failure |
【Notes】
None
【Reference Code】
None
HB_SYS_Bind
【Function Declaration】
int HB_SYS_Bind(const SYS_MOD_S *pstSrcMod, const SYS_MOD_S *pstDstMod);
【Function Description】
Establishes a binding relationship between VIN pipelines, channels, VPS groups/channels, VO channels, and VENC channels.
【Parameter Description】
Parameter Name | Description | Input/Output |
---|---|---|
pstSrcMod | Source module pointer | Input |
pstDstMod | Destination module pointer | Input |
【Return Value】
Returns | Description |
---|---|
0 | Success |
Non-zero | Failure |
【Notes】
None
【Reference Code】
None
HB_SYS_UnBind
【Function Declaration】
int HB_SYS_UnBind(const SYS_MOD_S *pstSrcMod, const SYS_MOD_S *pstDstMod);
【Function Description】
Unbinds the binding relationship between VIN pipelines, channels, VPS groups/channels, VO channels, and VENC channels.
【Function Description】
Get the working mode of the VIN, VPS module of the specified pipe ID.
【Parameter Description】
Parameter Name | Description | Input/Output |
---|---|---|
pipeId | Pipe number | Input |
【Return Value】
Return Value | Description |
---|---|
>=0 | SYS_VIN_VPS_MODE_E enum |
<0 | Failed |
【Notice】
None
【Reference Code】
None
HB_SYS_SetVINVPSMode
Function Declaration
int HB_SYS_SetVINVPSMode(int pipeId, const SYS_VIN_VPS_MODE_E mode);
Function Description
Sets the working mode between the VIN and VPS modules.
Parameter Descriptions
Parameter Name | Description | Input/Output |
---|---|---|
pipeId | Pipe ID | Input |
mode | VIN-VPS operating mode | Input |
Return Values
Return Value | Description |
---|---|
0 | Success |
Non-zero | Failure |
Caution
None
Reference Code
None
HB_SYS_GetVINVPSMode
Function Declaration
int HB_SYS_GetVINVPSMode(int pipeId);
Function Description
Retrieves the working mode of the VIN and VPS modules for the specified pipe ID.
Parameter Descriptions
Parameter Name | Description | Input/Output |
---|---|---|
pipeId | Pipe ID | Input |
Return Values
Return Value | Meaning |
---|---|
>=0 | A value of type SYS_VIN_VPS_MODE_E |
<0 | Failure |
Caution
None
Reference Code
None
Video Cache Pool
HB_VP_SetConfig
【Function Declaration】
int HB_VP_SetConfig(VP_CONFIG_S *VpConfig);
【Function Description】
Set the attributes of the Video Pool video buffer pool.
【Parameter Description】
Parameter Name | Description | Input/Output |
---|---|---|
vpConfig | Pointer to video buffer pool properties | Input |
【Return Value】
Return Value | Description |
---|---|
0 | Success |
Non-zero | Failed |
【Notice】
None【Reference Code】 VideoPool Reference Code
HB_VP_GetConfig
【Function Declaration】
int HB_VP_GetConfig(VP_CONFIG_S *VpConfig);
【Description】
Get the properties of the Video Pool video buffer pool.
【Parameter Description】
Parameter Name | Description | Input/Output |
---|---|---|
vpConfig | Video buffer pool property pointer | Output |
【Return Value】
Return Value | Description |
---|---|
0 | Success |
Non-zero | Failure |
【Note】
None
【Reference Code】
None
HB_VP_Init
【Function Declaration】
int HB_VP_Init(void);
【Description】
Initialize the video buffer pool.
【Parameter Description】
None
【Return Value】
Return Value | Description |
---|---|
0 | Success |
Non-zero | Failure |
【Note】
It is necessary to call HB_VP_SetConfig to configure the cache pool properties before initializing the cache pool, otherwise it will fail.【Reference code】 Reference code for VideoPool
HB_VP_Exit
【Function Declaration】
int HB_VP_Exit(void);
【Function Description】
Uninitialize the video pool
【Parameter Description】
None
【Return Value】
Return Value | Description |
---|---|
0 | Success |
Non-zero | Failure |
【Notes】
None
【Reference code】
Reference code for VideoPool
HB_VP_CreatePool
【Function Declaration】
uint32_t HB_VP_CreatePool(VP_POOL_CONFIG_S *VpPoolCfg);