]> rtime.felk.cvut.cz Git - arc.git/blob - include/Std_Types.h
fe5a70fdb32dcfeaf2a499654003f3766b517709
[arc.git] / include / Std_Types.h
1 /* -------------------------------- Arctic Core ------------------------------\r
2  * Arctic Core - the open source AUTOSAR platform http://arccore.com\r
3  *\r
4  * Copyright (C) 2009  ArcCore AB <contact@arccore.com>\r
5  *\r
6  * This source code is free software; you can redistribute it and/or modify it\r
7  * under the terms of the GNU General Public License version 2 as published by the\r
8  * Free Software Foundation; See <http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt>.\r
9  *\r
10  * This program is distributed in the hope that it will be useful, but\r
11  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY\r
12  * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License\r
13  * for more details.\r
14  * -------------------------------- Arctic Core ------------------------------*/\r
15 \r
16 \r
17 /** @addtogroup General General\r
18  *  @{ */\r
19 \r
20 /** @file Std_Types.h\r
21  *  Definitions of General types.\r
22  */\r
23 \r
24 #ifndef _STD_TYPES_H\r
25 #define _STD_TYPES_H\r
26 \r
27 // Autosar include files....\r
28 // TODO: we haven't really defined the autosar types yet.\r
29 //       the standard types are uint8, etc.\r
30 \r
31 #include <stdint.h>\r
32 #include "Platform_Types.h" // TODO: move\r
33 #include "Compiler.h"\r
34 \r
35 #ifndef         NULL\r
36 #define NULL    0\r
37 #endif\r
38 \r
39 //typedef uint8_t uint8;\r
40 //typedef uint16_t uint16;\r
41 //typedef uint32_t uint32;\r
42 \r
43 \r
44 typedef struct {\r
45         // TODO: not done!!\r
46         uint16 vendorID;\r
47         uint16 moduleID;\r
48         uint8  instanceID;\r
49 \r
50         uint8 sw_major_version;    /**< Vendor numbers */\r
51         uint8 sw_minor_version;    /**< Vendor numbers */\r
52         uint8 sw_patch_version;    /**< Vendor numbers */\r
53 \r
54         uint8 ar_major_version;    /**< Autosar spec. numbers */\r
55         uint8 ar_minor_version;    /**< Autosar spec. numbers */\r
56         uint8 ar_patch_version;    /**< Autosar spec. numbers */\r
57 } Std_VersionInfoType;\r
58 \r
59 /** make compare number... #if version > 10203  ( 1.2.3 ) */\r
60 #define STD_GET_VERSION (_major,_minor,_patch) (_major * 10000 + _minor * 100 + _patch)\r
61 \r
62 /** Create Std_VersionInfoType */\r
63 #define STD_GET_VERSION_INFO(_vi,_module) \\r
64         ((_vi)->vendorID =  _module ## _VENDOR_ID);\\r
65         ((_vi)->moduleID = _module ## _MODULE_ID);\\r
66         ((_vi)->sw_major_version = _module ## _SW_MAJOR_VERSION);\\r
67         ((_vi)->sw_minor_version =  _module ## _SW_MINOR_VERSION);\\r
68         ((_vi)->sw_patch_version =  _module ## _SW_PATCH_VERSION);\\r
69         ((_vi)->ar_major_version =  _module ## _AR_MAJOR_VERSION);\\r
70         ((_vi)->ar_minor_version =  _module ## _AR_MINOR_VERSION);\\r
71         ((_vi)->ar_patch_version =  _module ## _AR_PATCH_VERSION);\r
72 \r
73 \r
74 // TODO: Move to OSEK implementation, See 8.2 in SWS_StandardTypes\r
75 \r
76 #define STATUSTYPEDEFINED\r
77 typedef enum {\r
78         E_OK = 0,\r
79         E_OS_ACCESS = 1,               /**< STD OSEK */\r
80         E_OS_CALLEVEL = 2,             /**< STD OSEK */\r
81         E_OS_ID = 3,                   /**< STD OSEK */\r
82         E_OS_LIMIT = 4,                /**< STD OSEK */\r
83         E_OS_NOFUNC = 5,               /**< STD OSEK */\r
84         E_OS_RESOURCE = 6,             /**< STD OSEK */\r
85         E_OS_STATE = 7,                /**< STD OSEK */\r
86         E_OS_VALUE = 8,                /**< STD OSEK */\r
87 \r
88         E_OS_SERVICEID,                /**< AUTOSAR, see 7.10 */\r
89         E_OS_RATE ,                    /**< AUTOSAR, see 7.10 */\r
90         E_OS_ILLEGAL_ADDRESS ,         /**< AUTOSAR, see 7.10 */\r
91         E_OS_MISSINGEND ,              /**< AUTOSAR, see 7.10 */\r
92         E_OS_DISABLEDINT ,             /**< AUTOSAR, see 7.10 */\r
93         E_OS_STACKFAULT ,              /**< AUTOSAR, see 7.10 */\r
94         E_OS_PROTECTION_MEMORY ,       /**< AUTOSAR, see 7.10 */\r
95         E_OS_PROTECTION_TIME ,         /**< AUTOSAR, see 7.10 */\r
96         E_OS_PROTECTION_LOCKED ,       /**< AUTOSAR, see 7.10 */\r
97         E_OS_PROTECTION_EXCEPTION ,    /**< AUTOSAR, see 7.10 */\r
98         E_OS_PROTECTION_RATE,          /**< AUTOSAR, see 7.10 */\r
99 \r
100         /* COM.. TODO: move ?? */\r
101         E_COM_ID,\r
102 \r
103 \r
104         /** Implementation specific */\r
105         E_OS_SYS_APA,\r
106 \r
107         E_NOT_OK,\r
108 } StatusType;\r
109 \r
110 typedef uint8 Std_ReturnType;\r
111 \r
112 \r
113 #ifndef STATUSTYPEDEFINED\r
114 #define STATUSTYPEDEFINED\r
115 #define E_OK                    0\r
116 typedef unsigned char StatusType;\r
117 #endif\r
118 \r
119 #define E_NOT_OK                                1\r
120 \r
121 #define E_NO_DTC_AVAILABLE              2\r
122 #define E_SESSION_NOT_ALLOWED   4\r
123 #define E_PROTOCOL_NOT_ALLOWED  5\r
124 #define E_REQUEST_NOT_ACCEPTED  8\r
125 #define E_REQUEST_ENV_NOK               9\r
126 #define E_PENDING                               10\r
127 #define E_COMPARE_KEY_FAILED    11\r
128 #define E_FORCE_RCRRP                   12\r
129 \r
130 #define STD_HIGH                0x01\r
131 #define STD_LOW                 0x00\r
132 \r
133 #define STD_ACTIVE              0x01\r
134 #define STD_IDLE                0x00\r
135 \r
136 #define STD_ON                  0x01\r
137 #define STD_OFF                 0x00\r
138 \r
139 \r
140 #endif\r
141 /** @} */\r