目录

InitBuffer

Function Description

Calls TBufPool::InitBuffer to allocate memory for TQue/TBuf.

Function Prototype

template <class T> __aicore__ inline bool InitBuffer(T& que, uint8_t num, uint32_t len);
template <TPosition pos> __aicore__ inline bool InitBuffer(TBuf<pos>& buf, uint32_t len);

Parameters

Table 1 Parameters in InitBuffer(T& que, uint8_t num, uint32_t len) prototype definition

Parameter Input/Output Description
que Input TQue object that requires buffer allocation.
num Input Number of allocated buffers.
len Input Size of each buffer, in bytes. If the size is not 32-byte aligned, it is automatically padded up to 32-byte aligned.

Table 2 Parameters in InitBuffer(TBuf<pos>& buf, uint32_t len) prototype definition

Parameter Input/Output Description
buf Input TBuf object that requires buffer allocation.
len Input Size of the buffer allocated to the TBuf, in bytes. If the size is not 32-byte aligned, it is automatically padded up to 32-byte aligned.

Supported Models

Kirin 9020 series processors

Kirin 9030 series processors

Kirin X90 series processors

Precautions

When declaring TBufPool, you can use bufIDSize to specify the maximum number of buffers that can be allocated. The default upper limit is 4, and the maximum value is 16. The physical memory of TQue or TBuf must be the same as that of TBufPool.

Return Value

None

Calling Example

See InitBufPool.