]> rtime.felk.cvut.cz Git - arc.git/blob - system/kernel/include/counter_i.h
Initial commit.
[arc.git] / system / kernel / include / counter_i.h
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 #ifndef COUNTER_I_H_\r
24 #define COUNTER_I_H_\r
25 \r
26 #include "Os.h"\r
27 #include "kernel.h"\r
28 #include <sys/queue.h>\r
29 \r
30 #define COUNTER_TYPE_HARD       0\r
31 #define COUNTER_TYPE_SOFT       1\r
32 \r
33 #define COUNTER_UNIT_TICKS      0\r
34 #define COUNTER_UNIT_NANO       1\r
35 \r
36 /*-----------------------------------------------------------------*/\r
37 typedef struct counter_obj_s {\r
38         // counter id( TODO: remove ?? I use index here )\r
39 //      uint32_t cid;\r
40         char name[16];\r
41         // hardware or software counter, SWS OS255\r
42         _Bool type;\r
43         // Ticks or nano, SWS OS331\r
44         _Bool unit;\r
45         // The counter value ( if software counter )\r
46         uint32_t val;\r
47         // Application mask, SWS OS317\r
48         uint32_t app_mask;\r
49         //  hmm, strange to call it alarm base.... but see spec.\r
50         AlarmBaseType alarm_base;\r
51         /* Used only if we configure a GPT timer as os timer */\r
52         OsDriver driver;\r
53         /* List of alarms this counter is connected to\r
54          * Overkill ??? Could have list of id's here, but easier to debug this way*/\r
55         SLIST_HEAD(slist,alarm_obj_s) alarm_head;\r
56         /* List of scheduletable connected to this counter */\r
57         SLIST_HEAD(sclist,sched_table_s) sched_head;\r
58 } counter_obj_t;\r
59 \r
60 TickType GetCounterValue_( counter_obj_t *c_p );\r
61 \r
62 #endif /*COUNTER_I_H_*/\r