mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-04-19 21:11:57 -04:00
Start to remove unnecessary 'signed char *' casts from strings that are now just plain char * types.
This commit is contained in:
parent
b4116a7c7d
commit
da93f1fc4b
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
All rights reserved
|
All rights reserved
|
||||||
|
|
||||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
@ -63,9 +63,9 @@
|
||||||
1 tab == 4 spaces!
|
1 tab == 4 spaces!
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
NOTE : Tasks run in system mode and the scheduler runs in Supervisor mode.
|
NOTE : Tasks run in system mode and the scheduler runs in Supervisor mode.
|
||||||
The processor MUST be in supervisor mode when vTaskStartScheduler is
|
The processor MUST be in supervisor mode when vTaskStartScheduler is
|
||||||
called. The demo applications included in the FreeRTOS.org download switch
|
called. The demo applications included in the FreeRTOS.org download switch
|
||||||
to supervisor mode prior to main being called. If you are not using one of
|
to supervisor mode prior to main being called. If you are not using one of
|
||||||
these demo application projects then ensure Supervisor mode is used.
|
these demo application projects then ensure Supervisor mode is used.
|
||||||
|
@ -75,21 +75,21 @@
|
||||||
/*
|
/*
|
||||||
* Creates all the demo application tasks, then starts the scheduler. The WEB
|
* Creates all the demo application tasks, then starts the scheduler. The WEB
|
||||||
* documentation provides more details of the demo application tasks.
|
* documentation provides more details of the demo application tasks.
|
||||||
*
|
*
|
||||||
* Main.c also creates a task called "Check". This only executes every three
|
* Main.c also creates a task called "Check". This only executes every three
|
||||||
* seconds but has the highest priority so is guaranteed to get processor time.
|
* seconds but has the highest priority so is guaranteed to get processor time.
|
||||||
* Its main function is to check that all the other tasks are still operational.
|
* Its main function is to check that all the other tasks are still operational.
|
||||||
* Each task (other than the "flash" tasks) maintains a unique count that is
|
* Each task (other than the "flash" tasks) maintains a unique count that is
|
||||||
* incremented each time the task successfully completes its function. Should
|
* incremented each time the task successfully completes its function. Should
|
||||||
* any error occur within such a task the count is permanently halted. The
|
* any error occur within such a task the count is permanently halted. The
|
||||||
* check task inspects the count of each task to ensure it has changed since
|
* check task inspects the count of each task to ensure it has changed since
|
||||||
* the last time the check task executed. If all the count variables have
|
* the last time the check task executed. If all the count variables have
|
||||||
* changed all the tasks are still executing error free, and the check task
|
* changed all the tasks are still executing error free, and the check task
|
||||||
* toggles the onboard LED. Should any task contain an error at any time
|
* toggles the onboard LED. Should any task contain an error at any time
|
||||||
* the LED toggle rate will change from 3 seconds to 500ms.
|
* the LED toggle rate will change from 3 seconds to 500ms.
|
||||||
*
|
*
|
||||||
* To check the operation of the memory allocator the check task also
|
* To check the operation of the memory allocator the check task also
|
||||||
* dynamically creates a task before delaying, and deletes it again when it
|
* dynamically creates a task before delaying, and deletes it again when it
|
||||||
* wakes. If memory cannot be allocated for the new task the call to xTaskCreate
|
* wakes. If memory cannot be allocated for the new task the call to xTaskCreate
|
||||||
* will fail and an error is signalled. The dynamically created task itself
|
* will fail and an error is signalled. The dynamically created task itself
|
||||||
* allocates and frees memory just to give the allocator a bit more exercise.
|
* allocates and frees memory just to give the allocator a bit more exercise.
|
||||||
|
@ -134,7 +134,7 @@
|
||||||
#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1 )
|
#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1 )
|
||||||
#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 )
|
#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 )
|
||||||
|
|
||||||
/* The rate at which the on board LED will toggle when there is/is not an
|
/* The rate at which the on board LED will toggle when there is/is not an
|
||||||
error. */
|
error. */
|
||||||
#define mainNO_ERROR_FLASH_PERIOD ( ( portTickType ) 3000 / portTICK_RATE_MS )
|
#define mainNO_ERROR_FLASH_PERIOD ( ( portTickType ) 3000 / portTICK_RATE_MS )
|
||||||
#define mainERROR_FLASH_PERIOD ( ( portTickType ) 500 / portTICK_RATE_MS )
|
#define mainERROR_FLASH_PERIOD ( ( portTickType ) 500 / portTICK_RATE_MS )
|
||||||
|
@ -171,7 +171,7 @@ static const unsigned long ululCSRWaitValues[ MAX_WAIT_STATES + 1 ] =
|
||||||
static long prvCheckOtherTasksAreStillRunning( unsigned long ulMemCheckTaskCount );
|
static long prvCheckOtherTasksAreStillRunning( unsigned long ulMemCheckTaskCount );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The task that executes at the highest priority and calls
|
* The task that executes at the highest priority and calls
|
||||||
* prvCheckOtherTasksAreStillRunning(). See the description at the top
|
* prvCheckOtherTasksAreStillRunning(). See the description at the top
|
||||||
* of the file.
|
* of the file.
|
||||||
*/
|
*/
|
||||||
|
@ -193,7 +193,7 @@ static void prvSetupHardware( void );
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Starts all the other tasks, then starts the scheduler.
|
* Starts all the other tasks, then starts the scheduler.
|
||||||
*/
|
*/
|
||||||
int main( void )
|
int main( void )
|
||||||
{
|
{
|
||||||
|
@ -207,16 +207,16 @@ int main( void )
|
||||||
vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY );
|
vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY );
|
||||||
vStartMathTasks( tskIDLE_PRIORITY );
|
vStartMathTasks( tskIDLE_PRIORITY );
|
||||||
vStartSemaphoreTasks( mainSEM_TEST_PRIORITY );
|
vStartSemaphoreTasks( mainSEM_TEST_PRIORITY );
|
||||||
vStartDynamicPriorityTasks();
|
vStartDynamicPriorityTasks();
|
||||||
vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY );
|
vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY );
|
||||||
|
|
||||||
/* Start the check task - which is defined in this file. */
|
/* Start the check task - which is defined in this file. */
|
||||||
xTaskCreate( vErrorChecks, ( signed char * ) "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );
|
xTaskCreate( vErrorChecks, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );
|
||||||
|
|
||||||
/* Now all the tasks have been started - start the scheduler.
|
/* Now all the tasks have been started - start the scheduler.
|
||||||
|
|
||||||
NOTE : Tasks run in system mode and the scheduler runs in Supervisor mode.
|
NOTE : Tasks run in system mode and the scheduler runs in Supervisor mode.
|
||||||
The processor MUST be in supervisor mode when vTaskStartScheduler is
|
The processor MUST be in supervisor mode when vTaskStartScheduler is
|
||||||
called. The demo applications included in the FreeRTOS.org download switch
|
called. The demo applications included in the FreeRTOS.org download switch
|
||||||
to supervisor mode prior to main being called. If you are not using one of
|
to supervisor mode prior to main being called. If you are not using one of
|
||||||
these demo application projects then ensure Supervisor mode is used here. */
|
these demo application projects then ensure Supervisor mode is used here. */
|
||||||
|
@ -239,24 +239,24 @@ xTaskHandle xCreatedTask;
|
||||||
/* Cycle for ever, delaying then checking all the other tasks are still
|
/* Cycle for ever, delaying then checking all the other tasks are still
|
||||||
operating without error. If an error is detected then the delay period
|
operating without error. If an error is detected then the delay period
|
||||||
is decreased from mainNO_ERROR_FLASH_PERIOD to mainERROR_FLASH_PERIOD so
|
is decreased from mainNO_ERROR_FLASH_PERIOD to mainERROR_FLASH_PERIOD so
|
||||||
the on board LED flash rate will increase.
|
the on board LED flash rate will increase.
|
||||||
|
|
||||||
In addition to the standard tests the memory allocator is tested through
|
In addition to the standard tests the memory allocator is tested through
|
||||||
the dynamic creation and deletion of a task each cycle. Each time the
|
the dynamic creation and deletion of a task each cycle. Each time the
|
||||||
task is created memory must be allocated for its stack. When the task is
|
task is created memory must be allocated for its stack. When the task is
|
||||||
deleted this memory is returned to the heap. If the task cannot be created
|
deleted this memory is returned to the heap. If the task cannot be created
|
||||||
then it is likely that the memory allocation failed. */
|
then it is likely that the memory allocation failed. */
|
||||||
|
|
||||||
for( ;; )
|
for( ;; )
|
||||||
{
|
{
|
||||||
/* Reset xCreatedTask. This is modified by the task about to be
|
/* Reset xCreatedTask. This is modified by the task about to be
|
||||||
created so we can tell if it is executing correctly or not. */
|
created so we can tell if it is executing correctly or not. */
|
||||||
xCreatedTask = mainNO_TASK;
|
xCreatedTask = mainNO_TASK;
|
||||||
|
|
||||||
/* Dynamically create a task - passing ulMemCheckTaskRunningCount as a
|
/* Dynamically create a task - passing ulMemCheckTaskRunningCount as a
|
||||||
parameter. */
|
parameter. */
|
||||||
ulMemCheckTaskRunningCount = mainCOUNT_INITIAL_VALUE;
|
ulMemCheckTaskRunningCount = mainCOUNT_INITIAL_VALUE;
|
||||||
if( xTaskCreate( vMemCheckTask, ( signed char * ) "MEM_CHECK", configMINIMAL_STACK_SIZE, ( void * ) &ulMemCheckTaskRunningCount, tskIDLE_PRIORITY, &xCreatedTask ) != pdPASS )
|
if( xTaskCreate( vMemCheckTask, "MEM_CHECK", configMINIMAL_STACK_SIZE, ( void * ) &ulMemCheckTaskRunningCount, tskIDLE_PRIORITY, &xCreatedTask ) != pdPASS )
|
||||||
{
|
{
|
||||||
/* Could not create the task - we have probably run out of heap. */
|
/* Could not create the task - we have probably run out of heap. */
|
||||||
xDelayPeriod = mainERROR_FLASH_PERIOD;
|
xDelayPeriod = mainERROR_FLASH_PERIOD;
|
||||||
|
@ -271,7 +271,7 @@ xTaskHandle xCreatedTask;
|
||||||
vTaskDelete( xCreatedTask );
|
vTaskDelete( xCreatedTask );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check all the standard demo application tasks are executing without
|
/* Check all the standard demo application tasks are executing without
|
||||||
error. ulMemCheckTaskRunningCount is checked to ensure it was
|
error. ulMemCheckTaskRunningCount is checked to ensure it was
|
||||||
modified by the task just deleted. */
|
modified by the task just deleted. */
|
||||||
if( prvCheckOtherTasksAreStillRunning( ulMemCheckTaskRunningCount ) != pdPASS )
|
if( prvCheckOtherTasksAreStillRunning( ulMemCheckTaskRunningCount ) != pdPASS )
|
||||||
|
@ -323,7 +323,7 @@ long lCount;
|
||||||
ulCSRWaitValue = WaitState5;
|
ulCSRWaitValue = WaitState5;
|
||||||
|
|
||||||
AT91C_BASE_EBI->EBI_CSR[ 0 ] = ulCSRWaitValue | DataBus16 | WaitStateEnable
|
AT91C_BASE_EBI->EBI_CSR[ 0 ] = ulCSRWaitValue | DataBus16 | WaitStateEnable
|
||||||
| PageSize1M | tDF_0cycle
|
| PageSize1M | tDF_0cycle
|
||||||
| ByteWriteAccessType | CSEnable
|
| ByteWriteAccessType | CSEnable
|
||||||
| 0x00000000 /* Base Address */;
|
| 0x00000000 /* Base Address */;
|
||||||
}
|
}
|
||||||
|
@ -352,7 +352,7 @@ long lCount;
|
||||||
/* Clear all interrupts at the AIC level initially... */
|
/* Clear all interrupts at the AIC level initially... */
|
||||||
AT91C_BASE_AIC->AIC_ICCR = 0xFFFFFFFF;
|
AT91C_BASE_AIC->AIC_ICCR = 0xFFFFFFFF;
|
||||||
|
|
||||||
/* Perform 8 "End Of Interrupt" cmds to make sure AIC will not Lock out
|
/* Perform 8 "End Of Interrupt" cmds to make sure AIC will not Lock out
|
||||||
nIRQ */
|
nIRQ */
|
||||||
for( lCount = 0; lCount < 8; lCount++ )
|
for( lCount = 0; lCount < 8; lCount++ )
|
||||||
{
|
{
|
||||||
|
@ -428,10 +428,10 @@ static long lErrorOccurred = pdFALSE;
|
||||||
vErrorChecks task to check the operation of the memory allocator. Each time
|
vErrorChecks task to check the operation of the memory allocator. Each time
|
||||||
the task is created memory is allocated for the stack and TCB. Each time
|
the task is created memory is allocated for the stack and TCB. Each time
|
||||||
the task is deleted this memory is returned to the heap. This task itself
|
the task is deleted this memory is returned to the heap. This task itself
|
||||||
exercises the allocator by allocating and freeing blocks.
|
exercises the allocator by allocating and freeing blocks.
|
||||||
|
|
||||||
The task executes at the idle priority so does not require a delay.
|
The task executes at the idle priority so does not require a delay.
|
||||||
|
|
||||||
pulMemCheckTaskRunningCounter is incremented each cycle to indicate to the
|
pulMemCheckTaskRunningCounter is incremented each cycle to indicate to the
|
||||||
vErrorChecks() task that this task is still executing without error. */
|
vErrorChecks() task that this task is still executing without error. */
|
||||||
|
|
||||||
|
@ -446,12 +446,12 @@ static long lErrorOccurred = pdFALSE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* There has been an error so reset the counter so the check task
|
/* There has been an error so reset the counter so the check task
|
||||||
can tell that an error occurred. */
|
can tell that an error occurred. */
|
||||||
*pulMemCheckTaskRunningCounter = mainCOUNT_INITIAL_VALUE;
|
*pulMemCheckTaskRunningCounter = mainCOUNT_INITIAL_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Allocate some memory - just to give the allocator some extra
|
/* Allocate some memory - just to give the allocator some extra
|
||||||
exercise. This has to be in a critical section to ensure the
|
exercise. This has to be in a critical section to ensure the
|
||||||
task does not get deleted while it has memory allocated. */
|
task does not get deleted while it has memory allocated. */
|
||||||
vTaskSuspendAll();
|
vTaskSuspendAll();
|
||||||
|
|
|
@ -98,7 +98,7 @@ PT_THREAD(file_stats(struct httpd_state *s, char *ptr))
|
||||||
PSOCK_BEGIN(&s->sout);
|
PSOCK_BEGIN(&s->sout);
|
||||||
|
|
||||||
PSOCK_GENERATOR_SEND(&s->sout, generate_file_stats, strchr(ptr, ' ') + 1);
|
PSOCK_GENERATOR_SEND(&s->sout, generate_file_stats, strchr(ptr, ' ') + 1);
|
||||||
|
|
||||||
PSOCK_END(&s->sout);
|
PSOCK_END(&s->sout);
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
@ -139,14 +139,14 @@ static const char *states[] = {
|
||||||
closing,
|
closing,
|
||||||
time_wait,
|
time_wait,
|
||||||
last_ack};
|
last_ack};
|
||||||
|
|
||||||
|
|
||||||
static unsigned short
|
static unsigned short
|
||||||
generate_tcp_stats(void *arg)
|
generate_tcp_stats(void *arg)
|
||||||
{
|
{
|
||||||
struct uip_conn *conn;
|
struct uip_conn *conn;
|
||||||
struct httpd_state *s = (struct httpd_state *)arg;
|
struct httpd_state *s = (struct httpd_state *)arg;
|
||||||
|
|
||||||
conn = &uip_conns[s->count];
|
conn = &uip_conns[s->count];
|
||||||
return snprintf((char *)uip_appdata, UIP_APPDATA_SIZE,
|
return snprintf((char *)uip_appdata, UIP_APPDATA_SIZE,
|
||||||
"<tr><td>%d</td><td>%u.%u.%u.%u:%u</td><td>%s</td><td>%u</td><td>%u</td><td>%c %c</td></tr>\r\n",
|
"<tr><td>%d</td><td>%u.%u.%u.%u:%u</td><td>%s</td><td>%u</td><td>%u</td><td>%c %c</td></tr>\r\n",
|
||||||
|
@ -166,7 +166,7 @@ generate_tcp_stats(void *arg)
|
||||||
static
|
static
|
||||||
PT_THREAD(tcp_stats(struct httpd_state *s, char *ptr))
|
PT_THREAD(tcp_stats(struct httpd_state *s, char *ptr))
|
||||||
{
|
{
|
||||||
|
|
||||||
PSOCK_BEGIN(&s->sout);
|
PSOCK_BEGIN(&s->sout);
|
||||||
|
|
||||||
for(s->count = 0; s->count < UIP_CONNS; ++s->count) {
|
for(s->count = 0; s->count < UIP_CONNS; ++s->count) {
|
||||||
|
@ -197,14 +197,14 @@ PT_THREAD(net_stats(struct httpd_state *s, char *ptr))
|
||||||
++s->count) {
|
++s->count) {
|
||||||
PSOCK_GENERATOR_SEND(&s->sout, generate_net_stats, s);
|
PSOCK_GENERATOR_SEND(&s->sout, generate_net_stats, s);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* UIP_STATISTICS */
|
#endif /* UIP_STATISTICS */
|
||||||
|
|
||||||
PSOCK_END(&s->sout);
|
PSOCK_END(&s->sout);
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
extern void vTaskList( signed char *pcWriteBuffer );
|
extern void vTaskList( char *pcWriteBuffer );
|
||||||
static char cCountBuf[ 32 ];
|
static char cCountBuf[ 32 ];
|
||||||
long lRefreshCount = 0;
|
long lRefreshCount = 0;
|
||||||
static unsigned short
|
static unsigned short
|
||||||
|
@ -212,9 +212,9 @@ generate_rtos_stats(void *arg)
|
||||||
{
|
{
|
||||||
lRefreshCount++;
|
lRefreshCount++;
|
||||||
sprintf( cCountBuf, "<p><br>Refresh count = %ld", lRefreshCount );
|
sprintf( cCountBuf, "<p><br>Refresh count = %ld", lRefreshCount );
|
||||||
vTaskList( uip_appdata );
|
vTaskList( ( char * ) uip_appdata );
|
||||||
strcat( uip_appdata, cCountBuf );
|
strcat( uip_appdata, cCountBuf );
|
||||||
|
|
||||||
return strlen( uip_appdata );
|
return strlen( uip_appdata );
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
@ -224,7 +224,7 @@ static
|
||||||
PT_THREAD(rtos_stats(struct httpd_state *s, char *ptr))
|
PT_THREAD(rtos_stats(struct httpd_state *s, char *ptr))
|
||||||
{
|
{
|
||||||
PSOCK_BEGIN(&s->sout);
|
PSOCK_BEGIN(&s->sout);
|
||||||
PSOCK_GENERATOR_SEND(&s->sout, generate_rtos_stats, NULL);
|
PSOCK_GENERATOR_SEND(&s->sout, generate_rtos_stats, NULL);
|
||||||
PSOCK_END(&s->sout);
|
PSOCK_END(&s->sout);
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
@ -247,7 +247,7 @@ static unsigned short generate_io_state( void *arg )
|
||||||
sprintf( uip_appdata,
|
sprintf( uip_appdata,
|
||||||
"<input type=\"checkbox\" name=\"LED0\" value=\"1\" %s>LED DS4,"\
|
"<input type=\"checkbox\" name=\"LED0\" value=\"1\" %s>LED DS4,"\
|
||||||
"<p>",
|
"<p>",
|
||||||
pcStatus );
|
pcStatus );
|
||||||
|
|
||||||
return strlen( uip_appdata );
|
return strlen( uip_appdata );
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
All rights reserved
|
All rights reserved
|
||||||
|
|
||||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
@ -63,9 +63,9 @@
|
||||||
1 tab == 4 spaces!
|
1 tab == 4 spaces!
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
NOTE : Tasks run in system mode and the scheduler runs in Supervisor mode.
|
NOTE : Tasks run in system mode and the scheduler runs in Supervisor mode.
|
||||||
The processor MUST be in supervisor mode when vTaskStartScheduler is
|
The processor MUST be in supervisor mode when vTaskStartScheduler is
|
||||||
called. The demo applications included in the FreeRTOS.org download switch
|
called. The demo applications included in the FreeRTOS.org download switch
|
||||||
to supervisor mode prior to main being called. If you are not using one of
|
to supervisor mode prior to main being called. If you are not using one of
|
||||||
these demo application projects then ensure Supervisor mode is used.
|
these demo application projects then ensure Supervisor mode is used.
|
||||||
|
@ -75,36 +75,36 @@
|
||||||
/*
|
/*
|
||||||
* Creates all the demo application tasks, then starts the scheduler. The WEB
|
* Creates all the demo application tasks, then starts the scheduler. The WEB
|
||||||
* documentation provides more details of the demo application tasks.
|
* documentation provides more details of the demo application tasks.
|
||||||
*
|
*
|
||||||
* Main.c also creates a task called "Check". This only executes every three
|
* Main.c also creates a task called "Check". This only executes every three
|
||||||
* seconds but has the highest priority so is guaranteed to get processor time.
|
* seconds but has the highest priority so is guaranteed to get processor time.
|
||||||
* Its main function is to check that all the other tasks are still operational.
|
* Its main function is to check that all the other tasks are still operational.
|
||||||
* Each task (other than the "flash" tasks) maintains a unique count that is
|
* Each task (other than the "flash" tasks) maintains a unique count that is
|
||||||
* incremented each time the task successfully completes its function. Should
|
* incremented each time the task successfully completes its function. Should
|
||||||
* any error occur within such a task the count is permanently halted. The
|
* any error occur within such a task the count is permanently halted. The
|
||||||
* check task inspects the count of each task to ensure it has changed since
|
* check task inspects the count of each task to ensure it has changed since
|
||||||
* the last time the check task executed. If all the count variables have
|
* the last time the check task executed. If all the count variables have
|
||||||
* changed all the tasks are still executing error free, and the check task
|
* changed all the tasks are still executing error free, and the check task
|
||||||
* toggles the onboard LED. Should any task contain an error at any time
|
* toggles the onboard LED. Should any task contain an error at any time
|
||||||
* the LED toggle rate will change from 3 seconds to 500ms.
|
* the LED toggle rate will change from 3 seconds to 500ms.
|
||||||
*
|
*
|
||||||
* To check the operation of the memory allocator the check task also
|
* To check the operation of the memory allocator the check task also
|
||||||
* dynamically creates a task before delaying, and deletes it again when it
|
* dynamically creates a task before delaying, and deletes it again when it
|
||||||
* wakes. If memory cannot be allocated for the new task the call to xTaskCreate
|
* wakes. If memory cannot be allocated for the new task the call to xTaskCreate
|
||||||
* will fail and an error is signalled. The dynamically created task itself
|
* will fail and an error is signalled. The dynamically created task itself
|
||||||
* allocates and frees memory just to give the allocator a bit more exercise.
|
* allocates and frees memory just to give the allocator a bit more exercise.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Changes from V2.4.2
|
Changes from V2.4.2
|
||||||
|
|
||||||
+ The vErrorChecks() task now dynamically creates then deletes a task each
|
+ The vErrorChecks() task now dynamically creates then deletes a task each
|
||||||
cycle. This tests the operation of the memory allocator.
|
cycle. This tests the operation of the memory allocator.
|
||||||
|
|
||||||
Changes from V2.5.2
|
Changes from V2.5.2
|
||||||
|
|
||||||
+ vParTestInitialise() is called during initialisation to ensure all the
|
+ vParTestInitialise() is called during initialisation to ensure all the
|
||||||
LED's start off.
|
LED's start off.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -165,7 +165,7 @@
|
||||||
#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 0 )
|
#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 0 )
|
||||||
#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 )
|
#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 )
|
||||||
|
|
||||||
/* The rate at which the on board LED will toggle when there is/is not an
|
/* The rate at which the on board LED will toggle when there is/is not an
|
||||||
error. */
|
error. */
|
||||||
#define mainNO_ERROR_FLASH_PERIOD ( ( portTickType ) 3000 / portTICK_RATE_MS )
|
#define mainNO_ERROR_FLASH_PERIOD ( ( portTickType ) 3000 / portTICK_RATE_MS )
|
||||||
#define mainERROR_FLASH_PERIOD ( ( portTickType ) 500 / portTICK_RATE_MS )
|
#define mainERROR_FLASH_PERIOD ( ( portTickType ) 500 / portTICK_RATE_MS )
|
||||||
|
@ -184,7 +184,7 @@ error. */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The Olimex demo board has a single built in LED. This function simply
|
* The Olimex demo board has a single built in LED. This function simply
|
||||||
* toggles its state.
|
* toggles its state.
|
||||||
*/
|
*/
|
||||||
void prvToggleOnBoardLED( void );
|
void prvToggleOnBoardLED( void );
|
||||||
|
|
||||||
|
@ -195,7 +195,7 @@ void prvToggleOnBoardLED( void );
|
||||||
static long prvCheckOtherTasksAreStillRunning( unsigned long ulMemCheckTaskCount );
|
static long prvCheckOtherTasksAreStillRunning( unsigned long ulMemCheckTaskCount );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The task that executes at the highest priority and calls
|
* The task that executes at the highest priority and calls
|
||||||
* prvCheckOtherTasksAreStillRunning(). See the description at the top
|
* prvCheckOtherTasksAreStillRunning(). See the description at the top
|
||||||
* of the file.
|
* of the file.
|
||||||
*/
|
*/
|
||||||
|
@ -217,7 +217,7 @@ static void prvSetupHardware( void );
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Starts all the other tasks, then starts the scheduler.
|
* Starts all the other tasks, then starts the scheduler.
|
||||||
*/
|
*/
|
||||||
int main( void )
|
int main( void )
|
||||||
{
|
{
|
||||||
|
@ -235,12 +235,12 @@ int main( void )
|
||||||
vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY );
|
vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY );
|
||||||
|
|
||||||
/* Start the check task - which is defined in this file. */
|
/* Start the check task - which is defined in this file. */
|
||||||
xTaskCreate( vErrorChecks, ( signed char * ) "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );
|
xTaskCreate( vErrorChecks, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );
|
||||||
|
|
||||||
/* Now all the tasks have been started - start the scheduler.
|
/* Now all the tasks have been started - start the scheduler.
|
||||||
|
|
||||||
NOTE : Tasks run in system mode and the scheduler runs in Supervisor mode.
|
NOTE : Tasks run in system mode and the scheduler runs in Supervisor mode.
|
||||||
The processor MUST be in supervisor mode when vTaskStartScheduler is
|
The processor MUST be in supervisor mode when vTaskStartScheduler is
|
||||||
called. The demo applications included in the FreeRTOS.org download switch
|
called. The demo applications included in the FreeRTOS.org download switch
|
||||||
to supervisor mode prior to main being called. If you are not using one of
|
to supervisor mode prior to main being called. If you are not using one of
|
||||||
these demo application projects then ensure Supervisor mode is used here. */
|
these demo application projects then ensure Supervisor mode is used here. */
|
||||||
|
@ -263,22 +263,22 @@ xTaskHandle xCreatedTask;
|
||||||
/* Cycle for ever, delaying then checking all the other tasks are still
|
/* Cycle for ever, delaying then checking all the other tasks are still
|
||||||
operating without error. If an error is detected then the delay period
|
operating without error. If an error is detected then the delay period
|
||||||
is decreased from mainNO_ERROR_FLASH_PERIOD to mainERROR_FLASH_PERIOD so
|
is decreased from mainNO_ERROR_FLASH_PERIOD to mainERROR_FLASH_PERIOD so
|
||||||
the on board LED flash rate will increase.
|
the on board LED flash rate will increase.
|
||||||
|
|
||||||
In addition to the standard tests the memory allocator is tested through
|
In addition to the standard tests the memory allocator is tested through
|
||||||
the dynamic creation and deletion of a task each cycle. Each time the
|
the dynamic creation and deletion of a task each cycle. Each time the
|
||||||
task is created memory must be allocated for its stack. When the task is
|
task is created memory must be allocated for its stack. When the task is
|
||||||
deleted this memory is returned to the heap. If the task cannot be created
|
deleted this memory is returned to the heap. If the task cannot be created
|
||||||
then it is likely that the memory allocation failed. */
|
then it is likely that the memory allocation failed. */
|
||||||
|
|
||||||
for( ;; )
|
for( ;; )
|
||||||
{
|
{
|
||||||
/* Dynamically create a task - passing ulMemCheckTaskRunningCount as a
|
/* Dynamically create a task - passing ulMemCheckTaskRunningCount as a
|
||||||
parameter. */
|
parameter. */
|
||||||
ulMemCheckTaskRunningCount = mainCOUNT_INITIAL_VALUE;
|
ulMemCheckTaskRunningCount = mainCOUNT_INITIAL_VALUE;
|
||||||
xCreatedTask = mainNO_TASK;
|
xCreatedTask = mainNO_TASK;
|
||||||
|
|
||||||
if( xTaskCreate( vMemCheckTask, ( signed char * ) "MEM_CHECK", configMINIMAL_STACK_SIZE, ( void * ) &ulMemCheckTaskRunningCount, tskIDLE_PRIORITY, &xCreatedTask ) != pdPASS )
|
if( xTaskCreate( vMemCheckTask, "MEM_CHECK", configMINIMAL_STACK_SIZE, ( void * ) &ulMemCheckTaskRunningCount, tskIDLE_PRIORITY, &xCreatedTask ) != pdPASS )
|
||||||
{
|
{
|
||||||
/* Could not create the task - we have probably run out of heap. */
|
/* Could not create the task - we have probably run out of heap. */
|
||||||
xDelayPeriod = mainERROR_FLASH_PERIOD;
|
xDelayPeriod = mainERROR_FLASH_PERIOD;
|
||||||
|
@ -286,14 +286,14 @@ xTaskHandle xCreatedTask;
|
||||||
|
|
||||||
/* Delay until it is time to execute again. */
|
/* Delay until it is time to execute again. */
|
||||||
vTaskDelay( xDelayPeriod );
|
vTaskDelay( xDelayPeriod );
|
||||||
|
|
||||||
/* Delete the dynamically created task. */
|
/* Delete the dynamically created task. */
|
||||||
if( xCreatedTask != mainNO_TASK )
|
if( xCreatedTask != mainNO_TASK )
|
||||||
{
|
{
|
||||||
vTaskDelete( xCreatedTask );
|
vTaskDelete( xCreatedTask );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check all the standard demo application tasks are executing without
|
/* Check all the standard demo application tasks are executing without
|
||||||
error. ulMemCheckTaskRunningCount is checked to ensure it was
|
error. ulMemCheckTaskRunningCount is checked to ensure it was
|
||||||
modified by the task just deleted. */
|
modified by the task just deleted. */
|
||||||
if( prvCheckOtherTasksAreStillRunning( ulMemCheckTaskRunningCount ) != pdPASS )
|
if( prvCheckOtherTasksAreStillRunning( ulMemCheckTaskRunningCount ) != pdPASS )
|
||||||
|
@ -318,8 +318,8 @@ static void prvSetupHardware( void )
|
||||||
PCB_PINSEL0 |= mainTX_ENABLE;
|
PCB_PINSEL0 |= mainTX_ENABLE;
|
||||||
PCB_PINSEL0 |= mainRX_ENABLE;
|
PCB_PINSEL0 |= mainRX_ENABLE;
|
||||||
|
|
||||||
/* Set all GPIO to output other than the P0.14 (BSL), and the JTAG pins.
|
/* Set all GPIO to output other than the P0.14 (BSL), and the JTAG pins.
|
||||||
The JTAG pins are left as input as I'm not sure what will happen if the
|
The JTAG pins are left as input as I'm not sure what will happen if the
|
||||||
Wiggler is connected after powerup - not that it would be a good idea to
|
Wiggler is connected after powerup - not that it would be a good idea to
|
||||||
do that anyway. */
|
do that anyway. */
|
||||||
GPIO_IODIR = ~( mainP0_14 + mainJTAG_PORT );
|
GPIO_IODIR = ~( mainP0_14 + mainJTAG_PORT );
|
||||||
|
@ -349,7 +349,7 @@ static void prvSetupHardware( void )
|
||||||
|
|
||||||
/* Setup the peripheral bus to be the same as the PLL output. */
|
/* Setup the peripheral bus to be the same as the PLL output. */
|
||||||
SCB_VPBDIV = mainBUS_CLK_FULL;
|
SCB_VPBDIV = mainBUS_CLK_FULL;
|
||||||
|
|
||||||
/* Initialise LED outputs. */
|
/* Initialise LED outputs. */
|
||||||
vParTestInitialise();
|
vParTestInitialise();
|
||||||
}
|
}
|
||||||
|
@ -367,7 +367,7 @@ unsigned long ulState;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
GPIO_IOSET = mainON_BOARD_LED_BIT;
|
GPIO_IOSET = mainON_BOARD_LED_BIT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
@ -435,10 +435,10 @@ static long lErrorOccurred = pdFALSE;
|
||||||
vErrorChecks task to check the operation of the memory allocator. Each time
|
vErrorChecks task to check the operation of the memory allocator. Each time
|
||||||
the task is created memory is allocated for the stack and TCB. Each time
|
the task is created memory is allocated for the stack and TCB. Each time
|
||||||
the task is deleted this memory is returned to the heap. This task itself
|
the task is deleted this memory is returned to the heap. This task itself
|
||||||
exercises the allocator by allocating and freeing blocks.
|
exercises the allocator by allocating and freeing blocks.
|
||||||
|
|
||||||
The task executes at the idle priority so does not require a delay.
|
The task executes at the idle priority so does not require a delay.
|
||||||
|
|
||||||
pulMemCheckTaskRunningCounter is incremented each cycle to indicate to the
|
pulMemCheckTaskRunningCounter is incremented each cycle to indicate to the
|
||||||
vErrorChecks() task that this task is still executing without error. */
|
vErrorChecks() task that this task is still executing without error. */
|
||||||
|
|
||||||
|
@ -452,7 +452,7 @@ static long lErrorOccurred = pdFALSE;
|
||||||
( *pulMemCheckTaskRunningCounter )++;
|
( *pulMemCheckTaskRunningCounter )++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Allocate some memory - just to give the allocator some extra
|
/* Allocate some memory - just to give the allocator some extra
|
||||||
exercise. This has to be in a critical section to ensure the
|
exercise. This has to be in a critical section to ensure the
|
||||||
task does not get deleted while it has memory allocated. */
|
task does not get deleted while it has memory allocated. */
|
||||||
vTaskSuspendAll();
|
vTaskSuspendAll();
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
All rights reserved
|
All rights reserved
|
||||||
|
|
||||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
@ -217,10 +217,10 @@ int main( void )
|
||||||
vStartRecursiveMutexTasks();
|
vStartRecursiveMutexTasks();
|
||||||
|
|
||||||
/* Start the tasks defined within this file. */
|
/* Start the tasks defined within this file. */
|
||||||
xTaskCreate( vLEDTask, ( signed char * ) "LED", configMINIMAL_STACK_SIZE, NULL, mainLED_TASK_PRIORITY, NULL );
|
xTaskCreate( vLEDTask, "LED", configMINIMAL_STACK_SIZE, NULL, mainLED_TASK_PRIORITY, NULL );
|
||||||
xTaskCreate( vCheckTask, ( signed char * ) "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );
|
xTaskCreate( vCheckTask, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );
|
||||||
xTaskCreate( vPrintTask, ( signed char * ) "Print", configMINIMAL_STACK_SIZE, NULL, mainPRINT_TASK_PRIORITY, NULL );
|
xTaskCreate( vPrintTask, "Print", configMINIMAL_STACK_SIZE, NULL, mainPRINT_TASK_PRIORITY, NULL );
|
||||||
xTaskCreate( vButtonHandlerTask, ( signed char * ) "Button", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );
|
xTaskCreate( vButtonHandlerTask, "Button", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );
|
||||||
|
|
||||||
/* Start the scheduler. */
|
/* Start the scheduler. */
|
||||||
vTaskStartScheduler();
|
vTaskStartScheduler();
|
||||||
|
@ -357,8 +357,8 @@ char *pcMessage;
|
||||||
|
|
||||||
static void vButtonHandlerTask( void *pvParameters )
|
static void vButtonHandlerTask( void *pvParameters )
|
||||||
{
|
{
|
||||||
static signed char cListBuffer[ mainLIST_BUFFER_SIZE ];
|
static char cListBuffer[ mainLIST_BUFFER_SIZE ];
|
||||||
const signed char *pcList = &( cListBuffer[ 0 ] );
|
const char *pcList = &( cListBuffer[ 0 ] );
|
||||||
const char * const pcHeader = "\nTask State Priority Stack #\n************************************************";
|
const char * const pcHeader = "\nTask State Priority Stack #\n************************************************";
|
||||||
extern void (vButtonISRWrapper) ( void );
|
extern void (vButtonISRWrapper) ( void );
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
All rights reserved
|
All rights reserved
|
||||||
|
|
||||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
@ -76,10 +76,10 @@
|
||||||
* for messages - waking and displaying the messages as they arrive.
|
* for messages - waking and displaying the messages as they arrive.
|
||||||
*
|
*
|
||||||
* "Check" hook - This only executes every five seconds from the tick hook.
|
* "Check" hook - This only executes every five seconds from the tick hook.
|
||||||
* Its main function is to check that all the standard demo tasks are still
|
* Its main function is to check that all the standard demo tasks are still
|
||||||
* operational. Should any unexpected behaviour within a demo task be discovered
|
* operational. Should any unexpected behaviour within a demo task be discovered
|
||||||
* the tick hook will write an error to the LCD (via the LCD task). If all the
|
* the tick hook will write an error to the LCD (via the LCD task). If all the
|
||||||
* demo tasks are executing with their expected behaviour then the check task
|
* demo tasks are executing with their expected behaviour then the check task
|
||||||
* writes PASS to the LCD (again via the LCD task), as described above.
|
* writes PASS to the LCD (again via the LCD task), as described above.
|
||||||
*
|
*
|
||||||
* "uIP" task - This is the task that handles the uIP stack. All TCP/IP
|
* "uIP" task - This is the task that handles the uIP stack. All TCP/IP
|
||||||
|
@ -114,7 +114,7 @@
|
||||||
#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 )
|
#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 )
|
||||||
#define mainFLASH_PRIORITY ( tskIDLE_PRIORITY + 2 )
|
#define mainFLASH_PRIORITY ( tskIDLE_PRIORITY + 2 )
|
||||||
#define mainCREATOR_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 )
|
#define mainCREATOR_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 )
|
||||||
#define mainGEN_QUEUE_TASK_PRIORITY ( tskIDLE_PRIORITY )
|
#define mainGEN_QUEUE_TASK_PRIORITY ( tskIDLE_PRIORITY )
|
||||||
|
|
||||||
/* Constants to setup the PLL. */
|
/* Constants to setup the PLL. */
|
||||||
#define mainPLL_MUL ( ( unsigned portLONG ) ( 8 - 1 ) )
|
#define mainPLL_MUL ( ( unsigned portLONG ) ( 8 - 1 ) )
|
||||||
|
@ -134,15 +134,15 @@
|
||||||
#define mainMAM_TIM_3 ( ( unsigned portCHAR ) 0x03 )
|
#define mainMAM_TIM_3 ( ( unsigned portCHAR ) 0x03 )
|
||||||
#define mainMAM_MODE_FULL ( ( unsigned portCHAR ) 0x02 )
|
#define mainMAM_MODE_FULL ( ( unsigned portCHAR ) 0x02 )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The task that handles the uIP stack. All TCP/IP processing is performed in
|
* The task that handles the uIP stack. All TCP/IP processing is performed in
|
||||||
* this task.
|
* this task.
|
||||||
*/
|
*/
|
||||||
extern void vuIP_Task( void *pvParameters );
|
extern void vuIP_Task( void *pvParameters );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The LCD is written two by more than one task so is controlled by a
|
* The LCD is written two by more than one task so is controlled by a
|
||||||
* 'gatekeeper' task. This is the only task that is actually permitted to
|
* 'gatekeeper' task. This is the only task that is actually permitted to
|
||||||
* access the LCD directly. Other tasks wanting to display a message send
|
* access the LCD directly. Other tasks wanting to display a message send
|
||||||
* the message to the gatekeeper.
|
* the message to the gatekeeper.
|
||||||
*/
|
*/
|
||||||
|
@ -159,31 +159,31 @@ xQueueHandle xLCDQueue;
|
||||||
int main( void )
|
int main( void )
|
||||||
{
|
{
|
||||||
prvSetupHardware();
|
prvSetupHardware();
|
||||||
|
|
||||||
/* Create the queue used by the LCD task. Messages for display on the LCD
|
/* Create the queue used by the LCD task. Messages for display on the LCD
|
||||||
are received via this queue. */
|
are received via this queue. */
|
||||||
xLCDQueue = xQueueCreate( mainQUEUE_SIZE, sizeof( xLCDMessage ) );
|
xLCDQueue = xQueueCreate( mainQUEUE_SIZE, sizeof( xLCDMessage ) );
|
||||||
|
|
||||||
/* Create the uIP task. This uses the lwIP RTOS abstraction layer.*/
|
/* Create the uIP task. This uses the lwIP RTOS abstraction layer.*/
|
||||||
xTaskCreate( vuIP_Task, ( signed portCHAR * ) "uIP", mainBASIC_WEB_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY - 1, NULL );
|
xTaskCreate( vuIP_Task, "uIP", mainBASIC_WEB_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY - 1, NULL );
|
||||||
|
|
||||||
/* Start the standard demo tasks. */
|
/* Start the standard demo tasks. */
|
||||||
vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY );
|
vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY );
|
||||||
vCreateBlockTimeTasks();
|
vCreateBlockTimeTasks();
|
||||||
vStartLEDFlashTasks( mainFLASH_PRIORITY );
|
vStartLEDFlashTasks( mainFLASH_PRIORITY );
|
||||||
vStartGenericQueueTasks( mainGEN_QUEUE_TASK_PRIORITY );
|
vStartGenericQueueTasks( mainGEN_QUEUE_TASK_PRIORITY );
|
||||||
vStartQueuePeekTasks();
|
vStartQueuePeekTasks();
|
||||||
vStartDynamicPriorityTasks();
|
vStartDynamicPriorityTasks();
|
||||||
|
|
||||||
/* Start the tasks defined within this file/specific to this demo. */
|
/* Start the tasks defined within this file/specific to this demo. */
|
||||||
xTaskCreate( vLCDTask, ( signed portCHAR * ) "LCD", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY - 1, NULL );
|
xTaskCreate( vLCDTask, "LCD", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY - 1, NULL );
|
||||||
|
|
||||||
/* Start the scheduler. */
|
/* Start the scheduler. */
|
||||||
vTaskStartScheduler();
|
vTaskStartScheduler();
|
||||||
|
|
||||||
/* Will only get here if there was insufficient memory to create the idle
|
/* Will only get here if there was insufficient memory to create the idle
|
||||||
task. */
|
task. */
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
@ -200,7 +200,7 @@ static portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
|
||||||
if( ulTicksSinceLastDisplay >= mainCHECK_DELAY )
|
if( ulTicksSinceLastDisplay >= mainCHECK_DELAY )
|
||||||
{
|
{
|
||||||
ulTicksSinceLastDisplay = 0;
|
ulTicksSinceLastDisplay = 0;
|
||||||
|
|
||||||
/* Has an error been found in any task? */
|
/* Has an error been found in any task? */
|
||||||
|
|
||||||
if( xAreBlockingQueuesStillRunning() != pdTRUE )
|
if( xAreBlockingQueuesStillRunning() != pdTRUE )
|
||||||
|
@ -217,17 +217,17 @@ static portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
|
||||||
{
|
{
|
||||||
xMessage.pcMessage = "ERROR - GENQ";
|
xMessage.pcMessage = "ERROR - GENQ";
|
||||||
}
|
}
|
||||||
|
|
||||||
if( xAreQueuePeekTasksStillRunning() != pdTRUE )
|
if( xAreQueuePeekTasksStillRunning() != pdTRUE )
|
||||||
{
|
{
|
||||||
xMessage.pcMessage = "ERROR - PEEKQ";
|
xMessage.pcMessage = "ERROR - PEEKQ";
|
||||||
}
|
}
|
||||||
|
|
||||||
if( xAreDynamicPriorityTasksStillRunning() != pdTRUE )
|
if( xAreDynamicPriorityTasksStillRunning() != pdTRUE )
|
||||||
{
|
{
|
||||||
xMessage.pcMessage = "ERROR - DYNAMIC";
|
xMessage.pcMessage = "ERROR - DYNAMIC";
|
||||||
}
|
}
|
||||||
|
|
||||||
xMessage.xColumn++;
|
xMessage.xColumn++;
|
||||||
|
|
||||||
/* Send the message to the LCD gatekeeper for display. */
|
/* Send the message to the LCD gatekeeper for display. */
|
||||||
|
@ -244,7 +244,7 @@ xLCDMessage xMessage;
|
||||||
/* Initialise the LCD and display a startup message. */
|
/* Initialise the LCD and display a startup message. */
|
||||||
LCD_init();
|
LCD_init();
|
||||||
LCD_cur_off();
|
LCD_cur_off();
|
||||||
LCD_cls();
|
LCD_cls();
|
||||||
LCD_gotoxy( 1, 1 );
|
LCD_gotoxy( 1, 1 );
|
||||||
LCD_puts( "www.FreeRTOS.org" );
|
LCD_puts( "www.FreeRTOS.org" );
|
||||||
|
|
||||||
|
@ -252,7 +252,7 @@ xLCDMessage xMessage;
|
||||||
{
|
{
|
||||||
/* Wait for a message to arrive that requires displaying. */
|
/* Wait for a message to arrive that requires displaying. */
|
||||||
while( xQueueReceive( xLCDQueue, &xMessage, portMAX_DELAY ) != pdPASS );
|
while( xQueueReceive( xLCDQueue, &xMessage, portMAX_DELAY ) != pdPASS );
|
||||||
|
|
||||||
/* Display the message. Print each message to a different position. */
|
/* Display the message. Print each message to a different position. */
|
||||||
LCD_cls();
|
LCD_cls();
|
||||||
LCD_gotoxy( ( xMessage.xColumn & 0x07 ) + 1, ( xMessage.xColumn & 0x01 ) + 1 );
|
LCD_gotoxy( ( xMessage.xColumn & 0x07 ) + 1, ( xMessage.xColumn & 0x01 ) + 1 );
|
||||||
|
@ -268,17 +268,17 @@ static void prvSetupHardware( void )
|
||||||
/* Remap the interrupt vectors to RAM if we are are running from RAM. */
|
/* Remap the interrupt vectors to RAM if we are are running from RAM. */
|
||||||
SCB_MEMMAP = 2;
|
SCB_MEMMAP = 2;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Disable the PLL. */
|
/* Disable the PLL. */
|
||||||
PLLCON = 0;
|
PLLCON = 0;
|
||||||
PLLFEED = mainPLL_FEED_BYTE1;
|
PLLFEED = mainPLL_FEED_BYTE1;
|
||||||
PLLFEED = mainPLL_FEED_BYTE2;
|
PLLFEED = mainPLL_FEED_BYTE2;
|
||||||
|
|
||||||
/* Configure clock source. */
|
/* Configure clock source. */
|
||||||
SCS |= mainOSC_ENABLE;
|
SCS |= mainOSC_ENABLE;
|
||||||
while( !( SCS & mainOSC_STAT ) );
|
while( !( SCS & mainOSC_STAT ) );
|
||||||
CLKSRCSEL = mainOSC_SELECT;
|
CLKSRCSEL = mainOSC_SELECT;
|
||||||
|
|
||||||
/* Setup the PLL to multiply the XTAL input by 4. */
|
/* Setup the PLL to multiply the XTAL input by 4. */
|
||||||
PLLCFG = ( mainPLL_MUL | mainPLL_DIV );
|
PLLCFG = ( mainPLL_MUL | mainPLL_DIV );
|
||||||
PLLFEED = mainPLL_FEED_BYTE1;
|
PLLFEED = mainPLL_FEED_BYTE1;
|
||||||
|
@ -288,20 +288,20 @@ static void prvSetupHardware( void )
|
||||||
PLLCON = mainPLL_ENABLE;
|
PLLCON = mainPLL_ENABLE;
|
||||||
PLLFEED = mainPLL_FEED_BYTE1;
|
PLLFEED = mainPLL_FEED_BYTE1;
|
||||||
PLLFEED = mainPLL_FEED_BYTE2;
|
PLLFEED = mainPLL_FEED_BYTE2;
|
||||||
CCLKCFG = mainCPU_CLK_DIV;
|
CCLKCFG = mainCPU_CLK_DIV;
|
||||||
while( !( PLLSTAT & mainPLL_LOCK ) );
|
while( !( PLLSTAT & mainPLL_LOCK ) );
|
||||||
|
|
||||||
/* Connecting the clock. */
|
/* Connecting the clock. */
|
||||||
PLLCON = mainPLL_CONNECT;
|
PLLCON = mainPLL_CONNECT;
|
||||||
PLLFEED = mainPLL_FEED_BYTE1;
|
PLLFEED = mainPLL_FEED_BYTE1;
|
||||||
PLLFEED = mainPLL_FEED_BYTE2;
|
PLLFEED = mainPLL_FEED_BYTE2;
|
||||||
while( !( PLLSTAT & mainPLL_CONNECTED ) );
|
while( !( PLLSTAT & mainPLL_CONNECTED ) );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
This code is commented out as the MAM does not work on the original revision
|
This code is commented out as the MAM does not work on the original revision
|
||||||
LPC2368 chips. If using Rev B chips then you can increase the speed though
|
LPC2368 chips. If using Rev B chips then you can increase the speed though
|
||||||
the use of the MAM.
|
the use of the MAM.
|
||||||
|
|
||||||
Setup and turn on the MAM. Three cycle access is used due to the fast
|
Setup and turn on the MAM. Three cycle access is used due to the fast
|
||||||
PLL used. It is possible faster overall performance could be obtained by
|
PLL used. It is possible faster overall performance could be obtained by
|
||||||
tuning the MAM and PLL settings.
|
tuning the MAM and PLL settings.
|
||||||
|
@ -309,7 +309,7 @@ static void prvSetupHardware( void )
|
||||||
MAMTIM = mainMAM_TIM_3;
|
MAMTIM = mainMAM_TIM_3;
|
||||||
MAMCR = mainMAM_MODE_FULL;
|
MAMCR = mainMAM_MODE_FULL;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Setup the led's on the MCB2300 board */
|
/* Setup the led's on the MCB2300 board */
|
||||||
vParTestInitialise();
|
vParTestInitialise();
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,7 +98,7 @@ PT_THREAD(file_stats(struct httpd_state *s, char *ptr))
|
||||||
PSOCK_BEGIN(&s->sout);
|
PSOCK_BEGIN(&s->sout);
|
||||||
|
|
||||||
PSOCK_GENERATOR_SEND(&s->sout, generate_file_stats, strchr(ptr, ' ') + 1);
|
PSOCK_GENERATOR_SEND(&s->sout, generate_file_stats, strchr(ptr, ' ') + 1);
|
||||||
|
|
||||||
PSOCK_END(&s->sout);
|
PSOCK_END(&s->sout);
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
@ -139,14 +139,14 @@ static const char *states[] = {
|
||||||
closing,
|
closing,
|
||||||
time_wait,
|
time_wait,
|
||||||
last_ack};
|
last_ack};
|
||||||
|
|
||||||
|
|
||||||
static unsigned short
|
static unsigned short
|
||||||
generate_tcp_stats(void *arg)
|
generate_tcp_stats(void *arg)
|
||||||
{
|
{
|
||||||
struct uip_conn *conn;
|
struct uip_conn *conn;
|
||||||
struct httpd_state *s = (struct httpd_state *)arg;
|
struct httpd_state *s = (struct httpd_state *)arg;
|
||||||
|
|
||||||
conn = &uip_conns[s->count];
|
conn = &uip_conns[s->count];
|
||||||
return snprintf((char *)uip_appdata, UIP_APPDATA_SIZE,
|
return snprintf((char *)uip_appdata, UIP_APPDATA_SIZE,
|
||||||
"<tr><td>%d</td><td>%u.%u.%u.%u:%u</td><td>%s</td><td>%u</td><td>%u</td><td>%c %c</td></tr>\r\n",
|
"<tr><td>%d</td><td>%u.%u.%u.%u:%u</td><td>%s</td><td>%u</td><td>%u</td><td>%c %c</td></tr>\r\n",
|
||||||
|
@ -166,7 +166,7 @@ generate_tcp_stats(void *arg)
|
||||||
static
|
static
|
||||||
PT_THREAD(tcp_stats(struct httpd_state *s, char *ptr))
|
PT_THREAD(tcp_stats(struct httpd_state *s, char *ptr))
|
||||||
{
|
{
|
||||||
|
|
||||||
PSOCK_BEGIN(&s->sout);
|
PSOCK_BEGIN(&s->sout);
|
||||||
|
|
||||||
for(s->count = 0; s->count < UIP_CONNS; ++s->count) {
|
for(s->count = 0; s->count < UIP_CONNS; ++s->count) {
|
||||||
|
@ -197,14 +197,14 @@ PT_THREAD(net_stats(struct httpd_state *s, char *ptr))
|
||||||
++s->count) {
|
++s->count) {
|
||||||
PSOCK_GENERATOR_SEND(&s->sout, generate_net_stats, s);
|
PSOCK_GENERATOR_SEND(&s->sout, generate_net_stats, s);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* UIP_STATISTICS */
|
#endif /* UIP_STATISTICS */
|
||||||
|
|
||||||
PSOCK_END(&s->sout);
|
PSOCK_END(&s->sout);
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
extern void vTaskList( signed char *pcWriteBuffer );
|
extern void vTaskList( char *pcWriteBuffer );
|
||||||
static char cCountBuf[ 32 ];
|
static char cCountBuf[ 32 ];
|
||||||
long lRefreshCount = 0;
|
long lRefreshCount = 0;
|
||||||
static unsigned short
|
static unsigned short
|
||||||
|
@ -212,9 +212,9 @@ generate_rtos_stats(void *arg)
|
||||||
{
|
{
|
||||||
lRefreshCount++;
|
lRefreshCount++;
|
||||||
sprintf( cCountBuf, "<p><br>Refresh count = %ld", lRefreshCount );
|
sprintf( cCountBuf, "<p><br>Refresh count = %ld", lRefreshCount );
|
||||||
vTaskList( uip_appdata );
|
vTaskList( ( char * ) uip_appdata );
|
||||||
strcat( uip_appdata, cCountBuf );
|
strcat( uip_appdata, cCountBuf );
|
||||||
|
|
||||||
return strlen( uip_appdata );
|
return strlen( uip_appdata );
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
@ -224,7 +224,7 @@ static
|
||||||
PT_THREAD(rtos_stats(struct httpd_state *s, char *ptr))
|
PT_THREAD(rtos_stats(struct httpd_state *s, char *ptr))
|
||||||
{
|
{
|
||||||
PSOCK_BEGIN(&s->sout);
|
PSOCK_BEGIN(&s->sout);
|
||||||
PSOCK_GENERATOR_SEND(&s->sout, generate_rtos_stats, NULL);
|
PSOCK_GENERATOR_SEND(&s->sout, generate_rtos_stats, NULL);
|
||||||
PSOCK_END(&s->sout);
|
PSOCK_END(&s->sout);
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
@ -253,8 +253,8 @@ static unsigned short generate_io_state( void *arg )
|
||||||
"<input type=\"checkbox\" name=\"LED2\" value=\"1\" %s>LED 2.7"\
|
"<input type=\"checkbox\" name=\"LED2\" value=\"1\" %s>LED 2.7"\
|
||||||
"<p>"\
|
"<p>"\
|
||||||
"<input type=\"text\" name=\"LCD\" value=\"Enter LCD text\" size=\"16\">",
|
"<input type=\"text\" name=\"LCD\" value=\"Enter LCD text\" size=\"16\">",
|
||||||
pcStatus[ 0 ],
|
pcStatus[ 0 ],
|
||||||
pcStatus[ 1 ],
|
pcStatus[ 1 ],
|
||||||
pcStatus[ 2 ] );
|
pcStatus[ 2 ] );
|
||||||
|
|
||||||
return strlen( uip_appdata );
|
return strlen( uip_appdata );
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
All rights reserved
|
All rights reserved
|
||||||
|
|
||||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
@ -109,15 +109,15 @@
|
||||||
*/
|
*/
|
||||||
static void vCheckTask( void *pvParameters );
|
static void vCheckTask( void *pvParameters );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The task that handles the uIP stack. All TCP/IP processing is performed in
|
* The task that handles the uIP stack. All TCP/IP processing is performed in
|
||||||
* this task.
|
* this task.
|
||||||
*/
|
*/
|
||||||
extern void vuIP_Task( void *pvParameters );
|
extern void vuIP_Task( void *pvParameters );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The LCD is written two by more than one task so is controlled by a
|
* The LCD is written two by more than one task so is controlled by a
|
||||||
* 'gatekeeper' task. This is the only task that is actually permitted to
|
* 'gatekeeper' task. This is the only task that is actually permitted to
|
||||||
* access the LCD directly. Other tasks wanting to display a message send
|
* access the LCD directly. Other tasks wanting to display a message send
|
||||||
* the message to the gatekeeper.
|
* the message to the gatekeeper.
|
||||||
*/
|
*/
|
||||||
|
@ -138,7 +138,7 @@ int main (void)
|
||||||
xLCDQueue = xQueueCreate( mainQUEUE_SIZE, sizeof( xLCDMessage ) );
|
xLCDQueue = xQueueCreate( mainQUEUE_SIZE, sizeof( xLCDMessage ) );
|
||||||
|
|
||||||
/* Create the lwIP task. This uses the lwIP RTOS abstraction layer.*/
|
/* Create the lwIP task. This uses the lwIP RTOS abstraction layer.*/
|
||||||
xTaskCreate( vuIP_Task, ( signed char * ) "uIP", mainBASIC_WEB_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY - 1, NULL );
|
xTaskCreate( vuIP_Task, "uIP", mainBASIC_WEB_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY - 1, NULL );
|
||||||
|
|
||||||
/* Start the standard demo tasks - these serve no useful purpose other than
|
/* Start the standard demo tasks - these serve no useful purpose other than
|
||||||
to demonstrate the FreeRTOS API being used and to test the port. */
|
to demonstrate the FreeRTOS API being used and to test the port. */
|
||||||
|
@ -150,8 +150,8 @@ int main (void)
|
||||||
vStartIntegerMathTasks( mainINTEGER_TASK_PRIORITY );
|
vStartIntegerMathTasks( mainINTEGER_TASK_PRIORITY );
|
||||||
|
|
||||||
/* Start the tasks defined within this file/specific to this demo. */
|
/* Start the tasks defined within this file/specific to this demo. */
|
||||||
xTaskCreate( vCheckTask, ( signed char * ) "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );
|
xTaskCreate( vCheckTask, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );
|
||||||
xTaskCreate( vLCDTask, ( signed char * ) "LCD", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY - 1, NULL );
|
xTaskCreate( vLCDTask, "LCD", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY - 1, NULL );
|
||||||
|
|
||||||
/* The suicide tasks must be created last as they need to know how many
|
/* The suicide tasks must be created last as they need to know how many
|
||||||
tasks were running prior to their creation in order to ascertain whether
|
tasks were running prior to their creation in order to ascertain whether
|
||||||
|
@ -163,7 +163,7 @@ int main (void)
|
||||||
|
|
||||||
/* Will only get here if there was insufficient memory to create the idle
|
/* Will only get here if there was insufficient memory to create the idle
|
||||||
task. */
|
task. */
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
@ -238,7 +238,7 @@ xLCDMessage xMessage;
|
||||||
/* Initialise the LCD and display a startup message. */
|
/* Initialise the LCD and display a startup message. */
|
||||||
LCD_init();
|
LCD_init();
|
||||||
LCD_cur_off();
|
LCD_cur_off();
|
||||||
LCD_cls();
|
LCD_cls();
|
||||||
LCD_gotoxy( 1, 1 );
|
LCD_gotoxy( 1, 1 );
|
||||||
LCD_puts( ( signed char * ) "www.FreeRTOS.org" );
|
LCD_puts( ( signed char * ) "www.FreeRTOS.org" );
|
||||||
|
|
||||||
|
@ -246,7 +246,7 @@ xLCDMessage xMessage;
|
||||||
{
|
{
|
||||||
/* Wait for a message to arrive that requires displaying. */
|
/* Wait for a message to arrive that requires displaying. */
|
||||||
while( xQueueReceive( xLCDQueue, &xMessage, portMAX_DELAY ) != pdPASS );
|
while( xQueueReceive( xLCDQueue, &xMessage, portMAX_DELAY ) != pdPASS );
|
||||||
|
|
||||||
/* Display the message. Print each message to a different position. */
|
/* Display the message. Print each message to a different position. */
|
||||||
LCD_cls();
|
LCD_cls();
|
||||||
LCD_gotoxy( ( xMessage.xColumn & 0x07 ) + 1, ( xMessage.xColumn & 0x01 ) + 1 );
|
LCD_gotoxy( ( xMessage.xColumn & 0x07 ) + 1, ( xMessage.xColumn & 0x01 ) + 1 );
|
||||||
|
|
|
@ -98,7 +98,7 @@ PT_THREAD(file_stats(struct httpd_state *s, char *ptr))
|
||||||
PSOCK_BEGIN(&s->sout);
|
PSOCK_BEGIN(&s->sout);
|
||||||
|
|
||||||
PSOCK_GENERATOR_SEND(&s->sout, generate_file_stats, strchr(ptr, ' ') + 1);
|
PSOCK_GENERATOR_SEND(&s->sout, generate_file_stats, strchr(ptr, ' ') + 1);
|
||||||
|
|
||||||
PSOCK_END(&s->sout);
|
PSOCK_END(&s->sout);
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
@ -139,14 +139,14 @@ static const char *states[] = {
|
||||||
closing,
|
closing,
|
||||||
time_wait,
|
time_wait,
|
||||||
last_ack};
|
last_ack};
|
||||||
|
|
||||||
|
|
||||||
static unsigned short
|
static unsigned short
|
||||||
generate_tcp_stats(void *arg)
|
generate_tcp_stats(void *arg)
|
||||||
{
|
{
|
||||||
struct uip_conn *conn;
|
struct uip_conn *conn;
|
||||||
struct httpd_state *s = (struct httpd_state *)arg;
|
struct httpd_state *s = (struct httpd_state *)arg;
|
||||||
|
|
||||||
conn = &uip_conns[s->count];
|
conn = &uip_conns[s->count];
|
||||||
return snprintf((char *)uip_appdata, UIP_APPDATA_SIZE,
|
return snprintf((char *)uip_appdata, UIP_APPDATA_SIZE,
|
||||||
"<tr><td>%d</td><td>%u.%u.%u.%u:%u</td><td>%s</td><td>%u</td><td>%u</td><td>%c %c</td></tr>\r\n",
|
"<tr><td>%d</td><td>%u.%u.%u.%u:%u</td><td>%s</td><td>%u</td><td>%u</td><td>%c %c</td></tr>\r\n",
|
||||||
|
@ -166,7 +166,7 @@ generate_tcp_stats(void *arg)
|
||||||
static
|
static
|
||||||
PT_THREAD(tcp_stats(struct httpd_state *s, char *ptr))
|
PT_THREAD(tcp_stats(struct httpd_state *s, char *ptr))
|
||||||
{
|
{
|
||||||
|
|
||||||
PSOCK_BEGIN(&s->sout);
|
PSOCK_BEGIN(&s->sout);
|
||||||
|
|
||||||
for(s->count = 0; s->count < UIP_CONNS; ++s->count) {
|
for(s->count = 0; s->count < UIP_CONNS; ++s->count) {
|
||||||
|
@ -197,14 +197,14 @@ PT_THREAD(net_stats(struct httpd_state *s, char *ptr))
|
||||||
++s->count) {
|
++s->count) {
|
||||||
PSOCK_GENERATOR_SEND(&s->sout, generate_net_stats, s);
|
PSOCK_GENERATOR_SEND(&s->sout, generate_net_stats, s);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* UIP_STATISTICS */
|
#endif /* UIP_STATISTICS */
|
||||||
|
|
||||||
PSOCK_END(&s->sout);
|
PSOCK_END(&s->sout);
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
extern void vTaskList( signed char *pcWriteBuffer );
|
extern void vTaskList( char *pcWriteBuffer );
|
||||||
static char cCountBuf[ 32 ];
|
static char cCountBuf[ 32 ];
|
||||||
long lRefreshCount = 0;
|
long lRefreshCount = 0;
|
||||||
static unsigned short
|
static unsigned short
|
||||||
|
@ -212,9 +212,9 @@ generate_rtos_stats(void *arg)
|
||||||
{
|
{
|
||||||
lRefreshCount++;
|
lRefreshCount++;
|
||||||
sprintf( cCountBuf, "<p><br>Refresh count = %d", lRefreshCount );
|
sprintf( cCountBuf, "<p><br>Refresh count = %d", lRefreshCount );
|
||||||
vTaskList( uip_appdata );
|
vTaskList( ( char * ) uip_appdata );
|
||||||
strcat( uip_appdata, cCountBuf );
|
strcat( uip_appdata, cCountBuf );
|
||||||
|
|
||||||
return strlen( uip_appdata );
|
return strlen( uip_appdata );
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
@ -224,7 +224,7 @@ static
|
||||||
PT_THREAD(rtos_stats(struct httpd_state *s, char *ptr))
|
PT_THREAD(rtos_stats(struct httpd_state *s, char *ptr))
|
||||||
{
|
{
|
||||||
PSOCK_BEGIN(&s->sout);
|
PSOCK_BEGIN(&s->sout);
|
||||||
PSOCK_GENERATOR_SEND(&s->sout, generate_rtos_stats, NULL);
|
PSOCK_GENERATOR_SEND(&s->sout, generate_rtos_stats, NULL);
|
||||||
PSOCK_END(&s->sout);
|
PSOCK_END(&s->sout);
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
@ -253,8 +253,8 @@ static unsigned short generate_io_state( void *arg )
|
||||||
"<input type=\"checkbox\" name=\"LED2\" value=\"1\" %s>LED 2.7"\
|
"<input type=\"checkbox\" name=\"LED2\" value=\"1\" %s>LED 2.7"\
|
||||||
"<p>"\
|
"<p>"\
|
||||||
"<input type=\"text\" name=\"LCD\" value=\"Enter LCD text\" size=\"16\">",
|
"<input type=\"text\" name=\"LCD\" value=\"Enter LCD text\" size=\"16\">",
|
||||||
pcStatus[ 0 ],
|
pcStatus[ 0 ],
|
||||||
pcStatus[ 1 ],
|
pcStatus[ 1 ],
|
||||||
pcStatus[ 2 ] );
|
pcStatus[ 2 ] );
|
||||||
|
|
||||||
return strlen( uip_appdata );
|
return strlen( uip_appdata );
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
All rights reserved
|
All rights reserved
|
||||||
|
|
||||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
@ -180,8 +180,8 @@ int main( void )
|
||||||
vParTestInitialise();
|
vParTestInitialise();
|
||||||
|
|
||||||
/* Create the queue used to communicate with the LCD print task. */
|
/* Create the queue used to communicate with the LCD print task. */
|
||||||
xLCDQueue = xQueueCreate( mainLCD_QUEUE_LENGTH, sizeof( LCDMessage ) );
|
xLCDQueue = xQueueCreate( mainLCD_QUEUE_LENGTH, sizeof( LCDMessage ) );
|
||||||
|
|
||||||
/* Create the standard demo application tasks. See the WEB documentation
|
/* Create the standard demo application tasks. See the WEB documentation
|
||||||
for more information on these tasks. */
|
for more information on these tasks. */
|
||||||
vCreateBlockTimeTasks();
|
vCreateBlockTimeTasks();
|
||||||
|
@ -190,13 +190,13 @@ int main( void )
|
||||||
vStartDynamicPriorityTasks();
|
vStartDynamicPriorityTasks();
|
||||||
vStartLEDFlashTasks( mainLED_TASK_PRIORITY );
|
vStartLEDFlashTasks( mainLED_TASK_PRIORITY );
|
||||||
vStartIntegerMathTasks( tskIDLE_PRIORITY );
|
vStartIntegerMathTasks( tskIDLE_PRIORITY );
|
||||||
|
|
||||||
/* Create the tasks defined within this file. */
|
/* Create the tasks defined within this file. */
|
||||||
xTaskCreate( vPrintTask, ( signed char * ) "LCD", configMINIMAL_STACK_SIZE, NULL, mainLCD_TASK_PRIORITY, NULL );
|
xTaskCreate( vPrintTask, "LCD", configMINIMAL_STACK_SIZE, NULL, mainLCD_TASK_PRIORITY, NULL );
|
||||||
xTaskCreate( vCheckTask, ( signed char * ) "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );
|
xTaskCreate( vCheckTask, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );
|
||||||
|
|
||||||
vTaskStartScheduler();
|
vTaskStartScheduler();
|
||||||
|
|
||||||
/* Execution will only reach here if there was insufficient heap to
|
/* Execution will only reach here if there was insufficient heap to
|
||||||
start the scheduler. */
|
start the scheduler. */
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -205,7 +205,7 @@ int main( void )
|
||||||
|
|
||||||
static void vCheckTask( void *pvParameters )
|
static void vCheckTask( void *pvParameters )
|
||||||
{
|
{
|
||||||
static unsigned long ulErrorDetected = pdFALSE;
|
static unsigned long ulErrorDetected = pdFALSE;
|
||||||
portTickType xLastExecutionTime;
|
portTickType xLastExecutionTime;
|
||||||
unsigned char *ucErrorMessage = ( unsigned char * )" FAIL";
|
unsigned char *ucErrorMessage = ( unsigned char * )" FAIL";
|
||||||
unsigned char *ucSuccessMessage = ( unsigned char * )" PASS";
|
unsigned char *ucSuccessMessage = ( unsigned char * )" PASS";
|
||||||
|
@ -222,7 +222,7 @@ LCDMessage xMessage;
|
||||||
vTaskDelayUntil( &xLastExecutionTime, mainCHECK_TASK_CYCLE_TIME );
|
vTaskDelayUntil( &xLastExecutionTime, mainCHECK_TASK_CYCLE_TIME );
|
||||||
|
|
||||||
/* Has an error been found in any of the standard demo tasks? */
|
/* Has an error been found in any of the standard demo tasks? */
|
||||||
|
|
||||||
if( xAreIntegerMathsTaskStillRunning() != pdTRUE )
|
if( xAreIntegerMathsTaskStillRunning() != pdTRUE )
|
||||||
{
|
{
|
||||||
ulErrorDetected = pdTRUE;
|
ulErrorDetected = pdTRUE;
|
||||||
|
@ -237,17 +237,17 @@ LCDMessage xMessage;
|
||||||
{
|
{
|
||||||
ulErrorDetected = pdTRUE;
|
ulErrorDetected = pdTRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( xAreComTestTasksStillRunning() != pdTRUE )
|
if( xAreComTestTasksStillRunning() != pdTRUE )
|
||||||
{
|
{
|
||||||
ulErrorDetected = pdTRUE;
|
ulErrorDetected = pdTRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( xAreDynamicPriorityTasksStillRunning() != pdTRUE )
|
if( xAreDynamicPriorityTasksStillRunning() != pdTRUE )
|
||||||
{
|
{
|
||||||
ulErrorDetected = pdTRUE;
|
ulErrorDetected = pdTRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Calculate the LCD line on which we would like the message to
|
/* Calculate the LCD line on which we would like the message to
|
||||||
be displayed. The column variable is used for convenience as
|
be displayed. The column variable is used for convenience as
|
||||||
it is incremented each cycle anyway. */
|
it is incremented each cycle anyway. */
|
||||||
|
@ -256,19 +256,19 @@ LCDMessage xMessage;
|
||||||
/* The message displayed depends on whether an error was found or
|
/* The message displayed depends on whether an error was found or
|
||||||
not. Any discovered error is latched. Here the column variable
|
not. Any discovered error is latched. Here the column variable
|
||||||
is used as an index into the text string as a simple way of moving
|
is used as an index into the text string as a simple way of moving
|
||||||
the text from column to column. */
|
the text from column to column. */
|
||||||
if( ulErrorDetected == pdFALSE )
|
if( ulErrorDetected == pdFALSE )
|
||||||
{
|
{
|
||||||
xMessage.pucString = ucSuccessMessage + uxColumn;
|
xMessage.pucString = ucSuccessMessage + uxColumn;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
xMessage.pucString = ucErrorMessage + uxColumn;
|
xMessage.pucString = ucErrorMessage + uxColumn;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Send the message to the print task for display. */
|
/* Send the message to the print task for display. */
|
||||||
xQueueSend( xLCDQueue, ( void * ) &xMessage, mainNO_DELAY );
|
xQueueSend( xLCDQueue, ( void * ) &xMessage, mainNO_DELAY );
|
||||||
|
|
||||||
/* Make sure the message is printed in a different column the next
|
/* Make sure the message is printed in a different column the next
|
||||||
time around. */
|
time around. */
|
||||||
uxColumn--;
|
uxColumn--;
|
||||||
|
@ -289,7 +289,7 @@ LCDMessage xMessage;
|
||||||
{
|
{
|
||||||
/* Wait until a message arrives. */
|
/* Wait until a message arrives. */
|
||||||
while( xQueueReceive( xLCDQueue, ( void * ) &xMessage, portMAX_DELAY ) != pdPASS );
|
while( xQueueReceive( xLCDQueue, ( void * ) &xMessage, portMAX_DELAY ) != pdPASS );
|
||||||
|
|
||||||
/* The message contains the text to display, and the line on which the
|
/* The message contains the text to display, and the line on which the
|
||||||
text should be displayed. */
|
text should be displayed. */
|
||||||
LCD_Clear();
|
LCD_Clear();
|
||||||
|
@ -300,51 +300,51 @@ LCDMessage xMessage;
|
||||||
|
|
||||||
static void prvSetupHardware(void)
|
static void prvSetupHardware(void)
|
||||||
{
|
{
|
||||||
ErrorStatus OSC4MStartUpStatus01;
|
ErrorStatus OSC4MStartUpStatus01;
|
||||||
|
|
||||||
/* ST provided routine. */
|
/* ST provided routine. */
|
||||||
|
|
||||||
/* MRCC system reset */
|
/* MRCC system reset */
|
||||||
MRCC_DeInit();
|
MRCC_DeInit();
|
||||||
|
|
||||||
/* Wait for OSC4M start-up */
|
/* Wait for OSC4M start-up */
|
||||||
OSC4MStartUpStatus01 = MRCC_WaitForOSC4MStartUp();
|
OSC4MStartUpStatus01 = MRCC_WaitForOSC4MStartUp();
|
||||||
|
|
||||||
if(OSC4MStartUpStatus01 == SUCCESS)
|
if(OSC4MStartUpStatus01 == SUCCESS)
|
||||||
{
|
{
|
||||||
/* Set HCLK to 60MHz */
|
/* Set HCLK to 60MHz */
|
||||||
MRCC_HCLKConfig(MRCC_CKSYS_Div1);
|
MRCC_HCLKConfig(MRCC_CKSYS_Div1);
|
||||||
|
|
||||||
/* Set CKTIM to 60MHz */
|
/* Set CKTIM to 60MHz */
|
||||||
MRCC_CKTIMConfig(MRCC_HCLK_Div1);
|
MRCC_CKTIMConfig(MRCC_HCLK_Div1);
|
||||||
|
|
||||||
/* Set PCLK to 30MHz */
|
/* Set PCLK to 30MHz */
|
||||||
MRCC_PCLKConfig(MRCC_CKTIM_Div2);
|
MRCC_PCLKConfig(MRCC_CKTIM_Div2);
|
||||||
|
|
||||||
/* Enable Flash Burst mode */
|
/* Enable Flash Burst mode */
|
||||||
CFG_FLASHBurstConfig(CFG_FLASHBurst_Enable);
|
CFG_FLASHBurstConfig(CFG_FLASHBurst_Enable);
|
||||||
|
|
||||||
/* Set CK_SYS to 60 MHz */
|
/* Set CK_SYS to 60 MHz */
|
||||||
MRCC_CKSYSConfig(MRCC_CKSYS_OSC4MPLL, MRCC_PLL_Mul_15);
|
MRCC_CKSYSConfig(MRCC_CKSYS_OSC4MPLL, MRCC_PLL_Mul_15);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* GPIO pins optimized for 3V3 operation */
|
/* GPIO pins optimized for 3V3 operation */
|
||||||
MRCC_IOVoltageRangeConfig(MRCC_IOVoltageRange_3V3);
|
MRCC_IOVoltageRangeConfig(MRCC_IOVoltageRange_3V3);
|
||||||
|
|
||||||
/* GPIO clock source enable */
|
/* GPIO clock source enable */
|
||||||
MRCC_PeripheralClockConfig(MRCC_Peripheral_GPIO, ENABLE);
|
MRCC_PeripheralClockConfig(MRCC_Peripheral_GPIO, ENABLE);
|
||||||
|
|
||||||
/* EXTIT clock source enable */
|
/* EXTIT clock source enable */
|
||||||
MRCC_PeripheralClockConfig(MRCC_Peripheral_EXTIT, ENABLE);
|
MRCC_PeripheralClockConfig(MRCC_Peripheral_EXTIT, ENABLE);
|
||||||
/* TB clock source enable */
|
/* TB clock source enable */
|
||||||
MRCC_PeripheralClockConfig(MRCC_Peripheral_TB, ENABLE);
|
MRCC_PeripheralClockConfig(MRCC_Peripheral_TB, ENABLE);
|
||||||
|
|
||||||
/* Initialize the demonstration menu */
|
/* Initialize the demonstration menu */
|
||||||
LCD_Init();
|
LCD_Init();
|
||||||
|
|
||||||
LCD_DisplayString(Line1, ( unsigned char * ) "www.FreeRTOS.org", BlackText);
|
LCD_DisplayString(Line1, ( unsigned char * ) "www.FreeRTOS.org", BlackText);
|
||||||
LCD_DisplayString(Line2, ( unsigned char * ) " STR750 Demo ", BlackText);
|
LCD_DisplayString(Line2, ( unsigned char * ) " STR750 Demo ", BlackText);
|
||||||
|
|
||||||
EIC_IRQCmd(ENABLE);
|
EIC_IRQCmd(ENABLE);
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
All rights reserved
|
All rights reserved
|
||||||
|
|
||||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
@ -180,8 +180,8 @@ void main( void )
|
||||||
vParTestInitialise();
|
vParTestInitialise();
|
||||||
|
|
||||||
/* Create the queue used to communicate with the LCD print task. */
|
/* Create the queue used to communicate with the LCD print task. */
|
||||||
xLCDQueue = xQueueCreate( mainLCD_QUEUE_LENGTH, sizeof( LCDMessage ) );
|
xLCDQueue = xQueueCreate( mainLCD_QUEUE_LENGTH, sizeof( LCDMessage ) );
|
||||||
|
|
||||||
/* Create the standard demo application tasks. See the WEB documentation
|
/* Create the standard demo application tasks. See the WEB documentation
|
||||||
for more information on these tasks. */
|
for more information on these tasks. */
|
||||||
vCreateBlockTimeTasks();
|
vCreateBlockTimeTasks();
|
||||||
|
@ -190,13 +190,13 @@ void main( void )
|
||||||
vStartDynamicPriorityTasks();
|
vStartDynamicPriorityTasks();
|
||||||
vStartLEDFlashTasks( mainLED_TASK_PRIORITY );
|
vStartLEDFlashTasks( mainLED_TASK_PRIORITY );
|
||||||
vStartIntegerMathTasks( tskIDLE_PRIORITY );
|
vStartIntegerMathTasks( tskIDLE_PRIORITY );
|
||||||
|
|
||||||
/* Create the tasks defined within this file. */
|
/* Create the tasks defined within this file. */
|
||||||
xTaskCreate( vPrintTask, ( signed char * ) "LCD", configMINIMAL_STACK_SIZE, NULL, mainLCD_TASK_PRIORITY, NULL );
|
xTaskCreate( vPrintTask, "LCD", configMINIMAL_STACK_SIZE, NULL, mainLCD_TASK_PRIORITY, NULL );
|
||||||
xTaskCreate( vCheckTask, ( signed char * ) "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );
|
xTaskCreate( vCheckTask, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );
|
||||||
|
|
||||||
vTaskStartScheduler();
|
vTaskStartScheduler();
|
||||||
|
|
||||||
/* Execution will only reach here if there was insufficient heap to
|
/* Execution will only reach here if there was insufficient heap to
|
||||||
start the scheduler. */
|
start the scheduler. */
|
||||||
}
|
}
|
||||||
|
@ -204,7 +204,7 @@ void main( void )
|
||||||
|
|
||||||
static void vCheckTask( void *pvParameters )
|
static void vCheckTask( void *pvParameters )
|
||||||
{
|
{
|
||||||
static unsigned long ulErrorDetected = pdFALSE;
|
static unsigned long ulErrorDetected = pdFALSE;
|
||||||
portTickType xLastExecutionTime;
|
portTickType xLastExecutionTime;
|
||||||
unsigned char *cErrorMessage = " FAIL";
|
unsigned char *cErrorMessage = " FAIL";
|
||||||
unsigned char *cSuccessMessage = " PASS";
|
unsigned char *cSuccessMessage = " PASS";
|
||||||
|
@ -221,7 +221,7 @@ LCDMessage xMessage;
|
||||||
vTaskDelayUntil( &xLastExecutionTime, mainCHECK_TASK_CYCLE_TIME );
|
vTaskDelayUntil( &xLastExecutionTime, mainCHECK_TASK_CYCLE_TIME );
|
||||||
|
|
||||||
/* Has an error been found in any of the standard demo tasks? */
|
/* Has an error been found in any of the standard demo tasks? */
|
||||||
|
|
||||||
if( xAreIntegerMathsTaskStillRunning() != pdTRUE )
|
if( xAreIntegerMathsTaskStillRunning() != pdTRUE )
|
||||||
{
|
{
|
||||||
ulErrorDetected = pdTRUE;
|
ulErrorDetected = pdTRUE;
|
||||||
|
@ -236,17 +236,17 @@ LCDMessage xMessage;
|
||||||
{
|
{
|
||||||
ulErrorDetected = pdTRUE;
|
ulErrorDetected = pdTRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( xAreComTestTasksStillRunning() != pdTRUE )
|
if( xAreComTestTasksStillRunning() != pdTRUE )
|
||||||
{
|
{
|
||||||
ulErrorDetected = pdTRUE;
|
ulErrorDetected = pdTRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( xAreDynamicPriorityTasksStillRunning() != pdTRUE )
|
if( xAreDynamicPriorityTasksStillRunning() != pdTRUE )
|
||||||
{
|
{
|
||||||
ulErrorDetected = pdTRUE;
|
ulErrorDetected = pdTRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Calculate the LCD line on which we would like the message to
|
/* Calculate the LCD line on which we would like the message to
|
||||||
be displayed. The column variable is used for convenience as
|
be displayed. The column variable is used for convenience as
|
||||||
it is incremented each cycle anyway. */
|
it is incremented each cycle anyway. */
|
||||||
|
@ -255,19 +255,19 @@ LCDMessage xMessage;
|
||||||
/* The message displayed depends on whether an error was found or
|
/* The message displayed depends on whether an error was found or
|
||||||
not. Any discovered error is latched. Here the column variable
|
not. Any discovered error is latched. Here the column variable
|
||||||
is used as an index into the text string as a simple way of moving
|
is used as an index into the text string as a simple way of moving
|
||||||
the text from column to column. */
|
the text from column to column. */
|
||||||
if( ulErrorDetected == pdFALSE )
|
if( ulErrorDetected == pdFALSE )
|
||||||
{
|
{
|
||||||
xMessage.pucString = cSuccessMessage + uxColumn;
|
xMessage.pucString = cSuccessMessage + uxColumn;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
xMessage.pucString = cErrorMessage + uxColumn;
|
xMessage.pucString = cErrorMessage + uxColumn;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Send the message to the print task for display. */
|
/* Send the message to the print task for display. */
|
||||||
xQueueSend( xLCDQueue, ( void * ) &xMessage, mainNO_DELAY );
|
xQueueSend( xLCDQueue, ( void * ) &xMessage, mainNO_DELAY );
|
||||||
|
|
||||||
/* Make sure the message is printed in a different column the next
|
/* Make sure the message is printed in a different column the next
|
||||||
time around. */
|
time around. */
|
||||||
uxColumn--;
|
uxColumn--;
|
||||||
|
@ -287,7 +287,7 @@ LCDMessage xMessage;
|
||||||
{
|
{
|
||||||
/* Wait until a message arrives. */
|
/* Wait until a message arrives. */
|
||||||
while( xQueueReceive( xLCDQueue, ( void * ) &xMessage, portMAX_DELAY ) != pdPASS );
|
while( xQueueReceive( xLCDQueue, ( void * ) &xMessage, portMAX_DELAY ) != pdPASS );
|
||||||
|
|
||||||
/* The message contains the text to display, and the line on which the
|
/* The message contains the text to display, and the line on which the
|
||||||
text should be displayed. */
|
text should be displayed. */
|
||||||
LCD_Clear();
|
LCD_Clear();
|
||||||
|
@ -298,51 +298,51 @@ LCDMessage xMessage;
|
||||||
|
|
||||||
static void prvSetupHardware(void)
|
static void prvSetupHardware(void)
|
||||||
{
|
{
|
||||||
ErrorStatus OSC4MStartUpStatus01;
|
ErrorStatus OSC4MStartUpStatus01;
|
||||||
|
|
||||||
/* ST provided routine. */
|
/* ST provided routine. */
|
||||||
|
|
||||||
/* MRCC system reset */
|
/* MRCC system reset */
|
||||||
MRCC_DeInit();
|
MRCC_DeInit();
|
||||||
|
|
||||||
/* Wait for OSC4M start-up */
|
/* Wait for OSC4M start-up */
|
||||||
OSC4MStartUpStatus01 = MRCC_WaitForOSC4MStartUp();
|
OSC4MStartUpStatus01 = MRCC_WaitForOSC4MStartUp();
|
||||||
|
|
||||||
if(OSC4MStartUpStatus01 == SUCCESS)
|
if(OSC4MStartUpStatus01 == SUCCESS)
|
||||||
{
|
{
|
||||||
/* Set HCLK to 60MHz */
|
/* Set HCLK to 60MHz */
|
||||||
MRCC_HCLKConfig(MRCC_CKSYS_Div1);
|
MRCC_HCLKConfig(MRCC_CKSYS_Div1);
|
||||||
|
|
||||||
/* Set CKTIM to 60MHz */
|
/* Set CKTIM to 60MHz */
|
||||||
MRCC_CKTIMConfig(MRCC_HCLK_Div1);
|
MRCC_CKTIMConfig(MRCC_HCLK_Div1);
|
||||||
|
|
||||||
/* Set PCLK to 30MHz */
|
/* Set PCLK to 30MHz */
|
||||||
MRCC_PCLKConfig(MRCC_CKTIM_Div2);
|
MRCC_PCLKConfig(MRCC_CKTIM_Div2);
|
||||||
|
|
||||||
/* Enable Flash Burst mode */
|
/* Enable Flash Burst mode */
|
||||||
CFG_FLASHBurstConfig(CFG_FLASHBurst_Enable);
|
CFG_FLASHBurstConfig(CFG_FLASHBurst_Enable);
|
||||||
|
|
||||||
/* Set CK_SYS to 60 MHz */
|
/* Set CK_SYS to 60 MHz */
|
||||||
MRCC_CKSYSConfig(MRCC_CKSYS_OSC4MPLL, MRCC_PLL_Mul_15);
|
MRCC_CKSYSConfig(MRCC_CKSYS_OSC4MPLL, MRCC_PLL_Mul_15);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* GPIO pins optimized for 3V3 operation */
|
/* GPIO pins optimized for 3V3 operation */
|
||||||
MRCC_IOVoltageRangeConfig(MRCC_IOVoltageRange_3V3);
|
MRCC_IOVoltageRangeConfig(MRCC_IOVoltageRange_3V3);
|
||||||
|
|
||||||
/* GPIO clock source enable */
|
/* GPIO clock source enable */
|
||||||
MRCC_PeripheralClockConfig(MRCC_Peripheral_GPIO, ENABLE);
|
MRCC_PeripheralClockConfig(MRCC_Peripheral_GPIO, ENABLE);
|
||||||
|
|
||||||
/* EXTIT clock source enable */
|
/* EXTIT clock source enable */
|
||||||
MRCC_PeripheralClockConfig(MRCC_Peripheral_EXTIT, ENABLE);
|
MRCC_PeripheralClockConfig(MRCC_Peripheral_EXTIT, ENABLE);
|
||||||
/* TB clock source enable */
|
/* TB clock source enable */
|
||||||
MRCC_PeripheralClockConfig(MRCC_Peripheral_TB, ENABLE);
|
MRCC_PeripheralClockConfig(MRCC_Peripheral_TB, ENABLE);
|
||||||
|
|
||||||
/* Initialize the demonstration menu */
|
/* Initialize the demonstration menu */
|
||||||
LCD_Init();
|
LCD_Init();
|
||||||
|
|
||||||
LCD_DisplayString(Line1, "www.FreeRTOS.org", BlackText);
|
LCD_DisplayString(Line1, "www.FreeRTOS.org", BlackText);
|
||||||
LCD_DisplayString(Line2, " STR750 Demo ", BlackText);
|
LCD_DisplayString(Line2, " STR750 Demo ", BlackText);
|
||||||
|
|
||||||
EIC_IRQCmd(ENABLE);
|
EIC_IRQCmd(ENABLE);
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
|
@ -123,7 +123,7 @@ portTickType StartTime, EndTime, Elapsed;
|
||||||
{
|
{
|
||||||
msg = &dummyptr;
|
msg = &dummyptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( timeout != 0 )
|
if( timeout != 0 )
|
||||||
{
|
{
|
||||||
if(pdTRUE == xQueueReceive( mbox, &(*msg), timeout ) )
|
if(pdTRUE == xQueueReceive( mbox, &(*msg), timeout ) )
|
||||||
|
@ -154,7 +154,7 @@ portTickType StartTime, EndTime, Elapsed;
|
||||||
{
|
{
|
||||||
Elapsed = 1;
|
Elapsed = 1;
|
||||||
}
|
}
|
||||||
return ( Elapsed ); // return time blocked TBD test
|
return ( Elapsed ); // return time blocked TBD test
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -217,7 +217,7 @@ portTickType StartTime, EndTime, Elapsed;
|
||||||
{
|
{
|
||||||
Elapsed = 1;
|
Elapsed = 1;
|
||||||
}
|
}
|
||||||
return (Elapsed); // return time blocked TBD test
|
return (Elapsed); // return time blocked TBD test
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -237,8 +237,8 @@ portTickType StartTime, EndTime, Elapsed;
|
||||||
Elapsed = 1;
|
Elapsed = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ( Elapsed ); // return time blocked
|
return ( Elapsed ); // return time blocked
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -275,7 +275,7 @@ sys_init(void)
|
||||||
|
|
||||||
// keep track of how many threads have been created
|
// keep track of how many threads have been created
|
||||||
nextthread = 0;
|
nextthread = 0;
|
||||||
|
|
||||||
s_sys_arch_state.nTaskCount = 0;
|
s_sys_arch_state.nTaskCount = 0;
|
||||||
sys_set_default_state();
|
sys_set_default_state();
|
||||||
}
|
}
|
||||||
|
@ -329,7 +329,7 @@ sys_thread_t sys_thread_new(void (* thread)(void *arg), void *arg, int prio)
|
||||||
xTaskHandle CreatedTask;
|
xTaskHandle CreatedTask;
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
result = xTaskCreate(thread, ( signed char * ) s_sys_arch_state.cTaskName, s_sys_arch_state.nStackDepth, arg, prio, &CreatedTask );
|
result = xTaskCreate(thread, s_sys_arch_state.cTaskName, s_sys_arch_state.nStackDepth, arg, prio, &CreatedTask );
|
||||||
|
|
||||||
// For each task created, store the task handle (pid) in the timers array.
|
// For each task created, store the task handle (pid) in the timers array.
|
||||||
// This scheme doesn't allow for threads to be deleted
|
// This scheme doesn't allow for threads to be deleted
|
||||||
|
@ -338,7 +338,7 @@ int result;
|
||||||
if(result == pdPASS)
|
if(result == pdPASS)
|
||||||
{
|
{
|
||||||
++s_sys_arch_state.nTaskCount;
|
++s_sys_arch_state.nTaskCount;
|
||||||
|
|
||||||
return CreatedTask;
|
return CreatedTask;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -116,23 +116,23 @@ static void low_level_init(struct netif *netif)
|
||||||
ENET_InitClocksGPIO();
|
ENET_InitClocksGPIO();
|
||||||
ENET_Init();
|
ENET_Init();
|
||||||
ENET_Start();
|
ENET_Start();
|
||||||
|
|
||||||
portENTER_CRITICAL();
|
portENTER_CRITICAL();
|
||||||
{
|
{
|
||||||
/*set MAC physical*/
|
/*set MAC physical*/
|
||||||
ENET_MAC->MAH = (MAC_ADDR5<<8) + MAC_ADDR4;
|
ENET_MAC->MAH = (MAC_ADDR5<<8) + MAC_ADDR4;
|
||||||
ENET_MAC->MAL = (MAC_ADDR3<<24) + (MAC_ADDR2<<16) + (MAC_ADDR1<<8) + MAC_ADDR0;
|
ENET_MAC->MAL = (MAC_ADDR3<<24) + (MAC_ADDR2<<16) + (MAC_ADDR1<<8) + MAC_ADDR0;
|
||||||
|
|
||||||
VIC_Config( ENET_ITLine, VIC_IRQ, 1 );
|
VIC_Config( ENET_ITLine, VIC_IRQ, 1 );
|
||||||
VIC_ITCmd( ENET_ITLine, ENABLE );
|
VIC_ITCmd( ENET_ITLine, ENABLE );
|
||||||
ENET_DMA->ISR = DMI_RX_CURRENT_DONE;
|
ENET_DMA->ISR = DMI_RX_CURRENT_DONE;
|
||||||
ENET_DMA->IER = DMI_RX_CURRENT_DONE;
|
ENET_DMA->IER = DMI_RX_CURRENT_DONE;
|
||||||
}
|
}
|
||||||
portEXIT_CRITICAL();
|
portEXIT_CRITICAL();
|
||||||
|
|
||||||
/* Create the task that handles the EMAC. */
|
/* Create the task that handles the EMAC. */
|
||||||
xTaskCreate( ethernetif_input, ( signed char * ) "ETH_INT", netifINTERFACE_TASK_STACK_SIZE, NULL, netifINTERFACE_TASK_PRIORITY, NULL );
|
xTaskCreate( ethernetif_input, "ETH_INT", netifINTERFACE_TASK_STACK_SIZE, NULL, netifINTERFACE_TASK_PRIORITY, NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -303,17 +303,17 @@ static void ethernetif_input( void * pvParameters )
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
ethernetif = s_pxNetIf->state;
|
ethernetif = s_pxNetIf->state;
|
||||||
|
|
||||||
/* move received packet into a new pbuf */
|
/* move received packet into a new pbuf */
|
||||||
p = low_level_input( s_pxNetIf );
|
p = low_level_input( s_pxNetIf );
|
||||||
|
|
||||||
if( p == NULL )
|
if( p == NULL )
|
||||||
{
|
{
|
||||||
/* No packet could be read. Wait a for an interrupt to tell us
|
/* No packet could be read. Wait a for an interrupt to tell us
|
||||||
there is more data available. */
|
there is more data available. */
|
||||||
vEMACWaitForInput();
|
vEMACWaitForInput();
|
||||||
}
|
}
|
||||||
|
|
||||||
} while( p == NULL );
|
} while( p == NULL );
|
||||||
|
|
||||||
/* points to packet payload, which starts with an Ethernet header */
|
/* points to packet payload, which starts with an Ethernet header */
|
||||||
|
@ -336,12 +336,12 @@ static void ethernetif_input( void * pvParameters )
|
||||||
/* pass to network layer */
|
/* pass to network layer */
|
||||||
s_pxNetIf->input(p, s_pxNetIf);
|
s_pxNetIf->input(p, s_pxNetIf);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ETHTYPE_ARP:
|
case ETHTYPE_ARP:
|
||||||
/* pass p to ARP module */
|
/* pass p to ARP module */
|
||||||
etharp_arp_input(s_pxNetIf, ethernetif->ethaddr, p);
|
etharp_arp_input(s_pxNetIf, ethernetif->ethaddr, p);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
pbuf_free(p);
|
pbuf_free(p);
|
||||||
p = NULL;
|
p = NULL;
|
||||||
|
@ -394,7 +394,7 @@ ethernetif_init(struct netif *netif)
|
||||||
netif->ifoutnucastpkts = 0;
|
netif->ifoutnucastpkts = 0;
|
||||||
netif->ifoutdiscards = 0;
|
netif->ifoutdiscards = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
netif->state = ethernetif;
|
netif->state = ethernetif;
|
||||||
netif->name[0] = IFNAME0;
|
netif->name[0] = IFNAME0;
|
||||||
netif->name[1] = IFNAME1;
|
netif->name[1] = IFNAME1;
|
||||||
|
@ -419,11 +419,11 @@ portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
|
||||||
|
|
||||||
/* Give the semaphore in case the lwIP task needs waking. */
|
/* Give the semaphore in case the lwIP task needs waking. */
|
||||||
xSemaphoreGiveFromISR( s_xSemaphore, &xHigherPriorityTaskWoken );
|
xSemaphoreGiveFromISR( s_xSemaphore, &xHigherPriorityTaskWoken );
|
||||||
|
|
||||||
/* Clear the interrupt. */
|
/* Clear the interrupt. */
|
||||||
ENET_DMA->ISR = DMI_RX_CURRENT_DONE;
|
ENET_DMA->ISR = DMI_RX_CURRENT_DONE;
|
||||||
|
|
||||||
/* Switch tasks if necessary. */
|
/* Switch tasks if necessary. */
|
||||||
portEND_SWITCHING_ISR( xHigherPriorityTaskWoken );
|
portEND_SWITCHING_ISR( xHigherPriorityTaskWoken );
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
|
@ -97,7 +97,7 @@ PT_THREAD(file_stats(struct httpd_state *s, char *ptr))
|
||||||
PSOCK_BEGIN(&s->sout);
|
PSOCK_BEGIN(&s->sout);
|
||||||
|
|
||||||
PSOCK_GENERATOR_SEND(&s->sout, generate_file_stats, strchr(ptr, ' ') + 1);
|
PSOCK_GENERATOR_SEND(&s->sout, generate_file_stats, strchr(ptr, ' ') + 1);
|
||||||
|
|
||||||
PSOCK_END(&s->sout);
|
PSOCK_END(&s->sout);
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
@ -138,14 +138,14 @@ static const char *states[] = {
|
||||||
closing,
|
closing,
|
||||||
time_wait,
|
time_wait,
|
||||||
last_ack};
|
last_ack};
|
||||||
|
|
||||||
|
|
||||||
static unsigned short
|
static unsigned short
|
||||||
generate_tcp_stats(void *arg)
|
generate_tcp_stats(void *arg)
|
||||||
{
|
{
|
||||||
struct uip_conn *conn;
|
struct uip_conn *conn;
|
||||||
struct httpd_state *s = (struct httpd_state *)arg;
|
struct httpd_state *s = (struct httpd_state *)arg;
|
||||||
|
|
||||||
conn = &uip_conns[s->count];
|
conn = &uip_conns[s->count];
|
||||||
return snprintf((char *)uip_appdata, UIP_APPDATA_SIZE,
|
return snprintf((char *)uip_appdata, UIP_APPDATA_SIZE,
|
||||||
"<tr><td>%d</td><td>%u.%u.%u.%u:%u</td><td>%s</td><td>%u</td><td>%u</td><td>%c %c</td></tr>\r\n",
|
"<tr><td>%d</td><td>%u.%u.%u.%u:%u</td><td>%s</td><td>%u</td><td>%u</td><td>%c %c</td></tr>\r\n",
|
||||||
|
@ -165,7 +165,7 @@ generate_tcp_stats(void *arg)
|
||||||
static
|
static
|
||||||
PT_THREAD(tcp_stats(struct httpd_state *s, char *ptr))
|
PT_THREAD(tcp_stats(struct httpd_state *s, char *ptr))
|
||||||
{
|
{
|
||||||
|
|
||||||
PSOCK_BEGIN(&s->sout);
|
PSOCK_BEGIN(&s->sout);
|
||||||
|
|
||||||
for(s->count = 0; s->count < UIP_CONNS; ++s->count) {
|
for(s->count = 0; s->count < UIP_CONNS; ++s->count) {
|
||||||
|
@ -196,14 +196,14 @@ PT_THREAD(net_stats(struct httpd_state *s, char *ptr))
|
||||||
++s->count) {
|
++s->count) {
|
||||||
PSOCK_GENERATOR_SEND(&s->sout, generate_net_stats, s);
|
PSOCK_GENERATOR_SEND(&s->sout, generate_net_stats, s);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* UIP_STATISTICS */
|
#endif /* UIP_STATISTICS */
|
||||||
|
|
||||||
PSOCK_END(&s->sout);
|
PSOCK_END(&s->sout);
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
extern void vTaskList( signed char *pcWriteBuffer );
|
extern void vTaskList( char *pcWriteBuffer );
|
||||||
static char cCountBuf[ 32 ];
|
static char cCountBuf[ 32 ];
|
||||||
long lRefreshCount = 0;
|
long lRefreshCount = 0;
|
||||||
static unsigned short
|
static unsigned short
|
||||||
|
@ -211,9 +211,9 @@ generate_rtos_stats(void *arg)
|
||||||
{
|
{
|
||||||
lRefreshCount++;
|
lRefreshCount++;
|
||||||
sprintf( cCountBuf, "<p><br>Refresh count = %d", lRefreshCount );
|
sprintf( cCountBuf, "<p><br>Refresh count = %d", lRefreshCount );
|
||||||
vTaskList( uip_appdata );
|
vTaskList( ( char * ) uip_appdata );
|
||||||
strcat( uip_appdata, cCountBuf );
|
strcat( uip_appdata, cCountBuf );
|
||||||
|
|
||||||
return strlen( uip_appdata );
|
return strlen( uip_appdata );
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
@ -225,7 +225,7 @@ PT_THREAD(rtos_stats(struct httpd_state *s, char *ptr))
|
||||||
PSOCK_BEGIN(&s->sout);
|
PSOCK_BEGIN(&s->sout);
|
||||||
// for( s->count = 0; s->count < 4; ++s->count )
|
// for( s->count = 0; s->count < 4; ++s->count )
|
||||||
// {
|
// {
|
||||||
PSOCK_GENERATOR_SEND(&s->sout, generate_rtos_stats, NULL);
|
PSOCK_GENERATOR_SEND(&s->sout, generate_rtos_stats, NULL);
|
||||||
// }
|
// }
|
||||||
PSOCK_END(&s->sout);
|
PSOCK_END(&s->sout);
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
All rights reserved
|
All rights reserved
|
||||||
|
|
||||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
@ -223,7 +223,7 @@ int main( void )
|
||||||
task as described at the top of this file. */
|
task as described at the top of this file. */
|
||||||
xTaskCreate(
|
xTaskCreate(
|
||||||
vErrorChecks
|
vErrorChecks
|
||||||
, (const signed portCHAR *)"ErrCheck"
|
, "ErrCheck"
|
||||||
, configMINIMAL_STACK_SIZE
|
, configMINIMAL_STACK_SIZE
|
||||||
, NULL
|
, NULL
|
||||||
, mainCHECK_TASK_PRIORITY
|
, mainCHECK_TASK_PRIORITY
|
||||||
|
@ -288,7 +288,7 @@ portBASE_TYPE bSuicidalTask = 0;
|
||||||
ulMemCheckTaskRunningCount = mainCOUNT_INITIAL_VALUE;
|
ulMemCheckTaskRunningCount = mainCOUNT_INITIAL_VALUE;
|
||||||
|
|
||||||
if( xTaskCreate( vMemCheckTask,
|
if( xTaskCreate( vMemCheckTask,
|
||||||
( signed portCHAR * ) "MEM_CHECK",
|
"MEM_CHECK",
|
||||||
configMINIMAL_STACK_SIZE,
|
configMINIMAL_STACK_SIZE,
|
||||||
( void * ) &ulMemCheckTaskRunningCount,
|
( void * ) &ulMemCheckTaskRunningCount,
|
||||||
tskIDLE_PRIORITY, &xCreatedTask ) != pdPASS )
|
tskIDLE_PRIORITY, &xCreatedTask ) != pdPASS )
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
All rights reserved
|
All rights reserved
|
||||||
|
|
||||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
@ -66,15 +66,15 @@
|
||||||
/*
|
/*
|
||||||
* Creates all the demo application tasks, then starts the scheduler. The WEB
|
* Creates all the demo application tasks, then starts the scheduler. The WEB
|
||||||
* documentation provides more details of the demo application tasks.
|
* documentation provides more details of the demo application tasks.
|
||||||
*
|
*
|
||||||
* Main. c also creates a task called "Check". This only executes every three
|
* Main. c also creates a task called "Check". This only executes every three
|
||||||
* seconds but has the highest priority so is guaranteed to get processor time.
|
* seconds but has the highest priority so is guaranteed to get processor time.
|
||||||
* Its main function is to check that all the other tasks are still operational.
|
* Its main function is to check that all the other tasks are still operational.
|
||||||
* Each task that does not flash an LED maintains a unique count that is
|
* Each task that does not flash an LED maintains a unique count that is
|
||||||
* incremented each time the task successfully completes its function. Should
|
* incremented each time the task successfully completes its function. Should
|
||||||
* any error occur within such a task the count is permanently halted. The
|
* any error occur within such a task the count is permanently halted. The
|
||||||
* check task inspects the count of each task to ensure it has changed since
|
* check task inspects the count of each task to ensure it has changed since
|
||||||
* the last time the check task executed. If all the count variables have
|
* the last time the check task executed. If all the count variables have
|
||||||
* changed all the tasks are still executing error free, and the check task
|
* changed all the tasks are still executing error free, and the check task
|
||||||
* toggles an LED. Should any task contain an error at any time the LED toggle
|
* toggles an LED. Should any task contain an error at any time the LED toggle
|
||||||
* will stop.
|
* will stop.
|
||||||
|
@ -84,12 +84,12 @@
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Changes from V1.2.0
|
Changes from V1.2.0
|
||||||
|
|
||||||
+ Changed the baud rate for the serial test from 19200 to 57600.
|
+ Changed the baud rate for the serial test from 19200 to 57600.
|
||||||
|
|
||||||
Changes from V1.2.3
|
Changes from V1.2.3
|
||||||
|
|
||||||
+ The integer and comtest tasks are now used when the cooperative scheduler
|
+ The integer and comtest tasks are now used when the cooperative scheduler
|
||||||
is being used. Previously they were only used with the preemptive
|
is being used. Previously they were only used with the preemptive
|
||||||
scheduler.
|
scheduler.
|
||||||
|
|
||||||
|
@ -118,7 +118,7 @@ Changes from V4.0.5
|
||||||
|
|
||||||
#ifdef GCC_MEGA_AVR
|
#ifdef GCC_MEGA_AVR
|
||||||
/* EEPROM routines used only with the WinAVR compiler. */
|
/* EEPROM routines used only with the WinAVR compiler. */
|
||||||
#include <avr/eeprom.h>
|
#include <avr/eeprom.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Scheduler include files. */
|
/* Scheduler include files. */
|
||||||
|
@ -173,12 +173,12 @@ static void vErrorChecks( void *pvParameters );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Checks the unique counts of other tasks to ensure they are still operational.
|
* Checks the unique counts of other tasks to ensure they are still operational.
|
||||||
* Flashes an LED if everything is okay.
|
* Flashes an LED if everything is okay.
|
||||||
*/
|
*/
|
||||||
static void prvCheckOtherTasksAreStillRunning( void );
|
static void prvCheckOtherTasksAreStillRunning( void );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Called on boot to increment a count stored in the EEPROM. This is used to
|
* Called on boot to increment a count stored in the EEPROM. This is used to
|
||||||
* ensure the CPU does not reset unexpectedly.
|
* ensure the CPU does not reset unexpectedly.
|
||||||
*/
|
*/
|
||||||
static void prvIncrementResetCount( void );
|
static void prvIncrementResetCount( void );
|
||||||
|
@ -202,15 +202,15 @@ short main( void )
|
||||||
vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED );
|
vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED );
|
||||||
vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY );
|
vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY );
|
||||||
vStartRegTestTasks();
|
vStartRegTestTasks();
|
||||||
|
|
||||||
/* Create the tasks defined within this file. */
|
/* Create the tasks defined within this file. */
|
||||||
xTaskCreate( vErrorChecks, ( signed char * ) "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );
|
xTaskCreate( vErrorChecks, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );
|
||||||
|
|
||||||
/* Create the co-routines that flash the LED's. */
|
/* Create the co-routines that flash the LED's. */
|
||||||
vStartFlashCoRoutines( mainNUM_FLASH_COROUTINES );
|
vStartFlashCoRoutines( mainNUM_FLASH_COROUTINES );
|
||||||
|
|
||||||
/* In this port, to use preemptive scheduler define configUSE_PREEMPTION
|
/* In this port, to use preemptive scheduler define configUSE_PREEMPTION
|
||||||
as 1 in portmacro.h. To use the cooperative scheduler define
|
as 1 in portmacro.h. To use the cooperative scheduler define
|
||||||
configUSE_PREEMPTION as 0. */
|
configUSE_PREEMPTION as 0. */
|
||||||
vTaskStartScheduler();
|
vTaskStartScheduler();
|
||||||
|
|
||||||
|
@ -231,11 +231,11 @@ static volatile unsigned long ulDummyVariable = 3UL;
|
||||||
{
|
{
|
||||||
vTaskDelay( mainCHECK_PERIOD );
|
vTaskDelay( mainCHECK_PERIOD );
|
||||||
|
|
||||||
/* Perform a bit of 32bit maths to ensure the registers used by the
|
/* Perform a bit of 32bit maths to ensure the registers used by the
|
||||||
integer tasks get some exercise. The result here is not important -
|
integer tasks get some exercise. The result here is not important -
|
||||||
see the demo application documentation for more info. */
|
see the demo application documentation for more info. */
|
||||||
ulDummyVariable *= 3;
|
ulDummyVariable *= 3;
|
||||||
|
|
||||||
prvCheckOtherTasksAreStillRunning();
|
prvCheckOtherTasksAreStillRunning();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -264,7 +264,7 @@ static portBASE_TYPE xErrorHasOccurred = pdFALSE;
|
||||||
{
|
{
|
||||||
xErrorHasOccurred = pdTRUE;
|
xErrorHasOccurred = pdTRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( xErrorHasOccurred == pdFALSE )
|
if( xErrorHasOccurred == pdFALSE )
|
||||||
{
|
{
|
||||||
/* Toggle the LED if everything is okay so we know if an error occurs even if not
|
/* Toggle the LED if everything is okay so we know if an error occurs even if not
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
All rights reserved
|
All rights reserved
|
||||||
|
|
||||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
@ -84,8 +84,8 @@ portBASE_TYPE xRegTestError = pdFALSE;
|
||||||
|
|
||||||
void vStartRegTestTasks( void )
|
void vStartRegTestTasks( void )
|
||||||
{
|
{
|
||||||
xTaskCreate( prvRegisterCheck1, ( signed char * ) "Reg1", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );
|
xTaskCreate( prvRegisterCheck1, "Reg1", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );
|
||||||
xTaskCreate( prvRegisterCheck2, ( signed char * ) "Reg2", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );
|
xTaskCreate( prvRegisterCheck2, "Reg2", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
@ -103,7 +103,7 @@ portBASE_TYPE xReturn;
|
||||||
{
|
{
|
||||||
xReturn = pdFALSE;
|
xReturn = pdFALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return xReturn;
|
return xReturn;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
@ -114,7 +114,7 @@ static void prvRegisterCheck1( void *pvParameters )
|
||||||
|
|
||||||
for( ;; )
|
for( ;; )
|
||||||
{
|
{
|
||||||
asm( "LDI r31, 5" );
|
asm( "LDI r31, 5" );
|
||||||
asm( "MOV r0, r31" );
|
asm( "MOV r0, r31" );
|
||||||
asm( "LDI r31, 6" );
|
asm( "LDI r31, 6" );
|
||||||
asm( "MOV r1, r31" );
|
asm( "MOV r1, r31" );
|
||||||
|
@ -257,7 +257,7 @@ static void prvRegisterCheck2( void *pvParameters )
|
||||||
|
|
||||||
for( ;; )
|
for( ;; )
|
||||||
{
|
{
|
||||||
asm( "LDI r31, 1" );
|
asm( "LDI r31, 1" );
|
||||||
asm( "MOV r0, r31" );
|
asm( "MOV r0, r31" );
|
||||||
asm( "LDI r31, 2" );
|
asm( "LDI r31, 2" );
|
||||||
asm( "MOV r1, r31" );
|
asm( "MOV r1, r31" );
|
||||||
|
|
|
@ -105,7 +105,7 @@ static PT_THREAD( file_stats ( struct httpd_state *s, char *ptr ) )
|
||||||
PSOCK_BEGIN( &s->sout );
|
PSOCK_BEGIN( &s->sout );
|
||||||
|
|
||||||
( void ) PT_YIELD_FLAG;
|
( void ) PT_YIELD_FLAG;
|
||||||
|
|
||||||
PSOCK_GENERATOR_SEND( &s->sout, generate_file_stats, strchr(ptr, ' ') + 1 );
|
PSOCK_GENERATOR_SEND( &s->sout, generate_file_stats, strchr(ptr, ' ') + 1 );
|
||||||
|
|
||||||
PSOCK_END( &s->sout );
|
PSOCK_END( &s->sout );
|
||||||
|
@ -178,7 +178,7 @@ static PT_THREAD( net_stats ( struct httpd_state *s, char *ptr ) )
|
||||||
}
|
}
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
extern void vTaskList( signed char *pcWriteBuffer );
|
extern void vTaskList( char *pcWriteBuffer );
|
||||||
extern char *pcGetTaskStatusMessage( void );
|
extern char *pcGetTaskStatusMessage( void );
|
||||||
static char cCountBuf[128];
|
static char cCountBuf[128];
|
||||||
long lRefreshCount = 0;
|
long lRefreshCount = 0;
|
||||||
|
@ -187,7 +187,7 @@ static unsigned short generate_rtos_stats( void *arg )
|
||||||
( void ) arg;
|
( void ) arg;
|
||||||
lRefreshCount++;
|
lRefreshCount++;
|
||||||
sprintf( cCountBuf, "<p><br>Refresh count = %d<p><br>%s", ( int ) lRefreshCount, pcGetTaskStatusMessage() );
|
sprintf( cCountBuf, "<p><br>Refresh count = %d<p><br>%s", ( int ) lRefreshCount, pcGetTaskStatusMessage() );
|
||||||
vTaskList( uip_appdata );
|
vTaskList( ( char * ) uip_appdata );
|
||||||
strcat( uip_appdata, cCountBuf );
|
strcat( uip_appdata, cCountBuf );
|
||||||
|
|
||||||
return strlen( uip_appdata );
|
return strlen( uip_appdata );
|
||||||
|
@ -225,22 +225,22 @@ static unsigned short generate_io_state( void *arg )
|
||||||
pcStatus = "";
|
pcStatus = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
usRawVoltage = ( unsigned short ) ACE_get_ppe_sample( xVoltageChannel );
|
usRawVoltage = ( unsigned short ) ACE_get_ppe_sample( xVoltageChannel );
|
||||||
sprintf( uip_appdata, "<input type=\"checkbox\" name=\"LED0\" value=\"1\" %s>LED<p><p><p>Raw voltage input is %d", pcStatus, usRawVoltage );
|
sprintf( uip_appdata, "<input type=\"checkbox\" name=\"LED0\" value=\"1\" %s>LED<p><p><p>Raw voltage input is %d", pcStatus, usRawVoltage );
|
||||||
|
|
||||||
return strlen( uip_appdata );
|
return strlen( uip_appdata );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
extern void vTaskGetRunTimeStats( signed char *pcWriteBuffer );
|
extern void vTaskGetRunTimeStats( char *pcWriteBuffer );
|
||||||
extern unsigned short usMaxJitter;
|
extern unsigned short usMaxJitter;
|
||||||
static unsigned short generate_runtime_stats( void *arg )
|
static unsigned short generate_runtime_stats( void *arg )
|
||||||
{
|
{
|
||||||
( void ) arg;
|
( void ) arg;
|
||||||
lRefreshCount++;
|
lRefreshCount++;
|
||||||
sprintf( cCountBuf, "<p><br>Refresh count = %d", ( int ) lRefreshCount );
|
sprintf( cCountBuf, "<p><br>Refresh count = %d", ( int ) lRefreshCount );
|
||||||
|
|
||||||
vTaskGetRunTimeStats( uip_appdata );
|
vTaskGetRunTimeStats( ( char * ) uip_appdata );
|
||||||
strcat( uip_appdata, cCountBuf );
|
strcat( uip_appdata, cCountBuf );
|
||||||
|
|
||||||
return strlen( uip_appdata );
|
return strlen( uip_appdata );
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
All rights reserved
|
All rights reserved
|
||||||
|
|
||||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
@ -188,17 +188,17 @@ int main(void)
|
||||||
{
|
{
|
||||||
/* Start the two tasks as described in the comments at the top of this
|
/* Start the two tasks as described in the comments at the top of this
|
||||||
file. */
|
file. */
|
||||||
xTaskCreate( prvQueueReceiveTask, ( signed char * ) "Rx", configMINIMAL_STACK_SIZE, NULL, mainQUEUE_RECEIVE_TASK_PRIORITY, NULL );
|
xTaskCreate( prvQueueReceiveTask, "Rx", configMINIMAL_STACK_SIZE, NULL, mainQUEUE_RECEIVE_TASK_PRIORITY, NULL );
|
||||||
xTaskCreate( prvQueueSendTask, ( signed char * ) "TX", configMINIMAL_STACK_SIZE, NULL, mainQUEUE_SEND_TASK_PRIORITY, NULL );
|
xTaskCreate( prvQueueSendTask, "TX", configMINIMAL_STACK_SIZE, NULL, mainQUEUE_SEND_TASK_PRIORITY, NULL );
|
||||||
|
|
||||||
/* Create the software timer that is responsible for turning off the LED
|
/* Create the software timer that is responsible for turning off the LED
|
||||||
if the button is not pushed within 5000ms, as described at the top of
|
if the button is not pushed within 5000ms, as described at the top of
|
||||||
this file. */
|
this file. */
|
||||||
xLEDTimer = xTimerCreate( ( const signed char * ) "LEDTimer", /* A text name, purely to help debugging. */
|
xLEDTimer = xTimerCreate( "LEDTimer", /* A text name, purely to help debugging. */
|
||||||
( 5000 / portTICK_RATE_MS ), /* The timer period, in this case 5000ms (5s). */
|
( 5000 / portTICK_RATE_MS ), /* The timer period, in this case 5000ms (5s). */
|
||||||
pdFALSE, /* This is a one shot timer, so xAutoReload is set to pdFALSE. */
|
pdFALSE, /* This is a one shot timer, so xAutoReload is set to pdFALSE. */
|
||||||
( void * ) 0, /* The ID is not used, so can be set to anything. */
|
( void * ) 0, /* The ID is not used, so can be set to anything. */
|
||||||
vLEDTimerCallback /* The callback function that switches the LED off. */
|
vLEDTimerCallback /* The callback function that switches the LED off. */
|
||||||
);
|
);
|
||||||
|
|
||||||
/* Start the tasks and timer running. */
|
/* Start the tasks and timer running. */
|
||||||
|
|
|
@ -302,27 +302,27 @@ int main(void)
|
||||||
{
|
{
|
||||||
/* Start the three application specific demo tasks, as described in the
|
/* Start the three application specific demo tasks, as described in the
|
||||||
comments at the top of this file. */
|
comments at the top of this file. */
|
||||||
xTaskCreate( prvQueueReceiveTask, ( signed char * ) "Rx", configMINIMAL_STACK_SIZE, NULL, mainQUEUE_RECEIVE_TASK_PRIORITY, NULL );
|
xTaskCreate( prvQueueReceiveTask, "Rx", configMINIMAL_STACK_SIZE, NULL, mainQUEUE_RECEIVE_TASK_PRIORITY, NULL );
|
||||||
xTaskCreate( prvQueueSendTask, ( signed char * ) "TX", configMINIMAL_STACK_SIZE, NULL, mainQUEUE_SEND_TASK_PRIORITY, NULL );
|
xTaskCreate( prvQueueSendTask, "TX", configMINIMAL_STACK_SIZE, NULL, mainQUEUE_SEND_TASK_PRIORITY, NULL );
|
||||||
xTaskCreate( prvOLEDTask, ( signed char * ) "OLED", configMINIMAL_STACK_SIZE, NULL, mainOLED_TASK_PRIORITY, NULL );
|
xTaskCreate( prvOLEDTask, "OLED", configMINIMAL_STACK_SIZE, NULL, mainOLED_TASK_PRIORITY, NULL );
|
||||||
|
|
||||||
/* Create the software timer that is responsible for turning off the LED
|
/* Create the software timer that is responsible for turning off the LED
|
||||||
if the button is not pushed within 5000ms, as described at the top of
|
if the button is not pushed within 5000ms, as described at the top of
|
||||||
this file. */
|
this file. */
|
||||||
xLEDTimer = xTimerCreate( ( const signed char * ) "LEDTimer", /* A text name, purely to help debugging. */
|
xLEDTimer = xTimerCreate( "LEDTimer", /* A text name, purely to help debugging. */
|
||||||
( mainLED_TIMER_PERIOD_MS ), /* The timer period, in this case 5000ms (5s). */
|
( mainLED_TIMER_PERIOD_MS ), /* The timer period, in this case 5000ms (5s). */
|
||||||
pdFALSE, /* This is a one shot timer, so xAutoReload is set to pdFALSE. */
|
pdFALSE, /* This is a one shot timer, so xAutoReload is set to pdFALSE. */
|
||||||
( void * ) 0, /* The ID is not used, so can be set to anything. */
|
( void * ) 0, /* The ID is not used, so can be set to anything. */
|
||||||
prvLEDTimerCallback /* The callback function that switches the LED off. */
|
prvLEDTimerCallback /* The callback function that switches the LED off. */
|
||||||
);
|
);
|
||||||
|
|
||||||
/* Create the software timer that performs the 'check' functionality,
|
/* Create the software timer that performs the 'check' functionality,
|
||||||
as described at the top of this file. */
|
as described at the top of this file. */
|
||||||
xCheckTimer = xTimerCreate( ( const signed char * ) "CheckTimer",/* A text name, purely to help debugging. */
|
xCheckTimer = xTimerCreate( "CheckTimer", /* A text name, purely to help debugging. */
|
||||||
( mainCHECK_TIMER_PERIOD_MS ), /* The timer period, in this case 3000ms (3s). */
|
( mainCHECK_TIMER_PERIOD_MS ), /* The timer period, in this case 3000ms (3s). */
|
||||||
pdTRUE, /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */
|
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. */
|
( 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. */
|
prvCheckTimerCallback /* The callback function that inspects the status of all the other tasks. */
|
||||||
);
|
);
|
||||||
|
|
||||||
/* Create a lot of 'standard demo' tasks. */
|
/* Create a lot of 'standard demo' tasks. */
|
||||||
|
@ -336,7 +336,7 @@ int main(void)
|
||||||
vStartTimerDemoTask( mainTIMER_TEST_PERIOD );
|
vStartTimerDemoTask( mainTIMER_TEST_PERIOD );
|
||||||
|
|
||||||
/* Create the web server task. */
|
/* Create the web server task. */
|
||||||
xTaskCreate( vuIP_Task, ( signed char * ) "uIP", mainuIP_STACK_SIZE, NULL, mainuIP_TASK_PRIORITY, NULL );
|
xTaskCreate( vuIP_Task, "uIP", mainuIP_STACK_SIZE, NULL, mainuIP_TASK_PRIORITY, NULL );
|
||||||
|
|
||||||
/* The suicide tasks must be created last, as they need to know how many
|
/* The suicide tasks must be created last, as they need to know how many
|
||||||
tasks were running prior to their creation in order to ascertain whether
|
tasks were running prior to their creation in order to ascertain whether
|
||||||
|
|
|
@ -300,14 +300,14 @@ xTimerHandle xARPTimer, xPeriodicTimer;
|
||||||
xEMACEventQueue = xQueueCreate( uipEVENT_QUEUE_LENGTH, sizeof( unsigned long ) );
|
xEMACEventQueue = xQueueCreate( uipEVENT_QUEUE_LENGTH, sizeof( unsigned long ) );
|
||||||
|
|
||||||
/* Create and start the uIP timers. */
|
/* Create and start the uIP timers. */
|
||||||
xARPTimer = xTimerCreate( ( signed char * ) "ARPTimer", /* Just a name that is helpful for debugging, not used by the kernel. */
|
xARPTimer = xTimerCreate( "ARPTimer", /* Just a name that is helpful for debugging, not used by the kernel. */
|
||||||
( 10000UL / portTICK_RATE_MS ), /* Timer period. */
|
( 10000UL / portTICK_RATE_MS ), /* Timer period. */
|
||||||
pdTRUE, /* Autor-reload. */
|
pdTRUE, /* Autor-reload. */
|
||||||
( void * ) uipARP_TIMER,
|
( void * ) uipARP_TIMER,
|
||||||
prvUIPTimerCallback
|
prvUIPTimerCallback
|
||||||
);
|
);
|
||||||
|
|
||||||
xPeriodicTimer = xTimerCreate( ( signed char * ) "PeriodicTimer",
|
xPeriodicTimer = xTimerCreate( "PeriodicTimer",
|
||||||
( 500UL / portTICK_RATE_MS ),
|
( 500UL / portTICK_RATE_MS ),
|
||||||
pdTRUE, /* Autor-reload. */
|
pdTRUE, /* Autor-reload. */
|
||||||
( void * ) uipPERIODIC_TIMER,
|
( void * ) uipPERIODIC_TIMER,
|
||||||
|
|
|
@ -105,7 +105,7 @@ static PT_THREAD( file_stats ( struct httpd_state *s, char *ptr ) )
|
||||||
PSOCK_BEGIN( &s->sout );
|
PSOCK_BEGIN( &s->sout );
|
||||||
|
|
||||||
( void ) PT_YIELD_FLAG;
|
( void ) PT_YIELD_FLAG;
|
||||||
|
|
||||||
PSOCK_GENERATOR_SEND( &s->sout, generate_file_stats, strchr(ptr, ' ') + 1 );
|
PSOCK_GENERATOR_SEND( &s->sout, generate_file_stats, strchr(ptr, ' ') + 1 );
|
||||||
|
|
||||||
PSOCK_END( &s->sout );
|
PSOCK_END( &s->sout );
|
||||||
|
@ -178,7 +178,7 @@ static PT_THREAD( net_stats ( struct httpd_state *s, char *ptr ) )
|
||||||
}
|
}
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
extern void vTaskList( signed char *pcWriteBuffer );
|
extern void vTaskList( char *pcWriteBuffer );
|
||||||
extern char *pcGetTaskStatusMessage( void );
|
extern char *pcGetTaskStatusMessage( void );
|
||||||
static char cCountBuf[128];
|
static char cCountBuf[128];
|
||||||
long lRefreshCount = 0;
|
long lRefreshCount = 0;
|
||||||
|
@ -187,7 +187,7 @@ static unsigned short generate_rtos_stats( void *arg )
|
||||||
( void ) arg;
|
( void ) arg;
|
||||||
lRefreshCount++;
|
lRefreshCount++;
|
||||||
sprintf( cCountBuf, "<p><br>Refresh count = %d<p><br>%s", ( int ) lRefreshCount, pcGetTaskStatusMessage() );
|
sprintf( cCountBuf, "<p><br>Refresh count = %d<p><br>%s", ( int ) lRefreshCount, pcGetTaskStatusMessage() );
|
||||||
vTaskList( uip_appdata );
|
vTaskList( ( char * ) uip_appdata );
|
||||||
strcat( uip_appdata, cCountBuf );
|
strcat( uip_appdata, cCountBuf );
|
||||||
|
|
||||||
return strlen( uip_appdata );
|
return strlen( uip_appdata );
|
||||||
|
@ -225,22 +225,22 @@ static unsigned short generate_io_state( void *arg )
|
||||||
pcStatus = "";
|
pcStatus = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
usRawVoltage = ( unsigned short ) ACE_get_ppe_sample( xVoltageChannel );
|
usRawVoltage = ( unsigned short ) ACE_get_ppe_sample( xVoltageChannel );
|
||||||
sprintf( uip_appdata, "<input type=\"checkbox\" name=\"LED0\" value=\"1\" %s>LED<p><p><p>Raw voltage input is %d", pcStatus, usRawVoltage );
|
sprintf( uip_appdata, "<input type=\"checkbox\" name=\"LED0\" value=\"1\" %s>LED<p><p><p>Raw voltage input is %d", pcStatus, usRawVoltage );
|
||||||
|
|
||||||
return strlen( uip_appdata );
|
return strlen( uip_appdata );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
extern void vTaskGetRunTimeStats( signed char *pcWriteBuffer );
|
extern void vTaskGetRunTimeStats( char *pcWriteBuffer );
|
||||||
extern unsigned short usMaxJitter;
|
extern unsigned short usMaxJitter;
|
||||||
static unsigned short generate_runtime_stats( void *arg )
|
static unsigned short generate_runtime_stats( void *arg )
|
||||||
{
|
{
|
||||||
( void ) arg;
|
( void ) arg;
|
||||||
lRefreshCount++;
|
lRefreshCount++;
|
||||||
sprintf( cCountBuf, "<p><br>Refresh count = %d", ( int ) lRefreshCount );
|
sprintf( cCountBuf, "<p><br>Refresh count = %d", ( int ) lRefreshCount );
|
||||||
|
|
||||||
vTaskGetRunTimeStats( uip_appdata );
|
vTaskGetRunTimeStats( ( char * ) uip_appdata );
|
||||||
strcat( uip_appdata, cCountBuf );
|
strcat( uip_appdata, cCountBuf );
|
||||||
|
|
||||||
return strlen( uip_appdata );
|
return strlen( uip_appdata );
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
All rights reserved
|
All rights reserved
|
||||||
|
|
||||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
@ -188,17 +188,17 @@ int main(void)
|
||||||
{
|
{
|
||||||
/* Start the two tasks as described in the comments at the top of this
|
/* Start the two tasks as described in the comments at the top of this
|
||||||
file. */
|
file. */
|
||||||
xTaskCreate( prvQueueReceiveTask, ( signed char * ) "Rx", configMINIMAL_STACK_SIZE, NULL, mainQUEUE_RECEIVE_TASK_PRIORITY, NULL );
|
xTaskCreate( prvQueueReceiveTask, "Rx", configMINIMAL_STACK_SIZE, NULL, mainQUEUE_RECEIVE_TASK_PRIORITY, NULL );
|
||||||
xTaskCreate( prvQueueSendTask, ( signed char * ) "TX", configMINIMAL_STACK_SIZE, NULL, mainQUEUE_SEND_TASK_PRIORITY, NULL );
|
xTaskCreate( prvQueueSendTask, "TX", configMINIMAL_STACK_SIZE, NULL, mainQUEUE_SEND_TASK_PRIORITY, NULL );
|
||||||
|
|
||||||
/* Create the software timer that is responsible for turning off the LED
|
/* Create the software timer that is responsible for turning off the LED
|
||||||
if the button is not pushed within 5000ms, as described at the top of
|
if the button is not pushed within 5000ms, as described at the top of
|
||||||
this file. */
|
this file. */
|
||||||
xLEDTimer = xTimerCreate( ( const signed char * ) "LEDTimer", /* A text name, purely to help debugging. */
|
xLEDTimer = xTimerCreate( "LEDTimer", /* A text name, purely to help debugging. */
|
||||||
( 5000 / portTICK_RATE_MS ), /* The timer period, in this case 5000ms (5s). */
|
( 5000 / portTICK_RATE_MS ),/* The timer period, in this case 5000ms (5s). */
|
||||||
pdFALSE, /* This is a one shot timer, so xAutoReload is set to pdFALSE. */
|
pdFALSE, /* This is a one shot timer, so xAutoReload is set to pdFALSE. */
|
||||||
( void * ) 0, /* The ID is not used, so can be set to anything. */
|
( void * ) 0, /* The ID is not used, so can be set to anything. */
|
||||||
vLEDTimerCallback /* The callback function that switches the LED off. */
|
vLEDTimerCallback /* The callback function that switches the LED off. */
|
||||||
);
|
);
|
||||||
|
|
||||||
/* Start the tasks and timer running. */
|
/* Start the tasks and timer running. */
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
All rights reserved
|
All rights reserved
|
||||||
|
|
||||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
@ -302,27 +302,27 @@ int main(void)
|
||||||
{
|
{
|
||||||
/* Start the three application specific demo tasks, as described in the
|
/* Start the three application specific demo tasks, as described in the
|
||||||
comments at the top of this file. */
|
comments at the top of this file. */
|
||||||
xTaskCreate( prvQueueReceiveTask, ( signed char * ) "Rx", configMINIMAL_STACK_SIZE, NULL, mainQUEUE_RECEIVE_TASK_PRIORITY, NULL );
|
xTaskCreate( prvQueueReceiveTask, "Rx", configMINIMAL_STACK_SIZE, NULL, mainQUEUE_RECEIVE_TASK_PRIORITY, NULL );
|
||||||
xTaskCreate( prvQueueSendTask, ( signed char * ) "TX", configMINIMAL_STACK_SIZE, NULL, mainQUEUE_SEND_TASK_PRIORITY, NULL );
|
xTaskCreate( prvQueueSendTask, "TX", configMINIMAL_STACK_SIZE, NULL, mainQUEUE_SEND_TASK_PRIORITY, NULL );
|
||||||
xTaskCreate( prvOLEDTask, ( signed char * ) "OLED", configMINIMAL_STACK_SIZE, NULL, mainOLED_TASK_PRIORITY, NULL );
|
xTaskCreate( prvOLEDTask, "OLED", configMINIMAL_STACK_SIZE, NULL, mainOLED_TASK_PRIORITY, NULL );
|
||||||
|
|
||||||
/* Create the software timer that is responsible for turning off the LED
|
/* Create the software timer that is responsible for turning off the LED
|
||||||
if the button is not pushed within 5000ms, as described at the top of
|
if the button is not pushed within 5000ms, as described at the top of
|
||||||
this file. */
|
this file. */
|
||||||
xLEDTimer = xTimerCreate( ( const signed char * ) "LEDTimer", /* A text name, purely to help debugging. */
|
xLEDTimer = xTimerCreate( "LEDTimer", /* A text name, purely to help debugging. */
|
||||||
( mainLED_TIMER_PERIOD_MS ), /* The timer period, in this case 5000ms (5s). */
|
( mainLED_TIMER_PERIOD_MS ), /* The timer period, in this case 5000ms (5s). */
|
||||||
pdFALSE, /* This is a one shot timer, so xAutoReload is set to pdFALSE. */
|
pdFALSE, /* This is a one shot timer, so xAutoReload is set to pdFALSE. */
|
||||||
( void * ) 0, /* The ID is not used, so can be set to anything. */
|
( void * ) 0, /* The ID is not used, so can be set to anything. */
|
||||||
prvLEDTimerCallback /* The callback function that switches the LED off. */
|
prvLEDTimerCallback /* The callback function that switches the LED off. */
|
||||||
);
|
);
|
||||||
|
|
||||||
/* Create the software timer that performs the 'check' functionality,
|
/* Create the software timer that performs the 'check' functionality,
|
||||||
as described at the top of this file. */
|
as described at the top of this file. */
|
||||||
xCheckTimer = xTimerCreate( ( const signed char * ) "CheckTimer",/* A text name, purely to help debugging. */
|
xCheckTimer = xTimerCreate( "CheckTimer", /* A text name, purely to help debugging. */
|
||||||
( mainCHECK_TIMER_PERIOD_MS ), /* The timer period, in this case 3000ms (3s). */
|
( mainCHECK_TIMER_PERIOD_MS ), /* The timer period, in this case 3000ms (3s). */
|
||||||
pdTRUE, /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */
|
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. */
|
( 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. */
|
prvCheckTimerCallback /* The callback function that inspects the status of all the other tasks. */
|
||||||
);
|
);
|
||||||
|
|
||||||
/* Create a lot of 'standard demo' tasks. */
|
/* Create a lot of 'standard demo' tasks. */
|
||||||
|
@ -336,8 +336,8 @@ int main(void)
|
||||||
vStartTimerDemoTask( mainTIMER_TEST_PERIOD );
|
vStartTimerDemoTask( mainTIMER_TEST_PERIOD );
|
||||||
|
|
||||||
/* Create the web server task. */
|
/* Create the web server task. */
|
||||||
xTaskCreate( vuIP_Task, ( signed char * ) "uIP", mainuIP_STACK_SIZE, NULL, mainuIP_TASK_PRIORITY, NULL );
|
xTaskCreate( vuIP_Task, "uIP", mainuIP_STACK_SIZE, NULL, mainuIP_TASK_PRIORITY, NULL );
|
||||||
|
|
||||||
/* The suicide tasks must be created last, as they need to know how many
|
/* The suicide tasks must be created last, as they need to know how many
|
||||||
tasks were running prior to their creation in order to ascertain whether
|
tasks were running prior to their creation in order to ascertain whether
|
||||||
or not the correct/expected number of tasks are running at any given
|
or not the correct/expected number of tasks are running at any given
|
||||||
|
@ -462,8 +462,8 @@ const unsigned long ulValueToSend = 100UL;
|
||||||
|
|
||||||
/* The timer command queue will have been filled when the timer test tasks
|
/* The timer command queue will have been filled when the timer test tasks
|
||||||
were created in main() (this is part of the test they perform). Therefore,
|
were created in main() (this is part of the test they perform). Therefore,
|
||||||
while the check timer can be created in main(), it cannot be started from
|
while the check timer can be created in main(), it cannot be started from
|
||||||
main(). Once the scheduler has started, the timer service task will drain
|
main(). Once the scheduler has started, the timer service task will drain
|
||||||
the command queue, and now the check timer can be started successfully. */
|
the command queue, and now the check timer can be started successfully. */
|
||||||
xTimerStart( xCheckTimer, portMAX_DELAY );
|
xTimerStart( xCheckTimer, portMAX_DELAY );
|
||||||
|
|
||||||
|
@ -539,10 +539,10 @@ static portTickType xLastScrollTime = 0UL;
|
||||||
{
|
{
|
||||||
/* Wait until it is time to update the OLED again. */
|
/* Wait until it is time to update the OLED again. */
|
||||||
vTaskDelayUntil( &xLastScrollTime, mainOLED_PERIOD_MS );
|
vTaskDelayUntil( &xLastScrollTime, mainOLED_PERIOD_MS );
|
||||||
|
|
||||||
xOLEDData.char_offset1 = ucOffset1++;
|
xOLEDData.char_offset1 = ucOffset1++;
|
||||||
xOLEDData.char_offset2 = ucOffset2++;
|
xOLEDData.char_offset2 = ucOffset2++;
|
||||||
|
|
||||||
OLED_write_data( &xOLEDData, BOTH_LINES );
|
OLED_write_data( &xOLEDData, BOTH_LINES );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -551,13 +551,13 @@ static portTickType xLastScrollTime = 0UL;
|
||||||
static void prvSetupHardware( void )
|
static void prvSetupHardware( void )
|
||||||
{
|
{
|
||||||
SystemCoreClockUpdate();
|
SystemCoreClockUpdate();
|
||||||
|
|
||||||
/* Disable the Watch Dog Timer */
|
/* Disable the Watch Dog Timer */
|
||||||
MSS_WD_disable( );
|
MSS_WD_disable( );
|
||||||
|
|
||||||
/* Configure the GPIO for the LEDs. */
|
/* Configure the GPIO for the LEDs. */
|
||||||
vParTestInitialise();
|
vParTestInitialise();
|
||||||
|
|
||||||
/* ACE Initialization */
|
/* ACE Initialization */
|
||||||
ACE_init();
|
ACE_init();
|
||||||
|
|
||||||
|
@ -646,12 +646,12 @@ unsigned long *pulHighWord, *pulLowWord;
|
||||||
|
|
||||||
pulHighWord = ( unsigned long * ) &ullCurrentValue;
|
pulHighWord = ( unsigned long * ) &ullCurrentValue;
|
||||||
pulLowWord = pulHighWord++;
|
pulLowWord = pulHighWord++;
|
||||||
|
|
||||||
MSS_TIM64_get_current_value( ( uint32_t * ) pulHighWord, ( uint32_t * ) pulLowWord );
|
MSS_TIM64_get_current_value( ( uint32_t * ) pulHighWord, ( uint32_t * ) pulLowWord );
|
||||||
|
|
||||||
/* Convert the down count into an upcount. */
|
/* Convert the down count into an upcount. */
|
||||||
ullCurrentValue = ulMax64BitValue - ullCurrentValue;
|
ullCurrentValue = ulMax64BitValue - ullCurrentValue;
|
||||||
|
|
||||||
/* Scale to a 32bit number of suitable frequency. */
|
/* Scale to a 32bit number of suitable frequency. */
|
||||||
ullCurrentValue >>= 13;
|
ullCurrentValue >>= 13;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
All rights reserved
|
All rights reserved
|
||||||
|
|
||||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
@ -192,7 +192,7 @@ long lPacketLength;
|
||||||
if( ( lPacketLength > 0 ) && ( uip_buf != NULL ) )
|
if( ( lPacketLength > 0 ) && ( uip_buf != NULL ) )
|
||||||
{
|
{
|
||||||
uip_len = ( u16_t ) lPacketLength;
|
uip_len = ( u16_t ) lPacketLength;
|
||||||
|
|
||||||
/* Standard uIP loop taken from the uIP manual. */
|
/* Standard uIP loop taken from the uIP manual. */
|
||||||
if( xHeader->type == htons( UIP_ETHTYPE_IP ) )
|
if( xHeader->type == htons( UIP_ETHTYPE_IP ) )
|
||||||
{
|
{
|
||||||
|
@ -237,7 +237,7 @@ long lPacketLength;
|
||||||
for( i = 0; i < UIP_CONNS; i++ )
|
for( i = 0; i < UIP_CONNS; i++ )
|
||||||
{
|
{
|
||||||
uip_periodic( i );
|
uip_periodic( i );
|
||||||
|
|
||||||
/* If the above function invocation resulted in data that
|
/* If the above function invocation resulted in data that
|
||||||
should be sent out on the network, the global variable
|
should be sent out on the network, the global variable
|
||||||
uip_len is set to a value > 0. */
|
uip_len is set to a value > 0. */
|
||||||
|
@ -300,14 +300,14 @@ xTimerHandle xARPTimer, xPeriodicTimer;
|
||||||
xEMACEventQueue = xQueueCreate( uipEVENT_QUEUE_LENGTH, sizeof( unsigned long ) );
|
xEMACEventQueue = xQueueCreate( uipEVENT_QUEUE_LENGTH, sizeof( unsigned long ) );
|
||||||
|
|
||||||
/* Create and start the uIP timers. */
|
/* Create and start the uIP timers. */
|
||||||
xARPTimer = xTimerCreate( ( signed char * ) "ARPTimer", /* Just a name that is helpful for debugging, not used by the kernel. */
|
xARPTimer = xTimerCreate( "ARPTimer", /* Just a name that is helpful for debugging, not used by the kernel. */
|
||||||
( 10000UL / portTICK_RATE_MS ), /* Timer period. */
|
( 10000UL / portTICK_RATE_MS ), /* Timer period. */
|
||||||
pdTRUE, /* Autor-reload. */
|
pdTRUE, /* Autor-reload. */
|
||||||
( void * ) uipARP_TIMER,
|
( void * ) uipARP_TIMER,
|
||||||
prvUIPTimerCallback
|
prvUIPTimerCallback
|
||||||
);
|
);
|
||||||
|
|
||||||
xPeriodicTimer = xTimerCreate( ( signed char * ) "PeriodicTimer",
|
xPeriodicTimer = xTimerCreate( "PeriodicTimer",
|
||||||
( 500UL / portTICK_RATE_MS ),
|
( 500UL / portTICK_RATE_MS ),
|
||||||
pdTRUE, /* Autor-reload. */
|
pdTRUE, /* Autor-reload. */
|
||||||
( void * ) uipPERIODIC_TIMER,
|
( void * ) uipPERIODIC_TIMER,
|
||||||
|
@ -418,7 +418,7 @@ char *c;
|
||||||
|
|
||||||
/* Only interested in processing form input if this is the IO page. */
|
/* Only interested in processing form input if this is the IO page. */
|
||||||
c = strstr( pcInputString, "io.shtml" );
|
c = strstr( pcInputString, "io.shtml" );
|
||||||
|
|
||||||
if( c )
|
if( c )
|
||||||
{
|
{
|
||||||
/* Is there a command in the string? */
|
/* Is there a command in the string? */
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
All rights reserved
|
All rights reserved
|
||||||
|
|
||||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
@ -154,14 +154,14 @@ void main_blinky( void )
|
||||||
{
|
{
|
||||||
/* Start the two tasks as described in the comments at the top of this
|
/* Start the two tasks as described in the comments at the top of this
|
||||||
file. */
|
file. */
|
||||||
xTaskCreate( prvQueueReceiveTask, /* The function that implements the task. */
|
xTaskCreate( prvQueueReceiveTask, /* The function that implements the task. */
|
||||||
( signed char * ) "Rx", /* The text name assigned to the task - for debug only as it is not used by the kernel. */
|
"Rx", /* The text name assigned to the task - for debug only as it is not used by the kernel. */
|
||||||
configMINIMAL_STACK_SIZE, /* The size of the stack to allocate to the task. */
|
configMINIMAL_STACK_SIZE, /* The size of the stack to allocate to the task. */
|
||||||
NULL, /* The parameter passed to the task - not used in this case. */
|
NULL, /* The parameter passed to the task - not used in this case. */
|
||||||
mainQUEUE_RECEIVE_TASK_PRIORITY, /* The priority assigned to the task. */
|
mainQUEUE_RECEIVE_TASK_PRIORITY, /* The priority assigned to the task. */
|
||||||
NULL ); /* The task handle is not required, so NULL is passed. */
|
NULL ); /* The task handle is not required, so NULL is passed. */
|
||||||
|
|
||||||
xTaskCreate( prvQueueSendTask, ( signed char * ) "TX", configMINIMAL_STACK_SIZE, NULL, mainQUEUE_SEND_TASK_PRIORITY, NULL );
|
xTaskCreate( prvQueueSendTask, "TX", configMINIMAL_STACK_SIZE, NULL, mainQUEUE_SEND_TASK_PRIORITY, NULL );
|
||||||
|
|
||||||
/* Start the tasks and timer running. */
|
/* Start the tasks and timer running. */
|
||||||
vTaskStartScheduler();
|
vTaskStartScheduler();
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
All rights reserved
|
All rights reserved
|
||||||
|
|
||||||
FEATURES AND PORTS ARE ADDED TO FREERTOS ALL THE TIME. PLEASE VISIT
|
FEATURES AND PORTS ARE ADDED TO FREERTOS ALL THE TIME. PLEASE VISIT
|
||||||
|
@ -205,7 +205,7 @@ void vRegisterSampleCLICommands( void )
|
||||||
|
|
||||||
static portBASE_TYPE prvTaskStatsCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString )
|
static portBASE_TYPE prvTaskStatsCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString )
|
||||||
{
|
{
|
||||||
const int8_t *const pcHeader = ( int8_t * ) "Task State Priority Stack #\r\n************************************************\r\n";
|
const char *const pcHeader = "Task State Priority Stack #\r\n************************************************\r\n";
|
||||||
|
|
||||||
/* Remove compile time warnings about unused parameters, and check the
|
/* Remove compile time warnings about unused parameters, and check the
|
||||||
write buffer is not NULL. NOTE - for simplicity, this example assumes the
|
write buffer is not NULL. NOTE - for simplicity, this example assumes the
|
||||||
|
@ -215,8 +215,8 @@ const int8_t *const pcHeader = ( int8_t * ) "Task State Priority Stac
|
||||||
configASSERT( pcWriteBuffer );
|
configASSERT( pcWriteBuffer );
|
||||||
|
|
||||||
/* Generate a table of task stats. */
|
/* Generate a table of task stats. */
|
||||||
strcpy( ( char * ) pcWriteBuffer, ( char * ) pcHeader );
|
strcpy( ( char * ) pcWriteBuffer, pcHeader );
|
||||||
vTaskList( pcWriteBuffer + strlen( ( char * ) pcHeader ) );
|
vTaskList( pcWriteBuffer + strlen( pcHeader ) );
|
||||||
|
|
||||||
/* There is no more data to return after this single string, so return
|
/* There is no more data to return after this single string, so return
|
||||||
pdFALSE. */
|
pdFALSE. */
|
||||||
|
@ -226,7 +226,7 @@ const int8_t *const pcHeader = ( int8_t * ) "Task State Priority Stac
|
||||||
|
|
||||||
static portBASE_TYPE prvRunTimeStatsCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString )
|
static portBASE_TYPE prvRunTimeStatsCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString )
|
||||||
{
|
{
|
||||||
const int8_t * const pcHeader = ( int8_t * ) "Task Abs Time % Time\r\n****************************************\r\n";
|
const char * const pcHeader = "Task Abs Time % Time\r\n****************************************\r\n";
|
||||||
|
|
||||||
/* Remove compile time warnings about unused parameters, and check the
|
/* Remove compile time warnings about unused parameters, and check the
|
||||||
write buffer is not NULL. NOTE - for simplicity, this example assumes the
|
write buffer is not NULL. NOTE - for simplicity, this example assumes the
|
||||||
|
@ -236,8 +236,8 @@ const int8_t * const pcHeader = ( int8_t * ) "Task Abs Time % Ti
|
||||||
configASSERT( pcWriteBuffer );
|
configASSERT( pcWriteBuffer );
|
||||||
|
|
||||||
/* Generate a table of task stats. */
|
/* Generate a table of task stats. */
|
||||||
strcpy( ( char * ) pcWriteBuffer, ( char * ) pcHeader );
|
strcpy( ( char * ) pcWriteBuffer, pcHeader );
|
||||||
vTaskGetRunTimeStats( pcWriteBuffer + strlen( ( char * ) pcHeader ) );
|
vTaskGetRunTimeStats( ( ( char * ) pcWriteBuffer ) + strlen( pcHeader ) );
|
||||||
|
|
||||||
/* There is no more data to return after this single string, so return
|
/* There is no more data to return after this single string, so return
|
||||||
pdFALSE. */
|
pdFALSE. */
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
All rights reserved
|
All rights reserved
|
||||||
|
|
||||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
@ -317,12 +317,12 @@ void main_full( void )
|
||||||
|
|
||||||
/* Create the register check tasks, as described at the top of this
|
/* Create the register check tasks, as described at the top of this
|
||||||
file */
|
file */
|
||||||
xTaskCreate( prvRegTestTaskEntry1, ( signed char * ) "Reg1", configMINIMAL_STACK_SIZE, mainREG_TEST_TASK_1_PARAMETER, tskIDLE_PRIORITY, NULL );
|
xTaskCreate( prvRegTestTaskEntry1, "Reg1", configMINIMAL_STACK_SIZE, mainREG_TEST_TASK_1_PARAMETER, tskIDLE_PRIORITY, NULL );
|
||||||
xTaskCreate( prvRegTestTaskEntry2, ( signed char * ) "Reg2", configMINIMAL_STACK_SIZE, mainREG_TEST_TASK_2_PARAMETER, tskIDLE_PRIORITY, NULL );
|
xTaskCreate( prvRegTestTaskEntry2, "Reg2", configMINIMAL_STACK_SIZE, mainREG_TEST_TASK_2_PARAMETER, tskIDLE_PRIORITY, NULL );
|
||||||
|
|
||||||
/* Create the task that performs the 'check' functionality, as described at
|
/* Create the task that performs the 'check' functionality, as described at
|
||||||
the top of this file. */
|
the top of this file. */
|
||||||
xTaskCreate( prvCheckTask, ( signed char * ) "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );
|
xTaskCreate( prvCheckTask, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );
|
||||||
|
|
||||||
/* The set of tasks created by the following function call have to be
|
/* The set of tasks created by the following function call have to be
|
||||||
created last as they keep account of the number of tasks they expect to see
|
created last as they keep account of the number of tasks they expect to see
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
All rights reserved
|
All rights reserved
|
||||||
|
|
||||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
@ -194,17 +194,17 @@ int main( void )
|
||||||
port and provide some APU usage examples. */
|
port and provide some APU usage examples. */
|
||||||
vStartIntegerMathTasks( mainINTEGER_TASK_PRIORITY );
|
vStartIntegerMathTasks( mainINTEGER_TASK_PRIORITY );
|
||||||
vStartGenericQueueTasks( mainGEN_QUEUE_TASK_PRIORITY );
|
vStartGenericQueueTasks( mainGEN_QUEUE_TASK_PRIORITY );
|
||||||
vStartRecursiveMutexTasks();
|
vStartRecursiveMutexTasks();
|
||||||
vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY );
|
vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY );
|
||||||
vCreateBlockTimeTasks();
|
vCreateBlockTimeTasks();
|
||||||
vStartSemaphoreTasks( mainSEM_TEST_PRIORITY );
|
vStartSemaphoreTasks( mainSEM_TEST_PRIORITY );
|
||||||
vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY );
|
vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY );
|
||||||
vStartQueuePeekTasks();
|
vStartQueuePeekTasks();
|
||||||
vStartLEDFlashTasks( mainLED_TASK_PRIORITY );
|
vStartLEDFlashTasks( mainLED_TASK_PRIORITY );
|
||||||
vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainBAUD_RATE, mainCOM_TEST_LED );
|
vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainBAUD_RATE, mainCOM_TEST_LED );
|
||||||
|
|
||||||
/* Start the tasks defined within this file/specific to this demo. */
|
/* Start the tasks defined within this file/specific to this demo. */
|
||||||
xTaskCreate( prvLCDTask, ( signed char * ) "LCD", mainLCD_TASK_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );
|
xTaskCreate( prvLCDTask, "LCD", mainLCD_TASK_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );
|
||||||
|
|
||||||
/* Start the scheduler. */
|
/* Start the scheduler. */
|
||||||
vTaskStartScheduler();
|
vTaskStartScheduler();
|
||||||
|
@ -234,7 +234,7 @@ portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
|
||||||
if( ulTicksSinceLastDisplay >= mainCHECK_DELAY )
|
if( ulTicksSinceLastDisplay >= mainCHECK_DELAY )
|
||||||
{
|
{
|
||||||
ulTicksSinceLastDisplay = 0;
|
ulTicksSinceLastDisplay = 0;
|
||||||
|
|
||||||
/* Has an error been found in any task? */
|
/* Has an error been found in any task? */
|
||||||
if( xAreGenericQueueTasksStillRunning() != pdTRUE )
|
if( xAreGenericQueueTasksStillRunning() != pdTRUE )
|
||||||
{
|
{
|
||||||
|
@ -263,16 +263,16 @@ portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
|
||||||
else if( xAreQueuePeekTasksStillRunning() != pdTRUE )
|
else if( xAreQueuePeekTasksStillRunning() != pdTRUE )
|
||||||
{
|
{
|
||||||
xMessage.pcMessage = "ERROR IN PEEK Q";
|
xMessage.pcMessage = "ERROR IN PEEK Q";
|
||||||
}
|
}
|
||||||
else if( xAreRecursiveMutexTasksStillRunning() != pdTRUE )
|
else if( xAreRecursiveMutexTasksStillRunning() != pdTRUE )
|
||||||
{
|
{
|
||||||
xMessage.pcMessage = "ERROR IN REC MUTEX";
|
xMessage.pcMessage = "ERROR IN REC MUTEX";
|
||||||
}
|
}
|
||||||
else if( xAreComTestTasksStillRunning() != pdTRUE )
|
else if( xAreComTestTasksStillRunning() != pdTRUE )
|
||||||
{
|
{
|
||||||
xMessage.pcMessage = "ERROR IN COMTEST";
|
xMessage.pcMessage = "ERROR IN COMTEST";
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Send the message to the LCD gatekeeper for display. */
|
/* Send the message to the LCD gatekeeper for display. */
|
||||||
xHigherPriorityTaskWoken = pdFALSE;
|
xHigherPriorityTaskWoken = pdFALSE;
|
||||||
xQueueSendFromISR( xLCDQueue, &xMessage, &xHigherPriorityTaskWoken );
|
xQueueSendFromISR( xLCDQueue, &xMessage, &xHigherPriorityTaskWoken );
|
||||||
|
@ -300,10 +300,10 @@ const unsigned long ulMaxY = 250, ulYIncrement = 22, ulWidth = 250, ulHeight = 2
|
||||||
|
|
||||||
/* Initialize LCD. */
|
/* Initialize LCD. */
|
||||||
LCDD_Initialize();
|
LCDD_Initialize();
|
||||||
LCDD_Start();
|
LCDD_Start();
|
||||||
LCDD_Fill( ( void * ) BOARD_LCD_BASE, COLOR_WHITE );
|
LCDD_Fill( ( void * ) BOARD_LCD_BASE, COLOR_WHITE );
|
||||||
LCDD_DrawString( ( void * ) BOARD_LCD_BASE, 1, ulY + 3, " www.FreeRTOS.org", COLOR_BLACK );
|
LCDD_DrawString( ( void * ) BOARD_LCD_BASE, 1, ulY + 3, " www.FreeRTOS.org", COLOR_BLACK );
|
||||||
|
|
||||||
for( ;; )
|
for( ;; )
|
||||||
{
|
{
|
||||||
/* Wait for a message from the check function (which is executed in
|
/* Wait for a message from the check function (which is executed in
|
||||||
|
@ -312,10 +312,10 @@ const unsigned long ulMaxY = 250, ulYIncrement = 22, ulWidth = 250, ulHeight = 2
|
||||||
|
|
||||||
/* Clear the space where the old message was. */
|
/* Clear the space where the old message was. */
|
||||||
LCDD_DrawRectangle( ( void * ) BOARD_LCD_BASE, 0, ulY, ulWidth, ulHeight, COLOR_WHITE );
|
LCDD_DrawRectangle( ( void * ) BOARD_LCD_BASE, 0, ulY, ulWidth, ulHeight, COLOR_WHITE );
|
||||||
|
|
||||||
/* Increment to the next drawing position. */
|
/* Increment to the next drawing position. */
|
||||||
ulY += ulYIncrement;
|
ulY += ulYIncrement;
|
||||||
|
|
||||||
/* Have the Y position moved past the end of the LCD? */
|
/* Have the Y position moved past the end of the LCD? */
|
||||||
if( ulY >= ulMaxY )
|
if( ulY >= ulMaxY )
|
||||||
{
|
{
|
||||||
|
@ -324,7 +324,7 @@ const unsigned long ulMaxY = 250, ulYIncrement = 22, ulWidth = 250, ulHeight = 2
|
||||||
|
|
||||||
/* Draw a new rectangle, in which the message will be written. */
|
/* Draw a new rectangle, in which the message will be written. */
|
||||||
LCDD_DrawRectangle( ( void * ) BOARD_LCD_BASE, 0, ulY, ulWidth, ulHeight, COLOR_GREEN );
|
LCDD_DrawRectangle( ( void * ) BOARD_LCD_BASE, 0, ulY, ulWidth, ulHeight, COLOR_GREEN );
|
||||||
|
|
||||||
/* Write the message. */
|
/* Write the message. */
|
||||||
LCDD_DrawString( ( void * ) BOARD_LCD_BASE, ulX, ulY + 3, xMessage.pcMessage, COLOR_BLACK );
|
LCDD_DrawString( ( void * ) BOARD_LCD_BASE, ulX, ulY + 3, xMessage.pcMessage, COLOR_BLACK );
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
All rights reserved
|
All rights reserved
|
||||||
|
|
||||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
@ -158,8 +158,8 @@ void vAltStartComTestTasks( unsigned portBASE_TYPE uxPriority, unsigned long ulB
|
||||||
xSerialPortInitMinimal( ulBaudRate, comBUFFER_LEN );
|
xSerialPortInitMinimal( ulBaudRate, comBUFFER_LEN );
|
||||||
|
|
||||||
/* The Tx task is spawned with a lower priority than the Rx task. */
|
/* The Tx task is spawned with a lower priority than the Rx task. */
|
||||||
xTaskCreate( vComTxTask, ( signed char * ) "COMTx", comSTACK_SIZE, NULL, uxPriority - 1, ( xTaskHandle * ) NULL );
|
xTaskCreate( vComTxTask, "COMTx", comSTACK_SIZE, NULL, uxPriority - 1, ( xTaskHandle * ) NULL );
|
||||||
xTaskCreate( vComRxTask, ( signed char * ) "COMRx", comSTACK_SIZE, NULL, uxPriority, ( xTaskHandle * ) NULL );
|
xTaskCreate( vComRxTask, "COMRx", comSTACK_SIZE, NULL, uxPriority, ( xTaskHandle * ) NULL );
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
All rights reserved
|
All rights reserved
|
||||||
|
|
||||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
@ -127,7 +127,7 @@ will remove items as they are added, meaning the send task should always find
|
||||||
the queue empty. */
|
the queue empty. */
|
||||||
#define mainQUEUE_LENGTH ( 1 )
|
#define mainQUEUE_LENGTH ( 1 )
|
||||||
|
|
||||||
/* Values passed to the two tasks just to check the task parameter
|
/* Values passed to the two tasks just to check the task parameter
|
||||||
functionality. */
|
functionality. */
|
||||||
#define mainQUEUE_SEND_PARAMETER ( 0x1111UL )
|
#define mainQUEUE_SEND_PARAMETER ( 0x1111UL )
|
||||||
#define mainQUEUE_RECEIVE_PARAMETER ( 0x22UL )
|
#define mainQUEUE_RECEIVE_PARAMETER ( 0x22UL )
|
||||||
|
@ -163,13 +163,13 @@ void main_blinky( void )
|
||||||
/* Start the two tasks as described in the comments at the top of this
|
/* Start the two tasks as described in the comments at the top of this
|
||||||
file. */
|
file. */
|
||||||
xTaskCreate( prvQueueReceiveTask, /* The function that implements the task. */
|
xTaskCreate( prvQueueReceiveTask, /* The function that implements the task. */
|
||||||
( signed char * ) "Rx", /* The text name assigned to the task - for debug only as it is not used by the kernel. */
|
"Rx", /* The text name assigned to the task - for debug only as it is not used by the kernel. */
|
||||||
configMINIMAL_STACK_SIZE, /* The size of the stack to allocate to the task. */
|
configMINIMAL_STACK_SIZE, /* The size of the stack to allocate to the task. */
|
||||||
( void * ) mainQUEUE_RECEIVE_PARAMETER, /* The parameter passed to the task - just to check the functionality. */
|
( void * ) mainQUEUE_RECEIVE_PARAMETER, /* The parameter passed to the task - just to check the functionality. */
|
||||||
mainQUEUE_RECEIVE_TASK_PRIORITY, /* The priority assigned to the task. */
|
mainQUEUE_RECEIVE_TASK_PRIORITY, /* The priority assigned to the task. */
|
||||||
NULL ); /* The task handle is not required, so NULL is passed. */
|
NULL ); /* The task handle is not required, so NULL is passed. */
|
||||||
|
|
||||||
xTaskCreate( prvQueueSendTask, ( signed char * ) "TX", configMINIMAL_STACK_SIZE, ( void * ) mainQUEUE_SEND_PARAMETER, mainQUEUE_SEND_TASK_PRIORITY, NULL );
|
xTaskCreate( prvQueueSendTask, "TX", configMINIMAL_STACK_SIZE, ( void * ) mainQUEUE_SEND_PARAMETER, mainQUEUE_SEND_TASK_PRIORITY, NULL );
|
||||||
|
|
||||||
/* Start the tasks and timer running. */
|
/* Start the tasks and timer running. */
|
||||||
vTaskStartScheduler();
|
vTaskStartScheduler();
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
All rights reserved
|
All rights reserved
|
||||||
|
|
||||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
@ -76,8 +76,8 @@
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*
|
*
|
||||||
* main_full() creates all the demo application tasks and a software timer, then
|
* main_full() creates all the demo application tasks and a software timer, then
|
||||||
* starts the scheduler. The web documentation provides more details of the
|
* starts the scheduler. The web documentation provides more details of the
|
||||||
* standard demo application tasks, which provide no particular functionality,
|
* standard demo application tasks, which provide no particular functionality,
|
||||||
* but do provide a good example of how to use the FreeRTOS API.
|
* but do provide a good example of how to use the FreeRTOS API.
|
||||||
*
|
*
|
||||||
* In addition to the standard demo tasks, the following tasks and tests are
|
* In addition to the standard demo tasks, the following tasks and tests are
|
||||||
|
@ -85,18 +85,18 @@
|
||||||
*
|
*
|
||||||
* "Check" timer - The check software timer period is initially set to three
|
* "Check" timer - The check software timer period is initially set to three
|
||||||
* seconds. The callback function associated with the check software timer
|
* seconds. The callback function associated with the check software timer
|
||||||
* checks that all the standard demo tasks are not only still executing, but
|
* checks that all the standard demo tasks are not only still executing, but
|
||||||
* are executing without reporting any errors. If the check software timer
|
* are executing without reporting any errors. If the check software timer
|
||||||
* discovers that a task has either stalled, or reported an error, then it
|
* discovers that a task has either stalled, or reported an error, then it
|
||||||
* changes its own execution period from the initial three seconds, to just
|
* changes its own execution period from the initial three seconds, to just
|
||||||
* 200ms. The check software timer callback function also toggles the green
|
* 200ms. The check software timer callback function also toggles the green
|
||||||
* LED each time it is called. This provides a visual indication of the system
|
* LED each time it is called. This provides a visual indication of the system
|
||||||
* status: If the green LED toggles every three seconds, then no issues have
|
* status: If the green LED toggles every three seconds, then no issues have
|
||||||
* been discovered. If the green LED toggles every 200ms, then an issue has
|
* been discovered. If the green LED toggles every 200ms, then an issue has
|
||||||
* been discovered with at least one task.
|
* been discovered with at least one task.
|
||||||
*
|
*
|
||||||
* See the documentation page for this demo on the FreeRTOS.org web site for
|
* See the documentation page for this demo on the FreeRTOS.org web site for
|
||||||
* full information, including hardware setup requirements.
|
* full information, including hardware setup requirements.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Standard includes. */
|
/* Standard includes. */
|
||||||
|
@ -191,35 +191,35 @@ xTimerHandle xCheckTimer = NULL;
|
||||||
vStartSemaphoreTasks( mainSEM_TEST_PRIORITY );
|
vStartSemaphoreTasks( mainSEM_TEST_PRIORITY );
|
||||||
vStartLEDFlashTimers( mainNUMBER_OF_FLASH_TIMERS_LEDS );
|
vStartLEDFlashTimers( mainNUMBER_OF_FLASH_TIMERS_LEDS );
|
||||||
vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED );
|
vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED );
|
||||||
|
|
||||||
/* Create the software timer that performs the 'check' functionality,
|
/* Create the software timer that performs the 'check' functionality,
|
||||||
as described at the top of this file. */
|
as described at the top of this file. */
|
||||||
xCheckTimer = xTimerCreate( ( const signed char * ) "CheckTimer",/* A text name, purely to help debugging. */
|
xCheckTimer = xTimerCreate( "CheckTimer", /* A text name, purely to help debugging. */
|
||||||
( mainCHECK_TIMER_PERIOD_MS ), /* The timer period, in this case 3000ms (3s). */
|
( mainCHECK_TIMER_PERIOD_MS ), /* The timer period, in this case 3000ms (3s). */
|
||||||
pdTRUE, /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */
|
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. */
|
( 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. */
|
prvCheckTimerCallback /* The callback function that inspects the status of all the other tasks. */
|
||||||
);
|
);
|
||||||
|
|
||||||
if( xCheckTimer != NULL )
|
if( xCheckTimer != NULL )
|
||||||
{
|
{
|
||||||
xTimerStart( xCheckTimer, mainDONT_BLOCK );
|
xTimerStart( xCheckTimer, mainDONT_BLOCK );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The set of tasks created by the following function call have to be
|
/* The set of tasks created by the following function call have to be
|
||||||
created last as they keep account of the number of tasks they expect to see
|
created last as they keep account of the number of tasks they expect to see
|
||||||
running. */
|
running. */
|
||||||
vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY );
|
vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY );
|
||||||
|
|
||||||
/* Start the scheduler. */
|
/* Start the scheduler. */
|
||||||
vTaskStartScheduler();
|
vTaskStartScheduler();
|
||||||
|
|
||||||
/* If all is well, the scheduler will now be running, and the following line
|
/* If all is well, the scheduler will now be running, and the following line
|
||||||
will never be reached. If the following line does execute, then there was
|
will never be reached. If the following line does execute, then there was
|
||||||
insufficient FreeRTOS heap memory available for the idle and/or timer tasks
|
insufficient FreeRTOS heap memory available for the idle and/or timer tasks
|
||||||
to be created. See the memory management section on the FreeRTOS web site
|
to be created. See the memory management section on the FreeRTOS web site
|
||||||
for more details. */
|
for more details. */
|
||||||
for( ;; );
|
for( ;; );
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
@ -275,7 +275,7 @@ unsigned long ulErrorFound = pdFALSE;
|
||||||
{
|
{
|
||||||
ulErrorFound = pdTRUE;
|
ulErrorFound = pdTRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( xAreComTestTasksStillRunning() != pdTRUE )
|
if( xAreComTestTasksStillRunning() != pdTRUE )
|
||||||
{
|
{
|
||||||
ulErrorFound = pdTRUE;
|
ulErrorFound = pdTRUE;
|
||||||
|
@ -285,7 +285,7 @@ unsigned long ulErrorFound = pdFALSE;
|
||||||
the LED toggles every mainCHECK_TIMER_PERIOD_MS milliseconds then
|
the LED toggles every mainCHECK_TIMER_PERIOD_MS milliseconds then
|
||||||
everything is ok. A faster toggle indicates an error. */
|
everything is ok. A faster toggle indicates an error. */
|
||||||
vParTestToggleLED( mainCHECK_LED );
|
vParTestToggleLED( mainCHECK_LED );
|
||||||
|
|
||||||
/* Have any errors been latch in ulErrorFound? If so, shorten the
|
/* Have any errors been latch in ulErrorFound? If so, shorten the
|
||||||
period of the check timer to mainERROR_CHECK_TIMER_PERIOD_MS milliseconds.
|
period of the check timer to mainERROR_CHECK_TIMER_PERIOD_MS milliseconds.
|
||||||
This will result in an increase in the rate at which mainCHECK_LED
|
This will result in an increase in the rate at which mainCHECK_LED
|
||||||
|
@ -295,7 +295,7 @@ unsigned long ulErrorFound = pdFALSE;
|
||||||
if( lChangedTimerPeriodAlready == pdFALSE )
|
if( lChangedTimerPeriodAlready == pdFALSE )
|
||||||
{
|
{
|
||||||
lChangedTimerPeriodAlready = pdTRUE;
|
lChangedTimerPeriodAlready = pdTRUE;
|
||||||
|
|
||||||
/* This call to xTimerChangePeriod() uses a zero block time.
|
/* This call to xTimerChangePeriod() uses a zero block time.
|
||||||
Functions called from inside of a timer callback function must
|
Functions called from inside of a timer callback function must
|
||||||
*never* attempt to block. */
|
*never* attempt to block. */
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
All rights reserved
|
All rights reserved
|
||||||
|
|
||||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
@ -158,8 +158,8 @@ void vAltStartComTestTasks( unsigned portBASE_TYPE uxPriority, unsigned long ulB
|
||||||
xSerialPortInitMinimal( ulBaudRate, comBUFFER_LEN );
|
xSerialPortInitMinimal( ulBaudRate, comBUFFER_LEN );
|
||||||
|
|
||||||
/* The Tx task is spawned with a lower priority than the Rx task. */
|
/* The Tx task is spawned with a lower priority than the Rx task. */
|
||||||
xTaskCreate( vComTxTask, ( signed char * ) "COMTx", comSTACK_SIZE, NULL, uxPriority - 1, ( xTaskHandle * ) NULL );
|
xTaskCreate( vComTxTask, "COMTx", comSTACK_SIZE, NULL, uxPriority - 1, ( xTaskHandle * ) NULL );
|
||||||
xTaskCreate( vComRxTask, ( signed char * ) "COMRx", comSTACK_SIZE, NULL, uxPriority, ( xTaskHandle * ) NULL );
|
xTaskCreate( vComRxTask, "COMRx", comSTACK_SIZE, NULL, uxPriority, ( xTaskHandle * ) NULL );
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
All rights reserved
|
All rights reserved
|
||||||
|
|
||||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
@ -127,7 +127,7 @@ will remove items as they are added, meaning the send task should always find
|
||||||
the queue empty. */
|
the queue empty. */
|
||||||
#define mainQUEUE_LENGTH ( 1 )
|
#define mainQUEUE_LENGTH ( 1 )
|
||||||
|
|
||||||
/* Values passed to the two tasks just to check the task parameter
|
/* Values passed to the two tasks just to check the task parameter
|
||||||
functionality. */
|
functionality. */
|
||||||
#define mainQUEUE_SEND_PARAMETER ( 0x1111UL )
|
#define mainQUEUE_SEND_PARAMETER ( 0x1111UL )
|
||||||
#define mainQUEUE_RECEIVE_PARAMETER ( 0x22UL )
|
#define mainQUEUE_RECEIVE_PARAMETER ( 0x22UL )
|
||||||
|
@ -163,13 +163,13 @@ void main_blinky( void )
|
||||||
/* Start the two tasks as described in the comments at the top of this
|
/* Start the two tasks as described in the comments at the top of this
|
||||||
file. */
|
file. */
|
||||||
xTaskCreate( prvQueueReceiveTask, /* The function that implements the task. */
|
xTaskCreate( prvQueueReceiveTask, /* The function that implements the task. */
|
||||||
( signed char * ) "Rx", /* The text name assigned to the task - for debug only as it is not used by the kernel. */
|
"Rx", /* The text name assigned to the task - for debug only as it is not used by the kernel. */
|
||||||
configMINIMAL_STACK_SIZE, /* The size of the stack to allocate to the task. */
|
configMINIMAL_STACK_SIZE, /* The size of the stack to allocate to the task. */
|
||||||
( void * ) mainQUEUE_RECEIVE_PARAMETER, /* The parameter passed to the task - just to check the functionality. */
|
( void * ) mainQUEUE_RECEIVE_PARAMETER, /* The parameter passed to the task - just to check the functionality. */
|
||||||
mainQUEUE_RECEIVE_TASK_PRIORITY, /* The priority assigned to the task. */
|
mainQUEUE_RECEIVE_TASK_PRIORITY, /* The priority assigned to the task. */
|
||||||
NULL ); /* The task handle is not required, so NULL is passed. */
|
NULL ); /* The task handle is not required, so NULL is passed. */
|
||||||
|
|
||||||
xTaskCreate( prvQueueSendTask, ( signed char * ) "TX", configMINIMAL_STACK_SIZE, ( void * ) mainQUEUE_SEND_PARAMETER, mainQUEUE_SEND_TASK_PRIORITY, NULL );
|
xTaskCreate( prvQueueSendTask, "TX", configMINIMAL_STACK_SIZE, ( void * ) mainQUEUE_SEND_PARAMETER, mainQUEUE_SEND_TASK_PRIORITY, NULL );
|
||||||
|
|
||||||
/* Start the tasks and timer running. */
|
/* Start the tasks and timer running. */
|
||||||
vTaskStartScheduler();
|
vTaskStartScheduler();
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
All rights reserved
|
All rights reserved
|
||||||
|
|
||||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
@ -76,8 +76,8 @@
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*
|
*
|
||||||
* main_full() creates all the demo application tasks and a software timer, then
|
* main_full() creates all the demo application tasks and a software timer, then
|
||||||
* starts the scheduler. The web documentation provides more details of the
|
* starts the scheduler. The web documentation provides more details of the
|
||||||
* standard demo application tasks, which provide no particular functionality,
|
* standard demo application tasks, which provide no particular functionality,
|
||||||
* but do provide a good example of how to use the FreeRTOS API.
|
* but do provide a good example of how to use the FreeRTOS API.
|
||||||
*
|
*
|
||||||
* In addition to the standard demo tasks, the following tasks and tests are
|
* In addition to the standard demo tasks, the following tasks and tests are
|
||||||
|
@ -85,18 +85,18 @@
|
||||||
*
|
*
|
||||||
* "Check" timer - The check software timer period is initially set to three
|
* "Check" timer - The check software timer period is initially set to three
|
||||||
* seconds. The callback function associated with the check software timer
|
* seconds. The callback function associated with the check software timer
|
||||||
* checks that all the standard demo tasks are not only still executing, but
|
* checks that all the standard demo tasks are not only still executing, but
|
||||||
* are executing without reporting any errors. If the check software timer
|
* are executing without reporting any errors. If the check software timer
|
||||||
* discovers that a task has either stalled, or reported an error, then it
|
* discovers that a task has either stalled, or reported an error, then it
|
||||||
* changes its own execution period from the initial three seconds, to just
|
* changes its own execution period from the initial three seconds, to just
|
||||||
* 200ms. The check software timer callback function also toggles the green
|
* 200ms. The check software timer callback function also toggles the green
|
||||||
* LED each time it is called. This provides a visual indication of the system
|
* LED each time it is called. This provides a visual indication of the system
|
||||||
* status: If the green LED toggles every three seconds, then no issues have
|
* status: If the green LED toggles every three seconds, then no issues have
|
||||||
* been discovered. If the green LED toggles every 200ms, then an issue has
|
* been discovered. If the green LED toggles every 200ms, then an issue has
|
||||||
* been discovered with at least one task.
|
* been discovered with at least one task.
|
||||||
*
|
*
|
||||||
* See the documentation page for this demo on the FreeRTOS.org web site for
|
* See the documentation page for this demo on the FreeRTOS.org web site for
|
||||||
* full information, including hardware setup requirements.
|
* full information, including hardware setup requirements.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Standard includes. */
|
/* Standard includes. */
|
||||||
|
@ -191,35 +191,35 @@ xTimerHandle xCheckTimer = NULL;
|
||||||
vStartSemaphoreTasks( mainSEM_TEST_PRIORITY );
|
vStartSemaphoreTasks( mainSEM_TEST_PRIORITY );
|
||||||
vStartLEDFlashTimers( mainNUMBER_OF_FLASH_TIMERS_LEDS );
|
vStartLEDFlashTimers( mainNUMBER_OF_FLASH_TIMERS_LEDS );
|
||||||
vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED );
|
vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED );
|
||||||
|
|
||||||
/* Create the software timer that performs the 'check' functionality,
|
/* Create the software timer that performs the 'check' functionality,
|
||||||
as described at the top of this file. */
|
as described at the top of this file. */
|
||||||
xCheckTimer = xTimerCreate( ( const signed char * ) "CheckTimer",/* A text name, purely to help debugging. */
|
xCheckTimer = xTimerCreate( "CheckTimer", /* A text name, purely to help debugging. */
|
||||||
( mainCHECK_TIMER_PERIOD_MS ), /* The timer period, in this case 3000ms (3s). */
|
( mainCHECK_TIMER_PERIOD_MS ), /* The timer period, in this case 3000ms (3s). */
|
||||||
pdTRUE, /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */
|
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. */
|
( 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. */
|
prvCheckTimerCallback /* The callback function that inspects the status of all the other tasks. */
|
||||||
);
|
);
|
||||||
|
|
||||||
if( xCheckTimer != NULL )
|
if( xCheckTimer != NULL )
|
||||||
{
|
{
|
||||||
xTimerStart( xCheckTimer, mainDONT_BLOCK );
|
xTimerStart( xCheckTimer, mainDONT_BLOCK );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The set of tasks created by the following function call have to be
|
/* The set of tasks created by the following function call have to be
|
||||||
created last as they keep account of the number of tasks they expect to see
|
created last as they keep account of the number of tasks they expect to see
|
||||||
running. */
|
running. */
|
||||||
vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY );
|
vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY );
|
||||||
|
|
||||||
/* Start the scheduler. */
|
/* Start the scheduler. */
|
||||||
vTaskStartScheduler();
|
vTaskStartScheduler();
|
||||||
|
|
||||||
/* If all is well, the scheduler will now be running, and the following line
|
/* If all is well, the scheduler will now be running, and the following line
|
||||||
will never be reached. If the following line does execute, then there was
|
will never be reached. If the following line does execute, then there was
|
||||||
insufficient FreeRTOS heap memory available for the idle and/or timer tasks
|
insufficient FreeRTOS heap memory available for the idle and/or timer tasks
|
||||||
to be created. See the memory management section on the FreeRTOS web site
|
to be created. See the memory management section on the FreeRTOS web site
|
||||||
for more details. */
|
for more details. */
|
||||||
for( ;; );
|
for( ;; );
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
@ -275,7 +275,7 @@ unsigned long ulErrorFound = pdFALSE;
|
||||||
{
|
{
|
||||||
ulErrorFound = pdTRUE;
|
ulErrorFound = pdTRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( xAreComTestTasksStillRunning() != pdTRUE )
|
if( xAreComTestTasksStillRunning() != pdTRUE )
|
||||||
{
|
{
|
||||||
ulErrorFound = pdTRUE;
|
ulErrorFound = pdTRUE;
|
||||||
|
@ -285,7 +285,7 @@ unsigned long ulErrorFound = pdFALSE;
|
||||||
the LED toggles every mainCHECK_TIMER_PERIOD_MS milliseconds then
|
the LED toggles every mainCHECK_TIMER_PERIOD_MS milliseconds then
|
||||||
everything is ok. A faster toggle indicates an error. */
|
everything is ok. A faster toggle indicates an error. */
|
||||||
vParTestToggleLED( mainCHECK_LED );
|
vParTestToggleLED( mainCHECK_LED );
|
||||||
|
|
||||||
/* Have any errors been latch in ulErrorFound? If so, shorten the
|
/* Have any errors been latch in ulErrorFound? If so, shorten the
|
||||||
period of the check timer to mainERROR_CHECK_TIMER_PERIOD_MS milliseconds.
|
period of the check timer to mainERROR_CHECK_TIMER_PERIOD_MS milliseconds.
|
||||||
This will result in an increase in the rate at which mainCHECK_LED
|
This will result in an increase in the rate at which mainCHECK_LED
|
||||||
|
@ -295,7 +295,7 @@ unsigned long ulErrorFound = pdFALSE;
|
||||||
if( lChangedTimerPeriodAlready == pdFALSE )
|
if( lChangedTimerPeriodAlready == pdFALSE )
|
||||||
{
|
{
|
||||||
lChangedTimerPeriodAlready = pdTRUE;
|
lChangedTimerPeriodAlready = pdTRUE;
|
||||||
|
|
||||||
/* This call to xTimerChangePeriod() uses a zero block time.
|
/* This call to xTimerChangePeriod() uses a zero block time.
|
||||||
Functions called from inside of a timer callback function must
|
Functions called from inside of a timer callback function must
|
||||||
*never* attempt to block. */
|
*never* attempt to block. */
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
All rights reserved
|
All rights reserved
|
||||||
|
|
||||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
@ -122,7 +122,7 @@ extern void vSetupTimerTest( void );
|
||||||
/*
|
/*
|
||||||
* The Check task periodical interrogates each of the running tests to
|
* The Check task periodical interrogates each of the running tests to
|
||||||
* ensure that they are still executing correctly.
|
* ensure that they are still executing correctly.
|
||||||
* If all the tests pass, then the LCD is updated with Pass, the number of
|
* If all the tests pass, then the LCD is updated with Pass, the number of
|
||||||
* iterations and the Jitter time calculated but the Fast Interrupt Test.
|
* iterations and the Jitter time calculated but the Fast Interrupt Test.
|
||||||
* If any one of the tests fail, it is indicated with an error code printed on
|
* If any one of the tests fail, it is indicated with an error code printed on
|
||||||
* the display. This indicator won't disappear until the device is reset.
|
* the display. This indicator won't disappear until the device is reset.
|
||||||
|
@ -157,7 +157,7 @@ void main( void )
|
||||||
vStartInterruptQueueTasks();
|
vStartInterruptQueueTasks();
|
||||||
|
|
||||||
/* Start the error checking task. */
|
/* Start the error checking task. */
|
||||||
( void ) xTaskCreate( vCheckTask, ( signed portCHAR * ) "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );
|
( void ) xTaskCreate( vCheckTask, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );
|
||||||
|
|
||||||
/* Configure the timers used by the fast interrupt timer test. */
|
/* Configure the timers used by the fast interrupt timer test. */
|
||||||
vSetupTimerTest();
|
vSetupTimerTest();
|
||||||
|
@ -204,14 +204,14 @@ extern cyisraddress CyRamVectors[];
|
||||||
|
|
||||||
/* Start the UART. */
|
/* Start the UART. */
|
||||||
UART_1_Start();
|
UART_1_Start();
|
||||||
|
|
||||||
/* Initialise the LEDs. */
|
/* Initialise the LEDs. */
|
||||||
vParTestInitialise();
|
vParTestInitialise();
|
||||||
|
|
||||||
/* Start the PWM modules that drive the IntQueue tests. */
|
/* Start the PWM modules that drive the IntQueue tests. */
|
||||||
High_Frequency_PWM_0_Start();
|
High_Frequency_PWM_0_Start();
|
||||||
High_Frequency_PWM_1_Start();
|
High_Frequency_PWM_1_Start();
|
||||||
|
|
||||||
/* Start the timers for the Jitter test. */
|
/* Start the timers for the Jitter test. */
|
||||||
Timer_20KHz_Start();
|
Timer_20KHz_Start();
|
||||||
Timer_48MHz_Start();
|
Timer_48MHz_Start();
|
||||||
|
@ -228,73 +228,73 @@ extern unsigned portSHORT usMaxJitter;
|
||||||
|
|
||||||
/* Intialise the sleeper. */
|
/* Intialise the sleeper. */
|
||||||
xDelay = xTaskGetTickCount();
|
xDelay = xTaskGetTickCount();
|
||||||
|
|
||||||
for( ;; )
|
for( ;; )
|
||||||
{
|
{
|
||||||
/* Perform this check every mainCHECK_DELAY milliseconds. */
|
/* Perform this check every mainCHECK_DELAY milliseconds. */
|
||||||
vTaskDelayUntil( &xDelay, mainCHECK_DELAY );
|
vTaskDelayUntil( &xDelay, mainCHECK_DELAY );
|
||||||
|
|
||||||
/* Check that all of the Demo tasks are still running. */
|
/* Check that all of the Demo tasks are still running. */
|
||||||
if( pdTRUE != xAreBlockingQueuesStillRunning() )
|
if( pdTRUE != xAreBlockingQueuesStillRunning() )
|
||||||
{
|
{
|
||||||
usErrorCode |= 0x1;
|
usErrorCode |= 0x1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pdTRUE != xAreBlockTimeTestTasksStillRunning() )
|
if( pdTRUE != xAreBlockTimeTestTasksStillRunning() )
|
||||||
{
|
{
|
||||||
usErrorCode |= 0x2;
|
usErrorCode |= 0x2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pdTRUE != xAreCountingSemaphoreTasksStillRunning() )
|
if( pdTRUE != xAreCountingSemaphoreTasksStillRunning() )
|
||||||
{
|
{
|
||||||
usErrorCode |= 0x4;
|
usErrorCode |= 0x4;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pdTRUE != xIsCreateTaskStillRunning() )
|
if( pdTRUE != xIsCreateTaskStillRunning() )
|
||||||
{
|
{
|
||||||
usErrorCode |= 0x8;
|
usErrorCode |= 0x8;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pdTRUE != xAreDynamicPriorityTasksStillRunning() )
|
if( pdTRUE != xAreDynamicPriorityTasksStillRunning() )
|
||||||
{
|
{
|
||||||
usErrorCode |= 0x10;
|
usErrorCode |= 0x10;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pdTRUE != xAreMathsTaskStillRunning() )
|
if( pdTRUE != xAreMathsTaskStillRunning() )
|
||||||
{
|
{
|
||||||
usErrorCode |= 0x20;
|
usErrorCode |= 0x20;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pdTRUE != xAreGenericQueueTasksStillRunning() )
|
if( pdTRUE != xAreGenericQueueTasksStillRunning() )
|
||||||
{
|
{
|
||||||
usErrorCode |= 0x40;
|
usErrorCode |= 0x40;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pdTRUE != xAreIntegerMathsTaskStillRunning() )
|
if( pdTRUE != xAreIntegerMathsTaskStillRunning() )
|
||||||
{
|
{
|
||||||
usErrorCode |= 0x80;
|
usErrorCode |= 0x80;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pdTRUE != xArePollingQueuesStillRunning() )
|
if( pdTRUE != xArePollingQueuesStillRunning() )
|
||||||
{
|
{
|
||||||
usErrorCode |= 0x100;
|
usErrorCode |= 0x100;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pdTRUE != xAreQueuePeekTasksStillRunning() )
|
if( pdTRUE != xAreQueuePeekTasksStillRunning() )
|
||||||
{
|
{
|
||||||
usErrorCode |= 0x200;
|
usErrorCode |= 0x200;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pdTRUE != xAreSemaphoreTasksStillRunning() )
|
if( pdTRUE != xAreSemaphoreTasksStillRunning() )
|
||||||
{
|
{
|
||||||
usErrorCode |= 0x400;
|
usErrorCode |= 0x400;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pdTRUE != xAreComTestTasksStillRunning() )
|
if( pdTRUE != xAreComTestTasksStillRunning() )
|
||||||
{
|
{
|
||||||
usErrorCode |= 0x800;
|
usErrorCode |= 0x800;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pdTRUE != xAreIntQueueTasksStillRunning() )
|
if( pdTRUE != xAreIntQueueTasksStillRunning() )
|
||||||
{
|
{
|
||||||
usErrorCode |= 0x1000;
|
usErrorCode |= 0x1000;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
All rights reserved
|
All rights reserved
|
||||||
|
|
||||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
@ -122,7 +122,7 @@ extern void vSetupTimerTest( void );
|
||||||
/*
|
/*
|
||||||
* The Check task periodical interrogates each of the running tests to
|
* The Check task periodical interrogates each of the running tests to
|
||||||
* ensure that they are still executing correctly.
|
* ensure that they are still executing correctly.
|
||||||
* If all the tests pass, then the LCD is updated with Pass, the number of
|
* If all the tests pass, then the LCD is updated with Pass, the number of
|
||||||
* iterations and the Jitter time calculated but the Fast Interrupt Test.
|
* iterations and the Jitter time calculated but the Fast Interrupt Test.
|
||||||
* If any one of the tests fail, it is indicated with an error code printed on
|
* If any one of the tests fail, it is indicated with an error code printed on
|
||||||
* the display. This indicator won't disappear until the device is reset.
|
* the display. This indicator won't disappear until the device is reset.
|
||||||
|
@ -157,7 +157,7 @@ void main( void )
|
||||||
vStartInterruptQueueTasks();
|
vStartInterruptQueueTasks();
|
||||||
|
|
||||||
/* Start the error checking task. */
|
/* Start the error checking task. */
|
||||||
( void ) xTaskCreate( vCheckTask, ( signed portCHAR * ) "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );
|
( void ) xTaskCreate( vCheckTask, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );
|
||||||
|
|
||||||
/* Configure the timers used by the fast interrupt timer test. */
|
/* Configure the timers used by the fast interrupt timer test. */
|
||||||
vSetupTimerTest();
|
vSetupTimerTest();
|
||||||
|
@ -204,14 +204,14 @@ extern cyisraddress CyRamVectors[];
|
||||||
|
|
||||||
/* Start the UART. */
|
/* Start the UART. */
|
||||||
UART_1_Start();
|
UART_1_Start();
|
||||||
|
|
||||||
/* Initialise the LEDs. */
|
/* Initialise the LEDs. */
|
||||||
vParTestInitialise();
|
vParTestInitialise();
|
||||||
|
|
||||||
/* Start the PWM modules that drive the IntQueue tests. */
|
/* Start the PWM modules that drive the IntQueue tests. */
|
||||||
High_Frequency_PWM_0_Start();
|
High_Frequency_PWM_0_Start();
|
||||||
High_Frequency_PWM_1_Start();
|
High_Frequency_PWM_1_Start();
|
||||||
|
|
||||||
/* Start the timers for the Jitter test. */
|
/* Start the timers for the Jitter test. */
|
||||||
Timer_20KHz_Start();
|
Timer_20KHz_Start();
|
||||||
Timer_48MHz_Start();
|
Timer_48MHz_Start();
|
||||||
|
@ -228,73 +228,73 @@ extern unsigned portSHORT usMaxJitter;
|
||||||
|
|
||||||
/* Intialise the sleeper. */
|
/* Intialise the sleeper. */
|
||||||
xDelay = xTaskGetTickCount();
|
xDelay = xTaskGetTickCount();
|
||||||
|
|
||||||
for( ;; )
|
for( ;; )
|
||||||
{
|
{
|
||||||
/* Perform this check every mainCHECK_DELAY milliseconds. */
|
/* Perform this check every mainCHECK_DELAY milliseconds. */
|
||||||
vTaskDelayUntil( &xDelay, mainCHECK_DELAY );
|
vTaskDelayUntil( &xDelay, mainCHECK_DELAY );
|
||||||
|
|
||||||
/* Check that all of the Demo tasks are still running. */
|
/* Check that all of the Demo tasks are still running. */
|
||||||
if( pdTRUE != xAreBlockingQueuesStillRunning() )
|
if( pdTRUE != xAreBlockingQueuesStillRunning() )
|
||||||
{
|
{
|
||||||
usErrorCode |= 0x1;
|
usErrorCode |= 0x1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pdTRUE != xAreBlockTimeTestTasksStillRunning() )
|
if( pdTRUE != xAreBlockTimeTestTasksStillRunning() )
|
||||||
{
|
{
|
||||||
usErrorCode |= 0x2;
|
usErrorCode |= 0x2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pdTRUE != xAreCountingSemaphoreTasksStillRunning() )
|
if( pdTRUE != xAreCountingSemaphoreTasksStillRunning() )
|
||||||
{
|
{
|
||||||
usErrorCode |= 0x4;
|
usErrorCode |= 0x4;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pdTRUE != xIsCreateTaskStillRunning() )
|
if( pdTRUE != xIsCreateTaskStillRunning() )
|
||||||
{
|
{
|
||||||
usErrorCode |= 0x8;
|
usErrorCode |= 0x8;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pdTRUE != xAreDynamicPriorityTasksStillRunning() )
|
if( pdTRUE != xAreDynamicPriorityTasksStillRunning() )
|
||||||
{
|
{
|
||||||
usErrorCode |= 0x10;
|
usErrorCode |= 0x10;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pdTRUE != xAreMathsTaskStillRunning() )
|
if( pdTRUE != xAreMathsTaskStillRunning() )
|
||||||
{
|
{
|
||||||
usErrorCode |= 0x20;
|
usErrorCode |= 0x20;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pdTRUE != xAreGenericQueueTasksStillRunning() )
|
if( pdTRUE != xAreGenericQueueTasksStillRunning() )
|
||||||
{
|
{
|
||||||
usErrorCode |= 0x40;
|
usErrorCode |= 0x40;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pdTRUE != xAreIntegerMathsTaskStillRunning() )
|
if( pdTRUE != xAreIntegerMathsTaskStillRunning() )
|
||||||
{
|
{
|
||||||
usErrorCode |= 0x80;
|
usErrorCode |= 0x80;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pdTRUE != xArePollingQueuesStillRunning() )
|
if( pdTRUE != xArePollingQueuesStillRunning() )
|
||||||
{
|
{
|
||||||
usErrorCode |= 0x100;
|
usErrorCode |= 0x100;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pdTRUE != xAreQueuePeekTasksStillRunning() )
|
if( pdTRUE != xAreQueuePeekTasksStillRunning() )
|
||||||
{
|
{
|
||||||
usErrorCode |= 0x200;
|
usErrorCode |= 0x200;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pdTRUE != xAreSemaphoreTasksStillRunning() )
|
if( pdTRUE != xAreSemaphoreTasksStillRunning() )
|
||||||
{
|
{
|
||||||
usErrorCode |= 0x400;
|
usErrorCode |= 0x400;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pdTRUE != xAreComTestTasksStillRunning() )
|
if( pdTRUE != xAreComTestTasksStillRunning() )
|
||||||
{
|
{
|
||||||
usErrorCode |= 0x800;
|
usErrorCode |= 0x800;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pdTRUE != xAreIntQueueTasksStillRunning() )
|
if( pdTRUE != xAreIntQueueTasksStillRunning() )
|
||||||
{
|
{
|
||||||
usErrorCode |= 0x1000;
|
usErrorCode |= 0x1000;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
All rights reserved
|
All rights reserved
|
||||||
|
|
||||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
@ -122,7 +122,7 @@ extern void vSetupTimerTest( void );
|
||||||
/*
|
/*
|
||||||
* The Check task periodical interrogates each of the running tests to
|
* The Check task periodical interrogates each of the running tests to
|
||||||
* ensure that they are still executing correctly.
|
* ensure that they are still executing correctly.
|
||||||
* If all the tests pass, then the LCD is updated with Pass, the number of
|
* If all the tests pass, then the LCD is updated with Pass, the number of
|
||||||
* iterations and the Jitter time calculated but the Fast Interrupt Test.
|
* iterations and the Jitter time calculated but the Fast Interrupt Test.
|
||||||
* If any one of the tests fail, it is indicated with an error code printed on
|
* If any one of the tests fail, it is indicated with an error code printed on
|
||||||
* the display. This indicator won't disappear until the device is reset.
|
* the display. This indicator won't disappear until the device is reset.
|
||||||
|
@ -157,7 +157,7 @@ void main( void )
|
||||||
vStartInterruptQueueTasks();
|
vStartInterruptQueueTasks();
|
||||||
|
|
||||||
/* Start the error checking task. */
|
/* Start the error checking task. */
|
||||||
( void ) xTaskCreate( vCheckTask, ( signed portCHAR * ) "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );
|
( void ) xTaskCreate( vCheckTask, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );
|
||||||
|
|
||||||
/* Configure the timers used by the fast interrupt timer test. */
|
/* Configure the timers used by the fast interrupt timer test. */
|
||||||
vSetupTimerTest();
|
vSetupTimerTest();
|
||||||
|
@ -204,14 +204,14 @@ extern cyisraddress CyRamVectors[];
|
||||||
|
|
||||||
/* Start the UART. */
|
/* Start the UART. */
|
||||||
UART_1_Start();
|
UART_1_Start();
|
||||||
|
|
||||||
/* Initialise the LEDs. */
|
/* Initialise the LEDs. */
|
||||||
vParTestInitialise();
|
vParTestInitialise();
|
||||||
|
|
||||||
/* Start the PWM modules that drive the IntQueue tests. */
|
/* Start the PWM modules that drive the IntQueue tests. */
|
||||||
High_Frequency_PWM_0_Start();
|
High_Frequency_PWM_0_Start();
|
||||||
High_Frequency_PWM_1_Start();
|
High_Frequency_PWM_1_Start();
|
||||||
|
|
||||||
/* Start the timers for the Jitter test. */
|
/* Start the timers for the Jitter test. */
|
||||||
Timer_20KHz_Start();
|
Timer_20KHz_Start();
|
||||||
Timer_48MHz_Start();
|
Timer_48MHz_Start();
|
||||||
|
@ -228,73 +228,73 @@ extern unsigned portSHORT usMaxJitter;
|
||||||
|
|
||||||
/* Intialise the sleeper. */
|
/* Intialise the sleeper. */
|
||||||
xDelay = xTaskGetTickCount();
|
xDelay = xTaskGetTickCount();
|
||||||
|
|
||||||
for( ;; )
|
for( ;; )
|
||||||
{
|
{
|
||||||
/* Perform this check every mainCHECK_DELAY milliseconds. */
|
/* Perform this check every mainCHECK_DELAY milliseconds. */
|
||||||
vTaskDelayUntil( &xDelay, mainCHECK_DELAY );
|
vTaskDelayUntil( &xDelay, mainCHECK_DELAY );
|
||||||
|
|
||||||
/* Check that all of the Demo tasks are still running. */
|
/* Check that all of the Demo tasks are still running. */
|
||||||
if( pdTRUE != xAreBlockingQueuesStillRunning() )
|
if( pdTRUE != xAreBlockingQueuesStillRunning() )
|
||||||
{
|
{
|
||||||
usErrorCode |= 0x1;
|
usErrorCode |= 0x1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pdTRUE != xAreBlockTimeTestTasksStillRunning() )
|
if( pdTRUE != xAreBlockTimeTestTasksStillRunning() )
|
||||||
{
|
{
|
||||||
usErrorCode |= 0x2;
|
usErrorCode |= 0x2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pdTRUE != xAreCountingSemaphoreTasksStillRunning() )
|
if( pdTRUE != xAreCountingSemaphoreTasksStillRunning() )
|
||||||
{
|
{
|
||||||
usErrorCode |= 0x4;
|
usErrorCode |= 0x4;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pdTRUE != xIsCreateTaskStillRunning() )
|
if( pdTRUE != xIsCreateTaskStillRunning() )
|
||||||
{
|
{
|
||||||
usErrorCode |= 0x8;
|
usErrorCode |= 0x8;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pdTRUE != xAreDynamicPriorityTasksStillRunning() )
|
if( pdTRUE != xAreDynamicPriorityTasksStillRunning() )
|
||||||
{
|
{
|
||||||
usErrorCode |= 0x10;
|
usErrorCode |= 0x10;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pdTRUE != xAreMathsTaskStillRunning() )
|
if( pdTRUE != xAreMathsTaskStillRunning() )
|
||||||
{
|
{
|
||||||
usErrorCode |= 0x20;
|
usErrorCode |= 0x20;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pdTRUE != xAreGenericQueueTasksStillRunning() )
|
if( pdTRUE != xAreGenericQueueTasksStillRunning() )
|
||||||
{
|
{
|
||||||
usErrorCode |= 0x40;
|
usErrorCode |= 0x40;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pdTRUE != xAreIntegerMathsTaskStillRunning() )
|
if( pdTRUE != xAreIntegerMathsTaskStillRunning() )
|
||||||
{
|
{
|
||||||
usErrorCode |= 0x80;
|
usErrorCode |= 0x80;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pdTRUE != xArePollingQueuesStillRunning() )
|
if( pdTRUE != xArePollingQueuesStillRunning() )
|
||||||
{
|
{
|
||||||
usErrorCode |= 0x100;
|
usErrorCode |= 0x100;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pdTRUE != xAreQueuePeekTasksStillRunning() )
|
if( pdTRUE != xAreQueuePeekTasksStillRunning() )
|
||||||
{
|
{
|
||||||
usErrorCode |= 0x200;
|
usErrorCode |= 0x200;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pdTRUE != xAreSemaphoreTasksStillRunning() )
|
if( pdTRUE != xAreSemaphoreTasksStillRunning() )
|
||||||
{
|
{
|
||||||
usErrorCode |= 0x400;
|
usErrorCode |= 0x400;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pdTRUE != xAreComTestTasksStillRunning() )
|
if( pdTRUE != xAreComTestTasksStillRunning() )
|
||||||
{
|
{
|
||||||
usErrorCode |= 0x800;
|
usErrorCode |= 0x800;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pdTRUE != xAreIntQueueTasksStillRunning() )
|
if( pdTRUE != xAreIntQueueTasksStillRunning() )
|
||||||
{
|
{
|
||||||
usErrorCode |= 0x1000;
|
usErrorCode |= 0x1000;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
All rights reserved
|
All rights reserved
|
||||||
|
|
||||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
@ -70,21 +70,21 @@
|
||||||
* main-full.c (this file) defines a comprehensive demo that creates many
|
* main-full.c (this file) defines a comprehensive demo that creates many
|
||||||
* tasks, queues, semaphores and timers. It also demonstrates how Cortex-M3
|
* tasks, queues, semaphores and timers. It also demonstrates how Cortex-M3
|
||||||
* interrupts can interact with FreeRTOS tasks/timers, a simple web server, and
|
* interrupts can interact with FreeRTOS tasks/timers, a simple web server, and
|
||||||
* run time statistics gathering functionality. ***IF YOU ARE LOOKING FOR A
|
* run time statistics gathering functionality. ***IF YOU ARE LOOKING FOR A
|
||||||
* SIMPLER STARTING POINT THEN USE THE "BLINKY" BUILD CONFIGURATION FIRST.***
|
* SIMPLER STARTING POINT THEN USE THE "BLINKY" BUILD CONFIGURATION FIRST.***
|
||||||
*
|
*
|
||||||
* If the Ethernet functionality is excluded, then this demo will run 'stand
|
* If the Ethernet functionality is excluded, then this demo will run 'stand
|
||||||
* alone' (without the rest of the tower system) on the TWR-K60N512 tower
|
* alone' (without the rest of the tower system) on the TWR-K60N512 tower
|
||||||
* module. If the Ethernet functionality is included, then the full Freescale
|
* module. If the Ethernet functionality is included, then the full Freescale
|
||||||
* K60 tower kit, including both the TWR-K60N512 and TWR-SER modules, is
|
* K60 tower kit, including both the TWR-K60N512 and TWR-SER modules, is
|
||||||
* required (as the Ethernet connector is on the TWR-SER). The TWR-K60N512 is
|
* required (as the Ethernet connector is on the TWR-SER). The TWR-K60N512 is
|
||||||
* populated with a K60N512 Cortex-M4 microcontroller.
|
* populated with a K60N512 Cortex-M4 microcontroller.
|
||||||
*
|
*
|
||||||
* The main() Function:
|
* The main() Function:
|
||||||
* main() creates four demo specific software timers, and one demo specific
|
* main() creates four demo specific software timers, and one demo specific
|
||||||
* task (the web server task). It also creates a whole host of 'standard
|
* task (the web server task). It also creates a whole host of 'standard
|
||||||
* demo' tasks/queues/semaphores/timers, before starting the scheduler. The
|
* demo' tasks/queues/semaphores/timers, before starting the scheduler. The
|
||||||
* demo specific tasks and timers are described in the comments here. The
|
* demo specific tasks and timers are described in the comments here. The
|
||||||
* standard demo tasks are described on the FreeRTOS.org web site.
|
* standard demo tasks are described on the FreeRTOS.org web site.
|
||||||
*
|
*
|
||||||
* The standard demo tasks provide no specific functionality. They are
|
* The standard demo tasks provide no specific functionality. They are
|
||||||
|
@ -97,33 +97,33 @@
|
||||||
*
|
*
|
||||||
* The Demo Specific "LED" Timers and Callback Function:
|
* The Demo Specific "LED" Timers and Callback Function:
|
||||||
* Two very simple LED timers are created. All they do is toggle an LED each
|
* Two very simple LED timers are created. All they do is toggle an LED each
|
||||||
* when the timer callback function is executed. The two timers share a
|
* when the timer callback function is executed. The two timers share a
|
||||||
* callback function, so the callback function parameter is used to determine
|
* callback function, so the callback function parameter is used to determine
|
||||||
* which timer actually expired, and therefore, which LED to toggle. Both
|
* which timer actually expired, and therefore, which LED to toggle. Both
|
||||||
* timers use a different frequency, one toggles the blue LED and the other the
|
* timers use a different frequency, one toggles the blue LED and the other the
|
||||||
* green LED.
|
* green LED.
|
||||||
*
|
*
|
||||||
* The LED/Button Software Timer and the Button Interrupt:
|
* The LED/Button Software Timer and the Button Interrupt:
|
||||||
* The user button SW2 is configured to generate an interrupt each time it is
|
* The user button SW2 is configured to generate an interrupt each time it is
|
||||||
* pressed. The interrupt service routine switches the orange/yellow LED on,
|
* pressed. The interrupt service routine switches the orange/yellow LED on,
|
||||||
* and resets the LED software timer. The LED timer has a 5000 millisecond (5
|
* and resets the LED software timer. The LED timer has a 5000 millisecond (5
|
||||||
* second) period, and uses a callback function that is defined to just turn the
|
* second) period, and uses a callback function that is defined to just turn the
|
||||||
* LED off again. Therefore, pressing the user button will turn the LED on, and
|
* LED off again. Therefore, pressing the user button will turn the LED on, and
|
||||||
* the LED will remain on until a full five seconds pass without the button
|
* the LED will remain on until a full five seconds pass without the button
|
||||||
* being pressed.
|
* being pressed.
|
||||||
*
|
*
|
||||||
* The Demo Specific "Check" Timer and Callback Function:
|
* The Demo Specific "Check" Timer and Callback Function:
|
||||||
* The check timer period is initially set to three seconds. The check timer
|
* The check timer period is initially set to three seconds. The check timer
|
||||||
* callback function checks that all the standard demo tasks are not only still
|
* callback function checks that all the standard demo tasks are not only still
|
||||||
* executing, but are executing without reporting any errors. If the check
|
* executing, but are executing without reporting any errors. If the check
|
||||||
* timer discovers that a task has either stalled, or reported an error, then it
|
* timer discovers that a task has either stalled, or reported an error, then it
|
||||||
* changes its own period from the initial three seconds, to just 200ms. The
|
* changes its own period from the initial three seconds, to just 200ms. The
|
||||||
* check timer callback function also toggles the orange/red LED each time it is
|
* check timer callback function also toggles the orange/red LED each time it is
|
||||||
* called. This provides a visual indication of the system status: If the LED
|
* called. This provides a visual indication of the system status: If the LED
|
||||||
* toggles every three seconds, then no issues have been discovered. If the LED
|
* toggles every three seconds, then no issues have been discovered. If the LED
|
||||||
* toggles every 200ms, then an issue has been discovered with at least one
|
* toggles every 200ms, then an issue has been discovered with at least one
|
||||||
* task. The last reported issue is latched into the pcStatusMessage variable,
|
* task. The last reported issue is latched into the pcStatusMessage variable,
|
||||||
* and displayed at the bottom of the "task stats" web page served by the
|
* and displayed at the bottom of the "task stats" web page served by the
|
||||||
* embedded web server task.
|
* embedded web server task.
|
||||||
*
|
*
|
||||||
* The web server task:
|
* The web server task:
|
||||||
|
@ -142,7 +142,7 @@
|
||||||
* The Demo Specific Tick Hook Function:
|
* The Demo Specific Tick Hook Function:
|
||||||
* The tick hook function is used to test the interrupt safe software timer
|
* The tick hook function is used to test the interrupt safe software timer
|
||||||
* functionality.
|
* functionality.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Kernel includes. */
|
/* Kernel includes. */
|
||||||
|
@ -204,7 +204,7 @@ reported in one of the standard demo tasks. ms are converted to the equivalent
|
||||||
in ticks using the portTICK_RATE_MS constant. */
|
in ticks using the portTICK_RATE_MS constant. */
|
||||||
#define mainERROR_CHECK_TIMER_PERIOD_MS ( 200UL / portTICK_RATE_MS )
|
#define mainERROR_CHECK_TIMER_PERIOD_MS ( 200UL / portTICK_RATE_MS )
|
||||||
|
|
||||||
/* The LED that is turned on by pressing SW2 remains on until the button has not
|
/* The LED that is turned on by pressing SW2 remains on until the button has not
|
||||||
been pushed for a full 5000ms. */
|
been pushed for a full 5000ms. */
|
||||||
#define mainBUTTON_LED_TIMER_PERIOD_MS ( 5000UL / portTICK_RATE_MS )
|
#define mainBUTTON_LED_TIMER_PERIOD_MS ( 5000UL / portTICK_RATE_MS )
|
||||||
|
|
||||||
|
@ -234,7 +234,7 @@ static void prvSetupHardware( void );
|
||||||
static void prvCreateDemoSpecificTimers( void );
|
static void prvCreateDemoSpecificTimers( void );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The LED/button timer callback function. This does nothing but switch an LED
|
* The LED/button timer callback function. This does nothing but switch an LED
|
||||||
* off.
|
* off.
|
||||||
*/
|
*/
|
||||||
static void prvButtonLEDTimerCallback( xTimerHandle xTimer );
|
static void prvButtonLEDTimerCallback( xTimerHandle xTimer );
|
||||||
|
@ -258,7 +258,7 @@ extern void vuIP_Task( void *pvParameters );
|
||||||
|
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
/* The LED/Button software timer. This uses prvButtonLEDTimerCallback() as it's
|
/* The LED/Button software timer. This uses prvButtonLEDTimerCallback() as it's
|
||||||
callback function. */
|
callback function. */
|
||||||
static xTimerHandle xLEDButtonTimer = NULL;
|
static xTimerHandle xLEDButtonTimer = NULL;
|
||||||
|
|
||||||
|
@ -302,7 +302,7 @@ void main( void )
|
||||||
vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY );
|
vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY );
|
||||||
vStartCountingSemaphoreTasks();
|
vStartCountingSemaphoreTasks();
|
||||||
vStartDynamicPriorityTasks();
|
vStartDynamicPriorityTasks();
|
||||||
|
|
||||||
/* The web server task. */
|
/* The web server task. */
|
||||||
xTaskCreate( vuIP_Task, "uIP", mainuIP_STACK_SIZE, NULL, mainuIP_TASK_PRIORITY, NULL );
|
xTaskCreate( vuIP_Task, "uIP", mainuIP_STACK_SIZE, NULL, mainuIP_TASK_PRIORITY, NULL );
|
||||||
|
|
||||||
|
@ -381,12 +381,12 @@ static long lChangedTimerPeriodAlready = pdFALSE;
|
||||||
{
|
{
|
||||||
pcStatusMessage = "Error: CountSem\n";
|
pcStatusMessage = "Error: CountSem\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if( xAreDynamicPriorityTasksStillRunning() != pdTRUE )
|
if( xAreDynamicPriorityTasksStillRunning() != pdTRUE )
|
||||||
{
|
{
|
||||||
pcStatusMessage = "Error: DynamicPriority\n";
|
pcStatusMessage = "Error: DynamicPriority\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Toggle the check LED to give an indication of the system status. If
|
/* Toggle the check LED to give an indication of the system status. If
|
||||||
the LED toggles every mainCHECK_TIMER_PERIOD_MS milliseconds then
|
the LED toggles every mainCHECK_TIMER_PERIOD_MS milliseconds then
|
||||||
everything is ok. A faster toggle indicates an error. */
|
everything is ok. A faster toggle indicates an error. */
|
||||||
|
@ -401,9 +401,9 @@ static long lChangedTimerPeriodAlready = pdFALSE;
|
||||||
if( lChangedTimerPeriodAlready == pdFALSE )
|
if( lChangedTimerPeriodAlready == pdFALSE )
|
||||||
{
|
{
|
||||||
lChangedTimerPeriodAlready = pdTRUE;
|
lChangedTimerPeriodAlready = pdTRUE;
|
||||||
|
|
||||||
/* This call to xTimerChangePeriod() uses a zero block time.
|
/* This call to xTimerChangePeriod() uses a zero block time.
|
||||||
Functions called from inside of a timer callback function must
|
Functions called from inside of a timer callback function must
|
||||||
*never* attempt to block. */
|
*never* attempt to block. */
|
||||||
xTimerChangePeriod( xCheckTimer, ( mainERROR_CHECK_TIMER_PERIOD_MS ), mainDONT_BLOCK );
|
xTimerChangePeriod( xCheckTimer, ( mainERROR_CHECK_TIMER_PERIOD_MS ), mainDONT_BLOCK );
|
||||||
}
|
}
|
||||||
|
@ -464,11 +464,11 @@ static void prvSetupHardware( void )
|
||||||
taskDISABLE_INTERRUPTS();
|
taskDISABLE_INTERRUPTS();
|
||||||
PORTE_PCR26 = PORT_PCR_MUX( 1 ) | PORT_PCR_IRQC( 0xA ) | PORT_PCR_PE_MASK | PORT_PCR_PS_MASK;
|
PORTE_PCR26 = PORT_PCR_MUX( 1 ) | PORT_PCR_IRQC( 0xA ) | PORT_PCR_PE_MASK | PORT_PCR_PS_MASK;
|
||||||
enable_irq( mainGPIO_E_VECTOR );
|
enable_irq( mainGPIO_E_VECTOR );
|
||||||
|
|
||||||
/* The interrupt calls an interrupt safe API function - so its priority must
|
/* The interrupt calls an interrupt safe API function - so its priority must
|
||||||
be equal to or lower than configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY. */
|
be equal to or lower than configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY. */
|
||||||
set_irq_priority( mainGPIO_E_VECTOR, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY );
|
set_irq_priority( mainGPIO_E_VECTOR, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY );
|
||||||
|
|
||||||
/* Configure the LED outputs. */
|
/* Configure the LED outputs. */
|
||||||
vParTestInitialise();
|
vParTestInitialise();
|
||||||
}
|
}
|
||||||
|
@ -477,48 +477,48 @@ static void prvSetupHardware( void )
|
||||||
static void prvCreateDemoSpecificTimers( void )
|
static void prvCreateDemoSpecificTimers( void )
|
||||||
{
|
{
|
||||||
/* This function creates the timers, but does not start them. This is
|
/* This function creates the timers, but does not start them. This is
|
||||||
because the standard demo timer test is started from main(), after this
|
because the standard demo timer test is started from main(), after this
|
||||||
function is called. The standard demo timer test will deliberately fill the
|
function is called. The standard demo timer test will deliberately fill the
|
||||||
timer command queue - and will fail the test if the command queue already
|
timer command queue - and will fail the test if the command queue already
|
||||||
holds start commands for the timers created here. Instead, the timers
|
holds start commands for the timers created here. Instead, the timers
|
||||||
created in this function are started from the idle task, at which time, the
|
created in this function are started from the idle task, at which time, the
|
||||||
timer service/daemon task will be running, and will have drained the timer
|
timer service/daemon task will be running, and will have drained the timer
|
||||||
command queue. */
|
command queue. */
|
||||||
|
|
||||||
/* Create the software timer that is responsible for turning off the LED
|
/* Create the software timer that is responsible for turning off the LED
|
||||||
if the button is not pushed within 5000ms, as described at the top of
|
if the button is not pushed within 5000ms, as described at the top of
|
||||||
this file. */
|
this file. */
|
||||||
xLEDButtonTimer = xTimerCreate( ( const signed char * ) "ButtonLEDTimer", /* A text name, purely to help debugging. */
|
xLEDButtonTimer = xTimerCreate( "ButtonLEDTimer", /* A text name, purely to help debugging. */
|
||||||
( mainBUTTON_LED_TIMER_PERIOD_MS ), /* The timer period, in this case 5000ms (5s). */
|
( mainBUTTON_LED_TIMER_PERIOD_MS ), /* The timer period, in this case 5000ms (5s). */
|
||||||
pdFALSE, /* This is a one shot timer, so xAutoReload is set to pdFALSE. */
|
pdFALSE, /* This is a one shot timer, so xAutoReload is set to pdFALSE. */
|
||||||
( void * ) 0, /* The ID is not used, so can be set to anything. */
|
( void * ) 0, /* The ID is not used, so can be set to anything. */
|
||||||
prvButtonLEDTimerCallback /* The callback function that switches the LED off. */
|
prvButtonLEDTimerCallback /* The callback function that switches the LED off. */
|
||||||
);
|
);
|
||||||
|
|
||||||
/* Create the software timer that performs the 'check' functionality,
|
/* Create the software timer that performs the 'check' functionality,
|
||||||
as described at the top of this file. */
|
as described at the top of this file. */
|
||||||
xCheckTimer = xTimerCreate( ( const signed char * ) "CheckTimer",/* A text name, purely to help debugging. */
|
xCheckTimer = xTimerCreate( "CheckTimer", /* A text name, purely to help debugging. */
|
||||||
( mainCHECK_TIMER_PERIOD_MS ), /* The timer period, in this case 3000ms (3s). */
|
( mainCHECK_TIMER_PERIOD_MS ), /* The timer period, in this case 3000ms (3s). */
|
||||||
pdTRUE, /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */
|
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. */
|
( 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. */
|
prvCheckTimerCallback /* The callback function that inspects the status of all the other tasks. */
|
||||||
);
|
);
|
||||||
|
|
||||||
/* Create the software timers used to simply flash LEDs. These two timers
|
/* Create the software timers used to simply flash LEDs. These two timers
|
||||||
share a callback function, so the callback parameter is used to pass in the
|
share a callback function, so the callback parameter is used to pass in the
|
||||||
LED that should be toggled. */
|
LED that should be toggled. */
|
||||||
xLED1Timer = xTimerCreate( ( const signed char * ) "LED1Timer",/* A text name, purely to help debugging. */
|
xLED1Timer = xTimerCreate( "LED1Timer", /* A text name, purely to help debugging. */
|
||||||
( mainLED1_TIMER_PERIOD_MS ), /* The timer period, in this case 3000ms (3s). */
|
( mainLED1_TIMER_PERIOD_MS ), /* The timer period, in this case 3000ms (3s). */
|
||||||
pdTRUE, /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */
|
pdTRUE, /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */
|
||||||
( void * ) mainLED0, /* The ID is used to pass in the number of the LED to be toggled. */
|
( void * ) mainLED0, /* The ID is used to pass in the number of the LED to be toggled. */
|
||||||
prvLEDTimerCallback /* The callback function simply toggles the LED specified by its parameter. */
|
prvLEDTimerCallback /* The callback function simply toggles the LED specified by its parameter. */
|
||||||
);
|
);
|
||||||
|
|
||||||
xLED2Timer = xTimerCreate( ( const signed char * ) "LED2Timer",/* A text name, purely to help debugging. */
|
xLED2Timer = xTimerCreate( "LED2Timer", /* A text name, purely to help debugging. */
|
||||||
( mainLED2_TIMER_PERIOD_MS ), /* The timer period, in this case 3000ms (3s). */
|
( mainLED2_TIMER_PERIOD_MS ), /* The timer period, in this case 3000ms (3s). */
|
||||||
pdTRUE, /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */
|
pdTRUE, /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */
|
||||||
( void * ) mainLED1, /* The ID is used to pass in the number of the LED to be toggled. */
|
( void * ) mainLED1, /* The ID is used to pass in the number of the LED to be toggled. */
|
||||||
prvLEDTimerCallback /* The callback function simply toggles the LED specified by its parameter. */
|
prvLEDTimerCallback /* The callback function simply toggles the LED specified by its parameter. */
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
@ -570,9 +570,9 @@ volatile size_t xFreeHeapSpace;
|
||||||
xTimerStart( xCheckTimer, portMAX_DELAY );
|
xTimerStart( xCheckTimer, portMAX_DELAY );
|
||||||
xTimerStart( xLED1Timer, portMAX_DELAY );
|
xTimerStart( xLED1Timer, portMAX_DELAY );
|
||||||
xTimerStart( xLED2Timer, portMAX_DELAY );
|
xTimerStart( xLED2Timer, portMAX_DELAY );
|
||||||
|
|
||||||
xFreeHeapSpace = xPortGetFreeHeapSize();
|
xFreeHeapSpace = xPortGetFreeHeapSize();
|
||||||
|
|
||||||
if( xFreeHeapSpace > 100 )
|
if( xFreeHeapSpace > 100 )
|
||||||
{
|
{
|
||||||
/* By now, the kernel has allocated everything it is going to, so
|
/* By now, the kernel has allocated everything it is going to, so
|
||||||
|
@ -589,12 +589,12 @@ void vApplicationTickHook( void )
|
||||||
/* Call the periodic timer test, which tests the timer API functions that
|
/* Call the periodic timer test, which tests the timer API functions that
|
||||||
can be called from an ISR. */
|
can be called from an ISR. */
|
||||||
vTimerPeriodicISRTests();
|
vTimerPeriodicISRTests();
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
char *pcGetTaskStatusMessage( void )
|
char *pcGetTaskStatusMessage( void )
|
||||||
{
|
{
|
||||||
/* A simple GET function used by a CGI script so it can display the
|
/* A simple GET function used by a CGI script so it can display the
|
||||||
execution status at the bottom of the task stats web page served by the
|
execution status at the bottom of the task stats web page served by the
|
||||||
embedded web server. */
|
embedded web server. */
|
||||||
if( pcStatusMessage == NULL )
|
if( pcStatusMessage == NULL )
|
||||||
|
@ -631,7 +631,7 @@ const unsigned long ulSysTickPendingBit = 0x04000000UL;
|
||||||
/* The SysTick is a down counter. How many clocks have passed since it was
|
/* The SysTick is a down counter. How many clocks have passed since it was
|
||||||
last reloaded? */
|
last reloaded? */
|
||||||
ulSysTickCounts = ulSysTickReloadValue - *pulCurrentSysTickCount;
|
ulSysTickCounts = ulSysTickReloadValue - *pulCurrentSysTickCount;
|
||||||
|
|
||||||
/* How many times has it overflowed? */
|
/* How many times has it overflowed? */
|
||||||
ulTickCount = xTaskGetTickCountFromISR();
|
ulTickCount = xTaskGetTickCountFromISR();
|
||||||
|
|
||||||
|
@ -640,28 +640,28 @@ const unsigned long ulSysTickPendingBit = 0x04000000UL;
|
||||||
section, and the ISR safe critical sections are not designed to nest,
|
section, and the ISR safe critical sections are not designed to nest,
|
||||||
so reset the critical section. */
|
so reset the critical section. */
|
||||||
portSET_INTERRUPT_MASK_FROM_ISR();
|
portSET_INTERRUPT_MASK_FROM_ISR();
|
||||||
|
|
||||||
/* Is there a SysTick interrupt pending? */
|
/* Is there a SysTick interrupt pending? */
|
||||||
if( ( *pulInterruptCTRLState & ulSysTickPendingBit ) != 0UL )
|
if( ( *pulInterruptCTRLState & ulSysTickPendingBit ) != 0UL )
|
||||||
{
|
{
|
||||||
/* There is a SysTick interrupt pending, so the SysTick has overflowed
|
/* There is a SysTick interrupt pending, so the SysTick has overflowed
|
||||||
but the tick count not yet incremented. */
|
but the tick count not yet incremented. */
|
||||||
ulTickCount++;
|
ulTickCount++;
|
||||||
|
|
||||||
/* Read the SysTick again, as the overflow might have occurred since
|
/* Read the SysTick again, as the overflow might have occurred since
|
||||||
it was read last. */
|
it was read last. */
|
||||||
ulSysTickCounts = ulSysTickReloadValue - *pulCurrentSysTickCount;
|
ulSysTickCounts = ulSysTickReloadValue - *pulCurrentSysTickCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Convert the tick count into tenths of a millisecond. THIS ASSUMES
|
/* Convert the tick count into tenths of a millisecond. THIS ASSUMES
|
||||||
configTICK_RATE_HZ is 1000! */
|
configTICK_RATE_HZ is 1000! */
|
||||||
ulReturn = ( ulTickCount * 10UL ) ;
|
ulReturn = ( ulTickCount * 10UL ) ;
|
||||||
|
|
||||||
/* Add on the number of tenths of a millisecond that have passed since the
|
/* Add on the number of tenths of a millisecond that have passed since the
|
||||||
tick count last got updated. */
|
tick count last got updated. */
|
||||||
ulReturn += ( ulSysTickCounts / ulClocksPer10thOfAMilliSecond );
|
ulReturn += ( ulSysTickCounts / ulClocksPer10thOfAMilliSecond );
|
||||||
|
|
||||||
return ulReturn;
|
return ulReturn;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
All rights reserved
|
All rights reserved
|
||||||
|
|
||||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
@ -95,22 +95,22 @@
|
||||||
* in this file. prvQueueReceiveTask() sits in a loop that causes it to
|
* in this file. prvQueueReceiveTask() sits in a loop that causes it to
|
||||||
* repeatedly attempt to read data from the queue that was created within
|
* repeatedly attempt to read data from the queue that was created within
|
||||||
* main(). When data is received, the task checks the value of the data, and
|
* main(). When data is received, the task checks the value of the data, and
|
||||||
* if the value equals the expected 100, toggles the blue LED. The 'block
|
* if the value equals the expected 100, toggles the blue LED. The 'block
|
||||||
* time' parameter passed to the queue receive function specifies that the task
|
* time' parameter passed to the queue receive function specifies that the task
|
||||||
* should be held in the Blocked state indefinitely to wait for data to be
|
* should be held in the Blocked state indefinitely to wait for data to be
|
||||||
* available on the queue. The queue receive task will only leave the Blocked
|
* available on the queue. The queue receive task will only leave the Blocked
|
||||||
* state when the queue send task writes to the queue. As the queue send task
|
* state when the queue send task writes to the queue. As the queue send task
|
||||||
* writes to the queue every 200 milliseconds, the queue receive task leaves the
|
* writes to the queue every 200 milliseconds, the queue receive task leaves the
|
||||||
* Blocked state every 200 milliseconds, and therefore toggles the blue LED
|
* Blocked state every 200 milliseconds, and therefore toggles the blue LED
|
||||||
* every 200 milliseconds.
|
* every 200 milliseconds.
|
||||||
*
|
*
|
||||||
* The LED Software Timer and the Button Interrupt:
|
* The LED Software Timer and the Button Interrupt:
|
||||||
* The user button SW2 is configured to generate an interrupt each time it is
|
* The user button SW2 is configured to generate an interrupt each time it is
|
||||||
* pressed. The interrupt service routine switches the green LED on, and
|
* pressed. The interrupt service routine switches the green LED on, and
|
||||||
* resets the LED software timer. The LED timer has a 5000 millisecond (5
|
* resets the LED software timer. The LED timer has a 5000 millisecond (5
|
||||||
* second) period, and uses a callback function that is defined to just turn the
|
* second) period, and uses a callback function that is defined to just turn the
|
||||||
* LED off again. Therefore, pressing the user button will turn the LED on, and
|
* LED off again. Therefore, pressing the user button will turn the LED on, and
|
||||||
* the LED will remain on until a full five seconds pass without the button
|
* the LED will remain on until a full five seconds pass without the button
|
||||||
* being pressed.
|
* being pressed.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -196,17 +196,17 @@ void main( void )
|
||||||
{
|
{
|
||||||
/* Start the two tasks as described in the comments at the top of this
|
/* Start the two tasks as described in the comments at the top of this
|
||||||
file. */
|
file. */
|
||||||
xTaskCreate( prvQueueReceiveTask, ( signed char * ) "Rx", configMINIMAL_STACK_SIZE, NULL, mainQUEUE_RECEIVE_TASK_PRIORITY, NULL );
|
xTaskCreate( prvQueueReceiveTask, "Rx", configMINIMAL_STACK_SIZE, NULL, mainQUEUE_RECEIVE_TASK_PRIORITY, NULL );
|
||||||
xTaskCreate( prvQueueSendTask, ( signed char * ) "TX", configMINIMAL_STACK_SIZE, NULL, mainQUEUE_SEND_TASK_PRIORITY, NULL );
|
xTaskCreate( prvQueueSendTask, "TX", configMINIMAL_STACK_SIZE, NULL, mainQUEUE_SEND_TASK_PRIORITY, NULL );
|
||||||
|
|
||||||
/* Create the software timer that is responsible for turning off the LED
|
/* Create the software timer that is responsible for turning off the LED
|
||||||
if the button is not pushed within 5000ms, as described at the top of
|
if the button is not pushed within 5000ms, as described at the top of
|
||||||
this file. */
|
this file. */
|
||||||
xButtonLEDTimer = xTimerCreate( ( const signed char * ) "ButtonLEDTimer", /* A text name, purely to help debugging. */
|
xButtonLEDTimer = xTimerCreate( "ButtonLEDTimer", /* A text name, purely to help debugging. */
|
||||||
mainBUTTON_LED_TIMER_PERIOD_MS, /* The timer period, in this case 5000ms (5s). */
|
mainBUTTON_LED_TIMER_PERIOD_MS, /* The timer period, in this case 5000ms (5s). */
|
||||||
pdFALSE, /* This is a one shot timer, so xAutoReload is set to pdFALSE. */
|
pdFALSE, /* This is a one shot timer, so xAutoReload is set to pdFALSE. */
|
||||||
( void * ) 0, /* The ID is not used, so can be set to anything. */
|
( void * ) 0, /* The ID is not used, so can be set to anything. */
|
||||||
prvButtonLEDTimerCallback /* The callback function that switches the LED off. */
|
prvButtonLEDTimerCallback /* The callback function that switches the LED off. */
|
||||||
);
|
);
|
||||||
|
|
||||||
/* Start the tasks and timer running. */
|
/* Start the tasks and timer running. */
|
||||||
|
@ -308,20 +308,20 @@ static void prvSetupHardware( void )
|
||||||
/* Enable the interrupt on SW1. */
|
/* Enable the interrupt on SW1. */
|
||||||
PORTE_PCR26 = PORT_PCR_MUX( 1 ) | PORT_PCR_IRQC( 0xA ) | PORT_PCR_PE_MASK | PORT_PCR_PS_MASK;
|
PORTE_PCR26 = PORT_PCR_MUX( 1 ) | PORT_PCR_IRQC( 0xA ) | PORT_PCR_PE_MASK | PORT_PCR_PS_MASK;
|
||||||
enable_irq( mainGPIO_E_VECTOR );
|
enable_irq( mainGPIO_E_VECTOR );
|
||||||
|
|
||||||
/* The interrupt calls an interrupt safe API function - so its priority must
|
/* The interrupt calls an interrupt safe API function - so its priority must
|
||||||
be equal to or lower than configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY. */
|
be equal to or lower than configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY. */
|
||||||
set_irq_priority( mainGPIO_E_VECTOR, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY );
|
set_irq_priority( mainGPIO_E_VECTOR, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY );
|
||||||
|
|
||||||
/* Set PTA10, PTA11, PTA28, and PTA29 (connected to LED's) for GPIO
|
/* Set PTA10, PTA11, PTA28, and PTA29 (connected to LED's) for GPIO
|
||||||
functionality. */
|
functionality. */
|
||||||
PORTA_PCR10 = ( 0 | PORT_PCR_MUX( 1 ) );
|
PORTA_PCR10 = ( 0 | PORT_PCR_MUX( 1 ) );
|
||||||
PORTA_PCR11 = ( 0 | PORT_PCR_MUX( 1 ) );
|
PORTA_PCR11 = ( 0 | PORT_PCR_MUX( 1 ) );
|
||||||
PORTA_PCR28 = ( 0 | PORT_PCR_MUX( 1 ) );
|
PORTA_PCR28 = ( 0 | PORT_PCR_MUX( 1 ) );
|
||||||
PORTA_PCR29 = ( 0 | PORT_PCR_MUX( 1 ) );
|
PORTA_PCR29 = ( 0 | PORT_PCR_MUX( 1 ) );
|
||||||
|
|
||||||
/* Change PTA10, PTA29 to outputs. */
|
/* Change PTA10, PTA29 to outputs. */
|
||||||
GPIOA_PDDR=GPIO_PDDR_PDD( mainTASK_CONTROLLED_LED | mainTIMER_CONTROLLED_LED );
|
GPIOA_PDDR=GPIO_PDDR_PDD( mainTASK_CONTROLLED_LED | mainTIMER_CONTROLLED_LED );
|
||||||
|
|
||||||
/* Start with LEDs off. */
|
/* Start with LEDs off. */
|
||||||
GPIOA_PTOR = ~0U;
|
GPIOA_PTOR = ~0U;
|
||||||
|
@ -387,9 +387,9 @@ linker happy. */
|
||||||
void vMainConfigureTimerForRunTimeStats( void ) {}
|
void vMainConfigureTimerForRunTimeStats( void ) {}
|
||||||
unsigned long ulMainGetRunTimeCounterValue( void ) { return 0UL; }
|
unsigned long ulMainGetRunTimeCounterValue( void ) { return 0UL; }
|
||||||
|
|
||||||
/* A tick hook is used by the "Full" build configuration. The Full and blinky
|
/* A tick hook is used by the "Full" build configuration. The Full and blinky
|
||||||
build configurations share a FreeRTOSConfig.h header file, so this simple build
|
build configurations share a FreeRTOSConfig.h header file, so this simple build
|
||||||
configuration also has to define a tick hook - even though it does not actually
|
configuration also has to define a tick hook - even though it does not actually
|
||||||
use it for anything. */
|
use it for anything. */
|
||||||
void vApplicationTickHook( void ) {}
|
void vApplicationTickHook( void ) {}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
All rights reserved
|
All rights reserved
|
||||||
|
|
||||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
@ -166,7 +166,7 @@ unsigned short usPacketLength;
|
||||||
if( ( usPacketLength > 0U ) && ( uip_buf != NULL ) )
|
if( ( usPacketLength > 0U ) && ( uip_buf != NULL ) )
|
||||||
{
|
{
|
||||||
uip_len = usPacketLength;
|
uip_len = usPacketLength;
|
||||||
|
|
||||||
if( xHeader->type == htons( UIP_ETHTYPE_IP ) )
|
if( xHeader->type == htons( UIP_ETHTYPE_IP ) )
|
||||||
{
|
{
|
||||||
uip_arp_ipin();
|
uip_arp_ipin();
|
||||||
|
@ -210,7 +210,7 @@ unsigned short usPacketLength;
|
||||||
for( i = 0; i < UIP_CONNS; i++ )
|
for( i = 0; i < UIP_CONNS; i++ )
|
||||||
{
|
{
|
||||||
uip_periodic( i );
|
uip_periodic( i );
|
||||||
|
|
||||||
/* If the above function invocation resulted in data that
|
/* If the above function invocation resulted in data that
|
||||||
should be sent out on the network, the global variable
|
should be sent out on the network, the global variable
|
||||||
uip_len is set to a value > 0. */
|
uip_len is set to a value > 0. */
|
||||||
|
@ -273,14 +273,14 @@ xTimerHandle xARPTimer, xPeriodicTimer;
|
||||||
xEMACEventQueue = xQueueCreate( uipEVENT_QUEUE_LENGTH, sizeof( unsigned long ) );
|
xEMACEventQueue = xQueueCreate( uipEVENT_QUEUE_LENGTH, sizeof( unsigned long ) );
|
||||||
|
|
||||||
/* Create and start the uIP timers. */
|
/* Create and start the uIP timers. */
|
||||||
xARPTimer = xTimerCreate( ( signed char * ) "ARPTimer", /* Just a name that is helpful for debugging, not used by the kernel. */
|
xARPTimer = xTimerCreate( "ARPTimer", /* Just a name that is helpful for debugging, not used by the kernel. */
|
||||||
( 10000UL / portTICK_RATE_MS ), /* Timer period. */
|
( 10000UL / portTICK_RATE_MS ), /* Timer period. */
|
||||||
pdTRUE, /* Autor-reload. */
|
pdTRUE, /* Autor-reload. */
|
||||||
( void * ) uipARP_TIMER,
|
( void * ) uipARP_TIMER,
|
||||||
prvUIPTimerCallback
|
prvUIPTimerCallback
|
||||||
);
|
);
|
||||||
|
|
||||||
xPeriodicTimer = xTimerCreate( ( signed char * ) "PeriodicTimer",
|
xPeriodicTimer = xTimerCreate( "PeriodicTimer",
|
||||||
( 500UL / portTICK_RATE_MS ),
|
( 500UL / portTICK_RATE_MS ),
|
||||||
pdTRUE, /* Autor-reload. */
|
pdTRUE, /* Autor-reload. */
|
||||||
( void * ) uipPERIODIC_TIMER,
|
( void * ) uipPERIODIC_TIMER,
|
||||||
|
@ -328,7 +328,7 @@ const unsigned long ulYellowLED = 2UL;
|
||||||
|
|
||||||
/* Only interested in processing form input if this is the IO page. */
|
/* Only interested in processing form input if this is the IO page. */
|
||||||
c = strstr( pcInputString, "io.shtml" );
|
c = strstr( pcInputString, "io.shtml" );
|
||||||
|
|
||||||
if( c )
|
if( c )
|
||||||
{
|
{
|
||||||
/* Is there a command in the string? */
|
/* Is there a command in the string? */
|
||||||
|
|
|
@ -104,7 +104,7 @@ static PT_THREAD( file_stats ( struct httpd_state *s, char *ptr ) )
|
||||||
PSOCK_BEGIN( &s->sout );
|
PSOCK_BEGIN( &s->sout );
|
||||||
|
|
||||||
( void ) PT_YIELD_FLAG;
|
( void ) PT_YIELD_FLAG;
|
||||||
|
|
||||||
PSOCK_GENERATOR_SEND( &s->sout, generate_file_stats, strchr(ptr, ' ') + 1 );
|
PSOCK_GENERATOR_SEND( &s->sout, generate_file_stats, strchr(ptr, ' ') + 1 );
|
||||||
|
|
||||||
PSOCK_END( &s->sout );
|
PSOCK_END( &s->sout );
|
||||||
|
@ -177,7 +177,7 @@ static PT_THREAD( net_stats ( struct httpd_state *s, char *ptr ) )
|
||||||
}
|
}
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
extern void vTaskList( signed char *pcWriteBuffer );
|
extern void vTaskList( char *pcWriteBuffer );
|
||||||
extern char *pcGetTaskStatusMessage( void );
|
extern char *pcGetTaskStatusMessage( void );
|
||||||
static char cCountBuf[128];
|
static char cCountBuf[128];
|
||||||
long lRefreshCount = 0;
|
long lRefreshCount = 0;
|
||||||
|
@ -186,7 +186,7 @@ static unsigned short generate_rtos_stats( void *arg )
|
||||||
( void ) arg;
|
( void ) arg;
|
||||||
lRefreshCount++;
|
lRefreshCount++;
|
||||||
sprintf( cCountBuf, "<p><br>Refresh count = %d<p><br>%s", ( int ) lRefreshCount, pcGetTaskStatusMessage() );
|
sprintf( cCountBuf, "<p><br>Refresh count = %d<p><br>%s", ( int ) lRefreshCount, pcGetTaskStatusMessage() );
|
||||||
vTaskList( uip_appdata );
|
vTaskList( ( char * ) uip_appdata );
|
||||||
strcat( uip_appdata, cCountBuf );
|
strcat( uip_appdata, cCountBuf );
|
||||||
|
|
||||||
return strlen( uip_appdata );
|
return strlen( uip_appdata );
|
||||||
|
@ -228,13 +228,13 @@ static unsigned short generate_io_state( void *arg )
|
||||||
}
|
}
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
extern void vTaskGetRunTimeStats( signed char *pcWriteBuffer );
|
extern void vTaskGetRunTimeStats( char *pcWriteBuffer );
|
||||||
static unsigned short generate_runtime_stats( void *arg )
|
static unsigned short generate_runtime_stats( void *arg )
|
||||||
{
|
{
|
||||||
( void ) arg;
|
( void ) arg;
|
||||||
lRefreshCount++;
|
lRefreshCount++;
|
||||||
sprintf( cCountBuf, "<p><br>Refresh count = %d", ( int ) lRefreshCount );
|
sprintf( cCountBuf, "<p><br>Refresh count = %d", ( int ) lRefreshCount );
|
||||||
vTaskGetRunTimeStats( uip_appdata );
|
vTaskGetRunTimeStats( ( char * ) uip_appdata );
|
||||||
strcat( uip_appdata, cCountBuf );
|
strcat( uip_appdata, cCountBuf );
|
||||||
|
|
||||||
return strlen( uip_appdata );
|
return strlen( uip_appdata );
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
All rights reserved
|
All rights reserved
|
||||||
|
|
||||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
@ -246,7 +246,7 @@ int main( void )
|
||||||
PHY. */
|
PHY. */
|
||||||
if( SysCtlPeripheralPresent( SYSCTL_PERIPH_ETH ) )
|
if( SysCtlPeripheralPresent( SYSCTL_PERIPH_ETH ) )
|
||||||
{
|
{
|
||||||
xTaskCreate( vuIP_Task, ( signed portCHAR * ) "uIP", mainBASIC_WEB_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY - 1, NULL );
|
xTaskCreate( vuIP_Task, "uIP", mainBASIC_WEB_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY - 1, NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Start the standard demo tasks. */
|
/* Start the standard demo tasks. */
|
||||||
|
@ -261,7 +261,7 @@ int main( void )
|
||||||
vStartInterruptQueueTasks();
|
vStartInterruptQueueTasks();
|
||||||
|
|
||||||
/* Start the tasks defined within this file/specific to this demo. */
|
/* Start the tasks defined within this file/specific to this demo. */
|
||||||
xTaskCreate( vOLEDTask, ( signed portCHAR * ) "OLED", mainOLED_TASK_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );
|
xTaskCreate( vOLEDTask, "OLED", mainOLED_TASK_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );
|
||||||
|
|
||||||
/* The suicide tasks must be created last as they need to know how many
|
/* The suicide tasks must be created last as they need to know how many
|
||||||
tasks were running prior to their creation in order to ascertain whether
|
tasks were running prior to their creation in order to ascertain whether
|
||||||
|
@ -363,7 +363,7 @@ portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
|
||||||
{
|
{
|
||||||
xMessage.pcMessage = "ERROR IN INT QUEUE";
|
xMessage.pcMessage = "ERROR IN INT QUEUE";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Send the message to the OLED gatekeeper for display. */
|
/* Send the message to the OLED gatekeeper for display. */
|
||||||
xHigherPriorityTaskWoken = pdFALSE;
|
xHigherPriorityTaskWoken = pdFALSE;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
All rights reserved
|
All rights reserved
|
||||||
|
|
||||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
@ -140,14 +140,14 @@ portBASE_TYPE xReturn;
|
||||||
{
|
{
|
||||||
ulRxLength[ ulTemp ] = 0;
|
ulRxLength[ ulTemp ] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create the queue and task used to defer the MAC processing to the
|
/* Create the queue and task used to defer the MAC processing to the
|
||||||
task level. */
|
task level. */
|
||||||
vSemaphoreCreateBinary( xMACInterruptSemaphore );
|
vSemaphoreCreateBinary( xMACInterruptSemaphore );
|
||||||
xSemaphoreTake( xMACInterruptSemaphore, 0 );
|
xSemaphoreTake( xMACInterruptSemaphore, 0 );
|
||||||
xReturn = xTaskCreate( vMACHandleTask, ( signed portCHAR * ) "MAC", configMINIMAL_STACK_SIZE, NULL, configMAX_PRIORITIES - 1, NULL );
|
xReturn = xTaskCreate( vMACHandleTask, "MAC", configMINIMAL_STACK_SIZE, NULL, configMAX_PRIORITIES - 1, NULL );
|
||||||
vTaskDelay( macNEGOTIATE_DELAY );
|
vTaskDelay( macNEGOTIATE_DELAY );
|
||||||
|
|
||||||
/* We are only interested in Rx interrupts. */
|
/* We are only interested in Rx interrupts. */
|
||||||
IntPrioritySet( INT_ETH, configKERNEL_INTERRUPT_PRIORITY );
|
IntPrioritySet( INT_ETH, configKERNEL_INTERRUPT_PRIORITY );
|
||||||
IntEnable( INT_ETH );
|
IntEnable( INT_ETH );
|
||||||
|
@ -168,9 +168,9 @@ unsigned int iLen;
|
||||||
{
|
{
|
||||||
/* Leave room for the size at the start of the buffer. */
|
/* Leave room for the size at the start of the buffer. */
|
||||||
uip_buf = &( ucRxBuffers[ ulNextRxBuffer ][ 2 ] );
|
uip_buf = &( ucRxBuffers[ ulNextRxBuffer ][ 2 ] );
|
||||||
|
|
||||||
ulRxLength[ ulNextRxBuffer ] = 0;
|
ulRxLength[ ulNextRxBuffer ] = 0;
|
||||||
|
|
||||||
ulNextRxBuffer++;
|
ulNextRxBuffer++;
|
||||||
if( ulNextRxBuffer >= emacNUM_RX_BUFFERS )
|
if( ulNextRxBuffer >= emacNUM_RX_BUFFERS )
|
||||||
{
|
{
|
||||||
|
@ -214,9 +214,9 @@ unsigned portLONG ulNextWord;
|
||||||
{
|
{
|
||||||
vTaskDelay( macWAIT_SEND_TIME );
|
vTaskDelay( macWAIT_SEND_TIME );
|
||||||
}
|
}
|
||||||
|
|
||||||
pulSource = ( unsigned portLONG * ) pus;
|
pulSource = ( unsigned portLONG * ) pus;
|
||||||
|
|
||||||
for( ulNextWord = 0; ulNextWord < ulNextTxSpace; ulNextWord += sizeof( unsigned portLONG ) )
|
for( ulNextWord = 0; ulNextWord < ulNextTxSpace; ulNextWord += sizeof( unsigned portLONG ) )
|
||||||
{
|
{
|
||||||
HWREG(ETH_BASE + MAC_O_DATA) = *pulSource;
|
HWREG(ETH_BASE + MAC_O_DATA) = *pulSource;
|
||||||
|
@ -236,14 +236,14 @@ unsigned portLONG ulTemp;
|
||||||
/* Clear the interrupt. */
|
/* Clear the interrupt. */
|
||||||
ulTemp = EthernetIntStatus( ETH_BASE, pdFALSE );
|
ulTemp = EthernetIntStatus( ETH_BASE, pdFALSE );
|
||||||
EthernetIntClear( ETH_BASE, ulTemp );
|
EthernetIntClear( ETH_BASE, ulTemp );
|
||||||
|
|
||||||
/* Was it an Rx interrupt? */
|
/* Was it an Rx interrupt? */
|
||||||
if( ulTemp & ETH_INT_RX )
|
if( ulTemp & ETH_INT_RX )
|
||||||
{
|
{
|
||||||
xSemaphoreGiveFromISR( xMACInterruptSemaphore, &xHigherPriorityTaskWoken );
|
xSemaphoreGiveFromISR( xMACInterruptSemaphore, &xHigherPriorityTaskWoken );
|
||||||
EthernetIntDisable( ETH_BASE, ETH_INT_RX );
|
EthernetIntDisable( ETH_BASE, ETH_INT_RX );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Switch to the uIP task. */
|
/* Switch to the uIP task. */
|
||||||
portEND_SWITCHING_ISR( xHigherPriorityTaskWoken );
|
portEND_SWITCHING_ISR( xHigherPriorityTaskWoken );
|
||||||
}
|
}
|
||||||
|
@ -261,23 +261,23 @@ portBASE_TYPE xSwitchRequired = pdFALSE;
|
||||||
{
|
{
|
||||||
/* Wait for something to do. */
|
/* Wait for something to do. */
|
||||||
xSemaphoreTake( xMACInterruptSemaphore, portMAX_DELAY );
|
xSemaphoreTake( xMACInterruptSemaphore, portMAX_DELAY );
|
||||||
|
|
||||||
while( ( ulInt = ( EthernetIntStatus( ETH_BASE, pdFALSE ) & ETH_INT_RX ) ) != 0 )
|
while( ( ulInt = ( EthernetIntStatus( ETH_BASE, pdFALSE ) & ETH_INT_RX ) ) != 0 )
|
||||||
{
|
{
|
||||||
ulLength = HWREG( ETH_BASE + MAC_O_DATA );
|
ulLength = HWREG( ETH_BASE + MAC_O_DATA );
|
||||||
|
|
||||||
/* Leave room at the start of the buffer for the size. */
|
/* Leave room at the start of the buffer for the size. */
|
||||||
pulBuffer = ( unsigned long * ) &( ucRxBuffers[ ulNextRxBuffer ][ 2 ] );
|
pulBuffer = ( unsigned long * ) &( ucRxBuffers[ ulNextRxBuffer ][ 2 ] );
|
||||||
*pulBuffer = ( ulLength >> 16 );
|
*pulBuffer = ( ulLength >> 16 );
|
||||||
|
|
||||||
/* Get the size of the data. */
|
/* Get the size of the data. */
|
||||||
pulBuffer = ( unsigned long * ) &( ucRxBuffers[ ulNextRxBuffer ][ 4 ] );
|
pulBuffer = ( unsigned long * ) &( ucRxBuffers[ ulNextRxBuffer ][ 4 ] );
|
||||||
ulLength &= 0xFFFF;
|
ulLength &= 0xFFFF;
|
||||||
|
|
||||||
if( ulLength > 4 )
|
if( ulLength > 4 )
|
||||||
{
|
{
|
||||||
ulLength -= 4;
|
ulLength -= 4;
|
||||||
|
|
||||||
if( ulLength >= UIP_BUFSIZE )
|
if( ulLength >= UIP_BUFSIZE )
|
||||||
{
|
{
|
||||||
/* The data won't fit in our buffer. Ensure we don't
|
/* The data won't fit in our buffer. Ensure we don't
|
||||||
|
@ -291,22 +291,22 @@ portBASE_TYPE xSwitchRequired = pdFALSE;
|
||||||
*pulBuffer = HWREG( ETH_BASE + MAC_O_DATA );
|
*pulBuffer = HWREG( ETH_BASE + MAC_O_DATA );
|
||||||
pulBuffer++;
|
pulBuffer++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Store the length of the data into the separate array. */
|
/* Store the length of the data into the separate array. */
|
||||||
ulRxLength[ ulNextRxBuffer ] = ulLength;
|
ulRxLength[ ulNextRxBuffer ] = ulLength;
|
||||||
|
|
||||||
/* Use the next buffer the next time through. */
|
/* Use the next buffer the next time through. */
|
||||||
ulNextRxBuffer++;
|
ulNextRxBuffer++;
|
||||||
if( ulNextRxBuffer >= emacNUM_RX_BUFFERS )
|
if( ulNextRxBuffer >= emacNUM_RX_BUFFERS )
|
||||||
{
|
{
|
||||||
ulNextRxBuffer = 0;
|
ulNextRxBuffer = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Ensure the uIP task is not blocked as data has arrived. */
|
/* Ensure the uIP task is not blocked as data has arrived. */
|
||||||
xSemaphoreGive( xEMACSemaphore );
|
xSemaphoreGive( xEMACSemaphore );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EthernetIntEnable( ETH_BASE, ETH_INT_RX );
|
EthernetIntEnable( ETH_BASE, ETH_INT_RX );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -205,7 +205,7 @@ PT_THREAD(net_stats(struct httpd_state *s, char *ptr))
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
extern void vTaskList( signed char *pcWriteBuffer );
|
extern void vTaskList( char *pcWriteBuffer );
|
||||||
static char cCountBuf[ 32 ];
|
static char cCountBuf[ 32 ];
|
||||||
long lRefreshCount = 0;
|
long lRefreshCount = 0;
|
||||||
static unsigned short
|
static unsigned short
|
||||||
|
@ -213,7 +213,7 @@ generate_rtos_stats(void *arg)
|
||||||
{
|
{
|
||||||
lRefreshCount++;
|
lRefreshCount++;
|
||||||
sprintf( cCountBuf, "<p><br>Refresh count = %d", lRefreshCount );
|
sprintf( cCountBuf, "<p><br>Refresh count = %d", lRefreshCount );
|
||||||
vTaskList( uip_appdata );
|
vTaskList( ( char * ) uip_appdata );
|
||||||
strcat( uip_appdata, cCountBuf );
|
strcat( uip_appdata, cCountBuf );
|
||||||
|
|
||||||
return strlen( uip_appdata );
|
return strlen( uip_appdata );
|
||||||
|
@ -254,13 +254,13 @@ static unsigned short generate_io_state( void *arg )
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
extern void vTaskGetRunTimeStats( signed char *pcWriteBuffer );
|
extern void vTaskGetRunTimeStats( char *pcWriteBuffer );
|
||||||
static unsigned short
|
static unsigned short
|
||||||
generate_runtime_stats(void *arg)
|
generate_runtime_stats(void *arg)
|
||||||
{
|
{
|
||||||
lRefreshCount++;
|
lRefreshCount++;
|
||||||
sprintf( cCountBuf, "<p><br>Refresh count = %d", lRefreshCount );
|
sprintf( cCountBuf, "<p><br>Refresh count = %d", lRefreshCount );
|
||||||
vTaskGetRunTimeStats( uip_appdata );
|
vTaskGetRunTimeStats( ( char * ) uip_appdata );
|
||||||
strcat( uip_appdata, cCountBuf );
|
strcat( uip_appdata, cCountBuf );
|
||||||
|
|
||||||
return strlen( uip_appdata );
|
return strlen( uip_appdata );
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
All rights reserved
|
All rights reserved
|
||||||
|
|
||||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
@ -269,7 +269,7 @@ int main( void )
|
||||||
PHY. */
|
PHY. */
|
||||||
if( SysCtlPeripheralPresent( SYSCTL_PERIPH_ETH ) )
|
if( SysCtlPeripheralPresent( SYSCTL_PERIPH_ETH ) )
|
||||||
{
|
{
|
||||||
xTaskCreate( vuIP_Task, ( signed portCHAR * ) "uIP", mainBASIC_WEB_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY - 1, NULL );
|
xTaskCreate( vuIP_Task, "uIP", mainBASIC_WEB_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY - 1, NULL );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -277,7 +277,7 @@ int main( void )
|
||||||
|
|
||||||
|
|
||||||
/* Start the tasks defined within this file/specific to this demo. */
|
/* Start the tasks defined within this file/specific to this demo. */
|
||||||
xTaskCreate( vOLEDTask, ( signed portCHAR * ) "OLED", mainOLED_TASK_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );
|
xTaskCreate( vOLEDTask, "OLED", mainOLED_TASK_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );
|
||||||
|
|
||||||
/* The suicide tasks must be created last as they need to know how many
|
/* The suicide tasks must be created last as they need to know how many
|
||||||
tasks were running prior to their creation in order to ascertain whether
|
tasks were running prior to their creation in order to ascertain whether
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
All rights reserved
|
All rights reserved
|
||||||
|
|
||||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
@ -144,14 +144,14 @@ portBASE_TYPE xReturn;
|
||||||
{
|
{
|
||||||
ulRxLength[ ulTemp ] = 0;
|
ulRxLength[ ulTemp ] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create the queue and task used to defer the MAC processing to the
|
/* Create the queue and task used to defer the MAC processing to the
|
||||||
task level. */
|
task level. */
|
||||||
vSemaphoreCreateBinary( xMACInterruptSemaphore );
|
vSemaphoreCreateBinary( xMACInterruptSemaphore );
|
||||||
xSemaphoreTake( xMACInterruptSemaphore, 0 );
|
xSemaphoreTake( xMACInterruptSemaphore, 0 );
|
||||||
xReturn = xTaskCreate( vMACHandleTask, ( signed portCHAR * ) "MAC", configMINIMAL_STACK_SIZE, NULL, configMAX_PRIORITIES - 1, NULL );
|
xReturn = xTaskCreate( vMACHandleTask, "MAC", configMINIMAL_STACK_SIZE, NULL, configMAX_PRIORITIES - 1, NULL );
|
||||||
vTaskDelay( macNEGOTIATE_DELAY );
|
vTaskDelay( macNEGOTIATE_DELAY );
|
||||||
|
|
||||||
/* We are only interested in Rx interrupts. */
|
/* We are only interested in Rx interrupts. */
|
||||||
IntPrioritySet( INT_ETH, configKERNEL_INTERRUPT_PRIORITY );
|
IntPrioritySet( INT_ETH, configKERNEL_INTERRUPT_PRIORITY );
|
||||||
IntEnable( INT_ETH );
|
IntEnable( INT_ETH );
|
||||||
|
@ -172,9 +172,9 @@ unsigned int iLen;
|
||||||
{
|
{
|
||||||
/* Leave room for the size at the start of the buffer. */
|
/* Leave room for the size at the start of the buffer. */
|
||||||
uip_buf = &( uxRxBuffers.ucRxBuffers[ ulNextRxBuffer ][ 2 ] );
|
uip_buf = &( uxRxBuffers.ucRxBuffers[ ulNextRxBuffer ][ 2 ] );
|
||||||
|
|
||||||
ulRxLength[ ulNextRxBuffer ] = 0;
|
ulRxLength[ ulNextRxBuffer ] = 0;
|
||||||
|
|
||||||
ulNextRxBuffer++;
|
ulNextRxBuffer++;
|
||||||
if( ulNextRxBuffer >= emacNUM_RX_BUFFERS )
|
if( ulNextRxBuffer >= emacNUM_RX_BUFFERS )
|
||||||
{
|
{
|
||||||
|
@ -218,9 +218,9 @@ unsigned portLONG ulNextWord;
|
||||||
{
|
{
|
||||||
vTaskDelay( macWAIT_SEND_TIME );
|
vTaskDelay( macWAIT_SEND_TIME );
|
||||||
}
|
}
|
||||||
|
|
||||||
pulSource = ( unsigned portLONG * ) pus;
|
pulSource = ( unsigned portLONG * ) pus;
|
||||||
|
|
||||||
for( ulNextWord = 0; ulNextWord < ulNextTxSpace; ulNextWord += sizeof( unsigned portLONG ) )
|
for( ulNextWord = 0; ulNextWord < ulNextTxSpace; ulNextWord += sizeof( unsigned portLONG ) )
|
||||||
{
|
{
|
||||||
HWREG(ETH_BASE + MAC_O_DATA) = *pulSource;
|
HWREG(ETH_BASE + MAC_O_DATA) = *pulSource;
|
||||||
|
@ -240,14 +240,14 @@ unsigned portLONG ulTemp;
|
||||||
/* Clear the interrupt. */
|
/* Clear the interrupt. */
|
||||||
ulTemp = EthernetIntStatus( ETH_BASE, pdFALSE );
|
ulTemp = EthernetIntStatus( ETH_BASE, pdFALSE );
|
||||||
EthernetIntClear( ETH_BASE, ulTemp );
|
EthernetIntClear( ETH_BASE, ulTemp );
|
||||||
|
|
||||||
/* Was it an Rx interrupt? */
|
/* Was it an Rx interrupt? */
|
||||||
if( ulTemp & ETH_INT_RX )
|
if( ulTemp & ETH_INT_RX )
|
||||||
{
|
{
|
||||||
xSemaphoreGiveFromISR( xMACInterruptSemaphore, &xHigherPriorityTaskWoken );
|
xSemaphoreGiveFromISR( xMACInterruptSemaphore, &xHigherPriorityTaskWoken );
|
||||||
EthernetIntDisable( ETH_BASE, ETH_INT_RX );
|
EthernetIntDisable( ETH_BASE, ETH_INT_RX );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Switch to the uIP task. */
|
/* Switch to the uIP task. */
|
||||||
portEND_SWITCHING_ISR( xHigherPriorityTaskWoken );
|
portEND_SWITCHING_ISR( xHigherPriorityTaskWoken );
|
||||||
}
|
}
|
||||||
|
@ -264,23 +264,23 @@ static unsigned portLONG ulNextRxBuffer = 0;
|
||||||
{
|
{
|
||||||
/* Wait for something to do. */
|
/* Wait for something to do. */
|
||||||
xSemaphoreTake( xMACInterruptSemaphore, portMAX_DELAY );
|
xSemaphoreTake( xMACInterruptSemaphore, portMAX_DELAY );
|
||||||
|
|
||||||
while( ( ulInt = ( EthernetIntStatus( ETH_BASE, pdFALSE ) & ETH_INT_RX ) ) != 0 )
|
while( ( ulInt = ( EthernetIntStatus( ETH_BASE, pdFALSE ) & ETH_INT_RX ) ) != 0 )
|
||||||
{
|
{
|
||||||
ulLength = HWREG( ETH_BASE + MAC_O_DATA );
|
ulLength = HWREG( ETH_BASE + MAC_O_DATA );
|
||||||
|
|
||||||
/* Leave room at the start of the buffer for the size. */
|
/* Leave room at the start of the buffer for the size. */
|
||||||
pulBuffer = ( unsigned long * ) &( uxRxBuffers.ucRxBuffers[ ulNextRxBuffer ][ 2 ] );
|
pulBuffer = ( unsigned long * ) &( uxRxBuffers.ucRxBuffers[ ulNextRxBuffer ][ 2 ] );
|
||||||
*pulBuffer = ( ulLength >> 16 );
|
*pulBuffer = ( ulLength >> 16 );
|
||||||
|
|
||||||
/* Get the size of the data. */
|
/* Get the size of the data. */
|
||||||
pulBuffer = ( unsigned long * ) &( uxRxBuffers.ucRxBuffers[ ulNextRxBuffer ][ 4 ] );
|
pulBuffer = ( unsigned long * ) &( uxRxBuffers.ucRxBuffers[ ulNextRxBuffer ][ 4 ] );
|
||||||
ulLength &= 0xFFFF;
|
ulLength &= 0xFFFF;
|
||||||
|
|
||||||
if( ulLength > 4 )
|
if( ulLength > 4 )
|
||||||
{
|
{
|
||||||
ulLength -= 4;
|
ulLength -= 4;
|
||||||
|
|
||||||
if( ulLength >= UIP_BUFSIZE )
|
if( ulLength >= UIP_BUFSIZE )
|
||||||
{
|
{
|
||||||
/* The data won't fit in our buffer. Ensure we don't
|
/* The data won't fit in our buffer. Ensure we don't
|
||||||
|
@ -294,24 +294,24 @@ static unsigned portLONG ulNextRxBuffer = 0;
|
||||||
*pulBuffer = HWREG( ETH_BASE + MAC_O_DATA );
|
*pulBuffer = HWREG( ETH_BASE + MAC_O_DATA );
|
||||||
pulBuffer++;
|
pulBuffer++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Store the length of the data into the separate array. */
|
/* Store the length of the data into the separate array. */
|
||||||
ulRxLength[ ulNextRxBuffer ] = ulLength;
|
ulRxLength[ ulNextRxBuffer ] = ulLength;
|
||||||
|
|
||||||
/* Use the next buffer the next time through. */
|
/* Use the next buffer the next time through. */
|
||||||
ulNextRxBuffer++;
|
ulNextRxBuffer++;
|
||||||
if( ulNextRxBuffer >= emacNUM_RX_BUFFERS )
|
if( ulNextRxBuffer >= emacNUM_RX_BUFFERS )
|
||||||
{
|
{
|
||||||
ulNextRxBuffer = 0;
|
ulNextRxBuffer = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Ensure the uIP task is not blocked as data has arrived. */
|
/* Ensure the uIP task is not blocked as data has arrived. */
|
||||||
xSemaphoreGive( xEMACSemaphore );
|
xSemaphoreGive( xEMACSemaphore );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EthernetIntEnable( ETH_BASE, ETH_INT_RX );
|
EthernetIntEnable( ETH_BASE, ETH_INT_RX );
|
||||||
|
|
||||||
( void ) ulInt;
|
( void ) ulInt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -204,7 +204,7 @@ PT_THREAD(net_stats(struct httpd_state *s, char *ptr))
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
extern void vTaskList( signed char *pcWriteBuffer );
|
extern void vTaskList( char *pcWriteBuffer );
|
||||||
static char cCountBuf[ 32 ];
|
static char cCountBuf[ 32 ];
|
||||||
long lRefreshCount = 0;
|
long lRefreshCount = 0;
|
||||||
static unsigned short
|
static unsigned short
|
||||||
|
@ -212,7 +212,7 @@ generate_rtos_stats(void *arg)
|
||||||
{
|
{
|
||||||
lRefreshCount++;
|
lRefreshCount++;
|
||||||
sprintf( cCountBuf, "<p><br>Refresh count = %d", lRefreshCount );
|
sprintf( cCountBuf, "<p><br>Refresh count = %d", lRefreshCount );
|
||||||
vTaskList( uip_appdata );
|
vTaskList( ( char * ) uip_appdata );
|
||||||
strcat( uip_appdata, cCountBuf );
|
strcat( uip_appdata, cCountBuf );
|
||||||
|
|
||||||
return strlen( uip_appdata );
|
return strlen( uip_appdata );
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
All rights reserved
|
All rights reserved
|
||||||
|
|
||||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
@ -247,7 +247,7 @@ int main( void )
|
||||||
PHY. */
|
PHY. */
|
||||||
if( SysCtlPeripheralPresent( SYSCTL_PERIPH_ETH ) )
|
if( SysCtlPeripheralPresent( SYSCTL_PERIPH_ETH ) )
|
||||||
{
|
{
|
||||||
xTaskCreate( vuIP_Task, ( signed char * ) "uIP", mainBASIC_WEB_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY - 1, NULL );
|
xTaskCreate( vuIP_Task, "uIP", mainBASIC_WEB_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY - 1, NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Start the standard demo tasks. */
|
/* Start the standard demo tasks. */
|
||||||
|
@ -263,7 +263,7 @@ int main( void )
|
||||||
vStartQueueSetTasks();
|
vStartQueueSetTasks();
|
||||||
|
|
||||||
/* Start the tasks defined within this file/specific to this demo. */
|
/* Start the tasks defined within this file/specific to this demo. */
|
||||||
xTaskCreate( vOLEDTask, ( signed char * ) "OLED", mainOLED_TASK_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );
|
xTaskCreate( vOLEDTask, "OLED", mainOLED_TASK_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );
|
||||||
|
|
||||||
/* The suicide tasks must be created last as they need to know how many
|
/* The suicide tasks must be created last as they need to know how many
|
||||||
tasks were running prior to their creation in order to ascertain whether
|
tasks were running prior to their creation in order to ascertain whether
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
All rights reserved
|
All rights reserved
|
||||||
|
|
||||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
@ -145,7 +145,7 @@ portBASE_TYPE xReturn;
|
||||||
task level. */
|
task level. */
|
||||||
vSemaphoreCreateBinary( xMACInterruptSemaphore );
|
vSemaphoreCreateBinary( xMACInterruptSemaphore );
|
||||||
xSemaphoreTake( xMACInterruptSemaphore, 0 );
|
xSemaphoreTake( xMACInterruptSemaphore, 0 );
|
||||||
xReturn = xTaskCreate( vMACHandleTask, ( signed char * ) "MAC", configMINIMAL_STACK_SIZE, NULL, configMAX_PRIORITIES - 1, NULL );
|
xReturn = xTaskCreate( vMACHandleTask, "MAC", configMINIMAL_STACK_SIZE, NULL, configMAX_PRIORITIES - 1, NULL );
|
||||||
vTaskDelay( macNEGOTIATE_DELAY );
|
vTaskDelay( macNEGOTIATE_DELAY );
|
||||||
|
|
||||||
/* We are only interested in Rx interrupts. */
|
/* We are only interested in Rx interrupts. */
|
||||||
|
|
|
@ -205,7 +205,7 @@ PT_THREAD(net_stats(struct httpd_state *s, char *ptr))
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
extern void vTaskList( signed char *pcWriteBuffer );
|
extern void vTaskList( char *pcWriteBuffer );
|
||||||
static char cCountBuf[ 32 ];
|
static char cCountBuf[ 32 ];
|
||||||
long lRefreshCount = 0;
|
long lRefreshCount = 0;
|
||||||
static unsigned short
|
static unsigned short
|
||||||
|
@ -213,7 +213,7 @@ generate_rtos_stats(void *arg)
|
||||||
{
|
{
|
||||||
lRefreshCount++;
|
lRefreshCount++;
|
||||||
sprintf( cCountBuf, "<p><br>Refresh count = %d", lRefreshCount );
|
sprintf( cCountBuf, "<p><br>Refresh count = %d", lRefreshCount );
|
||||||
vTaskList( uip_appdata );
|
vTaskList( ( char * ) uip_appdata );
|
||||||
strcat( uip_appdata, cCountBuf );
|
strcat( uip_appdata, cCountBuf );
|
||||||
|
|
||||||
return strlen( uip_appdata );
|
return strlen( uip_appdata );
|
||||||
|
@ -254,13 +254,13 @@ static unsigned short generate_io_state( void *arg )
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
extern void vTaskGetRunTimeStats( signed char *pcWriteBuffer );
|
extern void vTaskGetRunTimeStats( char *pcWriteBuffer );
|
||||||
static unsigned short
|
static unsigned short
|
||||||
generate_runtime_stats(void *arg)
|
generate_runtime_stats(void *arg)
|
||||||
{
|
{
|
||||||
lRefreshCount++;
|
lRefreshCount++;
|
||||||
sprintf( cCountBuf, "<p><br>Refresh count = %d", lRefreshCount );
|
sprintf( cCountBuf, "<p><br>Refresh count = %d", lRefreshCount );
|
||||||
vTaskGetRunTimeStats( uip_appdata );
|
vTaskGetRunTimeStats( ( char * ) uip_appdata );
|
||||||
strcat( uip_appdata, cCountBuf );
|
strcat( uip_appdata, cCountBuf );
|
||||||
|
|
||||||
return strlen( uip_appdata );
|
return strlen( uip_appdata );
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
All rights reserved
|
All rights reserved
|
||||||
|
|
||||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
@ -80,7 +80,7 @@
|
||||||
*
|
*
|
||||||
* "uIP" task - This is the task that handles the uIP stack. All TCP/IP
|
* "uIP" task - This is the task that handles the uIP stack. All TCP/IP
|
||||||
* processing is performed in this task.
|
* processing is performed in this task.
|
||||||
*
|
*
|
||||||
* "USB" task - Enumerates the USB device as a CDC class, then echoes back all
|
* "USB" task - Enumerates the USB device as a CDC class, then echoes back all
|
||||||
* received characters with a configurable offset (for example, if the offset
|
* received characters with a configurable offset (for example, if the offset
|
||||||
* is 1 and 'A' is received then 'B' will be sent back). A dumb terminal such
|
* is 1 and 'A' is received then 'B' will be sent back). A dumb terminal such
|
||||||
|
@ -187,15 +187,15 @@ char cIPAddress[ 16 ]; /* Enough space for "xxx.xxx.xxx.xxx\0". */
|
||||||
vStartLEDFlashTasks( mainFLASH_TASK_PRIORITY );
|
vStartLEDFlashTasks( mainFLASH_TASK_PRIORITY );
|
||||||
|
|
||||||
/* Create the USB task. */
|
/* Create the USB task. */
|
||||||
xTaskCreate( vUSBTask, ( signed char * ) "USB", configMINIMAL_STACK_SIZE, ( void * ) NULL, tskIDLE_PRIORITY, NULL );
|
xTaskCreate( vUSBTask, "USB", configMINIMAL_STACK_SIZE, ( void * ) NULL, tskIDLE_PRIORITY, NULL );
|
||||||
|
|
||||||
/* Display the IP address, then create the uIP task. The WEB server runs
|
/* Display the IP address, then create the uIP task. The WEB server runs
|
||||||
in this task. */
|
in this task. */
|
||||||
LCDdriver_initialisation();
|
LCDdriver_initialisation();
|
||||||
LCD_PrintString( 5, 10, "FreeRTOS.org", 14, COLOR_GREEN);
|
LCD_PrintString( 5, 10, "FreeRTOS.org", 14, COLOR_GREEN);
|
||||||
sprintf( cIPAddress, "%d.%d.%d.%d", configIP_ADDR0, configIP_ADDR1, configIP_ADDR2, configIP_ADDR3 );
|
sprintf( cIPAddress, "%d.%d.%d.%d", configIP_ADDR0, configIP_ADDR1, configIP_ADDR2, configIP_ADDR3 );
|
||||||
LCD_PrintString( 5, 30, cIPAddress, 14, COLOR_RED);
|
LCD_PrintString( 5, 30, cIPAddress, 14, COLOR_RED);
|
||||||
xTaskCreate( vuIP_Task, ( signed char * ) "uIP", mainBASIC_WEB_STACK_SIZE, ( void * ) NULL, mainUIP_TASK_PRIORITY, NULL );
|
xTaskCreate( vuIP_Task, "uIP", mainBASIC_WEB_STACK_SIZE, ( void * ) NULL, mainUIP_TASK_PRIORITY, NULL );
|
||||||
|
|
||||||
/* Start the scheduler. */
|
/* Start the scheduler. */
|
||||||
vTaskStartScheduler();
|
vTaskStartScheduler();
|
||||||
|
@ -284,48 +284,48 @@ void prvSetupHardware( void )
|
||||||
LPC_SC->PLL0FEED = PLLFEED_FEED1;
|
LPC_SC->PLL0FEED = PLLFEED_FEED1;
|
||||||
LPC_SC->PLL0FEED = PLLFEED_FEED2;
|
LPC_SC->PLL0FEED = PLLFEED_FEED2;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Disable PLL, disconnected. */
|
/* Disable PLL, disconnected. */
|
||||||
LPC_SC->PLL0CON = 0;
|
LPC_SC->PLL0CON = 0;
|
||||||
LPC_SC->PLL0FEED = PLLFEED_FEED1;
|
LPC_SC->PLL0FEED = PLLFEED_FEED1;
|
||||||
LPC_SC->PLL0FEED = PLLFEED_FEED2;
|
LPC_SC->PLL0FEED = PLLFEED_FEED2;
|
||||||
|
|
||||||
/* Enable main OSC. */
|
/* Enable main OSC. */
|
||||||
LPC_SC->SCS |= 0x20;
|
LPC_SC->SCS |= 0x20;
|
||||||
while( !( LPC_SC->SCS & 0x40 ) );
|
while( !( LPC_SC->SCS & 0x40 ) );
|
||||||
|
|
||||||
/* select main OSC, 12MHz, as the PLL clock source. */
|
/* select main OSC, 12MHz, as the PLL clock source. */
|
||||||
LPC_SC->CLKSRCSEL = 0x1;
|
LPC_SC->CLKSRCSEL = 0x1;
|
||||||
|
|
||||||
LPC_SC->PLL0CFG = 0x20031;
|
LPC_SC->PLL0CFG = 0x20031;
|
||||||
LPC_SC->PLL0FEED = PLLFEED_FEED1;
|
LPC_SC->PLL0FEED = PLLFEED_FEED1;
|
||||||
LPC_SC->PLL0FEED = PLLFEED_FEED2;
|
LPC_SC->PLL0FEED = PLLFEED_FEED2;
|
||||||
|
|
||||||
/* Enable PLL, disconnected. */
|
/* Enable PLL, disconnected. */
|
||||||
LPC_SC->PLL0CON = 1;
|
LPC_SC->PLL0CON = 1;
|
||||||
LPC_SC->PLL0FEED = PLLFEED_FEED1;
|
LPC_SC->PLL0FEED = PLLFEED_FEED1;
|
||||||
LPC_SC->PLL0FEED = PLLFEED_FEED2;
|
LPC_SC->PLL0FEED = PLLFEED_FEED2;
|
||||||
|
|
||||||
/* Set clock divider. */
|
/* Set clock divider. */
|
||||||
LPC_SC->CCLKCFG = 0x03;
|
LPC_SC->CCLKCFG = 0x03;
|
||||||
|
|
||||||
/* Configure flash accelerator. */
|
/* Configure flash accelerator. */
|
||||||
LPC_SC->FLASHCFG = 0x403a;
|
LPC_SC->FLASHCFG = 0x403a;
|
||||||
|
|
||||||
/* Check lock bit status. */
|
/* Check lock bit status. */
|
||||||
while( ( ( LPC_SC->PLL0STAT & ( 1 << 26 ) ) == 0 ) );
|
while( ( ( LPC_SC->PLL0STAT & ( 1 << 26 ) ) == 0 ) );
|
||||||
|
|
||||||
/* Enable and connect. */
|
/* Enable and connect. */
|
||||||
LPC_SC->PLL0CON = 3;
|
LPC_SC->PLL0CON = 3;
|
||||||
LPC_SC->PLL0FEED = PLLFEED_FEED1;
|
LPC_SC->PLL0FEED = PLLFEED_FEED1;
|
||||||
LPC_SC->PLL0FEED = PLLFEED_FEED2;
|
LPC_SC->PLL0FEED = PLLFEED_FEED2;
|
||||||
while( ( ( LPC_SC->PLL0STAT & ( 1 << 25 ) ) == 0 ) );
|
while( ( ( LPC_SC->PLL0STAT & ( 1 << 25 ) ) == 0 ) );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Configure the clock for the USB. */
|
/* Configure the clock for the USB. */
|
||||||
|
|
||||||
if( LPC_SC->PLL1STAT & ( 1 << 9 ) )
|
if( LPC_SC->PLL1STAT & ( 1 << 9 ) )
|
||||||
{
|
{
|
||||||
/* Enable PLL, disconnected. */
|
/* Enable PLL, disconnected. */
|
||||||
|
@ -333,22 +333,22 @@ void prvSetupHardware( void )
|
||||||
LPC_SC->PLL1FEED = PLLFEED_FEED1;
|
LPC_SC->PLL1FEED = PLLFEED_FEED1;
|
||||||
LPC_SC->PLL1FEED = PLLFEED_FEED2;
|
LPC_SC->PLL1FEED = PLLFEED_FEED2;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Disable PLL, disconnected. */
|
/* Disable PLL, disconnected. */
|
||||||
LPC_SC->PLL1CON = 0;
|
LPC_SC->PLL1CON = 0;
|
||||||
LPC_SC->PLL1FEED = PLLFEED_FEED1;
|
LPC_SC->PLL1FEED = PLLFEED_FEED1;
|
||||||
LPC_SC->PLL1FEED = PLLFEED_FEED2;
|
LPC_SC->PLL1FEED = PLLFEED_FEED2;
|
||||||
|
|
||||||
LPC_SC->PLL1CFG = 0x23;
|
LPC_SC->PLL1CFG = 0x23;
|
||||||
LPC_SC->PLL1FEED = PLLFEED_FEED1;
|
LPC_SC->PLL1FEED = PLLFEED_FEED1;
|
||||||
LPC_SC->PLL1FEED = PLLFEED_FEED2;
|
LPC_SC->PLL1FEED = PLLFEED_FEED2;
|
||||||
|
|
||||||
/* Enable PLL, disconnected. */
|
/* Enable PLL, disconnected. */
|
||||||
LPC_SC->PLL1CON = 1;
|
LPC_SC->PLL1CON = 1;
|
||||||
LPC_SC->PLL1FEED = PLLFEED_FEED1;
|
LPC_SC->PLL1FEED = PLLFEED_FEED1;
|
||||||
LPC_SC->PLL1FEED = PLLFEED_FEED2;
|
LPC_SC->PLL1FEED = PLLFEED_FEED2;
|
||||||
while( ( ( LPC_SC->PLL1STAT & ( 1 << 10 ) ) == 0 ) );
|
while( ( ( LPC_SC->PLL1STAT & ( 1 << 10 ) ) == 0 ) );
|
||||||
|
|
||||||
/* Enable and connect. */
|
/* Enable and connect. */
|
||||||
LPC_SC->PLL1CON = 3;
|
LPC_SC->PLL1CON = 3;
|
||||||
LPC_SC->PLL1FEED = PLLFEED_FEED1;
|
LPC_SC->PLL1FEED = PLLFEED_FEED1;
|
||||||
|
|
|
@ -207,7 +207,7 @@ PT_THREAD(net_stats(struct httpd_state *s, char *ptr))
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
extern void vTaskList( signed char *pcWriteBuffer );
|
extern void vTaskList( char *pcWriteBuffer );
|
||||||
extern char *pcGetTaskStatusMessage( void );
|
extern char *pcGetTaskStatusMessage( void );
|
||||||
static char cCountBuf[ 128 ];
|
static char cCountBuf[ 128 ];
|
||||||
long lRefreshCount = 0;
|
long lRefreshCount = 0;
|
||||||
|
@ -217,7 +217,7 @@ generate_rtos_stats(void *arg)
|
||||||
( void ) arg;
|
( void ) arg;
|
||||||
lRefreshCount++;
|
lRefreshCount++;
|
||||||
sprintf( cCountBuf, "<p><br>Refresh count = %d<p><br>%s", (int)lRefreshCount, pcGetTaskStatusMessage() );
|
sprintf( cCountBuf, "<p><br>Refresh count = %d<p><br>%s", (int)lRefreshCount, pcGetTaskStatusMessage() );
|
||||||
vTaskList( uip_appdata );
|
vTaskList( ( char * ) uip_appdata );
|
||||||
strcat( uip_appdata, cCountBuf );
|
strcat( uip_appdata, cCountBuf );
|
||||||
|
|
||||||
return strlen( uip_appdata );
|
return strlen( uip_appdata );
|
||||||
|
@ -261,14 +261,14 @@ const unsigned long ulLEDNo = 3;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
extern void vTaskGetRunTimeStats( signed char *pcWriteBuffer );
|
extern void vTaskGetRunTimeStats( char *pcWriteBuffer );
|
||||||
static unsigned short
|
static unsigned short
|
||||||
generate_runtime_stats(void *arg)
|
generate_runtime_stats(void *arg)
|
||||||
{
|
{
|
||||||
( void ) arg;
|
( void ) arg;
|
||||||
lRefreshCount++;
|
lRefreshCount++;
|
||||||
sprintf( cCountBuf, "<p><br>Refresh count = %d", (int)lRefreshCount );
|
sprintf( cCountBuf, "<p><br>Refresh count = %d", (int)lRefreshCount );
|
||||||
vTaskGetRunTimeStats( uip_appdata );
|
vTaskGetRunTimeStats( ( char * ) uip_appdata );
|
||||||
strcat( uip_appdata, cCountBuf );
|
strcat( uip_appdata, cCountBuf );
|
||||||
|
|
||||||
return strlen( uip_appdata );
|
return strlen( uip_appdata );
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
All rights reserved
|
All rights reserved
|
||||||
|
|
||||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
@ -80,7 +80,7 @@
|
||||||
*
|
*
|
||||||
* "uIP" task - This is the task that handles the uIP stack. All TCP/IP
|
* "uIP" task - This is the task that handles the uIP stack. All TCP/IP
|
||||||
* processing is performed in this task.
|
* processing is performed in this task.
|
||||||
*
|
*
|
||||||
* "USB" task - Enumerates the USB device as a CDC class, then echoes back all
|
* "USB" task - Enumerates the USB device as a CDC class, then echoes back all
|
||||||
* received characters with a configurable offset (for example, if the offset
|
* received characters with a configurable offset (for example, if the offset
|
||||||
* is 1 and 'A' is received then 'B' will be sent back). A dumb terminal such
|
* is 1 and 'A' is received then 'B' will be sent back). A dumb terminal such
|
||||||
|
@ -174,10 +174,10 @@ int main( void )
|
||||||
vStartLEDFlashTasks( mainFLASH_TASK_PRIORITY );
|
vStartLEDFlashTasks( mainFLASH_TASK_PRIORITY );
|
||||||
|
|
||||||
/* Create the USB task. */
|
/* Create the USB task. */
|
||||||
xTaskCreate( vUSBTask, ( signed char * ) "USB", configMINIMAL_STACK_SIZE, ( void * ) NULL, tskIDLE_PRIORITY, NULL );
|
xTaskCreate( vUSBTask, "USB", configMINIMAL_STACK_SIZE, ( void * ) NULL, tskIDLE_PRIORITY, NULL );
|
||||||
|
|
||||||
/* Create the uIP task. The WEB server runs in this task. */
|
/* Create the uIP task. The WEB server runs in this task. */
|
||||||
xTaskCreate( vuIP_Task, ( signed char * ) "uIP", mainBASIC_WEB_STACK_SIZE, ( void * ) NULL, mainUIP_TASK_PRIORITY, NULL );
|
xTaskCreate( vuIP_Task, "uIP", mainBASIC_WEB_STACK_SIZE, ( void * ) NULL, mainUIP_TASK_PRIORITY, NULL );
|
||||||
|
|
||||||
/* Start the scheduler. */
|
/* Start the scheduler. */
|
||||||
vTaskStartScheduler();
|
vTaskStartScheduler();
|
||||||
|
|
|
@ -207,7 +207,7 @@ PT_THREAD(net_stats(struct httpd_state *s, char *ptr))
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
extern void vTaskList( signed char *pcWriteBuffer );
|
extern void vTaskList( char *pcWriteBuffer );
|
||||||
extern char *pcGetTaskStatusMessage( void );
|
extern char *pcGetTaskStatusMessage( void );
|
||||||
static char cCountBuf[ 128 ];
|
static char cCountBuf[ 128 ];
|
||||||
long lRefreshCount = 0;
|
long lRefreshCount = 0;
|
||||||
|
@ -217,7 +217,7 @@ generate_rtos_stats(void *arg)
|
||||||
( void ) arg;
|
( void ) arg;
|
||||||
lRefreshCount++;
|
lRefreshCount++;
|
||||||
sprintf( cCountBuf, "<p><br>Refresh count = %d<p><br>%s", (int)lRefreshCount, pcGetTaskStatusMessage() );
|
sprintf( cCountBuf, "<p><br>Refresh count = %d<p><br>%s", (int)lRefreshCount, pcGetTaskStatusMessage() );
|
||||||
vTaskList( uip_appdata );
|
vTaskList( ( char * ) uip_appdata );
|
||||||
strcat( uip_appdata, cCountBuf );
|
strcat( uip_appdata, cCountBuf );
|
||||||
|
|
||||||
return strlen( uip_appdata );
|
return strlen( uip_appdata );
|
||||||
|
@ -261,14 +261,14 @@ extern long lParTestGetLEDState( void );
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
extern void vTaskGetRunTimeStats( signed char *pcWriteBuffer );
|
extern void vTaskGetRunTimeStats( char *pcWriteBuffer );
|
||||||
static unsigned short
|
static unsigned short
|
||||||
generate_runtime_stats(void *arg)
|
generate_runtime_stats(void *arg)
|
||||||
{
|
{
|
||||||
( void ) arg;
|
( void ) arg;
|
||||||
lRefreshCount++;
|
lRefreshCount++;
|
||||||
sprintf( cCountBuf, "<p><br>Refresh count = %d", (int)lRefreshCount );
|
sprintf( cCountBuf, "<p><br>Refresh count = %d", (int)lRefreshCount );
|
||||||
vTaskGetRunTimeStats( uip_appdata );
|
vTaskGetRunTimeStats( ( char * ) uip_appdata );
|
||||||
strcat( uip_appdata, cCountBuf );
|
strcat( uip_appdata, cCountBuf );
|
||||||
|
|
||||||
return strlen( uip_appdata );
|
return strlen( uip_appdata );
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
All rights reserved
|
All rights reserved
|
||||||
|
|
||||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
@ -181,13 +181,13 @@ int main( void )
|
||||||
vStartRecursiveMutexTasks();
|
vStartRecursiveMutexTasks();
|
||||||
|
|
||||||
/* Create the simple LED flash task. */
|
/* Create the simple LED flash task. */
|
||||||
xTaskCreate( prvFlashTask, ( signed char * ) "Flash", configMINIMAL_STACK_SIZE, ( void * ) NULL, mainFLASH_TASK_PRIORITY, NULL );
|
xTaskCreate( prvFlashTask, "Flash", configMINIMAL_STACK_SIZE, ( void * ) NULL, mainFLASH_TASK_PRIORITY, NULL );
|
||||||
|
|
||||||
/* Create the USB task. */
|
/* Create the USB task. */
|
||||||
xTaskCreate( vUSBTask, ( signed char * ) "USB", configMINIMAL_STACK_SIZE, ( void * ) NULL, tskIDLE_PRIORITY, NULL );
|
xTaskCreate( vUSBTask, "USB", configMINIMAL_STACK_SIZE, ( void * ) NULL, tskIDLE_PRIORITY, NULL );
|
||||||
|
|
||||||
/* Create the uIP task. The WEB server runs in this task. */
|
/* Create the uIP task. The WEB server runs in this task. */
|
||||||
xTaskCreate( vuIP_Task, ( signed char * ) "uIP", mainBASIC_WEB_STACK_SIZE, ( void * ) NULL, mainUIP_TASK_PRIORITY, NULL );
|
xTaskCreate( vuIP_Task, "uIP", mainBASIC_WEB_STACK_SIZE, ( void * ) NULL, mainUIP_TASK_PRIORITY, NULL );
|
||||||
|
|
||||||
/* Start the scheduler. */
|
/* Start the scheduler. */
|
||||||
vTaskStartScheduler();
|
vTaskStartScheduler();
|
||||||
|
@ -289,81 +289,81 @@ void prvSetupHardware( void )
|
||||||
if ( SC->PLL0STAT & ( 1 << 25 ) )
|
if ( SC->PLL0STAT & ( 1 << 25 ) )
|
||||||
{
|
{
|
||||||
/* Enable PLL, disconnected. */
|
/* Enable PLL, disconnected. */
|
||||||
SC->PLL0CON = 1;
|
SC->PLL0CON = 1;
|
||||||
SC->PLL0FEED = PLLFEED_FEED1;
|
SC->PLL0FEED = PLLFEED_FEED1;
|
||||||
SC->PLL0FEED = PLLFEED_FEED2;
|
SC->PLL0FEED = PLLFEED_FEED2;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Disable PLL, disconnected. */
|
/* Disable PLL, disconnected. */
|
||||||
SC->PLL0CON = 0;
|
SC->PLL0CON = 0;
|
||||||
SC->PLL0FEED = PLLFEED_FEED1;
|
SC->PLL0FEED = PLLFEED_FEED1;
|
||||||
SC->PLL0FEED = PLLFEED_FEED2;
|
SC->PLL0FEED = PLLFEED_FEED2;
|
||||||
|
|
||||||
/* Enable main OSC. */
|
/* Enable main OSC. */
|
||||||
SC->SCS |= 0x20;
|
SC->SCS |= 0x20;
|
||||||
while( !( SC->SCS & 0x40 ) );
|
while( !( SC->SCS & 0x40 ) );
|
||||||
|
|
||||||
/* select main OSC, 12MHz, as the PLL clock source. */
|
/* select main OSC, 12MHz, as the PLL clock source. */
|
||||||
SC->CLKSRCSEL = 0x1;
|
SC->CLKSRCSEL = 0x1;
|
||||||
|
|
||||||
SC->PLL0CFG = 0x20031;
|
SC->PLL0CFG = 0x20031;
|
||||||
SC->PLL0FEED = PLLFEED_FEED1;
|
SC->PLL0FEED = PLLFEED_FEED1;
|
||||||
SC->PLL0FEED = PLLFEED_FEED2;
|
SC->PLL0FEED = PLLFEED_FEED2;
|
||||||
|
|
||||||
/* Enable PLL, disconnected. */
|
/* Enable PLL, disconnected. */
|
||||||
SC->PLL0CON = 1;
|
SC->PLL0CON = 1;
|
||||||
SC->PLL0FEED = PLLFEED_FEED1;
|
SC->PLL0FEED = PLLFEED_FEED1;
|
||||||
SC->PLL0FEED = PLLFEED_FEED2;
|
SC->PLL0FEED = PLLFEED_FEED2;
|
||||||
|
|
||||||
/* Set clock divider. */
|
/* Set clock divider. */
|
||||||
SC->CCLKCFG = 0x03;
|
SC->CCLKCFG = 0x03;
|
||||||
|
|
||||||
/* Configure flash accelerator. */
|
/* Configure flash accelerator. */
|
||||||
SC->FLASHCFG = 0x403a;
|
SC->FLASHCFG = 0x403a;
|
||||||
|
|
||||||
/* Check lock bit status. */
|
/* Check lock bit status. */
|
||||||
while( ( ( SC->PLL0STAT & ( 1 << 26 ) ) == 0 ) );
|
while( ( ( SC->PLL0STAT & ( 1 << 26 ) ) == 0 ) );
|
||||||
|
|
||||||
/* Enable and connect. */
|
/* Enable and connect. */
|
||||||
SC->PLL0CON = 3;
|
SC->PLL0CON = 3;
|
||||||
SC->PLL0FEED = PLLFEED_FEED1;
|
SC->PLL0FEED = PLLFEED_FEED1;
|
||||||
SC->PLL0FEED = PLLFEED_FEED2;
|
SC->PLL0FEED = PLLFEED_FEED2;
|
||||||
while( ( ( SC->PLL0STAT & ( 1 << 25 ) ) == 0 ) );
|
while( ( ( SC->PLL0STAT & ( 1 << 25 ) ) == 0 ) );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Configure the clock for the USB. */
|
/* Configure the clock for the USB. */
|
||||||
|
|
||||||
if( SC->PLL1STAT & ( 1 << 9 ) )
|
if( SC->PLL1STAT & ( 1 << 9 ) )
|
||||||
{
|
{
|
||||||
/* Enable PLL, disconnected. */
|
/* Enable PLL, disconnected. */
|
||||||
SC->PLL1CON = 1;
|
SC->PLL1CON = 1;
|
||||||
SC->PLL1FEED = PLLFEED_FEED1;
|
SC->PLL1FEED = PLLFEED_FEED1;
|
||||||
SC->PLL1FEED = PLLFEED_FEED2;
|
SC->PLL1FEED = PLLFEED_FEED2;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Disable PLL, disconnected. */
|
/* Disable PLL, disconnected. */
|
||||||
SC->PLL1CON = 0;
|
SC->PLL1CON = 0;
|
||||||
SC->PLL1FEED = PLLFEED_FEED1;
|
SC->PLL1FEED = PLLFEED_FEED1;
|
||||||
SC->PLL1FEED = PLLFEED_FEED2;
|
SC->PLL1FEED = PLLFEED_FEED2;
|
||||||
|
|
||||||
SC->PLL1CFG = 0x23;
|
SC->PLL1CFG = 0x23;
|
||||||
SC->PLL1FEED = PLLFEED_FEED1;
|
SC->PLL1FEED = PLLFEED_FEED1;
|
||||||
SC->PLL1FEED = PLLFEED_FEED2;
|
SC->PLL1FEED = PLLFEED_FEED2;
|
||||||
|
|
||||||
/* Enable PLL, disconnected. */
|
/* Enable PLL, disconnected. */
|
||||||
SC->PLL1CON = 1;
|
SC->PLL1CON = 1;
|
||||||
SC->PLL1FEED = PLLFEED_FEED1;
|
SC->PLL1FEED = PLLFEED_FEED1;
|
||||||
SC->PLL1FEED = PLLFEED_FEED2;
|
SC->PLL1FEED = PLLFEED_FEED2;
|
||||||
while( ( ( SC->PLL1STAT & ( 1 << 10 ) ) == 0 ) );
|
while( ( ( SC->PLL1STAT & ( 1 << 10 ) ) == 0 ) );
|
||||||
|
|
||||||
/* Enable and connect. */
|
/* Enable and connect. */
|
||||||
SC->PLL1CON = 3;
|
SC->PLL1CON = 3;
|
||||||
SC->PLL1FEED = PLLFEED_FEED1;
|
SC->PLL1FEED = PLLFEED_FEED1;
|
||||||
SC->PLL1FEED = PLLFEED_FEED2;
|
SC->PLL1FEED = PLLFEED_FEED2;
|
||||||
while( ( ( SC->PLL1STAT & ( 1 << 9 ) ) == 0 ) );
|
while( ( ( SC->PLL1STAT & ( 1 << 9 ) ) == 0 ) );
|
||||||
|
|
||||||
/* Setup the peripheral bus to be the same as the PLL output (64 MHz). */
|
/* Setup the peripheral bus to be the same as the PLL output (64 MHz). */
|
||||||
SC->PCLKSEL0 = 0x05555555;
|
SC->PCLKSEL0 = 0x05555555;
|
||||||
|
|
||||||
|
|
|
@ -207,7 +207,7 @@ PT_THREAD(net_stats(struct httpd_state *s, char *ptr))
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
extern void vTaskList( signed char *pcWriteBuffer );
|
extern void vTaskList( char *pcWriteBuffer );
|
||||||
extern char *pcGetTaskStatusMessage( void );
|
extern char *pcGetTaskStatusMessage( void );
|
||||||
static char cCountBuf[ 128 ];
|
static char cCountBuf[ 128 ];
|
||||||
long lRefreshCount = 0;
|
long lRefreshCount = 0;
|
||||||
|
@ -217,7 +217,7 @@ generate_rtos_stats(void *arg)
|
||||||
( void ) arg;
|
( void ) arg;
|
||||||
lRefreshCount++;
|
lRefreshCount++;
|
||||||
sprintf( cCountBuf, "<p><br>Refresh count = %d<p><br>%s", (int)lRefreshCount, pcGetTaskStatusMessage() );
|
sprintf( cCountBuf, "<p><br>Refresh count = %d<p><br>%s", (int)lRefreshCount, pcGetTaskStatusMessage() );
|
||||||
vTaskList( uip_appdata );
|
vTaskList( ( char * ) uip_appdata );
|
||||||
strcat( uip_appdata, cCountBuf );
|
strcat( uip_appdata, cCountBuf );
|
||||||
|
|
||||||
return strlen( uip_appdata );
|
return strlen( uip_appdata );
|
||||||
|
@ -261,14 +261,14 @@ extern long lParTestGetLEDState( void );
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
extern void vTaskGetRunTimeStats( signed char *pcWriteBuffer );
|
extern void vTaskGetRunTimeStats( char *pcWriteBuffer );
|
||||||
static unsigned short
|
static unsigned short
|
||||||
generate_runtime_stats(void *arg)
|
generate_runtime_stats(void *arg)
|
||||||
{
|
{
|
||||||
( void ) arg;
|
( void ) arg;
|
||||||
lRefreshCount++;
|
lRefreshCount++;
|
||||||
sprintf( cCountBuf, "<p><br>Refresh count = %d", (int)lRefreshCount );
|
sprintf( cCountBuf, "<p><br>Refresh count = %d", (int)lRefreshCount );
|
||||||
vTaskGetRunTimeStats( uip_appdata );
|
vTaskGetRunTimeStats( ( char * ) uip_appdata );
|
||||||
strcat( uip_appdata, cCountBuf );
|
strcat( uip_appdata, cCountBuf );
|
||||||
|
|
||||||
return strlen( uip_appdata );
|
return strlen( uip_appdata );
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
All rights reserved
|
All rights reserved
|
||||||
|
|
||||||
FEATURES AND PORTS ARE ADDED TO FREERTOS ALL THE TIME. PLEASE VISIT
|
FEATURES AND PORTS ARE ADDED TO FREERTOS ALL THE TIME. PLEASE VISIT
|
||||||
|
@ -199,7 +199,7 @@ void vRegisterSampleCLICommands( void )
|
||||||
|
|
||||||
static portBASE_TYPE prvTaskStatsCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString )
|
static portBASE_TYPE prvTaskStatsCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString )
|
||||||
{
|
{
|
||||||
const int8_t *const pcHeader = ( int8_t * ) "Task State Priority Stack #\r\n************************************************\r\n";
|
const char *const pcHeader = "Task State Priority Stack #\r\n************************************************\r\n";
|
||||||
|
|
||||||
/* Remove compile time warnings about unused parameters, and check the
|
/* Remove compile time warnings about unused parameters, and check the
|
||||||
write buffer is not NULL. NOTE - for simplicity, this example assumes the
|
write buffer is not NULL. NOTE - for simplicity, this example assumes the
|
||||||
|
@ -209,8 +209,8 @@ const int8_t *const pcHeader = ( int8_t * ) "Task State Priority Stac
|
||||||
configASSERT( pcWriteBuffer );
|
configASSERT( pcWriteBuffer );
|
||||||
|
|
||||||
/* Generate a table of task stats. */
|
/* Generate a table of task stats. */
|
||||||
strcpy( ( char * ) pcWriteBuffer, ( char * ) pcHeader );
|
strcpy( ( char * ) pcWriteBuffer, pcHeader );
|
||||||
vTaskList( pcWriteBuffer + strlen( ( char * ) pcHeader ) );
|
vTaskList( ( char * ) pcWriteBuffer + strlen( ( char * ) pcHeader ) );
|
||||||
|
|
||||||
/* There is no more data to return after this single string, so return
|
/* There is no more data to return after this single string, so return
|
||||||
pdFALSE. */
|
pdFALSE. */
|
||||||
|
@ -220,7 +220,7 @@ const int8_t *const pcHeader = ( int8_t * ) "Task State Priority Stac
|
||||||
|
|
||||||
static portBASE_TYPE prvRunTimeStatsCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString )
|
static portBASE_TYPE prvRunTimeStatsCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString )
|
||||||
{
|
{
|
||||||
const int8_t * const pcHeader = ( int8_t * ) "Task Abs Time % Time\r\n****************************************\r\n";
|
const char * const pcHeader = "Task Abs Time % Time\r\n****************************************\r\n";
|
||||||
|
|
||||||
/* Remove compile time warnings about unused parameters, and check the
|
/* Remove compile time warnings about unused parameters, and check the
|
||||||
write buffer is not NULL. NOTE - for simplicity, this example assumes the
|
write buffer is not NULL. NOTE - for simplicity, this example assumes the
|
||||||
|
@ -231,7 +231,7 @@ const int8_t * const pcHeader = ( int8_t * ) "Task Abs Time % Ti
|
||||||
|
|
||||||
/* Generate a table of task stats. */
|
/* Generate a table of task stats. */
|
||||||
strcpy( ( char * ) pcWriteBuffer, ( char * ) pcHeader );
|
strcpy( ( char * ) pcWriteBuffer, ( char * ) pcHeader );
|
||||||
vTaskGetRunTimeStats( pcWriteBuffer + strlen( ( char * ) pcHeader ) );
|
vTaskGetRunTimeStats( ( char * ) pcWriteBuffer + strlen( ( char * ) pcHeader ) );
|
||||||
|
|
||||||
/* There is no more data to return after this single string, so return
|
/* There is no more data to return after this single string, so return
|
||||||
pdFALSE. */
|
pdFALSE. */
|
||||||
|
|
|
@ -149,7 +149,7 @@ void vUARTCommandConsoleStart( uint16_t usStackSize, unsigned portBASE_TYPE uxPr
|
||||||
|
|
||||||
/* Create that task that handles the console itself. */
|
/* Create that task that handles the console itself. */
|
||||||
xTaskCreate( prvUARTCommandConsoleTask, /* The task that implements the command console. */
|
xTaskCreate( prvUARTCommandConsoleTask, /* The task that implements the command console. */
|
||||||
( const int8_t * const ) "CLI", /* Text name assigned to the task. This is just to assist debugging. The kernel does not use this name itself. */
|
"CLI", /* Text name assigned to the task. This is just to assist debugging. The kernel does not use this name itself. */
|
||||||
usStackSize, /* The size of the stack allocated to the task. */
|
usStackSize, /* The size of the stack allocated to the task. */
|
||||||
NULL, /* The parameter is not used, so NULL is passed. */
|
NULL, /* The parameter is not used, so NULL is passed. */
|
||||||
uxPriority, /* The priority allocated to the task. */
|
uxPriority, /* The priority allocated to the task. */
|
||||||
|
|
|
@ -155,13 +155,13 @@ void main_blinky( void )
|
||||||
/* Start the two tasks as described in the comments at the top of this
|
/* Start the two tasks as described in the comments at the top of this
|
||||||
file. */
|
file. */
|
||||||
xTaskCreate( prvQueueReceiveTask, /* The function that implements the task. */
|
xTaskCreate( prvQueueReceiveTask, /* The function that implements the task. */
|
||||||
( signed char * ) "Rx", /* The text name assigned to the task - for debug only as it is not used by the kernel. */
|
"Rx", /* The text name assigned to the task - for debug only as it is not used by the kernel. */
|
||||||
configMINIMAL_STACK_SIZE, /* The size of the stack to allocate to the task. */
|
configMINIMAL_STACK_SIZE, /* The size of the stack to allocate to the task. */
|
||||||
( void * ) mainQUEUE_RECEIVE_PARAMETER, /* The parameter passed to the task - just to check the functionality. */
|
( void * ) mainQUEUE_RECEIVE_PARAMETER, /* The parameter passed to the task - just to check the functionality. */
|
||||||
mainQUEUE_RECEIVE_TASK_PRIORITY, /* The priority assigned to the task. */
|
mainQUEUE_RECEIVE_TASK_PRIORITY, /* The priority assigned to the task. */
|
||||||
NULL ); /* The task handle is not required, so NULL is passed. */
|
NULL ); /* The task handle is not required, so NULL is passed. */
|
||||||
|
|
||||||
xTaskCreate( prvQueueSendTask, ( signed char * ) "TX", configMINIMAL_STACK_SIZE, ( void * ) mainQUEUE_SEND_PARAMETER, mainQUEUE_SEND_TASK_PRIORITY, NULL );
|
xTaskCreate( prvQueueSendTask, "TX", configMINIMAL_STACK_SIZE, ( void * ) mainQUEUE_SEND_PARAMETER, mainQUEUE_SEND_TASK_PRIORITY, NULL );
|
||||||
|
|
||||||
/* Start the tasks and timer running. */
|
/* Start the tasks and timer running. */
|
||||||
vTaskStartScheduler();
|
vTaskStartScheduler();
|
||||||
|
|
|
@ -209,14 +209,14 @@ const size_t xRegTestStackSize = 25U;
|
||||||
These are naked functions that don't use any stack. A stack still has
|
These are naked functions that don't use any stack. A stack still has
|
||||||
to be allocated to hold the task context. */
|
to be allocated to hold the task context. */
|
||||||
xTaskCreate( vRegTest1Task, /* Function that implements the task. */
|
xTaskCreate( vRegTest1Task, /* Function that implements the task. */
|
||||||
( signed char * ) "Reg1", /* Text name of the task. */
|
"Reg1", /* Text name of the task. */
|
||||||
xRegTestStackSize, /* Stack allocated to the task. */
|
xRegTestStackSize, /* Stack allocated to the task. */
|
||||||
NULL, /* The task parameter is not used. */
|
NULL, /* The task parameter is not used. */
|
||||||
tskIDLE_PRIORITY, /* The priority to assign to the task. */
|
tskIDLE_PRIORITY, /* The priority to assign to the task. */
|
||||||
NULL ); /* Don't receive a handle back, it is not needed. */
|
NULL ); /* Don't receive a handle back, it is not needed. */
|
||||||
|
|
||||||
xTaskCreate( vRegTest2Task, /* Function that implements the task. */
|
xTaskCreate( vRegTest2Task, /* Function that implements the task. */
|
||||||
( signed char * ) "Reg2", /* Text name of the task. */
|
"Reg2", /* Text name of the task. */
|
||||||
xRegTestStackSize, /* Stack allocated to the task. */
|
xRegTestStackSize, /* Stack allocated to the task. */
|
||||||
NULL, /* The task parameter is not used. */
|
NULL, /* The task parameter is not used. */
|
||||||
tskIDLE_PRIORITY, /* The priority to assign to the task. */
|
tskIDLE_PRIORITY, /* The priority to assign to the task. */
|
||||||
|
@ -224,7 +224,7 @@ const size_t xRegTestStackSize = 25U;
|
||||||
|
|
||||||
/* Create the software timer that performs the 'check' functionality,
|
/* Create the software timer that performs the 'check' functionality,
|
||||||
as described at the top of this file. */
|
as described at the top of this file. */
|
||||||
xTimer = xTimerCreate( ( const signed char * ) "CheckTimer",/* A text name, purely to help debugging. */
|
xTimer = xTimerCreate( "CheckTimer", /* A text name, purely to help debugging. */
|
||||||
( mainCHECK_TIMER_PERIOD_MS ), /* The timer period, in this case 3000ms (3s). */
|
( mainCHECK_TIMER_PERIOD_MS ), /* The timer period, in this case 3000ms (3s). */
|
||||||
pdTRUE, /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */
|
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. */
|
( void * ) 0, /* The ID is not used, so can be set to anything. */
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
All rights reserved
|
All rights reserved
|
||||||
|
|
||||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
@ -164,13 +164,13 @@ void main_blinky( void )
|
||||||
/* Start the two tasks as described in the comments at the top of this
|
/* Start the two tasks as described in the comments at the top of this
|
||||||
file. */
|
file. */
|
||||||
xTaskCreate( prvQueueReceiveTask, /* The function that implements the task. */
|
xTaskCreate( prvQueueReceiveTask, /* The function that implements the task. */
|
||||||
( signed char * ) "Rx", /* The text name assigned to the task - for debug only as it is not used by the kernel. */
|
"Rx", /* The text name assigned to the task - for debug only as it is not used by the kernel. */
|
||||||
configMINIMAL_STACK_SIZE, /* The size of the stack to allocate to the task. */
|
configMINIMAL_STACK_SIZE, /* The size of the stack to allocate to the task. */
|
||||||
( void * ) mainQUEUE_RECEIVE_PARAMETER, /* The parameter passed to the task - just to check the functionality. */
|
( void * ) mainQUEUE_RECEIVE_PARAMETER, /* The parameter passed to the task - just to check the functionality. */
|
||||||
mainQUEUE_RECEIVE_TASK_PRIORITY, /* The priority assigned to the task. */
|
mainQUEUE_RECEIVE_TASK_PRIORITY, /* The priority assigned to the task. */
|
||||||
NULL ); /* The task handle is not required, so NULL is passed. */
|
NULL ); /* The task handle is not required, so NULL is passed. */
|
||||||
|
|
||||||
xTaskCreate( prvQueueSendTask, ( signed char * ) "TX", configMINIMAL_STACK_SIZE, ( void * ) mainQUEUE_SEND_PARAMETER, mainQUEUE_SEND_TASK_PRIORITY, NULL );
|
xTaskCreate( prvQueueSendTask, "TX", configMINIMAL_STACK_SIZE, ( void * ) mainQUEUE_SEND_PARAMETER, mainQUEUE_SEND_TASK_PRIORITY, NULL );
|
||||||
|
|
||||||
/* Start the tasks and timer running. */
|
/* Start the tasks and timer running. */
|
||||||
vTaskStartScheduler();
|
vTaskStartScheduler();
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
All rights reserved
|
All rights reserved
|
||||||
|
|
||||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
@ -91,9 +91,9 @@
|
||||||
* containing an unexpected value is indicative of an error in the context
|
* containing an unexpected value is indicative of an error in the context
|
||||||
* switching mechanism.
|
* switching mechanism.
|
||||||
*
|
*
|
||||||
* "Interrupt semaphore take" task - This task does nothing but block on a
|
* "Interrupt semaphore take" task - This task does nothing but block on a
|
||||||
* semaphore that is 'given' from the tick hook function (which is defined in
|
* semaphore that is 'given' from the tick hook function (which is defined in
|
||||||
* main.c). It toggles the fourth LED each time it receives the semaphore. The
|
* main.c). It toggles the fourth LED each time it receives the semaphore. The
|
||||||
* Semahore is given every 50ms, so LED 4 toggles every 50ms.
|
* Semahore is given every 50ms, so LED 4 toggles every 50ms.
|
||||||
*
|
*
|
||||||
* "Flash timers" - A software timer callback function is defined that does
|
* "Flash timers" - A software timer callback function is defined that does
|
||||||
|
@ -227,7 +227,7 @@ const size_t xRegTestStackSize = 25U;
|
||||||
toggles an LED each time the semaphore is given. */
|
toggles an LED each time the semaphore is given. */
|
||||||
vSemaphoreCreateBinary( xLEDSemaphore );
|
vSemaphoreCreateBinary( xLEDSemaphore );
|
||||||
xTaskCreate( prvSemaphoreTakeTask, /* Function that implements the task. */
|
xTaskCreate( prvSemaphoreTakeTask, /* Function that implements the task. */
|
||||||
( signed char * ) "Sem", /* Text name of the task. */
|
"Sem", /* Text name of the task. */
|
||||||
configMINIMAL_STACK_SIZE, /* Stack allocated to the task (in words). */
|
configMINIMAL_STACK_SIZE, /* Stack allocated to the task (in words). */
|
||||||
NULL, /* The task parameter is not used. */
|
NULL, /* The task parameter is not used. */
|
||||||
configMAX_PRIORITIES - 2, /* The priority of the task. */
|
configMAX_PRIORITIES - 2, /* The priority of the task. */
|
||||||
|
@ -237,14 +237,14 @@ const size_t xRegTestStackSize = 25U;
|
||||||
These are naked functions that don't use any stack. A stack still has
|
These are naked functions that don't use any stack. A stack still has
|
||||||
to be allocated to hold the task context. */
|
to be allocated to hold the task context. */
|
||||||
xTaskCreate( vRegTest1Task, /* Function that implements the task. */
|
xTaskCreate( vRegTest1Task, /* Function that implements the task. */
|
||||||
( signed char * ) "Reg1", /* Text name of the task. */
|
"Reg1", /* Text name of the task. */
|
||||||
xRegTestStackSize, /* Stack allocated to the task. */
|
xRegTestStackSize, /* Stack allocated to the task. */
|
||||||
NULL, /* The task parameter is not used. */
|
NULL, /* The task parameter is not used. */
|
||||||
tskIDLE_PRIORITY, /* The priority to assign to the task. */
|
tskIDLE_PRIORITY, /* The priority to assign to the task. */
|
||||||
NULL ); /* Don't receive a handle back, it is not needed. */
|
NULL ); /* Don't receive a handle back, it is not needed. */
|
||||||
|
|
||||||
xTaskCreate( vRegTest2Task, /* Function that implements the task. */
|
xTaskCreate( vRegTest2Task, /* Function that implements the task. */
|
||||||
( signed char * ) "Reg2", /* Text name of the task. */
|
"Reg2", /* Text name of the task. */
|
||||||
xRegTestStackSize, /* Stack allocated to the task. */
|
xRegTestStackSize, /* Stack allocated to the task. */
|
||||||
NULL, /* The task parameter is not used. */
|
NULL, /* The task parameter is not used. */
|
||||||
tskIDLE_PRIORITY, /* The priority to assign to the task. */
|
tskIDLE_PRIORITY, /* The priority to assign to the task. */
|
||||||
|
@ -253,7 +253,7 @@ const size_t xRegTestStackSize = 25U;
|
||||||
/* Create the three flash timers. */
|
/* Create the three flash timers. */
|
||||||
for( ulTimer = 0UL; ulTimer < ulTimersToCreate; ulTimer++ )
|
for( ulTimer = 0UL; ulTimer < ulTimersToCreate; ulTimer++ )
|
||||||
{
|
{
|
||||||
xTimer = xTimerCreate( ( const signed char * ) "FlashTimer", /* A text name, purely to help debugging. */
|
xTimer = xTimerCreate( "FlashTimer", /* A text name, purely to help debugging. */
|
||||||
( mainFLASH_TIMER_BASE_RATE * ( ulTimer + 1UL ) ), /* The timer period, in this case 3000ms (3s). */
|
( mainFLASH_TIMER_BASE_RATE * ( ulTimer + 1UL ) ), /* The timer period, in this case 3000ms (3s). */
|
||||||
pdTRUE, /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */
|
pdTRUE, /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */
|
||||||
( void * ) ulTimer, /* The ID is used to hold the number of the LED that will be flashed. */
|
( void * ) ulTimer, /* The ID is used to hold the number of the LED that will be flashed. */
|
||||||
|
@ -268,11 +268,11 @@ const size_t xRegTestStackSize = 25U;
|
||||||
|
|
||||||
/* Create the software timer that performs the 'check' functionality,
|
/* Create the software timer that performs the 'check' functionality,
|
||||||
as described at the top of this file. */
|
as described at the top of this file. */
|
||||||
xTimer = xTimerCreate( ( const signed char * ) "CheckTimer",/* A text name, purely to help debugging. */
|
xTimer = xTimerCreate( "CheckTimer", /* A text name, purely to help debugging. */
|
||||||
( mainCHECK_TIMER_PERIOD_MS ), /* The timer period, in this case 3000ms (3s). */
|
( mainCHECK_TIMER_PERIOD_MS ), /* The timer period, in this case 3000ms (3s). */
|
||||||
pdTRUE, /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */
|
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. */
|
( 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. */
|
prvCheckTimerCallback /* The callback function that inspects the status of all the other tasks. */
|
||||||
);
|
);
|
||||||
|
|
||||||
/* If the software timer was created successfully, start it. It won't
|
/* If the software timer was created successfully, start it. It won't
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
All rights reserved
|
All rights reserved
|
||||||
|
|
||||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
@ -75,7 +75,7 @@
|
||||||
* required to configure the hardware, are defined in main.c.
|
* required to configure the hardware, are defined in main.c.
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*
|
*
|
||||||
* main_blinky() creates one queue, and two tasks. It then starts the
|
* main_blinky() creates one queue, and two tasks. It then starts the
|
||||||
* scheduler.
|
* scheduler.
|
||||||
*
|
*
|
||||||
* The Queue Send Task:
|
* The Queue Send Task:
|
||||||
|
@ -161,13 +161,13 @@ void main_blinky( void )
|
||||||
/* Start the two tasks as described in the comments at the top of this
|
/* Start the two tasks as described in the comments at the top of this
|
||||||
file. */
|
file. */
|
||||||
xTaskCreate( prvQueueReceiveTask, /* The function that implements the task. */
|
xTaskCreate( prvQueueReceiveTask, /* The function that implements the task. */
|
||||||
( signed char * ) "Rx", /* The text name assigned to the task - for debug only as it is not used by the kernel. */
|
"Rx", /* The text name assigned to the task - for debug only as it is not used by the kernel. */
|
||||||
configMINIMAL_STACK_SIZE, /* The size of the stack to allocate to the task. */
|
configMINIMAL_STACK_SIZE, /* The size of the stack to allocate to the task. */
|
||||||
( void * ) mainQUEUE_RECEIVE_PARAMETER, /* The parameter passed to the task - just to check the functionality. */
|
( void * ) mainQUEUE_RECEIVE_PARAMETER, /* The parameter passed to the task - just to check the functionality. */
|
||||||
mainQUEUE_RECEIVE_TASK_PRIORITY, /* The priority assigned to the task. */
|
mainQUEUE_RECEIVE_TASK_PRIORITY, /* The priority assigned to the task. */
|
||||||
NULL ); /* The task handle is not required, so NULL is passed. */
|
NULL ); /* The task handle is not required, so NULL is passed. */
|
||||||
|
|
||||||
xTaskCreate( prvQueueSendTask, ( signed char * ) "TX", configMINIMAL_STACK_SIZE, ( void * ) mainQUEUE_SEND_PARAMETER, mainQUEUE_SEND_TASK_PRIORITY, NULL );
|
xTaskCreate( prvQueueSendTask, "TX", configMINIMAL_STACK_SIZE, ( void * ) mainQUEUE_SEND_PARAMETER, mainQUEUE_SEND_TASK_PRIORITY, NULL );
|
||||||
|
|
||||||
/* Start the tasks and timer running. */
|
/* Start the tasks and timer running. */
|
||||||
vTaskStartScheduler();
|
vTaskStartScheduler();
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
All rights reserved
|
All rights reserved
|
||||||
|
|
||||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
@ -194,14 +194,14 @@ const size_t xRegTestStackSize = 25U;
|
||||||
These are naked functions that don't use any stack. A stack still has
|
These are naked functions that don't use any stack. A stack still has
|
||||||
to be allocated to hold the task context. */
|
to be allocated to hold the task context. */
|
||||||
xTaskCreate( vRegTest1Task, /* Function that implements the task. */
|
xTaskCreate( vRegTest1Task, /* Function that implements the task. */
|
||||||
( signed char * ) "Reg1", /* Text name of the task. */
|
"Reg1", /* Text name of the task. */
|
||||||
xRegTestStackSize, /* Stack allocated to the task. */
|
xRegTestStackSize, /* Stack allocated to the task. */
|
||||||
NULL, /* The task parameter is not used. */
|
NULL, /* The task parameter is not used. */
|
||||||
tskIDLE_PRIORITY, /* The priority to assign to the task. */
|
tskIDLE_PRIORITY, /* The priority to assign to the task. */
|
||||||
NULL ); /* Don't receive a handle back, it is not needed. */
|
NULL ); /* Don't receive a handle back, it is not needed. */
|
||||||
|
|
||||||
xTaskCreate( vRegTest2Task, /* Function that implements the task. */
|
xTaskCreate( vRegTest2Task, /* Function that implements the task. */
|
||||||
( signed char * ) "Reg2", /* Text name of the task. */
|
"Reg2", /* Text name of the task. */
|
||||||
xRegTestStackSize, /* Stack allocated to the task. */
|
xRegTestStackSize, /* Stack allocated to the task. */
|
||||||
NULL, /* The task parameter is not used. */
|
NULL, /* The task parameter is not used. */
|
||||||
tskIDLE_PRIORITY, /* The priority to assign to the task. */
|
tskIDLE_PRIORITY, /* The priority to assign to the task. */
|
||||||
|
@ -209,11 +209,11 @@ const size_t xRegTestStackSize = 25U;
|
||||||
|
|
||||||
/* Create the software timer that performs the 'check' functionality,
|
/* Create the software timer that performs the 'check' functionality,
|
||||||
as described at the top of this file. */
|
as described at the top of this file. */
|
||||||
xCheckTimer = xTimerCreate( ( const signed char * ) "CheckTimer",/* A text name, purely to help debugging. */
|
xCheckTimer = xTimerCreate( "CheckTimer", /* A text name, purely to help debugging. */
|
||||||
( mainCHECK_TIMER_PERIOD_MS ), /* The timer period, in this case 3000ms (3s). */
|
( mainCHECK_TIMER_PERIOD_MS ), /* The timer period, in this case 3000ms (3s). */
|
||||||
pdTRUE, /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */
|
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. */
|
( 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. */
|
prvCheckTimerCallback /* The callback function that inspects the status of all the other tasks. */
|
||||||
);
|
);
|
||||||
|
|
||||||
/* If the software timer was created successfully, start it. It won't
|
/* If the software timer was created successfully, start it. It won't
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
All rights reserved
|
All rights reserved
|
||||||
|
|
||||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
@ -164,13 +164,13 @@ void main_blinky( void )
|
||||||
/* Start the two tasks as described in the comments at the top of this
|
/* Start the two tasks as described in the comments at the top of this
|
||||||
file. */
|
file. */
|
||||||
xTaskCreate( prvQueueReceiveTask, /* The function that implements the task. */
|
xTaskCreate( prvQueueReceiveTask, /* The function that implements the task. */
|
||||||
( signed char * ) "Rx", /* The text name assigned to the task - for debug only as it is not used by the kernel. */
|
"Rx", /* The text name assigned to the task - for debug only as it is not used by the kernel. */
|
||||||
configMINIMAL_STACK_SIZE, /* The size of the stack to allocate to the task. */
|
configMINIMAL_STACK_SIZE, /* The size of the stack to allocate to the task. */
|
||||||
( void * ) mainQUEUE_RECEIVE_PARAMETER, /* The parameter passed to the task - just to check the functionality. */
|
( void * ) mainQUEUE_RECEIVE_PARAMETER, /* The parameter passed to the task - just to check the functionality. */
|
||||||
mainQUEUE_RECEIVE_TASK_PRIORITY, /* The priority assigned to the task. */
|
mainQUEUE_RECEIVE_TASK_PRIORITY, /* The priority assigned to the task. */
|
||||||
NULL ); /* The task handle is not required, so NULL is passed. */
|
NULL ); /* The task handle is not required, so NULL is passed. */
|
||||||
|
|
||||||
xTaskCreate( prvQueueSendTask, ( signed char * ) "TX", configMINIMAL_STACK_SIZE, ( void * ) mainQUEUE_SEND_PARAMETER, mainQUEUE_SEND_TASK_PRIORITY, NULL );
|
xTaskCreate( prvQueueSendTask, "TX", configMINIMAL_STACK_SIZE, ( void * ) mainQUEUE_SEND_PARAMETER, mainQUEUE_SEND_TASK_PRIORITY, NULL );
|
||||||
|
|
||||||
/* Start the tasks and timer running. */
|
/* Start the tasks and timer running. */
|
||||||
vTaskStartScheduler();
|
vTaskStartScheduler();
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
All rights reserved
|
All rights reserved
|
||||||
|
|
||||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
@ -206,14 +206,14 @@ const size_t xRegTestStackSize = 25U;
|
||||||
These are naked functions that don't use any stack. A stack still has
|
These are naked functions that don't use any stack. A stack still has
|
||||||
to be allocated to hold the task context. */
|
to be allocated to hold the task context. */
|
||||||
xTaskCreate( vRegTest1Task, /* Function that implements the task. */
|
xTaskCreate( vRegTest1Task, /* Function that implements the task. */
|
||||||
( signed char * ) "Reg1", /* Text name of the task. */
|
"Reg1", /* Text name of the task. */
|
||||||
xRegTestStackSize, /* Stack allocated to the task. */
|
xRegTestStackSize, /* Stack allocated to the task. */
|
||||||
NULL, /* The task parameter is not used. */
|
NULL, /* The task parameter is not used. */
|
||||||
tskIDLE_PRIORITY, /* The priority to assign to the task. */
|
tskIDLE_PRIORITY, /* The priority to assign to the task. */
|
||||||
NULL ); /* Don't receive a handle back, it is not needed. */
|
NULL ); /* Don't receive a handle back, it is not needed. */
|
||||||
|
|
||||||
xTaskCreate( vRegTest2Task, /* Function that implements the task. */
|
xTaskCreate( vRegTest2Task, /* Function that implements the task. */
|
||||||
( signed char * ) "Reg2", /* Text name of the task. */
|
"Reg2", /* Text name of the task. */
|
||||||
xRegTestStackSize, /* Stack allocated to the task. */
|
xRegTestStackSize, /* Stack allocated to the task. */
|
||||||
NULL, /* The task parameter is not used. */
|
NULL, /* The task parameter is not used. */
|
||||||
tskIDLE_PRIORITY, /* The priority to assign to the task. */
|
tskIDLE_PRIORITY, /* The priority to assign to the task. */
|
||||||
|
@ -222,26 +222,26 @@ const size_t xRegTestStackSize = 25U;
|
||||||
/* Create the three flash timers. */
|
/* Create the three flash timers. */
|
||||||
for( ulTimer = 0UL; ulTimer < ulTimersToCreate; ulTimer++ )
|
for( ulTimer = 0UL; ulTimer < ulTimersToCreate; ulTimer++ )
|
||||||
{
|
{
|
||||||
xTimer = xTimerCreate( ( const signed char * ) "FlashTimer", /* A text name, purely to help debugging. */
|
xTimer = xTimerCreate( "FlashTimer", /* A text name, purely to help debugging. */
|
||||||
( mainFLASH_TIMER_BASE_RATE * ( ulTimer + 1UL ) ), /* The timer period, in this case 3000ms (3s). */
|
( mainFLASH_TIMER_BASE_RATE * ( ulTimer + 1UL ) ), /* The timer period, in this case 3000ms (3s). */
|
||||||
pdTRUE, /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */
|
pdTRUE, /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */
|
||||||
( void * ) ulTimer, /* The ID is used to hold the number of the LED that will be flashed. */
|
( void * ) ulTimer, /* The ID is used to hold the number of the LED that will be flashed. */
|
||||||
prvFlashTimerCallback /* The callback function that inspects the status of all the other tasks. */
|
prvFlashTimerCallback /* The callback function that inspects the status of all the other tasks. */
|
||||||
);
|
);
|
||||||
|
|
||||||
if( xTimer != NULL )
|
if( xTimer != NULL )
|
||||||
{
|
{
|
||||||
xTimerStart( xTimer, mainDONT_BLOCK );
|
xTimerStart( xTimer, mainDONT_BLOCK );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create the software timer that performs the 'check' functionality,
|
/* Create the software timer that performs the 'check' functionality,
|
||||||
as described at the top of this file. */
|
as described at the top of this file. */
|
||||||
xTimer = xTimerCreate( ( const signed char * ) "CheckTimer",/* A text name, purely to help debugging. */
|
xTimer = xTimerCreate( "CheckTimer", /* A text name, purely to help debugging. */
|
||||||
( mainCHECK_TIMER_PERIOD_MS ), /* The timer period, in this case 3000ms (3s). */
|
( mainCHECK_TIMER_PERIOD_MS ), /* The timer period, in this case 3000ms (3s). */
|
||||||
pdTRUE, /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */
|
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. */
|
( 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. */
|
prvCheckTimerCallback /* The callback function that inspects the status of all the other tasks. */
|
||||||
);
|
);
|
||||||
|
|
||||||
/* If the software timer was created successfully, start it. It won't
|
/* If the software timer was created successfully, start it. It won't
|
||||||
|
@ -342,6 +342,6 @@ unsigned long ulLED;
|
||||||
ulLED = ( unsigned long ) pvTimerGetTimerID( xTimer );
|
ulLED = ( unsigned long ) pvTimerGetTimerID( xTimer );
|
||||||
|
|
||||||
/* Toggle the LED. */
|
/* Toggle the LED. */
|
||||||
vParTestToggleLED( ulLED );
|
vParTestToggleLED( ulLED );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
All rights reserved
|
All rights reserved
|
||||||
|
|
||||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
@ -157,13 +157,13 @@ void main_blinky( void )
|
||||||
/* Start the two tasks as described in the comments at the top of this
|
/* Start the two tasks as described in the comments at the top of this
|
||||||
file. */
|
file. */
|
||||||
xTaskCreate( prvQueueReceiveTask, /* The function that implements the task. */
|
xTaskCreate( prvQueueReceiveTask, /* The function that implements the task. */
|
||||||
( signed char * ) "Rx", /* The text name assigned to the task - for debug only as it is not used by the kernel. */
|
"Rx", /* The text name assigned to the task - for debug only as it is not used by the kernel. */
|
||||||
configMINIMAL_STACK_SIZE, /* The size of the stack to allocate to the task. */
|
configMINIMAL_STACK_SIZE, /* The size of the stack to allocate to the task. */
|
||||||
( void * ) mainQUEUE_RECEIVE_PARAMETER, /* The parameter passed to the task - just to check the functionality. */
|
( void * ) mainQUEUE_RECEIVE_PARAMETER, /* The parameter passed to the task - just to check the functionality. */
|
||||||
mainQUEUE_RECEIVE_TASK_PRIORITY, /* The priority assigned to the task. */
|
mainQUEUE_RECEIVE_TASK_PRIORITY, /* The priority assigned to the task. */
|
||||||
NULL ); /* The task handle is not required, so NULL is passed. */
|
NULL ); /* The task handle is not required, so NULL is passed. */
|
||||||
|
|
||||||
xTaskCreate( prvQueueSendTask, ( signed char * ) "TX", configMINIMAL_STACK_SIZE, ( void * ) mainQUEUE_SEND_PARAMETER, mainQUEUE_SEND_TASK_PRIORITY, NULL );
|
xTaskCreate( prvQueueSendTask, "TX", configMINIMAL_STACK_SIZE, ( void * ) mainQUEUE_SEND_PARAMETER, mainQUEUE_SEND_TASK_PRIORITY, NULL );
|
||||||
|
|
||||||
/* Start the tasks and timer running. */
|
/* Start the tasks and timer running. */
|
||||||
vTaskStartScheduler();
|
vTaskStartScheduler();
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
All rights reserved
|
All rights reserved
|
||||||
|
|
||||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
@ -76,8 +76,8 @@
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*
|
*
|
||||||
* main_full() creates all the demo application tasks and a software timer, then
|
* main_full() creates all the demo application tasks and a software timer, then
|
||||||
* starts the scheduler. The web documentation provides more details of the
|
* starts the scheduler. The web documentation provides more details of the
|
||||||
* standard demo application tasks, which provide no particular functionality,
|
* standard demo application tasks, which provide no particular functionality,
|
||||||
* but do provide a good example of how to use the FreeRTOS API.
|
* but do provide a good example of how to use the FreeRTOS API.
|
||||||
*
|
*
|
||||||
* In addition to the standard demo tasks, the following tasks and tests are
|
* In addition to the standard demo tasks, the following tasks and tests are
|
||||||
|
@ -180,21 +180,21 @@ xTimerHandle xCheckTimer = NULL;
|
||||||
vStartRecursiveMutexTasks();
|
vStartRecursiveMutexTasks();
|
||||||
vStartSemaphoreTasks( mainSEM_TEST_PRIORITY );
|
vStartSemaphoreTasks( mainSEM_TEST_PRIORITY );
|
||||||
vStartMathTasks( mainFLOP_TASK_PRIORITY );
|
vStartMathTasks( mainFLOP_TASK_PRIORITY );
|
||||||
|
|
||||||
/* Create the register check tasks, as described at the top of this
|
/* Create the register check tasks, as described at the top of this
|
||||||
file */
|
file */
|
||||||
xTaskCreate( prvRegTest1Task, ( signed char * ) "Reg1", configMINIMAL_STACK_SIZE, ( void * ) NULL, tskIDLE_PRIORITY, NULL );
|
xTaskCreate( prvRegTest1Task, "Reg1", configMINIMAL_STACK_SIZE, ( void * ) NULL, tskIDLE_PRIORITY, NULL );
|
||||||
xTaskCreate( prvRegTest2Task, ( signed char * ) "Reg2", configMINIMAL_STACK_SIZE, ( void * ) NULL, tskIDLE_PRIORITY, NULL );
|
xTaskCreate( prvRegTest2Task, "Reg2", configMINIMAL_STACK_SIZE, ( void * ) NULL, tskIDLE_PRIORITY, NULL );
|
||||||
|
|
||||||
/* Create the software timer that performs the 'check' functionality,
|
/* Create the software timer that performs the 'check' functionality,
|
||||||
as described at the top of this file. */
|
as described at the top of this file. */
|
||||||
xCheckTimer = xTimerCreate( ( const signed char * ) "CheckTimer",/* A text name, purely to help debugging. */
|
xCheckTimer = xTimerCreate( "CheckTimer", /* A text name, purely to help debugging. */
|
||||||
( mainCHECK_TIMER_PERIOD_MS ), /* The timer period, in this case 3000ms (3s). */
|
( mainCHECK_TIMER_PERIOD_MS ), /* The timer period, in this case 3000ms (3s). */
|
||||||
pdTRUE, /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */
|
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. */
|
( 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. */
|
prvCheckTimerCallback /* The callback function that inspects the status of all the other tasks. */
|
||||||
);
|
);
|
||||||
|
|
||||||
if( xCheckTimer != NULL )
|
if( xCheckTimer != NULL )
|
||||||
{
|
{
|
||||||
xTimerStart( xCheckTimer, mainDONT_BLOCK );
|
xTimerStart( xCheckTimer, mainDONT_BLOCK );
|
||||||
|
@ -202,13 +202,13 @@ xTimerHandle xCheckTimer = NULL;
|
||||||
|
|
||||||
/* Start the scheduler. */
|
/* Start the scheduler. */
|
||||||
vTaskStartScheduler();
|
vTaskStartScheduler();
|
||||||
|
|
||||||
/* If all is well, the scheduler will now be running, and the following line
|
/* If all is well, the scheduler will now be running, and the following line
|
||||||
will never be reached. If the following line does execute, then there was
|
will never be reached. If the following line does execute, then there was
|
||||||
insufficient FreeRTOS heap memory available for the idle and/or timer tasks
|
insufficient FreeRTOS heap memory available for the idle and/or timer tasks
|
||||||
to be created. See the memory management section on the FreeRTOS web site
|
to be created. See the memory management section on the FreeRTOS web site
|
||||||
for more details. */
|
for more details. */
|
||||||
for( ;; );
|
for( ;; );
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
@ -250,7 +250,7 @@ unsigned long ulErrorFound = pdFALSE;
|
||||||
{
|
{
|
||||||
ulErrorFound = pdTRUE;
|
ulErrorFound = pdTRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check that the register test 1 task is still running. */
|
/* Check that the register test 1 task is still running. */
|
||||||
if( ulLastRegTest1Value == ulRegTest1LoopCounter )
|
if( ulLastRegTest1Value == ulRegTest1LoopCounter )
|
||||||
{
|
{
|
||||||
|
@ -268,8 +268,8 @@ unsigned long ulErrorFound = pdFALSE;
|
||||||
/* Toggle the check LED to give an indication of the system status. If
|
/* Toggle the check LED to give an indication of the system status. If
|
||||||
the LED toggles every mainCHECK_TIMER_PERIOD_MS milliseconds then
|
the LED toggles every mainCHECK_TIMER_PERIOD_MS milliseconds then
|
||||||
everything is ok. A faster toggle indicates an error. */
|
everything is ok. A faster toggle indicates an error. */
|
||||||
configTOGGLE_LED();
|
configTOGGLE_LED();
|
||||||
|
|
||||||
/* Have any errors been latch in ulErrorFound? If so, shorten the
|
/* Have any errors been latch in ulErrorFound? If so, shorten the
|
||||||
period of the check timer to mainERROR_CHECK_TIMER_PERIOD_MS milliseconds.
|
period of the check timer to mainERROR_CHECK_TIMER_PERIOD_MS milliseconds.
|
||||||
This will result in an increase in the rate at which mainCHECK_LED
|
This will result in an increase in the rate at which mainCHECK_LED
|
||||||
|
@ -279,7 +279,7 @@ unsigned long ulErrorFound = pdFALSE;
|
||||||
if( lChangedTimerPeriodAlready == pdFALSE )
|
if( lChangedTimerPeriodAlready == pdFALSE )
|
||||||
{
|
{
|
||||||
lChangedTimerPeriodAlready = pdTRUE;
|
lChangedTimerPeriodAlready = pdTRUE;
|
||||||
|
|
||||||
/* This call to xTimerChangePeriod() uses a zero block time.
|
/* This call to xTimerChangePeriod() uses a zero block time.
|
||||||
Functions called from inside of a timer callback function must
|
Functions called from inside of a timer callback function must
|
||||||
*never* attempt to block. */
|
*never* attempt to block. */
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
All rights reserved
|
All rights reserved
|
||||||
|
|
||||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
@ -99,7 +99,7 @@
|
||||||
|
|
||||||
/* Set mainCREATE_SIMPLE_BLINKY_DEMO_ONLY to one to run the simple blinky demo,
|
/* Set mainCREATE_SIMPLE_BLINKY_DEMO_ONLY to one to run the simple blinky demo,
|
||||||
or 0 to run the more comprehensive test and demo application. */
|
or 0 to run the more comprehensive test and demo application. */
|
||||||
#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY 1
|
#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY 0
|
||||||
|
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
All rights reserved
|
All rights reserved
|
||||||
|
|
||||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
@ -157,13 +157,13 @@ void main_blinky( void )
|
||||||
/* Start the two tasks as described in the comments at the top of this
|
/* Start the two tasks as described in the comments at the top of this
|
||||||
file. */
|
file. */
|
||||||
xTaskCreate( prvQueueReceiveTask, /* The function that implements the task. */
|
xTaskCreate( prvQueueReceiveTask, /* The function that implements the task. */
|
||||||
( signed char * ) "Rx", /* The text name assigned to the task - for debug only as it is not used by the kernel. */
|
"Rx", /* The text name assigned to the task - for debug only as it is not used by the kernel. */
|
||||||
configMINIMAL_STACK_SIZE, /* The size of the stack to allocate to the task. */
|
configMINIMAL_STACK_SIZE, /* The size of the stack to allocate to the task. */
|
||||||
( void * ) mainQUEUE_RECEIVE_PARAMETER, /* The parameter passed to the task - just to check the functionality. */
|
( void * ) mainQUEUE_RECEIVE_PARAMETER, /* The parameter passed to the task - just to check the functionality. */
|
||||||
mainQUEUE_RECEIVE_TASK_PRIORITY, /* The priority assigned to the task. */
|
mainQUEUE_RECEIVE_TASK_PRIORITY, /* The priority assigned to the task. */
|
||||||
NULL ); /* The task handle is not required, so NULL is passed. */
|
NULL ); /* The task handle is not required, so NULL is passed. */
|
||||||
|
|
||||||
xTaskCreate( prvQueueSendTask, ( signed char * ) "TX", configMINIMAL_STACK_SIZE, ( void * ) mainQUEUE_SEND_PARAMETER, mainQUEUE_SEND_TASK_PRIORITY, NULL );
|
xTaskCreate( prvQueueSendTask, "TX", configMINIMAL_STACK_SIZE, ( void * ) mainQUEUE_SEND_PARAMETER, mainQUEUE_SEND_TASK_PRIORITY, NULL );
|
||||||
|
|
||||||
/* Start the tasks and timer running. */
|
/* Start the tasks and timer running. */
|
||||||
vTaskStartScheduler();
|
vTaskStartScheduler();
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
All rights reserved
|
All rights reserved
|
||||||
|
|
||||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
@ -185,12 +185,12 @@ xTimerHandle xCheckTimer = NULL;
|
||||||
|
|
||||||
/* Create the register check tasks, as described at the top of this
|
/* Create the register check tasks, as described at the top of this
|
||||||
file */
|
file */
|
||||||
xTaskCreate( vRegTest1Task, ( signed char * ) "Reg1", configMINIMAL_STACK_SIZE, ( void * ) NULL, tskIDLE_PRIORITY, NULL );
|
xTaskCreate( vRegTest1Task, "Reg1", configMINIMAL_STACK_SIZE, ( void * ) NULL, tskIDLE_PRIORITY, NULL );
|
||||||
xTaskCreate( vRegTest2Task, ( signed char * ) "Reg2", configMINIMAL_STACK_SIZE, ( void * ) NULL, tskIDLE_PRIORITY, NULL );
|
xTaskCreate( vRegTest2Task, "Reg2", configMINIMAL_STACK_SIZE, ( void * ) NULL, tskIDLE_PRIORITY, NULL );
|
||||||
|
|
||||||
/* Create the software timer that performs the 'check' functionality,
|
/* Create the software timer that performs the 'check' functionality,
|
||||||
as described at the top of this file. */
|
as described at the top of this file. */
|
||||||
xCheckTimer = xTimerCreate( ( const signed char * ) "CheckTimer",/* A text name, purely to help debugging. */
|
xCheckTimer = xTimerCreate( "CheckTimer", /* A text name, purely to help debugging. */
|
||||||
( mainCHECK_TIMER_PERIOD_MS ), /* The timer period, in this case 3000ms (3s). */
|
( mainCHECK_TIMER_PERIOD_MS ), /* The timer period, in this case 3000ms (3s). */
|
||||||
pdTRUE, /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */
|
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. */
|
( void * ) 0, /* The ID is not used, so can be set to anything. */
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
All rights reserved
|
All rights reserved
|
||||||
|
|
||||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
@ -157,13 +157,13 @@ void main_blinky( void )
|
||||||
/* Start the two tasks as described in the comments at the top of this
|
/* Start the two tasks as described in the comments at the top of this
|
||||||
file. */
|
file. */
|
||||||
xTaskCreate( prvQueueReceiveTask, /* The function that implements the task. */
|
xTaskCreate( prvQueueReceiveTask, /* The function that implements the task. */
|
||||||
( signed char * ) "Rx", /* The text name assigned to the task - for debug only as it is not used by the kernel. */
|
"Rx", /* The text name assigned to the task - for debug only as it is not used by the kernel. */
|
||||||
configMINIMAL_STACK_SIZE, /* The size of the stack to allocate to the task. */
|
configMINIMAL_STACK_SIZE, /* The size of the stack to allocate to the task. */
|
||||||
( void * ) mainQUEUE_RECEIVE_PARAMETER, /* The parameter passed to the task - just to check the functionality. */
|
( void * ) mainQUEUE_RECEIVE_PARAMETER, /* The parameter passed to the task - just to check the functionality. */
|
||||||
mainQUEUE_RECEIVE_TASK_PRIORITY, /* The priority assigned to the task. */
|
mainQUEUE_RECEIVE_TASK_PRIORITY, /* The priority assigned to the task. */
|
||||||
NULL ); /* The task handle is not required, so NULL is passed. */
|
NULL ); /* The task handle is not required, so NULL is passed. */
|
||||||
|
|
||||||
xTaskCreate( prvQueueSendTask, ( signed char * ) "TX", configMINIMAL_STACK_SIZE, ( void * ) mainQUEUE_SEND_PARAMETER, mainQUEUE_SEND_TASK_PRIORITY, NULL );
|
xTaskCreate( prvQueueSendTask, "TX", configMINIMAL_STACK_SIZE, ( void * ) mainQUEUE_SEND_PARAMETER, mainQUEUE_SEND_TASK_PRIORITY, NULL );
|
||||||
|
|
||||||
/* Start the tasks and timer running. */
|
/* Start the tasks and timer running. */
|
||||||
vTaskStartScheduler();
|
vTaskStartScheduler();
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
All rights reserved
|
All rights reserved
|
||||||
|
|
||||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
@ -76,8 +76,8 @@
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*
|
*
|
||||||
* main_full() creates all the demo application tasks and a software timer, then
|
* main_full() creates all the demo application tasks and a software timer, then
|
||||||
* starts the scheduler. The web documentation provides more details of the
|
* starts the scheduler. The web documentation provides more details of the
|
||||||
* standard demo application tasks, which provide no particular functionality,
|
* standard demo application tasks, which provide no particular functionality,
|
||||||
* but do provide a good example of how to use the FreeRTOS API.
|
* but do provide a good example of how to use the FreeRTOS API.
|
||||||
*
|
*
|
||||||
* In addition to the standard demo tasks, the following tasks and tests are
|
* In addition to the standard demo tasks, the following tasks and tests are
|
||||||
|
@ -180,21 +180,21 @@ xTimerHandle xCheckTimer = NULL;
|
||||||
vStartRecursiveMutexTasks();
|
vStartRecursiveMutexTasks();
|
||||||
vStartSemaphoreTasks( mainSEM_TEST_PRIORITY );
|
vStartSemaphoreTasks( mainSEM_TEST_PRIORITY );
|
||||||
vStartMathTasks( mainFLOP_TASK_PRIORITY );
|
vStartMathTasks( mainFLOP_TASK_PRIORITY );
|
||||||
|
|
||||||
/* Create the register check tasks, as described at the top of this
|
/* Create the register check tasks, as described at the top of this
|
||||||
file */
|
file */
|
||||||
xTaskCreate( vRegTest1Task, ( signed char * ) "Reg1", configMINIMAL_STACK_SIZE, ( void * ) NULL, tskIDLE_PRIORITY, NULL );
|
xTaskCreate( vRegTest1Task, "Reg1", configMINIMAL_STACK_SIZE, ( void * ) NULL, tskIDLE_PRIORITY, NULL );
|
||||||
xTaskCreate( vRegTest2Task, ( signed char * ) "Reg2", configMINIMAL_STACK_SIZE, ( void * ) NULL, tskIDLE_PRIORITY, NULL );
|
xTaskCreate( vRegTest2Task, "Reg2", configMINIMAL_STACK_SIZE, ( void * ) NULL, tskIDLE_PRIORITY, NULL );
|
||||||
|
|
||||||
/* Create the software timer that performs the 'check' functionality,
|
/* Create the software timer that performs the 'check' functionality,
|
||||||
as described at the top of this file. */
|
as described at the top of this file. */
|
||||||
xCheckTimer = xTimerCreate( ( const signed char * ) "CheckTimer",/* A text name, purely to help debugging. */
|
xCheckTimer = xTimerCreate( "CheckTimer", /* A text name, purely to help debugging. */
|
||||||
( mainCHECK_TIMER_PERIOD_MS ), /* The timer period, in this case 3000ms (3s). */
|
( mainCHECK_TIMER_PERIOD_MS ), /* The timer period, in this case 3000ms (3s). */
|
||||||
pdTRUE, /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */
|
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. */
|
( 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. */
|
prvCheckTimerCallback /* The callback function that inspects the status of all the other tasks. */
|
||||||
);
|
);
|
||||||
|
|
||||||
if( xCheckTimer != NULL )
|
if( xCheckTimer != NULL )
|
||||||
{
|
{
|
||||||
xTimerStart( xCheckTimer, mainDONT_BLOCK );
|
xTimerStart( xCheckTimer, mainDONT_BLOCK );
|
||||||
|
@ -202,13 +202,13 @@ xTimerHandle xCheckTimer = NULL;
|
||||||
|
|
||||||
/* Start the scheduler. */
|
/* Start the scheduler. */
|
||||||
vTaskStartScheduler();
|
vTaskStartScheduler();
|
||||||
|
|
||||||
/* If all is well, the scheduler will now be running, and the following line
|
/* If all is well, the scheduler will now be running, and the following line
|
||||||
will never be reached. If the following line does execute, then there was
|
will never be reached. If the following line does execute, then there was
|
||||||
insufficient FreeRTOS heap memory available for the idle and/or timer tasks
|
insufficient FreeRTOS heap memory available for the idle and/or timer tasks
|
||||||
to be created. See the memory management section on the FreeRTOS web site
|
to be created. See the memory management section on the FreeRTOS web site
|
||||||
for more details. */
|
for more details. */
|
||||||
for( ;; );
|
for( ;; );
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
@ -250,7 +250,7 @@ unsigned long ulErrorFound = pdFALSE;
|
||||||
{
|
{
|
||||||
ulErrorFound = pdTRUE;
|
ulErrorFound = pdTRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check that the register test 1 task is still running. */
|
/* Check that the register test 1 task is still running. */
|
||||||
if( ulLastRegTest1Value == ulRegTest1LoopCounter )
|
if( ulLastRegTest1Value == ulRegTest1LoopCounter )
|
||||||
{
|
{
|
||||||
|
@ -268,8 +268,8 @@ unsigned long ulErrorFound = pdFALSE;
|
||||||
/* Toggle the check LED to give an indication of the system status. If
|
/* Toggle the check LED to give an indication of the system status. If
|
||||||
the LED toggles every mainCHECK_TIMER_PERIOD_MS milliseconds then
|
the LED toggles every mainCHECK_TIMER_PERIOD_MS milliseconds then
|
||||||
everything is ok. A faster toggle indicates an error. */
|
everything is ok. A faster toggle indicates an error. */
|
||||||
configTOGGLE_LED();
|
configTOGGLE_LED();
|
||||||
|
|
||||||
/* Have any errors been latch in ulErrorFound? If so, shorten the
|
/* Have any errors been latch in ulErrorFound? If so, shorten the
|
||||||
period of the check timer to mainERROR_CHECK_TIMER_PERIOD_MS milliseconds.
|
period of the check timer to mainERROR_CHECK_TIMER_PERIOD_MS milliseconds.
|
||||||
This will result in an increase in the rate at which mainCHECK_LED
|
This will result in an increase in the rate at which mainCHECK_LED
|
||||||
|
@ -279,7 +279,7 @@ unsigned long ulErrorFound = pdFALSE;
|
||||||
if( lChangedTimerPeriodAlready == pdFALSE )
|
if( lChangedTimerPeriodAlready == pdFALSE )
|
||||||
{
|
{
|
||||||
lChangedTimerPeriodAlready = pdTRUE;
|
lChangedTimerPeriodAlready = pdTRUE;
|
||||||
|
|
||||||
/* This call to xTimerChangePeriod() uses a zero block time.
|
/* This call to xTimerChangePeriod() uses a zero block time.
|
||||||
Functions called from inside of a timer callback function must
|
Functions called from inside of a timer callback function must
|
||||||
*never* attempt to block. */
|
*never* attempt to block. */
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
All rights reserved
|
All rights reserved
|
||||||
|
|
||||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
@ -157,13 +157,13 @@ void main_blinky( void )
|
||||||
/* Start the two tasks as described in the comments at the top of this
|
/* Start the two tasks as described in the comments at the top of this
|
||||||
file. */
|
file. */
|
||||||
xTaskCreate( prvQueueReceiveTask, /* The function that implements the task. */
|
xTaskCreate( prvQueueReceiveTask, /* The function that implements the task. */
|
||||||
( signed char * ) "Rx", /* The text name assigned to the task - for debug only as it is not used by the kernel. */
|
"Rx", /* The text name assigned to the task - for debug only as it is not used by the kernel. */
|
||||||
configMINIMAL_STACK_SIZE, /* The size of the stack to allocate to the task. */
|
configMINIMAL_STACK_SIZE, /* The size of the stack to allocate to the task. */
|
||||||
( void * ) mainQUEUE_RECEIVE_PARAMETER, /* The parameter passed to the task - just to check the functionality. */
|
( void * ) mainQUEUE_RECEIVE_PARAMETER, /* The parameter passed to the task - just to check the functionality. */
|
||||||
mainQUEUE_RECEIVE_TASK_PRIORITY, /* The priority assigned to the task. */
|
mainQUEUE_RECEIVE_TASK_PRIORITY, /* The priority assigned to the task. */
|
||||||
NULL ); /* The task handle is not required, so NULL is passed. */
|
NULL ); /* The task handle is not required, so NULL is passed. */
|
||||||
|
|
||||||
xTaskCreate( prvQueueSendTask, ( signed char * ) "TX", configMINIMAL_STACK_SIZE, ( void * ) mainQUEUE_SEND_PARAMETER, mainQUEUE_SEND_TASK_PRIORITY, NULL );
|
xTaskCreate( prvQueueSendTask, "TX", configMINIMAL_STACK_SIZE, ( void * ) mainQUEUE_SEND_PARAMETER, mainQUEUE_SEND_TASK_PRIORITY, NULL );
|
||||||
|
|
||||||
/* Start the tasks and timer running. */
|
/* Start the tasks and timer running. */
|
||||||
vTaskStartScheduler();
|
vTaskStartScheduler();
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
All rights reserved
|
All rights reserved
|
||||||
|
|
||||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
@ -185,18 +185,18 @@ xTimerHandle xCheckTimer = NULL;
|
||||||
|
|
||||||
/* Create the register check tasks, as described at the top of this
|
/* Create the register check tasks, as described at the top of this
|
||||||
file */
|
file */
|
||||||
xTaskCreate( vRegTest1Task, ( signed char * ) "Reg1", configMINIMAL_STACK_SIZE, ( void * ) NULL, tskIDLE_PRIORITY, NULL );
|
xTaskCreate( vRegTest1Task, "Reg1", configMINIMAL_STACK_SIZE, ( void * ) NULL, tskIDLE_PRIORITY, NULL );
|
||||||
xTaskCreate( vRegTest2Task, ( signed char * ) "Reg2", configMINIMAL_STACK_SIZE, ( void * ) NULL, tskIDLE_PRIORITY, NULL );
|
xTaskCreate( vRegTest2Task, "Reg2", configMINIMAL_STACK_SIZE, ( void * ) NULL, tskIDLE_PRIORITY, NULL );
|
||||||
|
|
||||||
/* Create the software timer that performs the 'check' functionality,
|
/* Create the software timer that performs the 'check' functionality,
|
||||||
as described at the top of this file. */
|
as described at the top of this file. */
|
||||||
xCheckTimer = xTimerCreate( ( const signed char * ) "CheckTimer",/* A text name, purely to help debugging. */
|
xCheckTimer = xTimerCreate( "CheckTimer", /* A text name, purely to help debugging. */
|
||||||
( mainCHECK_TIMER_PERIOD_MS ), /* The timer period, in this case 3000ms (3s). */
|
( mainCHECK_TIMER_PERIOD_MS ), /* The timer period, in this case 3000ms (3s). */
|
||||||
pdTRUE, /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */
|
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. */
|
( 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. */
|
prvCheckTimerCallback /* The callback function that inspects the status of all the other tasks. */
|
||||||
);
|
);
|
||||||
|
|
||||||
if( xCheckTimer != NULL )
|
if( xCheckTimer != NULL )
|
||||||
{
|
{
|
||||||
xTimerStart( xCheckTimer, mainDONT_BLOCK );
|
xTimerStart( xCheckTimer, mainDONT_BLOCK );
|
||||||
|
@ -204,7 +204,7 @@ xTimerHandle xCheckTimer = NULL;
|
||||||
|
|
||||||
/* Start the scheduler. */
|
/* Start the scheduler. */
|
||||||
vTaskStartScheduler();
|
vTaskStartScheduler();
|
||||||
|
|
||||||
/* If all is well, the scheduler will now be running, and the following line
|
/* If all is well, the scheduler will now be running, and the following line
|
||||||
will never be reached. If the following line does execute, then there was
|
will never be reached. If the following line does execute, then there was
|
||||||
insufficient FreeRTOS heap memory available for the idle and/or timer tasks
|
insufficient FreeRTOS heap memory available for the idle and/or timer tasks
|
||||||
|
|
|
@ -169,13 +169,13 @@ void main_blinky( void )
|
||||||
/* Start the two tasks as described in the comments at the top of this
|
/* Start the two tasks as described in the comments at the top of this
|
||||||
file. */
|
file. */
|
||||||
xTaskCreate( prvQueueReceiveTask, /* The function that implements the task. */
|
xTaskCreate( prvQueueReceiveTask, /* The function that implements the task. */
|
||||||
( signed char * ) "Rx", /* The text name assigned to the task - for debug only as it is not used by the kernel. */
|
"Rx", /* The text name assigned to the task - for debug only as it is not used by the kernel. */
|
||||||
configMINIMAL_STACK_SIZE, /* The size of the stack to allocate to the task. */
|
configMINIMAL_STACK_SIZE, /* The size of the stack to allocate to the task. */
|
||||||
( void * ) mainQUEUE_RECEIVE_PARAMETER, /* The parameter passed to the task - just to check the functionality. */
|
( void * ) mainQUEUE_RECEIVE_PARAMETER, /* The parameter passed to the task - just to check the functionality. */
|
||||||
mainQUEUE_RECEIVE_TASK_PRIORITY, /* The priority assigned to the task. */
|
mainQUEUE_RECEIVE_TASK_PRIORITY, /* The priority assigned to the task. */
|
||||||
NULL ); /* The task handle is not required, so NULL is passed. */
|
NULL ); /* The task handle is not required, so NULL is passed. */
|
||||||
|
|
||||||
xTaskCreate( prvQueueSendTask, ( signed char * ) "TX", configMINIMAL_STACK_SIZE, ( void * ) mainQUEUE_SEND_PARAMETER, mainQUEUE_SEND_TASK_PRIORITY, NULL );
|
xTaskCreate( prvQueueSendTask, "TX", configMINIMAL_STACK_SIZE, ( void * ) mainQUEUE_SEND_PARAMETER, mainQUEUE_SEND_TASK_PRIORITY, NULL );
|
||||||
|
|
||||||
/* Start the tasks and timer running. */
|
/* Start the tasks and timer running. */
|
||||||
vTaskStartScheduler();
|
vTaskStartScheduler();
|
||||||
|
|
|
@ -197,12 +197,12 @@ xTimerHandle xCheckTimer = NULL;
|
||||||
|
|
||||||
/* Create the register check tasks, as described at the top of this
|
/* Create the register check tasks, as described at the top of this
|
||||||
file */
|
file */
|
||||||
xTaskCreate( vRegTest1Task, ( signed char * ) "Reg1", configMINIMAL_STACK_SIZE, ( void * ) NULL, tskIDLE_PRIORITY, NULL );
|
xTaskCreate( vRegTest1Task, "Reg1", configMINIMAL_STACK_SIZE, ( void * ) NULL, tskIDLE_PRIORITY, NULL );
|
||||||
xTaskCreate( vRegTest2Task, ( signed char * ) "Reg2", configMINIMAL_STACK_SIZE, ( void * ) NULL, tskIDLE_PRIORITY, NULL );
|
xTaskCreate( vRegTest2Task, "Reg2", configMINIMAL_STACK_SIZE, ( void * ) NULL, tskIDLE_PRIORITY, NULL );
|
||||||
|
|
||||||
/* Create the software timer that performs the 'check' functionality,
|
/* Create the software timer that performs the 'check' functionality,
|
||||||
as described at the top of this file. */
|
as described at the top of this file. */
|
||||||
xCheckTimer = xTimerCreate( ( const signed char * ) "CheckTimer",/* A text name, purely to help debugging. */
|
xCheckTimer = xTimerCreate( "CheckTimer", /* A text name, purely to help debugging. */
|
||||||
( mainCHECK_TIMER_PERIOD_MS ), /* The timer period, in this case 3000ms (3s). */
|
( mainCHECK_TIMER_PERIOD_MS ), /* The timer period, in this case 3000ms (3s). */
|
||||||
pdTRUE, /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */
|
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. */
|
( void * ) 0, /* The ID is not used, so can be set to anything. */
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
All rights reserved
|
All rights reserved
|
||||||
|
|
||||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
@ -64,7 +64,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*-----------------------------------------------------------
|
/*-----------------------------------------------------------
|
||||||
* Normally, a demo application would define ParTest (parallel port test)
|
* Normally, a demo application would define ParTest (parallel port test)
|
||||||
* functions to write to an LED. In this case, four '*' symbols that are
|
* functions to write to an LED. In this case, four '*' symbols that are
|
||||||
* output to the debug printf() port are used to simulate LED outputs.
|
* output to the debug printf() port are used to simulate LED outputs.
|
||||||
*-----------------------------------------------------------*/
|
*-----------------------------------------------------------*/
|
||||||
|
@ -107,7 +107,7 @@ gatekeeper task. */
|
||||||
*/
|
*/
|
||||||
static void prvI2CGateKeeperTask( void *pvParameters );
|
static void prvI2CGateKeeperTask( void *pvParameters );
|
||||||
|
|
||||||
/* The queue used to communicate toggle commands with the I2C gatekeeper
|
/* The queue used to communicate toggle commands with the I2C gatekeeper
|
||||||
task. */
|
task. */
|
||||||
static xQueueHandle xI2CCommandQueue = NULL;
|
static xQueueHandle xI2CCommandQueue = NULL;
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
@ -137,7 +137,7 @@ I2C_M_SETUP_Type xI2CMessage;
|
||||||
configASSERT( xI2CCommandQueue );
|
configASSERT( xI2CCommandQueue );
|
||||||
|
|
||||||
/* Create the I2C gatekeeper task itself. */
|
/* Create the I2C gatekeeper task itself. */
|
||||||
xTaskCreate( prvI2CGateKeeperTask, ( signed char * ) "I2C", configMINIMAL_STACK_SIZE, ( void * ) NULL, tskIDLE_PRIORITY, NULL );
|
xTaskCreate( prvI2CGateKeeperTask, "I2C", configMINIMAL_STACK_SIZE, ( void * ) NULL, tskIDLE_PRIORITY, NULL );
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
@ -172,7 +172,7 @@ static I2C_M_SETUP_Type xI2CMessage; /* Static so it is not on the stack as this
|
||||||
{
|
{
|
||||||
/* Which bit is being manipulated? */
|
/* Which bit is being manipulated? */
|
||||||
ucLED = 0x01 << ucLED;
|
ucLED = 0x01 << ucLED;
|
||||||
|
|
||||||
/* Is the bit currently set or clear? */
|
/* Is the bit currently set or clear? */
|
||||||
if( ( ucLEDState & ucLED ) == 0U )
|
if( ( ucLEDState & ucLED ) == 0U )
|
||||||
{
|
{
|
||||||
|
@ -182,10 +182,10 @@ static I2C_M_SETUP_Type xI2CMessage; /* Static so it is not on the stack as this
|
||||||
{
|
{
|
||||||
ucLEDState &= ~ucLED;
|
ucLEDState &= ~ucLED;
|
||||||
}
|
}
|
||||||
|
|
||||||
ucBuffer[ 0 ] = partstIO_WRITE_COMMAND;
|
ucBuffer[ 0 ] = partstIO_WRITE_COMMAND;
|
||||||
ucBuffer[ 1 ] = ucLEDState;
|
ucBuffer[ 1 ] = ucLEDState;
|
||||||
|
|
||||||
xI2CMessage.sl_addr7bit = partstSLAVE_ADDRESS;
|
xI2CMessage.sl_addr7bit = partstSLAVE_ADDRESS;
|
||||||
xI2CMessage.tx_data = ucBuffer ;
|
xI2CMessage.tx_data = ucBuffer ;
|
||||||
xI2CMessage.tx_length = sizeof( ucBuffer );
|
xI2CMessage.tx_length = sizeof( ucBuffer );
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
All rights reserved
|
All rights reserved
|
||||||
|
|
||||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
@ -227,9 +227,9 @@ int main( void )
|
||||||
|
|
||||||
/* Start the scheduler. */
|
/* Start the scheduler. */
|
||||||
vTaskStartScheduler();
|
vTaskStartScheduler();
|
||||||
|
|
||||||
/* Infinite loop */
|
/* Infinite loop */
|
||||||
for( ;; );
|
for( ;; );
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
@ -291,7 +291,7 @@ unsigned long ulErrorFound = pdFALSE;
|
||||||
{
|
{
|
||||||
ulErrorFound |= 0x01UL << 9UL;
|
ulErrorFound |= 0x01UL << 9UL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check that the register test 1 task is still running. */
|
/* Check that the register test 1 task is still running. */
|
||||||
if( ulLastRegTest1Value == ulRegTest1LoopCounter )
|
if( ulLastRegTest1Value == ulRegTest1LoopCounter )
|
||||||
{
|
{
|
||||||
|
@ -309,8 +309,8 @@ unsigned long ulErrorFound = pdFALSE;
|
||||||
/* Toggle the check LED to give an indication of the system status. If
|
/* Toggle the check LED to give an indication of the system status. If
|
||||||
the LED toggles every mainCHECK_TIMER_PERIOD_MS milliseconds then
|
the LED toggles every mainCHECK_TIMER_PERIOD_MS milliseconds then
|
||||||
everything is ok. A faster toggle indicates an error. */
|
everything is ok. A faster toggle indicates an error. */
|
||||||
vParTestToggleLED( mainCHECK_LED );
|
vParTestToggleLED( mainCHECK_LED );
|
||||||
|
|
||||||
/* Have any errors been latch in ulErrorFound? If so, shorten the
|
/* Have any errors been latch in ulErrorFound? If so, shorten the
|
||||||
period of the check timer to mainERROR_CHECK_TIMER_PERIOD_MS milliseconds.
|
period of the check timer to mainERROR_CHECK_TIMER_PERIOD_MS milliseconds.
|
||||||
This will result in an increase in the rate at which mainCHECK_LED
|
This will result in an increase in the rate at which mainCHECK_LED
|
||||||
|
@ -320,7 +320,7 @@ unsigned long ulErrorFound = pdFALSE;
|
||||||
if( lChangedTimerPeriodAlready == pdFALSE )
|
if( lChangedTimerPeriodAlready == pdFALSE )
|
||||||
{
|
{
|
||||||
lChangedTimerPeriodAlready = pdTRUE;
|
lChangedTimerPeriodAlready = pdTRUE;
|
||||||
|
|
||||||
/* This call to xTimerChangePeriod() uses a zero block time.
|
/* This call to xTimerChangePeriod() uses a zero block time.
|
||||||
Functions called from inside of a timer callback function must
|
Functions called from inside of a timer callback function must
|
||||||
*never* attempt to block. */
|
*never* attempt to block. */
|
||||||
|
@ -339,10 +339,10 @@ extern void Hitex_CGU_Init( void );
|
||||||
|
|
||||||
/* Wind the clock speed up in steps to its maximum. */
|
/* Wind the clock speed up in steps to its maximum. */
|
||||||
Hitex_CGU_Init();
|
Hitex_CGU_Init();
|
||||||
|
|
||||||
/* Ensure all priority bits are assigned as preemption priority bits. */
|
/* Ensure all priority bits are assigned as preemption priority bits. */
|
||||||
NVIC_SetPriorityGrouping( 0 );
|
NVIC_SetPriorityGrouping( 0 );
|
||||||
|
|
||||||
/* Setup the LED outputs. */
|
/* Setup the LED outputs. */
|
||||||
vParTestInitialise();
|
vParTestInitialise();
|
||||||
}
|
}
|
||||||
|
@ -367,21 +367,21 @@ static void prvOptionallyCreateComprehensveTestApplication( void )
|
||||||
|
|
||||||
/* Most importantly, start the tasks that use the FPU. */
|
/* Most importantly, start the tasks that use the FPU. */
|
||||||
vStartMathTasks( mainFLOP_TASK_PRIORITY );
|
vStartMathTasks( mainFLOP_TASK_PRIORITY );
|
||||||
|
|
||||||
/* Create the register check tasks, as described at the top of this
|
/* Create the register check tasks, as described at the top of this
|
||||||
file */
|
file */
|
||||||
xTaskCreate( vRegTest1Task, ( signed char * ) "Reg1", configMINIMAL_STACK_SIZE, ( void * ) NULL, tskIDLE_PRIORITY, NULL );
|
xTaskCreate( vRegTest1Task, "Reg1", configMINIMAL_STACK_SIZE, ( void * ) NULL, tskIDLE_PRIORITY, NULL );
|
||||||
xTaskCreate( vRegTest2Task, ( signed char * ) "Reg2", configMINIMAL_STACK_SIZE, ( void * ) NULL, tskIDLE_PRIORITY, NULL );
|
xTaskCreate( vRegTest2Task, "Reg2", configMINIMAL_STACK_SIZE, ( void * ) NULL, tskIDLE_PRIORITY, NULL );
|
||||||
|
|
||||||
/* Create the software timer that performs the 'check' functionality,
|
/* Create the software timer that performs the 'check' functionality,
|
||||||
as described at the top of this file. */
|
as described at the top of this file. */
|
||||||
xCheckTimer = xTimerCreate( ( const signed char * ) "CheckTimer",/* A text name, purely to help debugging. */
|
xCheckTimer = xTimerCreate( "CheckTimer", /* A text name, purely to help debugging. */
|
||||||
( mainCHECK_TIMER_PERIOD_MS ), /* The timer period, in this case 3000ms (3s). */
|
( mainCHECK_TIMER_PERIOD_MS ), /* The timer period, in this case 3000ms (3s). */
|
||||||
pdTRUE, /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */
|
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. */
|
( 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. */
|
prvCheckTimerCallback /* The callback function that inspects the status of all the other tasks. */
|
||||||
);
|
);
|
||||||
|
|
||||||
if( xCheckTimer != NULL )
|
if( xCheckTimer != NULL )
|
||||||
{
|
{
|
||||||
xTimerStart( xCheckTimer, mainDONT_BLOCK );
|
xTimerStart( xCheckTimer, mainDONT_BLOCK );
|
||||||
|
@ -450,7 +450,7 @@ void vApplicationStackOverflowHook( xTaskHandle pxTask, signed char *pcTaskName
|
||||||
|
|
||||||
void vApplicationTickHook( void )
|
void vApplicationTickHook( void )
|
||||||
{
|
{
|
||||||
/* This function will be called by each tick interrupt if
|
/* This function will be called by each tick interrupt if
|
||||||
configUSE_TICK_HOOK is set to 1 in FreeRTOSConfig.h. User code can be
|
configUSE_TICK_HOOK is set to 1 in FreeRTOSConfig.h. User code can be
|
||||||
added here, but the tick hook is called from an interrupt context, so
|
added here, but the tick hook is called from an interrupt context, so
|
||||||
code must not attempt to block, and only the interrupt safe FreeRTOS API
|
code must not attempt to block, and only the interrupt safe FreeRTOS API
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
All rights reserved
|
All rights reserved
|
||||||
|
|
||||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
@ -273,7 +273,7 @@ int main(void)
|
||||||
{
|
{
|
||||||
/* Configure the hardware ready to run the test. */
|
/* Configure the hardware ready to run the test. */
|
||||||
prvSetupHardware();
|
prvSetupHardware();
|
||||||
|
|
||||||
/* Start standard demo/test application flash tasks. See the comments at
|
/* Start standard demo/test application flash tasks. See the comments at
|
||||||
the top of this file. The LED flash tasks are always created. The other
|
the top of this file. The LED flash tasks are always created. The other
|
||||||
tasks are only created if mainCREATE_SIMPLE_LED_FLASHER_DEMO_ONLY is set to
|
tasks are only created if mainCREATE_SIMPLE_LED_FLASHER_DEMO_ONLY is set to
|
||||||
|
@ -288,13 +288,13 @@ int main(void)
|
||||||
|
|
||||||
/* Start the scheduler. */
|
/* Start the scheduler. */
|
||||||
vTaskStartScheduler();
|
vTaskStartScheduler();
|
||||||
|
|
||||||
/* If all is well, the scheduler will now be running, and the following line
|
/* If all is well, the scheduler will now be running, and the following line
|
||||||
will never be reached. If the following line does execute, then there was
|
will never be reached. If the following line does execute, then there was
|
||||||
insufficient FreeRTOS heap memory available for the idle and/or timer tasks
|
insufficient FreeRTOS heap memory available for the idle and/or timer tasks
|
||||||
to be created. See the memory management section on the FreeRTOS web site
|
to be created. See the memory management section on the FreeRTOS web site
|
||||||
for more details. */
|
for more details. */
|
||||||
for( ;; );
|
for( ;; );
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
@ -356,7 +356,7 @@ long lErrorFound = pdFALSE;
|
||||||
{
|
{
|
||||||
lErrorFound = pdTRUE;
|
lErrorFound = pdTRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check that the register test 1 task is still running. */
|
/* Check that the register test 1 task is still running. */
|
||||||
if( ulLastRegTest1Value == ulRegTest1LoopCounter )
|
if( ulLastRegTest1Value == ulRegTest1LoopCounter )
|
||||||
{
|
{
|
||||||
|
@ -374,8 +374,8 @@ long lErrorFound = pdFALSE;
|
||||||
/* Toggle the check LED to give an indication of the system status. If
|
/* Toggle the check LED to give an indication of the system status. If
|
||||||
the LED toggles every mainCHECK_TIMER_PERIOD_MS milliseconds then
|
the LED toggles every mainCHECK_TIMER_PERIOD_MS milliseconds then
|
||||||
everything is ok. A faster toggle indicates an error. */
|
everything is ok. A faster toggle indicates an error. */
|
||||||
vParTestToggleLED( mainCHECK_LED );
|
vParTestToggleLED( mainCHECK_LED );
|
||||||
|
|
||||||
/* Have any errors been latch in lErrorFound? If so, shorten the
|
/* Have any errors been latch in lErrorFound? If so, shorten the
|
||||||
period of the check timer to mainERROR_CHECK_TIMER_PERIOD_MS milliseconds.
|
period of the check timer to mainERROR_CHECK_TIMER_PERIOD_MS milliseconds.
|
||||||
This will result in an increase in the rate at which mainCHECK_LED
|
This will result in an increase in the rate at which mainCHECK_LED
|
||||||
|
@ -385,7 +385,7 @@ long lErrorFound = pdFALSE;
|
||||||
if( lChangedTimerPeriodAlready == pdFALSE )
|
if( lChangedTimerPeriodAlready == pdFALSE )
|
||||||
{
|
{
|
||||||
lChangedTimerPeriodAlready = pdTRUE;
|
lChangedTimerPeriodAlready = pdTRUE;
|
||||||
|
|
||||||
/* This call to xTimerChangePeriod() uses a zero block time.
|
/* This call to xTimerChangePeriod() uses a zero block time.
|
||||||
Functions called from inside of a timer callback function must
|
Functions called from inside of a timer callback function must
|
||||||
*never* attempt to block. */
|
*never* attempt to block. */
|
||||||
|
@ -403,11 +403,11 @@ static void prvButtonTestTask( void *pvParameters )
|
||||||
an interrupt. Each time the button interrupt gives the semaphore, this task
|
an interrupt. Each time the button interrupt gives the semaphore, this task
|
||||||
will unblock, increment its execution counter, then return to block
|
will unblock, increment its execution counter, then return to block
|
||||||
again. */
|
again. */
|
||||||
|
|
||||||
/* Take the semaphore before started to ensure it is in the correct
|
/* Take the semaphore before started to ensure it is in the correct
|
||||||
state. */
|
state. */
|
||||||
xSemaphoreTake( xTestSemaphore, mainDONT_BLOCK );
|
xSemaphoreTake( xTestSemaphore, mainDONT_BLOCK );
|
||||||
|
|
||||||
for( ;; )
|
for( ;; )
|
||||||
{
|
{
|
||||||
xSemaphoreTake( xTestSemaphore, portMAX_DELAY );
|
xSemaphoreTake( xTestSemaphore, portMAX_DELAY );
|
||||||
|
@ -420,13 +420,13 @@ static void prvSetupHardware( void )
|
||||||
{
|
{
|
||||||
/* Setup STM32 system (clock, PLL and Flash configuration) */
|
/* Setup STM32 system (clock, PLL and Flash configuration) */
|
||||||
SystemInit();
|
SystemInit();
|
||||||
|
|
||||||
/* Ensure all priority bits are assigned as preemption priority bits. */
|
/* Ensure all priority bits are assigned as preemption priority bits. */
|
||||||
NVIC_PriorityGroupConfig( NVIC_PriorityGroup_4 );
|
NVIC_PriorityGroupConfig( NVIC_PriorityGroup_4 );
|
||||||
|
|
||||||
/* Setup the LED outputs. */
|
/* Setup the LED outputs. */
|
||||||
vParTestInitialise();
|
vParTestInitialise();
|
||||||
|
|
||||||
/* Configure the button input. This configures the interrupt to use the
|
/* Configure the button input. This configures the interrupt to use the
|
||||||
lowest interrupt priority, so it is ok to use the ISR safe FreeRTOS API
|
lowest interrupt priority, so it is ok to use the ISR safe FreeRTOS API
|
||||||
from the button interrupt handler. */
|
from the button interrupt handler. */
|
||||||
|
@ -444,18 +444,18 @@ void vApplicationTickHook( void )
|
||||||
|
|
||||||
/* Fill the FPU registers with 0. */
|
/* Fill the FPU registers with 0. */
|
||||||
vRegTestClearFlopRegistersToParameterValue( 0UL );
|
vRegTestClearFlopRegistersToParameterValue( 0UL );
|
||||||
|
|
||||||
/* Trigger a timer 2 interrupt, which will fill the registers with a
|
/* Trigger a timer 2 interrupt, which will fill the registers with a
|
||||||
different value and itself trigger a timer 3 interrupt. Note that the
|
different value and itself trigger a timer 3 interrupt. Note that the
|
||||||
timers are not actually used. The timer 2 and 3 interrupt vectors are
|
timers are not actually used. The timer 2 and 3 interrupt vectors are
|
||||||
just used for convenience. */
|
just used for convenience. */
|
||||||
NVIC_SetPendingIRQ( TIM2_IRQn );
|
NVIC_SetPendingIRQ( TIM2_IRQn );
|
||||||
|
|
||||||
/* Ensure that, after returning from the nested interrupts, all the FPU
|
/* Ensure that, after returning from the nested interrupts, all the FPU
|
||||||
registers contain the value to which they were set by the tick hook
|
registers contain the value to which they were set by the tick hook
|
||||||
function. */
|
function. */
|
||||||
configASSERT( ulRegTestCheckFlopRegistersContainParameterValue( 0UL ) );
|
configASSERT( ulRegTestCheckFlopRegistersContainParameterValue( 0UL ) );
|
||||||
|
|
||||||
ulFPUInterruptNesting--;
|
ulFPUInterruptNesting--;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -475,7 +475,7 @@ NVIC_InitTypeDef NVIC_InitStructure;
|
||||||
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
|
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
|
||||||
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
|
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
|
||||||
NVIC_Init( &NVIC_InitStructure );
|
NVIC_Init( &NVIC_InitStructure );
|
||||||
|
|
||||||
/* Enable the TIM3 interrupt in the NVIC. The timer itself is not used,
|
/* Enable the TIM3 interrupt in the NVIC. The timer itself is not used,
|
||||||
just its interrupt vector to force nesting from software. TIM2 must have
|
just its interrupt vector to force nesting from software. TIM2 must have
|
||||||
a lower priority than TIM3, and both must have priorities above
|
a lower priority than TIM3, and both must have priorities above
|
||||||
|
@ -493,7 +493,7 @@ void TIM3_IRQHandler( void )
|
||||||
/* Just to verify that the interrupt nesting behaves as expected, increment
|
/* Just to verify that the interrupt nesting behaves as expected, increment
|
||||||
ulFPUInterruptNesting on entry, and decrement it on exit. */
|
ulFPUInterruptNesting on entry, and decrement it on exit. */
|
||||||
ulFPUInterruptNesting++;
|
ulFPUInterruptNesting++;
|
||||||
|
|
||||||
/* This is the highest priority interrupt in the chain of forced nesting
|
/* This is the highest priority interrupt in the chain of forced nesting
|
||||||
interrupts, so latch the maximum value reached by ulFPUInterruptNesting.
|
interrupts, so latch the maximum value reached by ulFPUInterruptNesting.
|
||||||
This is done purely to allow verification that the nesting depth reaches
|
This is done purely to allow verification that the nesting depth reaches
|
||||||
|
@ -506,7 +506,7 @@ void TIM3_IRQHandler( void )
|
||||||
/* Fill the FPU registers with 99 to overwrite the values written by
|
/* Fill the FPU registers with 99 to overwrite the values written by
|
||||||
TIM2_IRQHandler(). */
|
TIM2_IRQHandler(). */
|
||||||
vRegTestClearFlopRegistersToParameterValue( 99UL );
|
vRegTestClearFlopRegistersToParameterValue( 99UL );
|
||||||
|
|
||||||
ulFPUInterruptNesting--;
|
ulFPUInterruptNesting--;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
@ -516,10 +516,10 @@ void TIM2_IRQHandler( void )
|
||||||
/* Just to verify that the interrupt nesting behaves as expected, increment
|
/* Just to verify that the interrupt nesting behaves as expected, increment
|
||||||
ulFPUInterruptNesting on entry, and decrement it on exit. */
|
ulFPUInterruptNesting on entry, and decrement it on exit. */
|
||||||
ulFPUInterruptNesting++;
|
ulFPUInterruptNesting++;
|
||||||
|
|
||||||
/* Fill the FPU registers with 1. */
|
/* Fill the FPU registers with 1. */
|
||||||
vRegTestClearFlopRegistersToParameterValue( 1UL );
|
vRegTestClearFlopRegistersToParameterValue( 1UL );
|
||||||
|
|
||||||
/* Trigger a timer 3 interrupt, which will fill the registers with a
|
/* Trigger a timer 3 interrupt, which will fill the registers with a
|
||||||
different value. */
|
different value. */
|
||||||
NVIC_SetPendingIRQ( TIM3_IRQn );
|
NVIC_SetPendingIRQ( TIM3_IRQn );
|
||||||
|
@ -528,7 +528,7 @@ void TIM2_IRQHandler( void )
|
||||||
registers contain the value to which they were set by this interrupt
|
registers contain the value to which they were set by this interrupt
|
||||||
function. */
|
function. */
|
||||||
configASSERT( ulRegTestCheckFlopRegistersContainParameterValue( 1UL ) );
|
configASSERT( ulRegTestCheckFlopRegistersContainParameterValue( 1UL ) );
|
||||||
|
|
||||||
ulFPUInterruptNesting--;
|
ulFPUInterruptNesting--;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
@ -556,28 +556,28 @@ static void prvOptionallyCreateComprehensveTestApplication( void )
|
||||||
|
|
||||||
/* Most importantly, start the tasks that use the FPU. */
|
/* Most importantly, start the tasks that use the FPU. */
|
||||||
vStartMathTasks( mainFLOP_TASK_PRIORITY );
|
vStartMathTasks( mainFLOP_TASK_PRIORITY );
|
||||||
|
|
||||||
/* Create the register check tasks, as described at the top of this
|
/* Create the register check tasks, as described at the top of this
|
||||||
file */
|
file */
|
||||||
xTaskCreate( vRegTest1Task, ( signed char * ) "Reg1", configMINIMAL_STACK_SIZE, ( void * ) NULL, tskIDLE_PRIORITY, NULL );
|
xTaskCreate( vRegTest1Task, "Reg1", configMINIMAL_STACK_SIZE, ( void * ) NULL, tskIDLE_PRIORITY, NULL );
|
||||||
xTaskCreate( vRegTest2Task, ( signed char * ) "Reg2", configMINIMAL_STACK_SIZE, ( void * ) NULL, tskIDLE_PRIORITY, NULL );
|
xTaskCreate( vRegTest2Task, "Reg2", configMINIMAL_STACK_SIZE, ( void * ) NULL, tskIDLE_PRIORITY, NULL );
|
||||||
|
|
||||||
/* Create the semaphore that is used to demonstrate a task being
|
/* Create the semaphore that is used to demonstrate a task being
|
||||||
synchronised with an interrupt. */
|
synchronised with an interrupt. */
|
||||||
vSemaphoreCreateBinary( xTestSemaphore );
|
vSemaphoreCreateBinary( xTestSemaphore );
|
||||||
|
|
||||||
/* Create the task that is unblocked by the demonstration interrupt. */
|
/* Create the task that is unblocked by the demonstration interrupt. */
|
||||||
xTaskCreate( prvButtonTestTask, ( signed char * ) "BtnTest", configMINIMAL_STACK_SIZE, ( void * ) NULL, tskIDLE_PRIORITY, NULL );
|
xTaskCreate( prvButtonTestTask, "BtnTest", configMINIMAL_STACK_SIZE, ( void * ) NULL, tskIDLE_PRIORITY, NULL );
|
||||||
|
|
||||||
/* Create the software timer that performs the 'check' functionality,
|
/* Create the software timer that performs the 'check' functionality,
|
||||||
as described at the top of this file. */
|
as described at the top of this file. */
|
||||||
xCheckTimer = xTimerCreate( ( const signed char * ) "CheckTimer",/* A text name, purely to help debugging. */
|
xCheckTimer = xTimerCreate( "CheckTimer", /* A text name, purely to help debugging. */
|
||||||
( mainCHECK_TIMER_PERIOD_MS ), /* The timer period, in this case 3000ms (3s). */
|
( mainCHECK_TIMER_PERIOD_MS ), /* The timer period, in this case 3000ms (3s). */
|
||||||
pdTRUE, /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */
|
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. */
|
( 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. */
|
prvCheckTimerCallback /* The callback function that inspects the status of all the other tasks. */
|
||||||
);
|
);
|
||||||
|
|
||||||
if( xCheckTimer != NULL )
|
if( xCheckTimer != NULL )
|
||||||
{
|
{
|
||||||
xTimerStart( xCheckTimer, mainDONT_BLOCK );
|
xTimerStart( xCheckTimer, mainDONT_BLOCK );
|
||||||
|
@ -607,12 +607,12 @@ long lHigherPriorityTaskWoken = pdFALSE;
|
||||||
/* Only line 6 is enabled, so there is no need to test which line generated
|
/* Only line 6 is enabled, so there is no need to test which line generated
|
||||||
the interrupt. */
|
the interrupt. */
|
||||||
EXTI_ClearITPendingBit( EXTI_Line6 );
|
EXTI_ClearITPendingBit( EXTI_Line6 );
|
||||||
|
|
||||||
/* This interrupt does nothing more than demonstrate how to synchronise a
|
/* This interrupt does nothing more than demonstrate how to synchronise a
|
||||||
task with an interrupt. First the handler releases a semaphore.
|
task with an interrupt. First the handler releases a semaphore.
|
||||||
lHigherPriorityTaskWoken has been initialised to zero. */
|
lHigherPriorityTaskWoken has been initialised to zero. */
|
||||||
xSemaphoreGiveFromISR( xTestSemaphore, &lHigherPriorityTaskWoken );
|
xSemaphoreGiveFromISR( xTestSemaphore, &lHigherPriorityTaskWoken );
|
||||||
|
|
||||||
/* If there was a task that was blocked on the semaphore, and giving the
|
/* If there was a task that was blocked on the semaphore, and giving the
|
||||||
semaphore caused the task to unblock, and the unblocked task has a priority
|
semaphore caused the task to unblock, and the unblocked task has a priority
|
||||||
higher than the currently executing task (the task that this interrupt
|
higher than the currently executing task (the task that this interrupt
|
||||||
|
|
|
@ -161,22 +161,22 @@ xQueueHandle xQueue;
|
||||||
{
|
{
|
||||||
/* Start the two tasks as described in the comments at the top of this
|
/* Start the two tasks as described in the comments at the top of this
|
||||||
file. */
|
file. */
|
||||||
xTaskCreate( prvQueueReceiveTask, /* The function that implements the task. */
|
xTaskCreate( prvQueueReceiveTask, /* The function that implements the task. */
|
||||||
( signed char * ) "Rx", /* The text name assigned to the task - for debug only as it is not used by the kernel. */
|
"Rx", /* The text name assigned to the task - for debug only as it is not used by the kernel. */
|
||||||
configMINIMAL_STACK_SIZE, /* The size of the stack to allocate to the task. */
|
configMINIMAL_STACK_SIZE, /* The size of the stack to allocate to the task. */
|
||||||
( void * ) xQueue, /* Pass the queue into the task using the task parameter. */
|
( void * ) xQueue, /* Pass the queue into the task using the task parameter. */
|
||||||
mainQUEUE_RECEIVE_TASK_PRIORITY, /* The priority assigned to the task. */
|
mainQUEUE_RECEIVE_TASK_PRIORITY, /* The priority assigned to the task. */
|
||||||
NULL ); /* The task handle is not required, so NULL is passed. */
|
NULL ); /* The task handle is not required, so NULL is passed. */
|
||||||
|
|
||||||
xTaskCreate( prvQueueSendTask, ( signed char * ) "TX", configMINIMAL_STACK_SIZE, ( void * ) xQueue, mainQUEUE_SEND_TASK_PRIORITY, NULL );
|
xTaskCreate( prvQueueSendTask, "TX", configMINIMAL_STACK_SIZE, ( void * ) xQueue, mainQUEUE_SEND_TASK_PRIORITY, NULL );
|
||||||
|
|
||||||
/* Create the blinky software timer as described at the top of this
|
/* Create the blinky software timer as described at the top of this
|
||||||
file. */
|
file. */
|
||||||
xTimer = xTimerCreate( ( const signed char * ) "Blinky",/* A text name, purely to help debugging. */
|
xTimer = xTimerCreate( "Blinky", /* A text name, purely to help debugging. */
|
||||||
( mainBLINKY_TIMER_PERIOD ), /* The timer period. */
|
( mainBLINKY_TIMER_PERIOD ),/* The timer period. */
|
||||||
pdTRUE, /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */
|
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. */
|
( void * ) 0, /* The ID is not used, so can be set to anything. */
|
||||||
prvBlinkyTimerCallback ); /* The callback function that inspects the status of all the other tasks. */
|
prvBlinkyTimerCallback ); /* The callback function that inspects the status of all the other tasks. */
|
||||||
|
|
||||||
configASSERT( xTimer );
|
configASSERT( xTimer );
|
||||||
|
|
||||||
|
|
|
@ -296,11 +296,11 @@ xTimerHandle xTimer = NULL;
|
||||||
|
|
||||||
/* Create the software timer that performs the 'check' functionality, as
|
/* Create the software timer that performs the 'check' functionality, as
|
||||||
described at the top of this file. */
|
described at the top of this file. */
|
||||||
xTimer = xTimerCreate( ( const signed char * ) "CheckTimer",/* A text name, purely to help debugging. */
|
xTimer = xTimerCreate( "CheckTimer", /* A text name, purely to help debugging. */
|
||||||
( mainCHECK_TIMER_PERIOD_MS ), /* The timer period, in this case 3000ms (3s). */
|
( mainCHECK_TIMER_PERIOD_MS ), /* The timer period, in this case 3000ms (3s). */
|
||||||
pdTRUE, /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */
|
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. */
|
( 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. */
|
prvCheckTimerCallback ); /* The callback function that inspects the status of all the other tasks. */
|
||||||
|
|
||||||
if( xTimer != NULL )
|
if( xTimer != NULL )
|
||||||
{
|
{
|
||||||
|
@ -448,7 +448,7 @@ char cIPAddress[ 20 ];
|
||||||
for a new connection by lowering the priority of the IP task to that of
|
for a new connection by lowering the priority of the IP task to that of
|
||||||
the Idle task. */
|
the Idle task. */
|
||||||
vTaskPrioritySet( NULL, tskIDLE_PRIORITY );
|
vTaskPrioritySet( NULL, tskIDLE_PRIORITY );
|
||||||
|
|
||||||
/* Disconnected - so no IP address. */
|
/* Disconnected - so no IP address. */
|
||||||
ili93xx_draw_string( ulXCoord, ulYCoord, ( uint8_t * ) "IP: " );
|
ili93xx_draw_string( ulXCoord, ulYCoord, ( uint8_t * ) "IP: " );
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
All rights reserved
|
All rights reserved
|
||||||
|
|
||||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
@ -171,11 +171,11 @@ xTimerHandle xCheckTimer = NULL;
|
||||||
|
|
||||||
/* Create the software timer that performs the 'check' functionality,
|
/* Create the software timer that performs the 'check' functionality,
|
||||||
as described at the top of this file. */
|
as described at the top of this file. */
|
||||||
xCheckTimer = xTimerCreate( ( const signed char * ) "CheckTimer",/* A text name, purely to help debugging. */
|
xCheckTimer = xTimerCreate( "CheckTimer", /* A text name, purely to help debugging. */
|
||||||
( mainCHECK_TIMER_PERIOD_MS ), /* The timer period, in this case 3000ms (3s). */
|
( mainCHECK_TIMER_PERIOD_MS ), /* The timer period, in this case 3000ms (3s). */
|
||||||
pdTRUE, /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */
|
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. */
|
( 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. */
|
prvCheckTimerCallback /* The callback function that inspects the status of all the other tasks. */
|
||||||
);
|
);
|
||||||
|
|
||||||
if( xCheckTimer != NULL )
|
if( xCheckTimer != NULL )
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
All rights reserved
|
All rights reserved
|
||||||
|
|
||||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
@ -171,8 +171,8 @@ void main_low_power( void )
|
||||||
configASSERT( xQueue );
|
configASSERT( xQueue );
|
||||||
|
|
||||||
/* Start the two tasks as described at the top of this file. */
|
/* Start the two tasks as described at the top of this file. */
|
||||||
xTaskCreate( prvQueueReceiveTask, ( const signed char * const ) "Rx", configMINIMAL_STACK_SIZE, NULL, configQUEUE_RECEIVE_TASK_PRIORITY, NULL );
|
xTaskCreate( prvQueueReceiveTask, "Rx", configMINIMAL_STACK_SIZE, NULL, configQUEUE_RECEIVE_TASK_PRIORITY, NULL );
|
||||||
xTaskCreate( prvQueueSendTask, ( const signed char * const ) "TX", configMINIMAL_STACK_SIZE, NULL, configQUEUE_SEND_TASK_PRIORITY, NULL );
|
xTaskCreate( prvQueueSendTask, "TX", configMINIMAL_STACK_SIZE, NULL, configQUEUE_SEND_TASK_PRIORITY, NULL );
|
||||||
|
|
||||||
/* Start the scheduler running running. */
|
/* Start the scheduler running running. */
|
||||||
vTaskStartScheduler();
|
vTaskStartScheduler();
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
All rights reserved
|
All rights reserved
|
||||||
|
|
||||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
@ -158,8 +158,8 @@ void vAltStartComTestTasks( unsigned portBASE_TYPE uxPriority, unsigned long ulB
|
||||||
xSerialPortInitMinimal( ulBaudRate, comBUFFER_LEN );
|
xSerialPortInitMinimal( ulBaudRate, comBUFFER_LEN );
|
||||||
|
|
||||||
/* The Tx task is spawned with a lower priority than the Rx task. */
|
/* The Tx task is spawned with a lower priority than the Rx task. */
|
||||||
xTaskCreate( vComTxTask, ( signed char * ) "COMTx", comSTACK_SIZE, NULL, uxPriority - 1, ( xTaskHandle * ) NULL );
|
xTaskCreate( vComTxTask, "COMTx", comSTACK_SIZE, NULL, uxPriority - 1, ( xTaskHandle * ) NULL );
|
||||||
xTaskCreate( vComRxTask, ( signed char * ) "COMRx", comSTACK_SIZE, NULL, uxPriority, ( xTaskHandle * ) NULL );
|
xTaskCreate( vComRxTask, "COMRx", comSTACK_SIZE, NULL, uxPriority, ( xTaskHandle * ) NULL );
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
All rights reserved
|
All rights reserved
|
||||||
|
|
||||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
@ -127,7 +127,7 @@ will remove items as they are added, meaning the send task should always find
|
||||||
the queue empty. */
|
the queue empty. */
|
||||||
#define mainQUEUE_LENGTH ( 1 )
|
#define mainQUEUE_LENGTH ( 1 )
|
||||||
|
|
||||||
/* Values passed to the two tasks just to check the task parameter
|
/* Values passed to the two tasks just to check the task parameter
|
||||||
functionality. */
|
functionality. */
|
||||||
#define mainQUEUE_SEND_PARAMETER ( 0x1111UL )
|
#define mainQUEUE_SEND_PARAMETER ( 0x1111UL )
|
||||||
#define mainQUEUE_RECEIVE_PARAMETER ( 0x22UL )
|
#define mainQUEUE_RECEIVE_PARAMETER ( 0x22UL )
|
||||||
|
@ -163,13 +163,13 @@ void main_blinky( void )
|
||||||
/* Start the two tasks as described in the comments at the top of this
|
/* Start the two tasks as described in the comments at the top of this
|
||||||
file. */
|
file. */
|
||||||
xTaskCreate( prvQueueReceiveTask, /* The function that implements the task. */
|
xTaskCreate( prvQueueReceiveTask, /* The function that implements the task. */
|
||||||
( signed char * ) "Rx", /* The text name assigned to the task - for debug only as it is not used by the kernel. */
|
"Rx", /* The text name assigned to the task - for debug only as it is not used by the kernel. */
|
||||||
configMINIMAL_STACK_SIZE, /* The size of the stack to allocate to the task. */
|
configMINIMAL_STACK_SIZE, /* The size of the stack to allocate to the task. */
|
||||||
( void * ) mainQUEUE_RECEIVE_PARAMETER, /* The parameter passed to the task - just to check the functionality. */
|
( void * ) mainQUEUE_RECEIVE_PARAMETER, /* The parameter passed to the task - just to check the functionality. */
|
||||||
mainQUEUE_RECEIVE_TASK_PRIORITY, /* The priority assigned to the task. */
|
mainQUEUE_RECEIVE_TASK_PRIORITY, /* The priority assigned to the task. */
|
||||||
NULL ); /* The task handle is not required, so NULL is passed. */
|
NULL ); /* The task handle is not required, so NULL is passed. */
|
||||||
|
|
||||||
xTaskCreate( prvQueueSendTask, ( signed char * ) "TX", configMINIMAL_STACK_SIZE, ( void * ) mainQUEUE_SEND_PARAMETER, mainQUEUE_SEND_TASK_PRIORITY, NULL );
|
xTaskCreate( prvQueueSendTask, "TX", configMINIMAL_STACK_SIZE, ( void * ) mainQUEUE_SEND_PARAMETER, mainQUEUE_SEND_TASK_PRIORITY, NULL );
|
||||||
|
|
||||||
/* Start the tasks and timer running. */
|
/* Start the tasks and timer running. */
|
||||||
vTaskStartScheduler();
|
vTaskStartScheduler();
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
All rights reserved
|
All rights reserved
|
||||||
|
|
||||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
@ -195,11 +195,11 @@ xTimerHandle xCheckTimer = NULL;
|
||||||
|
|
||||||
/* Create the software timer that performs the 'check' functionality,
|
/* Create the software timer that performs the 'check' functionality,
|
||||||
as described at the top of this file. */
|
as described at the top of this file. */
|
||||||
xCheckTimer = xTimerCreate( ( const signed char * ) "CheckTimer",/* A text name, purely to help debugging. */
|
xCheckTimer = xTimerCreate( "CheckTimer", /* A text name, purely to help debugging. */
|
||||||
( mainCHECK_TIMER_PERIOD_MS ), /* The timer period, in this case 3000ms (3s). */
|
( mainCHECK_TIMER_PERIOD_MS ), /* The timer period, in this case 3000ms (3s). */
|
||||||
pdTRUE, /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */
|
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. */
|
( 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. */
|
prvCheckTimerCallback /* The callback function that inspects the status of all the other tasks. */
|
||||||
);
|
);
|
||||||
|
|
||||||
if( xCheckTimer != NULL )
|
if( xCheckTimer != NULL )
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
All rights reserved
|
All rights reserved
|
||||||
|
|
||||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
@ -317,37 +317,37 @@ int main(void)
|
||||||
{
|
{
|
||||||
/* Start the two application specific demo tasks, as described in the
|
/* Start the two application specific demo tasks, as described in the
|
||||||
comments at the top of this file. */
|
comments at the top of this file. */
|
||||||
xTaskCreate( prvQueueReceiveTask, ( signed char * ) "Rx", configMINIMAL_STACK_SIZE, NULL, mainQUEUE_RECEIVE_TASK_PRIORITY, NULL );
|
xTaskCreate( prvQueueReceiveTask, "Rx", configMINIMAL_STACK_SIZE, NULL, mainQUEUE_RECEIVE_TASK_PRIORITY, NULL );
|
||||||
xTaskCreate( prvQueueSendTask, ( signed char * ) "TX", configMINIMAL_STACK_SIZE, NULL, mainQUEUE_SEND_TASK_PRIORITY, NULL );
|
xTaskCreate( prvQueueSendTask, "TX", configMINIMAL_STACK_SIZE, NULL, mainQUEUE_SEND_TASK_PRIORITY, NULL );
|
||||||
|
|
||||||
/* Create the software timer that is responsible for turning off the LED
|
/* Create the software timer that is responsible for turning off the LED
|
||||||
if the button is not pushed within 5000ms, as described at the top of
|
if the button is not pushed within 5000ms, as described at the top of
|
||||||
this file. */
|
this file. */
|
||||||
xLEDTimer = xTimerCreate( ( const signed char * ) "LEDTimer", /* A text name, purely to help debugging. */
|
xLEDTimer = xTimerCreate( "LEDTimer", /* A text name, purely to help debugging. */
|
||||||
( mainLED_TIMER_PERIOD_MS ), /* The timer period, in this case 5000ms (5s). */
|
( mainLED_TIMER_PERIOD_MS ),/* The timer period, in this case 5000ms (5s). */
|
||||||
pdFALSE, /* This is a one shot timer, so xAutoReload is set to pdFALSE. */
|
pdFALSE, /* This is a one shot timer, so xAutoReload is set to pdFALSE. */
|
||||||
( void * ) 0, /* The ID is not used, so can be set to anything. */
|
( void * ) 0, /* The ID is not used, so can be set to anything. */
|
||||||
prvLEDTimerCallback /* The callback function that switches the LED off. */
|
prvLEDTimerCallback /* The callback function that switches the LED off. */
|
||||||
);
|
);
|
||||||
|
|
||||||
/* Create the software timer that performs the 'check' functionality,
|
/* Create the software timer that performs the 'check' functionality,
|
||||||
as described at the top of this file. */
|
as described at the top of this file. */
|
||||||
xCheckTimer = xTimerCreate( ( const signed char * ) "CheckTimer",/* A text name, purely to help debugging. */
|
xCheckTimer = xTimerCreate( "CheckTimer", /* A text name, purely to help debugging. */
|
||||||
( mainCHECK_TIMER_PERIOD_MS ), /* The timer period, in this case 3000ms (3s). */
|
( mainCHECK_TIMER_PERIOD_MS ), /* The timer period, in this case 3000ms (3s). */
|
||||||
pdTRUE, /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */
|
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. */
|
( 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. */
|
prvCheckTimerCallback /* The callback function that inspects the status of all the other tasks. */
|
||||||
);
|
);
|
||||||
|
|
||||||
/* Create the software timer that performs the 'digit counting'
|
/* Create the software timer that performs the 'digit counting'
|
||||||
functionality, as described at the top of this file. */
|
functionality, as described at the top of this file. */
|
||||||
xDigitCounterTimer = xTimerCreate( ( const signed char * ) "DigitCounter", /* A text name, purely to help debugging. */
|
xDigitCounterTimer = xTimerCreate( "DigitCounter", /* A text name, purely to help debugging. */
|
||||||
( mainDIGIT_COUNTER_TIMER_PERIOD_MS ), /* The timer period, in this case 3000ms (3s). */
|
( mainDIGIT_COUNTER_TIMER_PERIOD_MS ), /* The timer period, in this case 3000ms (3s). */
|
||||||
pdTRUE, /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */
|
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. */
|
( void * ) 0, /* The ID is not used, so can be set to anything. */
|
||||||
prvDigitCounterTimerCallback /* The callback function that inspects the status of all the other tasks. */
|
prvDigitCounterTimerCallback /* The callback function that inspects the status of all the other tasks. */
|
||||||
);
|
);
|
||||||
|
|
||||||
/* Create a lot of 'standard demo' tasks. Over 40 tasks are created in
|
/* Create a lot of 'standard demo' tasks. Over 40 tasks are created in
|
||||||
this demo. For a much simpler demo, select the 'blinky' build
|
this demo. For a much simpler demo, select the 'blinky' build
|
||||||
configuration. */
|
configuration. */
|
||||||
|
@ -363,7 +363,7 @@ int main(void)
|
||||||
vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY );
|
vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY );
|
||||||
vStartCountingSemaphoreTasks();
|
vStartCountingSemaphoreTasks();
|
||||||
vStartDynamicPriorityTasks();
|
vStartDynamicPriorityTasks();
|
||||||
|
|
||||||
/* The suicide tasks must be created last, as they need to know how many
|
/* The suicide tasks must be created last, as they need to know how many
|
||||||
tasks were running prior to their creation in order to ascertain whether
|
tasks were running prior to their creation in order to ascertain whether
|
||||||
or not the correct/expected number of tasks are running at any given
|
or not the correct/expected number of tasks are running at any given
|
||||||
|
@ -426,7 +426,7 @@ static void prvCheckTimerCallback( xTimerHandle xTimer )
|
||||||
{
|
{
|
||||||
pcStatusMessage = "Error: ComTest\r\n";
|
pcStatusMessage = "Error: ComTest\r\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if( xAreTimerDemoTasksStillRunning( ( mainCHECK_TIMER_PERIOD_MS ) ) != pdTRUE )
|
if( xAreTimerDemoTasksStillRunning( ( mainCHECK_TIMER_PERIOD_MS ) ) != pdTRUE )
|
||||||
{
|
{
|
||||||
pcStatusMessage = "Error: TimerDemo";
|
pcStatusMessage = "Error: TimerDemo";
|
||||||
|
@ -441,12 +441,12 @@ static void prvCheckTimerCallback( xTimerHandle xTimer )
|
||||||
{
|
{
|
||||||
pcStatusMessage = "Error: CountSem";
|
pcStatusMessage = "Error: CountSem";
|
||||||
}
|
}
|
||||||
|
|
||||||
if( xAreDynamicPriorityTasksStillRunning() != pdTRUE )
|
if( xAreDynamicPriorityTasksStillRunning() != pdTRUE )
|
||||||
{
|
{
|
||||||
pcStatusMessage = "Error: DynamicPriority";
|
pcStatusMessage = "Error: DynamicPriority";
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Toggle the check LED to give an indication of the system status. If
|
/* Toggle the check LED to give an indication of the system status. If
|
||||||
the LED toggles every mainCHECK_TIMER_PERIOD_MS milliseconds then
|
the LED toggles every mainCHECK_TIMER_PERIOD_MS milliseconds then
|
||||||
everything is ok. A faster toggle indicates an error. vParTestToggleLED()
|
everything is ok. A faster toggle indicates an error. vParTestToggleLED()
|
||||||
|
@ -497,13 +497,13 @@ unsigned short usCheckLEDState;
|
||||||
the state of the check LED. A critical section is not required to access
|
the state of the check LED. A critical section is not required to access
|
||||||
the port as only one timer can be executing at any one time. */
|
the port as only one timer can be executing at any one time. */
|
||||||
usCheckLEDState = ( FM3_GPIO->PDOR3 & mainCHECK_LED );
|
usCheckLEDState = ( FM3_GPIO->PDOR3 & mainCHECK_LED );
|
||||||
|
|
||||||
/* Display the next number, counting up. */
|
/* Display the next number, counting up. */
|
||||||
FM3_GPIO->PDOR3 = usNumbersPatterns[ lCounter ] | usCheckLEDState;
|
FM3_GPIO->PDOR3 = usNumbersPatterns[ lCounter ] | usCheckLEDState;
|
||||||
|
|
||||||
/* Move onto the next digit. */
|
/* Move onto the next digit. */
|
||||||
lCounter++;
|
lCounter++;
|
||||||
|
|
||||||
/* Ensure the counter does not go off the end of the array. */
|
/* Ensure the counter does not go off the end of the array. */
|
||||||
if( lCounter >= lNumberOfDigits )
|
if( lCounter >= lNumberOfDigits )
|
||||||
{
|
{
|
||||||
|
@ -603,15 +603,15 @@ const unsigned short usButtonInputBit = 0x01U;
|
||||||
SystemCoreClockUpdate();
|
SystemCoreClockUpdate();
|
||||||
|
|
||||||
/* Initialise the IO used for the LEDs on the 7 segment displays. */
|
/* Initialise the IO used for the LEDs on the 7 segment displays. */
|
||||||
vParTestInitialise();
|
vParTestInitialise();
|
||||||
|
|
||||||
/* Set the switches to input (P18->P1F). */
|
/* Set the switches to input (P18->P1F). */
|
||||||
FM3_GPIO->DDR5 = 0x0000;
|
FM3_GPIO->DDR5 = 0x0000;
|
||||||
FM3_GPIO->PFR5 = 0x0000;
|
FM3_GPIO->PFR5 = 0x0000;
|
||||||
|
|
||||||
/* Assign the button input as GPIO. */
|
/* Assign the button input as GPIO. */
|
||||||
FM3_GPIO->PFR5 |= usButtonInputBit;
|
FM3_GPIO->PFR5 |= usButtonInputBit;
|
||||||
|
|
||||||
/* Button interrupt on falling edge. */
|
/* Button interrupt on falling edge. */
|
||||||
FM3_EXTI->ELVR = 0x0003;
|
FM3_EXTI->ELVR = 0x0003;
|
||||||
|
|
||||||
|
@ -620,7 +620,7 @@ const unsigned short usButtonInputBit = 0x01U;
|
||||||
|
|
||||||
/* Enable the button interrupt. */
|
/* Enable the button interrupt. */
|
||||||
FM3_EXTI->ENIR |= usButtonInputBit;
|
FM3_EXTI->ENIR |= usButtonInputBit;
|
||||||
|
|
||||||
/* Setup the GPIO and the NVIC for the switch used in this simple demo. */
|
/* Setup the GPIO and the NVIC for the switch used in this simple demo. */
|
||||||
NVIC_SetPriority( EXINT0_7_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY );
|
NVIC_SetPriority( EXINT0_7_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY );
|
||||||
NVIC_EnableIRQ( EXINT0_7_IRQn );
|
NVIC_EnableIRQ( EXINT0_7_IRQn );
|
||||||
|
@ -675,6 +675,6 @@ void vApplicationTickHook( void )
|
||||||
/* Call the periodic timer test, which tests the timer API functions that
|
/* Call the periodic timer test, which tests the timer API functions that
|
||||||
can be called from an ISR. */
|
can be called from an ISR. */
|
||||||
vTimerPeriodicISRTests();
|
vTimerPeriodicISRTests();
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
All rights reserved
|
All rights reserved
|
||||||
|
|
||||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
@ -175,7 +175,7 @@ int main(void)
|
||||||
{
|
{
|
||||||
/* Configure the NVIC, LED outputs and button inputs. */
|
/* Configure the NVIC, LED outputs and button inputs. */
|
||||||
prvSetupHardware();
|
prvSetupHardware();
|
||||||
|
|
||||||
/* Create the queue. */
|
/* Create the queue. */
|
||||||
xQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( unsigned long ) );
|
xQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( unsigned long ) );
|
||||||
|
|
||||||
|
@ -183,17 +183,17 @@ int main(void)
|
||||||
{
|
{
|
||||||
/* Start the two tasks as described in the comments at the top of this
|
/* Start the two tasks as described in the comments at the top of this
|
||||||
file. */
|
file. */
|
||||||
xTaskCreate( prvQueueReceiveTask, ( signed char * ) "Rx", configMINIMAL_STACK_SIZE, NULL, mainQUEUE_RECEIVE_TASK_PRIORITY, NULL );
|
xTaskCreate( prvQueueReceiveTask, "Rx", configMINIMAL_STACK_SIZE, NULL, mainQUEUE_RECEIVE_TASK_PRIORITY, NULL );
|
||||||
xTaskCreate( prvQueueSendTask, ( signed char * ) "TX", configMINIMAL_STACK_SIZE, NULL, mainQUEUE_SEND_TASK_PRIORITY, NULL );
|
xTaskCreate( prvQueueSendTask, "TX", configMINIMAL_STACK_SIZE, NULL, mainQUEUE_SEND_TASK_PRIORITY, NULL );
|
||||||
|
|
||||||
/* Create the software timer that is responsible for turning off the LED
|
/* Create the software timer that is responsible for turning off the LED
|
||||||
if the button is not pushed within 5000ms, as described at the top of
|
if the button is not pushed within 5000ms, as described at the top of
|
||||||
this file. */
|
this file. */
|
||||||
xLEDTimer = xTimerCreate( ( const signed char * ) "LEDTimer", /* A text name, purely to help debugging. */
|
xLEDTimer = xTimerCreate( "LEDTimer", /* A text name, purely to help debugging. */
|
||||||
( 5000 / portTICK_RATE_MS ), /* The timer period, in this case 5000ms (5s). */
|
( 5000 / portTICK_RATE_MS ), /* The timer period, in this case 5000ms (5s). */
|
||||||
pdFALSE, /* This is a one shot timer, so xAutoReload is set to pdFALSE. */
|
pdFALSE, /* This is a one shot timer, so xAutoReload is set to pdFALSE. */
|
||||||
( void * ) 0, /* The ID is not used, so can be set to anything. */
|
( void * ) 0, /* The ID is not used, so can be set to anything. */
|
||||||
vLEDTimerCallback /* The callback function that switches the LED off. */
|
vLEDTimerCallback /* The callback function that switches the LED off. */
|
||||||
);
|
);
|
||||||
|
|
||||||
/* Start the tasks and timer running. */
|
/* Start the tasks and timer running. */
|
||||||
|
@ -311,14 +311,14 @@ const unsigned short usButtonInputBit = 0x01U;
|
||||||
|
|
||||||
SystemInit();
|
SystemInit();
|
||||||
SystemCoreClockUpdate();
|
SystemCoreClockUpdate();
|
||||||
|
|
||||||
/* Analog inputs are not used on the LED outputs. */
|
/* Analog inputs are not used on the LED outputs. */
|
||||||
FM3_GPIO->ADE = 0x0000;
|
FM3_GPIO->ADE = 0x0000;
|
||||||
|
|
||||||
/* Set to output. */
|
/* Set to output. */
|
||||||
FM3_GPIO->DDR1 |= 0xFFFF;
|
FM3_GPIO->DDR1 |= 0xFFFF;
|
||||||
FM3_GPIO->DDR3 |= 0xFFFF;
|
FM3_GPIO->DDR3 |= 0xFFFF;
|
||||||
|
|
||||||
/* Set as GPIO. */
|
/* Set as GPIO. */
|
||||||
FM3_GPIO->PFR1 &= 0x0000;
|
FM3_GPIO->PFR1 &= 0x0000;
|
||||||
FM3_GPIO->PFR3 &= 0x0000;
|
FM3_GPIO->PFR3 &= 0x0000;
|
||||||
|
@ -326,14 +326,14 @@ const unsigned short usButtonInputBit = 0x01U;
|
||||||
/* Start with all LEDs off. */
|
/* Start with all LEDs off. */
|
||||||
FM3_GPIO->PDOR3 = 0xFFFF;
|
FM3_GPIO->PDOR3 = 0xFFFF;
|
||||||
FM3_GPIO->PDOR1 = 0xFFFF;
|
FM3_GPIO->PDOR1 = 0xFFFF;
|
||||||
|
|
||||||
/* Set the switches to input (P18->P1F). */
|
/* Set the switches to input (P18->P1F). */
|
||||||
FM3_GPIO->DDR5 = 0x0000;
|
FM3_GPIO->DDR5 = 0x0000;
|
||||||
FM3_GPIO->PFR5 = 0x0000;
|
FM3_GPIO->PFR5 = 0x0000;
|
||||||
|
|
||||||
/* Assign the button input as GPIO. */
|
/* Assign the button input as GPIO. */
|
||||||
FM3_GPIO->PFR5 |= usButtonInputBit;
|
FM3_GPIO->PFR5 |= usButtonInputBit;
|
||||||
|
|
||||||
/* Button interrupt on falling edge. */
|
/* Button interrupt on falling edge. */
|
||||||
FM3_EXTI->ELVR = 0x0003;
|
FM3_EXTI->ELVR = 0x0003;
|
||||||
|
|
||||||
|
@ -342,7 +342,7 @@ const unsigned short usButtonInputBit = 0x01U;
|
||||||
|
|
||||||
/* Enable the button interrupt. */
|
/* Enable the button interrupt. */
|
||||||
FM3_EXTI->ENIR |= usButtonInputBit;
|
FM3_EXTI->ENIR |= usButtonInputBit;
|
||||||
|
|
||||||
/* Setup the GPIO and the NVIC for the switch used in this simple demo. */
|
/* Setup the GPIO and the NVIC for the switch used in this simple demo. */
|
||||||
NVIC_SetPriority( EXINT0_7_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY );
|
NVIC_SetPriority( EXINT0_7_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY );
|
||||||
NVIC_EnableIRQ( EXINT0_7_IRQn );
|
NVIC_EnableIRQ( EXINT0_7_IRQn );
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
All rights reserved
|
All rights reserved
|
||||||
|
|
||||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
@ -318,37 +318,37 @@ int main(void)
|
||||||
{
|
{
|
||||||
/* Start the two application specific demo tasks, as described in the
|
/* Start the two application specific demo tasks, as described in the
|
||||||
comments at the top of this file. */
|
comments at the top of this file. */
|
||||||
xTaskCreate( prvQueueReceiveTask, ( signed char * ) "Rx", configMINIMAL_STACK_SIZE, NULL, mainQUEUE_RECEIVE_TASK_PRIORITY, NULL );
|
xTaskCreate( prvQueueReceiveTask, "Rx", configMINIMAL_STACK_SIZE, NULL, mainQUEUE_RECEIVE_TASK_PRIORITY, NULL );
|
||||||
xTaskCreate( prvQueueSendTask, ( signed char * ) "TX", configMINIMAL_STACK_SIZE, NULL, mainQUEUE_SEND_TASK_PRIORITY, NULL );
|
xTaskCreate( prvQueueSendTask, "TX", configMINIMAL_STACK_SIZE, NULL, mainQUEUE_SEND_TASK_PRIORITY, NULL );
|
||||||
|
|
||||||
/* Create the software timer that is responsible for turning off the LED
|
/* Create the software timer that is responsible for turning off the LED
|
||||||
if the button is not pushed within 5000ms, as described at the top of
|
if the button is not pushed within 5000ms, as described at the top of
|
||||||
this file. */
|
this file. */
|
||||||
xLEDTimer = xTimerCreate( ( const signed char * ) "LEDTimer", /* A text name, purely to help debugging. */
|
xLEDTimer = xTimerCreate( "LEDTimer", /* A text name, purely to help debugging. */
|
||||||
( mainLED_TIMER_PERIOD_MS ), /* The timer period, in this case 5000ms (5s). */
|
( mainLED_TIMER_PERIOD_MS ),/* The timer period, in this case 5000ms (5s). */
|
||||||
pdFALSE, /* This is a one shot timer, so xAutoReload is set to pdFALSE. */
|
pdFALSE, /* This is a one shot timer, so xAutoReload is set to pdFALSE. */
|
||||||
( void * ) 0, /* The ID is not used, so can be set to anything. */
|
( void * ) 0, /* The ID is not used, so can be set to anything. */
|
||||||
prvLEDTimerCallback /* The callback function that switches the LED off. */
|
prvLEDTimerCallback /* The callback function that switches the LED off. */
|
||||||
);
|
);
|
||||||
|
|
||||||
/* Create the software timer that performs the 'check' functionality,
|
/* Create the software timer that performs the 'check' functionality,
|
||||||
as described at the top of this file. */
|
as described at the top of this file. */
|
||||||
xCheckTimer = xTimerCreate( ( const signed char * ) "CheckTimer",/* A text name, purely to help debugging. */
|
xCheckTimer = xTimerCreate( "CheckTimer", /* A text name, purely to help debugging. */
|
||||||
( mainCHECK_TIMER_PERIOD_MS ), /* The timer period, in this case 3000ms (3s). */
|
( mainCHECK_TIMER_PERIOD_MS ), /* The timer period, in this case 3000ms (3s). */
|
||||||
pdTRUE, /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */
|
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. */
|
( 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. */
|
prvCheckTimerCallback /* The callback function that inspects the status of all the other tasks. */
|
||||||
);
|
);
|
||||||
|
|
||||||
/* Create the software timer that performs the 'digit counting'
|
/* Create the software timer that performs the 'digit counting'
|
||||||
functionality, as described at the top of this file. */
|
functionality, as described at the top of this file. */
|
||||||
xDigitCounterTimer = xTimerCreate( ( const signed char * ) "DigitCounter", /* A text name, purely to help debugging. */
|
xDigitCounterTimer = xTimerCreate( "DigitCounter", /* A text name, purely to help debugging. */
|
||||||
( mainDIGIT_COUNTER_TIMER_PERIOD_MS ), /* The timer period, in this case 3000ms (3s). */
|
( mainDIGIT_COUNTER_TIMER_PERIOD_MS ), /* The timer period, in this case 3000ms (3s). */
|
||||||
pdTRUE, /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */
|
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. */
|
( void * ) 0, /* The ID is not used, so can be set to anything. */
|
||||||
prvDigitCounterTimerCallback /* The callback function that inspects the status of all the other tasks. */
|
prvDigitCounterTimerCallback /* The callback function that inspects the status of all the other tasks. */
|
||||||
);
|
);
|
||||||
|
|
||||||
/* Create a lot of 'standard demo' tasks. Over 40 tasks are created in
|
/* Create a lot of 'standard demo' tasks. Over 40 tasks are created in
|
||||||
this demo. For a much simpler demo, select the 'blinky' build
|
this demo. For a much simpler demo, select the 'blinky' build
|
||||||
configuration. */
|
configuration. */
|
||||||
|
@ -364,7 +364,7 @@ int main(void)
|
||||||
vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY );
|
vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY );
|
||||||
vStartCountingSemaphoreTasks();
|
vStartCountingSemaphoreTasks();
|
||||||
vStartDynamicPriorityTasks();
|
vStartDynamicPriorityTasks();
|
||||||
|
|
||||||
/* The suicide tasks must be created last, as they need to know how many
|
/* The suicide tasks must be created last, as they need to know how many
|
||||||
tasks were running prior to their creation in order to ascertain whether
|
tasks were running prior to their creation in order to ascertain whether
|
||||||
or not the correct/expected number of tasks are running at any given
|
or not the correct/expected number of tasks are running at any given
|
||||||
|
@ -427,7 +427,7 @@ static void prvCheckTimerCallback( xTimerHandle xTimer )
|
||||||
{
|
{
|
||||||
pcStatusMessage = "Error: ComTest\r\n";
|
pcStatusMessage = "Error: ComTest\r\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if( xAreTimerDemoTasksStillRunning( ( mainCHECK_TIMER_PERIOD_MS ) ) != pdTRUE )
|
if( xAreTimerDemoTasksStillRunning( ( mainCHECK_TIMER_PERIOD_MS ) ) != pdTRUE )
|
||||||
{
|
{
|
||||||
pcStatusMessage = "Error: TimerDemo";
|
pcStatusMessage = "Error: TimerDemo";
|
||||||
|
@ -442,12 +442,12 @@ static void prvCheckTimerCallback( xTimerHandle xTimer )
|
||||||
{
|
{
|
||||||
pcStatusMessage = "Error: CountSem";
|
pcStatusMessage = "Error: CountSem";
|
||||||
}
|
}
|
||||||
|
|
||||||
if( xAreDynamicPriorityTasksStillRunning() != pdTRUE )
|
if( xAreDynamicPriorityTasksStillRunning() != pdTRUE )
|
||||||
{
|
{
|
||||||
pcStatusMessage = "Error: DynamicPriority";
|
pcStatusMessage = "Error: DynamicPriority";
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Toggle the check LED to give an indication of the system status. If
|
/* Toggle the check LED to give an indication of the system status. If
|
||||||
the LED toggles every mainCHECK_TIMER_PERIOD_MS milliseconds then
|
the LED toggles every mainCHECK_TIMER_PERIOD_MS milliseconds then
|
||||||
everything is ok. A faster toggle indicates an error. */
|
everything is ok. A faster toggle indicates an error. */
|
||||||
|
@ -485,9 +485,9 @@ const long lNumberOfDigits = 10L;
|
||||||
/* Display the next number, counting up. */
|
/* Display the next number, counting up. */
|
||||||
FM3_GPIO->PDOR1 = usNumbersPatterns[ lCounter ];
|
FM3_GPIO->PDOR1 = usNumbersPatterns[ lCounter ];
|
||||||
|
|
||||||
/* Move onto the next digit. */
|
/* Move onto the next digit. */
|
||||||
lCounter++;
|
lCounter++;
|
||||||
|
|
||||||
/* Ensure the counter does not go off the end of the array. */
|
/* Ensure the counter does not go off the end of the array. */
|
||||||
if( lCounter >= lNumberOfDigits )
|
if( lCounter >= lNumberOfDigits )
|
||||||
{
|
{
|
||||||
|
@ -587,15 +587,15 @@ const unsigned short usButtonInputBit = 0x01U;
|
||||||
SystemCoreClockUpdate();
|
SystemCoreClockUpdate();
|
||||||
|
|
||||||
/* Initialise the IO used for the LEDs on the 7 segment displays. */
|
/* Initialise the IO used for the LEDs on the 7 segment displays. */
|
||||||
vParTestInitialise();
|
vParTestInitialise();
|
||||||
|
|
||||||
/* Set the switches to input (P18->P1F). */
|
/* Set the switches to input (P18->P1F). */
|
||||||
FM3_GPIO->DDR5 = 0x0000;
|
FM3_GPIO->DDR5 = 0x0000;
|
||||||
FM3_GPIO->PFR5 = 0x0000;
|
FM3_GPIO->PFR5 = 0x0000;
|
||||||
|
|
||||||
/* Assign the button input as GPIO. */
|
/* Assign the button input as GPIO. */
|
||||||
FM3_GPIO->PFR1 |= usButtonInputBit;
|
FM3_GPIO->PFR1 |= usButtonInputBit;
|
||||||
|
|
||||||
/* Button interrupt on falling edge. */
|
/* Button interrupt on falling edge. */
|
||||||
FM3_EXTI->ELVR = 0x0003;
|
FM3_EXTI->ELVR = 0x0003;
|
||||||
|
|
||||||
|
@ -604,7 +604,7 @@ const unsigned short usButtonInputBit = 0x01U;
|
||||||
|
|
||||||
/* Enable the button interrupt. */
|
/* Enable the button interrupt. */
|
||||||
FM3_EXTI->ENIR |= usButtonInputBit;
|
FM3_EXTI->ENIR |= usButtonInputBit;
|
||||||
|
|
||||||
/* Setup the GPIO and the NVIC for the switch used in this simple demo. */
|
/* Setup the GPIO and the NVIC for the switch used in this simple demo. */
|
||||||
NVIC_SetPriority( EXINT0_7_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY );
|
NVIC_SetPriority( EXINT0_7_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY );
|
||||||
NVIC_EnableIRQ( EXINT0_7_IRQn );
|
NVIC_EnableIRQ( EXINT0_7_IRQn );
|
||||||
|
@ -659,6 +659,6 @@ void vApplicationTickHook( void )
|
||||||
/* Call the periodic timer test, which tests the timer API functions that
|
/* Call the periodic timer test, which tests the timer API functions that
|
||||||
can be called from an ISR. */
|
can be called from an ISR. */
|
||||||
vTimerPeriodicISRTests();
|
vTimerPeriodicISRTests();
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
All rights reserved
|
All rights reserved
|
||||||
|
|
||||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
@ -184,17 +184,17 @@ int main(void)
|
||||||
{
|
{
|
||||||
/* Start the two tasks as described in the comments at the top of this
|
/* Start the two tasks as described in the comments at the top of this
|
||||||
file. */
|
file. */
|
||||||
xTaskCreate( prvQueueReceiveTask, ( signed char * ) "Rx", configMINIMAL_STACK_SIZE, NULL, mainQUEUE_RECEIVE_TASK_PRIORITY, NULL );
|
xTaskCreate( prvQueueReceiveTask, "Rx", configMINIMAL_STACK_SIZE, NULL, mainQUEUE_RECEIVE_TASK_PRIORITY, NULL );
|
||||||
xTaskCreate( prvQueueSendTask, ( signed char * ) "TX", configMINIMAL_STACK_SIZE, NULL, mainQUEUE_SEND_TASK_PRIORITY, NULL );
|
xTaskCreate( prvQueueSendTask, "TX", configMINIMAL_STACK_SIZE, NULL, mainQUEUE_SEND_TASK_PRIORITY, NULL );
|
||||||
|
|
||||||
/* Create the software timer that is responsible for turning off the LED
|
/* Create the software timer that is responsible for turning off the LED
|
||||||
if the button is not pushed within 5000ms, as described at the top of
|
if the button is not pushed within 5000ms, as described at the top of
|
||||||
this file. */
|
this file. */
|
||||||
xLEDTimer = xTimerCreate( ( const signed char * ) "LEDTimer", /* A text name, purely to help debugging. */
|
xLEDTimer = xTimerCreate( "LEDTimer", /* A text name, purely to help debugging. */
|
||||||
( 5000 / portTICK_RATE_MS ), /* The timer period, in this case 5000ms (5s). */
|
( 5000 / portTICK_RATE_MS ),/* The timer period, in this case 5000ms (5s). */
|
||||||
pdFALSE, /* This is a one shot timer, so xAutoReload is set to pdFALSE. */
|
pdFALSE, /* This is a one shot timer, so xAutoReload is set to pdFALSE. */
|
||||||
( void * ) 0, /* The ID is not used, so can be set to anything. */
|
( void * ) 0, /* The ID is not used, so can be set to anything. */
|
||||||
vLEDTimerCallback /* The callback function that switches the LED off. */
|
vLEDTimerCallback /* The callback function that switches the LED off. */
|
||||||
);
|
);
|
||||||
|
|
||||||
/* Start the tasks and timer running. */
|
/* Start the tasks and timer running. */
|
||||||
|
@ -313,29 +313,29 @@ const unsigned short usGPIOState = 0xFF00U;
|
||||||
|
|
||||||
SystemInit();
|
SystemInit();
|
||||||
SystemCoreClockUpdate();
|
SystemCoreClockUpdate();
|
||||||
|
|
||||||
/* Analog inputs are not used on the LED outputs. */
|
/* Analog inputs are not used on the LED outputs. */
|
||||||
FM3_GPIO->ADE = 0x00FF;
|
FM3_GPIO->ADE = 0x00FF;
|
||||||
|
|
||||||
/* LED seg1 to GPIO output (P18->P1F). */
|
/* LED seg1 to GPIO output (P18->P1F). */
|
||||||
FM3_GPIO->DDR1 = 0xFF00;
|
FM3_GPIO->DDR1 = 0xFF00;
|
||||||
FM3_GPIO->PFR1 = 0x0000;
|
FM3_GPIO->PFR1 = 0x0000;
|
||||||
|
|
||||||
/* LED seg2 to GPIO output (P30->P3F). */
|
/* LED seg2 to GPIO output (P30->P3F). */
|
||||||
FM3_GPIO->DDR3 = 0xFF00;
|
FM3_GPIO->DDR3 = 0xFF00;
|
||||||
FM3_GPIO->PFR3 = 0x0000;
|
FM3_GPIO->PFR3 = 0x0000;
|
||||||
|
|
||||||
/* Start with all LEDs off. */
|
/* Start with all LEDs off. */
|
||||||
FM3_GPIO->PDOR3 = usGPIOState;
|
FM3_GPIO->PDOR3 = usGPIOState;
|
||||||
FM3_GPIO->PDOR1 = usGPIOState;
|
FM3_GPIO->PDOR1 = usGPIOState;
|
||||||
|
|
||||||
/* Set the switches to input (P18->P1F). */
|
/* Set the switches to input (P18->P1F). */
|
||||||
FM3_GPIO->DDR5 = 0x0000;
|
FM3_GPIO->DDR5 = 0x0000;
|
||||||
FM3_GPIO->PFR5 = 0x0000;
|
FM3_GPIO->PFR5 = 0x0000;
|
||||||
|
|
||||||
/* Assign the button input as GPIO. */
|
/* Assign the button input as GPIO. */
|
||||||
FM3_GPIO->PFR1 |= usButtonInputBit;
|
FM3_GPIO->PFR1 |= usButtonInputBit;
|
||||||
|
|
||||||
/* Button interrupt on falling edge. */
|
/* Button interrupt on falling edge. */
|
||||||
FM3_EXTI->ELVR = 0x0003;
|
FM3_EXTI->ELVR = 0x0003;
|
||||||
|
|
||||||
|
@ -344,7 +344,7 @@ const unsigned short usGPIOState = 0xFF00U;
|
||||||
|
|
||||||
/* Enable the button interrupt. */
|
/* Enable the button interrupt. */
|
||||||
FM3_EXTI->ENIR |= usButtonInputBit;
|
FM3_EXTI->ENIR |= usButtonInputBit;
|
||||||
|
|
||||||
/* Setup the GPIO and the NVIC for the switch used in this simple demo. */
|
/* Setup the GPIO and the NVIC for the switch used in this simple demo. */
|
||||||
NVIC_SetPriority( EXINT0_7_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY );
|
NVIC_SetPriority( EXINT0_7_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY );
|
||||||
NVIC_EnableIRQ( EXINT0_7_IRQn );
|
NVIC_EnableIRQ( EXINT0_7_IRQn );
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
All rights reserved
|
All rights reserved
|
||||||
|
|
||||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
@ -239,7 +239,7 @@ structure passed to the xTaskCreateRestricted() function. */
|
||||||
static const xTaskParameters xCheckTaskParameters =
|
static const xTaskParameters xCheckTaskParameters =
|
||||||
{
|
{
|
||||||
prvCheckTask, /* pvTaskCode - the function that implements the task. */
|
prvCheckTask, /* pvTaskCode - the function that implements the task. */
|
||||||
( signed char * ) "Check", /* pcName */
|
"Check", /* pcName */
|
||||||
mainCHECK_TASK_STACK_SIZE_WORDS, /* usStackDepth - defined in words, not bytes. */
|
mainCHECK_TASK_STACK_SIZE_WORDS, /* usStackDepth - defined in words, not bytes. */
|
||||||
( void * ) 0x12121212, /* pvParameters - this value is just to test that the parameter is being passed into the task correctly. */
|
( void * ) 0x12121212, /* pvParameters - this value is just to test that the parameter is being passed into the task correctly. */
|
||||||
( tskIDLE_PRIORITY + 1 ) | portPRIVILEGE_BIT,/* uxPriority - this is the highest priority task in the system. The task is created in privileged mode to demonstrate accessing the privileged only data. */
|
( tskIDLE_PRIORITY + 1 ) | portPRIVILEGE_BIT,/* uxPriority - this is the highest priority task in the system. The task is created in privileged mode to demonstrate accessing the privileged only data. */
|
||||||
|
@ -280,7 +280,7 @@ static portSTACK_TYPE xRegTest2Stack[ mainREG_TEST_STACK_SIZE_WORDS ] mainALIGN_
|
||||||
static const xTaskParameters xRegTest1Parameters =
|
static const xTaskParameters xRegTest1Parameters =
|
||||||
{
|
{
|
||||||
prvRegTest1Task, /* pvTaskCode - the function that implements the task. */
|
prvRegTest1Task, /* pvTaskCode - the function that implements the task. */
|
||||||
( signed char * ) "RegTest1", /* pcName */
|
"RegTest1", /* pcName */
|
||||||
mainREG_TEST_STACK_SIZE_WORDS, /* usStackDepth */
|
mainREG_TEST_STACK_SIZE_WORDS, /* usStackDepth */
|
||||||
( void * ) 0x12345678, /* pvParameters - this value is just to test that the parameter is being passed into the task correctly. */
|
( void * ) 0x12345678, /* pvParameters - this value is just to test that the parameter is being passed into the task correctly. */
|
||||||
tskIDLE_PRIORITY | portPRIVILEGE_BIT, /* uxPriority - note that this task is created with privileges to demonstrate one method of passing a queue handle into the task. */
|
tskIDLE_PRIORITY | portPRIVILEGE_BIT, /* uxPriority - note that this task is created with privileges to demonstrate one method of passing a queue handle into the task. */
|
||||||
|
@ -297,7 +297,7 @@ static const xTaskParameters xRegTest1Parameters =
|
||||||
static xTaskParameters xRegTest2Parameters =
|
static xTaskParameters xRegTest2Parameters =
|
||||||
{
|
{
|
||||||
prvRegTest2Task, /* pvTaskCode - the function that implements the task. */
|
prvRegTest2Task, /* pvTaskCode - the function that implements the task. */
|
||||||
( signed char * ) "RegTest2", /* pcName */
|
"RegTest2", /* pcName */
|
||||||
mainREG_TEST_STACK_SIZE_WORDS, /* usStackDepth */
|
mainREG_TEST_STACK_SIZE_WORDS, /* usStackDepth */
|
||||||
( void * ) NULL, /* pvParameters - this task uses the parameter to pass in a queue handle, but the queue is not created yet. */
|
( void * ) NULL, /* pvParameters - this task uses the parameter to pass in a queue handle, but the queue is not created yet. */
|
||||||
tskIDLE_PRIORITY, /* uxPriority */
|
tskIDLE_PRIORITY, /* uxPriority */
|
||||||
|
@ -334,7 +334,7 @@ int main( void )
|
||||||
/* Create the tasks that are created using the original xTaskCreate() API
|
/* Create the tasks that are created using the original xTaskCreate() API
|
||||||
function. */
|
function. */
|
||||||
xTaskCreate( prvOldStyleUserModeTask, /* The function that implements the task. */
|
xTaskCreate( prvOldStyleUserModeTask, /* The function that implements the task. */
|
||||||
( signed char * ) "Task1", /* Text name for the task. */
|
"Task1", /* Text name for the task. */
|
||||||
100, /* Stack depth in words. */
|
100, /* Stack depth in words. */
|
||||||
NULL, /* Task parameters. */
|
NULL, /* Task parameters. */
|
||||||
3, /* Priority and mode (user in this case). */
|
3, /* Priority and mode (user in this case). */
|
||||||
|
@ -342,7 +342,7 @@ int main( void )
|
||||||
);
|
);
|
||||||
|
|
||||||
xTaskCreate( prvOldStylePrivilegedModeTask, /* The function that implements the task. */
|
xTaskCreate( prvOldStylePrivilegedModeTask, /* The function that implements the task. */
|
||||||
( signed char * ) "Task2", /* Text name for the task. */
|
"Task2", /* Text name for the task. */
|
||||||
100, /* Stack depth in words. */
|
100, /* Stack depth in words. */
|
||||||
NULL, /* Task parameters. */
|
NULL, /* Task parameters. */
|
||||||
( 3 | portPRIVILEGE_BIT ), /* Priority and mode. */
|
( 3 | portPRIVILEGE_BIT ), /* Priority and mode. */
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
All rights reserved
|
All rights reserved
|
||||||
|
|
||||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
@ -71,7 +71,7 @@
|
||||||
* User mode and Privileged mode, and using both the original xTaskCreate() and
|
* User mode and Privileged mode, and using both the original xTaskCreate() and
|
||||||
* the new xTaskCreateRestricted() API functions. The purpose of each created
|
* the new xTaskCreateRestricted() API functions. The purpose of each created
|
||||||
* task is documented in the comments above the task function prototype (in
|
* task is documented in the comments above the task function prototype (in
|
||||||
* this file), with the task behaviour demonstrated and documented within the
|
* this file), with the task behaviour demonstrated and documented within the
|
||||||
* task function itself. In addition a queue is used to demonstrate passing
|
* task function itself. In addition a queue is used to demonstrate passing
|
||||||
* data between protected/restricted tasks as well as passing data between an
|
* data between protected/restricted tasks as well as passing data between an
|
||||||
* interrupt and a protected/restricted task.
|
* interrupt and a protected/restricted task.
|
||||||
|
@ -117,7 +117,7 @@ achieved. */
|
||||||
/* Prototypes for functions that implement tasks. -----------*/
|
/* Prototypes for functions that implement tasks. -----------*/
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Prototype for the reg test tasks. Amongst other things, these fill the CPU
|
* Prototype for the reg test tasks. Amongst other things, these fill the CPU
|
||||||
* registers with known values before checking that the registers still contain
|
* registers with known values before checking that the registers still contain
|
||||||
* the expected values. Each of the two tasks use different values so an error
|
* the expected values. Each of the two tasks use different values so an error
|
||||||
|
@ -147,15 +147,15 @@ static void prvRegTest2Task( void *pvParameters );
|
||||||
static void prvCheckTask( void *pvParameters );
|
static void prvCheckTask( void *pvParameters );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Prototype for a task created in User mode using the original vTaskCreate()
|
* Prototype for a task created in User mode using the original vTaskCreate()
|
||||||
* API function. The task demonstrates the characteristics of such a task,
|
* API function. The task demonstrates the characteristics of such a task,
|
||||||
* before simply deleting itself.
|
* before simply deleting itself.
|
||||||
*/
|
*/
|
||||||
static void prvOldStyleUserModeTask( void *pvParameters );
|
static void prvOldStyleUserModeTask( void *pvParameters );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Prototype for a task created in Privileged mode using the original
|
* Prototype for a task created in Privileged mode using the original
|
||||||
* vTaskCreate() API function. The task demonstrates the characteristics of
|
* vTaskCreate() API function. The task demonstrates the characteristics of
|
||||||
* such a task, before simply deleting itself.
|
* such a task, before simply deleting itself.
|
||||||
*/
|
*/
|
||||||
static void prvOldStylePrivilegedModeTask( void *pvParameters );
|
static void prvOldStylePrivilegedModeTask( void *pvParameters );
|
||||||
|
@ -200,7 +200,7 @@ static void prvTestMemoryRegions( void );
|
||||||
/* The handle of the queue used to communicate between tasks and between tasks
|
/* The handle of the queue used to communicate between tasks and between tasks
|
||||||
and interrupts. Note that this is a file scope variable that falls outside of
|
and interrupts. Note that this is a file scope variable that falls outside of
|
||||||
any MPU region. As such other techniques have to be used to allow the tasks
|
any MPU region. As such other techniques have to be used to allow the tasks
|
||||||
to gain access to the queue. See the comments in the tasks themselves for
|
to gain access to the queue. See the comments in the tasks themselves for
|
||||||
further information. */
|
further information. */
|
||||||
static xQueueHandle xFileScopeCheckQueue = NULL;
|
static xQueueHandle xFileScopeCheckQueue = NULL;
|
||||||
|
|
||||||
|
@ -216,8 +216,8 @@ stack size is defined in words, not bytes. */
|
||||||
#define mainCHECK_TASK_STACK_ALIGNMENT ( mainCHECK_TASK_STACK_SIZE_WORDS * sizeof( portSTACK_TYPE ) )
|
#define mainCHECK_TASK_STACK_ALIGNMENT ( mainCHECK_TASK_STACK_SIZE_WORDS * sizeof( portSTACK_TYPE ) )
|
||||||
|
|
||||||
/* Declare the stack that will be used by the check task. The kernel will
|
/* Declare the stack that will be used by the check task. The kernel will
|
||||||
automatically create an MPU region for the stack. The stack alignment must
|
automatically create an MPU region for the stack. The stack alignment must
|
||||||
match its size, so if 128 words are reserved for the stack then it must be
|
match its size, so if 128 words are reserved for the stack then it must be
|
||||||
aligned to ( 128 * 4 ) bytes. */
|
aligned to ( 128 * 4 ) bytes. */
|
||||||
static portSTACK_TYPE xCheckTaskStack[ mainCHECK_TASK_STACK_SIZE_WORDS ] mainALIGN_TO( mainCHECK_TASK_STACK_ALIGNMENT );
|
static portSTACK_TYPE xCheckTaskStack[ mainCHECK_TASK_STACK_SIZE_WORDS ] mainALIGN_TO( mainCHECK_TASK_STACK_ALIGNMENT );
|
||||||
|
|
||||||
|
@ -226,9 +226,9 @@ using the xTaskParameters structure below. THIS IS JUST TO DEMONSTRATE THE
|
||||||
MPU FUNCTIONALITY, the data is not used by the check tasks primary function
|
MPU FUNCTIONALITY, the data is not used by the check tasks primary function
|
||||||
of monitoring the reg test tasks and printing out status information.
|
of monitoring the reg test tasks and printing out status information.
|
||||||
|
|
||||||
Note that the arrays allocate slightly more RAM than is actually assigned to
|
Note that the arrays allocate slightly more RAM than is actually assigned to
|
||||||
the MPU region. This is to permit writes off the end of the array to be
|
the MPU region. This is to permit writes off the end of the array to be
|
||||||
detected even when the arrays are placed in adjacent memory locations (with no
|
detected even when the arrays are placed in adjacent memory locations (with no
|
||||||
gaps between them). The align size must be a power of two. */
|
gaps between them). The align size must be a power of two. */
|
||||||
#define mainREAD_WRITE_ARRAY_SIZE 130
|
#define mainREAD_WRITE_ARRAY_SIZE 130
|
||||||
#define mainREAD_WRITE_ALIGN_SIZE 128
|
#define mainREAD_WRITE_ALIGN_SIZE 128
|
||||||
|
@ -247,7 +247,7 @@ structure passed to the xTaskCreateRestricted() function. */
|
||||||
static const xTaskParameters xCheckTaskParameters =
|
static const xTaskParameters xCheckTaskParameters =
|
||||||
{
|
{
|
||||||
prvCheckTask, /* pvTaskCode - the function that implements the task. */
|
prvCheckTask, /* pvTaskCode - the function that implements the task. */
|
||||||
( signed char * ) "Check", /* pcName */
|
"Check", /* pcName */
|
||||||
mainCHECK_TASK_STACK_SIZE_WORDS, /* usStackDepth - defined in words, not bytes. */
|
mainCHECK_TASK_STACK_SIZE_WORDS, /* usStackDepth - defined in words, not bytes. */
|
||||||
( void * ) 0x12121212, /* pvParameters - this value is just to test that the parameter is being passed into the task correctly. */
|
( void * ) 0x12121212, /* pvParameters - this value is just to test that the parameter is being passed into the task correctly. */
|
||||||
( tskIDLE_PRIORITY + 1 ) | portPRIVILEGE_BIT,/* uxPriority - this is the highest priority task in the system. The task is created in privileged mode to demonstrate accessing the privileged only data. */
|
( tskIDLE_PRIORITY + 1 ) | portPRIVILEGE_BIT,/* uxPriority - this is the highest priority task in the system. The task is created in privileged mode to demonstrate accessing the privileged only data. */
|
||||||
|
@ -258,7 +258,7 @@ static const xTaskParameters xCheckTaskParameters =
|
||||||
created with different parameters. Again, THIS IS JUST TO DEMONSTRATE THE
|
created with different parameters. Again, THIS IS JUST TO DEMONSTRATE THE
|
||||||
MPU FUNCTIONALITY, the data is not used by the check tasks primary function
|
MPU FUNCTIONALITY, the data is not used by the check tasks primary function
|
||||||
of monitoring the reg test tasks and printing out status information.*/
|
of monitoring the reg test tasks and printing out status information.*/
|
||||||
{
|
{
|
||||||
/* Base address Length Parameters */
|
/* Base address Length Parameters */
|
||||||
{ cReadWriteArray, mainREAD_WRITE_ALIGN_SIZE, portMPU_REGION_READ_WRITE },
|
{ cReadWriteArray, mainREAD_WRITE_ALIGN_SIZE, portMPU_REGION_READ_WRITE },
|
||||||
{ cReadOnlyArray, mainREAD_ONLY_ALIGN_SIZE, portMPU_REGION_READ_ONLY },
|
{ cReadOnlyArray, mainREAD_ONLY_ALIGN_SIZE, portMPU_REGION_READ_ONLY },
|
||||||
|
@ -266,15 +266,15 @@ static const xTaskParameters xCheckTaskParameters =
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Three MPU regions are defined for use by the 'check' task when the task is
|
/* Three MPU regions are defined for use by the 'check' task when the task is
|
||||||
created. These are only used to demonstrate the MPU features and are not
|
created. These are only used to demonstrate the MPU features and are not
|
||||||
actually necessary for the check task to fulfill its primary purpose. Instead
|
actually necessary for the check task to fulfill its primary purpose. Instead
|
||||||
the MPU regions are replaced with those defined by xAltRegions prior to the
|
the MPU regions are replaced with those defined by xAltRegions prior to the
|
||||||
check task receiving any data on the queue or printing any messages to the
|
check task receiving any data on the queue or printing any messages to the
|
||||||
debug console. The MPU region defined below covers the GPIO peripherals used
|
debug console. The MPU region defined below covers the GPIO peripherals used
|
||||||
to write to the LCD. */
|
to write to the LCD. */
|
||||||
static const xMemoryRegion xAltRegions[ portNUM_CONFIGURABLE_REGIONS ] =
|
static const xMemoryRegion xAltRegions[ portNUM_CONFIGURABLE_REGIONS ] =
|
||||||
{
|
{
|
||||||
/* Base address Length Parameters */
|
/* Base address Length Parameters */
|
||||||
{ mainGPIO_START_ADDRESS, ( 64 * 1024 ), portMPU_REGION_READ_WRITE },
|
{ mainGPIO_START_ADDRESS, ( 64 * 1024 ), portMPU_REGION_READ_WRITE },
|
||||||
{ 0, 0, 0 },
|
{ 0, 0, 0 },
|
||||||
|
@ -293,8 +293,8 @@ that stack size is defined in words, not bytes. */
|
||||||
#define mainREG_TEST_STACK_ALIGNMENT ( mainREG_TEST_STACK_SIZE_WORDS * sizeof( portSTACK_TYPE ) )
|
#define mainREG_TEST_STACK_ALIGNMENT ( mainREG_TEST_STACK_SIZE_WORDS * sizeof( portSTACK_TYPE ) )
|
||||||
|
|
||||||
/* Declare the stacks that will be used by the reg test tasks. The kernel will
|
/* Declare the stacks that will be used by the reg test tasks. The kernel will
|
||||||
automatically create an MPU region for the stack. The stack alignment must
|
automatically create an MPU region for the stack. The stack alignment must
|
||||||
match its size, so if 128 words are reserved for the stack then it must be
|
match its size, so if 128 words are reserved for the stack then it must be
|
||||||
aligned to ( 128 * 4 ) bytes. */
|
aligned to ( 128 * 4 ) bytes. */
|
||||||
static portSTACK_TYPE xRegTest1Stack[ mainREG_TEST_STACK_SIZE_WORDS ] mainALIGN_TO( mainREG_TEST_STACK_ALIGNMENT );
|
static portSTACK_TYPE xRegTest1Stack[ mainREG_TEST_STACK_SIZE_WORDS ] mainALIGN_TO( mainREG_TEST_STACK_ALIGNMENT );
|
||||||
static portSTACK_TYPE xRegTest2Stack[ mainREG_TEST_STACK_SIZE_WORDS ] mainALIGN_TO( mainREG_TEST_STACK_ALIGNMENT );
|
static portSTACK_TYPE xRegTest2Stack[ mainREG_TEST_STACK_SIZE_WORDS ] mainALIGN_TO( mainREG_TEST_STACK_ALIGNMENT );
|
||||||
|
@ -303,7 +303,7 @@ static portSTACK_TYPE xRegTest2Stack[ mainREG_TEST_STACK_SIZE_WORDS ] mainALIGN_
|
||||||
static const xTaskParameters xRegTest1Parameters =
|
static const xTaskParameters xRegTest1Parameters =
|
||||||
{
|
{
|
||||||
prvRegTest1Task, /* pvTaskCode - the function that implements the task. */
|
prvRegTest1Task, /* pvTaskCode - the function that implements the task. */
|
||||||
( signed char * ) "RegTest1", /* pcName */
|
"RegTest1", /* pcName */
|
||||||
mainREG_TEST_STACK_SIZE_WORDS, /* usStackDepth */
|
mainREG_TEST_STACK_SIZE_WORDS, /* usStackDepth */
|
||||||
( void * ) 0x12345678, /* pvParameters - this value is just to test that the parameter is being passed into the task correctly. */
|
( void * ) 0x12345678, /* pvParameters - this value is just to test that the parameter is being passed into the task correctly. */
|
||||||
tskIDLE_PRIORITY | portPRIVILEGE_BIT, /* uxPriority - note that this task is created with privileges to demonstrate one method of passing a queue handle into the task. */
|
tskIDLE_PRIORITY | portPRIVILEGE_BIT, /* uxPriority - note that this task is created with privileges to demonstrate one method of passing a queue handle into the task. */
|
||||||
|
@ -320,7 +320,7 @@ static const xTaskParameters xRegTest1Parameters =
|
||||||
static xTaskParameters xRegTest2Parameters =
|
static xTaskParameters xRegTest2Parameters =
|
||||||
{
|
{
|
||||||
prvRegTest2Task, /* pvTaskCode - the function that implements the task. */
|
prvRegTest2Task, /* pvTaskCode - the function that implements the task. */
|
||||||
( signed char * ) "RegTest2", /* pcName */
|
"RegTest2", /* pcName */
|
||||||
mainREG_TEST_STACK_SIZE_WORDS, /* usStackDepth */
|
mainREG_TEST_STACK_SIZE_WORDS, /* usStackDepth */
|
||||||
( void * ) NULL, /* pvParameters - this task uses the parameter to pass in a queue handle, but the queue is not created yet. */
|
( void * ) NULL, /* pvParameters - this task uses the parameter to pass in a queue handle, but the queue is not created yet. */
|
||||||
tskIDLE_PRIORITY, /* uxPriority */
|
tskIDLE_PRIORITY, /* uxPriority */
|
||||||
|
@ -357,7 +357,7 @@ int main( void )
|
||||||
/* Create the tasks that are created using the original xTaskCreate() API
|
/* Create the tasks that are created using the original xTaskCreate() API
|
||||||
function. */
|
function. */
|
||||||
xTaskCreate( prvOldStyleUserModeTask, /* The function that implements the task. */
|
xTaskCreate( prvOldStyleUserModeTask, /* The function that implements the task. */
|
||||||
( signed char * ) "Task1", /* Text name for the task. */
|
"Task1", /* Text name for the task. */
|
||||||
100, /* Stack depth in words. */
|
100, /* Stack depth in words. */
|
||||||
NULL, /* Task parameters. */
|
NULL, /* Task parameters. */
|
||||||
3, /* Priority and mode (user in this case). */
|
3, /* Priority and mode (user in this case). */
|
||||||
|
@ -365,7 +365,7 @@ int main( void )
|
||||||
);
|
);
|
||||||
|
|
||||||
xTaskCreate( prvOldStylePrivilegedModeTask, /* The function that implements the task. */
|
xTaskCreate( prvOldStylePrivilegedModeTask, /* The function that implements the task. */
|
||||||
( signed char * ) "Task2", /* Text name for the task. */
|
"Task2", /* Text name for the task. */
|
||||||
100, /* Stack depth in words. */
|
100, /* Stack depth in words. */
|
||||||
NULL, /* Task parameters. */
|
NULL, /* Task parameters. */
|
||||||
( 3 | portPRIVILEGE_BIT ), /* Priority and mode. */
|
( 3 | portPRIVILEGE_BIT ), /* Priority and mode. */
|
||||||
|
@ -397,7 +397,7 @@ unsigned char x = 5, y = 10;
|
||||||
/* Just to remove compiler warning. */
|
/* Just to remove compiler warning. */
|
||||||
( void ) pvParameters;
|
( void ) pvParameters;
|
||||||
|
|
||||||
/* Demonstrate how the various memory regions can and can't be accessed.
|
/* Demonstrate how the various memory regions can and can't be accessed.
|
||||||
The task privilege is set down to user mode within this function. */
|
The task privilege is set down to user mode within this function. */
|
||||||
prvTestMemoryRegions();
|
prvTestMemoryRegions();
|
||||||
|
|
||||||
|
@ -411,26 +411,26 @@ unsigned char x = 5, y = 10;
|
||||||
{
|
{
|
||||||
/* Wait for the next message to arrive. */
|
/* Wait for the next message to arrive. */
|
||||||
xQueueReceive( xQueue, &lMessage, portMAX_DELAY );
|
xQueueReceive( xQueue, &lMessage, portMAX_DELAY );
|
||||||
|
|
||||||
switch( lMessage )
|
switch( lMessage )
|
||||||
{
|
{
|
||||||
case mainREG_TEST_1_STILL_EXECUTING :
|
case mainREG_TEST_1_STILL_EXECUTING :
|
||||||
/* Message from task 1, so task 1 must still be executing. */
|
/* Message from task 1, so task 1 must still be executing. */
|
||||||
( ulStillAliveCounts[ 0 ] )++;
|
( ulStillAliveCounts[ 0 ] )++;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case mainREG_TEST_2_STILL_EXECUTING :
|
case mainREG_TEST_2_STILL_EXECUTING :
|
||||||
/* Message from task 2, so task 2 must still be executing. */
|
/* Message from task 2, so task 2 must still be executing. */
|
||||||
( ulStillAliveCounts[ 1 ] )++;
|
( ulStillAliveCounts[ 1 ] )++;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case mainPRINT_SYSTEM_STATUS :
|
case mainPRINT_SYSTEM_STATUS :
|
||||||
/* Message from tick hook, time to print out the system
|
/* Message from tick hook, time to print out the system
|
||||||
status. If messages has stopped arriving from either reg
|
status. If messages has stopped arriving from either reg
|
||||||
test task then the status must be set to fail. */
|
test task then the status must be set to fail. */
|
||||||
if( ( ulStillAliveCounts[ 0 ] == 0 ) || ( ulStillAliveCounts[ 1 ] == 0 ) )
|
if( ( ulStillAliveCounts[ 0 ] == 0 ) || ( ulStillAliveCounts[ 1 ] == 0 ) )
|
||||||
{
|
{
|
||||||
/* One or both of the test tasks are no longer sending
|
/* One or both of the test tasks are no longer sending
|
||||||
'still alive' messages. */
|
'still alive' messages. */
|
||||||
pcStatusMessage = "FAIL\r\n";
|
pcStatusMessage = "FAIL\r\n";
|
||||||
}
|
}
|
||||||
|
@ -438,7 +438,7 @@ unsigned char x = 5, y = 10;
|
||||||
/* Print a pass/fail message to the LCD - moving the
|
/* Print a pass/fail message to the LCD - moving the
|
||||||
message each time to provide feedback that the output
|
message each time to provide feedback that the output
|
||||||
is still being produced. LCD_PrintString() accesses const
|
is still being produced. LCD_PrintString() accesses const
|
||||||
data stored in flash, which all tasks are at liberty to do,
|
data stored in flash, which all tasks are at liberty to do,
|
||||||
and GPIO for which an MPU region has been set up for it. */
|
and GPIO for which an MPU region has been set up for it. */
|
||||||
LCD_ClearScreen();
|
LCD_ClearScreen();
|
||||||
LCD_PrintString( x>>1, y>>1, pcStatusMessage, 6, COLOR_RED );
|
LCD_PrintString( x>>1, y>>1, pcStatusMessage, 6, COLOR_RED );
|
||||||
|
@ -450,7 +450,7 @@ unsigned char x = 5, y = 10;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default :
|
default :
|
||||||
/* Something unexpected happened. Delete this task so the
|
/* Something unexpected happened. Delete this task so the
|
||||||
error is apparent (no output will be displayed). */
|
error is apparent (no output will be displayed). */
|
||||||
prvDeleteMe();
|
prvDeleteMe();
|
||||||
break;
|
break;
|
||||||
|
@ -464,8 +464,8 @@ static void prvTestMemoryRegions( void )
|
||||||
long l;
|
long l;
|
||||||
char cTemp;
|
char cTemp;
|
||||||
|
|
||||||
/* The check task (from which this function is called) is created in the
|
/* The check task (from which this function is called) is created in the
|
||||||
Privileged mode. The privileged array can be both read from and written
|
Privileged mode. The privileged array can be both read from and written
|
||||||
to while this task is privileged. */
|
to while this task is privileged. */
|
||||||
cPrivilegedOnlyAccessArray[ 0 ] = 'a';
|
cPrivilegedOnlyAccessArray[ 0 ] = 'a';
|
||||||
if( cPrivilegedOnlyAccessArray[ 0 ] != 'a' )
|
if( cPrivilegedOnlyAccessArray[ 0 ] != 'a' )
|
||||||
|
@ -476,15 +476,15 @@ char cTemp;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Writing off the end of the RAM allocated to this task will *NOT* cause a
|
/* Writing off the end of the RAM allocated to this task will *NOT* cause a
|
||||||
protection fault because the task is still executing in a privileged mode.
|
protection fault because the task is still executing in a privileged mode.
|
||||||
Uncomment the following to test. */
|
Uncomment the following to test. */
|
||||||
/* cPrivilegedOnlyAccessArray[ mainPRIVILEGED_ONLY_ACCESS_ALIGN_SIZE ] = 'a'; */
|
/* cPrivilegedOnlyAccessArray[ mainPRIVILEGED_ONLY_ACCESS_ALIGN_SIZE ] = 'a'; */
|
||||||
|
|
||||||
/* Now set the task into user mode. */
|
/* Now set the task into user mode. */
|
||||||
portSWITCH_TO_USER_MODE();
|
portSWITCH_TO_USER_MODE();
|
||||||
|
|
||||||
/* Accessing the privileged only array will now cause a fault. Uncomment
|
/* Accessing the privileged only array will now cause a fault. Uncomment
|
||||||
the following line to test. */
|
the following line to test. */
|
||||||
/* cPrivilegedOnlyAccessArray[ 0 ] = 'a'; */
|
/* cPrivilegedOnlyAccessArray[ 0 ] = 'a'; */
|
||||||
|
|
||||||
/* The read/write array can still be successfully read and written. */
|
/* The read/write array can still be successfully read and written. */
|
||||||
|
@ -500,7 +500,7 @@ char cTemp;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* But attempting to read or write off the end of the RAM allocated to this
|
/* But attempting to read or write off the end of the RAM allocated to this
|
||||||
task will cause a fault. Uncomment either of the following two lines to
|
task will cause a fault. Uncomment either of the following two lines to
|
||||||
test. */
|
test. */
|
||||||
/* cReadWriteArray[ 0 ] = cReadWriteArray[ -1 ]; */
|
/* cReadWriteArray[ 0 ] = cReadWriteArray[ -1 ]; */
|
||||||
/* cReadWriteArray[ mainREAD_WRITE_ALIGN_SIZE ] = 0x00; */
|
/* cReadWriteArray[ mainREAD_WRITE_ALIGN_SIZE ] = 0x00; */
|
||||||
|
@ -514,14 +514,14 @@ char cTemp;
|
||||||
/* ...but cannot be written. Uncomment the following line to test. */
|
/* ...but cannot be written. Uncomment the following line to test. */
|
||||||
/* cReadOnlyArray[ 0 ] = 'a'; */
|
/* cReadOnlyArray[ 0 ] = 'a'; */
|
||||||
|
|
||||||
/* Writing to the first and last locations in the stack array should not
|
/* Writing to the first and last locations in the stack array should not
|
||||||
cause a protection fault. Note that doing this will cause the kernel to
|
cause a protection fault. Note that doing this will cause the kernel to
|
||||||
detect a stack overflow if configCHECK_FOR_STACK_OVERFLOW is greater than
|
detect a stack overflow if configCHECK_FOR_STACK_OVERFLOW is greater than
|
||||||
1. */
|
1. */
|
||||||
xCheckTaskStack[ 0 ] = 0;
|
xCheckTaskStack[ 0 ] = 0;
|
||||||
xCheckTaskStack[ mainCHECK_TASK_STACK_SIZE_WORDS - 1 ] = 0;
|
xCheckTaskStack[ mainCHECK_TASK_STACK_SIZE_WORDS - 1 ] = 0;
|
||||||
|
|
||||||
/* Writing off either end of the stack array should cause a protection
|
/* Writing off either end of the stack array should cause a protection
|
||||||
fault, uncomment either of the following two lines to test. */
|
fault, uncomment either of the following two lines to test. */
|
||||||
/* xCheckTaskStack[ -1 ] = 0; */
|
/* xCheckTaskStack[ -1 ] = 0; */
|
||||||
/* xCheckTaskStack[ mainCHECK_TASK_STACK_SIZE_WORDS ] = 0; */
|
/* xCheckTaskStack[ mainCHECK_TASK_STACK_SIZE_WORDS ] = 0; */
|
||||||
|
@ -536,7 +536,7 @@ mode. Once this task is in user mode the file scope queue variable will no
|
||||||
longer be accessible but the stack copy will. */
|
longer be accessible but the stack copy will. */
|
||||||
xQueueHandle xQueue = xFileScopeCheckQueue;
|
xQueueHandle xQueue = xFileScopeCheckQueue;
|
||||||
|
|
||||||
/* Now the queue handle has been obtained the task can switch to user
|
/* Now the queue handle has been obtained the task can switch to user
|
||||||
mode. This is just one method of passing a handle into a protected
|
mode. This is just one method of passing a handle into a protected
|
||||||
task, the other reg test task uses the task parameter instead. */
|
task, the other reg test task uses the task parameter instead. */
|
||||||
portSWITCH_TO_USER_MODE();
|
portSWITCH_TO_USER_MODE();
|
||||||
|
@ -551,12 +551,12 @@ xQueueHandle xQueue = xFileScopeCheckQueue;
|
||||||
|
|
||||||
|
|
||||||
for( ;; )
|
for( ;; )
|
||||||
{
|
{
|
||||||
/* This task tests the kernel context switch mechanism by reading and
|
/* This task tests the kernel context switch mechanism by reading and
|
||||||
writing directly to registers - which requires the test to be written
|
writing directly to registers - which requires the test to be written
|
||||||
in assembly code. */
|
in assembly code. */
|
||||||
__asm volatile
|
__asm volatile
|
||||||
(
|
(
|
||||||
" MOV R4, #104 \n" /* Set registers to a known value. R0 to R1 are done in the loop below. */
|
" MOV R4, #104 \n" /* Set registers to a known value. R0 to R1 are done in the loop below. */
|
||||||
" MOV R5, #105 \n"
|
" MOV R5, #105 \n"
|
||||||
" MOV R6, #106 \n"
|
" MOV R6, #106 \n"
|
||||||
|
@ -579,8 +579,8 @@ xQueueHandle xQueue = xFileScopeCheckQueue;
|
||||||
" BNE prvDeleteMe \n"
|
" BNE prvDeleteMe \n"
|
||||||
" CMP R3, #103 \n"
|
" CMP R3, #103 \n"
|
||||||
" BNE prvDeleteMe \n"
|
" BNE prvDeleteMe \n"
|
||||||
" CMP R4, #104 \n"
|
" CMP R4, #104 \n"
|
||||||
" BNE prvDeleteMe \n"
|
" BNE prvDeleteMe \n"
|
||||||
" CMP R5, #105 \n"
|
" CMP R5, #105 \n"
|
||||||
" BNE prvDeleteMe \n"
|
" BNE prvDeleteMe \n"
|
||||||
" CMP R6, #106 \n"
|
" CMP R6, #106 \n"
|
||||||
|
@ -598,7 +598,7 @@ xQueueHandle xQueue = xFileScopeCheckQueue;
|
||||||
:::"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r8", "r9", "r10", "r11", "r12"
|
:::"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r8", "r9", "r10", "r11", "r12"
|
||||||
);
|
);
|
||||||
|
|
||||||
/* Send mainREG_TEST_1_STILL_EXECUTING to the check task to indicate that this
|
/* Send mainREG_TEST_1_STILL_EXECUTING to the check task to indicate that this
|
||||||
task is still functioning. */
|
task is still functioning. */
|
||||||
prvSendImAlive( xQueue, mainREG_TEST_1_STILL_EXECUTING );
|
prvSendImAlive( xQueue, mainREG_TEST_1_STILL_EXECUTING );
|
||||||
|
|
||||||
|
@ -611,7 +611,7 @@ xQueueHandle xQueue = xFileScopeCheckQueue;
|
||||||
static void prvRegTest2Task( void *pvParameters )
|
static void prvRegTest2Task( void *pvParameters )
|
||||||
{
|
{
|
||||||
/* The queue handle is passed in as the task parameter. This is one method of
|
/* The queue handle is passed in as the task parameter. This is one method of
|
||||||
passing data into a protected task, the other reg test task uses a different
|
passing data into a protected task, the other reg test task uses a different
|
||||||
method. */
|
method. */
|
||||||
xQueueHandle xQueue = ( xQueueHandle ) pvParameters;
|
xQueueHandle xQueue = ( xQueueHandle ) pvParameters;
|
||||||
|
|
||||||
|
@ -620,15 +620,15 @@ xQueueHandle xQueue = ( xQueueHandle ) pvParameters;
|
||||||
/* This task tests the kernel context switch mechanism by reading and
|
/* This task tests the kernel context switch mechanism by reading and
|
||||||
writing directly to registers - which requires the test to be written
|
writing directly to registers - which requires the test to be written
|
||||||
in assembly code. */
|
in assembly code. */
|
||||||
__asm volatile
|
__asm volatile
|
||||||
(
|
(
|
||||||
" MOV R4, #4 \n" /* Set registers to a known value. R0 to R1 are done in the loop below. */
|
" MOV R4, #4 \n" /* Set registers to a known value. R0 to R1 are done in the loop below. */
|
||||||
" MOV R5, #5 \n"
|
" MOV R5, #5 \n"
|
||||||
" MOV R6, #6 \n"
|
" MOV R6, #6 \n"
|
||||||
" MOV R8, #8 \n" /* Frame pointer is omitted as it must not be changed. */
|
" MOV R8, #8 \n" /* Frame pointer is omitted as it must not be changed. */
|
||||||
" MOV R9, #9 \n"
|
" MOV R9, #9 \n"
|
||||||
" MOV R10, 10 \n"
|
" MOV R10, 10 \n"
|
||||||
" MOV R11, #11 \n"
|
" MOV R11, #11 \n"
|
||||||
"reg2loop: \n"
|
"reg2loop: \n"
|
||||||
" MOV R0, #13 \n" /* Set the scratch registers to known values - done inside the loop as they get clobbered. */
|
" MOV R0, #13 \n" /* Set the scratch registers to known values - done inside the loop as they get clobbered. */
|
||||||
" MOV R1, #1 \n"
|
" MOV R1, #1 \n"
|
||||||
|
@ -662,7 +662,7 @@ xQueueHandle xQueue = ( xQueueHandle ) pvParameters;
|
||||||
:::"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r8", "r9", "r10", "r11", "r12"
|
:::"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r8", "r9", "r10", "r11", "r12"
|
||||||
);
|
);
|
||||||
|
|
||||||
/* Send mainREG_TEST_2_STILL_EXECUTING to the check task to indicate that this
|
/* Send mainREG_TEST_2_STILL_EXECUTING to the check task to indicate that this
|
||||||
task is still functioning. */
|
task is still functioning. */
|
||||||
prvSendImAlive( xQueue, mainREG_TEST_2_STILL_EXECUTING );
|
prvSendImAlive( xQueue, mainREG_TEST_2_STILL_EXECUTING );
|
||||||
|
|
||||||
|
@ -684,8 +684,8 @@ volatile unsigned long ulReadData;
|
||||||
|
|
||||||
/* The idle task, and therefore this function, run in Supervisor mode and
|
/* The idle task, and therefore this function, run in Supervisor mode and
|
||||||
can therefore access all memory. Try reading from corners of flash and
|
can therefore access all memory. Try reading from corners of flash and
|
||||||
RAM to ensure a memory fault does not occur.
|
RAM to ensure a memory fault does not occur.
|
||||||
|
|
||||||
Start with the edges of the privileged data area. */
|
Start with the edges of the privileged data area. */
|
||||||
pul = __privileged_data_start__;
|
pul = __privileged_data_start__;
|
||||||
ulReadData = *pul;
|
ulReadData = *pul;
|
||||||
|
@ -703,9 +703,9 @@ volatile unsigned long ulReadData;
|
||||||
pul = __FLASH_segment_end__ - 1;
|
pul = __FLASH_segment_end__ - 1;
|
||||||
ulReadData = *pul;
|
ulReadData = *pul;
|
||||||
|
|
||||||
/* Reading off the end of Flash or SRAM space should cause a fault.
|
/* Reading off the end of Flash or SRAM space should cause a fault.
|
||||||
Uncomment one of the following two pairs of lines to test. */
|
Uncomment one of the following two pairs of lines to test. */
|
||||||
|
|
||||||
/* pul = __FLASH_segment_end__ + 4;
|
/* pul = __FLASH_segment_end__ + 4;
|
||||||
ulReadData = *pul; */
|
ulReadData = *pul; */
|
||||||
|
|
||||||
|
@ -726,7 +726,7 @@ const volatile unsigned long *pulStandardPeripheralRegister = ( volatile unsigne
|
||||||
volatile unsigned long *pul;
|
volatile unsigned long *pul;
|
||||||
volatile unsigned long ulReadData;
|
volatile unsigned long ulReadData;
|
||||||
|
|
||||||
/* The following lines are commented out to prevent the unused variable
|
/* The following lines are commented out to prevent the unused variable
|
||||||
compiler warnings when the tests that use the variable are also commented out.
|
compiler warnings when the tests that use the variable are also commented out.
|
||||||
extern unsigned long __privileged_functions_start__[];
|
extern unsigned long __privileged_functions_start__[];
|
||||||
const volatile unsigned long *pulSystemPeripheralRegister = ( volatile unsigned long * ) 0xe000e014; */
|
const volatile unsigned long *pulSystemPeripheralRegister = ( volatile unsigned long * ) 0xe000e014; */
|
||||||
|
@ -766,17 +766,17 @@ const volatile unsigned long *pulSystemPeripheralRegister = ( volatile unsigned
|
||||||
|
|
||||||
/* pul = __privileged_functions_start__;
|
/* pul = __privileged_functions_start__;
|
||||||
ulReadData = *pul; */
|
ulReadData = *pul; */
|
||||||
|
|
||||||
/* pul = __privileged_functions_end__ - 1;
|
/* pul = __privileged_functions_end__ - 1;
|
||||||
ulReadData = *pul; */
|
ulReadData = *pul; */
|
||||||
|
|
||||||
/* pul = __privileged_data_start__;
|
/* pul = __privileged_data_start__;
|
||||||
ulReadData = *pul; */
|
ulReadData = *pul; */
|
||||||
|
|
||||||
/* pul = __privileged_data_end__ - 1;
|
/* pul = __privileged_data_end__ - 1;
|
||||||
ulReadData = *pul; */
|
ulReadData = *pul; */
|
||||||
|
|
||||||
/* Must not just run off the end of a task function, so delete this task.
|
/* Must not just run off the end of a task function, so delete this task.
|
||||||
Note that because this task was created using xTaskCreate() the stack was
|
Note that because this task was created using xTaskCreate() the stack was
|
||||||
allocated dynamically and I have not included any code to free it again. */
|
allocated dynamically and I have not included any code to free it again. */
|
||||||
vTaskDelete( NULL );
|
vTaskDelete( NULL );
|
||||||
|
@ -799,10 +799,10 @@ const volatile unsigned long *pulStandardPeripheralRegister = ( volatile unsigne
|
||||||
|
|
||||||
( void ) pvParameters;
|
( void ) pvParameters;
|
||||||
|
|
||||||
/* This task is created in Privileged mode using the original xTaskCreate()
|
/* This task is created in Privileged mode using the original xTaskCreate()
|
||||||
API function. It should have access to all Flash and RAM including that
|
API function. It should have access to all Flash and RAM including that
|
||||||
marked as Privileged access only. So reading from the start and end of the
|
marked as Privileged access only. So reading from the start and end of the
|
||||||
non-privileged RAM should not cause a problem (the privileged RAM is the
|
non-privileged RAM should not cause a problem (the privileged RAM is the
|
||||||
first block at the bottom of the RAM memory). */
|
first block at the bottom of the RAM memory). */
|
||||||
pul = __privileged_data_end__ + 1;
|
pul = __privileged_data_end__ + 1;
|
||||||
ulReadData = *pul;
|
ulReadData = *pul;
|
||||||
|
@ -824,7 +824,7 @@ const volatile unsigned long *pulStandardPeripheralRegister = ( volatile unsigne
|
||||||
pul = __privileged_functions_end__ - 1;
|
pul = __privileged_functions_end__ - 1;
|
||||||
ulReadData = *pul;
|
ulReadData = *pul;
|
||||||
pul = __privileged_data_start__;
|
pul = __privileged_data_start__;
|
||||||
ulReadData = *pul;
|
ulReadData = *pul;
|
||||||
pul = __privileged_data_end__ - 1;
|
pul = __privileged_data_end__ - 1;
|
||||||
ulReadData = *pul;
|
ulReadData = *pul;
|
||||||
|
|
||||||
|
@ -833,7 +833,7 @@ const volatile unsigned long *pulStandardPeripheralRegister = ( volatile unsigne
|
||||||
ulReadData = *pulSystemPeripheralRegister;
|
ulReadData = *pulSystemPeripheralRegister;
|
||||||
ulReadData = *pulStandardPeripheralRegister;
|
ulReadData = *pulStandardPeripheralRegister;
|
||||||
|
|
||||||
/* Must not just run off the end of a task function, so delete this task.
|
/* Must not just run off the end of a task function, so delete this task.
|
||||||
Note that because this task was created using xTaskCreate() the stack was
|
Note that because this task was created using xTaskCreate() the stack was
|
||||||
allocated dynamically and I have not included any code to free it again. */
|
allocated dynamically and I have not included any code to free it again. */
|
||||||
vTaskDelete( NULL );
|
vTaskDelete( NULL );
|
||||||
|
@ -869,84 +869,84 @@ void prvSetupHardware( void )
|
||||||
if ( SC->PLL0STAT & ( 1 << 25 ) )
|
if ( SC->PLL0STAT & ( 1 << 25 ) )
|
||||||
{
|
{
|
||||||
/* Enable PLL, disconnected. */
|
/* Enable PLL, disconnected. */
|
||||||
SC->PLL0CON = 1;
|
SC->PLL0CON = 1;
|
||||||
SC->PLL0FEED = PLLFEED_FEED1;
|
SC->PLL0FEED = PLLFEED_FEED1;
|
||||||
SC->PLL0FEED = PLLFEED_FEED2;
|
SC->PLL0FEED = PLLFEED_FEED2;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Disable PLL, disconnected. */
|
/* Disable PLL, disconnected. */
|
||||||
SC->PLL0CON = 0;
|
SC->PLL0CON = 0;
|
||||||
SC->PLL0FEED = PLLFEED_FEED1;
|
SC->PLL0FEED = PLLFEED_FEED1;
|
||||||
SC->PLL0FEED = PLLFEED_FEED2;
|
SC->PLL0FEED = PLLFEED_FEED2;
|
||||||
|
|
||||||
/* Enable main OSC. */
|
/* Enable main OSC. */
|
||||||
SC->SCS |= 0x20;
|
SC->SCS |= 0x20;
|
||||||
while( !( SC->SCS & 0x40 ) );
|
while( !( SC->SCS & 0x40 ) );
|
||||||
|
|
||||||
/* select main OSC, 12MHz, as the PLL clock source. */
|
/* select main OSC, 12MHz, as the PLL clock source. */
|
||||||
SC->CLKSRCSEL = 0x1;
|
SC->CLKSRCSEL = 0x1;
|
||||||
|
|
||||||
SC->PLL0CFG = 0x20031;
|
SC->PLL0CFG = 0x20031;
|
||||||
SC->PLL0FEED = PLLFEED_FEED1;
|
SC->PLL0FEED = PLLFEED_FEED1;
|
||||||
SC->PLL0FEED = PLLFEED_FEED2;
|
SC->PLL0FEED = PLLFEED_FEED2;
|
||||||
|
|
||||||
/* Enable PLL, disconnected. */
|
/* Enable PLL, disconnected. */
|
||||||
SC->PLL0CON = 1;
|
SC->PLL0CON = 1;
|
||||||
SC->PLL0FEED = PLLFEED_FEED1;
|
SC->PLL0FEED = PLLFEED_FEED1;
|
||||||
SC->PLL0FEED = PLLFEED_FEED2;
|
SC->PLL0FEED = PLLFEED_FEED2;
|
||||||
|
|
||||||
/* Set clock divider. */
|
/* Set clock divider. */
|
||||||
SC->CCLKCFG = 0x03;
|
SC->CCLKCFG = 0x03;
|
||||||
|
|
||||||
/* Configure flash accelerator. */
|
/* Configure flash accelerator. */
|
||||||
SC->FLASHCFG = 0x403a;
|
SC->FLASHCFG = 0x403a;
|
||||||
|
|
||||||
/* Check lock bit status. */
|
/* Check lock bit status. */
|
||||||
while( ( ( SC->PLL0STAT & ( 1 << 26 ) ) == 0 ) );
|
while( ( ( SC->PLL0STAT & ( 1 << 26 ) ) == 0 ) );
|
||||||
|
|
||||||
/* Enable and connect. */
|
/* Enable and connect. */
|
||||||
SC->PLL0CON = 3;
|
SC->PLL0CON = 3;
|
||||||
SC->PLL0FEED = PLLFEED_FEED1;
|
SC->PLL0FEED = PLLFEED_FEED1;
|
||||||
SC->PLL0FEED = PLLFEED_FEED2;
|
SC->PLL0FEED = PLLFEED_FEED2;
|
||||||
while( ( ( SC->PLL0STAT & ( 1 << 25 ) ) == 0 ) );
|
while( ( ( SC->PLL0STAT & ( 1 << 25 ) ) == 0 ) );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Configure the clock for the USB. */
|
/* Configure the clock for the USB. */
|
||||||
|
|
||||||
if( SC->PLL1STAT & ( 1 << 9 ) )
|
if( SC->PLL1STAT & ( 1 << 9 ) )
|
||||||
{
|
{
|
||||||
/* Enable PLL, disconnected. */
|
/* Enable PLL, disconnected. */
|
||||||
SC->PLL1CON = 1;
|
SC->PLL1CON = 1;
|
||||||
SC->PLL1FEED = PLLFEED_FEED1;
|
SC->PLL1FEED = PLLFEED_FEED1;
|
||||||
SC->PLL1FEED = PLLFEED_FEED2;
|
SC->PLL1FEED = PLLFEED_FEED2;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Disable PLL, disconnected. */
|
/* Disable PLL, disconnected. */
|
||||||
SC->PLL1CON = 0;
|
SC->PLL1CON = 0;
|
||||||
SC->PLL1FEED = PLLFEED_FEED1;
|
SC->PLL1FEED = PLLFEED_FEED1;
|
||||||
SC->PLL1FEED = PLLFEED_FEED2;
|
SC->PLL1FEED = PLLFEED_FEED2;
|
||||||
|
|
||||||
SC->PLL1CFG = 0x23;
|
SC->PLL1CFG = 0x23;
|
||||||
SC->PLL1FEED = PLLFEED_FEED1;
|
SC->PLL1FEED = PLLFEED_FEED1;
|
||||||
SC->PLL1FEED = PLLFEED_FEED2;
|
SC->PLL1FEED = PLLFEED_FEED2;
|
||||||
|
|
||||||
/* Enable PLL, disconnected. */
|
/* Enable PLL, disconnected. */
|
||||||
SC->PLL1CON = 1;
|
SC->PLL1CON = 1;
|
||||||
SC->PLL1FEED = PLLFEED_FEED1;
|
SC->PLL1FEED = PLLFEED_FEED1;
|
||||||
SC->PLL1FEED = PLLFEED_FEED2;
|
SC->PLL1FEED = PLLFEED_FEED2;
|
||||||
while( ( ( SC->PLL1STAT & ( 1 << 10 ) ) == 0 ) );
|
while( ( ( SC->PLL1STAT & ( 1 << 10 ) ) == 0 ) );
|
||||||
|
|
||||||
/* Enable and connect. */
|
/* Enable and connect. */
|
||||||
SC->PLL1CON = 3;
|
SC->PLL1CON = 3;
|
||||||
SC->PLL1FEED = PLLFEED_FEED1;
|
SC->PLL1FEED = PLLFEED_FEED1;
|
||||||
SC->PLL1FEED = PLLFEED_FEED2;
|
SC->PLL1FEED = PLLFEED_FEED2;
|
||||||
while( ( ( SC->PLL1STAT & ( 1 << 9 ) ) == 0 ) );
|
while( ( ( SC->PLL1STAT & ( 1 << 9 ) ) == 0 ) );
|
||||||
|
|
||||||
/* Setup the peripheral bus to be the same as the PLL output (64 MHz). */
|
/* Setup the peripheral bus to be the same as the PLL output (64 MHz). */
|
||||||
SC->PCLKSEL0 = 0x05555555;
|
SC->PCLKSEL0 = 0x05555555;
|
||||||
|
|
||||||
/* Prepare the LCD. */
|
/* Prepare the LCD. */
|
||||||
LCDdriver_initialisation();
|
LCDdriver_initialisation();
|
||||||
LCD_PrintString( 5, 10, "FreeRTOS.org", 14, COLOR_GREEN);
|
LCD_PrintString( 5, 10, "FreeRTOS.org", 14, COLOR_GREEN);
|
||||||
|
@ -972,8 +972,8 @@ portBASE_TYPE xDummy;
|
||||||
ulCallCount = 0;
|
ulCallCount = 0;
|
||||||
|
|
||||||
/* Send a message to the check task to command it to check that all
|
/* Send a message to the check task to command it to check that all
|
||||||
the tasks are still running then print out the status.
|
the tasks are still running then print out the status.
|
||||||
|
|
||||||
This is running in an ISR so has to use the "FromISR" version of
|
This is running in an ISR so has to use the "FromISR" version of
|
||||||
xQueueSend(). Because it is in an ISR it is running with privileges
|
xQueueSend(). Because it is in an ISR it is running with privileges
|
||||||
so can access xFileScopeCheckQueue directly. */
|
so can access xFileScopeCheckQueue directly. */
|
||||||
|
@ -984,7 +984,7 @@ portBASE_TYPE xDummy;
|
||||||
|
|
||||||
void vApplicationStackOverflowHook( xTaskHandle pxTask, signed char *pcTaskName )
|
void vApplicationStackOverflowHook( xTaskHandle pxTask, signed char *pcTaskName )
|
||||||
{
|
{
|
||||||
/* If configCHECK_FOR_STACK_OVERFLOW is set to either 1 or 2 then this
|
/* If configCHECK_FOR_STACK_OVERFLOW is set to either 1 or 2 then this
|
||||||
function will automatically get called if a task overflows its stack. */
|
function will automatically get called if a task overflows its stack. */
|
||||||
( void ) pxTask;
|
( void ) pxTask;
|
||||||
( void ) pcTaskName;
|
( void ) pcTaskName;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
All rights reserved
|
All rights reserved
|
||||||
|
|
||||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
@ -64,15 +64,15 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Creates eight tasks, each of which loops continuously performing an (emulated)
|
* Creates eight tasks, each of which loops continuously performing an (emulated)
|
||||||
* floating point calculation.
|
* floating point calculation.
|
||||||
*
|
*
|
||||||
* All the tasks run at the idle priority and never block or yield. This causes
|
* All the tasks run at the idle priority and never block or yield. This causes
|
||||||
* all eight tasks to time slice with the idle task. Running at the idle priority
|
* all eight tasks to time slice with the idle task. Running at the idle priority
|
||||||
* means that these tasks will get pre-empted any time another task is ready to run
|
* means that these tasks will get pre-empted any time another task is ready to run
|
||||||
* or a time slice occurs. More often than not the pre-emption will occur mid
|
* or a time slice occurs. More often than not the pre-emption will occur mid
|
||||||
* calculation, creating a good test of the schedulers context switch mechanism - a
|
* calculation, creating a good test of the schedulers context switch mechanism - a
|
||||||
* calculation producing an unexpected result could be a symptom of a corruption in
|
* calculation producing an unexpected result could be a symptom of a corruption in
|
||||||
* the context of a task.
|
* the context of a task.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -89,14 +89,14 @@
|
||||||
#define mathSTACK_SIZE configMINIMAL_STACK_SIZE
|
#define mathSTACK_SIZE configMINIMAL_STACK_SIZE
|
||||||
#define mathNUMBER_OF_TASKS ( 8 )
|
#define mathNUMBER_OF_TASKS ( 8 )
|
||||||
|
|
||||||
/* Four tasks, each of which performs a different floating point calculation.
|
/* Four tasks, each of which performs a different floating point calculation.
|
||||||
Each of the four is created twice. */
|
Each of the four is created twice. */
|
||||||
static portTASK_FUNCTION_PROTO( vCompetingMathTask1, pvParameters );
|
static portTASK_FUNCTION_PROTO( vCompetingMathTask1, pvParameters );
|
||||||
static portTASK_FUNCTION_PROTO( vCompetingMathTask2, pvParameters );
|
static portTASK_FUNCTION_PROTO( vCompetingMathTask2, pvParameters );
|
||||||
static portTASK_FUNCTION_PROTO( vCompetingMathTask3, pvParameters );
|
static portTASK_FUNCTION_PROTO( vCompetingMathTask3, pvParameters );
|
||||||
static portTASK_FUNCTION_PROTO( vCompetingMathTask4, pvParameters );
|
static portTASK_FUNCTION_PROTO( vCompetingMathTask4, pvParameters );
|
||||||
|
|
||||||
/* These variables are used to check that all the tasks are still running. If a
|
/* These variables are used to check that all the tasks are still running. If a
|
||||||
task gets a calculation wrong it will
|
task gets a calculation wrong it will
|
||||||
stop incrementing its check variable. */
|
stop incrementing its check variable. */
|
||||||
static volatile unsigned long ulTaskCheck[ mathNUMBER_OF_TASKS ] = { 0 };
|
static volatile unsigned long ulTaskCheck[ mathNUMBER_OF_TASKS ] = { 0 };
|
||||||
|
@ -112,14 +112,14 @@ a floating point context. */
|
||||||
|
|
||||||
void vStartMathTasks( unsigned portBASE_TYPE uxPriority )
|
void vStartMathTasks( unsigned portBASE_TYPE uxPriority )
|
||||||
{
|
{
|
||||||
xTaskCreate( vCompetingMathTask1, ( signed char * ) "Math1", mathSTACK_SIZE, ( void * ) &( ulTaskCheck[ 0 ] ), uxPriority, NULL );
|
xTaskCreate( vCompetingMathTask1, "Math1", mathSTACK_SIZE, ( void * ) &( ulTaskCheck[ 0 ] ), uxPriority, NULL );
|
||||||
xTaskCreate( vCompetingMathTask2, ( signed char * ) "Math2", mathSTACK_SIZE, ( void * ) &( ulTaskCheck[ 1 ] ), uxPriority, NULL );
|
xTaskCreate( vCompetingMathTask2, "Math2", mathSTACK_SIZE, ( void * ) &( ulTaskCheck[ 1 ] ), uxPriority, NULL );
|
||||||
xTaskCreate( vCompetingMathTask3, ( signed char * ) "Math3", mathSTACK_SIZE, ( void * ) &( ulTaskCheck[ 2 ] ), uxPriority, NULL );
|
xTaskCreate( vCompetingMathTask3, "Math3", mathSTACK_SIZE, ( void * ) &( ulTaskCheck[ 2 ] ), uxPriority, NULL );
|
||||||
xTaskCreate( vCompetingMathTask4, ( signed char * ) "Math4", mathSTACK_SIZE, ( void * ) &( ulTaskCheck[ 3 ] ), uxPriority, NULL );
|
xTaskCreate( vCompetingMathTask4, "Math4", mathSTACK_SIZE, ( void * ) &( ulTaskCheck[ 3 ] ), uxPriority, NULL );
|
||||||
xTaskCreate( vCompetingMathTask1, ( signed char * ) "Math5", mathSTACK_SIZE, ( void * ) &( ulTaskCheck[ 4 ] ), uxPriority, NULL );
|
xTaskCreate( vCompetingMathTask1, "Math5", mathSTACK_SIZE, ( void * ) &( ulTaskCheck[ 4 ] ), uxPriority, NULL );
|
||||||
xTaskCreate( vCompetingMathTask2, ( signed char * ) "Math6", mathSTACK_SIZE, ( void * ) &( ulTaskCheck[ 5 ] ), uxPriority, NULL );
|
xTaskCreate( vCompetingMathTask2, "Math6", mathSTACK_SIZE, ( void * ) &( ulTaskCheck[ 5 ] ), uxPriority, NULL );
|
||||||
xTaskCreate( vCompetingMathTask3, ( signed char * ) "Math7", mathSTACK_SIZE, ( void * ) &( ulTaskCheck[ 6 ] ), uxPriority, NULL );
|
xTaskCreate( vCompetingMathTask3, "Math7", mathSTACK_SIZE, ( void * ) &( ulTaskCheck[ 6 ] ), uxPriority, NULL );
|
||||||
xTaskCreate( vCompetingMathTask4, ( signed char * ) "Math8", mathSTACK_SIZE, ( void * ) &( ulTaskCheck[ 7 ] ), uxPriority, NULL );
|
xTaskCreate( vCompetingMathTask4, "Math8", mathSTACK_SIZE, ( void * ) &( ulTaskCheck[ 7 ] ), uxPriority, NULL );
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
@ -144,7 +144,7 @@ short sError = pdFALSE;
|
||||||
|
|
||||||
dAnswer = ( d1 + d2 ) * d3;
|
dAnswer = ( d1 + d2 ) * d3;
|
||||||
|
|
||||||
/* The variable this task increments to show it is still running is passed in
|
/* The variable this task increments to show it is still running is passed in
|
||||||
as the parameter. */
|
as the parameter. */
|
||||||
pulTaskCheckVariable = ( unsigned long * ) pvParameters;
|
pulTaskCheckVariable = ( unsigned long * ) pvParameters;
|
||||||
|
|
||||||
|
@ -161,7 +161,7 @@ short sError = pdFALSE;
|
||||||
taskYIELD();
|
taskYIELD();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* If the calculation does not match the expected constant, stop the
|
/* If the calculation does not match the expected constant, stop the
|
||||||
increment of the check variable. */
|
increment of the check variable. */
|
||||||
if( fabs( d4 - dAnswer ) > 0.001 )
|
if( fabs( d4 - dAnswer ) > 0.001 )
|
||||||
{
|
{
|
||||||
|
@ -170,7 +170,7 @@ short sError = pdFALSE;
|
||||||
|
|
||||||
if( sError == pdFALSE )
|
if( sError == pdFALSE )
|
||||||
{
|
{
|
||||||
/* If the calculation has always been correct, increment the check
|
/* If the calculation has always been correct, increment the check
|
||||||
variable so we know this task is still running okay. */
|
variable so we know this task is still running okay. */
|
||||||
( *pulTaskCheckVariable )++;
|
( *pulTaskCheckVariable )++;
|
||||||
}
|
}
|
||||||
|
@ -204,7 +204,7 @@ short sError = pdFALSE;
|
||||||
dAnswer = ( d1 / d2 ) * d3;
|
dAnswer = ( d1 / d2 ) * d3;
|
||||||
|
|
||||||
|
|
||||||
/* The variable this task increments to show it is still running is passed in
|
/* The variable this task increments to show it is still running is passed in
|
||||||
as the parameter. */
|
as the parameter. */
|
||||||
pulTaskCheckVariable = ( unsigned long * ) pvParameters;
|
pulTaskCheckVariable = ( unsigned long * ) pvParameters;
|
||||||
|
|
||||||
|
@ -220,8 +220,8 @@ short sError = pdFALSE;
|
||||||
#if configUSE_PREEMPTION == 0
|
#if configUSE_PREEMPTION == 0
|
||||||
taskYIELD();
|
taskYIELD();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* If the calculation does not match the expected constant, stop the
|
/* If the calculation does not match the expected constant, stop the
|
||||||
increment of the check variable. */
|
increment of the check variable. */
|
||||||
if( fabs( d4 - dAnswer ) > 0.001 )
|
if( fabs( d4 - dAnswer ) > 0.001 )
|
||||||
{
|
{
|
||||||
|
@ -230,7 +230,7 @@ short sError = pdFALSE;
|
||||||
|
|
||||||
if( sError == pdFALSE )
|
if( sError == pdFALSE )
|
||||||
{
|
{
|
||||||
/* If the calculation has always been correct, increment the check
|
/* If the calculation has always been correct, increment the check
|
||||||
variable so we know
|
variable so we know
|
||||||
this task is still running okay. */
|
this task is still running okay. */
|
||||||
( *pulTaskCheckVariable )++;
|
( *pulTaskCheckVariable )++;
|
||||||
|
@ -258,14 +258,14 @@ short sError = pdFALSE;
|
||||||
vPortTaskUsesFPU();
|
vPortTaskUsesFPU();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* The variable this task increments to show it is still running is passed in
|
/* The variable this task increments to show it is still running is passed in
|
||||||
as the parameter. */
|
as the parameter. */
|
||||||
pulTaskCheckVariable = ( unsigned long * ) pvParameters;
|
pulTaskCheckVariable = ( unsigned long * ) pvParameters;
|
||||||
|
|
||||||
pdArray = ( portDOUBLE * ) pvPortMalloc( xArraySize * sizeof( portDOUBLE ) );
|
pdArray = ( portDOUBLE * ) pvPortMalloc( xArraySize * sizeof( portDOUBLE ) );
|
||||||
|
|
||||||
/* Keep filling an array, keeping a running total of the values placed in the
|
/* Keep filling an array, keeping a running total of the values placed in the
|
||||||
array. Then run through the array adding up all the values. If the two totals
|
array. Then run through the array adding up all the values. If the two totals
|
||||||
do not match, stop the check variable from incrementing. */
|
do not match, stop the check variable from incrementing. */
|
||||||
for( ;; )
|
for( ;; )
|
||||||
{
|
{
|
||||||
|
@ -275,7 +275,7 @@ short sError = pdFALSE;
|
||||||
for( xPosition = 0; xPosition < xArraySize; xPosition++ )
|
for( xPosition = 0; xPosition < xArraySize; xPosition++ )
|
||||||
{
|
{
|
||||||
pdArray[ xPosition ] = ( portDOUBLE ) xPosition + 5.5;
|
pdArray[ xPosition ] = ( portDOUBLE ) xPosition + 5.5;
|
||||||
dTotal1 += ( portDOUBLE ) xPosition + 5.5;
|
dTotal1 += ( portDOUBLE ) xPosition + 5.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if configUSE_PREEMPTION == 0
|
#if configUSE_PREEMPTION == 0
|
||||||
|
@ -299,7 +299,7 @@ short sError = pdFALSE;
|
||||||
|
|
||||||
if( sError == pdFALSE )
|
if( sError == pdFALSE )
|
||||||
{
|
{
|
||||||
/* If the calculation has always been correct, increment the check
|
/* If the calculation has always been correct, increment the check
|
||||||
variable so we know this task is still running okay. */
|
variable so we know this task is still running okay. */
|
||||||
( *pulTaskCheckVariable )++;
|
( *pulTaskCheckVariable )++;
|
||||||
}
|
}
|
||||||
|
@ -322,14 +322,14 @@ short sError = pdFALSE;
|
||||||
vPortTaskUsesFPU();
|
vPortTaskUsesFPU();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* The variable this task increments to show it is still running is passed in
|
/* The variable this task increments to show it is still running is passed in
|
||||||
as the parameter. */
|
as the parameter. */
|
||||||
pulTaskCheckVariable = ( unsigned long * ) pvParameters;
|
pulTaskCheckVariable = ( unsigned long * ) pvParameters;
|
||||||
|
|
||||||
pdArray = ( portDOUBLE * ) pvPortMalloc( xArraySize * sizeof( portDOUBLE ) );
|
pdArray = ( portDOUBLE * ) pvPortMalloc( xArraySize * sizeof( portDOUBLE ) );
|
||||||
|
|
||||||
/* Keep filling an array, keeping a running total of the values placed in the
|
/* Keep filling an array, keeping a running total of the values placed in the
|
||||||
array. Then run through the array adding up all the values. If the two totals
|
array. Then run through the array adding up all the values. If the two totals
|
||||||
do not match, stop the check variable from incrementing. */
|
do not match, stop the check variable from incrementing. */
|
||||||
for( ;; )
|
for( ;; )
|
||||||
{
|
{
|
||||||
|
@ -339,7 +339,7 @@ short sError = pdFALSE;
|
||||||
for( xPosition = 0; xPosition < xArraySize; xPosition++ )
|
for( xPosition = 0; xPosition < xArraySize; xPosition++ )
|
||||||
{
|
{
|
||||||
pdArray[ xPosition ] = ( portDOUBLE ) xPosition * 12.123;
|
pdArray[ xPosition ] = ( portDOUBLE ) xPosition * 12.123;
|
||||||
dTotal1 += ( portDOUBLE ) xPosition * 12.123;
|
dTotal1 += ( portDOUBLE ) xPosition * 12.123;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if configUSE_PREEMPTION == 0
|
#if configUSE_PREEMPTION == 0
|
||||||
|
@ -363,23 +363,23 @@ short sError = pdFALSE;
|
||||||
|
|
||||||
if( sError == pdFALSE )
|
if( sError == pdFALSE )
|
||||||
{
|
{
|
||||||
/* If the calculation has always been correct, increment the check
|
/* If the calculation has always been correct, increment the check
|
||||||
variable so we know this task is still running okay. */
|
variable so we know this task is still running okay. */
|
||||||
( *pulTaskCheckVariable )++;
|
( *pulTaskCheckVariable )++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
/* This is called to check that all the created tasks are still running. */
|
/* This is called to check that all the created tasks are still running. */
|
||||||
portBASE_TYPE xAreMathsTaskStillRunning( void )
|
portBASE_TYPE xAreMathsTaskStillRunning( void )
|
||||||
{
|
{
|
||||||
/* Keep a history of the check variables so we know if they have been incremented
|
/* Keep a history of the check variables so we know if they have been incremented
|
||||||
since the last call. */
|
since the last call. */
|
||||||
static unsigned long ulLastTaskCheck[ mathNUMBER_OF_TASKS ] = { ( unsigned short ) 0 };
|
static unsigned long ulLastTaskCheck[ mathNUMBER_OF_TASKS ] = { ( unsigned short ) 0 };
|
||||||
portBASE_TYPE xReturn = pdTRUE, xTask;
|
portBASE_TYPE xReturn = pdTRUE, xTask;
|
||||||
|
|
||||||
/* Check the maths tasks are still running by ensuring their check variables
|
/* Check the maths tasks are still running by ensuring their check variables
|
||||||
are still incrementing. */
|
are still incrementing. */
|
||||||
for( xTask = 0; xTask < mathNUMBER_OF_TASKS; xTask++ )
|
for( xTask = 0; xTask < mathNUMBER_OF_TASKS; xTask++ )
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
All rights reserved
|
All rights reserved
|
||||||
|
|
||||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
@ -124,7 +124,7 @@ will remove items as they are added, meaning the send task should always find
|
||||||
the queue empty. */
|
the queue empty. */
|
||||||
#define mainQUEUE_LENGTH ( 1 )
|
#define mainQUEUE_LENGTH ( 1 )
|
||||||
|
|
||||||
/* Values passed to the two tasks just to check the task parameter
|
/* Values passed to the two tasks just to check the task parameter
|
||||||
functionality. */
|
functionality. */
|
||||||
#define mainQUEUE_SEND_PARAMETER ( 0x1111UL )
|
#define mainQUEUE_SEND_PARAMETER ( 0x1111UL )
|
||||||
#define mainQUEUE_RECEIVE_PARAMETER ( 0x22UL )
|
#define mainQUEUE_RECEIVE_PARAMETER ( 0x22UL )
|
||||||
|
@ -160,13 +160,13 @@ void main_blinky( void )
|
||||||
/* Start the two tasks as described in the comments at the top of this
|
/* Start the two tasks as described in the comments at the top of this
|
||||||
file. */
|
file. */
|
||||||
xTaskCreate( prvQueueReceiveTask, /* The function that implements the task. */
|
xTaskCreate( prvQueueReceiveTask, /* The function that implements the task. */
|
||||||
( signed char * ) "Rx", /* The text name assigned to the task - for debug only as it is not used by the kernel. */
|
"Rx", /* The text name assigned to the task - for debug only as it is not used by the kernel. */
|
||||||
configMINIMAL_STACK_SIZE, /* The size of the stack to allocate to the task. */
|
configMINIMAL_STACK_SIZE, /* The size of the stack to allocate to the task. */
|
||||||
( void * ) mainQUEUE_RECEIVE_PARAMETER, /* The parameter passed to the task - just to check the functionality. */
|
( void * ) mainQUEUE_RECEIVE_PARAMETER, /* The parameter passed to the task - just to check the functionality. */
|
||||||
mainQUEUE_RECEIVE_TASK_PRIORITY, /* The priority assigned to the task. */
|
mainQUEUE_RECEIVE_TASK_PRIORITY, /* The priority assigned to the task. */
|
||||||
NULL ); /* The task handle is not required, so NULL is passed. */
|
NULL ); /* The task handle is not required, so NULL is passed. */
|
||||||
|
|
||||||
xTaskCreate( prvQueueSendTask, ( signed char * ) "TX", configMINIMAL_STACK_SIZE, ( void * ) mainQUEUE_SEND_PARAMETER, mainQUEUE_SEND_TASK_PRIORITY, NULL );
|
xTaskCreate( prvQueueSendTask, "TX", configMINIMAL_STACK_SIZE, ( void * ) mainQUEUE_SEND_PARAMETER, mainQUEUE_SEND_TASK_PRIORITY, NULL );
|
||||||
|
|
||||||
/* Start the tasks and timer running. */
|
/* Start the tasks and timer running. */
|
||||||
vTaskStartScheduler();
|
vTaskStartScheduler();
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
All rights reserved
|
All rights reserved
|
||||||
|
|
||||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
@ -105,7 +105,7 @@
|
||||||
* software time maintains a pattern of spinning white LEDs.
|
* software time maintains a pattern of spinning white LEDs.
|
||||||
*
|
*
|
||||||
* See the documentation page for this demo on the FreeRTOS.org web site for
|
* See the documentation page for this demo on the FreeRTOS.org web site for
|
||||||
* full information, including hardware setup requirements.
|
* full information, including hardware setup requirements.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Standard includes. */
|
/* Standard includes. */
|
||||||
|
@ -203,19 +203,19 @@ xTimerHandle xTimer = NULL;
|
||||||
vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED );
|
vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED );
|
||||||
|
|
||||||
/* Create the register test tasks, as described at the top of this file. */
|
/* Create the register test tasks, as described at the top of this file. */
|
||||||
xTaskCreate( vRegTestTask1, ( const signed char * ) "Reg1...", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );
|
xTaskCreate( vRegTestTask1, "Reg1...", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );
|
||||||
xTaskCreate( vRegTestTask2, ( const signed char * ) "Reg2...", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );
|
xTaskCreate( vRegTestTask2, "Reg2...", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );
|
||||||
|
|
||||||
|
|
||||||
/* Create the software timer that performs the 'check' functionality,
|
/* Create the software timer that performs the 'check' functionality,
|
||||||
as described at the top of this file. */
|
as described at the top of this file. */
|
||||||
xTimer = xTimerCreate( ( const signed char * ) "CheckTimer",/* A text name, purely to help debugging. */
|
xTimer = xTimerCreate( "CheckTimer", /* A text name, purely to help debugging. */
|
||||||
( mainCHECK_TIMER_PERIOD_MS ), /* The timer period, in this case 3000ms (3s). */
|
( mainCHECK_TIMER_PERIOD_MS ), /* The timer period, in this case 3000ms (3s). */
|
||||||
pdTRUE, /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */
|
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. */
|
( 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. */
|
prvCheckTimerCallback /* The callback function that inspects the status of all the other tasks. */
|
||||||
);
|
);
|
||||||
|
|
||||||
if( xTimer != NULL )
|
if( xTimer != NULL )
|
||||||
{
|
{
|
||||||
xTimerStart( xTimer, mainDONT_BLOCK );
|
xTimerStart( xTimer, mainDONT_BLOCK );
|
||||||
|
@ -223,11 +223,11 @@ xTimerHandle xTimer = NULL;
|
||||||
|
|
||||||
/* Create the software timer that performs the 'LED spin' functionality,
|
/* Create the software timer that performs the 'LED spin' functionality,
|
||||||
as described at the top of this file. */
|
as described at the top of this file. */
|
||||||
xTimer = xTimerCreate( ( const signed char * ) "LEDTimer", /* A text name, purely to help debugging. */
|
xTimer = xTimerCreate( "LEDTimer", /* A text name, purely to help debugging. */
|
||||||
( mainLED_TIMER_PERIOD_MS ), /* The timer period, in this case 75ms. */
|
( mainLED_TIMER_PERIOD_MS ),/* The timer period, in this case 75ms. */
|
||||||
pdTRUE, /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */
|
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. */
|
( void * ) 0, /* The ID is not used, so can be set to anything. */
|
||||||
prvLEDTimerCallback /* The callback function that toggles the white LEDs. */
|
prvLEDTimerCallback /* The callback function that toggles the white LEDs. */
|
||||||
);
|
);
|
||||||
|
|
||||||
if( xTimer != NULL )
|
if( xTimer != NULL )
|
||||||
|
@ -235,20 +235,20 @@ xTimerHandle xTimer = NULL;
|
||||||
xTimerStart( xTimer, mainDONT_BLOCK );
|
xTimerStart( xTimer, mainDONT_BLOCK );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The set of tasks created by the following function call have to be
|
/* The set of tasks created by the following function call have to be
|
||||||
created last as they keep account of the number of tasks they expect to see
|
created last as they keep account of the number of tasks they expect to see
|
||||||
running. */
|
running. */
|
||||||
vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY );
|
vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY );
|
||||||
|
|
||||||
/* Start the scheduler. */
|
/* Start the scheduler. */
|
||||||
vTaskStartScheduler();
|
vTaskStartScheduler();
|
||||||
|
|
||||||
/* If all is well, the scheduler will now be running, and the following line
|
/* If all is well, the scheduler will now be running, and the following line
|
||||||
will never be reached. If the following line does execute, then there was
|
will never be reached. If the following line does execute, then there was
|
||||||
insufficient FreeRTOS heap memory available for the idle and/or timer tasks
|
insufficient FreeRTOS heap memory available for the idle and/or timer tasks
|
||||||
to be created. See the memory management section on the FreeRTOS web site
|
to be created. See the memory management section on the FreeRTOS web site
|
||||||
for more details. */
|
for more details. */
|
||||||
for( ;; );
|
for( ;; );
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
@ -340,7 +340,7 @@ const unsigned long ulRedLED1 = 6, ulRedLED2 = 9;
|
||||||
LEDs are toggling, then an error has been reported in at least one task. */
|
LEDs are toggling, then an error has been reported in at least one task. */
|
||||||
vParTestToggleLED( ulLED1 );
|
vParTestToggleLED( ulLED1 );
|
||||||
vParTestToggleLED( ulLED2 );
|
vParTestToggleLED( ulLED2 );
|
||||||
|
|
||||||
/* Have any errors been latch in ulErrorFound? If so, ensure the gree LEDs
|
/* Have any errors been latch in ulErrorFound? If so, ensure the gree LEDs
|
||||||
are off, then switch to using the red LEDs. */
|
are off, then switch to using the red LEDs. */
|
||||||
if( ulErrorFound != pdFALSE )
|
if( ulErrorFound != pdFALSE )
|
||||||
|
@ -348,7 +348,7 @@ const unsigned long ulRedLED1 = 6, ulRedLED2 = 9;
|
||||||
if( lChangeToRedLEDsAlready == pdFALSE )
|
if( lChangeToRedLEDsAlready == pdFALSE )
|
||||||
{
|
{
|
||||||
lChangeToRedLEDsAlready = pdTRUE;
|
lChangeToRedLEDsAlready = pdTRUE;
|
||||||
|
|
||||||
/* An error has been found. Switch to use the red LEDs. */
|
/* An error has been found. Switch to use the red LEDs. */
|
||||||
vParTestSetLED( ulLED1, pdFALSE );
|
vParTestSetLED( ulLED1, pdFALSE );
|
||||||
vParTestSetLED( ulLED2, pdFALSE );
|
vParTestSetLED( ulLED2, pdFALSE );
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
All rights reserved
|
All rights reserved
|
||||||
|
|
||||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
@ -65,20 +65,20 @@
|
||||||
|
|
||||||
/*
|
/*
|
||||||
This simple demo project runs on the STM32 Discovery board, which is
|
This simple demo project runs on the STM32 Discovery board, which is
|
||||||
populated with an STM32F100RB Cortex-M3 microcontroller. The discovery board
|
populated with an STM32F100RB Cortex-M3 microcontroller. The discovery board
|
||||||
makes an ideal low cost evaluation platform, but the 8K of RAM provided on the
|
makes an ideal low cost evaluation platform, but the 8K of RAM provided on the
|
||||||
STM32F100RB does not allow the simple application to demonstrate all of all the
|
STM32F100RB does not allow the simple application to demonstrate all of all the
|
||||||
FreeRTOS kernel features. Therefore, this simple demo only actively
|
FreeRTOS kernel features. Therefore, this simple demo only actively
|
||||||
demonstrates task, queue, timer and interrupt functionality. In addition, the
|
demonstrates task, queue, timer and interrupt functionality. In addition, the
|
||||||
demo is configured to include malloc failure, idle and stack overflow hook
|
demo is configured to include malloc failure, idle and stack overflow hook
|
||||||
functions.
|
functions.
|
||||||
|
|
||||||
The idle hook function:
|
The idle hook function:
|
||||||
The idle hook function queries the amount of FreeRTOS heap space that is
|
The idle hook function queries the amount of FreeRTOS heap space that is
|
||||||
remaining (see vApplicationIdleHook() defined in this file). The demo
|
remaining (see vApplicationIdleHook() defined in this file). The demo
|
||||||
application is configured to use 7K of the available 8K of RAM as the FreeRTOS
|
application is configured to use 7K of the available 8K of RAM as the FreeRTOS
|
||||||
heap. Memory is only allocated from this heap during initialisation, and this
|
heap. Memory is only allocated from this heap during initialisation, and this
|
||||||
demo only actually uses 1.6K bytes of the configured 7K available - leaving 5.4K
|
demo only actually uses 1.6K bytes of the configured 7K available - leaving 5.4K
|
||||||
bytes of heap space unallocated.
|
bytes of heap space unallocated.
|
||||||
|
|
||||||
The main() Function:
|
The main() Function:
|
||||||
|
@ -86,31 +86,31 @@ main() creates one software timer, one queue, and two tasks. It then starts the
|
||||||
scheduler.
|
scheduler.
|
||||||
|
|
||||||
The Queue Send Task:
|
The Queue Send Task:
|
||||||
The queue send task is implemented by the prvQueueSendTask() function in this
|
The queue send task is implemented by the prvQueueSendTask() function in this
|
||||||
file. prvQueueSendTask() sits in a loop that causes it to repeatedly block for
|
file. prvQueueSendTask() sits in a loop that causes it to repeatedly block for
|
||||||
200 milliseconds, before sending the value 100 to the queue that was created
|
200 milliseconds, before sending the value 100 to the queue that was created
|
||||||
within main(). Once the value is sent, the task loops back around to block for
|
within main(). Once the value is sent, the task loops back around to block for
|
||||||
another 200 milliseconds.
|
another 200 milliseconds.
|
||||||
|
|
||||||
The Queue Receive Task:
|
The Queue Receive Task:
|
||||||
The queue receive task is implemented by the prvQueueReceiveTask() function
|
The queue receive task is implemented by the prvQueueReceiveTask() function
|
||||||
in this file. prvQueueReceiveTask() sits in a loop where it repeatedly blocks
|
in this file. prvQueueReceiveTask() sits in a loop where it repeatedly blocks
|
||||||
on attempts to read data from the queue that was created within main(). When
|
on attempts to read data from the queue that was created within main(). When
|
||||||
data is received, the task checks the value of the data, and if the value equals
|
data is received, the task checks the value of the data, and if the value equals
|
||||||
the expected 100, toggles the green LED. The 'block time' parameter passed to
|
the expected 100, toggles the green LED. The 'block time' parameter passed to
|
||||||
the queue receive function specifies that the task should be held in the Blocked
|
the queue receive function specifies that the task should be held in the Blocked
|
||||||
state indefinitely to wait for data to be available on the queue. The queue
|
state indefinitely to wait for data to be available on the queue. The queue
|
||||||
receive task will only leave the Blocked state when the queue send task writes
|
receive task will only leave the Blocked state when the queue send task writes
|
||||||
to the queue. As the queue send task writes to the queue every 200
|
to the queue. As the queue send task writes to the queue every 200
|
||||||
milliseconds, the queue receive task leaves the Blocked state every 200
|
milliseconds, the queue receive task leaves the Blocked state every 200
|
||||||
milliseconds, and therefore toggles the green LED every 200 milliseconds.
|
milliseconds, and therefore toggles the green LED every 200 milliseconds.
|
||||||
|
|
||||||
The LED Software Timer and the Button Interrupt:
|
The LED Software Timer and the Button Interrupt:
|
||||||
The user button B1 is configured to generate an interrupt each time it is
|
The user button B1 is configured to generate an interrupt each time it is
|
||||||
pressed. The interrupt service routine switches the red LED on, and resets the
|
pressed. The interrupt service routine switches the red LED on, and resets the
|
||||||
LED software timer. The LED timer has a 5000 millisecond (5 second) period, and
|
LED software timer. The LED timer has a 5000 millisecond (5 second) period, and
|
||||||
uses a callback function that is defined to just turn the red LED off.
|
uses a callback function that is defined to just turn the red LED off.
|
||||||
Therefore, pressing the user button will turn the red LED on, and the LED will
|
Therefore, pressing the user button will turn the red LED on, and the LED will
|
||||||
remain on until a full five seconds pass without the button being pressed.
|
remain on until a full five seconds pass without the button being pressed.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -152,7 +152,7 @@ static void prvQueueReceiveTask( void *pvParameters );
|
||||||
static void prvQueueSendTask( void *pvParameters );
|
static void prvQueueSendTask( void *pvParameters );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The LED timer callback function. This does nothing but switch the red LED
|
* The LED timer callback function. This does nothing but switch the red LED
|
||||||
* off.
|
* off.
|
||||||
*/
|
*/
|
||||||
static void vLEDTimerCallback( xTimerHandle xTimer );
|
static void vLEDTimerCallback( xTimerHandle xTimer );
|
||||||
|
@ -163,7 +163,7 @@ static void vLEDTimerCallback( xTimerHandle xTimer );
|
||||||
static xQueueHandle xQueue = NULL;
|
static xQueueHandle xQueue = NULL;
|
||||||
|
|
||||||
/* The LED software timer. This uses vLEDTimerCallback() as its callback
|
/* The LED software timer. This uses vLEDTimerCallback() as its callback
|
||||||
* function.
|
* function.
|
||||||
*/
|
*/
|
||||||
static xTimerHandle xLEDTimer = NULL;
|
static xTimerHandle xLEDTimer = NULL;
|
||||||
|
|
||||||
|
@ -181,17 +181,17 @@ int main(void)
|
||||||
{
|
{
|
||||||
/* Start the two tasks as described in the comments at the top of this
|
/* Start the two tasks as described in the comments at the top of this
|
||||||
file. */
|
file. */
|
||||||
xTaskCreate( prvQueueReceiveTask, ( signed char * ) "Rx", configMINIMAL_STACK_SIZE, NULL, mainQUEUE_RECEIVE_TASK_PRIORITY, NULL );
|
xTaskCreate( prvQueueReceiveTask, "Rx", configMINIMAL_STACK_SIZE, NULL, mainQUEUE_RECEIVE_TASK_PRIORITY, NULL );
|
||||||
xTaskCreate( prvQueueSendTask, ( signed char * ) "TX", configMINIMAL_STACK_SIZE, NULL, mainQUEUE_SEND_TASK_PRIORITY, NULL );
|
xTaskCreate( prvQueueSendTask, "TX", configMINIMAL_STACK_SIZE, NULL, mainQUEUE_SEND_TASK_PRIORITY, NULL );
|
||||||
|
|
||||||
/* Create the software timer that is responsible for turning off the LED
|
/* Create the software timer that is responsible for turning off the LED
|
||||||
if the button is not pushed within 5000ms, as described at the top of
|
if the button is not pushed within 5000ms, as described at the top of
|
||||||
this file. */
|
this file. */
|
||||||
xLEDTimer = xTimerCreate( ( const signed char * ) "LEDTimer", /* A text name, purely to help debugging. */
|
xLEDTimer = xTimerCreate( "LEDTimer", /* A text name, purely to help debugging. */
|
||||||
( 5000 / portTICK_RATE_MS ), /* The timer period, in this case 5000ms (5s). */
|
( 5000 / portTICK_RATE_MS ),/* The timer period, in this case 5000ms (5s). */
|
||||||
pdFALSE, /* This is a one shot timer, so xAutoReload is set to pdFALSE. */
|
pdFALSE, /* This is a one shot timer, so xAutoReload is set to pdFALSE. */
|
||||||
( void * ) 0, /* The ID is not used, so can be set to anything. */
|
( void * ) 0, /* The ID is not used, so can be set to anything. */
|
||||||
vLEDTimerCallback /* The callback function that switches the LED off. */
|
vLEDTimerCallback /* The callback function that switches the LED off. */
|
||||||
);
|
);
|
||||||
|
|
||||||
/* Start the tasks and timer running. */
|
/* Start the tasks and timer running. */
|
||||||
|
@ -286,8 +286,8 @@ unsigned long ulReceivedValue;
|
||||||
if( ulReceivedValue == 100UL )
|
if( ulReceivedValue == 100UL )
|
||||||
{
|
{
|
||||||
/* NOTE - accessing the LED port should use a critical section
|
/* NOTE - accessing the LED port should use a critical section
|
||||||
because it is accessed from multiple tasks, and the button interrupt
|
because it is accessed from multiple tasks, and the button interrupt
|
||||||
- in this trivial case, for simplicity, the critical section is
|
- in this trivial case, for simplicity, the critical section is
|
||||||
omitted. */
|
omitted. */
|
||||||
STM32vldiscovery_LEDToggle( LED3 );
|
STM32vldiscovery_LEDToggle( LED3 );
|
||||||
}
|
}
|
||||||
|
@ -305,7 +305,7 @@ static void prvSetupHardware( void )
|
||||||
STM32vldiscovery_LEDInit( LED3 );
|
STM32vldiscovery_LEDInit( LED3 );
|
||||||
STM32vldiscovery_LEDInit( LED4 );
|
STM32vldiscovery_LEDInit( LED4 );
|
||||||
STM32vldiscovery_PBInit( BUTTON_USER, BUTTON_MODE_EXTI );
|
STM32vldiscovery_PBInit( BUTTON_USER, BUTTON_MODE_EXTI );
|
||||||
|
|
||||||
/* Start with the LEDs off. */
|
/* Start with the LEDs off. */
|
||||||
STM32vldiscovery_LEDOff( LED3 );
|
STM32vldiscovery_LEDOff( LED3 );
|
||||||
STM32vldiscovery_LEDOff( LED4 );
|
STM32vldiscovery_LEDOff( LED4 );
|
||||||
|
@ -316,7 +316,7 @@ void vApplicationMallocFailedHook( void )
|
||||||
{
|
{
|
||||||
/* Called if a call to pvPortMalloc() fails because there is insufficient
|
/* Called if a call to pvPortMalloc() fails because there is insufficient
|
||||||
free memory available in the FreeRTOS heap. pvPortMalloc() is called
|
free memory available in the FreeRTOS heap. pvPortMalloc() is called
|
||||||
internally by FreeRTOS API functions that create tasks, queues, software
|
internally by FreeRTOS API functions that create tasks, queues, software
|
||||||
timers, and semaphores. The size of the FreeRTOS heap is set by the
|
timers, and semaphores. The size of the FreeRTOS heap is set by the
|
||||||
configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h. */
|
configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h. */
|
||||||
for( ;; );
|
for( ;; );
|
||||||
|
@ -340,7 +340,7 @@ void vApplicationIdleHook( void )
|
||||||
volatile size_t xFreeStackSpace;
|
volatile size_t xFreeStackSpace;
|
||||||
|
|
||||||
/* This function is called on each cycle of the idle task. In this case it
|
/* This function is called on each cycle of the idle task. In this case it
|
||||||
does nothing useful, other than report the amout of FreeRTOS heap that
|
does nothing useful, other than report the amout of FreeRTOS heap that
|
||||||
remains unallocated. */
|
remains unallocated. */
|
||||||
xFreeStackSpace = xPortGetFreeHeapSize();
|
xFreeStackSpace = xPortGetFreeHeapSize();
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
All rights reserved
|
All rights reserved
|
||||||
|
|
||||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
@ -74,28 +74,28 @@
|
||||||
* defined and/or created within this file:
|
* defined and/or created within this file:
|
||||||
*
|
*
|
||||||
* "Check" task - This only executes every five seconds but has the highest
|
* "Check" task - This only executes every five seconds but has the highest
|
||||||
* priority so is guaranteed to get processor time. Its main function is to
|
* priority so is guaranteed to get processor time. Its main function is to
|
||||||
* check that all the standard demo tasks are still operational. The check task
|
* check that all the standard demo tasks are still operational. The check task
|
||||||
* will toggle LED 3 (PB11) every five seconds so long as no errors have been
|
* will toggle LED 3 (PB11) every five seconds so long as no errors have been
|
||||||
* detected. The toggle rate will increase to half a second if an error has
|
* detected. The toggle rate will increase to half a second if an error has
|
||||||
* been found in any task.
|
* been found in any task.
|
||||||
*
|
*
|
||||||
* "Echo" task - This is a very basic task that simply echoes any characters
|
* "Echo" task - This is a very basic task that simply echoes any characters
|
||||||
* received on COM0 (USART1). This can be tested by transmitting a text file
|
* received on COM0 (USART1). This can be tested by transmitting a text file
|
||||||
* from a dumb terminal to the STM32 USART then observing or capturing the text
|
* from a dumb terminal to the STM32 USART then observing or capturing the text
|
||||||
* that is echoed back. Missing characters will be all the more obvious if the
|
* that is echoed back. Missing characters will be all the more obvious if the
|
||||||
* file contains a simple repeating string of fixed width.
|
* file contains a simple repeating string of fixed width.
|
||||||
*
|
*
|
||||||
* Currently this demo does not include interrupt nesting examples. High
|
* Currently this demo does not include interrupt nesting examples. High
|
||||||
* frequency timer and simpler nesting examples can be found in most Cortex-M3
|
* frequency timer and simpler nesting examples can be found in most Cortex-M3
|
||||||
* demo applications.
|
* demo applications.
|
||||||
*
|
*
|
||||||
* The functions used to initialise, set and clear LED outputs are normally
|
* The functions used to initialise, set and clear LED outputs are normally
|
||||||
* defined in partest.c. This demo includes two partest files, one that is
|
* defined in partest.c. This demo includes two partest files, one that is
|
||||||
* configured for use with the Keil MCBSTM32 evaluation board (called
|
* configured for use with the Keil MCBSTM32 evaluation board (called
|
||||||
* ParTest_MCBSTM32.c) and one that is configured for use with the official
|
* ParTest_MCBSTM32.c) and one that is configured for use with the official
|
||||||
* ST Eval board (called ParTest_ST_Eval.c). One one of these files should be
|
* ST Eval board (called ParTest_ST_Eval.c). One one of these files should be
|
||||||
* included in the build at any one time, as appropriate for the hardware
|
* included in the build at any one time, as appropriate for the hardware
|
||||||
* actually being used.
|
* actually being used.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -155,7 +155,7 @@ static void prvSetupHardware( void );
|
||||||
/* The 'check' task as described at the top of this file. */
|
/* The 'check' task as described at the top of this file. */
|
||||||
static void prvCheckTask( void *pvParameters );
|
static void prvCheckTask( void *pvParameters );
|
||||||
|
|
||||||
/* A simple task that echoes all the characters that are received on COM0
|
/* A simple task that echoes all the characters that are received on COM0
|
||||||
(USART1). */
|
(USART1). */
|
||||||
static void prvUSARTEchoTask( void *pvParameters );
|
static void prvUSARTEchoTask( void *pvParameters );
|
||||||
|
|
||||||
|
@ -181,10 +181,10 @@ int main( void )
|
||||||
vStartRecursiveMutexTasks();
|
vStartRecursiveMutexTasks();
|
||||||
|
|
||||||
/* Create the 'echo' task, which is also defined within this file. */
|
/* Create the 'echo' task, which is also defined within this file. */
|
||||||
xTaskCreate( prvUSARTEchoTask, ( signed char * ) "Echo", configMINIMAL_STACK_SIZE, NULL, mainECHO_TASK_PRIORITY, NULL );
|
xTaskCreate( prvUSARTEchoTask, "Echo", configMINIMAL_STACK_SIZE, NULL, mainECHO_TASK_PRIORITY, NULL );
|
||||||
|
|
||||||
/* Create the 'check' task, which is also defined within this file. */
|
/* Create the 'check' task, which is also defined within this file. */
|
||||||
xTaskCreate( prvCheckTask, ( signed char * ) "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );
|
xTaskCreate( prvCheckTask, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );
|
||||||
|
|
||||||
/* Start the scheduler. */
|
/* Start the scheduler. */
|
||||||
vTaskStartScheduler();
|
vTaskStartScheduler();
|
||||||
|
@ -254,7 +254,7 @@ signed char cChar;
|
||||||
|
|
||||||
/* String declared static to ensure it does not end up on the stack, no matter
|
/* String declared static to ensure it does not end up on the stack, no matter
|
||||||
what the optimisation level. */
|
what the optimisation level. */
|
||||||
static const char *pcLongishString =
|
static const char *pcLongishString =
|
||||||
"ABBA was a Swedish pop music group formed in Stockholm in 1972, consisting of Anni-Frid Frida Lyngstad, "
|
"ABBA was a Swedish pop music group formed in Stockholm in 1972, consisting of Anni-Frid Frida Lyngstad, "
|
||||||
"Björn Ulvaeus, Benny Andersson and Agnetha Fältskog. Throughout the band's existence, Fältskog and Ulvaeus "
|
"Björn Ulvaeus, Benny Andersson and Agnetha Fältskog. Throughout the band's existence, Fältskog and Ulvaeus "
|
||||||
"were a married couple, as were Lyngstad and Andersson - although both couples later divorced. They became one "
|
"were a married couple, as were Lyngstad and Andersson - although both couples later divorced. They became one "
|
||||||
|
@ -293,41 +293,41 @@ static const char *pcLongishString =
|
||||||
static void prvSetupHardware( void )
|
static void prvSetupHardware( void )
|
||||||
{
|
{
|
||||||
/* RCC system reset(for debug purpose). */
|
/* RCC system reset(for debug purpose). */
|
||||||
RCC_DeInit ();
|
RCC_DeInit ();
|
||||||
|
|
||||||
/* Enable HSE. */
|
/* Enable HSE. */
|
||||||
RCC_HSEConfig( RCC_HSE_ON );
|
RCC_HSEConfig( RCC_HSE_ON );
|
||||||
|
|
||||||
/* Wait till HSE is ready. */
|
/* Wait till HSE is ready. */
|
||||||
while (RCC_GetFlagStatus(RCC_FLAG_HSERDY) == RESET);
|
while (RCC_GetFlagStatus(RCC_FLAG_HSERDY) == RESET);
|
||||||
|
|
||||||
/* HCLK = SYSCLK. */
|
/* HCLK = SYSCLK. */
|
||||||
RCC_HCLKConfig( RCC_SYSCLK_Div1 );
|
RCC_HCLKConfig( RCC_SYSCLK_Div1 );
|
||||||
|
|
||||||
/* PCLK2 = HCLK. */
|
/* PCLK2 = HCLK. */
|
||||||
RCC_PCLK2Config( RCC_HCLK_Div1 );
|
RCC_PCLK2Config( RCC_HCLK_Div1 );
|
||||||
|
|
||||||
/* PCLK1 = HCLK/2. */
|
/* PCLK1 = HCLK/2. */
|
||||||
RCC_PCLK1Config( RCC_HCLK_Div2 );
|
RCC_PCLK1Config( RCC_HCLK_Div2 );
|
||||||
|
|
||||||
/* ADCCLK = PCLK2/4. */
|
/* ADCCLK = PCLK2/4. */
|
||||||
RCC_ADCCLKConfig( RCC_PCLK2_Div4 );
|
RCC_ADCCLKConfig( RCC_PCLK2_Div4 );
|
||||||
|
|
||||||
/* Flash 2 wait state. */
|
/* Flash 2 wait state. */
|
||||||
*( volatile unsigned long * )0x40022000 = 0x01;
|
*( volatile unsigned long * )0x40022000 = 0x01;
|
||||||
|
|
||||||
/* PLLCLK = 8MHz * 9 = 72 MHz */
|
/* PLLCLK = 8MHz * 9 = 72 MHz */
|
||||||
RCC_PLLConfig( RCC_PLLSource_HSE_Div1, RCC_PLLMul_9 );
|
RCC_PLLConfig( RCC_PLLSource_HSE_Div1, RCC_PLLMul_9 );
|
||||||
|
|
||||||
/* Enable PLL. */
|
/* Enable PLL. */
|
||||||
RCC_PLLCmd( ENABLE );
|
RCC_PLLCmd( ENABLE );
|
||||||
|
|
||||||
/* Wait till PLL is ready. */
|
/* Wait till PLL is ready. */
|
||||||
while (RCC_GetFlagStatus(RCC_FLAG_PLLRDY) == RESET);
|
while (RCC_GetFlagStatus(RCC_FLAG_PLLRDY) == RESET);
|
||||||
|
|
||||||
/* Select PLL as system clock source. */
|
/* Select PLL as system clock source. */
|
||||||
RCC_SYSCLKConfig (RCC_SYSCLKSource_PLLCLK);
|
RCC_SYSCLKConfig (RCC_SYSCLKSource_PLLCLK);
|
||||||
|
|
||||||
/* Wait till PLL is used as system clock source. */
|
/* Wait till PLL is used as system clock source. */
|
||||||
while (RCC_GetSYSCLKSource() != 0x08);
|
while (RCC_GetSYSCLKSource() != 0x08);
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
All rights reserved
|
All rights reserved
|
||||||
|
|
||||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
@ -220,7 +220,7 @@ int main( void )
|
||||||
/* Create the queue used by the LCD task. Messages for display on the LCD
|
/* Create the queue used by the LCD task. Messages for display on the LCD
|
||||||
are received via this queue. */
|
are received via this queue. */
|
||||||
xLCDQueue = xQueueCreate( mainLCD_QUEUE_SIZE, sizeof( xLCDMessage ) );
|
xLCDQueue = xQueueCreate( mainLCD_QUEUE_SIZE, sizeof( xLCDMessage ) );
|
||||||
|
|
||||||
/* Start the standard demo tasks. */
|
/* Start the standard demo tasks. */
|
||||||
vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY );
|
vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY );
|
||||||
vCreateBlockTimeTasks();
|
vCreateBlockTimeTasks();
|
||||||
|
@ -231,20 +231,20 @@ int main( void )
|
||||||
vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED );
|
vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED );
|
||||||
|
|
||||||
/* Start the tasks defined within this file/specific to this demo. */
|
/* Start the tasks defined within this file/specific to this demo. */
|
||||||
xTaskCreate( vCheckTask, ( signed portCHAR * ) "Check", mainCHECK_TASK_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );
|
xTaskCreate( vCheckTask, "Check", mainCHECK_TASK_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );
|
||||||
xTaskCreate( vLCDTask, ( signed portCHAR * ) "LCD", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );
|
xTaskCreate( vLCDTask, "LCD", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );
|
||||||
|
|
||||||
/* The suicide tasks must be created last as they need to know how many
|
/* The suicide tasks must be created last as they need to know how many
|
||||||
tasks were running prior to their creation in order to ascertain whether
|
tasks were running prior to their creation in order to ascertain whether
|
||||||
or not the correct/expected number of tasks are running at any given time. */
|
or not the correct/expected number of tasks are running at any given time. */
|
||||||
vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY );
|
vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY );
|
||||||
|
|
||||||
/* Configure the timers used by the fast interrupt timer test. */
|
/* Configure the timers used by the fast interrupt timer test. */
|
||||||
vSetupTimerTest();
|
vSetupTimerTest();
|
||||||
|
|
||||||
/* Start the scheduler. */
|
/* Start the scheduler. */
|
||||||
vTaskStartScheduler();
|
vTaskStartScheduler();
|
||||||
|
|
||||||
/* Will only get here if there was not enough heap space to create the
|
/* Will only get here if there was not enough heap space to create the
|
||||||
idle task. */
|
idle task. */
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -279,7 +279,7 @@ extern unsigned portSHORT usMaxJitter;
|
||||||
|
|
||||||
xLastExecutionTime = xTaskGetTickCount();
|
xLastExecutionTime = xTaskGetTickCount();
|
||||||
xMessage.pcMessage = cPassMessage;
|
xMessage.pcMessage = cPassMessage;
|
||||||
|
|
||||||
for( ;; )
|
for( ;; )
|
||||||
{
|
{
|
||||||
/* Perform this check every mainCHECK_DELAY milliseconds. */
|
/* Perform this check every mainCHECK_DELAY milliseconds. */
|
||||||
|
@ -314,7 +314,7 @@ extern unsigned portSHORT usMaxJitter;
|
||||||
else if( xAreComTestTasksStillRunning() != pdTRUE )
|
else if( xAreComTestTasksStillRunning() != pdTRUE )
|
||||||
{
|
{
|
||||||
xMessage.pcMessage = "ERROR IN COM TEST\n";
|
xMessage.pcMessage = "ERROR IN COM TEST\n";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sprintf( ( portCHAR * ) cPassMessage, "PASS [%uns]\n", ( ( unsigned portLONG ) usMaxJitter ) * mainNS_PER_CLOCK );
|
sprintf( ( portCHAR * ) cPassMessage, "PASS [%uns]\n", ( ( unsigned portLONG ) usMaxJitter ) * mainNS_PER_CLOCK );
|
||||||
|
@ -382,10 +382,10 @@ static void prvSetupHardware( void )
|
||||||
NVIC_SetVectorTable( NVIC_VectTab_FLASH, 0x0 );
|
NVIC_SetVectorTable( NVIC_VectTab_FLASH, 0x0 );
|
||||||
|
|
||||||
NVIC_PriorityGroupConfig( NVIC_PriorityGroup_4 );
|
NVIC_PriorityGroupConfig( NVIC_PriorityGroup_4 );
|
||||||
|
|
||||||
/* Configure HCLK clock as SysTick clock source. */
|
/* Configure HCLK clock as SysTick clock source. */
|
||||||
SysTick_CLKSourceConfig( SysTick_CLKSource_HCLK );
|
SysTick_CLKSourceConfig( SysTick_CLKSource_HCLK );
|
||||||
|
|
||||||
vParTestInitialise();
|
vParTestInitialise();
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
@ -430,10 +430,10 @@ static unsigned portCHAR ucLine = 0;
|
||||||
{
|
{
|
||||||
/* Display one character on LCD */
|
/* Display one character on LCD */
|
||||||
LCD_DisplayChar( ucLine, usRefColumn, (u8) ch );
|
LCD_DisplayChar( ucLine, usRefColumn, (u8) ch );
|
||||||
|
|
||||||
/* Decrement the column position by 16 */
|
/* Decrement the column position by 16 */
|
||||||
usRefColumn -= mainCOLUMN_INCREMENT;
|
usRefColumn -= mainCOLUMN_INCREMENT;
|
||||||
|
|
||||||
/* Increment the character counter */
|
/* Increment the character counter */
|
||||||
usColumn++;
|
usColumn++;
|
||||||
if( usColumn == mainMAX_COLUMN )
|
if( usColumn == mainMAX_COLUMN )
|
||||||
|
@ -448,7 +448,7 @@ static unsigned portCHAR ucLine = 0;
|
||||||
/* Move back to the first column of the next line. */
|
/* Move back to the first column of the next line. */
|
||||||
ucLine += mainROW_INCREMENT;
|
ucLine += mainROW_INCREMENT;
|
||||||
usRefColumn = mainCOLUMN_START;
|
usRefColumn = mainCOLUMN_START;
|
||||||
usColumn = 0;
|
usColumn = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Wrap back to the top of the display. */
|
/* Wrap back to the top of the display. */
|
||||||
|
@ -456,7 +456,7 @@ static unsigned portCHAR ucLine = 0;
|
||||||
{
|
{
|
||||||
ucLine = 0;
|
ucLine = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ch;
|
return ch;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
All rights reserved
|
All rights reserved
|
||||||
|
|
||||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
@ -220,7 +220,7 @@ int main( void )
|
||||||
/* Create the queue used by the LCD task. Messages for display on the LCD
|
/* Create the queue used by the LCD task. Messages for display on the LCD
|
||||||
are received via this queue. */
|
are received via this queue. */
|
||||||
xLCDQueue = xQueueCreate( mainLCD_QUEUE_SIZE, sizeof( xLCDMessage ) );
|
xLCDQueue = xQueueCreate( mainLCD_QUEUE_SIZE, sizeof( xLCDMessage ) );
|
||||||
|
|
||||||
/* Start the standard demo tasks. */
|
/* Start the standard demo tasks. */
|
||||||
vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY );
|
vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY );
|
||||||
vCreateBlockTimeTasks();
|
vCreateBlockTimeTasks();
|
||||||
|
@ -231,20 +231,20 @@ int main( void )
|
||||||
vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED );
|
vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED );
|
||||||
|
|
||||||
/* Start the tasks defined within this file/specific to this demo. */
|
/* Start the tasks defined within this file/specific to this demo. */
|
||||||
xTaskCreate( vCheckTask, ( signed portCHAR * ) "Check", mainCHECK_TASK_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );
|
xTaskCreate( vCheckTask, "Check", mainCHECK_TASK_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );
|
||||||
xTaskCreate( vLCDTask, ( signed portCHAR * ) "LCD", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );
|
xTaskCreate( vLCDTask, "LCD", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );
|
||||||
|
|
||||||
/* The suicide tasks must be created last as they need to know how many
|
/* The suicide tasks must be created last as they need to know how many
|
||||||
tasks were running prior to their creation in order to ascertain whether
|
tasks were running prior to their creation in order to ascertain whether
|
||||||
or not the correct/expected number of tasks are running at any given time. */
|
or not the correct/expected number of tasks are running at any given time. */
|
||||||
vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY );
|
vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY );
|
||||||
|
|
||||||
/* Configure the timers used by the fast interrupt timer test. */
|
/* Configure the timers used by the fast interrupt timer test. */
|
||||||
vSetupTimerTest();
|
vSetupTimerTest();
|
||||||
|
|
||||||
/* Start the scheduler. */
|
/* Start the scheduler. */
|
||||||
vTaskStartScheduler();
|
vTaskStartScheduler();
|
||||||
|
|
||||||
/* Will only get here if there was not enough heap space to create the
|
/* Will only get here if there was not enough heap space to create the
|
||||||
idle task. */
|
idle task. */
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -279,7 +279,7 @@ extern unsigned portSHORT usMaxJitter;
|
||||||
|
|
||||||
xLastExecutionTime = xTaskGetTickCount();
|
xLastExecutionTime = xTaskGetTickCount();
|
||||||
xMessage.pcMessage = cPassMessage;
|
xMessage.pcMessage = cPassMessage;
|
||||||
|
|
||||||
for( ;; )
|
for( ;; )
|
||||||
{
|
{
|
||||||
/* Perform this check every mainCHECK_DELAY milliseconds. */
|
/* Perform this check every mainCHECK_DELAY milliseconds. */
|
||||||
|
@ -314,7 +314,7 @@ extern unsigned portSHORT usMaxJitter;
|
||||||
else if( xAreComTestTasksStillRunning() != pdTRUE )
|
else if( xAreComTestTasksStillRunning() != pdTRUE )
|
||||||
{
|
{
|
||||||
xMessage.pcMessage = "ERROR IN COM TEST\n";
|
xMessage.pcMessage = "ERROR IN COM TEST\n";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sprintf( ( portCHAR * ) cPassMessage, "PASS [%uns]\n", ( ( unsigned portLONG ) usMaxJitter ) * mainNS_PER_CLOCK );
|
sprintf( ( portCHAR * ) cPassMessage, "PASS [%uns]\n", ( ( unsigned portLONG ) usMaxJitter ) * mainNS_PER_CLOCK );
|
||||||
|
@ -382,10 +382,10 @@ static void prvSetupHardware( void )
|
||||||
NVIC_SetVectorTable( NVIC_VectTab_FLASH, 0x0 );
|
NVIC_SetVectorTable( NVIC_VectTab_FLASH, 0x0 );
|
||||||
|
|
||||||
NVIC_PriorityGroupConfig( NVIC_PriorityGroup_4 );
|
NVIC_PriorityGroupConfig( NVIC_PriorityGroup_4 );
|
||||||
|
|
||||||
/* Configure HCLK clock as SysTick clock source. */
|
/* Configure HCLK clock as SysTick clock source. */
|
||||||
SysTick_CLKSourceConfig( SysTick_CLKSource_HCLK );
|
SysTick_CLKSourceConfig( SysTick_CLKSource_HCLK );
|
||||||
|
|
||||||
vParTestInitialise();
|
vParTestInitialise();
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
@ -430,10 +430,10 @@ static unsigned portCHAR ucLine = 0;
|
||||||
{
|
{
|
||||||
/* Display one character on LCD */
|
/* Display one character on LCD */
|
||||||
LCD_DisplayChar( ucLine, usRefColumn, (u8) ch );
|
LCD_DisplayChar( ucLine, usRefColumn, (u8) ch );
|
||||||
|
|
||||||
/* Decrement the column position by 16 */
|
/* Decrement the column position by 16 */
|
||||||
usRefColumn -= mainCOLUMN_INCREMENT;
|
usRefColumn -= mainCOLUMN_INCREMENT;
|
||||||
|
|
||||||
/* Increment the character counter */
|
/* Increment the character counter */
|
||||||
usColumn++;
|
usColumn++;
|
||||||
if( usColumn == mainMAX_COLUMN )
|
if( usColumn == mainMAX_COLUMN )
|
||||||
|
@ -448,7 +448,7 @@ static unsigned portCHAR ucLine = 0;
|
||||||
/* Move back to the first column of the next line. */
|
/* Move back to the first column of the next line. */
|
||||||
ucLine += mainROW_INCREMENT;
|
ucLine += mainROW_INCREMENT;
|
||||||
usRefColumn = mainCOLUMN_START;
|
usRefColumn = mainCOLUMN_START;
|
||||||
usColumn = 0;
|
usColumn = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Wrap back to the top of the display. */
|
/* Wrap back to the top of the display. */
|
||||||
|
@ -456,7 +456,7 @@ static unsigned portCHAR ucLine = 0;
|
||||||
{
|
{
|
||||||
ucLine = 0;
|
ucLine = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ch;
|
return ch;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue