]> rtime.felk.cvut.cz Git - arc.git/blob - include/Port.h
a5fa82d9f8a5e63bdb2d82ea99816ffc678066df
[arc.git] / include / Port.h
1 /* -------------------------------- Arctic Core ------------------------------
2  * Arctic Core - the open source AUTOSAR platform http://arccore.com
3  *
4  * Copyright (C) 2009  ArcCore AB <contact@arccore.com>
5  *
6  * This source code is free software; you can redistribute it and/or modify it
7  * under the terms of the GNU General Public License version 2 as published by the
8  * Free Software Foundation; See <http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt>.
9  *
10  * This program is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12  * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
13  * for more details.
14  * -------------------------------- Arctic Core ------------------------------*/
15
16 /** @addtogroup Port Port Driver
17  *  @{ */
18
19 /** @file Port.h
20  * API and type definitions for Port Driver.
21  */
22
23 #ifndef PORT_H_
24 #define PORT_H_
25
26 #define PORT_SW_MAJOR_VERSION 1
27 #define PORT_SW_MINOR_VERSION 0
28 #define PORT_SW_PATCH_VERSION 0
29
30 /** @req PORT114 */
31 #define PORT_AR_MAJOR_VERSION 3
32 #define PORT_AR_MINOR_VERSION 1
33 #define PORT_AR_PATCH_VERSION 0
34
35 #include "Modules.h"
36 #include "Port_Cfg.h" /** @req PORT130 */
37
38 #if (PORT_VERSION_INFO_API == STD_ON)
39 void Port_GetVersionInfo(Std_VersionInfoType *versionInfo);
40 #endif 
41
42 /** @name Error Codes */
43 /** @req PORT051 */
44 /** @req PORT116 */
45 #define PORT_E_PARAM_PIN              0x0a
46 #define PORT_E_DIRECTION_UNCHANGEABLE 0x0b
47 #define PORT_E_PARAM_CONFIG           0x0c
48 #define PORT_E_PARAM_INVALID_MODE     0x0d
49 #define PORT_E_MODE_UNCHANGEABLE      0x0e
50 #define PORT_E_UNINIT                 0x0f
51 #define PORT_E_PARAM_POINTER              0x10
52 //@}
53
54 /** @name Service id's */
55 //@{
56 #define PORT_INIT_ID                    0x00
57 #define PORT_SET_PIN_DIRECTION_ID       0x01
58 #define PORT_REFRESH_PORT_DIRECTION_ID  0x02
59 #define PORT_GET_VERSION_INFO_ID        0x03
60 #define PORT_SET_PIN_MODE_ID            0x04
61 //@}
62
63 /** @req PORT046
64  * The type Port_PinDirectionType is a type for defining the direction of a Port Pin.
65  * PORT_PIN_IN Sets port pin as input. 
66  * PORT_PIN_OUT  Sets port pin as output. 
67  */
68 typedef enum
69 {
70     PORT_PIN_IN = 0, PORT_PIN_OUT,
71 } Port_PinDirectionType;
72
73 #if defined(CFG_HC1X)
74 /** @req PORT124 */
75 typedef uint8 Port_PinModeType;
76 #else  // CFG_PPC, CFG_STM32_STAMP and others
77 typedef uint32 Port_PinModeType;
78 #endif
79
80 void Port_Init(const Port_ConfigType *configType);
81
82 #if ( PORT_SET_PIN_DIRECTION_API == STD_ON )
83 void Port_SetPinDirection(Port_PinType pin, Port_PinDirectionType direction);
84 #endif
85
86 void Port_RefreshPortDirection(void);
87
88 #if (PORT_SET_PIN_MODE_API == STD_ON)
89 void Port_SetPinMode(Port_PinType Pin, Port_PinModeType Mode);
90 #endif
91
92 typedef volatile struct pinMuxKicker
93 {
94     uint32 KICKER0;       /* kicker 0 register */
95     uint32 KICKER1;       /* kicker 1 register */
96 } pinMuxKICKER;
97
98 /** @def kickerReg
99 *   @brief Pin Muxing Kicker Register Frame Pointer
100 *       - used to enable and disable muxing across the device.
101 */
102 #define kickerReg ((pinMuxKICKER *) 0xFFFFEA38)
103
104 #endif /*PORT_H_*/
105 /** @} */