]> git.sur5r.net Git - freertos/commitdiff
Basic demo up and running.
authorrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Fri, 8 Aug 2008 12:47:06 +0000 (12:47 +0000)
committerrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Fri, 8 Aug 2008 12:47:06 +0000 (12:47 +0000)
git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@436 1d2547de-c912-0410-9cb9-b8ca96c0e9e2

Demo/ColdFire_MCF5282_Eclipse/RTOSDemo/FreeRTOSConfig.h
Demo/ColdFire_MCF5282_Eclipse/RTOSDemo/FreeRTOS_Tick_Setup.c
Demo/ColdFire_MCF5282_Eclipse/RTOSDemo/Makefile
Demo/ColdFire_MCF5282_Eclipse/RTOSDemo/main.c

index e01917f0b0a18b925b512c2015d8f17a68d436ea..d0575a0fc8b33519f11cc0640c0ffccb904f253c 100644 (file)
@@ -67,7 +67,7 @@
 #define configUSE_TICK_HOOK                            0\r
 #define configCPU_CLOCK_HZ                             ( ( unsigned portLONG ) 25000000 )\r
 #define configTICK_RATE_HZ                             ( ( portTickType ) 1000 )\r
-#define configMINIMAL_STACK_SIZE               ( ( unsigned portSHORT ) 60 )\r
+#define configMINIMAL_STACK_SIZE               ( ( unsigned portSHORT ) 90 )\r
 #define configTOTAL_HEAP_SIZE                  ( ( size_t ) ( 24000 ) )\r
 #define configMAX_TASK_NAME_LEN                        ( 12 )\r
 #define configUSE_TRACE_FACILITY               1\r
@@ -94,6 +94,7 @@ to exclude the API function. */
 #define INCLUDE_vTaskDelay                                     1\r
 #define INCLUDE_uxTaskGetStackHighWaterMark    1\r
 \r
+#define configYIELD_INTERRUPT_VECTOR                   63UL\r
 #define configKERNEL_INTERRUPT_PRIORITY                1\r
 #define configMAX_SYSCALL_INTERRUPT_PRIORITY   4\r
 \r
index 1d325b239b960cb48b4526de9e5ded80ef200c2c..73e57857cede9df137b303a17bbd8bef8ed2d708 100644 (file)
@@ -48,6 +48,7 @@
 */\r
 \r
 #include "FreeRTOS.h"\r
+#include "task.h"\r
 \r
 #define portPRESCALE_VALUE                     64\r
 #define portPRESCALE_REG_SETTING       ( 5 << 8 )\r
