/**********************************************************************************************************************
 *  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:  Gpt_Cfg.h
 *      Project:  Tms570_AutosarGptDriver
 *       Module:  GptDriver
 *    Generator:  EB Tresos
 *
 *  Description:  This component provides services for initialization and control of the microcontroller internal
 *                GPT unit (General Purpose Timer).
 *  
 ---------------------------------------------------------------------------------------------------------------------
 * Author:  Vishwanath Reddy
 *---------------------------------------------------------------------------------------------------------------------
 * Revision History
 *---------------------------------------------------------------------------------------------------------------------
 * Version        Date         Author               Change ID        Description
 *--------------------------------------------------------------------------------------------------------------------- 
 * 02.21.00       30Sep14      Vishwanath Reddy     SDOCM00113129    Initial Version
 * 02.21.01       11Mar16      Enrique Lizarraga    SDOCM00121245    Update version info
 * 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.
    
 *********************************************************************************************************************/
#ifndef GPT_CFG_H
#define GPT_CFG_H

/**********************************************************************************************************************
 *  GLOBAL CONSTANT MACROS
 *********************************************************************************************************************/
/*---- Version identification -------------------------------------------------*/
#define GPT_CFG_MAJOR_VERSION               (5U)
#define GPT_CFG_MINOR_VERSION               (30U)
#define GPT_CFG_PATCH_VERSION               (0U)

/* ---- Pre-Compile Switches for API Services ----------------------------------*/
#define GPT_DEINIT_API                 		[!IF "as:modconf('Gpt')[1]/GptConfigurationOfOptApiServices/GptDeinitApi"!](STD_ON)[!ELSE!](STD_OFF)[!ENDIF!]
#define GPT_TIME_ELAPSED_API		   		[!IF "as:modconf('Gpt')[1]/GptConfigurationOfOptApiServices/GptTimeElapsedApi"!](STD_ON)[!ELSE!](STD_OFF)[!ENDIF!]
#define GPT_TIME_REMAINING_API          	[!IF "as:modconf('Gpt')[1]/GptConfigurationOfOptApiServices/GptTimeRemainingApi"!](STD_ON)[!ELSE!](STD_OFF)[!ENDIF!]
#define GPT_ENABLE_DISABLE_NOTIFICATION_API [!IF "as:modconf('Gpt')[1]/GptConfigurationOfOptApiServices/GptEnableDisableNotificationApi"!](STD_ON)[!ELSE!](STD_OFF)[!ENDIF!]
#define GPT_WAKEUP_FUNCTIONALITY_API     	[!IF "as:modconf('Gpt')[1]/GptConfigurationOfOptApiServices/GptWakeupFunctionalityApi"!](STD_ON)[!ELSE!](STD_OFF)[!ENDIF!]
#define GPT_VERSION_INFO_API            	[!IF "as:modconf('Gpt')[1]/GptConfigurationOfOptApiServices/GptVersionInfoApi"!](STD_ON)[!ELSE!](STD_OFF)[!ENDIF!]
#define GPT_SAFETI_API            			[!IF "as:modconf('Gpt')[1]/GptConfigurationOfOptApiServices/GptSafetiApi"!](STD_ON)[!ELSE!](STD_OFF)[!ENDIF!]

/**********************************************************************************************************************
 *  INCLUDES
 *********************************************************************************************************************/

[!IF "as:modconf('Gpt')[1]/GptDriverConfiguration/GptNotificationsIncludeFile != ''"!]
#if (GPT_ENABLE_DISABLE_NOTIFICATION_API == STD_ON)
    /* include user callback definitions for notification  */
#include "[!"as:modconf('Gpt')[1]/GptDriverConfiguration/GptNotificationsIncludeFile"!]"
#endif[!ENDIF!]

/*<GPT_CFG_CHANNEL_LIST>*/
[!VAR "Index" = "0"!][!LOOP "as:modconf('Gpt')[1]/GptChannelConfigSet/*[1]/GptChannelConfiguration/*"!]
#define  [!"@name"!]       [!"num:i($Index)"!]u [!VAR "Index" = "$Index + 1"!][!ENDLOOP!]
/*<GPT_CFG_CHANNEL_LIST>*/





