/**********************************************************************************************************************
 *  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:  Icu.c
 *      Project:  Tms570_AutosarIcuDriver
 *       Module:  ICU
 *    Generator:  -
 *
 *  Description:  The ICU driver is a module using the input capture unit (ICU) for demodulation of a PWM signal,
 *                counting pulses, measuring of frequency and duty cycle, generating simple interrupts and wake-up
 *                interrupts.
 *
 *                The ICU driver provides services for
 *                -    Signal edge notification
 *                -    Controlling wake-up interrupts
 *                -    Periodic signal time measurement
 *                -    Edge timestamping, usable for the acquisition of non-periodic signals
 *                -    Edge counting
 *
 *                This module works on pins and ports which are configured by the PORT driver for this purpose. For
 *                this reason there is no configuration and initialization of this port structure in the ICU Driver.
 *---------------------------------------------------------------------------------------------------------------------
 * Author:  Vineeth Thomas Alex
 *---------------------------------------------------------------------------------------------------------------------
 * Revision History
 *---------------------------------------------------------------------------------------------------------------------
 * Version     Date           Author                   Change ID          Description
 *---------------------------------------------------------------------------------------------------------------------
 * 02.21.00    30Sept2014     Vineeth Thomas Alex      SDOCM00113121      Initial version adapted from TMS570LS3137
 *                                                                        Code state pragma added to API's in ISR
 * 02.21.01    16Mar2016      Enrique Lizarraga        SDOCM00121723      Rename AUTOSAR Release Version macros
 * 02.30.00    01Dec2016      Sudhakar Singh           None               Update version info
 * 05.30.00    15Mar2017      Sudhakar Singh           SDOCM00122834      Version supports TMS570LSxx Family of Devices.
 *********************************************************************************************************************/

#define ICU_SOURCE

/**********************************************************************************************************************
 *  INCLUDES
 *********************************************************************************************************************/
/* SourceId : ICU_SourceId_008 */
/* DesignId : ICU_DesignId_05  */
/* Requirements : AR_ICU_SR2, AR_ICU_SR3, AR_ICU_SR4, AR_ICU_SR5, AR_ICU_SR6, AR_ICU_SR7, AR_ICU_SR8, AR_ICU_SR9,
 * AR_ICU_SR10, AR_ICU_SR11, AR_ICU_SR12 */
#include "Icu.h"
#include "Icu_Irq.h"
#include "Icu_Cbk.h"
#include "Icu_Het.h"
#if (ICU_DEV_ERROR_DETECT == STD_ON)
	/* Include-File, which contains Errorhook-Function */
	#include "Det.h"
#endif  /* (ICU_DEV_ERROR_DETECT == STD_ON) */
#include "SchM_Icu.h"

/**********************************************************************************************************************
 *  VERSION CHECK
 *********************************************************************************************************************/
#define ICU_SW_C_MAJOR_VERSION               (5U)
#define ICU_SW_C_MINOR_VERSION               (30U)
#define ICU_SW_C_PATCH_VERSION               (0U)
 
 /* vendor specific version information is BCD coded */
#if (  (ICU_SW_MAJOR_VERSION != ICU_SW_C_MAJOR_VERSION) \
    || (ICU_SW_MINOR_VERSION != ICU_SW_C_MINOR_VERSION) \
    || (ICU_SW_PATCH_VERSION != ICU_SW_C_PATCH_VERSION) )
#error "Vendor specific version numbers of Icu.c and Icu.h are inconsistent" */
#endif

/* AUTOSAR version information check has to match definition in header file */
#if (  (ICU_AR_RELEASE_MAJOR_VERSION    != (4U)) \
    || (ICU_AR_RELEASE_MINOR_VERSION    != (0U)) \
    || (ICU_AR_RELEASE_REVISION_VERSION != (3U)) )
#error "AUTOSAR Specification Version numbers of Icu.c and Icu.h are inconsistent!"
#endif

/* versions of all included header files shall be checked, configuration is just an example */
#if (  (ICU_CFG_MAJOR_VERSION != ICU_SW_C_MAJOR_VERSION) \
    || (ICU_CFG_MINOR_VERSION != ICU_SW_C_MINOR_VERSION) )
#error "Version numbers of Icu.c and Icu_Cfg.h are inconsistent!"
#endif

/**********************************************************************************************************************
 *  LOCAL CONSTANT MACROS
 **********************************************************************************************************************/

#define ICU_MAXNUMBEROFCHANNELS     (16U)
#define ICU_OVERFLOW_IRQ            (35U)


/**********************************************************************************************************************
 *  LOCAL FUNCTION MACROS
 *********************************************************************************************************************/
#if ( ICU_DEV_ERROR_DETECT == STD_ON )
#define Icu_Errorhook(Icu_FunctionId, Icu_ErrorCode) \
    Det_ReportError((ICU_MODULE_ID),(0U),(Icu_FunctionId),(Icu_ErrorCode))
#else
#define Icu_Errorhook(Icu_FunctionId, Icu_ErrorCode)
#endif


#define Icu_GlobalSuspend()  /*<ICU_GLOBAL_SUSPEND/>*/ SchM_Enter_Icu_ICU_EXCLUSIVE_AREA_0()
#define Icu_GlobalRestore()  /*<ICU_GLOBAL_RESTORE/>*/ SchM_Exit_Icu_ICU_EXCLUSIVE_AREA_0()


/* ===== REGISTER DEFINITIONS ======================================================================================= */


/* Offset Level 1 Register */
#define ICU_HETOFF1(BaseAddress)         (*((volatile uint32 *)((BaseAddress) + 0x0CU)))
/* Offset Level 2 Register */
#define ICU_HETOFF2(BaseAddress)         (*((volatile uint32 *)((BaseAddress) + 0x10U)))
/* Interrupt Enable Set Register */
#define ICU_HETINTENAS(BaseAddress)      (*((volatile uint32 *)((BaseAddress) + 0x14U)))
/* Interrupt Enable Clear Register */
#define ICU_HETINTENAC(BaseAddress)      (*((volatile uint32 *)((BaseAddress) + 0x18U)))
/* Interrupt Flag Register */
#define ICU_HETFLG(BaseAddress)          (*((volatile uint32 *)((BaseAddress) + 0x28U)))


/**********************************************************************************************************************
 *  LOCAL DATA TYPES AND STRUCTURES
 *********************************************************************************************************************/
/*SAFETYMCUSW 37 S MR:16.3 <APPROVED> "Irq function pointer" */
typedef void (*Icu_FctPtrType)(uint32 param1);

#if ( ICU_TIMESTAMP_API == STD_ON )
  /* Type to store information about the timestamping setting for a channel */
  typedef struct
  {
    Icu_IndexType BufferIndex;      /* Stores next value to be written */
    Icu_IndexType BufferSize;       /* Size of the user defined buffer */
    Icu_IndexType NotifyInterval;   /* Notify interval */
    Icu_IndexType NotifyCnt;        /* Counter for notificaton control */
    P2VAR(Icu_ValueType, ICU_VAR_FAST, ICU_APPL_DATA) BufferPtr;
  }Icu_TsArrayType;
#endif

typedef struct
{
    Het_Icu_InstructionType Instruction[47U];
}Icu_RamType;


/**********************************************************************************************************************
 *  LOCAL DATA PROTOTYPES
 *********************************************************************************************************************/

/**********************************************************************************************************************
 *  GLOBAL DATA
 *********************************************************************************************************************/


/* ===== UINT8 VARIABLES =================================================== */

/* ----- VAR_NO_INIT_8BIT ----- */
/*SAFETYMCUSW 580 S MR:1.1 <APPROVED> "Reason - Memory mapping requires this syntax" */
#define ICU_START_SEC_VAR_NO_INIT_8
/*SAFETYMCUSW 338 S MR:19.1 <APPROVED> "Memory mapping requires this syntax" */
#include "MemMap.h"

    static VAR(uint8, ICU_VAR) Icu_NoOfChannels_u8;                         /* Number of configured channels */
#if(ICU_TIMESTAMP_API||ICU_SIGNAL_MEASUREMENT_API||ICU_EDGE_DETECTION_API)
    static VAR(uint8, ICU_VAR)
        Icu_NotificationConf_au8[ICU_MAXNUMBEROFCHANNELS];                  /* Notification Configuration */
#endif
    static VAR(uint8, ICU_VAR)
        Icu_ChlRunState_au8[ICU_MAXNUMBEROFCHANNELS];                       /* Channel Run States */


#if(ICU_GET_INPUT_STATE_API == STD_ON)
        static VAR(Icu_InputStateType, ICU_VAR)
            Icu_ChlInputState_at[ICU_MAXNUMBEROFCHANNELS];                     /* Channel Input State (Active/Idle) */
#endif /* (ICU_GET_INPUT_STATE_API == STD_ON) */

#if(ICU_WAKEUP_FUNCTIONALITY_API == STD_ON)
        static VAR(uint8, ICU_VAR)
            Icu_WakeupConf_au8[ICU_MAXNUMBEROFCHANNELS];                    /* Wake-up Configuration */
#endif /* (ICU_WAKEUP_FUNCTIONALITY_API == STD_ON) */

/*SAFETYMCUSW 580 S MR:1.1 <APPROVED> "Reason - Memory mapping requires this syntax" */
#define ICU_STOP_SEC_VAR_NO_INIT_8
/*SAFETYMCUSW 338 S MR:19.1 <APPROVED> "Reason - This is the format for specifying memory sections" */
#include "MemMap.h"

/* ----- VAR_ZERO_INIT_8BIT ----- */
/*SAFETYMCUSW 580 S MR:1.1 <APPROVED> "Reason - Memory mapping requires this syntax" */
#define ICU_START_SEC_VAR_ZERO_INIT_8
/*SAFETYMCUSW 338 S MR:19.1 <APPROVED> "Reason - This is the format for specifying memory sections" */
#include "MemMap.h"

#if(ICU_DEV_ERROR_DETECT == STD_ON)
		/*SAFETYMCUSW 331 S MR:10.1 <APPROVED> "Reason -  Comes from compiler"*/
        static VAR(uint8, ICU_VAR) Icu_ModuleInitialized_u8 = FALSE;        /* Init-State of the driver */
#endif /* (ICU_DEV_ERROR_DETECT == STD_ON) */

#if(ICU_SET_MODE_API == STD_ON)
		/*SAFETYMCUSW 331 S MR:10.1 <APPROVED> "Reason -  Comes from compiler"*/
        static VAR(uint8, ICU_VAR) Icu_SleepMode_u8 = FALSE;                /* Sleep-Mode Active? */
#endif /* (ICU_SET_MODE_API == STD_ON) */

/*SAFETYMCUSW 580 S MR:1.1 <APPROVED> "Reason - Memory mapping requires this syntax" */
#define ICU_STOP_SEC_VAR_ZERO_INIT_8
/*SAFETYMCUSW 338 S MR:19.1 <APPROVED> "Reason - This is the format for specifying memory sections" */
#include "MemMap.h"


/* ===== UINT32 VARIABLES ================================================== */
/* ----- VAR_NO_INIT_32BIT ----- */
/*SAFETYMCUSW 580 S MR:1.1 <APPROVED> "Reason - Memory mapping requires this syntax" */
#define ICU_START_SEC_VAR_NO_INIT_32
/*SAFETYMCUSW 338 S MR:19.1 <APPROVED> "Reason - This is the format for specifying memory sections" */
#include "MemMap.h"

#if(ICU_EDGE_COUNT_API == STD_ON)
        static VAR(Icu_EdgeNumberType, ICU_VAR)
            Icu_CurrEdgeCount_at[ICU_MAXNUMBEROFCHANNELS];                  /* Current Edge Count */
#endif /* (ICU_EDGE_COUNT_API == STD_ON) */

    static volatile P2VAR(Icu_RamType, AUTOMATIC, ICU_VAR) Icu_Rambase;

    static VAR(uint32, ICU_VAR) Icu_Regbase;

/*SAFETYMCUSW 580 S MR:1.1 <APPROVED> "Reason - Memory mapping requires this syntax" */
#define ICU_STOP_SEC_VAR_NO_INIT_32
/*SAFETYMCUSW 338 S MR:19.1 <APPROVED> "Reason - This is the format for specifying memory sections" */
#include "MemMap.h"


/* ===== UNSPECIFIED VARIABLES ============================================= */

