#ifndef DIO_CFG_H
#define DIO_CFG_H
/**********************************************************************************************************************
 *  COPYRIGHT
 *  -------------------------------------------------------------------------------------------------------------------
 *  \verbatim
 *
 *                 TEXAS INSTRUMENTS INCORPORATED PROPRIETARY INFORMATION
 *
 *                 Property of Texas Instruments, Unauthorized reproduction and/or distribution
 *                 is strictly prohibited.  This product  is  protected  under  copyright  law
 *                 and  trade  secret law as an  unpublished work.
 *                 (C) Copyright Texas Instruments.  All rights reserved.
 *
 *  \endverbatim
 *  -------------------------------------------------------------------------------------------------------------------
 *  FILE DESCRIPTION
 *  -------------------------------------------------------------------------------------------------------------------
 *         File:  Dio_Cfg.h
 *    Component:  Tms570_AutosarDioDriver
 *       Module:  DioDriver Configuration Header File Dio_Cfg.h
 *    Generator:  EB Tresos
 *
 *  Description:  This file is generated by EB Tresos.Do not modify this file, otherwise the software may
 *                behave in unexpected way.
 *
 *
 * ---------------------------------------------------------------------------------------------------------------------
 * Author:  Sunil Kumar T V
 *---------------------------------------------------------------------------------------------------------------------
 * Revision History
 *---------------------------------------------------------------------------------------------------------------------
 * Version        Date         Author               Change ID        Description
 *---------------------------------------------------------------------------------------------------------------------
 * 02.10.00       11Feb2013    Sapthagiri G         0000000000000    Initial version(adapted from TMS570LS31xx v01.10.00). 
 * 02.20.00       29Aug2013    Sreyas K             SDOCM00103509    Changes for Production Version Champion
 * 02.21.00       30Sep2014    Vineeth T Alex       SDOCM00113124    Changes for 2.21.00 release; Files restructured
 * 02.21.01       11Mar2016    E Lizarraga          SDOCM00121657    Changes for 2.21.01 version
 * 02.30.00       01Dec2016    Sudhakar Singh       None             Update version info
 * 05.30.00       15Mar2017    Sudhakar Singh       SDOCM00122834    Version supports TMS570LSxx Family of Devices.
 *********************************************************************************************************************/

/**********************************************************************************************************************
    Project: [!"$project"!]
	Date   : [!"$datetime"!]

    This file is generated by EB Tresos
    Do not modify this file, otherwise the software may behave in unexpected way.

 *********************************************************************************************************************/

/**********************************************************************************************************************
 *  PUBLIC PART OF CONFIGURATION
 *********************************************************************************************************************/
 
/**********************************************************************************************************************
 * INCLUDES
 *********************************************************************************************************************/
 
#include "Dem.h"
 
/**********************************************************************************************************************
 *  GLOBAL CONSTANT MACROS
 *********************************************************************************************************************/
/* SourceId : DIO_SourceId_065 */
/* DesignId : Dio_DesignId_01  */
/* Requirements : AR_DIO_SR107 */
/* Configuration file version information */
#define DIO_CFG_MAJOR_VERSION               (5U)
#define DIO_CFG_MINOR_VERSION               (30U)
#define DIO_CFG_PATCH_VERSION               (0U)

#define DIO_INSTANCE_ID           (0U)
/* SourceId : DIO_SourceId_046 */
/* DesignId : Dio_DesignId_07  */
/* Requirements : AR_DIO_SR44, AR_DIO_SR108, AR_DIO_SR45 */
#define DIO_DEV_ERROR_DETECT      [!IF "as:modconf('Dio')[1]/DioGeneral/DioDevErrorDetect"!](STD_ON)[!ELSE!](STD_OFF)[!ENDIF!]
#define DIO_DEM_ENABLE		      [!IF "as:modconf('Dio')[1]/DioGeneral/DioDemEnable"!](STD_ON)[!ELSE!](STD_OFF)[!ENDIF!]
/* SourceId : DIO_SourceId_067 */
/* DesignId : Dio_DesignId_01  */
/* Requirements : AR_DIO_SR110 */
#define DIO_VERSION_INFO_API      [!IF "as:modconf('Dio')[1]/DioGeneral/DioVersionInfoApi"!](STD_ON)[!ELSE!](STD_OFF)[!ENDIF!]
/* SourceId : DIO_SourceId_066 */
/* DesignId : Dio_DesignId_18  */
/* Requirements : AR_DIO_SR109 */
#define DIO_FLIP_CHANNEL_API      [!IF "as:modconf('Dio')[1]/DioGeneral/DioFlipChannelApi"!](STD_ON)[!ELSE!](STD_OFF)[!ENDIF!]

/* SourceId : DIO_SourceId_008 */
/* DesignId : Dio_DesignId_09  */
/* Requirements : AR_DIO_SR19, AR_DIO_SR20, AR_DIO_SR56, AR_DIO_SR111, AR_DIO_SR114, AR_DIO_SR113, AR_DIO_SR119 */
/*<DIO_CFG_CHL_LIST>*/
[!VAR "var1" = "0"!]
[!LOOP "as:modconf('Dio')[1]/DioConfig/*[1]/DioPort/*"!][!LOOP "DioChannel/*"!]#define [!"@name"!] ((Dio_ChannelType) [!"num:i($var1)"!]U)[!VAR "var1" = "$var1+1"!][!CR!][!ENDLOOP!][!ENDLOOP!]
#define MAX_NO_OF_CHANNELS [!"num:i($var1)"!]U
/*</DIO_CFG_CHL_LIST>*/

