]> rtime.felk.cvut.cz Git - arc.git/blob - system/WdgIf/WdgIf.c
#ifdef:ed all Det includes
[arc.git] / system / WdgIf / WdgIf.c
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  * WdgIf.c\r
16  *\r
17  *  Created on: 22 feb 2010\r
18  *      Author: Fredrik\r
19  */\r
20 \r
21 // 904 PC-Lint MISRA 14.7: OK. Allow VALIDATE_ENTITY_ID, VALIDATE and VALIDATE_NO_RETURNVAL to return value.\r
22 //lint -emacro(904,VALIDATE,VALIDATE_NO_RETURNVAL)\r
23 \r
24 #include "WdgIf.h"\r
25 #if defined(USE_DET)\r
26 #include "Det.h"\r
27 #endif\r
28 \r
29 #define VALIDATE(_expr, _api, _errorcode) \\r
30         if(!_expr) {    \\r
31                 Det_ReportError(MODULE_ID_WDGIF,0,_api,_errorcode ); \\r
32                 ret = E_NOT_OK; \\r
33                 return ret;     \\r
34                 }\r
35 \r
36 #define VALIDATE_NO_RETURNVAL(_expr, _api, _errorcode) \\r
37         if(!_expr) {    \\r
38                 Det_ReportError(MODULE_ID_WDGIF,0,_api,_errorcode ); \\r
39                 return; \\r
40                 }\r
41 \r
42 \r
43 Std_ReturnType WdgIf_SetMode (uint8 DeviceIndex, WdgIf_ModeType Mode)\r
44 {\r
45         Std_ReturnType ret = E_NOT_OK;\r
46         VALIDATE((WdgIfConfig.WdgIf_General->WdgIf_NumberOfDevices > DeviceIndex), WDGIF_SETMODE_ID, WDGIF_E_PARAM_DEVICE);\r
47 \r
48         return WdgIfConfig.WdgIf_Device[DeviceIndex].WdgRef->Wdg_SetModeLocationPtr(Mode);\r
49 }\r
50 \r
51 void WdgIf_Trigger (uint8 DeviceIndex)\r
52 {\r
53         VALIDATE_NO_RETURNVAL((WdgIfConfig.WdgIf_General->WdgIf_NumberOfDevices > DeviceIndex), WDGIF_TRIGGER_ID, WDGIF_E_PARAM_DEVICE);\r
54         WdgIfConfig.WdgIf_Device[DeviceIndex].WdgRef->Wdg_TriggerLocationPtr();\r
55 }\r