/* ----- VAR_ZERO_INIT_UNSPECIFIED ----- */
/*SAFETYMCUSW 580 S MR:1.1 <APPROVED> "Reason - Memory mapping requires this syntax" */
#define ICU_START_SEC_VAR_ZERO_INIT_UNSPECIFIED
/*SAFETYMCUSW 338 S MR:19.1 <APPROVED> "Reason - This is the format for specifying memory sections" */
#include "MemMap.h"

    static P2CONST(Icu_ConfigType, ICU_VAR, ICU_PBCFG) Icu_ConfigSet_pt;    /* Pointer to the PB Configuration */

#if(ICU_TIMESTAMP_API == STD_ON)
        static VAR(Icu_TsArrayType, ICU_VAR)
            Icu_TsBuffer_at[ICU_MAXNUMBEROFCHANNELS];                       /* Timestamping-buffer */
#endif

/*SAFETYMCUSW 580 S MR:1.1 <APPROVED> "Reason - Memory mapping requires this syntax" */
#define ICU_STOP_SEC_VAR_ZERO_INIT_UNSPECIFIED
/*SAFETYMCUSW 338 S MR:19.1 <APPROVED> "Reason - This is the format for specifying memory sections" */
#include "MemMap.h"



/* ===== CONST ============================================================= */

/* ----- CONST UINT8 ----- */
/*SAFETYMCUSW 580 S MR:1.1 <APPROVED> "Reason - Memory mapping requires this syntax" */
#define ICU_START_SEC_CONST_8
/*SAFETYMCUSW 338 S MR:19.1 <APPROVED> "Reason - This is the format for specifying memory sections" */
#include "MemMap.h"

    /* Mapping from AUOTSAR type to hardware values */
/*SAFETYMCUSW 127 S MR:8.12 <APPROVED> "Array is constant and does not require bounds" */
/*SAFETYMCUSW 25 D MR:8.7 <APPROVED> "Reason - This variable is defined globally for readability reasons" */
    static const uint8 Icu_Activation_au8[3U] = {
        2U,  /* [0]ICU_RISING_EDGE */
        1U,  /* [1]ICU_FALLING_EDGE */
        3U   /* [2]ICU_BOTH_EDGES */
    };

/*SAFETYMCUSW 580 S MR:1.1 <APPROVED> "Reason - Memory mapping requires this syntax" */
#define ICU_STOP_SEC_CONST_8
/*SAFETYMCUSW 338 S MR:19.1 <APPROVED> "Reason - This is the format for specifying memory sections" */
#include "MemMap.h"



/**********************************************************************************************************************
 *  LOCAL FUNCTION PROTOTYPES
 *********************************************************************************************************************/
/*SAFETYMCUSW 580 S MR:1.1 <APPROVED> "Reason - Memory mapping requires this syntax" */
#define ICU_START_SEC_CODE
/*SAFETYMCUSW 338 S MR:19.1 <APPROVED> "Reason - This is the format for specifying memory sections" */
#include "MemMap.h"

/* Main interrupt handler Icu_IrqFunction() and overflow-interrupt handler Icu_IrqOverflow()
 * are defined in 'Icu_Irq.h', because they have to be visible to 'Icu_Irq.c' */

/* Edge Detection interrupt handler */
static FUNC(void, ICU_CODE) Icu_IrqEdgeDetection(uint32 IrqNumber);

/* Timestamping interrupt handler */
static FUNC(void, ICU_CODE) Icu_IrqTimestamping(uint32 IrqNumber);

/* Signal Measurement interrupt handler */
static FUNC(void, ICU_CODE) Icu_IrqSignalMeasurement(uint32 IrqNumber);

/* Overflow interrupt handler */
static FUNC(void, ICU_CODE) Icu_IrqOverflow(void);

/*SAFETYMCUSW 580 S MR:1.1 <APPROVED> "Reason - Memory mapping requires this syntax" */
#define ICU_STOP_SEC_CODE
/*SAFETYMCUSW 338 S MR:19.1 <APPROVED> "Reason - This is the format for specifying memory sections" */
#include "MemMap.h"

/* ----- CONST UNSPECIFIED ----- */
/* This has to be placed after the above FUNCTION DECLARATIONS */
/*SAFETYMCUSW 580 S MR:1.1 <APPROVED> "Reason - Memory mapping requires this syntax" */
#define ICU_START_SEC_CONST_UNSPECIFIED
/*SAFETYMCUSW 338 S MR:19.1 <APPROVED> "Reason - This is the format for specifying memory sections" */
#include "MemMap.h"

    static const Icu_FctPtrType Icu_IrqModeSwitch[3U] = {
      Icu_IrqEdgeDetection,
      Icu_IrqSignalMeasurement,
      Icu_IrqTimestamping
    };

/*SAFETYMCUSW 580 S MR:1.1 <APPROVED> "Reason - Memory mapping requires this syntax" */
#define ICU_STOP_SEC_CONST_UNSPECIFIED
/*SAFETYMCUSW 338 S MR:19.1 <APPROVED> "Reason - This is the format for specifying memory sections" */
#include "MemMap.h"



/**********************************************************************************************************************
 *  GLOBAL FUNCTIONS
 *********************************************************************************************************************/
/*SAFETYMCUSW 580 S MR:1.1 <APPROVED> "Reason - Memory mapping requires this syntax" */
#undef ICU_START_SEC_CODE
#define ICU_START_SEC_CODE
/*SAFETYMCUSW 338 S MR:19.1 <APPROVED> "Reason - This is the format for specifying memory sections" */
#include "MemMap.h"
/***********************************************************************************************************************
 *  Icu_Init()
 **********************************************************************************************************************/
/*! \brief      Service for driver initialization. The Initialization function initializes all relevant registers of
 *              the configured hardware with the values of the structure referenced by the parameter ConfigPtr.
 *  \param[in]  ConfigPtr               Pointer to a selected configuration structure
 *  \pre        Input parameter must not be NULL_PTR.
 *  \context    Function shall be called from task level
 **********************************************************************************************************************/
/* SourceId : ICU_SourceId_010 */
/* DesignId : ICU_DesignId_13  */
/* Requirements : AR_ICU_SR60,AR_ICU_SR61,AR_ICU_SR62,AR_ICU_SR63,AR_ICU_SR64,AR_ICU_SR65,AR_ICU_SR66,AR_ICU_SR67,
 *                AR_ICU_SR68,AR_ICU_SR69,AR_ICU_SR70,AR_ICU_SR71,AR_ICU_SR72,AR_ICU_SR73,AR_ICU_SR74,AR_ICU_SR75,
 *                AR_ICU_SR76,AR_ICU_SR77  */
FUNC(void, ICU_CODE) Icu_Init(P2CONST( Icu_ConfigType, AUTOMATIC, ICU_PBCFG) ConfigPtr)
{
    /* ----- Function Local Variables ------------------------------------- */
    uint32 Counter_u32;
    uint8 init_result = E_OK;

    /* ----- Development Error Checks ------------------------------------- */
#if(ICU_DEV_ERROR_DETECT == STD_ON)
        if(TRUE == Icu_ModuleInitialized_u8)
        {
                (void)Icu_Errorhook(ICU_SID_INIT, ICU_E_ALREADY_INITIALIZED);
        }
        else if(NULL_PTR == ConfigPtr)
        {
                (void)Icu_Errorhook(ICU_SID_INIT, ICU_E_PARAM_CONFIG);
        }
        else
        {
#endif /* (ICU_DEV_ERROR_DETECT == STD_ON) */


    /* ----- Implementation ----------------------------------------------- */

    /* --- Initialize global variables --- */

    /* Initialize all the state-structures */
    for (Counter_u32 = 0U; Counter_u32 < ICU_MAXNUMBEROFCHANNELS; ++Counter_u32)
    {
#if(ICU_TIMESTAMP_API||ICU_SIGNAL_MEASUREMENT_API||ICU_EDGE_DETECTION_API)
        Icu_NotificationConf_au8[Counter_u32] = STD_OFF;
#endif
		Icu_ChlRunState_au8[Counter_u32] = 0U;
#if(ICU_WAKEUP_FUNCTIONALITY_API == STD_ON)
        Icu_WakeupConf_au8[Counter_u32] = 0U;
#endif /* (ICU_WAKEUP_FUNCTIONALITY_API == STD_ON) */
#if(ICU_GET_INPUT_STATE_API == STD_ON)
        Icu_ChlInputState_at[Counter_u32] = ICU_IDLE;
#endif /* (ICU_GET_INPUT_STATE_API == STD_ON) */
#if(ICU_TIMESTAMP_API == STD_ON)
        Icu_TsBuffer_at[Counter_u32].BufferIndex = 0U;
		Icu_TsBuffer_at[Counter_u32].BufferSize = 0U;
		Icu_TsBuffer_at[Counter_u32].NotifyCnt = 0U;
		Icu_TsBuffer_at[Counter_u32].NotifyInterval = 0U;
        Icu_TsBuffer_at[Counter_u32].BufferPtr = NULL_PTR;
#endif /* (ICU_TIMESTAMP_API == STD_ON) */
#if(ICU_EDGE_COUNT_API == STD_ON)
        Icu_CurrEdgeCount_at[Counter_u32] = (Icu_EdgeNumberType)0U;
#endif /* (ICU_EDGE_COUNT_API == STD_ON) */
    }
#if(ICU_SET_MODE_API == STD_ON)
	/*SAFETYMCUSW 331 S MR:10.1 <APPROVED> "Reason -  Comes from compiler"*/
    Icu_SleepMode_u8 = FALSE;
#endif /* (ICU_SET_MODE_API == STD_ON) */

    /*SAFETYMCUSW 45 D MR:21.1 <APPROVED> "Reason - Pointer is checked at the beginning of init function" */
    /* Store pointer to the PB configuration */
    Icu_ConfigSet_pt = ConfigPtr;

	
    /* Calculate the number of configured channels */
	/*SAFETYMCUSW 45 D MR:21.1 <APPROVED> "Reason - Pointer is checked at the beginning of init function" */
    /* Store pointer to the PB configuration */
    Icu_NoOfChannels_u8 =   Icu_ConfigSet_pt->Icu_EcChannelCount_u8 +
                            Icu_ConfigSet_pt->Icu_TsChannelCount_u8 +
                            Icu_ConfigSet_pt->Icu_EdChannelCount_u8 +
                            Icu_ConfigSet_pt->Icu_SmChannelCount_u8;

    /* Get the base addresses of RAM and Registers for the confgured NHET unit */
    Icu_Regbase = Icu_ConfigSet_pt->Icu_NhetRegBaseAddress_u32;
    Icu_Rambase = (volatile Icu_RamType*)Icu_ConfigSet_pt->Icu_NhetRamBaseAddress_u32;

    Icu_GlobalSuspend();
    /*SAFETYMCUSW 45 D MR:21.1 <APPROVED> "Reason - Pointer is checked at the beginning of init function" */
    /*SAFETYMCUSW 439 S MR:11.3 <APPROVED> "Reason - Lower layer function requires uint32 variable" */
    init_result = Icu_Het_Init(Icu_ConfigSet_pt->Icu_HetRamBlocks_at, (uint32) Icu_Rambase,
        Icu_Regbase);
    Icu_GlobalRestore();
	if( E_OK == init_result )
    {
    /* Enable interrupts for all edge detection channels, disable all others */
		for(Counter_u32 = 0U; Counter_u32 < Icu_NoOfChannels_u8; Counter_u32++)
		{
			if(ICU_MODE_SIGNAL_EDGE_DETECT == (Icu_ConfigSet_pt->Icu_ChannelConfig_at[Counter_u32].Icu_ChlMeasMode_t))
			{
				/*SAFETYMCUSW 93 S MR:6.1,6.2,10.1,10.2,10.3,10.4 <APPROVED> "Register Pointer is used here" */
				ICU_HETFLG(Icu_Regbase)     = (uint32)(1U << (Counter_u32 + 1U));
				/*SAFETYMCUSW 93 S MR:6.1,6.2,10.1,10.2,10.3,10.4 <APPROVED> "Register Pointer is used here" */
				ICU_HETINTENAS(Icu_Regbase) = (uint32)(1U << (Counter_u32 + 1U));
			}
			else
			{
				/*SAFETYMCUSW 93 S MR:6.1,6.2,10.1,10.2,10.3,10.4 <APPROVED> "Register Pointer is used here" */
				ICU_HETINTENAC(Icu_Regbase) = (uint32)(1U << (Counter_u32 + 1U));
			}
		}
    }
#if(STD_ON == ICU_DEV_ERROR_DETECT)
	/*SAFETYMCUSW 331 S MR:10.1 <APPROVED> "Reason -  Comes from compiler"*/
	Icu_ModuleInitialized_u8 = TRUE;
	}
#endif
}



