InitBuffer
Applicability
|
Product |
Supported/Unsupported |
|---|---|
|
|
√ |
|
|
√ |
|
|
x |
|
|
√ |
|
|
x |
|
|
√ |
Function Usage
Calls TBufPool::InitBuffer to allocate buffer for the TQue/TBuf.
Prototype
1 2 |
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
|
Parameter |
Input/Output |
Meaning |
|---|---|---|
|
que |
Input |
TQue object that requires memory 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. |
|
Parameter |
Input/Output |
Meaning |
|---|---|---|
|
buf |
Input |
TBuf object that requires memory allocation |
|
len |
Input |
Size of the memory allocated to the TBuf, in bytes. If the size is not 32-byte aligned, it is automatically padded up to 32-byte aligned. |
Restrictions
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 the TQue or TBuf must be the same as that of the TBufPool.
Returns
None
Example
See InitBufPool.