]> rtime.felk.cvut.cz Git - arc.git/blob - include/IoHwAb.h
EcuM: More SchM,Gpt stuff
[arc.git] / include / IoHwAb.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 #ifndef IOHWAB_H_\r
19 #define IOHWAB_H_\r
20 \r
21 #define IOHWAB_SW_MAJOR_VERSION 1\r
22 #define IOHWAB_SW_MINOR_VERSION 0\r
23 #define IOHWAB_SW_PATCH_VERSION 0\r
24 \r
25 #define IOHWAB_MODULE_ID                0xAB\r
26 #define IOHWAB_VENDOR_ID                1\r
27 \r
28 #if defined(CFG_IOHWAB_USE_SERVICE_COMPONENT)\r
29 #include "Rte_Type.h"\r
30 #endif\r
31 \r
32 #include "IoHwAb_Cfg.h"\r
33 #include "IoHwAb_Types.h"\r
34 #include "IoHwAb_Analog.h"\r
35 #include "IoHwAb_Digital.h"\r
36 #include "IoHwAb_Pwm.h"\r
37 \r
38 \r
39 //#include "IoHwAb_Cbk.h"\r
40 \r
41 \r
42 #define IOHWAB_UNLOCKED         0\r
43 #define IOHWAB_LOCKED           1\r
44 \r
45 /******************************************** API ids *********************************************/\r
46 \r
47 #define IOHWAB_INIT_ID                                          0x10\r
48 \r
49 #define IOHWAB_ANALOG_GET_ID                            0x20\r
50 \r
51 #define IOHWAB_DIGITAL_GET_ID                           0x30\r
52 #define IOHWAB_DIGITAL_SET_ID                           0x31\r
53 \r
54 #define IOHWAB_PWMDUTY_SET_ID                           0x40\r
55 #define IOHWAB_PWMFREQUENCYANDDUTY_SET_ID       0x41\r
56 \r
57 #define IOHWAB_CAPTURE_GET_ID                           0x50\r
58 \r
59 /***************************************** DET error ids ******************************************/\r
60 \r
61 #define IOHWAB_E_INIT                           0x01\r
62 \r
63 #define IOHWAB_E_PARAM_SIGNAL           0x11\r
64 #define IOHWAB_E_PARAM_DUTY                     0x12\r
65 \r
66 /******************************************* DET macros *******************************************/\r
67 \r
68 #if (IOHWAB_DEV_ERROR_DETECT == STD_ON)\r
69 \r
70 #define IOHWAB_DET_REPORT_ERROR(api, error)                   \\r
71                 do {                                                  \\r
72                         Det_ReportError(IOHWAB_MODULE_ID, 0, api, error); \\r
73                 } while(0)\r
74 \r
75 #define IOHWAB_VALIDATE(expression, api, error)      \\r
76                 do {                                         \\r
77                         if ( !(expression) ) {                   \\r
78                                 IOHWAB_DET_REPORT_ERROR(api, error); \\r
79                         }                                        \\r
80                 } while(0)\r
81 \r
82 #define IOHWAB_VALIDATE_RETURN(expression, api, error, rv) \\r
83                 do {                                               \\r
84                         if ( !(expression) ) {                         \\r
85                                 IOHWAB_DET_REPORT_ERROR(api, error);       \\r
86                                 return rv;                                 \\r
87                         }                                              \\r
88                 } while(0)\r
89 \r
90 #else  /* IOHWAB_DEV_ERROR_DETECT */\r
91 \r
92 #define IOHWAB_DET_REPORT_ERROR(api, error)\r
93 #define IOHWAB_VALIDATE(expression, api, error)\r
94 #define IOHWAB_VALIDATE_RETURN(expression, api, error, rv)\r
95 \r
96 #endif /* IOHWAB_DEV_ERROR_DETECT */\r
97 \r
98 \r
99 #define IoHwAb_LockSave(_x)     Irq_Save(_x)\r
100 #define IoHwAb_LockRestore(_x)  Irq_Restore(_x)\r
101 \r
102 void IoHwAb_Init( void );\r
103 \r
104 \r
105 #endif /* IOHWAB_H_ */\r