#if (STD_ON == ICU_DE_INIT_API)
/* SourceId : ICU_SourceId_011 */
/* DesignId : ICU_DesignId_14  */
/* Requirements : AR_ICU_SR78,AR_ICU_SR79,AR_ICU_SR80,AR_ICU_SR81,AR_ICU_SR82,AR_ICU_SR83,AR_ICU_SR86,AR_ICU_SR87 */
/***********************************************************************************************************************
 *  Icu_DeInit()
 **********************************************************************************************************************/
/*! \brief      Service for ICU De-Initialization. After the call of this service, the state of the peripherals used
 *              by configuration will be the same as after power on reset. Values of registers which are not writeable
 *              are excluded.
 *  \context    Function shall be called from task level
 **********************************************************************************************************************/
FUNC(void, ICU_CODE) Icu_DeInit(void)
{
    /* ----- Function Local Variables ------------------------------------- */
    uint32 Counter_u32;

    /* ----- Development Error Checks ------------------------------------- */
#if(ICU_DEV_ERROR_DETECT == STD_ON)
	/*SAFETYMCUSW 331 S MR:10.1 <APPROVED> "Reason -  Comes from compiler"*/
    uint8 dev_error_detect = FALSE;
        if(FALSE == Icu_ModuleInitialized_u8)
        {
                (void)Icu_Errorhook(ICU_SID_DE_INIT, ICU_E_UNINIT);
				/*SAFETYMCUSW 331 S MR:10.1 <APPROVED> "Reason -  Comes from compiler"*/
                dev_error_detect = TRUE;
        }
        else
        {
        for (Counter_u32 = 0U; Counter_u32 < ICU_MAXNUMBEROFCHANNELS; ++Counter_u32)
        {
            if(STD_ON == Icu_ChlRunState_au8[Counter_u32])
            {
                    (void)Icu_Errorhook(ICU_SID_DE_INIT, ICU_E_BUSY_OPERATION);
					/*SAFETYMCUSW 331 S MR:10.1 <APPROVED> "Reason -  Comes from compiler"*/
                    dev_error_detect = TRUE;
            }
        }
        }
        /*SAFETYMCUSW 139 S MR:13.7 <APPROVED> "Tool Issue" */
        if(FALSE == dev_error_detect)
        {
#endif /* (ICU_DEV_ERROR_DETECT == STD_ON) */

    /* ----- Implementation ----------------------------------------------- */

	/*SAFETYMCUSW 439 S MR:11.3 <APPROVED> "Reason - Lower layer function requires uint32 variable" */
    /* Call HET de-initialization service */
    Icu_Het_DeInit((uint32) Icu_Rambase, Icu_Regbase);

    /* Disable all edge detection interrupts */
    for(Counter_u32 = 0U; Counter_u32 < Icu_NoOfChannels_u8; Counter_u32++)
    {
    	/*SAFETYMCUSW 93 S MR:6.1,6.2,10.1,10.2,10.3,10.4 <APPROVED> "Register Pointer is used here" */
        ICU_HETINTENAC(Icu_Regbase) = (uint32)(1U << (Counter_u32 + 1U));
    }
    /* Reset configuration pointer */
    Icu_ConfigSet_pt = NULL_PTR;
    /* Set module state to uninitialized */
#if(STD_ON == ICU_DEV_ERROR_DETECT)
	/*SAFETYMCUSW 331 S MR:10.1 <APPROVED> "Reason -  Comes from compiler"*/
	Icu_ModuleInitialized_u8 = FALSE;
	}
#endif
} /* Icu_DeInit() */
#endif /* (STDON == ICU_DE_INIT_API) */



#if (STD_ON == ICU_SET_MODE_API)
/***********************************************************************************************************************
 *  Icu_SetMode()
 **********************************************************************************************************************/
/*! \brief      Service for ICU mode selection. This service sets the operation mode to the given mode parameter. The
 *              component can be set to sleep mode or normal mode with this service.
 *
 *  \param[in]  Mode                    Icu-Mode to set
 *  \pre        Channel must be either ICU_MODE_NORMAL or ICU_MODE_SLEEP.
 *  \context    Function shall be called from task level
 **********************************************************************************************************************/
/* SourceId : ICU_SourceId_012 */
/* DesignId : ICU_DesignId_15  */
/* Requirements : AR_ICU_SR88,AR_ICU_SR89,AR_ICU_SR90,AR_ICU_SR93,AR_ICU_SR94,AR_ICU_SR17,AR_ICU_SR18,
 *                AR_ICU_SR19,AR_ICU_SR20,AR_ICU_SR21,AR_ICU_SR22 */
FUNC(void, ICU_CODE) Icu_SetMode(Icu_ModeType Mode)
{
    /* ----- Function Local Variables ------------------------------------- */
    uint32 Counter_u32;

    /* ----- Development Error Checks ------------------------------------- */
#if(ICU_DEV_ERROR_DETECT == STD_ON)
        if(FALSE == Icu_ModuleInitialized_u8)
        {
                (void)Icu_Errorhook(ICU_SID_SET_MODE, ICU_E_UNINIT);
        }
        else if((ICU_MODE_SLEEP != Mode) && (ICU_MODE_NORMAL != Mode))
        	/* AUTOSAR specifies checking this parameter. */

        {
                (void)Icu_Errorhook(ICU_SID_SET_MODE, ICU_E_PARAM_MODE);
        }
        else

#endif /* (ICU_DEV_ERROR_DETECT == STD_ON) */
        {
		/* ----- Implementation ----------------------------------------------- */

		if(ICU_MODE_SLEEP == Mode)
		{
			/* ICU goes to sleep mode: Switch all non wake-up capable channels off */
			for (Counter_u32 = 0U; Counter_u32 < Icu_NoOfChannels_u8; ++Counter_u32)
			{
				if(STD_ON == Icu_WakeupConf_au8[Counter_u32])
				{
					/* Edge Detection channel is wake-up capable and wake-up is enabled - don't disable the interrupt */
				}

				else
				{
					/* Disable Interrupt */
					/*SAFETYMCUSW 93 S MR:6.1,6.2,10.1,10.2,10.3,10.4 <APPROVED> "Register Pointer is used here" */
					ICU_HETINTENAC(Icu_Regbase) = (uint32)(1U << (Counter_u32 + 1U));

					/* Disable channel in the channel state array */
					Icu_ChlRunState_au8[Counter_u32] = STD_OFF;
				}
			}
			/*SAFETYMCUSW 331 S MR:10.1 <APPROVED> "Reason -  Comes from compiler"*/
			Icu_SleepMode_u8 = TRUE;
		}
		else
		{
			/* ICU awakes: Enable all Edge Detection Channels */
			for (Counter_u32 = 0U; Counter_u32 < Icu_NoOfChannels_u8; ++Counter_u32)
			{
				if(ICU_MODE_SIGNAL_EDGE_DETECT == (Icu_ConfigSet_pt->Icu_ChannelConfig_at[Counter_u32].Icu_ChlMeasMode_t))
				{
					/* Clear Interrupt flag */
					/*SAFETYMCUSW 93 S MR:6.1,6.2,10.1,10.2,10.3,10.4 <APPROVED> "Register Pointer is used here" */
					ICU_HETFLG(Icu_Regbase) = (uint32)(1U << (Counter_u32 + 1U));

					/* Re-enable interrupt of the edge detection channel */
					/*SAFETYMCUSW 93 S MR:6.1,6.2,10.1,10.2,10.3,10.4 <APPROVED> "Register Pointer is used here" */
					ICU_HETINTENAS(Icu_Regbase) = (uint32)(1U << (Counter_u32 + 1U));
				}
			}
			/*SAFETYMCUSW 331 S MR:10.1 <APPROVED> "Reason -  Comes from compiler"*/
			Icu_SleepMode_u8 = FALSE;
		}
	}



}/* Icu_SetMode() */
#endif /* (STD_ON == ICU_SET_MODE_API) */



#if (STD_ON == ICU_DISABLE_WAKEUP_API)
/**********************************************************************************************************************
 *  Icu_DisableWakeup()
 *********************************************************************************************************************/
/*! \brief      This service shall disable the wakeup capability of a single ICU channel. This service is only feasible
 *              for ICU channels configured statically as wakeup capable true.
 *
 *  \param[in]  Channel                 Numeric identifier of the Icu channel
 *  \pre        Channel has to be a valid channel number.
 *  \pre        Channel has to be configured as a wakeup-capable channel.
 *  \context    Function shall be called from task level
 *********************************************************************************************************************/
/* SourceId : ICU_SourceId_013 */
/* DesignId : ICU_DesignId_16  */
/* Requirements : AR_ICU_SR95,AR_ICU_SR96,AR_ICU_SR97,AR_ICU_SR98 */
FUNC(void, ICU_CODE) Icu_DisableWakeup(Icu_ChannelType Channel)
{

    /* ----- Development Error Checks ------------------------------------- */
#if(ICU_DEV_ERROR_DETECT == STD_ON)
    if(TRUE != Icu_ModuleInitialized_u8)
    {
            (void)Icu_Errorhook(ICU_SID_DISABLE_WAKEUP, ICU_E_UNINIT);
    }
    else if(
        (Channel >= Icu_NoOfChannels_u8) ||
        (ICU_MODE_SIGNAL_EDGE_DETECT != Icu_ConfigSet_pt->Icu_ChannelConfig_at[Channel].Icu_ChlMeasMode_t) ||
        (ICU_UNDEFINED == Icu_ConfigSet_pt->Icu_ChannelConfig_at[Channel].Icu_EcuMWakeupIdent)
      )
    {
        (void)Icu_Errorhook(ICU_SID_DISABLE_WAKEUP, ICU_E_PARAM_CHANNEL);
    }
    else

#endif /* (ICU_DEV_ERROR_DETECT == STD_ON) */
    {
    /* ----- Implementation ----------------------------------------------- */

    /* Disable wake-up */
    Icu_WakeupConf_au8[Channel] = STD_OFF;
    }


}/* Icu_DisableWakeup() */
#endif /* (STD_ON == ICU_DISABLE_WAKEUP_API) */



#if (STD_ON == ICU_ENABLE_WAKEUP_API)
/**********************************************************************************************************************
 *  Icu_EnableWakeup()
 *********************************************************************************************************************/
/*! \brief      This service (re-)enables the wakeup capability of a single ICU channel. This service is only feasible
 *              for ICU channels configured as wakeup capable true.
 *
 *  \param[in]  Channel                 Numeric identifier of the Icu channel
 *  \pre        Channel has to be a valid channel number.
 *  \pre        Channel has to be configured as a wakeup-capable channel.
 *  \context    Function shall be called from task level
 *********************************************************************************************************************/
/* SourceId : ICU_SourceId_014 */
/* DesignId : ICU_DesignId_17  */
/* Requirements : AR_ICU_SR103,AR_ICU_SR104,AR_ICU_SR105,AR_ICU_SR108,AR_ICU_SR109 */
FUNC(void, ICU_CODE) Icu_EnableWakeup(Icu_ChannelType Channel)
{

    /* ----- Development Error Checks ------------------------------------- */
#if(ICU_DEV_ERROR_DETECT == STD_ON)
    if(TRUE != Icu_ModuleInitialized_u8)
    {
            (void)Icu_Errorhook(ICU_SID_ENABLE_WAKEUP, ICU_E_UNINIT);
    }
    else if(
        (Channel >= Icu_NoOfChannels_u8) ||
        (ICU_MODE_SIGNAL_EDGE_DETECT != Icu_ConfigSet_pt->Icu_ChannelConfig_at[Channel].Icu_ChlMeasMode_t) ||
        (ICU_UNDEFINED == Icu_ConfigSet_pt->Icu_ChannelConfig_at[Channel].Icu_EcuMWakeupIdent)
      )
    {
            (void)Icu_Errorhook(ICU_SID_ENABLE_WAKEUP, ICU_E_PARAM_CHANNEL);
    }
    else

#endif /* (ICU_DEV_ERROR_DETECT == STD_ON) */
	{
    /* ----- Implementation ----------------------------------------------- */

    /* Enable Wake-up */
    Icu_WakeupConf_au8[Channel] = STD_ON;
    }


}/* Icu_EnableWakeup() */
#endif /* (STD_ON == ICU_ENABLE_WAKEUP_API) */


#if (STD_ON == ICU_WAKEUP_FUNCTIONALITY_API)
/********************************************************************************************************************
    Function name:  Icu_CheckWakeup
 ********************************************************************************************************************/
