Download FreeRTOS
 

Quality RTOS & Embedded Software

LIBRARIES
WHAT'S NEW
Simplifying Authenticated Cloud Connectivity for Any Device.
Designing an energy efficient and cloud-connected IoT solution with CoAP.
Introducing FreeRTOS Kernel version 11.0.0:
FreeRTOS Roadmap and Code Contribution process.
OPC-UA over TSN with FreeRTOS.

pxGetNetworkBufferWithDescriptor()
[Ethernet Driver Porting API]

FreeRTOS_IP_Private.h
NetworkBufferManagement.h
NetworkBufferDescriptor_t *pxGetNetworkBufferWithDescriptor( size_t xRequestedSizeBytes,
                                                TickType_t xBlockTimeTicks );

		

Data that is sent out to the network or received from the network is stored in a network buffer. A network buffer is basically just a block of RAM (actually an array of uint8_t in the source code).

The embedded TCP/IP stack needs to first locate the network buffers, and once located know how big the network buffers are. Network buffer descriptors are used for that purpose.

Embedded network buffers

pucPayloadBuffer points to the start of the network buffer.
xDataLength holds the size of the buffer in bytes, excluding the Ethernet CRC bytes.


More information is provided on the page that network buffer descriptordescribes how to port FreeRTOS-Plus-TCP to new devices.

pxGetNetworkBufferWithDescriptor() Obtains a network buffer and associated network buffer descriptor. If xRequestedSizeBytes is 0 then a network buffer descriptor is obtained by itself - without a network buffer.

pxGetNetworkBufferWithDescriptor() must not be called from an interrupt service routine (ISR).

The total number of network buffer descriptors is set by ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS.


Parameters:

xRequestedSizeBytes   The size of the Ethernet buffer to obtain and reference from the returned network buffer descriptor. The size is specified in bytes.

If xRequestedSizeBytes is zero then the returned network buffer descriptor will not reference an Ethernet buffer (the reference is set to NULL).

xBlockTimeTicks   If a network buffer is not available then the calling RTOS task will be held in the Blocked state (so other tasks can execute) until either a network buffer becomes available or the specified block time expires.

The block time is specified in RTOS ticks. To convert a time specified in milliseconds to a time specified in RTOS ticks divide the time specified in milliseconds by portTICK_PERIOD_MS.


Returns:

Successful calls return a pointer to the obtained network buffer descriptor. Unsuccessful calls return NULL.

Example usage:

Examples are provided on the Porting FreeRTOS to a Different Microcontroller page.

Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.