Move the MSVC/lwIP code into the main line - not yet tested since moved.

This commit is contained in:
Richard Barry 2011-08-01 10:58:22 +00:00
parent d53ed61cab
commit 723bed71bf
5 changed files with 97 additions and 280 deletions

View file

@ -54,7 +54,7 @@
</Midl> </Midl>
<ClCompile> <ClCompile>
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\Common\ethernet\lwip-1.4.0\ports\win32\WinPCap;..\Common\ethernet\lwip-1.4.0\src\include\ipv4;..\Common\ethernet\lwip-1.4.0\src\include;..\..\Source\include;..\..\Source\portable\MSVC-MingW;..\Common\ethernet\lwip-1.4.0\ports\win32\include;..\Common\Include;.\lwIP_Apps;.;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>..\Common\Utils;..\Common\ethernet\lwip-1.4.0\ports\win32\WinPCap;..\Common\ethernet\lwip-1.4.0\src\include\ipv4;..\Common\ethernet\lwip-1.4.0\src\include;..\..\Source\include;..\..\Source\portable\MSVC-MingW;..\Common\ethernet\lwip-1.4.0\ports\win32\include;..\Common\Include;.\lwIP_Apps;.;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_WINSOCKAPI_;WIN32;_DEBUG;_CONSOLE;_WIN32_WINNT=0x0500;WINVER=0x400;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>_WINSOCKAPI_;WIN32;_DEBUG;_CONSOLE;_WIN32_WINNT=0x0500;WINVER=0x400;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild> <MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
@ -168,21 +168,11 @@
<ClCompile Include="..\Common\ethernet\lwip-1.4.0\src\core\tcp_out.c" /> <ClCompile Include="..\Common\ethernet\lwip-1.4.0\src\core\tcp_out.c" />
<ClCompile Include="..\Common\ethernet\lwip-1.4.0\src\core\udp.c" /> <ClCompile Include="..\Common\ethernet\lwip-1.4.0\src\core\udp.c" />
<ClCompile Include="..\Common\ethernet\lwip-1.4.0\src\netif\etharp.c" /> <ClCompile Include="..\Common\ethernet\lwip-1.4.0\src\netif\etharp.c" />
<ClCompile Include="..\Common\Minimal\BlockQ.c" />
<ClCompile Include="..\Common\Minimal\blocktim.c" />
<ClCompile Include="..\Common\Minimal\countsem.c" />
<ClCompile Include="..\Common\Minimal\flop.c" />
<ClCompile Include="..\Common\Minimal\GenQTest.c" /> <ClCompile Include="..\Common\Minimal\GenQTest.c" />
<ClCompile Include="..\Common\Minimal\integer.c" />
<ClCompile Include="..\Common\Minimal\PollQ.c" />
<ClCompile Include="..\Common\Minimal\QPeek.c" />
<ClCompile Include="..\Common\Minimal\semtest.c" />
<ClCompile Include="..\Common\Minimal\timerdemo.c" />
<ClCompile Include="..\Common\Utils\CommandInterpreter.c" /> <ClCompile Include="..\Common\Utils\CommandInterpreter.c" />
<ClCompile Include="DemosModifiedForLowTickRate\recmutex.c" /> <ClCompile Include="lwIP_Apps\apps\BasicSocketCommandServer\BasicSocketCommandServer.c" />
<ClCompile Include="lwIP_Apps\apps\httpserver_raw\fs.c" /> <ClCompile Include="lwIP_Apps\apps\httpserver_raw_from_lwIP_download\fs.c" />
<ClCompile Include="lwIP_Apps\apps\httpserver_raw\httpd.c" /> <ClCompile Include="lwIP_Apps\apps\httpserver_raw_from_lwIP_download\httpd.c" />
<ClCompile Include="lwIP_Apps\BasicSocketCommandServer.c" />
<ClCompile Include="lwIP_Apps\lwIP_Apps.c" /> <ClCompile Include="lwIP_Apps\lwIP_Apps.c" />
<ClCompile Include="main.c"> <ClCompile Include="main.c">
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>

View file