/*  \Description: Icu_CheckWakeup will check if wakeup capable channel is source for a wakeup event
 *                and call EcuM_SetWakeupEvent to indicate the valid wakeup event to the EcuM.
 *  \param[in]:   Wakeupsource
 *  \return:      None
 *  \context:     Interrupt Subroutine Call
 *  \note:        Icu Driver should be in Sleep Mode and channel should be configured for wakeup.
 *********************************************************************************************************************/
/* SourceId : ICU_SourceId_015 */
/* DesignId : ICU_DesignId_18  */
/* Requirements : AR_ICU_SR110,AR_ICU_SR111,AR_ICU_SR112,AR_ICU_SR113,AR_ICU_SR50,AR_ICU_SR51 */
/*SAFETYMCUSW 69 S MR:3.4 <APPROVED> "Reason - pragma is required here to force code state to 32 bits"*/
#pragma CODE_STATE(Icu_CheckWakeup, 32)
FUNC(void, ICU_CODE) Icu_CheckWakeup ( EcuM_WakeupSourceType wakeupSource )
{
   Icu_ChannelType Icu_Channel = 0U;/*Icu Channel Id*/
   Icu_ChannelType ChannelIdx = 0U;/*Configured channel number*/
   EcuM_WakeupSourceType ChlWakeupRef = 0U;/*channel wakeup source*/
   /*SAFETYMCUSW 331 S MR:10.1 <APPROVED> "Reason -  Comes from compiler"*/
   uint8 Wakeup_Channel_Found = FALSE;

   /* Check if the driver has been successfully initialized. If the driver
    * has not been initialized, report an error and return immediately.
    */
   /* ----- Development Error Checks ------------------------------------- */
#if(ICU_DEV_ERROR_DETECT == STD_ON)
   if(TRUE != Icu_ModuleInitialized_u8)
   {
	   (void)Icu_Errorhook(ICU_SID_CHECK_WAKEUP, ICU_E_UNINIT);
   }
   /* Check if wakeupSource is valid (reference ID != 0) */
   else if ( ICU_UNDEFINED == wakeupSource )
   {
   }
   else

#endif
   {
      /* -------------------- Loop over all channels ----------------------------------------
       * Check if delivered wakeupSource comes from configured wakeup capable timer channel
       */
      for ( ChannelIdx = 0U; ChannelIdx < Icu_NoOfChannels_u8; ChannelIdx++ )
      {
         ChlWakeupRef = (EcuM_WakeupSourceType)(Icu_ConfigSet_pt->Icu_ChannelConfig_at[ChannelIdx].Icu_EcuMWakeupIdent );

         if (wakeupSource == ChlWakeupRef)
         {
            /* configured wakeup capable timer found; leave loop */
			/*SAFETYMCUSW 331 S MR:10.1 <APPROVED> "Reason -  Comes from compiler"*/
            Wakeup_Channel_Found = TRUE;
            Icu_Channel = ChannelIdx;
            break;
         }
      } /* End of for loop*/

      /* Check if configured wakeup capable timer was found */
	  /*SAFETYMCUSW 331 S MR:10.1 <APPROVED> "Reason -  Comes from compiler"*/
      if (Wakeup_Channel_Found == FALSE )
      {
         /* no wakeup capable timer found */
      }
      else
      {
         /* Check if delivered wakeupSource comes from wakeup enabled timer channel */
         if ( STD_ON == Icu_WakeupConf_au8[Icu_Channel] )
         {
        	Icu_SetMode(ICU_MODE_NORMAL);
#if (STD_ON == ICU_REPORT_WAKEUP_SOURCE)
            Icu_ReportWakeup(ChlWakeupRef);
#endif /* (STD_ON == ICU_REPORT_WAKEUP_SOURCE) */
         }
      }/*Else (Wakeup_Channel_Found == FALSE ) */
   }
} /* Icu_CheckWakeup */
#endif /* (STD_ON == ICU_WAKEUP_FUNCTIONALITY_API) */


/***********************************************************************************************************************
 *  Icu_SetActivationCondition()
 **********************************************************************************************************************/
/*! \brief      This service sets the activation-edge according to the Activation parameter for the given channel. This
 *              service overrides the edge setting of the configuration.
 *
 *  \param[in]  Channel                 Numeric identifier of the Icu channel
 *  \param[in]  Activation              Type of activation
 *  \pre        Channel has to be a valid channel number.
 *  \pre        Channel must be configured for one of the following modes:
 *              - ICU_MODE_SIGNAL_EDGE_DETECT
 *              - ICU_MODE_TIMESTAMP
 *              - ICU_MODE_EDGE_COUNTER
 *  \pre        Activation must be ICU_RISING_EDGE, ICU_FALLING_EDGE, ICU_BOTH_EDGES
 *  \context    Function shall be called from task level
 **********************************************************************************************************************/
/* SourceId : ICU_SourceId_016 */
/* DesignId : ICU_DesignId_19  */
/* Requirements : AR_ICU_SR116,AR_ICU_SR117,AR_ICU_SR118,AR_ICU_SR119,AR_ICU_SR120,AR_ICU_SR121 */
FUNC(void, ICU_CODE) Icu_SetActivationCondition
(
        Icu_ChannelType Channel,
        Icu_ActivationType Activation
)
{
    /* ----- Development Error Checks ------------------------------------- */
#if(ICU_DEV_ERROR_DETECT == STD_ON)
	if(FALSE == Icu_ModuleInitialized_u8)

	{
			(void)Icu_Errorhook(ICU_SID_SET_ACTIVATION_CONDITION, ICU_E_UNINIT);
	}
	else if(
		(Channel >= Icu_NoOfChannels_u8) ||
		(ICU_MODE_SIGNAL_MEASUREMENT == Icu_ConfigSet_pt->Icu_ChannelConfig_at[Channel].Icu_ChlMeasMode_t)
	  )
	{
			(void)Icu_Errorhook(ICU_SID_SET_ACTIVATION_CONDITION, ICU_E_PARAM_CHANNEL);
	}
	else if((ICU_RISING_EDGE != Activation) && (ICU_FALLING_EDGE != Activation) && (ICU_BOTH_EDGES != Activation))
		/* AUTOSAR specifies checking this parameter. */
	{
			(void)Icu_Errorhook(ICU_SID_SET_ACTIVATION_CONDITION, ICU_E_PARAM_ACTIVATION);
	}

	else

#endif /* (ICU_DEV_ERROR_DETECT == STD_ON) */
	{
		/* ----- Implementation ----------------------------------------------- */
		if(ICU_MODE_TIMESTAMP == Icu_ConfigSet_pt->Icu_ChannelConfig_at[Channel].Icu_ChlMeasMode_t)
		{
			Icu_GlobalSuspend();
			/* Timestamping channel -> Instruction: WCAP */
			Icu_Rambase->Instruction[Channel + 1U].Control_u32 &= ~((3U) << (5U)); /* Clear Bits */
			Icu_Rambase->Instruction[Channel + 1U].Control_u32 |= ((Icu_Activation_au8[Activation]) << 5); /* Write activation */
			Icu_GlobalRestore();
		}
		else
		{
			Icu_GlobalSuspend();
			/* Edge Detection or Edge Counting channel -> Instruction: ECNT */
			Icu_Rambase->Instruction[Channel + 1U].Control_u32 &= ~((7U) << (4U)); /* Clear Bits */
			Icu_Rambase->Instruction[Channel + 1U].Control_u32 |= ((Icu_Activation_au8[Activation]) << 4U); /* Write activation */
			Icu_GlobalRestore();
		}
	}


} /* Icu_SetActivationCondition() */



/***********************************************************************************************************************
 *  Icu_DisableNofitication()
 **********************************************************************************************************************/
/*! \brief      This service disables the notification on the given Icu channel.
 *
 *  \param[in]  Channel                 Numeric identifier of the Icu channel
 *  \pre        Channel has to be a valid channel number.
 *  \pre        Channel must be configured for one of the following modes:
 *              - ICU_MODE_SIGNAL_EDGE_DETECT
 *              - ICU_MODE_TIMESTAMP
 *  \context    Function shall be called from task level
 **********************************************************************************************************************/
/* SourceId : ICU_SourceId_017 */
/* DesignId : ICU_DesignId_20  */
/* Requirements : AR_ICU_SR122,AR_ICU_SR123,AR_ICU_SR124,AR_ICU_SR125 */
FUNC(void, ICU_CODE) Icu_DisableNotification(Icu_ChannelType Channel)
{
    /* ----- Development Error Checks ------------------------------------- */
#if(ICU_DEV_ERROR_DETECT == STD_ON)
    if(TRUE != Icu_ModuleInitialized_u8)
    {
            (void)Icu_Errorhook(ICU_SID_DISABLE_NOTIFICATION, ICU_E_UNINIT);
    }
    else if(
        (Channel >= Icu_NoOfChannels_u8) ||
        (ICU_MODE_EDGE_COUNTER == (Icu_ConfigSet_pt->Icu_ChannelConfig_at[Channel].Icu_ChlMeasMode_t))
      )
    {
            (void)Icu_Errorhook(ICU_SID_DISABLE_NOTIFICATION, ICU_E_PARAM_CHANNEL);
    }
    else

#endif /* (ICU_DEV_ERROR_DETECT == STD_ON) */
    {
    /* ----- Implementation ----------------------------------------------- */

#if(ICU_TIMESTAMP_API||ICU_SIGNAL_MEASUREMENT_API||ICU_EDGE_DETECTION_API)
    /* Disable notification */
    Icu_NotificationConf_au8[Channel] = STD_OFF;
#endif
    }

} /* Icu_DisableNotification() */



/***********************************************************************************************************************
 *  Icu_EnableNotification()
 **********************************************************************************************************************/
/*! \brief      This service enables the notification functionality on the given Icu channel. Once the notification
 *              functionality is enabled, pre-configured notification functions are called by the component.
 *
 *  \param[in]  Channel                 Numeric identifier of the Icu channel
 *  \pre        Channel has to be a valid channel number.
 *  \pre        Channel must be configured for one of the following modes:
 *              - ICU_MODE_SIGNAL_EDGE_DETECT
 *              - ICU_MODE_TIMESTAMP
 *              - ICU_MODE_SIGNAL_MEASUREMENT
 *  \context    Function shall be called from task level
 **********************************************************************************************************************/
/* SourceId : ICU_SourceId_018 */
/* DesignId : ICU_DesignId_21  */
/* Requirements : AR_ICU_SR126,AR_ICU_SR127,AR_ICU_SR128,AR_ICU_SR129 */
FUNC(void, ICU_CODE) Icu_EnableNotification(Icu_ChannelType Channel)
{
    /* ----- Development Error Checks ------------------------------------- */
#if(ICU_DEV_ERROR_DETECT == STD_ON)
    if(TRUE != Icu_ModuleInitialized_u8)
    {
            (void)Icu_Errorhook(ICU_SID_ENABLE_NOTIFICATION, ICU_E_UNINIT);
    }
else if(
        (Channel >= Icu_NoOfChannels_u8) ||
        (ICU_MODE_EDGE_COUNTER == (Icu_ConfigSet_pt->Icu_ChannelConfig_at[Channel].Icu_ChlMeasMode_t))
      )
    {
            (void)Icu_Errorhook(ICU_SID_ENABLE_NOTIFICATION, ICU_E_PARAM_CHANNEL);
    }
    else

#endif /* (ICU_DEV_ERROR_DETECT == STD_ON) */
	{
    	/* ----- Implementation ----------------------------------------------- */
#if(ICU_TIMESTAMP_API||ICU_SIGNAL_MEASUREMENT_API||ICU_EDGE_DETECTION_API)
		/* Enable notification */
		Icu_NotificationConf_au8[Channel] = STD_ON;
#endif
    }

} /* Icu_EnableNotification() */



#if (STD_ON == ICU_GET_INPUT_STATE_API)
/***********************************************************************************************************************
 *  Icu_GetInputState()
 **********************************************************************************************************************/
/*! \brief      This service returns the status of the Icu input. If an activation edge has been detected, the service
 *              will return ICU_ACTIVE, if not, the service will return ICU_IDLE. Once the state has been read, the
 *              service resets the state to ICU_IDLE.
 *
 *  \param[in]  Channel                 Numeric identifier of the Icu channel
 *  \return     ICU_ACTIVE, ICU_IDLE
 *  \pre        Channel has to be a valid channel number.
 *  \pre        Channel must be configured for one of the following modes:
 *              - ICU_MODE_SIGNAL_EDGE_DETECT
 *              - ICU_MODE_SIGNAL_MEASUREMENT
 *  \context    Function shall be called from task level
 **********************************************************************************************************************/
