summaryrefslogtreecommitdiff
path: root/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/src/main_full.c
diff options
context:
space:
mode:
authorrtel <rtel@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>2014-12-19 16:27:56 +0000
committerrtel <rtel@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>2014-12-19 16:27:56 +0000
commit7971989e9fbc3fbf59e9647caeae3044000f57e4 (patch)
treeb9f0624032fce4a452c026c328cdb92925cb6991 /FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/src/main_full.c
parent00234ccb848898af1a57174fd0954e8ac9bd15e4 (diff)
downloadfreertos-7971989e9fbc3fbf59e9647caeae3044000f57e4.tar.gz
Kernel changes:
+ Do not attempt to free the stack of a deleted task if the stack was statically allocated. + Introduce configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES - which optionally writes known values into the list and list item data structures in order to assist with the detection of memory corruptions. Microblase port: +Change occurrences of #if XPAR_MICROBLAZE_0_USE_FPU == 1 to #if XPAR_MICROBLAZE_0_USE_FPU != 0 as the value can also be 2 or 3. Demo app modifications: + Update Zynq project to use the 2014.4 tools and add in tests for the new task notification feature. + Update SAM4S project to include tests for the new task notification feature. git-svn-id: http://svn.code.sf.net/p/freertos/code/trunk@2316 1d2547de-c912-0410-9cb9-b8ca96c0e9e2
Diffstat (limited to 'FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/src/main_full.c')
-rw-r--r--FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/src/main_full.c137
1 files changed, 105 insertions, 32 deletions
diff --git a/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/src/main_full.c b/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/src/main_full.c
index 2067f66bb..4e4495cec 100644
--- a/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/src/main_full.c
+++ b/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/src/main_full.c
@@ -124,6 +124,10 @@
#include "comtest2.h"
#include "QueueSet.h"
#include "IntQueue.h"
+#include "TaskNotify.h"
+#include "TimerDemo.h"
+#include "EventGroupsDemo.h"
+#include "IntSemTest.h"
/* Atmel library includes. */
#include "asf.h"
@@ -142,12 +146,12 @@
/* The period after which the check timer will expire, in ms, provided no errors
have been reported by any of the standard demo tasks. ms are converted to the
equivalent in ticks using the portTICK_PERIOD_MS constant. */
-#define mainCHECK_TIMER_PERIOD_MS ( 3000UL / portTICK_PERIOD_MS )
+#define mainCHECK_TIMER_PERIOD_MS ( pdMS_TO_TICKS( 3000UL ) )
/* The period at which the check timer will expire, in ms, if an error has been
reported in one of the standard demo tasks. ms are converted to the equivalent
in ticks using the portTICK_PERIOD_MS constant. */
-#define mainERROR_CHECK_TIMER_PERIOD_MS ( 200UL / portTICK_PERIOD_MS )
+#define mainERROR_CHECK_TIMER_PERIOD_MS ( pdMS_TO_TICKS( 200UL ) )
/* The standard demo flash timers can be used to flash any number of LEDs. In
this case, because only three LEDs are available, and one is in use by the
@@ -165,9 +169,24 @@ standard demo flash timers. */
for the comtest, so the LED number is deliberately out of range. */
#define mainCOM_TEST_LED ( 3 )
+/* Used by the standard demo timer tasks. */
+#define mainTIMER_TEST_PERIOD ( 50 )
+
/*-----------------------------------------------------------*/
/*
+ * Called by the idle hook function when the project is configured to run the
+ * full (as opposed to the blinky) demo.
+ */
+void vFullDemoIdleHook( void );
+
+/*
+ * Called by the tick hook function when the project is configured to run the
+ * full (as opposed to the blinky) demo.
+ */
+void vFullDemoTickHook( void );
+
+/*
* The check timer callback function, as described at the top of this file.
*/
static void prvCheckTimerCallback( TimerHandle_t xTimer );
@@ -176,8 +195,6 @@ static void prvCheckTimerCallback( TimerHandle_t xTimer );
void main_full( void )
{
-TimerHandle_t xCheckTimer = NULL;
-
/* Start all the other standard demo/test tasks. The have not particular
functionality, but do demonstrate how to use the FreeRTOS API and test the
kernel port. */
@@ -191,23 +208,12 @@ TimerHandle_t xCheckTimer = NULL;
vStartRecursiveMutexTasks();
vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY );
vStartSemaphoreTasks( mainSEM_TEST_PRIORITY );
- vStartLEDFlashTimers( mainNUMBER_OF_FLASH_TIMERS_LEDS );
vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED );
vStartQueueSetTasks();
-
- /* Create the software timer that performs the 'check' functionality,
- as described at the top of this file. */
- xCheckTimer = xTimerCreate( "CheckTimer", /* A text name, purely to help debugging. */
- ( 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. */
- ( 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. */
- );
-
- if( xCheckTimer != NULL )
- {
- xTimerStart( xCheckTimer, mainDONT_BLOCK );
- }
+ vStartTaskNotifyTask();
+ vStartTimerDemoTask( mainTIMER_TEST_PERIOD );
+ vStartEventGroupTasks();
+ vStartInterruptSemaphoreTasks();
/* 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
@@ -236,63 +242,84 @@ unsigned long ulErrorFound = pdFALSE;
if( xAreIntQueueTasksStillRunning() != pdTRUE )
{
- ulErrorFound = pdTRUE;
+ ulErrorFound |= 1UL << 0UL;
}
if( xAreIntegerMathsTaskStillRunning() != pdTRUE )
{
- ulErrorFound = pdTRUE;
+ ulErrorFound |= 1UL << 1UL;
}
if( xAreDynamicPriorityTasksStillRunning() != pdTRUE )
{
- ulErrorFound = pdTRUE;
+ ulErrorFound |= 1UL << 2UL;
}
if( xAreBlockingQueuesStillRunning() != pdTRUE )
{
- ulErrorFound = pdTRUE;
+ ulErrorFound |= 1UL << 3UL;
}
if ( xAreBlockTimeTestTasksStillRunning() != pdTRUE )
{
- ulErrorFound = pdTRUE;
+ ulErrorFound |= 1UL << 4UL;
}
if ( xAreGenericQueueTasksStillRunning() != pdTRUE )
{
- ulErrorFound = pdTRUE;
+ ulErrorFound |= 1UL << 5UL;
}
if ( xAreRecursiveMutexTasksStillRunning() != pdTRUE )
{
- ulErrorFound = pdTRUE;
+ ulErrorFound |= 1UL << 6UL;
}
if( xIsCreateTaskStillRunning() != pdTRUE )
{
- ulErrorFound = pdTRUE;
+ ulErrorFound |= 1UL << 7UL;
}
if( xArePollingQueuesStillRunning() != pdTRUE )
{
- ulErrorFound = pdTRUE;
+ ulErrorFound |= 1UL << 8UL;
}
if( xAreSemaphoreTasksStillRunning() != pdTRUE )
{
- ulErrorFound = pdTRUE;
+ ulErrorFound |= 1UL << 9UL;
}
if( xAreComTestTasksStillRunning() != pdTRUE )
{
- ulErrorFound = pdTRUE;
+ ulErrorFound |= 1UL << 10UL;
}
- if( xAreQueueSetTasksStillRunning() != pdPASS )
+ if( xAreQueueSetTasksStillRunning() != pdTRUE )
+ {
+ ulErrorFound |= 1UL << 11UL;
+ }
+
+ if( xAreTaskNotificationTasksStillRunning() != pdTRUE )
+ {
+ ulErrorFound |= 1UL << 12UL;
+ }
+
+ if( xAreTimerDemoTasksStillRunning( mainCHECK_TIMER_PERIOD_MS ) != pdTRUE )
+ {
+ ulErrorFound |= 1UL << 13UL;
+ }
+
+ if( xAreEventGroupTasksStillRunning() != pdTRUE )
+ {
+ ulErrorFound |= 1UL << 14UL;
+ }
+
+ if( xAreInterruptSemaphoreTasksStillRunning() != pdTRUE )
{
- ulErrorFound = pdTRUE;
+ ulErrorFound |= 1UL << 15UL;
}
+
/* Toggle the check LED to give an indication of the system status. If
the LED toggles every mainCHECK_TIMER_PERIOD_MS milliseconds then
@@ -318,3 +345,49 @@ unsigned long ulErrorFound = pdFALSE;
}
/*-----------------------------------------------------------*/
+void vFullDemoIdleHook( void )
+{
+static TimerHandle_t xCheckTimer = NULL;
+
+ if( xCheckTimer == NULL )
+ {
+ /* Create the software timer that performs the 'check'
+ functionality, in the full demo. This is not done before the
+ scheduler is started as to do so would prevent the standard demo
+ timer tasks from passing their tests (they expect the timer
+ command queue to be empty. */
+ xCheckTimer = xTimerCreate( "CheckTimer", /* A text name, purely to help debugging. */
+ 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. */
+ ( 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. */
+ );
+
+ if( xCheckTimer != NULL )
+ {
+ xTimerStart( xCheckTimer, mainDONT_BLOCK );
+ }
+
+ /* Also start some timers that just flash LEDs. */
+ vStartLEDFlashTimers( mainNUMBER_OF_FLASH_TIMERS_LEDS );
+ }
+}
+/*-----------------------------------------------------------*/
+
+void vFullDemoTickHook( void )
+{
+ /* In this case the tick hook is used as part of the queue set test. */
+ vQueueSetAccessQueueSetFromISR();
+
+ /* Use task notifications from an interrupt. */
+ xNotifyTaskFromISR();
+
+ /* Use timers from an interrupt. */
+ vTimerPeriodicISRTests();
+
+ /* Use event groups from an interrupt. */
+ vPeriodicEventGroupsProcessing();
+
+ /* Use mutexes from interrupts. */
+ vInterruptSemaphorePeriodicTest();
+}