/* ======================================================================
 *   Copyright (C) 2022 Texas Instruments Incorporated
 *
 *   All rights reserved. Property of Texas Instruments Incorporated.
 *   Restricted rights to use, duplicate or disclose this code are
 *   granted through contract.
 *
 *   The program may not be used without the written permission
 *   of Texas Instruments Incorporated or against the terms and conditions
 *   stipulated in the agreement under which this program has been
 *   supplied.
 * ==================================================================== */

/**
 *  \file     GptApp.c
 *
 *  \brief    This file contains the GPT test example
 *
 */

/* ========================================================================== */
/*                             Include Files                                  */
/* ========================================================================== */

/*LDRA_NOANALYSIS*/
#include "string.h"
#include "Det.h"
#include "Dem.h"
/*LDRA_ANALYSIS*/
#include "assert.h"
/*LDRA_NOANALYSIS*/
#include "Std_Types.h"
#include "SchM_CDD_I2C.h"
#include "SchM_Port.h"

/*LDRA_ANALYSIS*/
#include "Cdd_I2c_Cfg.h"
#include "Cdd_I2c.h"
#include "hw_types.h"
#include "Mcu.h"
#include "Mcu_Cfg.h"
#include "Port_Cfg.h"
#include "Port.h"


#include "app_utils.h"
#include "sys_common.h"

#include "sys_vim.h"

/* For PRCM base addresses */
#include "soc.h"

/* ========================================================================== */
/*                           Macros & Typedefs                                */
/* ========================================================================== */

#define APP_NAME                        "CDD_I2C_APP"
#define ARRAYSIZE(x)                    (sizeof ((x)) / sizeof ((x)[0]))

#define I2C_VERSION_ID		0x00U
#define I2C_INIT_ID			0x01U
#define	I2C_SETUPEBTX_ID	0x02U
#define	I2C_SETUPEBRX_ID	0x03U
#define I2C_SETUPEBDYNAMICTX_ID 0x4U
#define	I2C_SETUPEBDYNAMICRX_ID 0x05
#define	I2C_ASYNCTRANSMIT_ID 0x06
#define	I2C_MAINFUNCTION_ID 0x07
#define	I2C_DEINIT_ID 0x08
#define I2C_GETSTATUS_ID 0x09U
#define	I2C_GETRESULT_ID 0x0A
#define	I2C_GETSEQUENCERESULT_ID 0x0B
#define	I2C_CANCEL_ID 0x0C

#define APP_PERFORMANCE_MODE   STD_OFF

/* ========================================================================== */
/*                         Structures and Enums                               */
/* ========================================================================== */

/*None*/

/* ========================================================================== */
/*                 Internal Function Declarations                             */
/* ========================================================================== */

void _enable_interrupt_(void);
void StartCyclecount(void);
static void CDD_I2CApp_platformInit(void);
//static void CDD_I2CApp_interruptConfig(uint32 channelId);
static void CDD_I2CApp_interruptInit(void);
static void CDD_I2CApp_interruptDisable(uint32 channelId);
#if (STD_ON == APP_PERFORMANCE_MODE)
static void I2cExample_PerformanceTest();
#endif
static void CDD_I2CApp_mainTest(void);
typedef void (*CDD_I2CAppFxn_t)(void);
uint32 Performance_Result[30];
void Stop_Timer(uint8 Api_Id);
void Start_Timer(void);

/* ========================================================================== */
/*                            Global Variables                                */
/* ========================================================================== */


extern CONST(I2C_ConfigType, I2C_CONFIG_DATA) I2cConfigSets[2];
//extern struct I2C_ConfigType * CDD_I2CChannelConfigSet_0;
#if (STD_OFF == MCU_NO_PLL)
extern CONST(Mcu_ConfigType, MCU_PBCFG) McuModuleConfiguration_0;
#endif
volatile uint32                       notifyRecvFlag = 0xFFFF;
uint8                        validWakeupSrcDetectedFlag = (uint8) FALSE;