/* SourceId : ICU_SourceId_019 */
/* DesignId : ICU_DesignId_22  */
/* Requirements : AR_ICU_SR130,AR_ICU_SR131,AR_ICU_SR132,AR_ICU_SR133,AR_ICU_SR134,AR_ICU_SR135,AR_ICU_SR136,
 *                AR_ICU_SR139,AR_ICU_SR140 */
FUNC(Icu_InputStateType, ICU_CODE) Icu_GetInputState(Icu_ChannelType Channel)
{
    /* ----- Function Local Variables ------------------------------------- */
    Icu_InputStateType InputState_u32 = ICU_IDLE;
    /* ----- Development Error Checks ------------------------------------- */
#if(ICU_DEV_ERROR_DETECT == STD_ON)
        if(FALSE == Icu_ModuleInitialized_u8)
        {
                (void)Icu_Errorhook(ICU_SID_GET_INPUT_STATE, ICU_E_UNINIT);
        }
        else if(
            (Channel >= Icu_NoOfChannels_u8) ||
            (
                (ICU_MODE_SIGNAL_MEASUREMENT != (Icu_ConfigSet_pt->Icu_ChannelConfig_at[Channel].Icu_ChlMeasMode_t)) &&
                (ICU_MODE_SIGNAL_EDGE_DETECT != (Icu_ConfigSet_pt->Icu_ChannelConfig_at[Channel].Icu_ChlMeasMode_t))
            )
          )
        {
                (void)Icu_Errorhook(ICU_SID_GET_INPUT_STATE, ICU_E_PARAM_CHANNEL);
        }
        else

#endif /* (ICU_DEV_ERROR_DETECT == STD_ON) */
        {
		/* ----- Implementation ----------------------------------------------- */

		/* Store current input state of the channel */
		/*SAFETYMCUSW 93 S MR:6.1,6.2,10.1,10.2,10.3,10.4 <APPROVED> "Safe Conversion to smaller type" */
		InputState_u32 = (uint32)Icu_ChlInputState_at[Channel];

		/* Reset the input state */
		Icu_ChlInputState_at[Channel] = ICU_IDLE;

        }
    /* Return the stored value */
    return(InputState_u32);

} /* Icu_GetInputState() */
#endif /* (STD_ON == ICU_GET_INPUT_STATE_API) */



#if (STD_ON == ICU_TIMESTAMP_API)
/***********************************************************************************************************************
 *  Icu_StartTimestamp()
 **********************************************************************************************************************/
/*! \brief      This service starts the capturing of timer values on the currently configured edges (rising/falling/
 *              both). The values will be written to the pre-configured buffer.
 *
 *  \param[in]  Channel                 Numeric identifier of the Icu channel
 *  \param[in]  BufferPtr               Pointer to the buffer array, where the timestamp values shall be placed
 *  \param[in]  BufferSize              Size of the external buffer
 *  \param[in]  NotifyInterval          Notification interval (number of events until next call of the notification)
 *  \param[out] inOut                   Output parameter reference
 *  \pre        Channel has to be a valid channel number.
 *  \pre        Channel must be a Timestamping channel.
 *  \pre        BufferPtr must not be NULL_PTR.
 *  \pre        BufferSize must not be '0'.
 *  \context    Function shall be called from task level
 **********************************************************************************************************************/
/* SourceId : ICU_SourceId_020 */
/* DesignId : ICU_DesignId_23  */
/* Requirements : AR_ICU_SR141,AR_ICU_SR142,AR_ICU_SR143,AR_ICU_SR144,AR_ICU_SR145,AR_ICU_SR146,AR_ICU_SR147,
 *                AR_ICU_SR148,AR_ICU_SR149,AR_ICU_SR150,AR_ICU_SR151,AR_ICU_SR154,AR_ICU_SR155,AR_ICU_SR156,
 *                AR_ICU_SR157 */
FUNC(void, ICU_CODE) Icu_StartTimestamp
(
        Icu_ChannelType Channel,
        P2VAR(Icu_ValueType, ICU_VAR_FAST, ICU_APPL_DATA) BufferPtr,
        Icu_IndexType BufferSize,
        Icu_IndexType NotifyInterval
)
{
    /* ----- Development Error Checks ------------------------------------- */
#if(ICU_DEV_ERROR_DETECT == STD_ON)
	if(FALSE == Icu_ModuleInitialized_u8)
	{
			(void)Icu_Errorhook(ICU_SID_START_TIMESTAMP, ICU_E_UNINIT);
	}
	else if(
		(Channel >= Icu_NoOfChannels_u8) ||
		(ICU_MODE_TIMESTAMP != (Icu_ConfigSet_pt->Icu_ChannelConfig_at[Channel].Icu_ChlMeasMode_t))
	  )
	{
			(void)Icu_Errorhook(ICU_SID_START_TIMESTAMP, ICU_E_PARAM_CHANNEL);
	}
	else if(NULL_PTR == BufferPtr)
	{
			(void)Icu_Errorhook(ICU_SID_START_TIMESTAMP, ICU_E_PARAM_BUFFER_PTR);
	}
	else if(BufferSize == 0U)
	{
			(void)Icu_Errorhook(ICU_SID_START_TIMESTAMP, ICU_E_PARAM_BUFFER_SIZE);
	}
	else if(NotifyInterval < 1U)
	{
			(void)Icu_Errorhook(ICU_SID_START_TIMESTAMP, ICU_E_PARAM_NOTIFY_INTERVAL);
	}
	else

#endif /* (ICU_DEV_ERROR_DETECT == STD_ON) */
	{
		/* ----- Implementation ----------------------------------------------- */

		/* Store buffer information */
		Icu_TsBuffer_at[Channel].BufferPtr      = BufferPtr;
		Icu_TsBuffer_at[Channel].BufferSize     = BufferSize;
		Icu_TsBuffer_at[Channel].NotifyInterval = NotifyInterval;

		/* Reset temporary buffer values */
		Icu_TsBuffer_at[Channel].NotifyCnt = 0U;
		Icu_TsBuffer_at[Channel].BufferIndex = 0U;

		/* Clear Flag */
		/*SAFETYMCUSW 93 S MR:6.1,6.2,10.1,10.2,10.3,10.4 <APPROVED> "Register Pointer is used here" */
		ICU_HETFLG(Icu_Regbase) = (uint32)(1U << (Channel + 1U));

		/* Enable interrupt */
		/*SAFETYMCUSW 93 S MR:6.1,6.2,10.1,10.2,10.3,10.4 <APPROVED> "Register Pointer is used here" */
		ICU_HETINTENAS(Icu_Regbase) = (uint32)(1U << (Channel + 1U));


		/* Enable channel in the channel state array */
		Icu_ChlRunState_au8[Channel] = STD_ON;

	}

}/* Icu_StartTimestamp() */

/***********************************************************************************************************************
 *  Icu_StopTimestamp()
 **********************************************************************************************************************/
/*! \brief      This service stops the timestamp measurement of the given channel.
 *
 *  \param[in]  Channel                 Numeric identifier of the Icu channel
 *  \pre        Channel has to be a valid channel number.
 *  \pre        Channel must be a Timestamping channel.
 *  \context    Function shall be called from task level
 **********************************************************************************************************************/
/* SourceId : ICU_SourceId_021 */
/* DesignId : ICU_DesignId_24  */
/* Requirements : AR_ICU_SR158,AR_ICU_SR159,AR_ICU_SR160,AR_ICU_SR161,AR_ICU_SR163,AR_ICU_SR165 */
FUNC(void, ICU_CODE) Icu_StopTimestamp(Icu_ChannelType Channel)
{

	/* ----- Development Error Checks ------------------------------------- */
#if(ICU_DEV_ERROR_DETECT == STD_ON)
	if(FALSE == Icu_ModuleInitialized_u8)
	{
			(void)Icu_Errorhook(ICU_SID_STOP_TIMESTAMP, ICU_E_UNINIT);
	}
	else if(
		(Channel >= Icu_NoOfChannels_u8) ||
		(ICU_MODE_TIMESTAMP != (Icu_ConfigSet_pt->Icu_ChannelConfig_at[Channel].Icu_ChlMeasMode_t))
	  )
	{
			(void)Icu_Errorhook(ICU_SID_STOP_TIMESTAMP, ICU_E_PARAM_CHANNEL);
	}
	else if(Icu_ChlRunState_au8[Channel] == 0U)
	{
			(void)Icu_Errorhook(ICU_SID_STOP_TIMESTAMP, ICU_E_NOT_STARTED);
	}
	else

#endif /* (ICU_DEV_ERROR_DETECT == STD_ON) */
	{

    /* ----- Implementation ----------------------------------------------- */

    /* Disable Interrupt */
    /*SAFETYMCUSW 93 S MR:6.1,6.2,10.1,10.2,10.3,10.4 <APPROVED> "Register Pointer is used here" */
    ICU_HETINTENAC(Icu_Regbase) = (uint32)(1U << (Channel + 1U));

    /* Disable channel in the channel state array */
    Icu_ChlRunState_au8[Channel] = STD_OFF;
	}

}/* Icu_StopTimestamp() */

/***********************************************************************************************************************
 *  Icu_GetTimestampIndex()
 **********************************************************************************************************************/
/*! \brief      This service reads the timestamp index, which is the next to be written, on the given channel.
 *
 *  \param[in]  Channel                 Numeric identifier of the Icu channel
 *  \pre        Channel has to be a valid channel number.
 *  \pre        Channel must be a Timestamping channel.
 *  \context    Function shall be called from task level
 **********************************************************************************************************************/
/* SourceId : ICU_SourceId_022 */
/* DesignId : ICU_DesignId_25  */
/* Requirements : AR_ICU_SR166,AR_ICU_SR167,AR_ICU_SR168,AR_ICU_SR169,AR_ICU_SR170,AR_ICU_SR173,AR_ICU_SR174 */
FUNC(Icu_IndexType, ICU_CODE) Icu_GetTimestampIndex(Icu_ChannelType Channel)
{
	Icu_IndexType return_value = 0U;
    /* ----- Development Error Checks ------------------------------------- */
#if(ICU_DEV_ERROR_DETECT == STD_ON)
	if(FALSE == Icu_ModuleInitialized_u8)
	{
			(void)Icu_Errorhook(ICU_SID_GET_TIMESTAMP_INDEX, ICU_E_UNINIT);
	}
	else if(
		(Channel >= Icu_NoOfChannels_u8) ||
		( ICU_MODE_TIMESTAMP != (Icu_ConfigSet_pt->Icu_ChannelConfig_at[Channel].Icu_ChlMeasMode_t))
	  )
	{
			(void)Icu_Errorhook(ICU_SID_GET_TIMESTAMP_INDEX, ICU_E_PARAM_CHANNEL);
	}
	else

#endif /* (ICU_DEV_ERROR_DETECT == STD_ON) */
	{

	/* ----- Implementation ----------------------------------------------- */
	return_value = Icu_TsBuffer_at[Channel].BufferIndex;
	}

    return(return_value);
}/* Icu_GetTimestampIndex() */
#endif /* (STD_ON == ICU_TIMESTAMP_API) */



#if (STD_ON == ICU_EDGE_COUNT_API)
/***********************************************************************************************************************
 *  Icu_ResetEdgeCount()
 **********************************************************************************************************************/
/*! \brief      This service resets the counted edges on the given channel.
 *
 *  \param[in]  Channel                 Numeric identifier of the Icu channel
 *  \pre        Channel has to be a valid channel number.
 *  \pre        Channel must be an Edge Counting channel.
 *  \context    Function shall be called from task level
 **********************************************************************************************************************/
/* SourceId : ICU_SourceId_023 */
/* DesignId : ICU_DesignId_26  */
/* Requirements : AR_ICU_SR175,AR_ICU_SR176,AR_ICU_SR177,AR_ICU_SR180 */
FUNC(void, ICU_CODE) Icu_ResetEdgeCount(Icu_ChannelType Channel)
{

    /* ----- Development Error Checks ------------------------------------- */
#if(ICU_DEV_ERROR_DETECT == STD_ON)
	if(FALSE == Icu_ModuleInitialized_u8)
	{
			(void)Icu_Errorhook(ICU_SID_RESET_EDGE_COUNT, ICU_E_UNINIT);
	}
	else if(
		(Channel >= Icu_NoOfChannels_u8) ||
		(ICU_MODE_EDGE_COUNTER != (Icu_ConfigSet_pt->Icu_ChannelConfig_at[Channel].Icu_ChlMeasMode_t))
	  )
	{
			(void)Icu_Errorhook(ICU_SID_RESET_EDGE_COUNT, ICU_E_PARAM_CHANNEL);
	}
	else

#endif /* (ICU_DEV_ERROR_DETECT == STD_ON) */
	{
    /* ----- Implementation ----------------------------------------------- */

    /* Reset local buffer */
    Icu_CurrEdgeCount_at[Channel] = 0U;

    /* Reset value in NHET RAM */
    Icu_Rambase->Instruction[Channel + 1U].Data_u32 = 0U;

	}
}/* Icu_ResetEdgeCount() */

