Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem


pucGetNetworkBuffer() and BufferAllocation_1.c

Posted by tc-cadscan on December 21, 2017

I'm attempting to write a zero-copy network driver for FreeRTOS+TCP. The DMA alignment requirements for the chip I'm using mean that I need to use statically allocated buffers (i.e. BufferAllocation1.c). The page on porting says that the receive buffers should be allocated to the DMA at start-up using pucGetNetworkBuffer(), but this isn't defined in BufferAllocation1.c, only in BufferAllocation_2.c

I think I can get around this by getting a full descriptor (using pxGetNetworkBufferWithDescriptor()), and using the buffer from that. Then set the descriptor's buffer pointer to NULL and give it back to the TCP/IP stack, like in the receiving data example on the porting page. However there doesn't seem to be anything in BufferAllocation_1.c to prevent a descriptor with a NULL pointer from being reused, so I'm not sure if this will actually work?

It seems as though the examples on the porting page for writing zero-copy drivers couldn't actually work with the code as is. Looking on this forum though, it seems several people have had success writing zero-copy drivers before, so it must be possible. Am I missing something here?

pucGetNetworkBuffer() and BufferAllocation_1.c

Posted by rtel on December 21, 2017

Have a look at the Zynq example in the labs download. I think that uses BufferAllocation_1.c and might be a good reference.

[ Back to the top ]    [ About FreeRTOS ]    [ Privacy ]    [ Sitemap ]    [ ]

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

Latest News

NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS.

Meet Richard Barry and learn about running FreeRTOS on RISC-V at FOSDEM 2019

Version 10.1.1 of the FreeRTOS kernel is available for immediate download. MIT licensed.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


FreeRTOS and other embedded software careers at AWS.

FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers


STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS

Xilinx Microblaze and Zynq partner