]> rtime.felk.cvut.cz Git - arc.git/blob - include/Std_Types.h
Integration with Arctic Core Builder Empty Toolchain
[arc.git] / include / Std_Types.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 /** @addtogroup General General
17  *  @{ */
18
19 /** @file Std_Types.h
20  *  Definitions of General types.
21  */
22 \r
23 #ifndef _STD_TYPES_H\r
24 #define _STD_TYPES_H\r
25 \r
26 // Autosar include files....\r
27 // TODO: we haven't really defined the autosar types yet.\r
28 //       the standard types are uint8, etc.\r
29 \r
30 #ifndef NULL\r
31 #define NULL    0\r
32 #endif\r
33 \r
34 #if !defined(USE_KERNEL)\r
35 #include "typedefs.h"\r
36 #else\r
37 #include <stdint.h>\r
38 #endif\r
39 \r
40 #include "Platform_Types.h" // TODO: move\r
41 #include "Compiler.h"\r
42 \r
43 //typedef uint8_t uint8;\r
44 //typedef uint16_t uint16;\r
45 //typedef uint32_t uint32;\r
46 \r
47 \r
48 typedef struct {\r
49         // TODO: not done!!\r
50         uint16 vendorID;\r
51         uint16 moduleID;\r
52         uint8  instanceID;\r
53
54         uint8 sw_major_version;    /**< Vendor numbers */
55         uint8 sw_minor_version;    /**< Vendor numbers */
56         uint8 sw_patch_version;    /**< Vendor numbers */
57
58         uint8 ar_major_version;    /**< Autosar spec. numbers */
59         uint8 ar_minor_version;    /**< Autosar spec. numbers */
60         uint8 ar_patch_version;    /**< Autosar spec. numbers */
61 } Std_VersionInfoType;\r
62 \r
63 /** make compare number... #if version > 10203  ( 1.2.3 ) */
64 #define STD_GET_VERSION (_major,_minor,_patch) (_major * 10000 + _minor * 100 + _patch)\r
65 \r
66 /** Create Std_VersionInfoType */
67 #define STD_GET_VERSION_INFO(_vi,_module) \\r
68         ((_vi)->vendorID =  _module ## _VENDOR_ID);\\r
69         ((_vi)->moduleID = _module ## _MODULE_ID);\\r
70         ((_vi)->sw_major_version = _module ## _SW_MAJOR_VERSION);\\r
71         ((_vi)->sw_minor_version =  _module ## _SW_MINOR_VERSION);\\r
72         ((_vi)->sw_patch_version =  _module ## _SW_PATCH_VERSION);\\r
73         ((_vi)->ar_major_version =  _module ## _AR_MAJOR_VERSION);\\r
74         ((_vi)->ar_minor_version =  _module ## _AR_MINOR_VERSION);\\r
75         ((_vi)->ar_patch_version =  _module ## _AR_PATCH_VERSION);\r
76 \r
77 \r
78 // TODO: Move to OSEK implementation, See 8.2 in SWS_StandardTypes\r
79 \r
80 #define STATUSTYPEDEFINED\r
81 typedef enum {\r
82         E_OK = 0,\r
83         E_OS_ACCESS = 1,               /**< STD OSEK */
84         E_OS_CALLEVEL = 2,             /**< STD OSEK */
85         E_OS_ID = 3,                   /**< STD OSEK */
86         E_OS_LIMIT = 4,                /**< STD OSEK */
87         E_OS_NOFUNC = 5,               /**< STD OSEK */
88         E_OS_RESOURCE = 6,             /**< STD OSEK */
89         E_OS_STATE = 7,                /**< STD OSEK */
90         E_OS_VALUE = 8,                /**< STD OSEK */
91 \r
92         E_OS_SERVICEID,                /**< AUTOSAR, see 7.10 */
93         E_OS_RATE ,                    /**< AUTOSAR, see 7.10 */
94         E_OS_ILLEGAL_ADDRESS ,         /**< AUTOSAR, see 7.10 */
95         E_OS_MISSINGEND ,              /**< AUTOSAR, see 7.10 */
96         E_OS_DISABLEDINT ,             /**< AUTOSAR, see 7.10 */
97         E_OS_STACKFAULT ,              /**< AUTOSAR, see 7.10 */
98         E_OS_PROTECTION_MEMORY ,       /**< AUTOSAR, see 7.10 */
99         E_OS_PROTECTION_TIME ,         /**< AUTOSAR, see 7.10 */
100         E_OS_PROTECTION_LOCKED ,       /**< AUTOSAR, see 7.10 */
101         E_OS_PROTECTION_EXCEPTION ,    /**< AUTOSAR, see 7.10 */
102         E_OS_PROTECTION_RATE,          /**< AUTOSAR, see 7.10 */
103 \r
104         /* COM.. TODO: move ?? */\r
105         E_COM_ID,\r
106 \r
107 \r
108         /** Implementation specific */
109         E_OS_SYS_APA,\r
110 \r
111         E_NOT_OK,\r
112 } StatusType;\r
113 \r
114 \r
115 // TODO: really ???\r
116 typedef uint8 Std_ReturnType;\r
117 \r
118 \r
119 #ifndef STATUSTYPEDEFINED\r
120 #define STATUSTYPEDEFINED\r
121 #define E_OK                    0\r
122 typedef unsigned char StatusType;\r
123 #endif\r
124 \r
125 #define E_NOT_OK                1\r
126 \r
127 #define STD_HIGH                0x01\r
128 #define STD_LOW         0x00\r
129 \r
130 #define STD_ACTIVE              0x01\r
131 #define STD_IDLE                0x00\r
132 \r
133 #define STD_ON                  0x01\r
134 #define STD_OFF         0x00\r
135 \r
136 \r
137 #endif\r
138 /** @} */