]> rtime.felk.cvut.cz Git - arc.git/blob - include/Std_Types.h
Merge branch 'mikulka' of git@rtime.felk.cvut.cz:arc into mikulka
[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 //lint -esym(960,20.2) // PC-Lint LINT EXCEPTION\r
37 #define NULL    0\r
38 #endif\r
39 \r
40 //typedef uint8_t uint8;\r
41 //typedef uint16_t uint16;\r
42 //typedef uint32_t uint32;\r
43 \r
44 \r
45 typedef struct {\r
46         // TODO: not done!!\r
47         uint16 vendorID;\r
48         uint16 moduleID;\r
49         uint8  instanceID;\r
50 \r
51         uint8 sw_major_version;    /**< Vendor numbers */\r
52         uint8 sw_minor_version;    /**< Vendor numbers */\r
53         uint8 sw_patch_version;    /**< Vendor numbers */\r
54 \r
55         uint8 ar_major_version;    /**< Autosar spec. numbers */\r
56         uint8 ar_minor_version;    /**< Autosar spec. numbers */\r
57         uint8 ar_patch_version;    /**< Autosar spec. numbers */\r
58 } Std_VersionInfoType;\r
59 \r
60 /** make compare number... #if version > 10203  ( 1.2.3 ) */\r
61 #define STD_GET_VERSION (_major,_minor,_patch) (_major * 10000 + _minor * 100 + _patch)\r
62 \r
63 /** Create Std_VersionInfoType */\r
64 // PC-Lint Exception MISRA rule 19.12\r
65 //lint -save -esym(960,19.12)\r
66 #define STD_GET_VERSION_INFO(_vi,_module) \\r
67         if(_vi != NULL) {\\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 //lint -restore\r
78 \r
79 #ifndef MIN\r
80 #define MIN(_x,_y) (((_x) < (_y)) ? (_x) : (_y))\r
81 #endif\r
82 #ifndef MAX\r
83 #define MAX(_x,_y) (((_x) > (_y)) ? (_x) : (_y))\r
84 #endif\r
85 \r
86 \r
87 typedef uint8 Std_ReturnType;\r
88 \r
89 #define E_OK                                    (Std_ReturnType)0\r
90 #define E_NOT_OK                                (Std_ReturnType)1\r
91 \r
92 #define E_NO_DTC_AVAILABLE              (Std_ReturnType)2\r
93 #define E_SESSION_NOT_ALLOWED   (Std_ReturnType)4\r
94 #define E_PROTOCOL_NOT_ALLOWED  (Std_ReturnType)5\r
95 #define E_REQUEST_NOT_ACCEPTED  (Std_ReturnType)8\r
96 #define E_REQUEST_ENV_NOK               (Std_ReturnType)9\r
97 #define E_PENDING                               (Std_ReturnType)10\r
98 #define E_COMPARE_KEY_FAILED    (Std_ReturnType)11\r
99 #define E_FORCE_RCRRP                   (Std_ReturnType)12\r
100 \r
101 #define STD_HIGH                0x01\r
102 #define STD_LOW                 0x00\r
103 \r
104 #define STD_ACTIVE              0x01\r
105 #define STD_IDLE                0x00\r
106 \r
107 #define STD_ON                  0x01\r
108 #define STD_OFF                 0x00\r
109 \r
110 \r
111 #endif\r
112 /** @} */\r