@ -25,9 +25,6 @@
<Filter Include="FreeRTOS Source\Source\Portable"> <Filter Include="FreeRTOS Source\Source\Portable">
<UniqueIdentifier>{88f409e6-d396-4ac5-94bd-7a99c914be46}</UniqueIdentifier> <UniqueIdentifier>{88f409e6-d396-4ac5-94bd-7a99c914be46}</UniqueIdentifier>
</Filter> </Filter>
<Filter Include="Demo App Source\Common Demo Tasks\ModifiedForLowTickRate">
<UniqueIdentifier>{143cf5a3-f134-4439-9f71-a201ae23b44b}</UniqueIdentifier>
</Filter>
<Filter Include="Configuration Files"> <Filter Include="Configuration Files">
<UniqueIdentifier>{19ff1a34-36de-4c48-9d10-3fb1fa0d1fa4}</UniqueIdentifier> <UniqueIdentifier>{19ff1a34-36de-4c48-9d10-3fb1fa0d1fa4}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl</Extensions> <Extensions>h;hpp;hxx;hm;inl</Extensions>
@ -74,7 +71,10 @@
<Filter Include="lwIP_Apps"> <Filter Include="lwIP_Apps">
<UniqueIdentifier>{c3366d35-95df-4c03-a752-3ae631ec6bba}</UniqueIdentifier> <UniqueIdentifier>{c3366d35-95df-4c03-a752-3ae631ec6bba}</UniqueIdentifier>
</Filter> </Filter>
<Filter Include="lwIP_Apps\httpd_raw"> <Filter Include="lwIP_Apps\BasicSocketCommandServer">
<UniqueIdentifier>{92b32a46-5658-4c53-b5de-3b174955a777}</UniqueIdentifier>
</Filter>
<Filter Include="lwIP_Apps\httpd_raw_from_lwIP_download">
<UniqueIdentifier>{6c4a261d-ca37-4528-ad50-8f04032898cb}</UniqueIdentifier> <UniqueIdentifier>{6c4a261d-ca37-4528-ad50-8f04032898cb}</UniqueIdentifier>
</Filter> </Filter>
</ItemGroup> </ItemGroup>
@ -97,42 +97,12 @@
<ClCompile Include="..\..\Source\portable\MSVC-MingW\port.c"> <ClCompile Include="..\..\Source\portable\MSVC-MingW\port.c">
<Filter>FreeRTOS Source\Source\Portable</Filter> <Filter>FreeRTOS Source\Source\Portable</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\Common\Minimal\flop.c">
<Filter>Demo App Source\Common Demo Tasks</Filter>
</ClCompile>
<ClCompile Include="..\Common\Minimal\GenQTest.c"> <ClCompile Include="..\Common\Minimal\GenQTest.c">
<Filter>Demo App Source\Common Demo Tasks</Filter> <Filter>Demo App Source\Common Demo Tasks</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\Common\Minimal\integer.c">
<Filter>Demo App Source\Common Demo Tasks</Filter>
</ClCompile>
<ClCompile Include="..\Common\Minimal\PollQ.c">
<Filter>Demo App Source\Common Demo Tasks</Filter>
</ClCompile>
<ClCompile Include="..\Common\Minimal\QPeek.c">
<Filter>Demo App Source\Common Demo Tasks</Filter>
</ClCompile>
<ClCompile Include="..\Common\Minimal\semtest.c">
<Filter>Demo App Source\Common Demo Tasks</Filter>
</ClCompile>
<ClCompile Include="..\Common\Minimal\BlockQ.c">
<Filter>Demo App Source\Common Demo Tasks</Filter>
</ClCompile>
<ClCompile Include="..\Common\Minimal\blocktim.c">
<Filter>Demo App Source\Common Demo Tasks</Filter>
</ClCompile>
<ClCompile Include="DemosModifiedForLowTickRate\recmutex.c">
<Filter>Demo App Source\Common Demo Tasks\ModifiedForLowTickRate</Filter>
</ClCompile>
<ClCompile Include="..\..\Source\timers.c"> <ClCompile Include="..\..\Source\timers.c">
<Filter>FreeRTOS Source\Source</Filter> <Filter>FreeRTOS Source\Source</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\Common\Minimal\timerdemo.c">
<Filter>Demo App Source\Common Demo Tasks</Filter>
</ClCompile>
<ClCompile Include="..\Common\Minimal\countsem.c">
<Filter>Demo App Source\Common Demo Tasks</Filter>
</ClCompile>
<ClCompile Include="..\Common\ethernet\lwip-1.4.0\src\api\tcpip.c"> <ClCompile Include="..\Common\ethernet\lwip-1.4.0\src\api\tcpip.c">
<Filter>lwIP\Source\API</Filter> <Filter>lwIP\Source\API</Filter>
</ClCompile> </ClCompile>
@ -256,21 +226,21 @@
<ClCompile Include="..\Common\ethernet\lwip-1.4.0\src\core\snmp\msg_in.c"> <ClCompile Include="..\Common\ethernet\lwip-1.4.0\src\core\snmp\msg_in.c">
<Filter>lwIP\Source\Core\SNMP</Filter> <Filter>lwIP\Source\Core\SNMP</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="lwIP_Apps\apps\httpserver_raw\httpd.c">
<Filter>lwIP_Apps\httpd_raw</Filter>
</ClCompile>
<ClCompile Include="lwIP_Apps\apps\httpserver_raw\fs.c">
<Filter>lwIP_Apps\httpd_raw</Filter>
</ClCompile>
<ClCompile Include="lwIP_Apps\lwIP_Apps.c"> <ClCompile Include="lwIP_Apps\lwIP_Apps.c">
<Filter>lwIP_Apps</Filter> <Filter>lwIP_Apps</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="lwIP_Apps\BasicSocketCommandServer.c">
<Filter>lwIP_Apps</Filter>
</ClCompile>
<ClCompile Include="..\Common\Utils\CommandInterpreter.c"> <ClCompile Include="..\Common\Utils\CommandInterpreter.c">
<Filter>Demo App Source</Filter> <Filter>Demo App Source</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="lwIP_Apps\apps\BasicSocketCommandServer\BasicSocketCommandServer.c">
<Filter>lwIP_Apps\BasicSocketCommandServer</Filter>
</ClCompile>
<ClCompile Include="lwIP_Apps\apps\httpserver_raw_from_lwIP_download\httpd.c">
<Filter>lwIP_Apps\httpd_raw_from_lwIP_download</Filter>
</ClCompile>
<ClCompile Include="lwIP_Apps\apps\httpserver_raw_from_lwIP_download\fs.c">
<Filter>lwIP_Apps\httpd_raw_from_lwIP_download</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="FreeRTOSConfig.h"> <ClInclude Include="FreeRTOSConfig.h">