/* SourceId : DIO_SourceId_050 */
/* DesignId : Dio_DesignId_09  */
/* Requirements : AR_DIO_SR58, AR_DIO_SR59, AR_DIO_SR60, AR_DIO_SR111,AR_DIO_SR112 */
/*<DIO_CFG_PORT_LIST>*/
[!VAR "var1" = "0"!]
[!LOOP "as:modconf('Dio')[1]/DioConfig/*[1]/DioPort/*"!]#define [!"@name"!] ((Dio_PortType)  [!"num:i($var1)"!]U)[!CR!][!VAR "var1" = "$var1+1"!][!ENDLOOP!]
#define MAX_NO_OF_PORTS [!"num:i($var1)"!]U
/*</DIO_CFG_PORT_LIST>*/


/* SourceId : DIO_SourceId_070*/
/* DesignId : Dio_DesignId_25 */
/* Requirements : AR_DIO_SR106 */
[!IF "as:modconf('Dio')[1]/IMPLEMENTATION_CONFIG_VARIANT = 'VariantPostBuild'"!]#define DIO_PBCFG_SOURCE[!ELSE!][!ENDIF!]


#define DIO_CFG_SUPPORT_GIO           [!IF "as:modconf('Dio')[1]/DioGeneral/DioCfgSupportGio"!](STD_ON)[!ELSE!](STD_OFF)[!ENDIF!]
#define DIO_CFG_SUPPORT_CAN           [!IF "as:modconf('Dio')[1]/DioGeneral/DioCfgSupportCan"!](STD_ON)[!ELSE!](STD_OFF)[!ENDIF!]

/* DEM Error Codes */
#define DIO_DEM_NO_EVENT (0xFFFFFFFFU)

/* DIO IO check Dem IDs */
#ifndef DIO_WRITE_CHANNEL_EVENT_ID
/*SAFETYMCUSW 580 S MR:19.1 <APPROVED> "Reason - Inspected, defined if only not defined" */
	#define DIO_WRITE_CHANNEL_EVENT_ID			[!IF "node:refexists(as:modconf('Dio')[1]/DioDemEventParameterRef/DIO_WRITE_CHANNEL_EVENT_ID)"!]DemConf_DemEventParameter_[!"substring-after(substring-after(substring-after(substring-after(as:modconf('Dio')[1]/DioDemEventParameterRef/DIO_WRITE_CHANNEL_EVENT_ID,'/'),'/'),'/'),'/')"!][!ELSE!]DIO_DEM_NO_EVENT[!ENDIF!]
#endif
#ifndef DIO_WRITE_PORT_EVENT_ID
/*SAFETYMCUSW 580 S MR:19.1 <APPROVED> "Reason - Inspected, defined if only not defined" */
	#define DIO_WRITE_PORT_EVENT_ID				[!IF "node:refexists(as:modconf('Dio')[1]/DioDemEventParameterRef/DIO_WRITE_PORT_EVENT_ID)"!]DemConf_DemEventParameter_[!"substring-after(substring-after(substring-after(substring-after(as:modconf('Dio')[1]/DioDemEventParameterRef/DIO_WRITE_PORT_EVENT_ID,'/'),'/'),'/'),'/')"!][!ELSE!]DIO_DEM_NO_EVENT[!ENDIF!]
#endif

/**********************************************************************************************************************
 *  STATIC TESTS
 *********************************************************************************************************************/
/* Static tests for configuration integrity can be conducted here */
/* This check throws an error if Dio is configured to support neither Can nor Gio */
[!IF "as:modconf('Dio')[1]/DioGeneral/DioCfgSupportGio"!][!ELSEIF "as:modconf('Dio')[1]/DioGeneral/DioCfgSupportCan"!]
[!ELSE!][!ERROR "Dio does not support Can nor Gio. This configuration is invalid."!][!ENDIF!]

#if ((DIO_CFG_SUPPORT_GIO == STD_OFF) && (DIO_CFG_SUPPORT_CAN == STD_OFF))
error("DIO does not support CAN or GIO. This configuration is not valid.");
#endif
  
/********************************************************************************************************************
 *  GLOBAL DATA
 ********************************************************************************************************************/

/* table containing all configured channels for checking */
/*SAFETYMCUSW 127 S MR:8.12 <APPROVED> "Array as extern"*/
extern CONST(Dio_ChannelType, DIO_CONST) Dio_ChannelCheckTable[];


/* table containing all configured ports for checking */
/*SAFETYMCUSW 127 S MR:8.12 <APPROVED> "Array as extern"*/
extern CONST(Dio_PortType, DIO_CONST) Dio_PortCheckTable[];


/* SourceId : DIO_SourceId_052 */
/* DesignId : Dio_DesignId_09  */
/* Requirements : AR_DIO_SR63, AR_DIO_SR111, AR_DIO_SR115 */
/*<DIO_CFG_GROUP_LIST>*/
[!LOOP "as:modconf('Dio')[1]/DioConfig/*[1]/DioPort/*"!][!LOOP "DioChannelGroup/*"!]extern CONST(Dio_ChannelGroupType, DIO_CONST) [!"@name"!];[!CR!][!ENDLOOP!][!ENDLOOP!]
/*</DIO_CFG_GROUP_LIST>*/


/* Dio_ConfigType for the  Dio_Init()*/
/* SourceId : DIO_SourceId_054 */
/* DesignId : Dio_DesignId_02  */
/* Requirements : AR_DIO_SR68, AR_DIO_SR69 */
typedef struct _Dio_ConfigType
{
   uint8 totalNumPorts;
}Dio_ConfigType;

/* Dummy Configuration variable to be passed to Dio Init API */
extern CONST(Dio_ConfigType, DIO_PBCFG) DioModuleConfiguration_0;

#endif  /* DIO_CFG_H */

/**********************************************************************************************************************
 *  END OF FILE: Dio_Cfg.h
 *********************************************************************************************************************/