Mcu_ClockConfigType CDD_I2CMcu_ClkConfig[] =
{
   [0] = 
   { .Mcu_InitCfg       = TRUE,
    .Mcu_ClockModuleId = MCU_CLKSRC_MODULE_ID_I2C,   
    .Mcu_ClockSourceId = MCU_CLKSRC_3,    
    .Mcu_ClockDiv = 7U // Source = Sysclk ie 192MHz, so (192/(7+1) = 24MHz with 200MHz clk)
   },
   [1] = 
    {
        .Mcu_ClockModuleId = MCU_CLKSRC_MODULE_ID_RTI0,
        .Mcu_ClockSourceId = MCU_CLKSRC_2,
        .Mcu_ClockDiv = 0,
        .Mcu_InitCfg  = TRUE,
    },
    [2] =
    {
        .Mcu_ClockModuleId = MCU_CLKSRC_MODULE_ID_RTI1,
        .Mcu_ClockSourceId = MCU_CLKSRC_2,
        .Mcu_ClockDiv = 0,
        .Mcu_InitCfg  = TRUE,
    },
    [3] =
    {
        .Mcu_ClockModuleId = MCU_CLKSRC_MODULE_ID_RTI2,
        .Mcu_ClockSourceId = MCU_CLKSRC_2,
        .Mcu_ClockDiv = 0,
        .Mcu_InitCfg  = TRUE,
    },
    [4] =
    {
        .Mcu_ClockModuleId = MCU_CLKSRC_MODULE_ID_RTI3,
        .Mcu_ClockSourceId = MCU_CLKSRC_2,
        .Mcu_ClockDiv = 0,
        .Mcu_InitCfg  = TRUE,
    },
	[5] =
    {
        .Mcu_ClockModuleId = MCU_CLKSRC_MODULE_ID_SCI0,
        .Mcu_ClockSourceId = MCU_CLKSRC_3,
        .Mcu_ClockDiv = 3,
        .Mcu_InitCfg  = TRUE,
    }
	
};

static Mcu_ConfigType        gCDD_I2CAppMcuConfig =
{
    .Mcu_ResetMode           = MCU_PERFORM_RESET_MODE_WARM,
    .Mcu_ConfigRamSection    = (Mcu_RamConfigPtrType) NULL_PTR,
    .Mcu_NumberOfRamSectors  = 0,
    .Mcu_ClockConfig         = (Mcu_ClockConfigPtrType)&CDD_I2CMcu_ClkConfig,
    .Mcu_NumberOfClockConfig = ARRAYSIZE(CDD_I2CMcu_ClkConfig),
};

uint16 I2c_GaaMemAddrBuffer[2] = {0x0002};

uint16 const I2c_GaaTxDataBuffer[32] = {0x01, 0x02,1,2,3,4,5,6,7,8};

uint16 const I2c_GaaTxDataBuffer1[32] = {0x02, 0x05,9,10,11,12,13,14,15,16};

uint16 const I2c_GaaTxDataBuffer2[32] = {0x03, 0x08,17,18,19,20,21,22,23,24};

uint16 const I2c_GaaTxDataBuffer3[32] = {0x04, 0x0B,25,26,27,28,29,30,31,32};

uint16 I2c_GaaRxDataBuffer[32] = {0x01,0x02};

uint16 I2c_GaaRxDataBuffer1[32] = {0x02, 0x05};

uint16 I2c_GaaRxDataBuffer2[32] = {0x03, 0x08};

uint16 I2c_GaaRxDataBuffer3[32] = {0x04, 0x0B};

uint32 						frc;//,mask = 0x00000000U;

CDD_I2CAppFxn_t                  CDD_I2CAppFxnTbl[] =
{
    &CDD_I2CApp_mainTest,
#if (STD_ON == APP_PERFORMANCE_MODE)
	&I2cExample_PerformanceTest
#endif
};

