tfPoolCreate
Table of Contents >> Programmer's Reference
#include <trsocket.h> |
int tfPoolCreate | ( |
ttUserInterface interfaceHandle, | |
int numberFullSizeBuffers, | |
int numberSmallSizeBuffers, | |
int fullBufferSize, | |
int smallBufferSize, | |
int alignmnet, | |
int flag | |
); |
Function Description
Allocate a ring of pre-allocated device driver receive buffers so that the device driver can get a pre-allocated buffer from this recv pool during an ISR. The user can specify a number of maximum size packets and a number of small size packets. For Ethernet device driver the maximum size packet (fullBufferSize parameter) should be TM_ETHER_MAX_PACKET_CRC. This function should be called from the device driver open function, and the device driver should only get a buffer from this pool during an ISR.
Note: | The user must periodically replinish the Treck ISR recv pool as follows:
errorCode=tfIoctlInterface(interfaceHandle, TM_DEV_IOCTL_REFILL_POOL_FLAG, (void *)0, 0); |
Parameters
- interfaceHandle
- Interface handle as given in the first parameter of the driver open function, or as returned by tfAddInterface().
- numberFullSizeBuffers
- The number of full size buffers to pre-allocate in the ring.
- numberSmallSizeBuffers
- The number of small size buffers to pre-allocate in the ring.
- fullBufferSize
- The maximum buffer size (TM_ETHER_MAX_PACKET_CRC for Ethernet).
- smallBufferSize
- The small buffer size (for example 128 bytes).
- alignmnet
- Specify data pointer alignment for pre-allocated receive buffers.
- flag
- Indicates whether buffers should be reallocated in line when the tfPoolReceive() function is called (in the context of the recv task). 0 means no in-line reallocation. TM_POOL_REFILL_IN_LINE means in-line reallocation.
Parameters
- TM_ENOERROR
- Success.
- TM_EINVAL
- One of the follwing:
- numberFullSizeBuffers parameter is less or equal to zero
- fullBufferSize parameter is less or equal to zero
- fullBufferSize is less than TM_ETHER_MAX_PACKET_CRC on Ethernet
- numberSmallSizeBuffers is negative
- smallBufferSize is negative
- smallBufferSize is zero and numberSmallSizeBuffers is not zero
- alignment is negative
- alignment is bigger than 64
- flag is neither 0 nor TM_POOL_REFILL_IN_LINE
- TM_EPERM
- Function not called from the device driver open function.
- TM_EALREADY
- Pool already created on that interface.
- TM_ENOBUFS
- Not enough memory to allocate the recv pool.