View file

@ -66,6 +66,7 @@
#include "CommandInterpreter.h" #include "CommandInterpreter.h"
#define cmdMAX_INPUT_SIZE 20 #define cmdMAX_INPUT_SIZE 20
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
void vBasicTelnetServer( void *pvParameters ) void vBasicTelnetServer( void *pvParameters )
@ -133,7 +134,7 @@ signed char cInputString[ cmdMAX_INPUT_SIZE ];
{ {
/* The input string was not a quit command. /* The input string was not a quit command.
Pass the string to the command interpreter. */ Pass the string to the command interpreter. */
while( ( pcString = pcProcessCommand( cInputString ) ) != NULL ) while( ( pcString = pcCmdIntProcessCommand( cInputString ) ) != NULL )
{ {
/* A string has been generated by the /* A string has been generated by the
command interpreter. Send it. */ command interpreter. Send it. */

View file

@ -74,19 +74,7 @@
#include "netif/etharp.h" #include "netif/etharp.h"
/* applications includes */ /* applications includes */
#include "apps/httpserver_raw/httpd.h" #include "apps/httpserver_raw_from_lwIP_download/httpd.h"
#include "apps/httpserver/httpserver-netconn.h"
#include "apps/netio/netio.h"
#include "apps/netbios/netbios.h"
#include "apps/ping/ping.h"
#include "apps/rtp/rtp.h"
#include "apps/sntp/sntp.h"
#include "apps/chargen/chargen.h"
#include "apps/shell/shell.h"
#include "apps/tcpecho/tcpecho.h"
#include "apps/udpecho/udpecho.h"
#include "apps/tcpecho_raw/echo.h"
#include "apps/socket_examples/socket_examples.h"
/* include the port-dependent configuration */ /* include the port-dependent configuration */
#include "lwipcfg_msvc.h" #include "lwipcfg_msvc.h"
@ -149,67 +137,12 @@ extern err_t ethernetif_init( struct netif *netif );
/* This function initializes applications */ /* This function initializes applications */
static void apps_init( void ) static void apps_init( void )
{ {
/* Taken from the lwIP example code. */ /* Create the httpd server from the standard lwIP code. This demonstrates
use of the lwIP raw API. */
#if LWIP_DNS_APP && LWIP_DNS httpd_init();
/* wait until the netif is up (for dhcp, autoip or ppp) */
sys_timeout(5000, dns_dorequest, NULL);
#endif /* LWIP_DNS_APP && LWIP_DNS */
#if LWIP_CHARGEN_APP && LWIP_SOCKET
chargen_init();
#endif /* LWIP_CHARGEN_APP && LWIP_SOCKET */
#if LWIP_PING_APP && LWIP_RAW && LWIP_ICMP
ping_init();
#endif /* LWIP_PING_APP && LWIP_RAW && LWIP_ICMP */
#if LWIP_NETBIOS_APP && LWIP_UDP
netbios_init();
#endif /* LWIP_NETBIOS_APP && LWIP_UDP */
#if LWIP_HTTPD_APP && LWIP_TCP
{
#ifdef LWIP_HTTPD_APP_NETCONN
http_server_netconn_init();
#else /* LWIP_HTTPD_APP_NETCONN */
httpd_init();
#endif /* LWIP_HTTPD_APP_NETCONN */
}
#endif /* LWIP_HTTPD_APP && LWIP_TCP */
#if LWIP_NETIO_APP && LWIP_TCP
netio_init();
#endif /* LWIP_NETIO_APP && LWIP_TCP */
#if LWIP_RTP_APP && LWIP_SOCKET && LWIP_IGMP
rtp_init();
#endif /* LWIP_RTP_APP && LWIP_SOCKET && LWIP_IGMP */
#if LWIP_SNTP_APP && LWIP_SOCKET
sntp_init();
#endif /* LWIP_SNTP_APP && LWIP_SOCKET */
#if LWIP_SHELL_APP && LWIP_NETCONN
shell_init();
#endif /* LWIP_SHELL_APP && LWIP_NETCONN */
#if LWIP_TCPECHO_APP
#if LWIP_NETCONN && defined(LWIP_TCPECHO_APP_NETCONN)
tcpecho_init();
#else /* LWIP_NETCONN && defined(LWIP_TCPECHO_APP_NETCONN) */
echo_init();
#endif
#endif /* LWIP_TCPECHO_APP && LWIP_NETCONN */
#if LWIP_UDPECHO_APP && LWIP_NETCONN
udpecho_init();
#endif /* LWIP_UDPECHO_APP && LWIP_NETCONN */
#if LWIP_SOCKET_EXAMPLES_APP && LWIP_SOCKET
socket_examples_init();
#endif /* LWIP_SOCKET_EXAMPLES_APP && LWIP_SOCKET */
/* Create the FreeRTOS defined basic command server. This demonstrates use
of the lwIP sockets API. */
xTaskCreate( vBasicTelnetServer, ( signed char * ) "Telnet", configMINIMAL_STACK_SIZE * 10, NULL, configMAX_PRIORITIES - 2, NULL ); xTaskCreate( vBasicTelnetServer, ( signed char * ) "Telnet", configMINIMAL_STACK_SIZE * 10, NULL, configMAX_PRIORITIES - 2, NULL );
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/

View file

@ -60,44 +60,31 @@
* *
* - READ THE WEB DOCUMENTATION FOR THIS PORT FOR MORE INFORMATION ON USING IT - * - READ THE WEB DOCUMENTATION FOR THIS PORT FOR MORE INFORMATION ON USING IT -
* - http://www.freertos.org/FreeRTOS-Windows-Simulator-Emulator-for-Visual-Studio-and-Eclipse-MingW.html * - http://www.freertos.org/FreeRTOS-Windows-Simulator-Emulator-for-Visual-Studio-and-Eclipse-MingW.html
* - Note that the above linked page describes the simulator environment. It
* - is not the correct page to view for information on using this lwIP demo.
******************************************************************************* *******************************************************************************
* *
* main() creates all the demo application tasks, then starts the scheduler. * This project demonstrates use of the lwIP stack. The lwIP raw API is
* The web documentation provides more details of the standard demo application * demonstrated by a simple http server that comes as part of the lwIP
* tasks, which provide no particular functionality but do provide a good * distribution - and executes in the tcpip task. The lwIP sockets API
* example of how to use the FreeRTOS API. * is demonstrated by a simple command line interpreter interface, which
* executes in its own task.
* *
* In addition to the standard demo tasks, the following tasks and tests are * Both the http and command line server can be used to view task stats, and
* defined and/or created within this file: * run time stats. Task stats give a snapshot of the state of each task in
* the system. Run time stats show how much processing time has been allocated
* to each task. A few of the standard demo tasks are created, just to ensure
* there is some data to be viewed.
* *
* "Check" task - This only executes every five seconds but has a high priority * Finally, a check timer is created. The check timer is a software timer that
* to ensure it gets processor time. Its main function is to check that all the * inspects the few standard demo tasks that are created to ensure they are
* standard demo tasks are still operational. While no errors have been * executing as expected. It maintains a status string that can be viewed on
* discovered the check task will print out "OK" and the current simulated tick * the "task stats" page served by the web server.
* time. If an error is discovered in the execution of a task then the check
* task will print out an appropriate error message.
* *
* lwIP - This project also includes a simple lwIP example. The implements a * More information about this demo, including details of how to set up the
* web server that includes Server Side Include (SSI) functionality. The web * network interface, and the command line commands that are available, is
* server serves a page that shows task statistics, and another page that shows * available on the documentation page for this demo on the
* run time statistics (how much CPU time each task is consuming). Following * http://www.FreeRTOS.org web site.
* are some notes on the web server functionality:
* - Configuration parameters (IP address, etc.) are set at the bottom of
* FreeRTOSConfig.h. In particular, the number of the WinPCap interface to
* open is set by the configNETWORK_INTERFACE_TO_USE parameter.
* - A WinPCap driver is provided in
* FreeRTOS\Demo\Common\ethernet\lwip-1.4.0\ports\win32\ethernetif.c.
* - Currently, the files served by the web server are converted into C structs,
* and built into the executable image. The html and image files are converted
* to C structs using the makefsdata.exe binary found in
* FreeRTOS\Demo\WIN32-MSVC\lwIP_Apps\apps\httpserver_raw\makefsdata. A
* Microsoft Visual Studio Express 10 project file that builds the .exe is
* located in the same directory.
* - Makefsdata.exe outputs a file called fsdata.c. fsdata.c must be copied
* into FreeRTOS\Demo\WIN32-MSVC\lwIP_Apps\apps\httpserver_raw prior to the
* project being built.
* - The SSI generator functions are located in
* FreeRTOS\Demo\WIN32-MSVC\lwIP_Apps\lwIP_Apps.c
* *
*/ */
@ -108,19 +95,10 @@
/* Kernel includes. */ /* Kernel includes. */
#include <FreeRTOS.h> #include <FreeRTOS.h>
#include "task.h" #include "task.h"
#include "queue.h" #include "timers.h"
/* Standard demo includes. */ /* Standard demo includes. */
#include "BlockQ.h"
#include "integer.h"
#include "semtest.h"
#include "PollQ.h"
#include "GenQTest.h" #include "GenQTest.h"
#include "QPeek.h"
#include "recmutex.h"
#include "flop.h"
#include "TimerDemo.h"
#include "countsem.h"
/* lwIP includes. */ /* lwIP includes. */
#include "lwip/tcpip.h" #include "lwip/tcpip.h"
@ -129,21 +107,15 @@
#include "CommandInterpreter.h" #include "CommandInterpreter.h"
/* Priorities at which the tasks are created. */ /* Priorities at which the tasks are created. */
#define mainCHECK_TASK_PRIORITY ( configMAX_PRIORITIES - 1 )
#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 1 )
#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1 )
#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 )
#define mainCREATOR_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 )
#define mainFLASH_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 )
#define mainuIP_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 )
#define mainINTEGER_TASK_PRIORITY ( tskIDLE_PRIORITY )
#define mainGEN_QUEUE_TASK_PRIORITY ( tskIDLE_PRIORITY ) #define mainGEN_QUEUE_TASK_PRIORITY ( tskIDLE_PRIORITY )
#define mainFLOP_TASK_PRIORITY ( tskIDLE_PRIORITY )
#define mainTIMER_TEST_PERIOD ( 50 ) /* The period at which the check timer will expire, in ms, provided no errors
have been reported by any of the standard demo tasks. ms are converted to the
equivalent in ticks using the portTICK_RATE_MS constant. */
#define mainCHECK_TIMER_PERIOD_MS ( 3000UL / portTICK_RATE_MS )
/* Task function prototypes. */ /* Check timer callback function. */
static void prvCheckTask( void *pvParameters ); static void prvCheckTimerCallback( xTimerHandle xTimer );
/* Defined in lwIPApps.c. */ /* Defined in lwIPApps.c. */
extern void lwIPAppsInit( void *pvArguments ); extern void lwIPAppsInit( void *pvArguments );
@ -162,13 +134,16 @@ static char *pcStatusMessage = "All tasks running without error";
stats record how much time each task spends in the Running state. */ stats record how much time each task spends in the Running state. */
long long llInitialRunTimeCounterValue = 0LL, llRunTimeStatsDivisor = 0LL; long long llInitialRunTimeCounterValue = 0LL, llRunTimeStatsDivisor = 0LL;
/* The check timer. This uses prvCheckTimerCallback() as its callback
function. */
static xTimerHandle xCheckTimer = NULL;
/* Structure that defines the "run-time-stats" command line command. */ /* Structure that defines the "run-time-stats" command line command. */
static const xCommandLineInput xRunTimeStats = static const xCommandLineInput xRunTimeStats =
{ {
"run-time-stats", "run-time-stats",
"run-time-stats: Displays a table showing how much processing time each FreeRTOS task has used\r\n", "run-time-stats: Displays a table showing how much processing time each FreeRTOS task has used\r\n",
prvRunTimeStatsCommand, prvRunTimeStatsCommand,
NULL
}; };
/* Structure that defines the "task-stats" command line command. */ /* Structure that defines the "task-stats" command line command. */
@ -177,110 +152,67 @@ static const xCommandLineInput xTaskStats =
"task-stats", "task-stats",
"task-stats: Displays a table showing the state of each FreeRTOS task\r\n", "task-stats: Displays a table showing the state of each FreeRTOS task\r\n",
prvTaskStatsCommand, prvTaskStatsCommand,
&xRunTimeStats
}; };
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
int main( void ) int main( void )
{ {
const unsigned long ulLongTime_ms = 1000UL;
/* This call creates the TCP/IP thread. */ /* This call creates the TCP/IP thread. */
tcpip_init( lwIPAppsInit, NULL ); tcpip_init( lwIPAppsInit, NULL );
#if configINCLUDE_STANDARD_DEMO_TASKS == 1 /* Create and start the check timer, as described at the top of this file. */
{ xCheckTimer = xTimerCreate( ( const signed char * ) "CheckTimer",/* A text name, purely to help debugging. */
/* Start the check task as described at the top of this file. */ ( mainCHECK_TIMER_PERIOD_MS ), /* The timer period, in this case 3000ms (3s). */
xTaskCreate( prvCheckTask, ( signed char * ) "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL ); pdTRUE, /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */
( void * ) 0, /* The ID is not used, so can be set to anything. */
prvCheckTimerCallback /* The callback function that inspects the status of all the other tasks. */
);
/* Create the standard demo tasks. */ /* Sanity check that the timer was created. */
vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY ); configASSERT( xCheckTimer );
vStartSemaphoreTasks( mainSEM_TEST_PRIORITY );
vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY ); /* Start the check timer. */
vStartIntegerMathTasks( mainINTEGER_TASK_PRIORITY ); xTimerStart( xCheckTimer, 0UL );
vStartGenericQueueTasks( mainGEN_QUEUE_TASK_PRIORITY );
vStartQueuePeekTasks(); /* Create a few standard demo tasks, just so there are tasks running to
vStartMathTasks( mainFLOP_TASK_PRIORITY ); view on the web server and via the command line command interpreter. */
vStartRecursiveMutexTasks(); vStartGenericQueueTasks( mainGEN_QUEUE_TASK_PRIORITY );
vStartTimerDemoTask( mainTIMER_TEST_PERIOD );
vStartCountingSemaphoreTasks();
}
#endif
/* Register two command line commands to show task stats and run time stats /* Register two command line commands to show task stats and run time stats
respectively. */ respectively. */
vCmdIntRegisterCommand( &xTaskStats ); xCmdIntRegisterCommand( &xTaskStats );
vCmdIntRegisterCommand( &xRunTimeStats ); xCmdIntRegisterCommand( &xRunTimeStats );
/* Start the scheduler itself. */ /* Start the scheduler itself. */
vTaskStartScheduler(); vTaskStartScheduler();
/* Should never get here unless there was not enough heap space to create /* This line should never be reached. If it does execute then there was
the idle and other system tasks. */ insufficient FreeRTOS heap memory available for the idle and/or timer
return 0; tasks to be created. */
for( ;; )
{
Sleep( ulLongTime_ms );
}
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
static void prvCheckTask( void *pvParameters ) static void prvCheckTimerCallback( xTimerHandle xTimer )
{ {
portTickType xNextWakeTime; /* The parameter is not used in this case. */
const portTickType xCycleFrequency = 1000 / portTICK_RATE_MS; ( void ) xTimer;
/* Just to remove compiler warning. */ /* Check the standard demo tasks are running without error. Latch the
( void ) pvParameters; latest reported error in the pcStatusMessage character pointer. The latched
string can be viewed using the embedded web server and the command line
/* Initialise xNextWakeTime - this only needs to be done once. */ interpreter. This project is really to demonstrate the lwIP stack - so very
xNextWakeTime = xTaskGetTickCount(); few tasks are created - and those that are created are created purely so
there is something to view. */
for( ;; ) if( xAreGenericQueueTasksStillRunning() != pdTRUE )
{ {
/* Place this task in the blocked state until it is time to run again. */ pcStatusMessage = "Error: The GenQueue test reported an error.";
vTaskDelayUntil( &xNextWakeTime, xCycleFrequency );
/* Check the standard demo tasks are running without error. */
if( xAreTimerDemoTasksStillRunning( xCycleFrequency ) != pdTRUE )
{
pcStatusMessage = "Error: TimerDemo";
}
else if( xAreIntegerMathsTaskStillRunning() != pdTRUE )
{
pcStatusMessage = "Error: IntMath";
}
else if( xAreGenericQueueTasksStillRunning() != pdTRUE )
{
pcStatusMessage = "Error: GenQueue";
}
else if( xAreQueuePeekTasksStillRunning() != pdTRUE )
{
pcStatusMessage = "Error: QueuePeek";
}
else if( xAreBlockingQueuesStillRunning() != pdTRUE )
{
pcStatusMessage = "Error: BlockQueue";
}
else if( xAreSemaphoreTasksStillRunning() != pdTRUE )
{
pcStatusMessage = "Error: SemTest";
}
else if( xArePollingQueuesStillRunning() != pdTRUE )
{
pcStatusMessage = "Error: PollQueue";
}
else if( xAreMathsTaskStillRunning() != pdPASS )
{
pcStatusMessage = "Error: Flop";
}
else if( xAreRecursiveMutexTasksStillRunning() != pdTRUE )
{
pcStatusMessage = "Error: RecMutex";
}
else if( xAreCountingSemaphoreTasksStillRunning() != pdTRUE )
{
pcStatusMessage = "Error: CountSem";
}
/* This is the only task that uses stdout so its ok to call printf()
directly. */
printf( "%s - %d\r\n", pcStatusMessage, xTaskGetTickCount() );
} }
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
@ -323,18 +255,6 @@ const unsigned long ulLongSleep = 1000UL;
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
void vApplicationTickHook( void )
{
#if configINCLUDE_STANDARD_DEMO_TASKS == 1
{
/* Call the periodic timer test, which tests the timer API functions that
can be called from an ISR. */
vTimerPeriodicISRTests();
}
#endif
}
/*-----------------------------------------------------------*/
void vAssertCalled( void ) void vAssertCalled( void )
{ {
const unsigned long ulLongSleep = 1000UL; const unsigned long ulLongSleep = 1000UL;
@ -398,6 +318,7 @@ unsigned long ulReturn;
static const signed char *prvTaskStatsCommand( void ) static const signed char *prvTaskStatsCommand( void )
{ {
static signed char *pcReturn = NULL; static signed char *pcReturn = NULL;
static char cTxBuffer[ 1024 ]; /*_RB_ Remove this. */
/* This is the callback function that is executed when the command line /* This is the callback function that is executed when the command line
command defined by the xTaskStats structure is entered. This function command defined by the xTaskStats structure is entered. This function
@ -425,6 +346,8 @@ static signed char *pcReturn = NULL;
static const signed char *prvRunTimeStatsCommand( void ) static const signed char *prvRunTimeStatsCommand( void )
{ {
static signed char *pcReturn = NULL; static signed char *pcReturn = NULL;
static char cTxBuffer[ 1024 ]; /*_RB_ Remove this. */
/* This is the callback function that is executed when the command line /* This is the callback function that is executed when the command line
command defined by the xRunTimeStats structure is entered. This function command defined by the xRunTimeStats structure is entered. This function