/* ========================================================================== */
/*                          Function Definitions                              */
/* ========================================================================== */

#if defined CLANG
void  SchM_Enter_Mcu_MCU_EXCLUSIVE_AREA_0()
{
    AppUtils_SchM_Enter_EXCLUSIVE_AREA_0();
}

void   SchM_Exit_Mcu_MCU_EXCLUSIVE_AREA_0()
{
     AppUtils_SchM_Exit_EXCLUSIVE_AREA_0();
}
#endif

int main(void)
{
    volatile uint32 i;
    AppUtils_defaultInit();

    /*Enable Domain clocks*/
    CDD_I2CApp_platformInit();
    CDD_I2CApp_interruptInit();


    AppUtils_printf(APP_NAME ": Sample Application - STARTS !!!\n\r");
    for (i = 0U; i < ARRAYSIZE(CDD_I2CAppFxnTbl); i++)
    {
        CDD_I2CAppFxnTbl[i]();
    }
    AppUtils_printf(APP_NAME ": Sample Application - DONE !!!\n\r");
    
    while(1);
    return 0;
}

static void CDD_I2CApp_mainTest(void)
{
    I2C_ConfigType   		*pChannelCfg;
    I2C_ChannelType         ChannelId;
	VAR(Std_ReturnType, AUTOMATIC)LddRetVal = E_NOT_OK;

	
#if (I2C_VERSION_INFO_API == STD_ON)
    Std_VersionInfoType    versioninfo;
#endif  /* #if (I2C_VERSION_INFO_API == STD_ON) */

#if (I2C_VERSION_INFO_API == STD_ON)
    /* Get and print version */
    I2c_GetVersionInfo(&versioninfo);
    AppUtils_printf(" \n\r");
    AppUtils_printf("CDD I2C MCAL Version Info\n\r");
    AppUtils_printf("---------------------\n\r");
    AppUtils_printf("Vendor ID           : %d\n\r", versioninfo.vendorID);
    AppUtils_printf("Module ID           : %d\n\r", versioninfo.moduleID);
    AppUtils_printf("SW Major Version    : %d\n\r", versioninfo.sw_major_version);
    AppUtils_printf("SW Minor Version    : %d\n\r", versioninfo.sw_minor_version);
    AppUtils_printf("SW Patch Version    : %d\n\r", versioninfo.sw_patch_version);
    AppUtils_printf(" \n\r");
#endif

    AppUtils_printf(
        "----------------------------------------------------------------------------------\n\r");
    AppUtils_printf(
        "----------------------------------------------------------------------------------\n\r");

    AppUtils_printf("Initializing I2C\n\r");
    I2c_Init(&I2cConfigSets[0]);
	
	LddRetVal = I2c_SetupEB(0, I2c_GaaTxDataBuffer, NULL_PTR,10);
	
	LddRetVal = I2c_SetupEB(1, I2c_GaaTxDataBuffer1, NULL_PTR,10);

	LddRetVal = I2c_SetupEB(2,NULL_PTR, I2c_GaaRxDataBuffer, 10);	
	
	LddRetVal = I2c_SetupEB(3,NULL_PTR, I2c_GaaRxDataBuffer1, 10);	
		
	if(E_OK == LddRetVal)
	{
	  LddRetVal = I2c_AsyncTransmit(1);
	  I2c_MainFunction();
	}
	AppUtils_delay(50U);
	if(E_OK == LddRetVal)
	{
	  LddRetVal = I2c_AsyncTransmit(2);
	  I2c_MainFunction();
	}
	AppUtils_delay(50U);
	if(E_OK == LddRetVal)
	{
	  LddRetVal = I2c_AsyncTransmit(3);
	  I2c_MainFunction();
	}
	AppUtils_delay(50U);
	I2c_DeInit(&I2cConfigSets[0]);
	
    AppUtils_printf("CDD I2C Test Passed for configuration!!\n\r");
    AppUtils_printf("CDD I2C Test Completed, njoy life!!!\n\r");
}