/*Macros for Interrupt Types*/
#define GPT_ISR_CAT1  0U
#define GPT_ISR_CAT2  1U
#define GPT_ISR_VOID  2U

/*********************************************************************************************************************
 * Exported Type Declarations
 *********************************************************************************************************************/
/* notification callback function pointer */
typedef void (*Gpt_NotifyType)(void);

/*type for specifying source clock selection */
typedef uint32 Gpt_ClockSourceType;

/*type describing the Gpt channel*/
typedef uint32 Gpt_ChannelType;

/* Configuration per channel*/
typedef struct
{
	Gpt_ChannelType   ChannelId;
	uint32            ChannelMode;            /* Channel mode */
	float32           GptChannelTickFrequency;/*Channel Frequency*/
	uint32            GptChannelTickValueMax; /*Channel Tick Max Value*/
	boolean           GptEnableWakeup;
	VAR (Gpt_NotifyType, GPT_APPL_CODE) Notification_pt; /* Pointer to notification function */
	Gpt_ClockSourceType GptChannelClksrcRef;        /* Channel clock source */
	uint8 GptWakeupSourceRef;
}Gpt_ChannelConfigType;

/* global configuration of the driver */
typedef struct
{
    P2CONST(Gpt_ChannelConfigType,
            AUTOMATIC,
            GPT_CONST) ChannelConfig_pt;    /* Pointer to Channel list*/
    uint32             ChannelCount;        /* Number of channels configured */
} Gpt_ConfigType;

/**********************************************************************************************************************
 *  Exported Object Declarations
 **********************************************************************************************************************/
/*Extern declaration of GptChannelConfigSet*/
[!LOOP "as:modconf('Gpt')[1]/GptChannelConfigSet/*"!]
extern CONST(Gpt_ConfigType, GPT_PBCFG) [!"@name"!];
[!ENDLOOP!]
/**********************************************************************************************************************
 *  GLOBAL CONSTANT MACROS
 *********************************************************************************************************************/
/* ---- Development Error Switch------------ ----------------------------------*/
#define GPT_DEV_ERROR_DETECT              [!IF "as:modconf('Gpt')[1]/GptDriverConfiguration/GptDevErrorDetect"!](STD_ON)[!ELSE!](STD_OFF)[!ENDIF!]
#define GPT_REPORT_WAKEUP_SOURCE          [!IF "as:modconf('Gpt')[1]/GptDriverConfiguration/GptReportWakeupSource"!](STD_ON)[!ELSE!](STD_OFF)[!ENDIF!]
#define GPT_CFG_ISR_TYPE                  [!"as:modconf('Gpt')[1]/GptDriverConfiguration/GptTypeofInterruptFunction"!]


#if (STD_ON == GPT_DEV_ERROR_DETECT)
    /* Function for errorhook */
    #define Gpt_Errorhook(Gpt_FunctionId, Gpt_ErrorCode) Det_ReportError((GPT_MODULE_ID), (0u), (Gpt_FunctionId), (Gpt_ErrorCode))
#else
    #define Gpt_Errorhook(Gpt_FunctionId, Gpt_ErrorCode)
#endif  /* (STD_ON == GPT_DEV_ERROR_DETECT) */

#if (STD_ON == GPT_DEV_ERROR_DETECT)
    /* Include-File, which contains Errorhook-Function */
    #include "Det.h"
#endif  /* (STD_ON == GPT_DEV_ERROR_DETECT) */

#ifndef GPT_PRIVATE_H
#define GPT_PRIVATE_H

/*<GPT_ISR_INCLUDE_IRQ>*/
#include "SchM_Gpt.h"
#include "Os.h"
/*</GPT_ISR_INCLUDE_IRQ>*/

#endif  /* GPT_PRIVATE_H */

#endif /* #if (!defined GPT_CFG_H) */
/**********************************************************************************************************************
 *  End of File: Gpt_Cfg.h
 *********************************************************************************************************************/