]> rtime.felk.cvut.cz Git - arc.git/blob - include/Det.h
Merge branch 'mikulka' of git@rtime.felk.cvut.cz:arc into mikulka
[arc.git] / include / Det.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 \r
18 \r
19 \r
20 \r
21 \r
22 \r
23 /*\r
24  * Development Error Tracer driver\r
25  *\r
26  */\r
27 \r
28 \r
29 /*\r
30  *  General requirements\r
31  */\r
32 /** @req DET004 */\r
33 \r
34 #ifndef DET_H\r
35 #define DET_H\r
36 \r
37 #define DET_MODULE_ID            MODULE_ID_DET\r
38 #define DET_VENDOR_ID            1\r
39 \r
40 /* Implementation version */\r
41 #define DET_SW_MAJOR_VERSION     1\r
42 #define DET_SW_MINOR_VERSION     0\r
43 #define DET_SW_PATCH_VERSION     0\r
44 \r
45 /* AUTOSAR specification document version */\r
46 #define DET_AR_MAJOR_VERSION     2\r
47 #define DET_AR_MINOR_VERSION     2\r
48 #define DET_AR_PATCH_VERSION     2\r
49 \r
50 #include "Std_Types.h"\r
51 #include "Det_Cfg.h"\r
52 #include "Modules.h"\r
53 \r
54 // Error codes\r
55 #define DET_E_CBK_REGISTRATION_FAILED 0x01\r
56 #define DET_E_INDEX_OUT_OF_RANGE      0x02\r
57 \r
58 #define DET_CALLBACK_API              0xFF\r
59 \r
60 #define DET_CBK_REGISTRATION_FAILED_INDEX       0xFF\r
61 \r
62 // Type used to store errors\r
63 typedef struct\r
64 {\r
65   uint16 moduleId;\r
66   uint8 instanceId;\r
67   uint8 apiId;\r
68   uint8 errorId;\r
69 } Det_EntryType;\r
70 \r
71 #if ( DET_ENABLE_CALLBACKS == STD_ON )\r
72 typedef void (*detCbk_t)( uint16 ModuleId, uint8 InstanceId , uint8 ApiId, uint8 ErrorId);\r
73 \r
74 /*\r
75  * Add a callback function to the array of callback. After a call to Det_ReportError the callback\r
76  * is called. This can be used in for instance unit tests to verify that correct errors are\r
77  * reported when sending invalid parameters to a function.\r
78  * This function returns the index of the callback in the array when registration is successful. If\r
79  * not DET_CBK_REGISTRATION_FAILED_INDEX is returned.\r
80  * The index can be used to remove a callback with the Det_RemoveCbk.\r
81  */\r
82 uint8 Det_AddCbk ( detCbk_t detCbk);\r
83 void Det_RemoveCbk ( uint8 detCbkIndex);\r
84 #endif\r
85 \r
86 void Det_Init( void ); /** @req DET008 */\r
87 #if DET_DEINIT_API == STD_ON\r
88 void Det_DeInit( void );\r
89 #endif\r
90 void Det_ReportError( uint16 ModuleId, uint8 InstanceId, uint8 ApiId, uint8 ErrorId); /** @req DET009 */\r
91 void Det_Start( void ); /** @req DET010 */\r
92 #define Det_GetVersionInfo(_vi) STD_GET_VERSION_INFO(_vi,DET) /** @req DET011 */ /** @req DET012 */\r
93 \r
94 #endif /*DET_H*/\r