/***********************************************************************************************************************
 *  Icu_EnableEdgeCount()
 **********************************************************************************************************************/
/*! \brief      This service enables the counting of edges on the given channel.
 *
 *  \param[in]  Channel                 Numeric identifier of the Icu channel
 *  \pre        Channel has to be a valid channel number.
 *  \pre        Channel must be an Edge Counting channel.
 *  \context    Function shall be called from task level
 **********************************************************************************************************************/
/* SourceId : ICU_SourceId_024 */
/* DesignId : ICU_DesignId_27  */
/* Requirements : AR_ICU_SR181,AR_ICU_SR182,AR_ICU_SR183,AR_ICU_SR184,AR_ICU_SR185,AR_ICU_SR188 */
FUNC(void, ICU_CODE) Icu_EnableEdgeCount(Icu_ChannelType Channel)
{

    /* ----- Development Error Checks ------------------------------------- */
#if(ICU_DEV_ERROR_DETECT == STD_ON)
	if(FALSE == Icu_ModuleInitialized_u8)
	{
			(void)Icu_Errorhook(ICU_SID_ENABLE_EDGE_COUNT, ICU_E_UNINIT);
	}
	else if(
		(Channel >= Icu_NoOfChannels_u8) ||
		( ICU_MODE_EDGE_COUNTER != (Icu_ConfigSet_pt->Icu_ChannelConfig_at[Channel].Icu_ChlMeasMode_t))
	  )
	{
			(void)Icu_Errorhook(ICU_SID_ENABLE_EDGE_COUNT, ICU_E_PARAM_CHANNEL);
	}
	else

#endif /* (ICU_DEV_ERROR_DETECT == STD_ON) */
	{
    /* ----- Implementation ----------------------------------------------- */

    /* Write last data value into the NHET RAM instruction */
    Icu_Rambase->Instruction[Channel + 1U].Data_u32 = ((Icu_CurrEdgeCount_at[Channel]) << 7U);

    /* Enable channel in the channel state array */
    Icu_ChlRunState_au8[Channel] = STD_ON;
	}

}/* Icu_EnableEdgeCount() */

/***********************************************************************************************************************
 *  Icu_DisableEdgeCount()
 **********************************************************************************************************************/
/*! \brief      This service disables the counting of edges on the given channel.
 *
 *  \param[in]  Channel                 Numeric identifier of the Icu channel
 *  \pre        Channel has to be a valid channel number.
 *  \pre        Channel must be an Edge Counting channel.
 *  \context    Function shall be called from task level
 **********************************************************************************************************************/
/* SourceId : ICU_SourceId_027 */
/* DesignId : ICU_DesignId_30  */
/* Requirements : AR_ICU_SR203,AR_ICU_SR204,AR_ICU_SR205,AR_ICU_SR208 */
FUNC(void, ICU_CODE) Icu_DisableEdgeCount(Icu_ChannelType Channel)
{

    /* ----- Development Error Checks ------------------------------------- */
#if(ICU_DEV_ERROR_DETECT == STD_ON)
	if(FALSE == Icu_ModuleInitialized_u8)
	{
			(void)Icu_Errorhook(ICU_SID_DISABLE_EDGE_COUNT, ICU_E_UNINIT);
	}
	else if(
		(Channel >= Icu_NoOfChannels_u8) ||
		( ICU_MODE_EDGE_COUNTER != (Icu_ConfigSet_pt->Icu_ChannelConfig_at[Channel].Icu_ChlMeasMode_t))
	  )
	{
			(void)Icu_Errorhook(ICU_SID_DISABLE_EDGE_COUNT, ICU_E_PARAM_CHANNEL);
	}
	else
#endif /* (ICU_DEV_ERROR_DETECT == STD_ON) */
	{
    /* ----- Implementation ----------------------------------------------- */

    /* Retrieve value from the NHET RAM and store it  */
    Icu_CurrEdgeCount_at[Channel] = ((Icu_Rambase->Instruction[Channel + 1U].Data_u32) >> 7U);

    /* Disable channel in the channel state array */
    Icu_ChlRunState_au8[Channel] = STD_OFF;

	}
}/* Icu_DisableEdgeCount() */

/***********************************************************************************************************************
 *  Icu_GetEdgeNumbers()
 **********************************************************************************************************************/
/*! \brief      This service reads the number of counted edges of the given channel.
 *
 *  \param[in]  Channel                 Numeric identifier of the Icu channel
 *  \return     Edge number
 *  \pre        Channel has to be a valid channel number.
 *  \pre        Channel must be an Edge Counting channel.
 *  \context    Function shall be called from task level
 **********************************************************************************************************************/
/* SourceId : ICU_SourceId_028 */
/* DesignId : ICU_DesignId_31  */
/* Requirements : AR_ICU_SR209,AR_ICU_SR210,AR_ICU_SR211,AR_ICU_SR214,AR_ICU_SR215 */
FUNC(Icu_EdgeNumberType, ICU_CODE) Icu_GetEdgeNumbers(Icu_ChannelType Channel)
{
	Icu_EdgeNumberType Return_Value = 0U;
    /* ----- Development Error Checks ------------------------------------- */
#if(ICU_DEV_ERROR_DETECT == STD_ON)
	if(FALSE == Icu_ModuleInitialized_u8)
	{
			(void)Icu_Errorhook(ICU_SID_GET_EDGE_NUMBERS, ICU_E_UNINIT);
	}
	else if(
		(Channel >= Icu_NoOfChannels_u8) ||
		(ICU_MODE_EDGE_COUNTER != (Icu_ConfigSet_pt->Icu_ChannelConfig_at[Channel].Icu_ChlMeasMode_t))
	  )
	{
			(void)Icu_Errorhook(ICU_SID_GET_EDGE_NUMBERS, ICU_E_PARAM_CHANNEL);
	}
	else
#endif /* (ICU_DEV_ERROR_DETECT == STD_ON) */
	{
		/* ----- Implementation ----------------------------------------------- */

		/* Check of the counter is running */
		if(STD_ON == Icu_ChlRunState_au8[Channel])
		{
			/* Channel is running - Retrieve current counter value and store it */
			Icu_CurrEdgeCount_at[Channel] = ((Icu_Rambase->Instruction[Channel + 1U].Data_u32) >> 7U);
		}
		Return_Value = Icu_CurrEdgeCount_at[Channel];

	}
	/* Return the value */
    return(Return_Value);

}/* Icu_GetEdgeNumbers() */
#endif /* (STD_ON == ICU_EDGE_COUNT_API) */



#if (STD_ON == ICU_SIGNAL_MEASUREMENT_API)
/***********************************************************************************************************************
 *  Icu_StartSignalMeasurement()
 **********************************************************************************************************************/
/*! \brief      This service starts the capturing of a periodic signal on the given channel. The capturing itself
 *              starts on the first 'default start edge', which occurrs after the call of this function.
 *
 *  \param[in]  Channel                 Numeric identifier of the Icu channel
 *  \pre        Channel has to be a valid channel number.
 *  \pre        Channel must be an Signal Measurement channel.
 *  \context    Function shall be called from task level
 **********************************************************************************************************************/
/* SourceId : ICU_SourceId_029 */
/* DesignId : ICU_DesignId_32  */
/* Requirements : AR_ICU_SR216,AR_ICU_SR217,AR_ICU_SR218,AR_ICU_SR219,AR_ICU_SR220,AR_ICU_SR223 */
FUNC(void, ICU_CODE) Icu_StartSignalMeasurement(Icu_ChannelType Channel)
{

    /* ----- Development Error Checks ------------------------------------- */
#if(ICU_DEV_ERROR_DETECT == STD_ON)
	if(FALSE == Icu_ModuleInitialized_u8)
	{
			(void)Icu_Errorhook(ICU_SID_START_SIG_MEASUREMENT, ICU_E_UNINIT);
	}
	else if(
		(Channel >= Icu_NoOfChannels_u8) ||
		(ICU_MODE_SIGNAL_MEASUREMENT != (Icu_ConfigSet_pt->Icu_ChannelConfig_at[Channel].Icu_ChlMeasMode_t))
	  )
	{
			(void)Icu_Errorhook(ICU_SID_START_SIG_MEASUREMENT, ICU_E_PARAM_CHANNEL);
	}
	else

#endif /* (ICU_DEV_ERROR_DETECT == STD_ON) */
	{
    /* ----- Implementation ----------------------------------------------- */

		/* Clear Flag */
		/*SAFETYMCUSW 93 S MR:6.1,6.2,10.1,10.2,10.3,10.4 <APPROVED> "Register Pointer is used here" */
		ICU_HETFLG(Icu_Regbase) = (uint32)(1U << (Channel + 1U));

		/* Enable interrupt */
		/*SAFETYMCUSW 93 S MR:6.1,6.2,10.1,10.2,10.3,10.4 <APPROVED> "Register Pointer is used here" */
		ICU_HETINTENAS(Icu_Regbase) = (uint32)(1U << (Channel + 1U));

		/* Enable channel in the channel state array */
		Icu_ChlRunState_au8[Channel] = STD_ON;
	}

}/* Icu_StartSignalMeasurement() */

/***********************************************************************************************************************
 *  Icu_StopSignalMeasurement()
 **********************************************************************************************************************/
/*! \brief      This service stops the capturing of a periodic signal on the given channel.
 *
 *  \param[in]  Channel                 Numeric identifier of the Icu channel
 *  \pre        Channel has to be a valid channel number.
 *  \pre        Channel must be an Signal Measurement channel.
 *  \context    Function shall be called from task level
 **********************************************************************************************************************/
/* SourceId : ICU_SourceId_030 */
/* DesignId : ICU_DesignId_33  */
/* Requirements : AR_ICU_SR224,AR_ICU_SR225,AR_ICU_SR226,AR_ICU_SR227,AR_ICU_SR230 */
FUNC(void, ICU_CODE) Icu_StopSignalMeasurement(Icu_ChannelType Channel)
{

    /* ----- Development Error Checks ------------------------------------- */
#if(ICU_DEV_ERROR_DETECT == STD_ON)
	if(FALSE == Icu_ModuleInitialized_u8)
	{
			(void)Icu_Errorhook(ICU_SID_STOP_SIG_MEASUREMENT, ICU_E_UNINIT);
	}
	else if(
		(Channel >= Icu_NoOfChannels_u8) ||
		(ICU_MODE_SIGNAL_MEASUREMENT != (Icu_ConfigSet_pt->Icu_ChannelConfig_at[Channel].Icu_ChlMeasMode_t))
	  )
	{
			(void)Icu_Errorhook(ICU_SID_STOP_SIG_MEASUREMENT, ICU_E_PARAM_CHANNEL);
	}
	else
#endif /* (ICU_DEV_ERROR_DETECT == STD_ON) */
	{
    /* ----- Implementation ----------------------------------------------- */

    /* Disable Interrupt */
    /*SAFETYMCUSW 93 S MR:6.1,6.2,10.1,10.2,10.3,10.4 <APPROVED> "Register Pointer is used here" */
    ICU_HETINTENAC(Icu_Regbase) = (uint32)(1U << (Channel + 1U));

    /* Disable channel in the channel state array */
    Icu_ChlRunState_au8[Channel] = STD_OFF;

	}
}/* Icu_StopSignalMeasurement() */
#endif /* (STD_ON == ICU_SIGNAL_MEASUREMENT_API) */



#if (STD_ON == ICU_GET_TIME_ELAPSED_API)
/***********************************************************************************************************************
 *  Icu_GetTimeElapsed()
 **********************************************************************************************************************/
