mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-08-01 08:54:14 -04:00
Update TimerDemo.c to test the new vTimerSetTimerID() function.
Update WinPCap NetworkInterface.c for FreeRTOS+UDP to correctly store a pointer to the network buffer structure at the beginning of the network buffer.
This commit is contained in:
parent
03213b9e4a
commit
d39c0d5926
6 changed files with 62 additions and 19 deletions
|
@ -630,6 +630,7 @@ static uint8_t *prvCreatePartDHCPMessage( struct freertos_sockaddr *pxAddress, x
|
|||
xDHCPMessage_t *pxDHCPMessage;
|
||||
const size_t xRequiredBufferSize = sizeof( xDHCPMessage_t ) + xOptionsArraySize;
|
||||
uint8_t *pucUDPPayloadBuffer;
|
||||
static uint8_t ucUseBroadcastFlag = pdFALSE;
|
||||
|
||||
/* Get a buffer. This uses a maximum delay, but the delay will be capped
|
||||
to ipconfigMAX_SEND_BLOCK_TIME_TICKS so the return value still needs to be
|
||||
|
@ -649,7 +650,19 @@ uint8_t *pucUDPPayloadBuffer;
|
|||
pxDHCPMessage->ucAddressLength = dhcpETHERNET_ADDRESS_LENGTH;
|
||||
pxDHCPMessage->ulTransactionID = ulTransactionId;
|
||||
pxDHCPMessage->ulDHCPCookie = dhcpCOOKIE;
|
||||
pxDHCPMessage->usFlags = dhcpBROADCAST;
|
||||
|
||||
/* For maximum possibility of success, alternate between broadcast and non
|
||||
broadcast. */
|
||||
ucUseBroadcastFlag = !ucUseBroadcastFlag;
|
||||
if( ucUseBroadcastFlag == pdTRUE )
|
||||
{
|
||||
pxDHCPMessage->usFlags = dhcpBROADCAST;
|
||||
}
|
||||
else
|
||||
{
|
||||
pxDHCPMessage->usFlags = 0;
|
||||
}
|
||||
|
||||
memcpy( ( void * ) &( pxDHCPMessage->ucClientHardwareAddress[ 0 ] ), ( void * ) pxMACAddress, sizeof( xMACAddress_t ) );
|
||||
|
||||
/* Copy in the const part of the options options. */
|
||||
|
|
|
@ -5,11 +5,11 @@
|
|||
* This file is part of the FreeRTOS+UDP distribution. The FreeRTOS+UDP license
|
||||
* terms are different to the FreeRTOS license terms.
|
||||
*
|
||||
* FreeRTOS+UDP uses a dual license model that allows the software to be used
|
||||
* under a standard GPL open source license, or a commercial license. The
|
||||
* standard GPL license (unlike the modified GPL license under which FreeRTOS
|
||||
* itself is distributed) requires that all software statically linked with
|
||||
* FreeRTOS+UDP is also distributed under the same GPL V2 license terms.
|
||||
* FreeRTOS+UDP uses a dual license model that allows the software to be used
|
||||
* under a standard GPL open source license, or a commercial license. The
|
||||
* standard GPL license (unlike the modified GPL license under which FreeRTOS
|
||||
* itself is distributed) requires that all software statically linked with
|
||||
* FreeRTOS+UDP is also distributed under the same GPL V2 license terms.
|
||||
* Details of both license options follow:
|
||||
*
|
||||
* - Open source licensing -
|
||||
|
@ -21,9 +21,9 @@
|
|||
*
|
||||
* - Commercial licensing -
|
||||
* Businesses and individuals that for commercial or other reasons cannot comply
|
||||
* with the terms of the GPL V2 license must obtain a commercial license before
|
||||
* incorporating FreeRTOS+UDP into proprietary software for distribution in any
|
||||
* form. Commercial licenses can be purchased from http://shop.freertos.org/udp
|
||||
* with the terms of the GPL V2 license must obtain a commercial license before
|
||||
* incorporating FreeRTOS+UDP into proprietary software for distribution in any
|
||||
* form. Commercial licenses can be purchased from http://shop.freertos.org/udp
|
||||
* and do not require any source files to be changed.
|
||||
*
|
||||
* FreeRTOS+UDP is distributed in the hope that it will be useful. You cannot
|
||||
|
@ -117,7 +117,7 @@ this case the network buffers are declared in NetworkInterface.c because, as
|
|||
this file is only used on Windows machines, wasting a few bytes in buffers that
|
||||
never get used does not matter (the buffers will not get used if the dynamic
|
||||
payload allocation file is included in the project). */
|
||||
static uint8_t ucBuffers[ ipconfigNUM_NETWORK_BUFFERS ][ ipTOTAL_ETHERNET_FRAME_SIZE ];
|
||||
static uint8_t ucBuffers[ ipconfigNUM_NETWORK_BUFFERS ][ ipTOTAL_ETHERNET_FRAME_SIZE + ipBUFFER_PADDING ];
|
||||
|
||||
/* The queue used to communicate Ethernet events with the IP task. */
|
||||
extern xQueueHandle xNetworkEventQueue;
|
||||
|
@ -472,10 +472,18 @@ eFrameProcessingResult_t eResult;
|
|||
void vNetworkInterfaceAllocateRAMToBuffers( xNetworkBufferDescriptor_t pxNetworkBuffers[ ipconfigNUM_NETWORK_BUFFERS ] )
|
||||
{
|
||||
BaseType_t x;
|
||||
xNetworkBufferDescriptor_t **ppxStartOfBuffer;
|
||||
|
||||
for( x = 0; x < ipconfigNUM_NETWORK_BUFFERS; x++ )
|
||||
{
|
||||
pxNetworkBuffers[ x ].pucEthernetBuffer = &( ucBuffers[ x ][ 0 ] );
|
||||
/* Place a pointer to the network buffer structure at the beginning
|
||||
of the buffer that will be allocated to the structure. */
|
||||
ppxStartOfBuffer = ( xNetworkBufferDescriptor_t ** ) &( ucBuffers[ x ][ 0 ] );
|
||||
*ppxStartOfBuffer = &( pxNetworkBuffers[ x ] );
|
||||
|
||||
/* Allocate the buffer to the network buffer structure, jumping over
|
||||
the bytes where the pointer to the network buffer is now stored. */
|
||||
pxNetworkBuffers[ x ].pucEthernetBuffer = &( ucBuffers[ x ][ ipBUFFER_PADDING ] );
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue