]> rtime.felk.cvut.cz Git - arc.git/blob - include/Dio.h
Solved ticket refs #104.
[arc.git] / include / Dio.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 #ifndef DIO_H_\r
24 #define DIO_H_\r
25 \r
26 #include "Std_Types.h" /** @req DIO131 */\r
27 \r
28 // API Service ID's\r
29 #define DIO_READCHANNEL_ID                      0x00\r
30 #define DIO_WRITECHANNEL_ID                     0x01\r
31 #define DIO_READPORT_ID                         0x02\r
32 #define DIO_WRITEPORT_ID                        0x03\r
33 #define DIO_READCHANNELGROUP_ID         0x04\r
34 #define DIO_WRITECHANNELGROUP_ID        0x05\r
35 #define DIO_GETVERSIONINFO_ID           0x12\r
36 \r
37 #define DIO_E_PARAM_INVALID_CHANNEL_ID          10\r
38 #define DIO_E_PARAM_INVALID_PORT_ID             20\r
39 #define DIO_E_PARAM_INVALID_GROUP_ID            31\r
40 \r
41 #if defined(CFG_HC1X)\r
42 typedef uint8 Dio_ChannelType;\r
43 typedef uint8 Dio_PortType;\r
44 \r
45 /** @req DIO021 */\r
46 /** @req DIO022 */\r
47 typedef struct\r
48 {\r
49   Dio_PortType port;\r
50   uint8 offset;\r
51   uint8 mask;\r
52 } Dio_ChannelGroupType;\r
53 \r
54 /** @req DIO023 */\r
55 typedef uint8 Dio_LevelType;\r
56 \r
57 /** @req DIO024 */\r
58 typedef uint8 Dio_PortLevelType;\r
59 \r
60 #else   // CFG_PPC, CFG_STM32_STAMP and others\r
61 typedef uint32 Dio_ChannelType;\r
62 typedef uint32 Dio_PortType;\r
63 typedef struct\r
64 {\r
65   Dio_PortType port;\r
66   uint8 offset;\r
67   uint32 mask;\r
68 } Dio_ChannelGroupType;\r
69 \r
70 typedef uint32 Dio_LevelType;\r
71 \r
72 typedef uint16 Dio_PortLevelType;\r
73 #endif\r
74 \r
75 \r
76 #define DIO_MODULE_ID                   MODULE_ID_DIO\r
77 #define DIO_VENDOR_ID                   1\r
78 \r
79 #define DIO_SW_MAJOR_VERSION    1\r
80 #define DIO_SW_MINOR_VERSION    0\r
81 #define DIO_SW_PATCH_VERSION    0\r
82 \r
83 #define DIO_AR_MAJOR_VERSION    2\r
84 #define DIO_AR_MINOR_VERSION    2 \r
85 #define DIO_AR_PATCH_VERSION    1 \r
86 \r
87 #include "Dio_Cfg.h"\r
88 \r
89 /** @req DIO124 */\r
90 #if ( DIO_VERSION_INFO_API == STD_ON)\r
91 /** @req DIO139 */\r
92 #define Dio_GetVersionInfo(_vi) STD_GET_VERSION_INFO(_vi,DIO)\r
93 #endif\r
94 \r
95 /** @req DIO133 */\r
96 /** @req DIO027 */\r
97 Dio_LevelType Dio_ReadChannel(Dio_ChannelType channelId);\r
98 \r
99 /** @req DIO134 */\r
100 void Dio_WriteChannel(Dio_ChannelType channelId, Dio_LevelType level);\r
101 \r
102 /** @req DIO135 */\r
103 /** @req DIO031 */\r
104 Dio_PortLevelType Dio_ReadPort(Dio_PortType portId);\r
105 \r
106 /** @req DIO136 */\r
107 void Dio_WritePort(Dio_PortType portId, Dio_PortLevelType level);\r
108 \r
109 /** @req DIO137 */\r
110 Dio_PortLevelType Dio_ReadChannelGroup( const Dio_ChannelGroupType *channelGroupIdPtr );\r
111 \r
112 /** @req DIO138 */\r
113 void Dio_WriteChannelGroup(const Dio_ChannelGroupType *channelGroupIdPtr, Dio_PortLevelType level);\r
114 \r
115 #endif /*DIO_H_*/\r