/*! \brief      This service reads the elapsed Signal Low Time for the given channel that is configured in Measurement
 *              Mode 'Signal Measurement, Signal Low Time'. The elapsed time is measured between a falling edge and the
 *              consecutive rising edge of the channel.
 *              This service reads the elapsed Signal High Time for the given channel that is configured in Measurement
 *              Mode 'Signal Measurement, Signal High Time'. The elapsed time is measured between a rising edge and the
 *              consecutive falling edge of the channel.
 *              This service reads the elapsed Signal Period Time for the given channel that is configured in
 *              Mode 'Signal Measurement, Signal Period Time'. The elapsed time is measured between consecutive rising
 *              (or falling) edges of the channel. The period start edge is configurable.
 *
 *  \param[in]  Channel                 Numeric identifier of the Icu channel
 *  \return     Low time/high time/period time
 *  \pre        Channel has to be a valid channel number.
 *  \pre        Channel must be an Signal Measurement channel.
 *  \context    Function shall be called from task level
 **********************************************************************************************************************/
/* SourceId : ICU_SourceId_017 */
/* DesignId : ICU_DesignId_34  */
/* Requirements : AR_ICU_SR231,AR_ICU_SR232,AR_ICU_SR233,AR_ICU_SR234,AR_ICU_SR235,AR_ICU_SR236,AR_ICU_SR237,
 *                AR_ICU_SR238,AR_ICU_SR241,AR_ICU_SR242 */
FUNC(Icu_ValueType, ICU_CODE) Icu_GetTimeElapsed(Icu_ChannelType Channel)
{
    /* ----- Function Local Variables ------------------------------------- */
	Icu_ValueType Value_u32 = 0U;

    /* ----- Development Error Checks ------------------------------------- */
#if(ICU_DEV_ERROR_DETECT == STD_ON)
	if(FALSE == Icu_ModuleInitialized_u8)
	{
			(void)Icu_Errorhook(ICU_SID_GET_TIME_ELAPSED, ICU_E_UNINIT);
	}
	else if(
		(Channel >= Icu_NoOfChannels_u8) ||
		(ICU_MODE_SIGNAL_MEASUREMENT != (Icu_ConfigSet_pt->Icu_ChannelConfig_at[Channel].Icu_ChlMeasMode_t))
	  )
	{
			(void)Icu_Errorhook(ICU_SID_GET_TIME_ELAPSED, ICU_E_PARAM_CHANNEL);
	}
	else
#endif /* (ICU_DEV_ERROR_DETECT == STD_ON) */
	{
		/* ----- Implementation ----------------------------------------------- */
		Value_u32 = (Icu_ValueType)(Icu_Rambase->Instruction[Channel + 1U].Data_u32 >> 7U);
		Icu_Rambase->Instruction[Channel + 1U].Data_u32 = 0U;
	}
    return(Value_u32);

}/* Icu_GetTimeElapsed() */
#endif /* (STD_ON == ICU_GET_TIME_ELAPSED_API) */



#if (STD_ON == ICU_GET_DUTY_CYCLE_VALUES_API)
/***********************************************************************************************************************
 *  Icu_GetDutyCycleValues()
 **********************************************************************************************************************/
/*! \brief      This service reads the coherent active time and period time for the given ICU Channel, if it is
 *              configured in Measurement Mode 'Signal Measurement, Duty Cycle Values'.
 *  \param[in]  Channel                 Numeric identifier of the Icu channel
 *  \param[in]  DutyCycleValues         Pointer to a buffer where the results (high time and period time) shall be
 *                                      placed
 *  \pre        Channel has to be a valid channel number.
 *  \pre        Channel must be an Signal Measurement channel.
 *  \pre        DutyCycleValues must not be NULL_PTR.
 *  \context    Function shall be called from task level
 **********************************************************************************************************************/
/* SourceId : ICU_SourceId_032 */
/* DesignId : ICU_DesignId_35  */
/* Requirements : AR_ICU_SR243,AR_ICU_SR244,AR_ICU_SR245,AR_ICU_SR246,AR_ICU_SR247,AR_ICU_SR248,AR_ICU_SR251,
 *                AR_ICU_SR252 */
FUNC(void, ICU_CODE) Icu_GetDutyCycleValues
(
        Icu_ChannelType Channel,
        P2VAR(Icu_DutyCycleType, ICU_VAR_FAST, ICU_APPL_DATA) DutyCycleValues
)
{

    /* ----- Development Error Checks ------------------------------------- */
#if(ICU_DEV_ERROR_DETECT == STD_ON)
	if(FALSE == Icu_ModuleInitialized_u8)
	{
			(void)Icu_Errorhook(ICU_SID_GET_DUTY_CYCLE_VALUES, ICU_E_UNINIT);
	}
	else if(
		(Channel >= Icu_NoOfChannels_u8) ||
		(ICU_MODE_SIGNAL_MEASUREMENT != (Icu_ConfigSet_pt->Icu_ChannelConfig_at[Channel].Icu_ChlMeasMode_t))
	  )
	{
			(void)Icu_Errorhook(ICU_SID_GET_DUTY_CYCLE_VALUES, ICU_E_PARAM_CHANNEL);
	}
	else if(DutyCycleValues == NULL_PTR)
	{
			(void)Icu_Errorhook(ICU_SID_GET_DUTY_CYCLE_VALUES, ICU_E_PARAM_BUFFER_PTR);
	}
	else

#endif /* (ICU_DEV_ERROR_DETECT == STD_ON) */
	{
		/* ----- Implementation ----------------------------------------------- */

		Icu_GlobalSuspend();
		DutyCycleValues->ActiveTime = (Icu_Rambase->Instruction[Channel + 1U].Data_u32 >> 7U);
		DutyCycleValues->PeriodTime = (Icu_Rambase->Instruction[Channel + 33U].Data_u32 >> 7U);

		Icu_Rambase->Instruction[Channel + 1U].Data_u32   = 0U;
		Icu_Rambase->Instruction[Channel + 33U].Data_u32  = 0U;
		Icu_GlobalRestore();

	}
}/* Icu_GetDutyCycleValues() */
#endif /* (STD_ON == ICU_GET_DUTY_CYCLE_VALUES_API) */

#if (ICU_EDGE_DETECTION_API == STD_ON)
/***********************************************************************************************************************
 *  Icu_EnableEdgeDetection()
 **********************************************************************************************************************/
/*! \brief      This service starts the detection of edges configured as 'default start edge',
 *              which occurrs after the call of this function.
 *
 *  \param[in]  Channel                 Numeric identifier of the Icu channel
 *  \pre        Channel has to be a valid channel number.
 *  \pre        Channel must be an Edge Detection channel.
 *  \context    Function shall be called from task level
 **********************************************************************************************************************/
/* SourceId : ICU_SourceId_025 */
/* DesignId : ICU_DesignId_28  */
/* Requirements : AR_ICU_SR189,AR_ICU_SR190,AR_ICU_SR191,AR_ICU_SR192,AR_ICU_SR193,AR_ICU_SR196 */
FUNC(void, ICU_CODE) Icu_EnableEdgeDetection(Icu_ChannelType Channel)
{

	/* ----- Development Error Checks ------------------------------------- */
#if(ICU_DEV_ERROR_DETECT == STD_ON)
	if(FALSE == Icu_ModuleInitialized_u8)
	{
			(void)Icu_Errorhook(ICU_SID_ENABLE_EDGE_DETECT, ICU_E_UNINIT);
	}
	else if(
		(Channel >= Icu_NoOfChannels_u8) ||
		( ICU_MODE_SIGNAL_EDGE_DETECT != (Icu_ConfigSet_pt->Icu_ChannelConfig_at[Channel].Icu_ChlMeasMode_t))
	  )
	{
			(void)Icu_Errorhook(ICU_SID_ENABLE_EDGE_DETECT, ICU_E_PARAM_CHANNEL);
	}
	else

#endif /* (ICU_DEV_ERROR_DETECT == STD_ON) */
	{
	/* ----- Implementation ----------------------------------------------- */
	/* Clear Flag */
	   /*SAFETYMCUSW 93 S MR:6.1,6.2,10.1,10.2,10.3,10.4 <APPROVED> "Register Pointer is used here" */
	   ICU_HETFLG(Icu_Regbase) = (uint32)(1U << (Channel + 1U));

	   /* Enable interrupt */
	   /*SAFETYMCUSW 93 S MR:6.1,6.2,10.1,10.2,10.3,10.4 <APPROVED> "Register Pointer is used here" */
	   ICU_HETINTENAS(Icu_Regbase) = (uint32)(1U << (Channel + 1U));

	   /* Enable channel in the channel state array */
	   Icu_ChlRunState_au8[Channel] = STD_ON;
	}

}/*Icu_EnableEdgeDetection()*/

/***********************************************************************************************************************
 *  Icu_DisableEdgeDetection()
 **********************************************************************************************************************/
/*! \brief      This service stops the detection of edges on the given channel after the call of this function.
 *
 *  \param[in]  Channel                 Numeric identifier of the Icu channel
 *  \pre        Channel has to be a valid channel number.
 *  \pre        Channel must be an Edge Detection channel.
 *  \context    Function shall be called from task level
 **********************************************************************************************************************/
/* SourceId : ICU_SourceId_026 */
/* DesignId : ICU_DesignId_29  */
/* Requirements : AR_ICU_SR197,AR_ICU_SR198,AR_ICU_SR199,AR_ICU_SR202 */
  FUNC(void, ICU_CODE) Icu_DisableEdgeDetection(Icu_ChannelType Channel)
{

/* ----- Development Error Checks ------------------------------------- */
#if(ICU_DEV_ERROR_DETECT == STD_ON)
	if(FALSE == Icu_ModuleInitialized_u8)
	{
			(void)Icu_Errorhook(ICU_SID_DISABLE_EDGE_DETECT, ICU_E_UNINIT);
	}
	else if(
		(Channel >= Icu_NoOfChannels_u8) ||
		( ICU_MODE_SIGNAL_EDGE_DETECT != (Icu_ConfigSet_pt->Icu_ChannelConfig_at[Channel].Icu_ChlMeasMode_t))
	  )
	{
			(void)Icu_Errorhook(ICU_SID_DISABLE_EDGE_DETECT, ICU_E_PARAM_CHANNEL);
	}
	else

#endif /* (ICU_DEV_ERROR_DETECT == STD_ON) */
	{
	    /* ----- Implementation ----------------------------------------------- */
	   /* Disable interrupt */
	   /*SAFETYMCUSW 93 S MR:6.1,6.2,10.1,10.2,10.3,10.4 <APPROVED> "Register Pointer is used here" */
	   ICU_HETINTENAC(Icu_Regbase) = (uint32)(1U << (Channel + 1U));

	   /* Disable channel in the channel state array */
	   Icu_ChlRunState_au8[Channel] = STD_OFF;
	}

}/*Icu_DisableEdgeDetection()*/
#endif/*ICU_EDGE_DETECTION_API == STD_ON*/

#if (STD_ON == ICU_GET_VERSION_INFO_API)
/***********************************************************************************************************************
 *  Icu_GetVersionInfo()
 **********************************************************************************************************************/
/*! \brief      This service returns the version information of this module. The version information includes:
 *              - Module Id
 *              - Vendor Id
 *              - Vendor specific version numbers
 *  \param[out] versioninfo             Pointer to where to store the version information of this module
 *  \pre        Versioninfo parameter must not be NULL_PTR.
 *  \context    Function shall be called from task level
 **********************************************************************************************************************/
/* SourceId : ICU_SourceId_033 */
/* DesignId : ICU_DesignId_38  */
/* Requirements : AR_ICU_SR253,AR_ICU_SR254,AR_ICU_SR255 */
FUNC(void, ICU_CODE) Icu_GetVersionInfo
(
        P2VAR(Std_VersionInfoType, AUTOMATIC, ICU_APPL_DATA) versioninfo
)
{

	/* ----- Development Error Checks ------------------------------------- */
#if(ICU_DEV_ERROR_DETECT == STD_ON)
	if(versioninfo == NULL_PTR)
	{
			(void)Icu_Errorhook(ICU_SID_GET_VERSION_INFO, ICU_E_PARAM_VINFO);
	}
	else

#endif /* (ICU_DEV_ERROR_DETECT == STD_ON) */
	{

    /* ----- Implementation ----------------------------------------------- */

		versioninfo->vendorID         = (uint16) ICU_VENDOR_ID;
		versioninfo->moduleID         = (uint16)  ICU_MODULE_ID;
		versioninfo->sw_major_version = (uint8)  ICU_SW_MAJOR_VERSION;
		versioninfo->sw_minor_version = (uint8)  ICU_SW_MINOR_VERSION;
		versioninfo->sw_patch_version = (uint8)  ICU_SW_PATCH_VERSION;
	}

}/* Icu_GetVersionInfo() */
#endif /* (STD_ON == ICU_GET_VERSION_INFO_API) */