@@ -69,14 +70,16 @@ const unsigned portSHORT usCompareMatchValue = ( ( configCPU_CLOCK_HZ / portPRES
     MCF_PIT0_PCSR = ( portPRESCALE_REG_SETTING | MCF_PIT_PCSR_PIE | MCF_PIT_PCSR_RLD | MCF_PIT_PCSR_EN );\r
        MCF_PIT0_PMR = usCompareMatchValue;\r
 }\r
+/*-----------------------------------------------------------*/\r
 \r
-void __attribute__ ((interrupt)) __cs3_isr_interrupt_127(void)\r
-{\r
-       MCF_INTC0_INTFRCH &= ~( 1UL << 31UL );\r
-}\r
-\r
-void __attribute__ ((interrupt)) __cs3_isr_interrupt_119(void)\r
+void __attribute__ ((interrupt)) __cs3_isr_interrupt_119( void )\r
 {\r
        MCF_PIT0_PCSR |= MCF_PIT_PCSR_PIF;\r
-       MCF_INTC0_INTFRCH |= ( 1UL << 31UL );\r
+       vTaskIncrementTick();\r
+\r
+       #if configUSE_PREEMPTION == 1\r
+       {\r
+               taskYIELD();\r
+       }\r
+       #endif\r
 }\r
index 614f002592ef26dd5a22bb157d71a51d67e1a3cb..0c6bccd56121ad31b7f70411a4015d21682d7003 100644 (file)
@@ -13,6 +13,7 @@ VPATH=$(FREERTOS_SOURCE_DIR) : $(PORT_SOURCE_DIR) : $(COMMON_DEMO_CODE_DIR) : $(
 \r
 OBJS =         $(OUTPUT_DIR)/portasm.o \\r
                        $(OUTPUT_DIR)/main.o \\r
+                       $(OUTPUT_DIR)/flash.o \\r
                        $(OUTPUT_DIR)/ParTest.o \\r
                        $(OUTPUT_DIR)/BlockQ.o \\r
                        $(OUTPUT_DIR)/blocktim.o \\r
index 02a6c8f260a83e812a7d8829081edbe70de0a9de..3c63ed3f7e6b9cfea3b39b08ab0854f9f1e8f6b3 100644 (file)
 \r
 /* The time between cycles of the 'check' functionality (defined within the\r
 tick hook. */\r
-#define mainCHECK_DELAY                                                ( ( portTickType ) 5000 / portTICK_RATE_MS )\r
+#define mainNO_ERROR_PERIOD                                    ( ( portTickType ) 5000 / portTICK_RATE_MS )\r
+\r
+/* The rate at which the LED controlled by the 'check' task will flash when an\r
+error has been detected. */\r
+#define mainERROR_PERIOD                                       ( 500 )\r
+\r
+/* The LED controlled by the 'check' task. */\r
+#define mainCHECK_LED                                          ( 3 )\r
 \r
 /* Task priorities. */\r
 #define mainQUEUE_POLL_PRIORITY                                ( tskIDLE_PRIORITY + 2 )\r
@@ -107,6 +114,13 @@ tick hook. */
  */\r
 static void prvSetupHardware( void );\r
 \r
+/*\r
+ * Implements the 'check' task functionality as described at the top of this\r
+ * file.\r
+ */\r
+static void prvCheckTask( void *pvParameters );\r
+\r
+\r
 /*-----------------------------------------------------------*/\r
 \r
 int main( void )\r
@@ -114,14 +128,18 @@ int main( void )
        prvSetupHardware();\r
 \r
        /* Start the standard demo tasks. */\r
+       vStartLEDFlashTasks( tskIDLE_PRIORITY );\r
        vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY );\r
-    vCreateBlockTimeTasks();\r
-    vStartSemaphoreTasks( mainSEM_TEST_PRIORITY );\r
-    vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY );\r
-    vStartIntegerMathTasks( mainINTEGER_TASK_PRIORITY );\r
-    vStartGenericQueueTasks( mainGEN_QUEUE_TASK_PRIORITY );\r
-    vStartQueuePeekTasks();\r
-    vStartRecursiveMutexTasks();\r
+       vCreateBlockTimeTasks();\r
+       vStartSemaphoreTasks( mainSEM_TEST_PRIORITY );\r
+       vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY );\r
+       vStartIntegerMathTasks( mainINTEGER_TASK_PRIORITY );\r
+       vStartGenericQueueTasks( mainGEN_QUEUE_TASK_PRIORITY );\r
+       vStartQueuePeekTasks();\r
+       vStartRecursiveMutexTasks();\r
+\r
+       /* Create the check task. */\r
+       xTaskCreate( prvCheckTask, ( signed portCHAR * ) "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );\r
 \r
        /* The suicide tasks must be created last as they need to know how many\r
        tasks were running prior to their creation in order to ascertain whether\r
@@ -133,7 +151,66 @@ int main( void )
 \r
     /* Will only get here if there was insufficient memory to create the idle\r
     task. */\r
-       return 0;\r
+       for( ;; );\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+static void prvCheckTask( void *pvParameters )\r
+{\r
+unsigned ulTicksToWait = mainNO_ERROR_PERIOD;\r
+portTickType xLastExecutionTime;\r
+\r
+       ( void ) pvParameters;\r
+\r
+       /* Initialise the variable used to control our iteration rate prior to\r
+       its first use. */\r
+       xLastExecutionTime = xTaskGetTickCount();\r
+\r
+       for( ;; )\r
+       {\r
+               /* Wait until it is time to run the tests again. */\r
+               vTaskDelayUntil( &xLastExecutionTime, ulTicksToWait );\r
+\r
+               /* Has an error been found in any task? */\r
+               if( xAreGenericQueueTasksStillRunning() != pdTRUE )\r
+               {\r
+                       ulTicksToWait = mainERROR_PERIOD;\r
+               }\r
+               else if( xAreQueuePeekTasksStillRunning() != pdTRUE )\r
+               {\r
+                       ulTicksToWait = mainERROR_PERIOD;\r
+               }\r
+               else if( xAreBlockingQueuesStillRunning() != pdTRUE )\r
+               {\r
+                       ulTicksToWait = mainERROR_PERIOD;\r
+               }\r
+               else if( xAreBlockTimeTestTasksStillRunning() != pdTRUE )\r
+               {\r
+                       ulTicksToWait = mainERROR_PERIOD;\r
+               }\r
+           else if( xAreSemaphoreTasksStillRunning() != pdTRUE )\r
+           {\r
+               ulTicksToWait = mainERROR_PERIOD;\r
+           }\r
+           else if( xArePollingQueuesStillRunning() != pdTRUE )\r
+           {\r
+               ulTicksToWait = mainERROR_PERIOD;\r
+           }\r
+           else if( xIsCreateTaskStillRunning() != pdTRUE )\r
+           {\r
+               ulTicksToWait = mainERROR_PERIOD;\r
+           }\r
+           else if( xAreIntegerMathsTaskStillRunning() != pdTRUE )\r
+           {\r
+               ulTicksToWait = mainERROR_PERIOD;\r
+           }\r
+           else if( xAreRecursiveMutexTasksStillRunning() != pdTRUE )\r
+           {\r
+               ulTicksToWait = mainERROR_PERIOD;\r
+           }\r
+\r
+               vParTestToggleLED( mainCHECK_LED );\r
+       }\r
 }\r
 /*-----------------------------------------------------------*/\r
 \r