]> rtime.felk.cvut.cz Git - arc.git/blob - examples/blinker_node/Tasks.c
Initial commit.
[arc.git] / examples / blinker_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 #include "os_config_macros.h"\r
25 \r
26 #include "EcuM.h"\r
27 #include <stdio.h>\r
28 #include <assert.h>\r
29 #include "blinker_main.h"\r
30 #include "Trace.h"\r
31 #include "WdgM.h"\r
32 \r
33 \r
34 void OsIdle( void ) {\r
35         for(;;);\r
36 }\r
37 \r
38 /*\r
39  * This basic task should execute every 10 OS ticks\r
40  */\r
41 \r
42 void bTask10( void ) {\r
43 \r
44         WdgM_MainFunction_Trigger();\r
45 \r
46         TerminateTask();\r
47 }\r
48 \r
49 /*\r
50  * This basic task should execute every 25 OS ticks\r
51  */\r
52 void bTask25( void ) {\r
53 \r
54         WdgM_UpdateAliveCounter(WDBG_ALIVE_LOOP_BLINK_COMPONENT);\r
55         blinker_component_main();\r
56 \r
57         TerminateTask();\r
58 }\r
59 \r
60 /*\r
61  * This basic task should execute every 100 OS ticks
62  */\r
63 \r
64 void bTask100( void ) {\r
65 \r
66         WdgM_MainFunction_AliveSupervision();\r
67 \r
68         TerminateTask();\r
69 }\r
70 /*\r
71  * This is the startup task. It is activated once immediately after the OS i started.
72  */\r
73 void Startup( void ) {\r
74 \r
75         // Call second phase of startup sequence.\r
76         EcuM_StartupTwo();\r
77 \r
78         /*\r
79          * Activate scheduled tasks. OS tick is 1ms.\r
80          * The Blink is run every 25 ms with an offset of 25ms.\r
81          */\r
82         SetRelAlarm(ALARM_ID_bTask10, 10, 10); // ADC data acquisition\r
83         SetRelAlarm(ALARM_ID_bTask25, 25, 25); // ADC data acquisition\r
84         SetRelAlarm(ALARM_ID_bTask100, 100, 100); // ADC data acquisition\r
85 \r
86         WdgM_ActivateAliveSupervision(WDBG_ALIVE_LOOP_BLINK_COMPONENT);\r
87 \r
88         // End of startup_task().\r
89         TerminateTask();\r
90 }\r
91 \r
92 \r