#if (STD_ON == ICU_SAFETI_API)
/**********************************************************************************************************************
 *   Function Name : Icu_ConfigRegReadBack
 *********************************************************************************************************************/
/*! \Description: Register readback to check if static registers have expected values.
 *
 *  \param[in]  : Icu_HetType      Het                    HET to read configuration registers from.
 *  \param[out] : IcuConfigReg*    IcuConfigReg_pt        Pointer to where to store the register
 *                                                        values which are to be read.
 *  \return     : uint8            Dev_Error_Detect       Value of error if present. 0 otherwise.
 *  \context    : Function is called from top layer applications.
 *********************************************************************************************************************/
/* SourceId : ICU_SourceId_036 */
/* DesignId : ICU_DesignId_39  */
/* Requirements : AR_ICU_SR313 */

FUNC(Std_ReturnType, ICU_CODE) Icu_ConfigRegReadBack(Icu_HetType Het, IcuConfigReg* IcuConfigReg_pt)
{
	Std_ReturnType Dev_Error_Detect = E_NOT_OK;
	uint32 HetRegAddr = 0U;
   /*SAFETYMCUSW 440 S MR:11.3 <APPROVED> "Reason - NULL_PTR comes from Compiler.h" */
   if ( NULL_PTR == IcuConfigReg_pt )
   {

   }
   else if((Het != NHET1)
		   && (Het != NHET2)
		   )
   {

   }
#if ( STD_ON == ICU_DEV_ERROR_DETECT )
   /*SAFETYMCUSW 440 S MR:11.3 <APPROVED> "Reason - NULL_PTR comes from Compiler.h" */
   else if(TRUE != Icu_ModuleInitialized_u8)
   {

   }
#endif

   else
   {
	   if( NHET2 == Het )
	   {
		   HetRegAddr = (uint32)ICU_HET2_REG_ADDR;
	   }
	   else
	   {
		   HetRegAddr = (uint32)ICU_HET1_REG_ADDR;
	   }
	   IcuConfigReg_pt->Icu_ReadBack_GCR  = HET_CGR(HetRegAddr);/*Reg address of GCR*/
	   IcuConfigReg_pt->Icu_ReadBack_PFR  = HET_PFR(HetRegAddr);/*Reg address of PFR*/
	   IcuConfigReg_pt->Icu_ReadBack_PRY  = HET_PRY(HetRegAddr);/*Reg address of PRY*/
	   IcuConfigReg_pt->Icu_ReadBack_DIR  = HET_DIR(HetRegAddr);/*Reg address of DIR*/
	   IcuConfigReg_pt->Icu_ReadBack_PDR  = HET_PDR(HetRegAddr);/*Reg address of PDR*/
	   IcuConfigReg_pt->Icu_ReadBack_PDIS = HET_PULLDIS(HetRegAddr);/*Reg address of PDIS*/
	   IcuConfigReg_pt->Icu_ReadBack_PSL  = HET_PSL(HetRegAddr);/*Reg address of PSL*/

	   Dev_Error_Detect = E_OK;
   }
   return Dev_Error_Detect;
}

#endif

/***********************************************************************************************************************
 *  Icu_IrqFunction()
 **********************************************************************************************************************/
/*! \brief      This service is the global interrupt handler that is called first on an occurring interrupt. It
 *              determines which functionality is configured for the caller hardware-channel and forwards the event
 *              to the corresponding interrupt handler that executes edge counting, timestamping, edge detection or
 *              signal measurement functionality.
 *  \context    Function shall be called from interrupt level.
 **********************************************************************************************************************/
/*SAFETYMCUSW 69 S MR:3.4 <APPROVED> "Reason - pragma is required here to force code state to 32 bits"*/
#pragma CODE_STATE(Icu_IrqFunction, 32)
FUNC(void, ICU_CODE) Icu_IrqFunction(void)
{
    /* ----- Function Local Variables ------------------------------------- */
    uint32 IrqNumber;

    /* ----- Implementation ----------------------------------------------- */

    /* Retrieve interrupt offset from offset register */
    IrqNumber = ((ICU_HETOFF1(Icu_Regbase)) - 2U);

    /* Check if interrupt is an overflow interrupt */
    if(IrqNumber == ICU_OVERFLOW_IRQ)
    {
        Icu_IrqOverflow();
    }

    /* Check if the interrupt is an ICU interrupt */
    if(IrqNumber < Icu_NoOfChannels_u8)
    {

#if(ICU_SET_MODE_API == STD_ON)
    /* Check if module is in sleep mode */
    if(TRUE == Icu_SleepMode_u8)
    {
        /* Module is in sleep mode - call wake-up notification with configured wake-up identifier */
        Icu_CheckWakeup(Icu_ConfigSet_pt->Icu_ChannelConfig_at[IrqNumber].Icu_EcuMWakeupIdent);
    }
#endif /* (ICU_SET_MODE_API == STD_ON) */

#if (ICU_GET_INPUT_STATE_API == STD_ON)
    /* Set channel input state to 'active' */
    Icu_ChlInputState_at[IrqNumber] = ICU_ACTIVE;
#endif /* (ICU_GET_INPUT_STATE_API == STD_ON) */

    /* Switch to the dedicated interrupt handler for the current channel */
    Icu_IrqModeSwitch[Icu_ConfigSet_pt->Icu_ChannelConfig_at[IrqNumber].Icu_ChlMeasMode_t](IrqNumber);
    }
} /* Icu_IrqFunction() */



/***********************************************************************************************************************
 *  Icu_IrqOverflow()
 **********************************************************************************************************************/
/*! \brief      This service is the global interrupt handler for timer overflows. On an occuring timer interrupt it
 * calls all the configured overflow notifications.
 *  \context    Function shall be called from interrupt level
 **********************************************************************************************************************/
/*SAFETYMCUSW 69 S MR:3.4 <APPROVED> "Reason - pragma is required here to force code state to 32 bits"*/
#pragma CODE_STATE(Icu_IrqOverflow, 32)
static FUNC(void, ICU_CODE) Icu_IrqOverflow(void)
{
    /* ----- Implementation ----------------------------------------------- */

    /* Call the configured overflow notification */
    Icu_GlobalOvNotification();

} /* Icu_OvIrqFunction() */


/**********************************************************************************************************************
 *  LOCAL FUNCTIONS
 **********************************************************************************************************************/

/***********************************************************************************************************************
 *  Icu_IrqEdgeDetection()
 **********************************************************************************************************************/
/*! \brief      This service is the mode-specific handler for Edge Detection interrupts.
 *  \param[in]  IrqNumber               Number of the interrupt source
 *  \context    Function shall be called from interrupt level
 **********************************************************************************************************************/
static FUNC(void, ICU_CODE) Icu_IrqEdgeDetection(uint32 IrqNumber)
{
    /* ----- Implementation ----------------------------------------------- */
#if(ICU_EDGE_DETECTION_API == STD_ON)

    if(STD_ON == Icu_NotificationConf_au8[IrqNumber])
    {
        /* Notification is enabled for the channel - call the configured notification */
        Icu_ConfigSet_pt->Icu_ChannelConfig_at[IrqNumber].Icu_Notify_pt();
    }

#endif /* (ICU_EDGE_DETECTION_API == STD_ON) */
} /* Icu_IrqEdgeDetection() */



/***********************************************************************************************************************
 *  Icu_IrqTimestamping()
 **********************************************************************************************************************/
/*! \brief      This service is the mode-specific handler for Timestamping interrupts.
 *  \param[in]  IrqNumber               Number of the interrupt source
 *  \context    Function shall be called from interrupt level
 **********************************************************************************************************************/
static FUNC(void, ICU_CODE) Icu_IrqTimestamping(uint32 IrqNumber)
{
    /* ----- Implementation ----------------------------------------------- */
	/*SAFETYMCUSW 45 D MR:21.1 <APPROVED> "Reason - Pointer is checked at the beginning of calling function" */
#if(ICU_TIMESTAMP_API == STD_ON)
	/*SAFETYMCUSW 45 D MR:21.1 <APPROVED> "Reason - Pointer is checked at the beginning of calling function" */
    /* Store current Timestamp value */
    (Icu_TsBuffer_at[IrqNumber].BufferPtr)[Icu_TsBuffer_at[IrqNumber].BufferIndex] =
	/*SAFETYMCUSW 45 D MR:21.1 <APPROVED> "Reason - Pointer is checked at the beginning of init function" */
        ((Icu_Rambase->Instruction[IrqNumber+1].Data_u32) >> 7U);
	/*SAFETYMCUSW 45 D MR:21.1 <APPROVED> "Reason - Pointer is checked at the beginning of calling function" */
    /* Is notification mechanism enabled? */
    if(
        ((Icu_TsBuffer_at[IrqNumber].NotifyInterval) != 0U) &&
        (Icu_NotificationConf_au8[IrqNumber] == STD_ON)
      )
    {
        /* Check if notification period end is reached */
        if(Icu_TsBuffer_at[IrqNumber].NotifyCnt == ((Icu_TsBuffer_at[IrqNumber].NotifyInterval) - 1U))
        {
            /* Call notification function */
            /*SAFETYMCUSW 57 S MR:14.2 <APPROVED> "Statement calls notification function" */
            (Icu_ConfigSet_pt->Icu_ChannelConfig_at[IrqNumber].Icu_Notify_pt)();
            /* Reset Notification counter */
            Icu_TsBuffer_at[IrqNumber].NotifyCnt = 0U;
        }
        else
        {
            /* Increment notification counter */
            Icu_TsBuffer_at[IrqNumber].NotifyCnt++;
        }
    }

    /* Check for buffer end */
    if((Icu_TsBuffer_at[IrqNumber].BufferIndex) == ((Icu_TsBuffer_at[IrqNumber].BufferSize) - 1U))
    {
        /* Buffer end is reachen - Check buffer type */
        if(ICU_CIRCULAR_BUFFER == (Icu_ConfigSet_pt->Icu_ChannelConfig_at[IrqNumber].Icu_CommonPropertyStore_u8))
        {
            /* Reset buffer to the beginning */
            Icu_TsBuffer_at[IrqNumber].BufferIndex = 0U;
        }
        else
        {
            /* Disable interrupt on the current channel */
        	/*SAFETYMCUSW 93 S MR:6.1,6.2,10.1,10.2,10.3,10.4 <APPROVED> "Register Pointer is used here" */
            ICU_HETINTENAC(Icu_Regbase) = (uint32)(1U << (IrqNumber + 1U));
            /* Disable channel in the local state array */
            Icu_ChlRunState_au8[IrqNumber] = STD_OFF;
        }
    }
    else
    {
        /* Buffer end is not reached yet - increment buffer index */
        Icu_TsBuffer_at[IrqNumber].BufferIndex++;
    }


#endif /* (ICU_TIMESTAMP_API == STD_ON) */
} /* Icu_IrqTimestamping() */



/***********************************************************************************************************************
 *  Icu_IrqSignalMeasurement()
 **********************************************************************************************************************/
/*! \brief      This service is the mode-specific handler for Signal Measurement interrupts.
 *  \param[in]  IrqNumber               Number of the interrupt source
 *  \context    Function shall be called from interrupt level
 **********************************************************************************************************************/
static FUNC(void, ICU_CODE) Icu_IrqSignalMeasurement(uint32 IrqNumber)
{
    /* ----- Implementation ----------------------------------------------- */
#if(ICU_SIGNAL_MEASUREMENT_API == STD_ON)

    if(STD_ON == Icu_NotificationConf_au8[IrqNumber])
    {
        /* Notification is enabled for the channel - call the configured notification */
        Icu_ConfigSet_pt->Icu_ChannelConfig_at[IrqNumber].Icu_Notify_pt();
    }
#endif /* (ICU_SIGNAL_MEASUREMENT_API == STD_ON) */
} /* Icu_IrqSignalmeasurement() */



/***********************************************************************************************************************
 *  Icu_DoNothing()
 **********************************************************************************************************************/
/*! \brief      Icu_DoNothing() is an empty function that can be called to avoid NULL_PTR checks.
 *  \context    Function shall be called from task level
 **********************************************************************************************************************/
FUNC(void, ICU_CODE) Icu_DoNothing(void)
{
    /*Do Nothing*/
}

/*SAFETYMCUSW 580 S MR:1.1 <APPROVED> "Reason - Memory mapping requires this syntax" */
#undef ICU_STOP_SEC_CODE
#define ICU_STOP_SEC_CODE
#include "MemMap.h"

/**********************************************************************************************************************
 *  END OF FILE: ICU.C
 *********************************************************************************************************************/
 
