diff --git a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_UDP_and_CLI_Windows_Simulator/FreeRTOSConfig.h b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_UDP_and_CLI_Windows_Simulator/FreeRTOSConfig.h
index a19cf4616..d61a38d00 100644
--- a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_UDP_and_CLI_Windows_Simulator/FreeRTOSConfig.h
+++ b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_UDP_and_CLI_Windows_Simulator/FreeRTOSConfig.h
@@ -185,13 +185,16 @@ configNETWORK_INTERFACE_TO_USE to 2 results in the wireless network being
used. */
#define configNETWORK_INTERFACE_TO_USE 4L
+/* Only when using BufferAllocation_1.c. */
+#define configUSE_STATIC_BUFFERS 1
+
/* The address of an echo server that will be used by the two demo echo client
tasks.
http://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_UDP/Embedded_Ethernet_Examples/Common_Echo_Clients.shtml */
-#define configECHO_SERVER_ADDR0 10
-#define configECHO_SERVER_ADDR1 134
-#define configECHO_SERVER_ADDR2 134
-#define configECHO_SERVER_ADDR3 71
+#define configECHO_SERVER_ADDR0 172
+#define configECHO_SERVER_ADDR1 25
+#define configECHO_SERVER_ADDR2 218
+#define configECHO_SERVER_ADDR3 100
/* Default MAC address configuration. The demo creates a virtual network
connection that uses this MAC address by accessing the raw Ethernet/WiFi data
diff --git a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_UDP_and_CLI_Windows_Simulator/WIN32.vcxproj b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_UDP_and_CLI_Windows_Simulator/WIN32.vcxproj
index 298b6876c..78206e497 100644
--- a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_UDP_and_CLI_Windows_Simulator/WIN32.vcxproj
+++ b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_UDP_and_CLI_Windows_Simulator/WIN32.vcxproj
@@ -139,6 +139,9 @@
+
+ true
+
diff --git a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_UDP_and_CLI_Windows_Simulator/WIN32.vcxproj.filters b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_UDP_and_CLI_Windows_Simulator/WIN32.vcxproj.filters
index 5a76f97cc..dd25ff982 100644
--- a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_UDP_and_CLI_Windows_Simulator/WIN32.vcxproj.filters
+++ b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_UDP_and_CLI_Windows_Simulator/WIN32.vcxproj.filters
@@ -109,6 +109,9 @@
Demo App Source\DemoTasks
+
+ FreeRTOS+\FreeRTOS+UDP\portable
+
diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-UDP/FreeRTOS_DHCP.c b/FreeRTOS-Plus/Source/FreeRTOS-Plus-UDP/FreeRTOS_DHCP.c
index e9fe777b5..06842535e 100644
--- a/FreeRTOS-Plus/Source/FreeRTOS-Plus-UDP/FreeRTOS_DHCP.c
+++ b/FreeRTOS-Plus/Source/FreeRTOS-Plus-UDP/FreeRTOS_DHCP.c
@@ -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. */
diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-UDP/portable/NetworkInterface/WinPCap/NetworkInterface.c b/FreeRTOS-Plus/Source/FreeRTOS-Plus-UDP/portable/NetworkInterface/WinPCap/NetworkInterface.c
index bfbf2d393..1d823367f 100644
--- a/FreeRTOS-Plus/Source/FreeRTOS-Plus-UDP/portable/NetworkInterface/WinPCap/NetworkInterface.c
+++ b/FreeRTOS-Plus/Source/FreeRTOS-Plus-UDP/portable/NetworkInterface/WinPCap/NetworkInterface.c
@@ -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
diff --git a/FreeRTOS/Demo/Common/Minimal/TimerDemo.c b/FreeRTOS/Demo/Common/Minimal/TimerDemo.c
index de37052b2..1a7ec746e 100644
--- a/FreeRTOS/Demo/Common/Minimal/TimerDemo.c
+++ b/FreeRTOS/Demo/Common/Minimal/TimerDemo.c
@@ -192,7 +192,7 @@ static void prvTimerTestTask( void *pvParameters )
xOneShotTimer = xTimerCreate( "Oneshot Timer", /* Text name to facilitate debugging. The kernel does not use this itself. */
tmrdemoONE_SHOT_TIMER_PERIOD, /* The period for the timer. */
pdFALSE, /* Don't auto-reload - hence a one shot timer. */
- ( void * ) 0, /* The timer identifier. In this case this is not used as the timer has its own callback. */
+ ( void * ) 0, /* The timer identifier. Initialise to 0, then increment each time it is called. */
prvOneShotTimerCallback ); /* The callback to be called when the timer expires. */
if( xOneShotTimer == NULL )
@@ -1062,9 +1062,22 @@ uint32_t ulTimerID;
static void prvOneShotTimerCallback( TimerHandle_t pxExpiredTimer )
{
- /* The parameter is not used in this case as only one timer uses this
- callback function. */
- ( void ) pxExpiredTimer;
+/* A count is kept of the number of times this callback function is executed.
+The count is stored as the timer's ID. This is only done to test the
+vTimerSetTimerID() function. */
+static uint32_t ulCallCount = 0;
+uint32_t ulLastCallCount;
+
+ /* Obtain the timer's ID, which should be a count of the number of times
+ this callback function has been executed. */
+ ulLastCallCount = ( uint32_t ) pvTimerGetTimerID( pxExpiredTimer );
+ configASSERT( ulLastCallCount == ulCallCount );
+
+ /* Increment the call count, then save it back as the timer's ID. This is
+ only done to test the vTimerSetTimerID() API function. */
+ ulLastCallCount++;
+ vTimerSetTimerID( pxExpiredTimer, ( void * ) ulLastCallCount );
+ ulCallCount++;
ucOneShotTimerCounter++;
}