MCUSW
Dio.h
Go to the documentation of this file.
1 /*
2 *
3 * Copyright (c) 2019 Texas Instruments Incorporated
4 *
5 * All rights reserved not granted herein.
6 *
7 * Limited License.
8 *
9 * Texas Instruments Incorporated grants a world-wide, royalty-free, non-exclusive
10 * license under copyrights and patents it now or hereafter owns or controls to make,
11 * have made, use, import, offer to sell and sell ("Utilize") this software subject to the
12 * terms herein. With respect to the foregoing patent license, such license is granted
13 * solely to the extent that any such patent is necessary to Utilize the software alone.
14 * The patent license shall not apply to any combinations which include this software,
15 * other than combinations with devices manufactured by or for TI ("TI Devices").
16 * No hardware patent is licensed hereunder.
17 *
18 * Redistributions must preserve existing copyright notices and reproduce this license
19 * (including the above copyright notice and the disclaimer and (if applicable) source
20 * code license limitations below) in the documentation and/or other materials provided
21 * with the distribution
22 *
23 * Redistribution and use in binary form, without modification, are permitted provided
24 * that the following conditions are met:
25 *
26 * * No reverse engineering, decompilation, or disassembly of this software is
27 * permitted with respect to any software provided in binary form.
28 *
29 * * any redistribution and use are licensed by TI for use only with TI Devices.
30 *
31 * * Nothing shall obligate TI to provide you with source code for the software
32 * licensed and provided to you in object code.
33 *
34 * If software source code is provided to you, modification and redistribution of the
35 * source code are permitted provided that the following conditions are met:
36 *
37 * * any redistribution and use of the source code, including any resulting derivative
38 * works, are licensed by TI for use only with TI Devices.
39 *
40 * * any redistribution and use of any object code compiled from the source code
41 * and any resulting derivative works, are licensed by TI for use only with TI Devices.
42 *
43 * Neither the name of Texas Instruments Incorporated nor the names of its suppliers
44 *
45 * may be used to endorse or promote products derived from this software without
46 * specific prior written permission.
47 *
48 * DISCLAIMER.
49 *
50 * THIS SOFTWARE IS PROVIDED BY TI AND TI'S LICENSORS "AS IS" AND ANY EXPRESS
51 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
52 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
53 * IN NO EVENT SHALL TI AND TI'S LICENSORS BE LIABLE FOR ANY DIRECT, INDIRECT,
54 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
55 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
56 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
57 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
58 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
59 * OF THE POSSIBILITY OF SUCH DAMAGE.
60 *
61 */
62 
89 /* Design : DES_DIO_001, DES_DIO_002, DES_DIO_003, DES_DIO_004 */
90 /*
91  * Below are the global requirements which are met by this DIO
92  * driver which can't be mapped to a particular source ID
93  */
94 /*
95  * Requirements : MCAL-1128 , MCAL-1088,MCAL-1087,MCAL-1089,
96  * MCAL-1104 , MCAL-1097, MCAL-1103, MCAL-981
97  */
98 #ifndef DIO_H_
99 #define DIO_H_
100 
101 /* ========================================================================== */
102 /* Include Files */
103 /* ========================================================================== */
104 
105 /* Requirements : MCAL-1091, MCAL-1090 */
106 #include "Std_Types.h"
107 /* Requirements : MCAL-1090 */
108 #include "Dio_Cfg.h"
109 
110 #ifdef __cplusplus
111 extern "C"
112 {
113 #endif
114 
115 /* ========================================================================== */
116 /* Macros & Typedefs */
117 /* ========================================================================== */
118 
126 #define DIO_SW_MAJOR_VERSION (1U)
127 
128 #define DIO_SW_MINOR_VERSION (2U)
129 
130 #define DIO_SW_PATCH_VERSION (1U)
131 /* @} */
132 
140 #define DIO_AR_RELEASE_MAJOR_VERSION (4U)
141 
142 #define DIO_AR_RELEASE_MINOR_VERSION (3U)
143 
144 #define DIO_AR_RELEASE_REVISION_VERSION (1U)
145 /* @} */
146 
152 #define DIO_VENDOR_ID ((uint16) 44U)
153 
154 #define DIO_MODULE_ID ((uint16) 120U)
155 /* @} */
156 
162 #if defined (SOC_AM65XX)
163 #define DIO_HW_UNIT_CNT (3U)
164 #elif defined (SOC_J721E)
165 #define DIO_HW_UNIT_CNT (10U)
166 #endif
167 
173 /* Requirements : MCAL-4171 */
174 #ifndef DIO_E_PARAM_INVALID_CHANNEL_ID
175 
176 #define DIO_E_PARAM_INVALID_CHANNEL_ID (0x0AU)
177 #endif
178 /* Requirements : MCAL-4172 */
179 #ifndef DIO_E_PARAM_INVALID_PORT_ID
180 
181 #define DIO_E_PARAM_INVALID_PORT_ID (0x14U)
182 #endif
183 /* Requirements : MCAL-4173 */
184 #ifndef DIO_E_PARAM_INVALID_GROUP
185 
186 #define DIO_E_PARAM_INVALID_GROUP (0x1FU)
187 #endif
188 /* Requirements : MCAL-4174 */
189 #ifndef DIO_E_PARAM_POINTER
190 
191 #define DIO_E_PARAM_POINTER (0x20U)
192 #endif
193 /* @} */
194 
202 /* DIO API service identification */
204 #define DIO_SID_READ_CHANNEL (0U)
205 
206 #define DIO_SID_WRITE_CHANNEL (1U)
207 
208 #define DIO_SID_READ_PORT (2U)
209 
210 #define DIO_SID_WRITE_PORT (3U)
211 
212 #define DIO_SID_READ_CHL_GROUP (4U)
213 
214 #define DIO_SID_WRITE_CHL_GROUP (5U)
215 
216 #define DIO_SID_FLIP_CHANNEL (7U)
217 
218 #define DIO_SID_GET_VERSION_INFO (18U)
219 /* @} */
220 
221 /* Requirements : MCAL-1125 */
224 #define DIO_PORT_WIDTH (32U)
225 
227 #define DIO_MCAL_2139_FIXED (0U)
228 /* ========================================================================== */
229 /* Structures and Enums */
230 /* ========================================================================== */
231 
241 /* Requirements : MCAL-1126, MCAL-1127, MCAL-1173 */
242 typedef uint32 Dio_ChannelType;
243 
245 /* Requirements : MCAL-1130, MCAL-1131, MCAL-1132,MCAL-1098 */
246 typedef uint32 Dio_PortType;
247 
248 /* Requirements : MCAL-1139 */
255 typedef uint32 Dio_PortLevelType;
256 /* Requirements : MCAL-1099, MCAL-1134, MCAL-1135 */
260 typedef struct
261 {
262  Dio_PortType port;
264  Dio_PortLevelType mask;
266  uint8 offset;
269 
270 /* Requirements : MCAL-1137 */
276 typedef uint8 Dio_LevelType;
277 
278 
279 
280 
281 /* @} */
282 
283 /* ========================================================================== */
284 /* Function Declarations */
285 /* ========================================================================== */
286 
308 FUNC(Dio_LevelType, DIO_CODE) Dio_ReadChannel(Dio_ChannelType ChannelId);
309 
328 FUNC(void, DIO_CODE) Dio_WriteChannel(
329  Dio_ChannelType ChannelId, Dio_LevelType Level);
330 
347 FUNC(Dio_PortLevelType, DIO_CODE) Dio_ReadPort(Dio_PortType PortId);
348 
367 FUNC(void, DIO_CODE) Dio_WritePort(
368  Dio_PortType PortId, Dio_PortLevelType Level);
369 
389 FUNC(Dio_PortLevelType, DIO_CODE) Dio_ReadChannelGroup(
390  const Dio_ChannelGroupType *ChannelGroupIdPtr);
391 
412 FUNC(void, DIO_CODE) Dio_WriteChannelGroup(
413  const Dio_ChannelGroupType *ChannelGroupIdPtr, Dio_PortLevelType Level);
414 
415 #if (STD_ON == DIO_VERSION_INFO_API)
416 
434 FUNC(void, DIO_CODE) Dio_GetVersionInfo(
435  P2VAR(Std_VersionInfoType, AUTOMATIC, DIO_APPL_DATA) versioninfo);
436 #endif
437 
438 #if (STD_ON == DIO_FLIP_CHANNEL_API)
439 
464 FUNC(Dio_LevelType, DIO_CODE) Dio_FlipChannel(Dio_ChannelType ChannelId);
465 #endif
466 
467 #if (STD_ON == DIO_REGISTER_READBACK_API)
468 
494 FUNC(uint32, DIO_CODE) Dio_RegisterReadback(Dio_ChannelType ChannelId);
495 #endif
496 
497 #ifdef __cplusplus
498 }
499 #endif
500 
501 #endif /* #ifndef DIO_H_ */
502 
503 /* @} */
void Dio_GetVersionInfo(Std_VersionInfoType *versioninfo)
Service to get the version information of this module.
uint32 Dio_ChannelType
type definition for identifying DIO channels (meaning single port pins)
Definition: Dio.h:242
void Dio_WriteChannelGroup(const Dio_ChannelGroupType *ChannelGroupIdPtr, Dio_PortLevelType Level)
Service to set a subset of the adjoining bits of a port to a specified level.
void Dio_WriteChannel(Dio_ChannelType ChannelId, Dio_LevelType Level)
Service to set a level of a channel.
uint32 Dio_PortLevelType
type definition for setting port level values
Definition: Dio.h:255
Type definition for identifying channel groups (meaning a set of pins in one port) ...
Definition: Dio.h:260
uint32 Dio_RegisterReadback(Dio_ChannelType ChannelId)
This function reads the important registers of the hardware unit and returns the value in the structu...
Dio_LevelType Dio_ReadChannel(Dio_ChannelType ChannelId)
Returns the value of the specified DIO channel.
void Dio_WritePort(Dio_PortType PortId, Dio_PortLevelType Level)
Service to set a value of the port.
uint8 Dio_LevelType
type definition for setting DIO channnel level values (allowed values: STD_HIGH and STD_LOW) ...
Definition: Dio.h:276
Dio_PortLevelType Dio_ReadChannelGroup(const Dio_ChannelGroupType *ChannelGroupIdPtr)
This Service reads a subset of the adjoining bits of a port.
Dio_PortLevelType mask
Definition: Dio.h:264
This file contains generated pre compile configuration file for DIO MCAL driver.
uint32 Dio_PortType
type definition for identifying ports
Definition: Dio.h:246
Dio_PortLevelType Dio_ReadPort(Dio_PortType PortId)
Returns the level of all channels of that port.
Dio_LevelType Dio_FlipChannel(Dio_ChannelType ChannelId)
Service to flip (change from 1 to 0 or from 0 to 1) the level of a channel and return the level of th...
Dio_PortType port
Definition: Dio.h:262
uint8 offset
Definition: Dio.h:266