2 * FreeRTOS+TCP Labs Build 160919 (C) 2016 Real Time Engineers ltd.
3 * Authors include Hein Tibosch and Richard Barry
5 *******************************************************************************
6 ***** NOTE ******* NOTE ******* NOTE ******* NOTE ******* NOTE ******* NOTE ***
9 *** FREERTOS+TCP IS STILL IN THE LAB (mainly because the FTP and HTTP ***
10 *** demos have a dependency on FreeRTOS+FAT, which is only in the Labs ***
13 *** FreeRTOS+TCP is functional and has been used in commercial products ***
14 *** for some time. Be aware however that we are still refining its ***
15 *** design, the source code does not yet quite conform to the strict ***
16 *** coding and style standards mandated by Real Time Engineers ltd., and ***
17 *** the documentation and testing is not necessarily complete. ***
19 *** PLEASE REPORT EXPERIENCES USING THE SUPPORT RESOURCES FOUND ON THE ***
20 *** URL: http://www.FreeRTOS.org/contact Active early adopters may, at ***
21 *** the sole discretion of Real Time Engineers Ltd., be offered versions ***
22 *** under a license other than that described below. ***
25 ***** NOTE ******* NOTE ******* NOTE ******* NOTE ******* NOTE ******* NOTE ***
26 *******************************************************************************
28 * FreeRTOS+TCP can be used under two different free open source licenses. The
29 * license that applies is dependent on the processor on which FreeRTOS+TCP is
30 * executed, as follows:
32 * If FreeRTOS+TCP is executed on one of the processors listed under the Special
33 * License Arrangements heading of the FreeRTOS+TCP license information web
34 * page, then it can be used under the terms of the FreeRTOS Open Source
35 * License. If FreeRTOS+TCP is used on any other processor, then it can be used
36 * under the terms of the GNU General Public License V2. Links to the relevant
39 * The FreeRTOS+TCP License Information Page: http://www.FreeRTOS.org/tcp_license
40 * The FreeRTOS Open Source License: http://www.FreeRTOS.org/license
41 * The GNU General Public License Version 2: http://www.FreeRTOS.org/gpl-2.0.txt
43 * FreeRTOS+TCP is distributed in the hope that it will be useful. You cannot
44 * use FreeRTOS+TCP unless you agree that you use the software 'as is'.
45 * FreeRTOS+TCP is provided WITHOUT ANY WARRANTY; without even the implied
46 * warranties of NON-INFRINGEMENT, MERCHANTABILITY or FITNESS FOR A PARTICULAR
47 * PURPOSE. Real Time Engineers Ltd. disclaims all conditions and terms, be they
48 * implied, expressed, or statutory.
52 * http://www.FreeRTOS.org
53 * http://www.FreeRTOS.org/plus
54 * http://www.FreeRTOS.org/labs
58 /******************************************************************************
60 * See the following web page for essential buffer allocation scheme usage and
61 * configuration details:
62 * http://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/Embedded_Ethernet_Buffer_Management.html
64 ******************************************************************************/
66 /* THIS FILE SHOULD NOT BE USED IF THE PROJECT INCLUDES A MEMORY ALLOCATOR
67 * THAT WILL FRAGMENT THE HEAP MEMORY. For example, heap_2 must not be used,
68 * heap_4 can be used. */
70 /* Standard includes. */
73 /* FreeRTOS includes. */
78 /* FreeRTOS+TCP includes. */
79 #include "FreeRTOS_IP.h"
80 #include "FreeRTOS_UDP_IP.h"
81 #include "FreeRTOS_IP_Private.h"
82 #include "NetworkInterface.h"
83 #include "NetworkBufferManagement.h"
85 #include "tcpip/tcpip.h"
86 #include "tcpip/src/tcpip_private.h"
88 #include "NetworkConfig.h"
90 /* The obtained network buffer must be large enough to hold a packet that might
91 * replace the packet that was requested to be sent. */
92 #if ipconfigUSE_TCP == 1
93 #define baMINIMAL_BUFFER_SIZE sizeof( TCPPacket_t )
95 #define baMINIMAL_BUFFER_SIZE sizeof( ARPPacket_t )
96 #endif /* ipconfigUSE_TCP == 1 */
98 /*_RB_ This is too complex not to have an explanation. */
99 #if defined( ipconfigETHERNET_MINIMUM_PACKET_BYTES )
100 #define ASSERT_CONCAT_( a, b ) a ## b
101 #define ASSERT_CONCAT( a, b ) ASSERT_CONCAT_( a, b )
102 #define STATIC_ASSERT( e ) \
103 ; enum { ASSERT_CONCAT( assert_line_, __LINE__ ) = 1 / ( !!( e ) ) }
105 STATIC_ASSERT( ipconfigETHERNET_MINIMUM_PACKET_BYTES <= baMINIMAL_BUFFER_SIZE );
108 /* A list of free (available) NetworkBufferDescriptor_t structures. */
109 static List_t xFreeBuffersList;
111 /* Some statistics about the use of buffers. */
112 static size_t uxMinimumFreeNetworkBuffers;
114 /* Declares the pool of NetworkBufferDescriptor_t structures that are available
115 * to the system. All the network buffers referenced from xFreeBuffersList exist
116 * in this array. The array is not accessed directly except during initialisation,
117 * when the xFreeBuffersList is filled (as all the buffers are free when the system
119 static NetworkBufferDescriptor_t xNetworkBufferDescriptors[ ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS ];
121 /* This constant is defined as false to let FreeRTOS_TCP_IP.c know that the
122 * network buffers have a variable size: resizing may be necessary */
123 const BaseType_t xBufferAllocFixedSize = pdFALSE;
125 /* The semaphore used to obtain network buffers. */
126 static SemaphoreHandle_t xNetworkBufferSemaphore = NULL;
128 /*-----------------------------------------------------------*/
130 #ifdef PIC32_USE_ETHERNET
132 /* PIC32 specific stuff */
135 /* MAC packet acknowledgment, once MAC is done with it */
136 static bool PIC32_MacPacketAcknowledge( TCPIP_MAC_PACKET * pPkt,
137 const void * param );
139 /* allocates a MAC packet that holds a data buffer that can be used by both: */
140 /* - the FreeRTOSIP (NetworkBufferDescriptor_t->pucEthernetBuffer) */
141 /* - the Harmony MAC driver: TCPIP_MAC_PACKET->pDSeg->segLoad */
142 /* from the beginning of the buffer: */
143 /* - 4 bytes pointer to the network descriptor (FreeRTOS) */
144 /* - 4 bytes pointer to the MAC packet (pic32_NetworkInterface.c) */
145 /* - 2 bytes offset from the MAC packet (Harmony MAC driver: segLoadOffset) */
147 /* NOTE: segLoadLen should NOT include: */
148 /* - the TCPIP_MAC_FRAME_OFFSET (== ipBUFFER_PADDING which should be == 10!) */
149 /* - the sizeof(TCPIP_MAC_ETHERNET_HEADER) */
150 /* These are added by the MAC packet allocation! */
152 static uint8_t * PIC32_PktAlloc( uint16_t pktLen,
154 TCPIP_MAC_PACKET_ACK_FUNC ackF,
155 TCPIP_MAC_PACKET ** pPtrPkt )
159 /* allocate standard packet */
160 TCPIP_MAC_PACKET * pPkt = TCPIP_PKT_PacketAlloc( pktLen, segLoadLen, 0 );
162 /* set the MAC packet pointer in the packet */
165 pBuff = pPkt->pDSeg->segLoad;
166 TCPIP_MAC_PACKET ** ppkt = ( TCPIP_MAC_PACKET ** ) ( pBuff - PIC32_BUFFER_PKT_PTR_OSSET );
167 configASSERT( ( ( uint32_t ) ppkt & ( sizeof( uint32_t ) - 1 ) ) == 0 );
168 *ppkt = pPkt; /* store the packet it comes from */
169 pPkt->ackFunc = ackF;
183 /* standard PIC32 MAC allocation function for a MAC packet */
184 /* this packet saves room for the FreeRTOS network descriptor */
185 /* at the beginning of the data buffer */
186 /* see NetworkBufferAllocate */
187 /* Note: flags parameter is ignored since that's used in the Harmony stack only */
188 TCPIP_MAC_PACKET * PIC32_MacPacketAllocate( uint16_t pktLen,
190 TCPIP_MAC_PACKET_FLAGS flags )
192 TCPIP_MAC_PACKET * pPkt;
194 PIC32_PktAlloc( pktLen, segLoadLen, 0, &pPkt );
199 /* standard PIC32 MAC packet acknowledgment */
200 /* function called once MAC is done with it */
201 static bool PIC32_MacPacketAcknowledge( TCPIP_MAC_PACKET * pPkt,
204 configASSERT( ( pPkt != 0 ) );
206 TCPIP_PKT_PacketFree( pPkt );
211 /* associates the current MAC packet with a network descriptor */
212 /* mainly for RX packet */
213 void PIC32_MacAssociate( TCPIP_MAC_PACKET * pRxPkt,
214 NetworkBufferDescriptor_t * pxBufferDescriptor,
217 uint8_t * pPktBuff = pRxPkt->pDSeg->segLoad;
219 pxBufferDescriptor->pucEthernetBuffer = pPktBuff;
220 pxBufferDescriptor->xDataLength = pktLength;
222 /* make sure this is a properly allocated packet */
223 TCPIP_MAC_PACKET ** ppkt = ( TCPIP_MAC_PACKET ** ) ( pPktBuff - PIC32_BUFFER_PKT_PTR_OSSET );
224 configASSERT( ( ( uint32_t ) ppkt & ( sizeof( uint32_t ) - 1 ) ) == 0 );
226 if( *ppkt != pRxPkt )
228 configASSERT( false );
231 /* set the proper descriptor info */
232 NetworkBufferDescriptor_t ** ppDcpt = ( NetworkBufferDescriptor_t ** ) ( pPktBuff - ipBUFFER_PADDING );
233 configASSERT( ( ( uint32_t ) ppDcpt & ( sizeof( uint32_t ) - 1 ) ) == 0 );
234 *ppDcpt = pxBufferDescriptor;
237 /* debug functionality */
238 void PIC32_MacPacketOrphan( TCPIP_MAC_PACKET * pPkt )
240 TCPIP_PKT_PacketFree( pPkt );
241 configASSERT( false );
244 /* FreeRTOS allocation functions */
246 /* allocates a buffer that can be used by both: */
247 /* - the FreeRTOSIP (NetworkBufferDescriptor_t->pucEthernetBuffer) */
248 /* - the Harmony MAC driver: TCPIP_MAC_PACKET */
249 /* See PIC32_PktAlloc for details */
251 /* NOTE: reqLength should NOT include the ipBUFFER_PADDING (which should be == 10!) */
252 /* or the sizeof(TCPIP_MAC_ETHERNET_HEADER) */
253 /* These are added by the MAC packet allocation! */
255 uint8_t * NetworkBufferAllocate( size_t reqLength )
257 return PIC32_PktAlloc( sizeof( TCPIP_MAC_PACKET ), reqLength, PIC32_MacPacketAcknowledge, 0 );
260 /* deallocates a network buffer previously allocated */
261 /* with NetworkBufferAllocate */
262 void NetworkBufferFree( uint8_t * pNetworkBuffer )
264 if( pNetworkBuffer != 0 )
266 TCPIP_MAC_PACKET ** ppkt = ( TCPIP_MAC_PACKET ** ) ( pNetworkBuffer - PIC32_BUFFER_PKT_PTR_OSSET );
267 configASSERT( ( ( uint32_t ) ppkt & ( sizeof( uint32_t ) - 1 ) ) == 0 );
268 TCPIP_MAC_PACKET * pPkt = *ppkt;
269 configASSERT( ( pPkt != 0 ) );
271 if( pPkt->ackFunc != 0 )
273 ( *pPkt->ackFunc )( pPkt, pPkt->ackParam );
277 PIC32_MacPacketOrphan( pPkt );
282 #endif /* #ifdef PIC32_USE_ETHERNET */
284 /*-----------------------------------------------------------*/
286 BaseType_t xNetworkBuffersInitialise( void )
288 BaseType_t xReturn, x;
290 /* Only initialise the buffers and their associated kernel objects if they
291 * have not been initialised before. */
292 if( xNetworkBufferSemaphore == NULL )
294 xNetworkBufferSemaphore = xSemaphoreCreateCounting( ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS, ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS );
295 configASSERT( xNetworkBufferSemaphore );
297 if( xNetworkBufferSemaphore != NULL )
299 #if ( configQUEUE_REGISTRY_SIZE > 0 )
301 vQueueAddToRegistry( xNetworkBufferSemaphore, "NetBufSem" );
303 #endif /* configQUEUE_REGISTRY_SIZE */
305 /* If the trace recorder code is included name the semaphore for viewing
306 * in FreeRTOS+Trace. */
307 #if ( ipconfigINCLUDE_EXAMPLE_FREERTOS_PLUS_TRACE_CALLS == 1 )
309 extern QueueHandle_t xNetworkEventQueue;
310 vTraceSetQueueName( xNetworkEventQueue, "IPStackEvent" );
311 vTraceSetQueueName( xNetworkBufferSemaphore, "NetworkBufferCount" );
313 #endif /* ipconfigINCLUDE_EXAMPLE_FREERTOS_PLUS_TRACE_CALLS == 1 */
315 vListInitialise( &xFreeBuffersList );
317 /* Initialise all the network buffers. No storage is allocated to
318 * the buffers yet. */
319 for( x = 0; x < ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS; x++ )
321 /* Initialise and set the owner of the buffer list items. */
322 xNetworkBufferDescriptors[ x ].pucEthernetBuffer = NULL;
323 vListInitialiseItem( &( xNetworkBufferDescriptors[ x ].xBufferListItem ) );
324 listSET_LIST_ITEM_OWNER( &( xNetworkBufferDescriptors[ x ].xBufferListItem ), &xNetworkBufferDescriptors[ x ] );
326 /* Currently, all buffers are available for use. */
327 vListInsert( &xFreeBuffersList, &( xNetworkBufferDescriptors[ x ].xBufferListItem ) );
330 uxMinimumFreeNetworkBuffers = ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS;
334 if( xNetworkBufferSemaphore == NULL )
345 /*-----------------------------------------------------------*/
347 uint8_t * pucGetNetworkBuffer( size_t * pxRequestedSizeBytes )
349 uint8_t * pucEthernetBuffer;
350 size_t xSize = *pxRequestedSizeBytes;
352 if( xSize < baMINIMAL_BUFFER_SIZE )
354 /* Buffers must be at least large enough to hold a TCP-packet with
355 * headers, or an ARP packet, in case TCP is not included. */
356 xSize = baMINIMAL_BUFFER_SIZE;
359 /* Round up xSize to the nearest multiple of N bytes,
360 * where N equals 'sizeof( size_t )'. */
361 if( ( xSize & ( sizeof( size_t ) - 1u ) ) != 0u )
363 xSize = ( xSize | ( sizeof( size_t ) - 1u ) ) + 1u;
366 *pxRequestedSizeBytes = xSize;
368 /* Allocate a buffer large enough to store the requested Ethernet frame size
369 * and a pointer to a network buffer structure (hence the addition of
370 * ipBUFFER_PADDING bytes). */
372 #ifdef PIC32_USE_ETHERNET
373 pucEthernetBuffer = NetworkBufferAllocate( xSize - sizeof( TCPIP_MAC_ETHERNET_HEADER ) );
375 pucEthernetBuffer = ( uint8_t * ) pvPortMalloc( xSize + ipBUFFER_PADDING );
376 #endif /* #ifdef PIC32_USE_ETHERNET */
378 configASSERT( pucEthernetBuffer );
380 if( pucEthernetBuffer != NULL )
382 /* Enough space is left at the start of the buffer to place a pointer to
383 * the network buffer structure that references this Ethernet buffer.
384 * Return a pointer to the start of the Ethernet buffer itself. */
385 #ifndef PIC32_USE_ETHERNET
386 pucEthernetBuffer += ipBUFFER_PADDING;
387 #endif /* #ifndef PIC32_USE_ETHERNET */
390 return pucEthernetBuffer;
392 /*-----------------------------------------------------------*/
394 void vReleaseNetworkBuffer( uint8_t * pucEthernetBuffer )
396 /* There is space before the Ethernet buffer in which a pointer to the
397 * network buffer that references this Ethernet buffer is stored. Remove the
398 * space before freeing the buffer. */
399 #ifdef PIC32_USE_ETHERNET
400 NetworkBufferFree( pucEthernetBuffer );
402 if( pucEthernetBuffer != NULL )
404 pucEthernetBuffer -= ipBUFFER_PADDING;
405 vPortFree( ( void * ) pucEthernetBuffer );
407 #endif /* #ifdef PIC32_USE_ETHERNET */
409 /*-----------------------------------------------------------*/
411 NetworkBufferDescriptor_t * pxGetNetworkBufferWithDescriptor( size_t xRequestedSizeBytes,
412 TickType_t xBlockTimeTicks )
414 NetworkBufferDescriptor_t * pxReturn = NULL;
417 if( ( xRequestedSizeBytes != 0u ) && ( xRequestedSizeBytes < ( size_t ) baMINIMAL_BUFFER_SIZE ) )
419 /* ARP packets can replace application packets, so the storage must be
420 * at least large enough to hold an ARP. */
421 xRequestedSizeBytes = baMINIMAL_BUFFER_SIZE;
424 #ifdef PIC32_USE_ETHERNET
425 if( xRequestedSizeBytes != 0u )
427 #endif /* #ifdef PIC32_USE_ETHERNET */
428 xRequestedSizeBytes += 2u;
430 if( ( xRequestedSizeBytes & ( sizeof( size_t ) - 1u ) ) != 0u )
432 xRequestedSizeBytes = ( xRequestedSizeBytes | ( sizeof( size_t ) - 1u ) ) + 1u;
434 #ifdef PIC32_USE_ETHERNET
436 #endif /* #ifdef PIC32_USE_ETHERNET */
438 /* If there is a semaphore available, there is a network buffer available. */
439 if( xSemaphoreTake( xNetworkBufferSemaphore, xBlockTimeTicks ) == pdPASS )
441 /* Protect the structure as it is accessed from tasks and interrupts. */
442 taskENTER_CRITICAL();
444 pxReturn = ( NetworkBufferDescriptor_t * ) listGET_OWNER_OF_HEAD_ENTRY( &xFreeBuffersList );
445 uxListRemove( &( pxReturn->xBufferListItem ) );
449 /* Reading UBaseType_t, no critical section needed. */
450 uxCount = listCURRENT_LIST_LENGTH( &xFreeBuffersList );
452 if( uxMinimumFreeNetworkBuffers > uxCount )
454 uxMinimumFreeNetworkBuffers = uxCount;
457 /* Allocate storage of exactly the requested size to the buffer. */
458 configASSERT( pxReturn->pucEthernetBuffer == NULL );
460 if( xRequestedSizeBytes > 0 )
462 /* Extra space is obtained so a pointer to the network buffer can
463 * be stored at the beginning of the buffer. */
465 #ifdef PIC32_USE_ETHERNET
466 pxReturn->pucEthernetBuffer = NetworkBufferAllocate( xRequestedSizeBytes - sizeof( TCPIP_MAC_ETHERNET_HEADER ) );
468 pxReturn->pucEthernetBuffer = ( uint8_t * ) pvPortMalloc( xRequestedSizeBytes + ipBUFFER_PADDING );
469 #endif /* #ifdef PIC32_USE_ETHERNET */
471 if( pxReturn->pucEthernetBuffer == NULL )
473 /* The attempt to allocate storage for the buffer payload failed,
474 * so the network buffer structure cannot be used and must be
476 vReleaseNetworkBufferAndDescriptor( pxReturn );
481 /* Store a pointer to the network buffer structure in the
482 * buffer storage area, then move the buffer pointer on past the
483 * stored pointer so the pointer value is not overwritten by the
484 * application when the buffer is used. */
485 #ifdef PIC32_USE_ETHERNET
486 *( ( NetworkBufferDescriptor_t ** ) ( pxReturn->pucEthernetBuffer - ipBUFFER_PADDING ) ) = pxReturn;
488 *( ( NetworkBufferDescriptor_t ** ) ( pxReturn->pucEthernetBuffer ) ) = pxReturn;
489 pxReturn->pucEthernetBuffer += ipBUFFER_PADDING;
490 #endif /* #ifdef PIC32_USE_ETHERNET */
492 /* Store the actual size of the allocated buffer, which may be
493 * greater than the original requested size. */
494 pxReturn->xDataLength = xRequestedSizeBytes;
496 #if ( ipconfigUSE_LINKED_RX_MESSAGES != 0 )
498 /* make sure the buffer is not linked */
499 pxReturn->pxNextBuffer = NULL;
501 #endif /* ipconfigUSE_LINKED_RX_MESSAGES */
506 /* A descriptor is being returned without an associated buffer being
511 if( pxReturn == NULL )
513 iptraceFAILED_TO_OBTAIN_NETWORK_BUFFER();
517 iptraceNETWORK_BUFFER_OBTAINED( pxReturn );
522 /*-----------------------------------------------------------*/
524 void vReleaseNetworkBufferAndDescriptor( NetworkBufferDescriptor_t * const pxNetworkBuffer )
526 BaseType_t xListItemAlreadyInFreeList;
528 /* Ensure the buffer is returned to the list of free buffers before the
529 * counting semaphore is 'given' to say a buffer is available. Release the
530 * storage allocated to the buffer payload. THIS FILE SHOULD NOT BE USED
531 * IF THE PROJECT INCLUDES A MEMORY ALLOCATOR THAT WILL FRAGMENT THE HEAP
532 * MEMORY. For example, heap_2 must not be used, heap_4 can be used. */
533 vReleaseNetworkBuffer( pxNetworkBuffer->pucEthernetBuffer );
534 pxNetworkBuffer->pucEthernetBuffer = NULL;
536 taskENTER_CRITICAL();
538 xListItemAlreadyInFreeList = listIS_CONTAINED_WITHIN( &xFreeBuffersList, &( pxNetworkBuffer->xBufferListItem ) );
540 if( xListItemAlreadyInFreeList == pdFALSE )
542 vListInsertEnd( &xFreeBuffersList, &( pxNetworkBuffer->xBufferListItem ) );
548 * Update the network state machine, unless the program fails to release its 'xNetworkBufferSemaphore'.
549 * The program should only try to release its semaphore if 'xListItemAlreadyInFreeList' is false.
551 if( xListItemAlreadyInFreeList == pdFALSE )
553 if ( xSemaphoreGive( xNetworkBufferSemaphore ) == pdTRUE )
555 iptraceNETWORK_BUFFER_RELEASED( pxNetworkBuffer );
560 iptraceNETWORK_BUFFER_RELEASED( pxNetworkBuffer );
563 /*-----------------------------------------------------------*/
566 * Returns the number of free network buffers
568 UBaseType_t uxGetNumberOfFreeNetworkBuffers( void )
570 return listCURRENT_LIST_LENGTH( &xFreeBuffersList );
572 /*-----------------------------------------------------------*/
574 UBaseType_t uxGetMinimumFreeNetworkBuffers( void )
576 return uxMinimumFreeNetworkBuffers;
578 /*-----------------------------------------------------------*/
580 NetworkBufferDescriptor_t * pxResizeNetworkBufferWithDescriptor( NetworkBufferDescriptor_t * pxNetworkBuffer,
581 size_t xNewSizeBytes )
583 size_t xOriginalLength;
586 #ifdef PIC32_USE_ETHERNET
587 xOriginalLength = pxNetworkBuffer->xDataLength;
589 xOriginalLength = pxNetworkBuffer->xDataLength + ipBUFFER_PADDING;
590 xNewSizeBytes = xNewSizeBytes + ipBUFFER_PADDING;
591 #endif /* #ifdef PIC32_USE_ETHERNET */
593 pucBuffer = pucGetNetworkBuffer( &( xNewSizeBytes ) );
595 if( pucBuffer == NULL )
597 /* In case the allocation fails, return NULL. */
598 pxNetworkBuffer = NULL;
602 pxNetworkBuffer->xDataLength = xNewSizeBytes;
603 if( xNewSizeBytes > xOriginalLength )
605 xNewSizeBytes = xOriginalLength;
608 #ifdef PIC32_USE_ETHERNET
609 memcpy( pucBuffer, pxNetworkBuffer->pucEthernetBuffer, xNewSizeBytes );
610 *( ( NetworkBufferDescriptor_t ** ) ( pucBuffer - ipBUFFER_PADDING ) ) = pxNetworkBuffer;
612 memcpy( pucBuffer - ipBUFFER_PADDING, pxNetworkBuffer->pucEthernetBuffer - ipBUFFER_PADDING, xNewSizeBytes );
613 #endif /* #ifdef PIC32_USE_ETHERNET */
615 vReleaseNetworkBuffer( pxNetworkBuffer->pucEthernetBuffer );
616 pxNetworkBuffer->pucEthernetBuffer = pucBuffer;
619 return pxNetworkBuffer;