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