static void CDD_I2CApp_platformInit(void)
{
    uint16 mss_uart_tx_pin, mss_uart_rx_pin;
    uint32 sys_clk_freq_vclk_const;

    #if (STD_OFF == MCU_NO_PLL)
    /* MCU PLL Config */
    gCDD_I2CAppMcuConfig.Mcu_PllConfig = McuModuleConfiguration_0.Mcu_PllConfig;
    gCDD_I2CAppMcuConfig.Mcu_PllSourceId = McuModuleConfiguration_0.Mcu_PllSourceId;
    #endif

    Mcu_Init(&gCDD_I2CAppMcuConfig);
    Port_Init(PortConfigSet_0_pt);
    mss_uart_tx_pin = 13;
    mss_uart_rx_pin = 14;
    
    /* Set up the pinmux for UART tx */
    Port_SetPinMode(mss_uart_tx_pin, PORT_PIN_MODE_LIN0);

    /* Set up the pinmux for UART rx */
    Port_SetPinMode(mss_uart_rx_pin, PORT_PIN_MODE_LIN0);
    Port_SetPinDirection(mss_uart_rx_pin, PORT_PIN_IN);

    #if (STD_OFF == MCU_NO_PLL)
    if(McuModuleConfiguration_0.Mcu_PllSourceId == MCU_CLKSRC_DPLL)
    {
        sys_clk_freq_vclk_const = (McuModuleConfiguration_0.Mcu_PllConfig[MCU_CLKSRC_DPLL].Mcu_PllClk1.MCU_PLL_HSDIV2 / (2e6)) * 30;
    }
    else
    {
        sys_clk_freq_vclk_const = (McuModuleConfiguration_0.Mcu_PllConfig[MCU_CLKSRC_APLL].Mcu_PllClk1.MCU_PLL_HSDIV0 / (2e6)) * 30;
    }
    Enable_Uart();
    #else
    Enable_Uart();
    #endif

    return;
}

