-/* THIS SAMPLE CODE IS PROVIDED AS IS AND IS SUBJECT TO ALTERATIONS. FUJITSU */\r
-/* MICROELECTRONICS ACCEPTS NO RESPONSIBILITY OR LIABILITY FOR ANY ERRORS OR */\r
-/* ELIGIBILITY FOR ANY PURPOSES. */\r
-/* (C) Fujitsu Microelectronics Europe GmbH */\r
-/*------------------------------------------------------------------------\r
- MAIN.C\r
- - description\r
- - See README.TXT for project description and disclaimer.\r
--------------------------------------------------------------------------*/\r
+/*\r
+ FreeRTOS.org V4.7.1 - Copyright (C) 2003-2008 Richard Barry.\r
+\r
+ This file is part of the FreeRTOS.org distribution.\r
+\r
+ FreeRTOS.org is free software; you can redistribute it and/or modify\r
+ it under the terms of the GNU General Public License as published by\r
+ the Free Software Foundation; either version 2 of the License, or\r
+ (at your option) any later version.\r
+\r
+ FreeRTOS.org is distributed in the hope that it will be useful,\r
+ but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ GNU General Public License for more details.\r
+\r
+ You should have received a copy of the GNU General Public License\r
+ along with FreeRTOS.org; if not, write to the Free Software\r
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
+\r
+ A special exception to the GPL can be applied should you wish to distribute\r
+ a combined work that includes FreeRTOS.org, without being obliged to provide\r
+ the source code for any proprietary components. See the licensing section\r
+ of http://www.FreeRTOS.org for full details of how and when the exception\r
+ can be applied.\r
+\r
+ ***************************************************************************\r
+\r
+ Please ensure to read the configuration and relevant port sections of the \r
+ online documentation.\r
+\r
+ +++ http://www.FreeRTOS.org +++\r
+ Documentation, latest information, license and contact details. \r
+\r
+ +++ http://www.SafeRTOS.com +++\r
+ A version that is certified for use in safety critical systems.\r
+\r
+ +++ http://www.OpenRTOS.com +++\r
+ Commercial support, development, porting, licensing and training services.\r
+\r
+ ***************************************************************************\r
+*/\r
\r
\r
/*\r
* Creates all the demo application tasks, then starts the scheduler. The WEB\r
* documentation provides more details of the demo application tasks.\r
* \r
- * Main.c also creates a task called "Check". This only executes every three \r
- * seconds but has the highest priority so is guaranteed to get processor time. \r
- * Its main function is to check that all the other tasks are still operational.\r
- * Each task (other than the "flash" tasks) maintains a unique count that is \r
- * incremented each time the task successfully completes its function. Should \r
- * any error occur within such a task the count is permanently halted. The \r
- * check task inspects the count of each task to ensure it has changed since\r
- * the last time the check task executed. If all the count variables have \r
- * changed all the tasks are still executing error free, and the check task\r
- * toggles the onboard LED. Should any task contain an error at any time \r
+ * In addition to the standard demo tasks, the follow demo specific tasks are\r
+ * create:\r
+ *\r
+ * The "Check" task. This only executes every three seconds but has the highest \r
+ * priority so is guaranteed to get processor time. Its main function is to \r
+ * check that all the other tasks are still operational. Most tasks maintain \r
+ * a unique count that is incremented each time the task successfully completes \r
+ * its function. Should any error occur within such a task the count is \r
+ * permanently halted. The check task inspects the count of each task to ensure \r
+ * it has changed since the last time the check task executed. If all the count \r
+ * variables have changed all the tasks are still executing error free, and the \r
+ * check task toggles the onboard LED. Should any task contain an error at any time \r
* the LED toggle rate will change from 3 seconds to 500ms.\r
*\r
+ * The "Register Check" tasks. These tasks fill the CPU registers with known\r
+ * values, then check that each register still contains the expected value 0 the\r
+ * discovery of an unexpected value being indicative of an error in the RTOS\r
+ * context switch mechanism. The register check tasks operate at low priority\r
+ * so are switched in and out frequently.\r
+ *\r
+ * The "Trace Utility" task. This can be used to obtain trace and debug \r
+ * information via UART5.\r
*/\r
\r
\r
top of the page. When the system is operating error free the 'Check' task\r
toggles an LED every three seconds. If an error is discovered in any task the\r
rate is increased to 500 milliseconds. [in this case the '*' characters on the \r
-LCD represent LED's]*/\r
+LCD represent LEDs]*/\r
#define mainNO_ERROR_CHECK_DELAY ( ( portTickType ) 3000 / portTICK_RATE_MS )\r
#define mainERROR_CHECK_DELAY ( ( portTickType ) 500 / portTICK_RATE_MS )\r
\r
* The function that implements the Check task. See the comments at the head\r
* of the page for implementation details.\r
*/ \r
-static void vErrorChecks( void *pvParameters );\r
+static void prvErrorChecks( void *pvParameters );\r
\r
/*\r
* Called by the Check task. Returns pdPASS if all the other tasks are found\r
vCreateBlockTimeTasks();\r
\r
/* Start the 'Check' task which is defined in this file. */\r
- xTaskCreate( vErrorChecks, ( signed portCHAR * ) "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL ); \r
+ xTaskCreate( prvErrorChecks, ( signed portCHAR * ) "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL ); \r
\r
+ /* Start the 'Register Test' tasks as described at the top of this file. */\r
xTaskCreate( vFirstRegisterTestTask, ( signed portCHAR * ) "Reg1", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );\r
xTaskCreate( vSecondRegisterTestTask, ( signed portCHAR * ) "Reg2", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );\r
\r
}\r
/*-----------------------------------------------------------*/\r
\r
-static void vErrorChecks( void *pvParameters )\r
+static void prvErrorChecks( void *pvParameters )\r
{\r
portTickType xDelayPeriod = mainNO_ERROR_CHECK_DELAY, xLastExecutionTime;\r
\r
lReturn = pdFAIL;\r
}\r
\r
+ /* Record the current values of the register check cycle counters so we\r
+ can ensure they are still running the next time this function is called. */\r
ulLastRegTest1Counter = ulRegTest1Counter;\r
ulLastRegTest2Counter = ulRegTest2Counter;\r
\r
}\r
/*-----------------------------------------------------------*/\r
\r
-/* The below callback function is called from Delayed ISR if configUSE_IDLE_HOOK \r
-is configured as 1. */ \r
+/* Idle hook function. */\r
#if configUSE_IDLE_HOOK == 1\r
void vApplicationIdleHook( void )\r
{\r
- /* Are we using the idle task to kick the watchdog? */\r
+ /* Are we using the idle task to kick the watchdog? See watchdog.h\r
+ for watchdog kicking options. Note this is for demonstration only\r
+ and is not a suggested method of servicing the watchdog in a real\r
+ application. */\r
#if WATCHDOG == WTC_IN_IDLE\r
Kick_Watchdog();\r
#endif\r
-\r
- #if configUSE_CO_ROUTINES == 1 \r
- vCoRoutineSchedule();\r
- #endif\r
}\r
#endif\r
/*-----------------------------------------------------------*/\r
\r
-/*\r
-The below callback function is called from Tick ISR if configUSE_TICK_HOOK \r
-is configured as 1. */ \r
+/* Tick hook function. */\r
#if configUSE_TICK_HOOK == 1\r
void vApplicationTickHook( void )\r
{\r
+ /* Are we using the tick to kick the watchdog? See watchdog.h\r
+ for watchdog kicking options. Note this is for demonstration\r
+ only and is not a suggested method of servicing the watchdog in\r
+ a real application. */\r
#if WATCHDOG == WTC_IN_TICK\r
Kick_Watchdog();\r
#endif\r
\r
#include "mb91467d.h"\r
#include "watchdog.h"\r
+#include "FreeRTOSConfig.h"\r
\r
/*------------------------------------------------------------------------\r
InitIrqLevels()\r
/* ICRxx */ \r
/* Softune Workbench Monitor Debugger is using ext int0 for abort function */\r
/* ICR00 = 31; *//* External Interrupt 0 */\r
- /* External Interrupt 1 */ \r
- ICR01 = 31; /* External Interrupt 2 */\r
- /* External Interrupt 3 */\r
- ICR02 = 31; /* External Interrupt 4 */\r
- /* External Interrupt 5 */\r
- ICR03 = 31; /* External Interrupt 6 */\r
- /* External Interrupt 7 */\r
- ICR04 = 31; /* External Interrupt 8 */\r
- /* External Interrupt 9 */\r
- ICR05 = 31; /* External Interrupt 10 */\r
- /* External Interrupt 11 */\r
- ICR06 = 31; /* External Interrupt 12 */\r
- /* External Interrupt 13 */\r
- ICR07 = 31; /* External Interrupt 14 */\r
- /* External Interrupt 15 */\r
- ICR08 = 30; /* Reload Timer 0 */\r
- /* Reload Timer 1 */\r
- ICR09 = 31; /* Reload Timer 2 */\r
- /* Reload Timer 3 */\r
- ICR10 = 31; /* Reload Timer 4 */\r
- /* Reload Timer 5 */\r
- ICR11 = 31; /* Reload Timer 6 */\r
- /* Reload Timer 7 */\r
- ICR12 = 31; /* Free Run Timer 0 */\r
- /* Free Run Timer 1 */\r
- ICR13 = 31; /* Free Run Timer 2 */\r
- /* Free Run Timer 3 */\r
- ICR14 = 31; /* Free Run Timer 4 */\r
- /* Free Run Timer 5 */\r
- ICR15 = 31; /* Free Run Timer 6 */\r
- /* Free Run Timer 7 */\r
- ICR16 = 31; /* CAN 0 */\r
- /* CAN 1 */\r
- ICR17 = 31; /* CAN 2 */\r
- /* CAN 3 */\r
- ICR18 = 31; /* CAN 4 */\r
- /* CAN 5 */\r
- ICR19 = 31; /* USART (LIN) 0 RX */\r
- /* USART (LIN) 0 TX */\r
- ICR20 = 31; /* USART (LIN) 1 RX */\r
- /* USART (LIN) 1 TX */\r
- ICR21 = 30; /* USART (LIN) 2 RX */\r
- /* USART (LIN) 2 TX */\r
- ICR22 = 31; /* USART (LIN) 3 RX */\r
- /* USART (LIN) 3 TX */\r
- ICR23 = 30; /* System Reserved */\r
- /* Delayed Interrupt */\r
- ICR24 = 31; /* System Reserved */\r
- /* System Reserved */\r
- ICR25 = 31; /* USART (LIN, FIFO) 4 RX */\r
- /* USART (LIN, FIFO) 4 TX */\r
- ICR26 = 30; /* USART (LIN, FIFO) 5 RX */\r
- /* USART (LIN, FIFO) 5 TX */\r
- ICR27 = 31; /* USART (LIN, FIFO) 6 RX */\r
- /* USART (LIN, FIFO) 6 TX */\r
- ICR28 = 31; /* USART (LIN, FIFO) 7 RX */\r
- /* USART (LIN, FIFO) 7 TX */\r
- ICR29 = 31; /* I2C 0 / I2C 2 */\r
- /* I2C 1 / I2C 3 */\r
- ICR30 = 31; /* USART (LIN, FIFO) 8 RX */\r
- /* USART (LIN, FIFO) 8 TX */\r
- ICR31 = 31; /* USART (LIN, FIFO) 9 RX */\r
- /* USART (LIN, FIFO) 9 TX */\r
- ICR32 = 31; /* USART (LIN, FIFO) 10 RX */\r
- /* USART (LIN, FIFO) 10 TX */\r
- ICR33 = 31; /* USART (LIN, FIFO) 11 RX */\r
- /* USART (LIN, FIFO) 11 TX */\r
- ICR34 = 31; /* USART (LIN, FIFO) 12 RX */\r
- /* USART (LIN, FIFO) 12 TX */\r
- ICR35 = 31; /* USART (LIN, FIFO) 13 RX */\r
- /* USART (LIN, FIFO) 13 TX */\r
- ICR36 = 31; /* USART (LIN, FIFO) 14 RX */\r
- /* USART (LIN, FIFO) 14 TX */\r
- ICR37 = 31; /* USART (LIN, FIFO) 15 RX */\r
- /* USART (LIN, FIFO) 15 TX */\r
- ICR38 = 31; /* Input Capture 0 */\r
- /* Input Capture 1 */\r
- ICR39 = 31; /* Input Capture 2 */\r
- /* Input Capture 3 */\r
- ICR40 = 31; /* Input Capture 4 */\r
- /* Input Capture 5 */\r
- ICR41 = 31; /* Input Capture 6 */\r
- /* Input Capture 7 */\r
- ICR42 = 31; /* Output Compare 0 */\r
- /* Output Compare 1 */\r
- ICR43 = 31; /* Output Compare 2 */\r
- /* Output Compare 3 */\r
- ICR44 = 31; /* Output Compare 4 */\r
- /* Output Compare 5 */\r
- ICR45 = 31; /* Output Compare 6 */\r
- /* Output Compare 7 */\r
- ICR46 = 31; /* Sound Generator */\r
- /* Phase Frequ. Modulator */\r
- ICR47 = 31; /* System Reserved */\r
- /* System Reserved */\r
- ICR48 = 31; /* Prog. Pulse Gen. 0 */\r
- /* Prog. Pulse Gen. 1 */\r
- ICR49 = 31; /* Prog. Pulse Gen. 2 */\r
- /* Prog. Pulse Gen. 3 */\r
- ICR50 = 31; /* Prog. Pulse Gen. 4 */\r
- /* Prog. Pulse Gen. 5 */\r
- ICR51 = 31; /* Prog. Pulse Gen. 6 */\r
- /* Prog. Pulse Gen. 7 */\r
- ICR52 = 31; /* Prog. Pulse Gen. 8 */\r
- /* Prog. Pulse Gen. 9 */\r
- ICR53 = 31; /* Prog. Pulse Gen. 10 */\r
- /* Prog. Pulse Gen. 11 */\r
- ICR54 = 31; /* Prog. Pulse Gen. 12 */\r
- /* Prog. Pulse Gen. 13 */\r
- ICR55 = 31; /* Prog. Pulse Gen. 14 */\r
- /* Prog. Pulse Gen. 15 */\r
- ICR56 = 31; /* Up/Down Counter 0 */\r
- /* Up/Down Counter 1 */\r
- ICR57 = 31; /* Up/Down Counter 2 */\r
- /* Up/Down Counter 3 */\r
- ICR58 = 31; /* Real Time Clock */\r
- /* Calibration Unit */\r
- ICR59 = 31; /* A/D Converter 0 */\r
- /* - */\r
- ICR60 = 31; /* Alarm Comperator 0 */\r
- /* Alarm Comperator 1 */\r
- ICR61 = 31; /* Low Volage Detector */\r
- /* SMC Zero Point 0-5 */\r
- ICR62 = 31; /* Timebase Overflow */\r
- /* PLL Clock Gear */\r
- ICR63 = 31; /* DMA Controller */\r
- /* Main/Sub OSC stability wait */\r
+ /* External Interrupt 1 */ \r
+ ICR01 = 31; /* External Interrupt 2 */\r
+ /* External Interrupt 3 */\r
+ ICR02 = 31; /* External Interrupt 4 */\r
+ /* External Interrupt 5 */\r
+ ICR03 = 31; /* External Interrupt 6 */\r
+ /* External Interrupt 7 */\r
+ ICR04 = 31; /* External Interrupt 8 */\r
+ /* External Interrupt 9 */\r
+ ICR05 = 31; /* External Interrupt 10 */\r
+ /* External Interrupt 11 */\r
+ ICR06 = 31; /* External Interrupt 12 */\r
+ /* External Interrupt 13 */\r
+ ICR07 = 31; /* External Interrupt 14 */\r
+ /* External Interrupt 15 */\r
+ ICR08 = configKERNEL_INTERRUPT_PRIORITY; /* Reload Timer 0 */\r
+ /* Reload Timer 1 */\r
+ ICR09 = 31; /* Reload Timer 2 */\r
+ /* Reload Timer 3 */\r
+ ICR10 = 31; /* Reload Timer 4 */\r
+ /* Reload Timer 5 */\r
+ ICR11 = 31; /* Reload Timer 6 */\r
+ /* Reload Timer 7 */\r
+ ICR12 = 31; /* Free Run Timer 0 */\r
+ /* Free Run Timer 1 */\r
+ ICR13 = 31; /* Free Run Timer 2 */\r
+ /* Free Run Timer 3 */\r
+ ICR14 = 31; /* Free Run Timer 4 */\r
+ /* Free Run Timer 5 */\r
+ ICR15 = 31; /* Free Run Timer 6 */\r
+ /* Free Run Timer 7 */\r
+ ICR16 = 31; /* CAN 0 */\r
+ /* CAN 1 */\r
+ ICR17 = 31; /* CAN 2 */\r
+ /* CAN 3 */\r
+ ICR18 = 31; /* CAN 4 */\r
+ /* CAN 5 */\r
+ ICR19 = 31; /* USART (LIN) 0 RX */\r
+ /* USART (LIN) 0 TX */\r
+ ICR20 = 31; /* USART (LIN) 1 RX */\r
+ /* USART (LIN) 1 TX */\r
+ ICR21 = configKERNEL_INTERRUPT_PRIORITY; /* USART (LIN) 2 RX */\r
+ /* USART (LIN) 2 TX */\r
+ ICR22 = 31; /* USART (LIN) 3 RX */\r
+ /* USART (LIN) 3 TX */\r
+ ICR23 = configKERNEL_INTERRUPT_PRIORITY; /* System Reserved */\r
+ /* Delayed Interrupt */\r
+ ICR24 = 31; /* System Reserved */\r
+ /* System Reserved */\r
+ ICR25 = 31; /* USART (LIN, FIFO) 4 RX */\r
+ /* USART (LIN, FIFO) 4 TX */\r
+ ICR26 = configKERNEL_INTERRUPT_PRIORITY; /* USART (LIN, FIFO) 5 RX */\r
+ /* USART (LIN, FIFO) 5 TX */\r
+ ICR27 = 31; /* USART (LIN, FIFO) 6 RX */\r
+ /* USART (LIN, FIFO) 6 TX */\r
+ ICR28 = 31; /* USART (LIN, FIFO) 7 RX */\r
+ /* USART (LIN, FIFO) 7 TX */\r
+ ICR29 = 31; /* I2C 0 / I2C 2 */\r
+ /* I2C 1 / I2C 3 */\r
+ ICR30 = 31; /* USART (LIN, FIFO) 8 RX */\r
+ /* USART (LIN, FIFO) 8 TX */\r
+ ICR31 = 31; /* USART (LIN, FIFO) 9 RX */\r
+ /* USART (LIN, FIFO) 9 TX */\r
+ ICR32 = 31; /* USART (LIN, FIFO) 10 RX */\r
+ /* USART (LIN, FIFO) 10 TX */\r
+ ICR33 = 31; /* USART (LIN, FIFO) 11 RX */\r
+ /* USART (LIN, FIFO) 11 TX */\r
+ ICR34 = 31; /* USART (LIN, FIFO) 12 RX */\r
+ /* USART (LIN, FIFO) 12 TX */\r
+ ICR35 = 31; /* USART (LIN, FIFO) 13 RX */\r
+ /* USART (LIN, FIFO) 13 TX */\r
+ ICR36 = 31; /* USART (LIN, FIFO) 14 RX */\r
+ /* USART (LIN, FIFO) 14 TX */\r
+ ICR37 = 31; /* USART (LIN, FIFO) 15 RX */\r
+ /* USART (LIN, FIFO) 15 TX */\r
+ ICR38 = 31; /* Input Capture 0 */\r
+ /* Input Capture 1 */\r
+ ICR39 = 31; /* Input Capture 2 */\r
+ /* Input Capture 3 */\r
+ ICR40 = 31; /* Input Capture 4 */\r
+ /* Input Capture 5 */\r
+ ICR41 = 31; /* Input Capture 6 */\r
+ /* Input Capture 7 */\r
+ ICR42 = 31; /* Output Compare 0 */\r
+ /* Output Compare 1 */\r
+ ICR43 = 31; /* Output Compare 2 */\r
+ /* Output Compare 3 */\r
+ ICR44 = 31; /* Output Compare 4 */\r
+ /* Output Compare 5 */\r
+ ICR45 = 31; /* Output Compare 6 */\r
+ /* Output Compare 7 */\r
+ ICR46 = 31; /* Sound Generator */\r
+ /* Phase Frequ. Modulator */\r
+ ICR47 = 31; /* System Reserved */\r
+ /* System Reserved */\r
+ ICR48 = 31; /* Prog. Pulse Gen. 0 */\r
+ /* Prog. Pulse Gen. 1 */\r
+ ICR49 = 31; /* Prog. Pulse Gen. 2 */\r
+ /* Prog. Pulse Gen. 3 */\r
+ ICR50 = 31; /* Prog. Pulse Gen. 4 */\r
+ /* Prog. Pulse Gen. 5 */\r
+ ICR51 = 31; /* Prog. Pulse Gen. 6 */\r
+ /* Prog. Pulse Gen. 7 */\r
+ ICR52 = 31; /* Prog. Pulse Gen. 8 */\r
+ /* Prog. Pulse Gen. 9 */\r
+ ICR53 = 31; /* Prog. Pulse Gen. 10 */\r
+ /* Prog. Pulse Gen. 11 */\r
+ ICR54 = 31; /* Prog. Pulse Gen. 12 */\r
+ /* Prog. Pulse Gen. 13 */\r
+ ICR55 = 31; /* Prog. Pulse Gen. 14 */\r
+ /* Prog. Pulse Gen. 15 */\r
+ ICR56 = 31; /* Up/Down Counter 0 */\r
+ /* Up/Down Counter 1 */\r
+ ICR57 = 31; /* Up/Down Counter 2 */\r
+ /* Up/Down Counter 3 */\r
+ ICR58 = 31; /* Real Time Clock */\r
+ /* Calibration Unit */\r
+ ICR59 = 31; /* A/D Converter 0 */\r
+ /* - */\r
+ ICR60 = 31; /* Alarm Comperator 0 */\r
+ /* Alarm Comperator 1 */\r
+ ICR61 = 31; /* Low Volage Detector */\r
+ /* SMC Zero Point 0-5 */\r
+ ICR62 = 31; /* Timebase Overflow */\r
+ /* PLL Clock Gear */\r
+ ICR63 = 31; /* DMA Controller */\r
+ /* Main/Sub OSC stability wait */\r
}\r
\r
\r