Synopsis
void *ctl_net_mem_alloc_data(size_t byteSize,
                             CTL_TIME_t toTicks);
Description

ctl_net_mem_alloc_data is a wrapper around the alloc_data member of the of the network memory manager (see CTL_NET_MEM_DRIVER_t and ctl_net_mem_alloc_fn_t).

The network memory manager will not use its entire heap for this request. Instead, a kilobyte or so is held in reserve for future ctl_net_mem_alloc_xmit requests and this routine will fail before dipping into that reserve. Buffers allocated with this routine should be freed using ctl_net_mem_free.

The network memory manager driver will return a word-aligned buffer of at least byteSize bytes if successful, null for fail. If toTicks is non-zero and the allocation initially fails, the routine will block in the hope that another task or ISR will call ctl_net_mem_free in the interim, giving the network memory manager adequate resources to perform the allocation.

Thread Safety

Even with toTicks set to zero, ctl_net_mem_alloc_data routine is not safe to call from an ISR or a zero-priority main CTL task.

See Also

CTL_NET_MEM_DRIVER_t, ctl_net_mem_alloc_xmit, ctl_net_mem_free