#if (STD_ON == APP_PERFORMANCE_MODE)
static void I2cExample_PerformanceTest()
{
    char           option;
    boolean quit_opt = 0;
    uint32 cntr_cnt;//,mask = 0x00000000U;
    const I2C_ConfigType *I2c_ConfigPtr;
	Std_VersionInfoType I2c_Version;
    uint8 Channel = 0;
	

    I2c_ConfigPtr = &I2cConfigSets[0];
	
	Start_Timer();
	I2c_GetVersionInfo(&I2c_Version);
	Stop_Timer(I2C_VERSION_ID);
	AppUtils_printf("I2C_VERSION_ID           : %d\n\r", Performance_Result[I2C_VERSION_ID]);
	
	Start_Timer();
	I2c_Init(I2c_ConfigPtr);
	Stop_Timer(I2C_INIT_ID);
	AppUtils_printf("I2C_INIT_ID           : %d\n\r", Performance_Result[I2C_INIT_ID]);
	
	Start_Timer();
	I2c_SetupEB(Channel,I2c_GaaTxDataBuffer, NULL_PTR, 10);
	Stop_Timer(I2C_SETUPEBTX_ID);
	AppUtils_printf("I2C_SETUPEBTX_ID           : %d\n\r", Performance_Result[I2C_SETUPEBTX_ID]);
	
	Start_Timer();
	I2c_SetupEB(Channel,I2c_GaaTxDataBuffer, NULL_PTR, 10);
	Stop_Timer(I2C_SETUPEBTX_ID);
	AppUtils_printf("I2C_SETUPEBTX_ID           : %d\n\r", Performance_Result[I2C_SETUPEBTX_ID]);
	
	Start_Timer();
	I2c_SetupEB(Channel,NULL_PTR, I2c_GaaRxDataBuffer, 10);
	Stop_Timer(I2C_SETUPEBRX_ID);
	AppUtils_printf("I2C_SETUPEBRX_ID           : %d\n\r", Performance_Result[I2C_SETUPEBRX_ID]);
	
	Start_Timer();
	I2c_SetupEBDynamic(Channel,0x60, I2c_GaaTxDataBuffer, NULL_PTR, 10);
	Stop_Timer(I2C_SETUPEBDYNAMICTX_ID);
	AppUtils_printf("I2C_SETUPEBDYNAMICTX_ID           : %d\n\r", Performance_Result[I2C_SETUPEBDYNAMICTX_ID]);
	
	Start_Timer();
	I2c_SetupEBDynamic(Channel,0x60, NULL_PTR, I2c_GaaRxDataBuffer, 10);
	Stop_Timer(I2C_SETUPEBDYNAMICRX_ID);
	AppUtils_printf("I2C_SETUPEBDYNAMICRX_ID           : %d\n\r", Performance_Result[I2C_SETUPEBDYNAMICRX_ID]);
	
	Start_Timer();
	I2c_AsyncTransmit(1);
	Stop_Timer(I2C_ASYNCTRANSMIT_ID);
	AppUtils_printf("I2C_ASYNCTRANSMIT_ID           : %d\n\r", Performance_Result[I2C_ASYNCTRANSMIT_ID]);
	
	Start_Timer();
	I2c_GetStatus();
	Stop_Timer(I2C_GETSTATUS_ID);	
	AppUtils_printf("I2C_GETSTATUS_ID           : %d\n\r", Performance_Result[I2C_GETSTATUS_ID]);
	
	Start_Timer();
	I2c_GetResult(0);
	Stop_Timer(I2C_GETRESULT_ID);
	AppUtils_printf("I2C_GETRESULT_ID           : %d\n\r", Performance_Result[I2C_GETRESULT_ID]);
	
	Start_Timer();
	I2c_GetSequenceResult(1);
	Stop_Timer(I2C_GETSEQUENCERESULT_ID);
	AppUtils_printf("I2C_GETSEQUENCERESULT_ID           : %d\n\r", Performance_Result[I2C_GETSEQUENCERESULT_ID]);
	
	Start_Timer();
	I2c_Cancel(2);
	Stop_Timer(I2C_CANCEL_ID);
	AppUtils_printf("I2C_CANCEL_ID           : %d\n\r", Performance_Result[I2C_CANCEL_ID]);
	
	Start_Timer();
	I2c_MainFunction();
	Stop_Timer(I2C_MAINFUNCTION_ID);
	AppUtils_printf("I2C_MAINFUNCTION_ID           : %d\n\r", Performance_Result[I2C_MAINFUNCTION_ID]);
  
	Start_Timer();
	I2c_DeInit(I2c_ConfigPtr);
	Stop_Timer(I2C_DEINIT_ID);
	AppUtils_printf("I2C_DEINIT_ID           : %d\n\r", Performance_Result[I2C_DEINIT_ID]);
}
#endif
/* static void CDD_I2CApp_interruptConfig(uint32 channelId)
{
    Vim_IntCfg intCfg;
    intCfg.map = VIM_INTTYPE_IRQ;
    intCfg.type = VIM_INTTRIGTYPE_LEVEL;
    if (channelId == 0){
        intCfg.intNum = 84U;
        intCfg.handler = Gpt_Ch0Isr;
        intCfg.priority = VIM_PRIORITY_10;
        vimRegisterInterrupt(&intCfg);
    }else if (channelId == 1){
        intCfg.intNum = 85U;
        intCfg.priority = VIM_PRIORITY_11;
        intCfg.handler = Gpt_Ch1Isr;
        vimRegisterInterrupt(&intCfg);
    }else if(channelId == 2){
        intCfg.intNum = 86U;
        intCfg.priority = VIM_PRIORITY_12;
        intCfg.handler = Gpt_Ch2Isr;
        vimRegisterInterrupt(&intCfg);
    }else if(channelId == 3){
        intCfg.intNum = 87U;
        intCfg.priority = VIM_PRIORITY_13;
        intCfg.handler = Gpt_Ch3Isr;
        vimRegisterInterrupt(&intCfg);
    }else if(channelId == 4){
        intCfg.intNum = 91U;
        intCfg.priority = VIM_PRIORITY_14;
        intCfg.handler = Gpt_Ch4Isr;
        vimRegisterInterrupt(&intCfg);
    }else if(channelId == 5){
        intCfg.intNum = 92U;
        intCfg.priority = VIM_PRIORITY_15;
        intCfg.handler = Gpt_Ch5Isr;
        vimRegisterInterrupt(&intCfg);
    }else if(channelId == 6){
        intCfg.intNum = 93U;
        intCfg.priority = VIM_PRIORITY_16;
        intCfg.handler = Gpt_Ch6Isr;
        vimRegisterInterrupt(&intCfg);
    }else if(channelId == 7){
        intCfg.intNum = 94U;
        intCfg.priority = VIM_PRIORITY_17;
        intCfg.handler = Gpt_Ch7Isr;
        vimRegisterInterrupt(&intCfg);
    }else if(channelId == 8){
        intCfg.intNum = 98U;
        intCfg.priority = VIM_PRIORITY_18;
        intCfg.handler = Gpt_Ch8Isr;
        vimRegisterInterrupt(&intCfg);
    }else if(channelId == 9){
        intCfg.intNum = 99U;
        intCfg.priority = VIM_PRIORITY_19;
        intCfg.handler = Gpt_Ch9Isr;
        vimRegisterInterrupt(&intCfg);
    }else if(channelId == 10){
        intCfg.intNum = 100U;
        intCfg.priority = VIM_PRIORITY_20;
        intCfg.handler = Gpt_Ch10Isr;
        vimRegisterInterrupt(&intCfg);
    }else if(channelId == 11){
        intCfg.intNum = 101U;
        intCfg.priority = VIM_PRIORITY_21;
        intCfg.handler = Gpt_Ch11Isr;
        vimRegisterInterrupt(&intCfg);
    }else if(channelId == 12){
        intCfg.intNum = 105U;
        intCfg.priority = VIM_PRIORITY_22;
        intCfg.handler = Gpt_Ch12Isr;
        vimRegisterInterrupt(&intCfg);
    }else if(channelId == 13){
        intCfg.intNum = 106U;
        intCfg.priority = VIM_PRIORITY_23;
        intCfg.handler = Gpt_Ch13Isr;
        vimRegisterInterrupt(&intCfg);
    }else if(channelId == 14){
        intCfg.intNum = 107U;
        intCfg.priority = VIM_PRIORITY_24;
        intCfg.handler = Gpt_Ch14Isr;
        vimRegisterInterrupt(&intCfg);
    }else if(channelId == 15){
        intCfg.intNum = 108U;
        intCfg.priority = VIM_PRIORITY_25;
        intCfg.handler = Gpt_Ch15Isr;
        vimRegisterInterrupt(&intCfg);
    }
} */

