]> rtime.felk.cvut.cz Git - arc.git/blob - examples/switch_node/Tasks.c
Initial commit.
[arc.git] / examples / switch_node / Tasks.c
1 /* -------------------------------- Arctic Core ------------------------------
2  * Arctic Core - the open source AUTOSAR platform http://arccore.com
3  *
4  * Copyright (C) 2009  ArcCore AB <contact@arccore.com>
5  *
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>.
9  *
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
13  * for more details.
14  * -------------------------------- Arctic Core ------------------------------*/
15
16
17
18
19
20
21
22
23 #include "Os.h"\r
24 \r
25 #include "EcuM.h"\r
26 #include <stdio.h>\r
27 #include <assert.h>\r
28 #include "Trace.h"\r
29 #include "Com.h"\r
30 #include "Adc.h"\r
31 \r
32 void OsIdle( void ) {\r
33         for(;;);\r
34 }\r
35 \r
36 \r
37 void ComTask( void ) {\r
38         // Run COM scheduled functions.\r
39         Com_MainFunctionTx();\r
40         Com_MainFunctionRx();\r
41 \r
42         TerminateTask();\r
43 }\r
44 \r
45 void ReadSwitches( void ) {\r
46         // Trigger update of switch readings\r
47         Adc_StartGroupConversion(ADC_SWITCHES); // Read the switches\r
48         Adc_StartGroupConversion(ADC_POTENTIOMETERS);\r
49 \r
50         TerminateTask();\r
51 }\r
52 \r
53 /*\r
54  * This is the startup task. It is activated once immediately after the OS i started.
55  */\r
56 void StartupTask( void ) {\r
57 \r
58         // Call second phase of startup sequence.\r
59         EcuM_StartupTwo();\r
60 \r
61         // Make sure that the right PDU-groups are ready for communication.\r
62         Com_IpduGroupStart(TxGroup, 0);\r
63 \r
64         // End of startup_task().\r
65         TerminateTask();\r
66 }\r
67 \r
68 \r