]> rtime.felk.cvut.cz Git - arc.git/blob - include/Port.h
Merged in from diagnostic-dev
[arc.git] / include / Port.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 /** @addtogroup Port Port Driver\r
17  *  @{ */\r
18 \r
19 /** @file Port.h\r
20  * API and type definitions for Port Driver.\r
21  */\r
22 \r
23 #ifndef PORT_H_\r
24 #define PORT_H_\r
25 \r
26 #define PORT_SW_MAJOR_VERSION   1\r
27 #define PORT_SW_MINOR_VERSION   0\r
28 #define PORT_SW_PATCH_VERSION   0\r
29 \r
30 #define PORT_AR_MAJOR_VERSION   3\r
31 #define PORT_AR_MINOR_VERSION   0\r
32 #define PORT_AR_PATCH_VERSION   2\r
33 \r
34 #include "Port_Cfg.h" /** @req PORT130 */\r
35 \r
36 #if (PORT_VERSION_INFO_API == STD_ON)\r
37 void Port_GetVersionInfo(Std_VersionInfoType *versionInfo);\r
38 #endif\r
39 \r
40 /** @name Error Codes */\r
41 /** @req PORT051 */\r
42 /** @req PORT116 */\r
43 #define PORT_E_PARAM_PIN                                0x0a\r
44 #define PORT_E_DIRECTION_UNCHANGEABLE   0x0b\r
45 #define PORT_E_PARAM_CONFIG                             0x0c\r
46 #define PORT_E_PARAM_INVALID_MODE               0x0d\r
47 #define PORT_E_MODE_UNCHANGEABLE                0x0e\r
48 #define PORT_E_UNINIT                                   0x0f\r
49 //@}\r
50 \r
51 /** @name Service id's */\r
52 //@{\r
53 #define PORT_INIT_ID                                    0x00\r
54 #define PORT_SET_PIN_DIRECTION_ID               0x01\r
55 #define PORT_REFRESH_PORT_DIRECTION_ID  0x02\r
56 #define PORT_GET_VERSION_INFO_ID                0x03\r
57 #define PORT_SET_PIN_MODE_ID                    0x04\r
58 //@}\r
59 \r
60 /** @req PORT046\r
61  * The type Port_PinDirectionType is a type for defining the direction of a Port Pin.\r
62  * PORT_PIN_IN Sets port pin as input.\r
63  * PORT_PIN_OUT  Sets port pin as output.\r
64  */\r
65 typedef enum\r
66 {\r
67         PORT_PIN_IN = 0,\r
68         PORT_PIN_OUT,\r
69 } Port_PinDirectionType;\r
70 \r
71 #if defined(CFG_HC1X)\r
72 /** @req PORT124 */\r
73 typedef uint8 Port_PinModeType;\r
74 \r
75 #else   // CFG_PPC, CFG_STM32_STAMP and others\r
76 typedef uint32 Port_PinModeType;\r
77 #endif\r
78 \r
79 void Port_Init(const Port_ConfigType *configType);\r
80 #if (PORT_SET_PIN_DIRECTION_API == STD_ON)\r
81 void Port_SetPinDirection(Port_PinType pin, Port_PinDirectionType direction);\r
82 #endif\r
83 void Port_RefreshPortDirection(void);\r
84 #if (PORT_SET_PIN_MODE_API == STD_ON)\r
85 void Port_SetPinMode(Port_PinType Pin, Port_PinModeType Mode);\r
86 #endif\r
87 \r
88 #endif /*PORT_H_*/\r
89 /** @} */\r