static void CDD_I2CApp_interruptDisable(uint32 channelId)
{
    switch(channelId)
    {
        case 0: vimDisableInterrupt(84U);
                break; 
        case 1: vimDisableInterrupt(85U);
                break;
        case 2: vimDisableInterrupt(86U);
                break;
        case 3: vimDisableInterrupt(87U);
                break;
        case 4: vimDisableInterrupt(91U);
                break;
        case 5: vimDisableInterrupt(92U);
                break;
        case 6: vimDisableInterrupt(93U);
                break;
        case 7: vimDisableInterrupt(94U);
                break;
        case 8: vimDisableInterrupt(98U);
                break;
        case 9: vimDisableInterrupt(99U);
                break;
        case 10: vimDisableInterrupt(100U);
                break;
        case 11: vimDisableInterrupt(101U);
                break;
		case 12: vimDisableInterrupt(105U);
                break;
        case 13: vimDisableInterrupt(106U);
                break;
        case 14: vimDisableInterrupt(107U);
                break;
        case 15: vimDisableInterrupt(108U);
                break;
    }
#ifdef GPTTIMER_QT 
        AppUtils_delay(2U);
#else         
        AppUtils_delay(20U);
#endif                 
    return;

}

void Start_Timer(void)
{
	
      HW_WR_REG32(0x52180000, 0x00000000);//GCTRL
	  HW_WR_REG32(0x52180008, 0x00000000);//Capture Control
	  HW_WR_REG32(0x5218000C, 0x00000000);//COMP CTRL
	  HW_WR_REG32(0x52180010, 0x00000000);//FRC0
	  HW_WR_REG32(0x52180014, 0x00000000);//UP Counter
	  HW_WR_REG32(0x52180018, 0x00000001);//Compare Up Counter
	  HW_WR_REG32(0x52180084, 0x00070F0F);//Clear Interrupt
	  HW_WR_REG32(0x52180000, 0x00000001);//GCTRL Start Timer
	  
}

