1 /* -------------------------------- Arctic Core ------------------------------
2 * Arctic Core - the open source AUTOSAR platform http://arccore.com
4 * Copyright (C) 2009 ArcCore AB <contact@arccore.com>
6 * This source code is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 as published by the
8 * Free Software Foundation; See <http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt>.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * -------------------------------- Arctic Core ------------------------------*/
21 //#define USE_LDEBUG_PRINTF // Uncomment this to turn debug statements on.
24 // How many errors to keep in error log.
25 #define ERROR_LOG_SIZE 20
29 * Just an example of a basic task.
35 LDEBUG_PRINTF("[%08u] bTask3 start\n", (unsigned)GetOsTick() );
38 Os_Arc_GetStackInfo(currTask,&si);
39 LDEBUG_PRINTF("bTask3: %u%% stack usage\n",
40 (unsigned)OS_STACK_USAGE(&si));
46 * An extended task is auto-started and is also triggered by an alarm
51 volatile float tryFloatingPoint = 0.0F;
55 LDEBUG_FPUTS("eTask1 start\n");
57 SetEvent(TASK_ID_eTask2,EVENT_MASK_Event1);
58 WaitEvent(EVENT_MASK_Event2);
59 ClearEvent(EVENT_MASK_Event2);
60 tryFloatingPoint += 1.0F;
62 Os_Arc_GetStackInfo(currTask,&si);
63 LDEBUG_PRINTF("eTask1: %u%% stack usage\n",
64 (unsigned)OS_STACK_USAGE(&si));
70 * An extended task that receives events from someone
71 * and activates task: bTask3.
74 LDEBUG_FPUTS("eTask2 start\n");
77 WaitEvent(EVENT_MASK_Event1);
78 ClearEvent(EVENT_MASK_Event1);
79 ActivateTask(TASK_ID_bTask3);
84 Os_Arc_GetStackInfo(currTask,&si);
85 LDEBUG_PRINTF("eTask2: %u%% stack usage\n",
86 (unsigned)OS_STACK_USAGE(&si));
93 * Functions that must be supplied by the example