void Stop_Timer(uint8 Api_Id)
{
		  HW_WR_REG32(0x52180000, 0x00000000);//GCTRL Stop Timer
          frc = HW_RD_REG32(0x52180010);
		  Performance_Result[Api_Id] = frc;
}

static void CDD_I2CApp_interruptInit(void)
{
    vimInit();
}
uint8 Intc_status;

void SchM_Enter_CDD_I2C_EXCLUSIVE_AREA_0(void)
{
    AppUtils_SchM_Enter_EXCLUSIVE_AREA_0();

}

void SchM_Exit_CDD_I2C_EXCLUSIVE_AREA_0(void)
{
    AppUtils_SchM_Exit_EXCLUSIVE_AREA_0();

}

void  SchM_Enter_Port_PORT_EXCLUSIVE_AREA_0()
{
    AppUtils_SchM_Enter_EXCLUSIVE_AREA_0();

}

void   SchM_Exit_Port_PORT_EXCLUSIVE_AREA_0()
{

  AppUtils_SchM_Exit_EXCLUSIVE_AREA_0();

}

void Dem_ReportErrorStatus(Dem_EventIdType     eventId,
                           Dem_EventStatusType eventStatus)
{
    if (DEM_EVENT_STATUS_FAILED == eventStatus)
    {
        assert(FALSE);
    }
}

Std_ReturnType Det_ReportError(uint16 ModuleId,
                               uint8  InstanceId,
                               uint8  ApiId,
                               uint8  ErrorId)
{
    AppUtils_printf(APP_NAME "Module ID: %d \t Instance ID: %d\t ApiID: %d\t ErrorID: %d \n",ModuleId,InstanceId,ApiId,ErrorId);
    return (E_OK);
	
}

#if ((STD_ON == GPT_CFG_WAKEUP_FUNCTIONALITY_API) && (STD_ON == \
                                                      GPT_CFG_REPORT_WAKEUP_SOURCE))
void EcuM_CheckWakeup(EcuM_WakeupSourceType wakeupSource)
{
    AppUtils_printf(
        APP_NAME
        ": GPT Test Wakeup event received for wakeupSource =%d :)!!!\n\r",
        wakeupSource);
    validWakeupSrcDetectedFlag = (uint8) TRUE;
}

void EcuM_SetWakeupEvent(EcuM_WakeupSourceType chlWakeupRef)
{
    /* This function will be called after call to Gpt_CheckWakeup.
     * Gpt_CheckWakeup will call this function if wakeup source passed to it is
     * valid source */
    AppUtils_printf(
        APP_NAME
        ": GPT Test Wakeup event set for wakeupSource =%d :)!!!\n\r",
        chlWakeupRef);
}



#endif


/*EoF*/
