/**********************************************************************************************************************
 *  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 - 2014.  All rights reserved.
 *
 *  \endverbatim
 *  -------------------------------------------------------------------------------------------------------------------
 *  FILE DESCRIPTION
 *  -------------------------------------------------------------------------------------------------------------------
 *         File:  fee.c
 *      Project:  Tms570_FEEDriver
 *       Module:  FEE Driver
 *    Generator:  None
 *
 *  Description:  This file implements the Autosar FEE 4.0.3 Api's.
 *---------------------------------------------------------------------------------------------------------------------
 * Author:  Vishwanath Reddy
 *---------------------------------------------------------------------------------------------------------------------
 * Revision History
 *---------------------------------------------------------------------------------------------------------------------
 * Version        Date         Author               Change ID        Description
 *---------------------------------------------------------------------------------------------------------------------
 * 02.21.00       30Sep2014   Vishwanath reddy     SDOCM00113128    Initial Version
 * 02.21.01       30Jun2016   Vishwanath Reddy     SDOCM00122388    Update patch version FEE_SW_PATCH_VERSION.
 * 02.21.02       04Aug2016   Vishwanath Reddy     SDOCM00122571    Update patch version FEE_SW_PATCH_VERSION.
 *                                                                   Return BUSY, if FEE is doing internal operations.
 * 02.21.03       23Aug2016   Vishwanath Reddy     SDOCM00122617    Update patch version FEE_SW_PATCH_VERSION.
 *                                                                   MEMIF_JOB_CANCELLED spelling corrected as per 
 *                                                                   Autosar spec.
 *                                                                   Fee_JobEndNotification and 
 *                                                                   Fee_JobErrorNotification API's added as required 
 *                                                                   by Autosar spec.
 * 02.30.00       01Dec2016    Sudhakar Singh           None         Update version info
 * 05.30.00       15Mar2017    Sudhakar Singh       SDOCM00122834    Version supports TMS570LSxx Family of Devices.
 *********************************************************************************************************************/

 
 /*********************************************************************************************************************
 * INCLUDES
 *********************************************************************************************************************/
#include "Fee.h"
#include "Fee_Cbk.h"
#include "SchM_Fee.h"
#if (FEE_DEV_ERROR_DETECT == STD_ON)
#include "Det.h"
#endif

/**********************************************************************************************************************
 *  VERSION CHECK
 *********************************************************************************************************************/
/* SourceId : FEE_SourceId_001 */
/* DesignId : FEE4x_DesignId_001 */
/* Requirements : AR_FEE_SR23 */
 /* Fee Version Check */
#define FEE_SW_C_MAJOR_VERSION               (5U)
#define FEE_SW_C_MINOR_VERSION               (30U)
#define FEE_SW_C_PATCH_VERSION               (0U)
 
#if (FEE_AR_MAJOR_VERSION != 0x04U)
    #error Fee.c: FEE_AR_MAJOR_VERSION of Fee.h is incompatible.
#endif /* FEE_AR_MAJOR_VERSION */
#if (FEE_AR_MINOR_VERSION != 0x00U)
    #error Fee.c: FEE_AR_MINOR_VERSION of Fee.h is incompatible.
#endif /* FEE_AR_MINOR_VERSION */
#if (FEE_AR_PATCH_VERSION != 0x03U)
    #error Fee.c: FEE_AR_PATCH_VERSION of Fee.h is incompatible.
#endif /* FEE_AR_PATCH_VERSION */
#if (FEE_SW_MAJOR_VERSION != FEE_SW_C_MAJOR_VERSION)
    #error Fee.c: FEE_SW_MAJOR_VERSION of Fee.h is incompatible.
#endif /* FEE_SW_MAJOR_VERSION */
#if (FEE_SW_MINOR_VERSION != FEE_SW_C_MINOR_VERSION)
    #error Fee.c: FEE_SW_MINOR_VERSION of Fee.h is incompatible.
#endif /* FEE_SW_MINOR_VERSION */
#if (FEE_SW_PATCH_VERSION != FEE_SW_C_PATCH_VERSION)
    #error Fee.c: FEE_SW_PATCH_VERSION of Fee.h is incompatible.
#endif /* FEE_SW_PATCH_VERSION */

/**********************************************************************************************************************
 *  Configuration CHECK
 *********************************************************************************************************************/
#if ((FEE_NUMBER_OF_EEPS > 2U))
	#error fee.c: Number of EEP's can't be more than 2.
#endif	


/**********************************************************************************************************************
 *  INTERNAL FUNCTION PROTOTYPES
 *********************************************************************************************************************/
static void Fee_InternalUpdateGlobalStructure(void);
#if(FEE_NUMBER_OF_EEPS == 2U)
static MemIf_StatusType Fee_InternalGetStatus(void);
#endif

/**********************************************************************************************************************
 *  General Global Variables/defines
 *********************************************************************************************************************/
/*SAFETYMCUSW 580 S MR:1.1 <APPROVED> "Reason - This is the format to use for specifying memorysections."*/
#define FEE_START_SEC_CONST_UNSPECIFIED
/*SAFETYMCUSW 338 S MR:19.1 <APPROVED> "Reason - This is the format to use for specifying memorysections."*/
#include "MemMap.h"
/* SourceId : FEE_SourceId_002 */
/* DesignId : FEE4x_DesignId_001 */
/* Requirements : AR_FEE_SR128, AR_FEE_SR129, AR_FEE_SR130, AR_FEE_SR131, AR_FEE_SR132, AR_FEE_SR133,
                  AR_FEE_SR134, AR_FEE_SR135, AR_FEE_SR136 */
/*SAFETYMCUSW 27 D MR:8.10, 8.11<APPROVED> "Reason - Cannot be static since this can be used outside of this file."*/
const Fee_GeneralConfigType Fee_General=
{
    FEE_DEV_ERROR_DETECT,
  	FEE_INDEX,
    FEE_NVM_JOB_END_NOTIFICATION,
    FEE_NVM_JOB_ERROR_NOTIFICATION,
    FEE_POLLING_MODE,
    FEE_VERSION_INFO_API,        
	FEE_VIRTUAL_PAGE_SIZE   
};

/* SourceId : FEE_SourceId_003 */
/* DesignId : FEE4x_DesignId_001 */
/* Requirements : AR_FEE_SR143, AR_FEE_SR144, AR_FEE_SR145, AR_FEE_SR146, AR_FEE_SR147 */
/*SAFETYMCUSW 27 D MR:8.10, 8.11<APPROVED> "Reason - Cannot be static since this can be used outside of this file."*/
const Fee_PublishedInformationType Fee_PublishedInformation =
{
    FEE_BLOCK_OVERHEAD,
    FEE_MAXIMUM_BLOCKING_TIME,
    FEE_PAGE_OVERHEAD,
	FEE_VIRTUAL_SECTOR_OVERHEAD	
};

/*SAFETYMCUSW 580 S MR:1.1 <APPROVED> "Reason - This is the format to use for specifying memorysections."*/
#define FEE_STOP_SEC_CONST_UNSPECIFIED
/*SAFETYMCUSW 338 S MR:19.1 <APPROVED> "Reason - This is the format to use for specifying memorysections."*/
#include "MemMap.h"

/*SAFETYMCUSW 580 S MR:1.1 <APPROVED> "Reason - This is the format to use for specifying memorysections."*/
#define FEE_START_SEC_CODE
/*SAFETYMCUSW 338 S MR:19.1 <APPROVED> "Reason - This is the format to use for specifying memorysections."*/
#include "MemMap.h"

/**********************************************************************************************************************
 *  Fee_Init
 *********************************************************************************************************************/
/*! \brief      This function is used to initialize the TI Fee module.
 *				It determines which Virtual Sector to use, sets up the Flash state machine.
 *  \param[in]  none
 *  \param[out] none
 *  \return     none
 *  \return     none
 *  \context    Function could be called from task level
 *  \note       Autosar FEE API.
 *********************************************************************************************************************/
/* SourceId : FEE_SourceId_004 */
/* DesignId : FEE4x_DesignId_009 */
/* Requirements : AR_FEE_SR8, AR_FEE_SR29, AR_FEE_SR31 */ 
 void Fee_Init(void)
 {
	/* Call TI FEE Initialization API */
	TI_Fee_Init();		
	/* Update job result and module as required by MEMIF */
	Fee_InternalUpdateGlobalStructure();				
 }
 
 /*********************************************************************************************************************
 *  Fee_Write
 *********************************************************************************************************************/
/*! \brief      This function initiates the Write operation to a Block.
 *  \param[in]  uint16 BlockNumber
 *  \param[in]  uint8* DataBufferPtr
 *  \param[out] none
 *  \return     E_NOT_OK
 *  \return     E_OK
 *  \context    Function could be called from task level
 *  \note       Autosar FEE API.
 *********************************************************************************************************************/
/* SourceId : FEE_SourceId_005 */
/* DesignId : FEE4x_DesignId_010 */
/* Requirements : AR_FEE_SR50, AR_FEE_SR51, AR_FEE_SR53, AR_FEE_SR55, AR_FEE_SR56, AR_FEE_SR57, AR_FEE_SR59, 
                  AR_FEE_SR60, AR_FEE_SR61 */ 
 /*SAFETYMCUSW 62 D MR:16.7 <INSPECTED> "Reason - since DataBufferPtr is modified by FEE, it cannot be declared de 
  declared as const."*/
Std_ReturnType Fee_Write(uint16 BlockNumber,uint8* DataBufferPtr)
{
	/*SAFETYMCUSW 331 S MR:10.1 <INSPECTED> "Reason - Std_ReturnType is not part of FEE.This should be fixed 
	  outside of FEE."*/
	Std_ReturnType oResult=E_OK;	
	#if((FEE_NUMBER_OF_EEPS == 2U) && (STD_ON == FEE_DEV_ERROR_DETECT))
	TI_FeeJobResultType FeeJobResult1, FeeJobResult2;	
	#elif((FEE_NUMBER_OF_EEPS == 1U) && (STD_ON == FEE_DEV_ERROR_DETECT))
	TI_FeeJobResultType FeeJobResult1;
	#endif	
	
	
	#if(STD_ON == FEE_DEV_ERROR_DETECT)	
	/* Check if module is Initialized */	
	#if(FEE_NUMBER_OF_EEPS == 2U)
	if(MEMIF_UNINIT == Fee_InternalGetStatus())	
	#elif(FEE_NUMBER_OF_EEPS == 1U)
	if(MEMIF_UNINIT == TI_Fee_GlobalVariables[0].Fee_ModuleState)
	#endif
	{
		/* Module is Not Initialized */		
		(void)Det_ReportError(FEE_MODULE_ID,FEE_INSTANCE_ID,FEE_SID_WRITE,FEE_E_UNINIT);		
		oResult=E_NOT_OK;
	}
	#if(FEE_NUMBER_OF_EEPS == 2U)
	else if(MEMIF_BUSY == Fee_InternalGetStatus())	
	#elif(FEE_NUMBER_OF_EEPS == 1U)
	else if(MEMIF_BUSY == TI_Fee_GlobalVariables[0].Fee_ModuleState)
	#endif
	{
		/* Module is BUSY */	
		(void)Det_ReportError(FEE_MODULE_ID,FEE_INSTANCE_ID,FEE_SID_WRITE,FEE_E_BUSY);		
		oResult=E_NOT_OK;
	}
	else
	#endif
	{	
		/* Store Job Result */
		#if((FEE_NUMBER_OF_EEPS == 2U)&&(STD_ON == FEE_DEV_ERROR_DETECT))
		FeeJobResult1 = TI_Fee_GlobalVariables[0].Fee_u16JobResult;
		FeeJobResult2 = TI_Fee_GlobalVariables[1].Fee_u16JobResult;		
		#elif((FEE_NUMBER_OF_EEPS == 1U)&&(STD_ON == FEE_DEV_ERROR_DETECT))
		FeeJobResult1 = TI_Fee_GlobalVariables[0].Fee_u16JobResult;
		#endif		
		
		/* Call TI FEE Write API */
		oResult = TI_Fee_WriteAsync(BlockNumber,DataBufferPtr);	
		
		/* Update job result and module state as required by MEMIF */
		Fee_InternalUpdateGlobalStructure();
		
		#if(STD_ON == FEE_DEV_ERROR_DETECT)	
		if(Error_InvalidBlockIndex == TI_Fee_GlobalVariables[TI_Fee_u8DeviceIndex].Fee_Error)		
		{
			(void)Det_ReportError(FEE_MODULE_ID,FEE_INSTANCE_ID,FEE_SID_WRITE,FEE_E_INVALID_BLOCK_NO);		
			oResult=E_NOT_OK;	
			/* restore Job Result*/	
			#if(FEE_NUMBER_OF_EEPS == 2U)
			TI_Fee_GlobalVariables[0].Fee_u16JobResult = FeeJobResult1;
			TI_Fee_GlobalVariables[1].Fee_u16JobResult = FeeJobResult2;		
			#elif(FEE_NUMBER_OF_EEPS == 1U)
			TI_Fee_GlobalVariables[0].Fee_u16JobResult = FeeJobResult1;
			#endif
		}
		else 
		{
			if(Error_NullDataPtr == TI_Fee_GlobalVariables[TI_Fee_u8DeviceIndex].Fee_Error)		
			{
				(void)Det_ReportError(FEE_MODULE_ID,FEE_INSTANCE_ID,FEE_SID_WRITE,FEE_E_INVALID_DATA_PTR);		
				oResult=E_NOT_OK;
				/* restore Job Result*/	
				#if(FEE_NUMBER_OF_EEPS == 2U)
				TI_Fee_GlobalVariables[0].Fee_u16JobResult = FeeJobResult1;
				TI_Fee_GlobalVariables[1].Fee_u16JobResult = FeeJobResult2;		
				#elif(FEE_NUMBER_OF_EEPS == 1U)
				TI_Fee_GlobalVariables[0].Fee_u16JobResult = FeeJobResult1;
				#endif	
			}	
		}			
		#endif
	}
	
	return(oResult);
}

/**********************************************************************************************************************
 *  Fee_MainFunction
 *********************************************************************************************************************/
/*! \brief      This function is a cyclic function. It will Write data, Read Data, Invalidate Block, Erase Block,
 *				Copy blocks, Erase Sectors.
 *  \param[in]  none
 *  \param[in]  none
 *  \param[out] none
 *  \return     none 
 *  \context    Function could be called from task level
 *  \note       Autosar FEE API.
 *********************************************************************************************************************/
/* SourceId : FEE_SourceId_006 */
/* DesignId : FEE4x_DesignId_017 */
/* Requirements : AR_FEE_SR13, AR_FEE_SR14, AR_FEE_SR112, AR_FEE_SR113, AR_FEE_SR114, AR_FEE_SR115, AR_FEE_SR116 */
 void Fee_MainFunction(void)
{
	/* Call TI FEE Main API */
	TI_Fee_MainFunction();	
	
	/* Update job result and module as required by MEMIF */
	Fee_InternalUpdateGlobalStructure();		
}

/**********************************************************************************************************************
 *  Fee_Read
 *********************************************************************************************************************/
/*! \brief      This function performs the Read operation on the Block.
 *  \param[in]  uint16 BlockNumber
 *  \param[in]  uint16 BlockOffset
 *  \param[in]  uint8* DataBufferPtr
 *  \param[in]  uint16 Length
 *  \param[out] none
 *  \return     Std_ReturnType 
 *  \context    Function could be called from task level
 *  \note       Autosar FEE API.
 *********************************************************************************************************************/
/* SourceId : FEE_SourceId_007 */
/* DesignId : FEE4x_DesignId_011 */
/* Requirements : AR_FEE_SR12, AR_FEE_SR37, AR_FEE_SR38, AR_FEE_SR40, AR_FEE_SR41, AR_FEE_SR42, AR_FEE_SR43, 
                  AR_FEE_SR44, AR_FEE_SR45, AR_FEE_SR46, AR_FEE_SR47, AR_FEE_SR48, AR_FEE_SR49 */ 
 /*SAFETYMCUSW 62 D MR:16.7 <INSPECTED> "Reason - since DataBufferPtr is modified by FEE, it cannot be declared de 
  declared as const."*/
Std_ReturnType Fee_Read(uint16 BlockNumber,uint16 BlockOffset,uint8* DataBufferPtr,uint16 Length)
{
	/*SAFETYMCUSW 331 S MR:10.1 <INSPECTED> "Reason - Std_ReturnType is not part of FEE.This should be fixed outside
  	  of FEE."*/
	Std_ReturnType oResult=E_OK;
	#if((FEE_NUMBER_OF_EEPS == 2U) && (STD_ON == FEE_DEV_ERROR_DETECT))
	TI_FeeJobResultType FeeJobResult1, FeeJobResult2;	
	#elif((FEE_NUMBER_OF_EEPS == 1U) && (STD_ON == FEE_DEV_ERROR_DETECT))
	TI_FeeJobResultType FeeJobResult1;
	#endif

	#if(STD_ON == FEE_DEV_ERROR_DETECT)	
	/* Check if module is Initialized */	
	#if(FEE_NUMBER_OF_EEPS == 2U)
	if(MEMIF_UNINIT == Fee_InternalGetStatus())	
	#elif(FEE_NUMBER_OF_EEPS == 1U)
	if(MEMIF_UNINIT == TI_Fee_GlobalVariables[0].Fee_ModuleState)
	#endif
	{
		/* Module is Not Initialized */		
		(void)Det_ReportError(FEE_MODULE_ID,FEE_INSTANCE_ID,FEE_SID_READ,FEE_E_UNINIT);		
		oResult=E_NOT_OK;
	}
	#if(FEE_NUMBER_OF_EEPS == 2U)
	else if(MEMIF_BUSY == Fee_InternalGetStatus())	
	#elif(FEE_NUMBER_OF_EEPS == 1U)
	else if(MEMIF_BUSY == TI_Fee_GlobalVariables[0].Fee_ModuleState)
	#endif
	{
		/* Module is BUSY */		
		(void)Det_ReportError(FEE_MODULE_ID,FEE_INSTANCE_ID,FEE_SID_READ,FEE_E_BUSY);		
		oResult=E_NOT_OK;
	}
	else	
	#endif
	{			
		/* Store Job Result */
		#if((FEE_NUMBER_OF_EEPS == 2U)&&(STD_ON == FEE_DEV_ERROR_DETECT))
		FeeJobResult1 = TI_Fee_GlobalVariables[0].Fee_u16JobResult;
		FeeJobResult2 = TI_Fee_GlobalVariables[1].Fee_u16JobResult;		
		#elif((FEE_NUMBER_OF_EEPS == 1U)&&(STD_ON == FEE_DEV_ERROR_DETECT))
		FeeJobResult1 = TI_Fee_GlobalVariables[0].Fee_u16JobResult;
		#endif	
		
		/* Call TI FEE Read API */
		oResult = TI_Fee_Read(BlockNumber,BlockOffset,DataBufferPtr,Length);	
		
		/* Update job result and module state as required by MEMIF */
		Fee_InternalUpdateGlobalStructure();	
		
		#if(STD_ON == FEE_DEV_ERROR_DETECT)
		if(Error_InvalidBlockIndex == TI_Fee_GlobalVariables[TI_Fee_u8DeviceIndex].Fee_Error)		
		{
			(void)Det_ReportError(FEE_MODULE_ID,FEE_INSTANCE_ID,FEE_SID_READ,FEE_E_INVALID_BLOCK_NO);		
			oResult=E_NOT_OK;
			/* restore Job Result*/	
			#if(FEE_NUMBER_OF_EEPS == 2U)
			TI_Fee_GlobalVariables[0].Fee_u16JobResult = FeeJobResult1;
			TI_Fee_GlobalVariables[1].Fee_u16JobResult = FeeJobResult2;		
			#elif(FEE_NUMBER_OF_EEPS == 1U)
			TI_Fee_GlobalVariables[0].Fee_u16JobResult = FeeJobResult1;
			#endif
		}		
		else if(Error_BlockOffsetGtBlockSize == TI_Fee_GlobalVariables[TI_Fee_u8DeviceIndex].Fee_Error)		
		{
			(void)Det_ReportError(FEE_MODULE_ID,FEE_INSTANCE_ID,FEE_SID_READ,FEE_E_INVALID_BLOCK_OFS);		
			oResult=E_NOT_OK;
			/* restore Job Result*/	
			#if(FEE_NUMBER_OF_EEPS == 2U)
			TI_Fee_GlobalVariables[0].Fee_u16JobResult = FeeJobResult1;
			TI_Fee_GlobalVariables[1].Fee_u16JobResult = FeeJobResult2;		
			#elif(FEE_NUMBER_OF_EEPS == 1U)
			TI_Fee_GlobalVariables[0].Fee_u16JobResult = FeeJobResult1;
			#endif
		}
		else if(Error_LengthParam == TI_Fee_GlobalVariables[TI_Fee_u8DeviceIndex].Fee_Error)		
		{
			(void)Det_ReportError(FEE_MODULE_ID,FEE_INSTANCE_ID,FEE_SID_READ,FEE_E_INVALID_BLOCK_LEN);		
			oResult=E_NOT_OK;
			/* restore Job Result*/	
			#if(FEE_NUMBER_OF_EEPS == 2U)
			TI_Fee_GlobalVariables[0].Fee_u16JobResult = FeeJobResult1;
			TI_Fee_GlobalVariables[1].Fee_u16JobResult = FeeJobResult2;		
			#elif(FEE_NUMBER_OF_EEPS == 1U)
			TI_Fee_GlobalVariables[0].Fee_u16JobResult = FeeJobResult1;
			#endif
		}
		else 
		{
			if(Error_NullDataPtr == TI_Fee_GlobalVariables[TI_Fee_u8DeviceIndex].Fee_Error)		
			{
				(void)Det_ReportError(FEE_MODULE_ID,FEE_INSTANCE_ID,FEE_SID_READ,FEE_E_INVALID_DATA_PTR);		
				oResult=E_NOT_OK;
				/* restore Job Result*/	
				#if(FEE_NUMBER_OF_EEPS == 2U)
				TI_Fee_GlobalVariables[0].Fee_u16JobResult = FeeJobResult1;
				TI_Fee_GlobalVariables[1].Fee_u16JobResult = FeeJobResult2;		
				#elif(FEE_NUMBER_OF_EEPS == 1U)
				TI_Fee_GlobalVariables[0].Fee_u16JobResult = FeeJobResult1;
				#endif
			}	
		}			
		#endif		
	}
	return(oResult);	
}

/**********************************************************************************************************************
 *  Fee_EraseImmediateBlock
 *********************************************************************************************************************/
/*! \brief     	This function performs the Erase Immediate operation on a block .
 *  \param[in]	uint16 BlockNumber
 *  \param[out] none 
 *  \return 	Std_ReturnType
 *  \context    
 *  \note       Autosar FEE API.
 *********************************************************************************************************************/
/* SourceId : FEE_SourceId_008 */
/* DesignId : FEE4x_DesignId_012 */
/* Requirements : AR_FEE_SR96, AR_FEE_SR97, AR_FEE_SR98, AR_FEE_SR99, AR_FEE_SR100, AR_FEE_SR101, AR_FEE_SR102, 
                  AR_FEE_SR103, AR_FEE_SR104 */
Std_ReturnType Fee_EraseImmediateBlock(uint16 BlockNumber)
{
	/*SAFETYMCUSW 331 S MR:10.1 <INSPECTED> "Reason - Std_ReturnType is not part of FEE.This should be fixed 
	  outside of FEE."*/
	Std_ReturnType oResult=E_OK;
	#if((FEE_NUMBER_OF_EEPS == 2U) && (STD_ON == FEE_DEV_ERROR_DETECT))
	TI_FeeJobResultType FeeJobResult1, FeeJobResult2;	
	#elif((FEE_NUMBER_OF_EEPS == 1U) && (STD_ON == FEE_DEV_ERROR_DETECT))
	TI_FeeJobResultType FeeJobResult1;
	#endif	
	
	#if(STD_ON == FEE_DEV_ERROR_DETECT)	
	/* Check if module is Initialized */	
	#if(FEE_NUMBER_OF_EEPS == 2U)
	if(MEMIF_UNINIT == Fee_InternalGetStatus())	
	#elif(FEE_NUMBER_OF_EEPS == 1U)
	if(MEMIF_UNINIT == TI_Fee_GlobalVariables[0].Fee_ModuleState)
	#endif
	{
		/* Module is Not Initialized */		
		(void)Det_ReportError(FEE_MODULE_ID,FEE_INSTANCE_ID,FEE_SID_ERASEIMMEDIATEBLOCK,FEE_E_UNINIT);		
		oResult=E_NOT_OK;
	}
	#if(FEE_NUMBER_OF_EEPS == 2U)
	else if(MEMIF_BUSY == Fee_InternalGetStatus())	
	#elif(FEE_NUMBER_OF_EEPS == 1U)
	else if(MEMIF_BUSY == TI_Fee_GlobalVariables[0].Fee_ModuleState)
	#endif
	{
		/* Module is BUSY */		
		(void)Det_ReportError(FEE_MODULE_ID,FEE_INSTANCE_ID,FEE_SID_ERASEIMMEDIATEBLOCK,FEE_E_BUSY);		
		oResult=E_NOT_OK;
	}
	else	
	#endif
	{		
		/* Store Job Result */
		#if((FEE_NUMBER_OF_EEPS == 2U)&&(STD_ON == FEE_DEV_ERROR_DETECT))
		FeeJobResult1 = TI_Fee_GlobalVariables[0].Fee_u16JobResult;
		FeeJobResult2 = TI_Fee_GlobalVariables[1].Fee_u16JobResult;		
		#elif((FEE_NUMBER_OF_EEPS == 1U)&&(STD_ON == FEE_DEV_ERROR_DETECT))
		FeeJobResult1 = TI_Fee_GlobalVariables[0].Fee_u16JobResult;
		#endif
		
		/* Call TI FEE Erase Immediate API */
		oResult = TI_Fee_EraseImmediateBlock(BlockNumber);			
	
		/* Update job result and module state as required by MEMIF */
		Fee_InternalUpdateGlobalStructure();			
		
		#if(STD_ON == FEE_DEV_ERROR_DETECT)	
		if(Error_BlockInvalid == TI_Fee_GlobalVariables[TI_Fee_u8DeviceIndex].Fee_Error)		
		{
			(void)Det_ReportError(FEE_MODULE_ID,FEE_INSTANCE_ID,FEE_SID_ERASEIMMEDIATEBLOCK,FEE_E_INVALID_BLOCK_NO);		
			oResult=E_NOT_OK;
			/* restore Job Result*/	
			#if(FEE_NUMBER_OF_EEPS == 2U)
			TI_Fee_GlobalVariables[0].Fee_u16JobResult = FeeJobResult1;
			TI_Fee_GlobalVariables[1].Fee_u16JobResult = FeeJobResult2;		
			#elif(FEE_NUMBER_OF_EEPS == 1U)
			TI_Fee_GlobalVariables[0].Fee_u16JobResult = FeeJobResult1;
			#endif
		}
		#endif
	}	
	
	
	return(oResult);
}

/**********************************************************************************************************************
 *  Fee_InvalidateBlock
 *********************************************************************************************************************/
/*! \brief     	This function performs the Invalidate operation on a block .
 *  \param[in]	uint16 BlockNumber
 *  \param[out] none 
 *  \return 	Std_ReturnType
 *  \context    
 *  \note       Autosar FEE API.
 **********************************************************************************************************************/
/* SourceId : FEE_SourceId_009 */
/* DesignId : FEE4x_DesignId_013 */
/* Requirements : AR_FEE_SR82, AR_FEE_SR83, AR_FEE_SR84, AR_FEE_SR85, AR_FEE_SR86, AR_FEE_SR87, AR_FEE_SR88, 
                  AR_FEE_SR89, AR_FEE_SR89, AR_FEE_SR90 */
 Std_ReturnType Fee_InvalidateBlock(uint16 BlockNumber)
{
	/*SAFETYMCUSW 331 S MR:10.1 <INSPECTED> "Reason - Std_ReturnType is not part of FEE.This should be fixed  
	  outside of FEE."*/
	Std_ReturnType oResult=E_OK;
	#if((FEE_NUMBER_OF_EEPS == 2U)&&(STD_ON == FEE_DEV_ERROR_DETECT))
	TI_FeeJobResultType FeeJobResult1, FeeJobResult2;	
	#elif((FEE_NUMBER_OF_EEPS == 1U)&&(STD_ON == FEE_DEV_ERROR_DETECT))
	TI_FeeJobResultType FeeJobResult1;
	#endif
	
	
	#if(STD_ON == FEE_DEV_ERROR_DETECT)	
	/* Check if module is Initialized */	
	#if(FEE_NUMBER_OF_EEPS == 2U)
	if(MEMIF_UNINIT == Fee_InternalGetStatus())	
	#elif(FEE_NUMBER_OF_EEPS == 1U)
	if(MEMIF_UNINIT == TI_Fee_GlobalVariables[0].Fee_ModuleState)
	#endif
	{
		/* Module is Not Initialized */		
		(void)Det_ReportError(FEE_MODULE_ID,FEE_INSTANCE_ID,FEE_SID_INVALIDATEBLOCK,FEE_E_UNINIT);		
		oResult=E_NOT_OK;
	}
	#if(FEE_NUMBER_OF_EEPS == 2U)
	else if(MEMIF_BUSY == Fee_InternalGetStatus())	
	#elif(FEE_NUMBER_OF_EEPS == 1U)
	else if(MEMIF_BUSY == TI_Fee_GlobalVariables[0].Fee_ModuleState)
	#endif
	{
		/* Module is BUSY */		
		(void)Det_ReportError(FEE_MODULE_ID,FEE_INSTANCE_ID,FEE_SID_INVALIDATEBLOCK,FEE_E_BUSY);		
		oResult=E_NOT_OK;
	}
	else	
	#endif
	{
		/* Store Job Result */
		#if((FEE_NUMBER_OF_EEPS == 2U)&&(STD_ON == FEE_DEV_ERROR_DETECT))
		FeeJobResult1 = TI_Fee_GlobalVariables[0].Fee_u16JobResult;
		FeeJobResult2 = TI_Fee_GlobalVariables[1].Fee_u16JobResult;		
		#elif((FEE_NUMBER_OF_EEPS == 1U)&&(STD_ON == FEE_DEV_ERROR_DETECT))
		FeeJobResult1 = TI_Fee_GlobalVariables[0].Fee_u16JobResult;
		#endif
		
		/* Call TI FEE Invalidate Block API */
		oResult = TI_Fee_InvalidateBlock(BlockNumber);	
		
		/* Update job result and module state as required by MEMIF */
		Fee_InternalUpdateGlobalStructure();
		
		#if(STD_ON == FEE_DEV_ERROR_DETECT)	
		if(Error_InvalidBlockIndex == TI_Fee_GlobalVariables[TI_Fee_u8DeviceIndex].Fee_Error)	
		{
			(void)Det_ReportError(FEE_MODULE_ID,FEE_INSTANCE_ID,FEE_SID_INVALIDATEBLOCK,FEE_E_INVALID_BLOCK_NO);		
			oResult=E_NOT_OK;
			/* restore Job Result*/	
			#if(FEE_NUMBER_OF_EEPS == 2U)
			TI_Fee_GlobalVariables[0].Fee_u16JobResult = FeeJobResult1;
			TI_Fee_GlobalVariables[1].Fee_u16JobResult = FeeJobResult2;		
			#elif(FEE_NUMBER_OF_EEPS == 1U)
			TI_Fee_GlobalVariables[0].Fee_u16JobResult = FeeJobResult1;
			#endif
		}
		#endif
	}
			
	return(oResult);
}

/**********************************************************************************************************************
 *  Fee_Cancel
 *********************************************************************************************************************/
/*! \brief     	This functions cancels an ongoing operation.
 *  \param[in]	none
 *  \param[out] none 
 *  \return 	none
 *  \context    
 *  \note       Autosar FEE API.
 *********************************************************************************************************************/
/* SourceId : FEE_SourceId_010 */
/* DesignId : FEE4x_DesignId_019 */
/* Requirements : AR_FEE_SR62, AR_FEE_SR63, AR_FEE_SR64, AR_FEE_SR65, AR_FEE_SR66, AR_FEE_SR67 */ 
 void Fee_Cancel(void)
{
	uint8 u8EEPIndex = 0U;	
	
	#if(STD_ON == FEE_DEV_ERROR_DETECT)	
	/* Check if module is Initialized */	
	#if(FEE_NUMBER_OF_EEPS == 2U)
	if(MEMIF_UNINIT == Fee_InternalGetStatus())	
	#elif(FEE_NUMBER_OF_EEPS == 1U)
	if(MEMIF_UNINIT == TI_Fee_GlobalVariables[0].Fee_ModuleState)
	#endif
	{
		/* Module is Not Initialized */		
		(void)Det_ReportError(FEE_MODULE_ID,FEE_INSTANCE_ID,FEE_SID_CANCEL,FEE_E_UNINIT);			
	}
	#if(FEE_NUMBER_OF_EEPS == 2U)
	else if(MEMIF_BUSY != Fee_InternalGetStatus())	
	#elif(FEE_NUMBER_OF_EEPS == 1U)
	else if(MEMIF_BUSY != TI_Fee_GlobalVariables[0].Fee_ModuleState)
	#endif
	{
		/* Module is Not BUSY */		
		(void)Det_ReportError(FEE_MODULE_ID,FEE_INSTANCE_ID,FEE_SID_CANCEL,FEE_E_INVALID_CANCEL);				
	}
	else		
	#endif
	{
		/* Call TI FEE Cancel API */	
		TI_Fee_Cancel(u8EEPIndex);
		#if(FEE_NUMBER_OF_EEPS == 2U)
		TI_Fee_Cancel(u8EEPIndex+1U);
		#endif		
		/* Update job result and module state as required by MEMIF */
		Fee_InternalUpdateGlobalStructure();
	}
}

/**********************************************************************************************************************
 *  Fee_GetStatus
 *********************************************************************************************************************/
/*! \brief      This function returns the Status of the FEE module 
 *  \param[in]	none
 *  \param[out] none 
 *  \return 	MemIf_StatusType
 *  \context    
 *  \note       Autosar FEE API.
 *********************************************************************************************************************/
/* SourceId : FEE_SourceId_011 */
/* DesignId : FEE4x_DesignId_015 */
/* Requirements : AR_FEE_SR68, AR_FEE_SR69, AR_FEE_SR70, AR_FEE_SR71, AR_FEE_SR72 */ 
MemIf_StatusType Fee_GetStatus(void)
{
	#if(FEE_NUMBER_OF_EEPS == 1U)
	uint8 u8EEPIndex = 0U;
	#endif
	MemIf_StatusType ModuleState = MEMIF_UNINIT;	
	
	/* Update job result and module state as required by MEMIF */
	Fee_InternalUpdateGlobalStructure();
	
	#if(FEE_NUMBER_OF_EEPS == 2U)
	ModuleState = Fee_InternalGetStatus();		
	#elif(FEE_NUMBER_OF_EEPS == 1U)	
	if((TI_Fee_oStatusWord[0].Fee_StatusWordType_ST.Erase != 0U) ||
	   (TI_Fee_oStatusWord[0].Fee_StatusWordType_ST.Copy != 0U) ||
       (TI_Fee_GlobalVariables[0].Fee_ModuleState == MEMIF_BUSY_INTERNAL)
	  )
	{
		ModuleState = (MemIf_StatusType)MEMIF_BUSY;
	}
	else	
	{
		ModuleState = (MemIf_StatusType)TI_Fee_GlobalVariables[u8EEPIndex].Fee_ModuleState;
	}
	#endif	
	return(ModuleState);
}

/**********************************************************************************************************************
 *  Fee_GetVersionInfo
 *********************************************************************************************************************/
/*! \brief      This function is pre-compile time configurable by the parameter FEE_VERSION_INFO_API
 *  \param[in]	Std_VersionInfoType* VersionInfoPtr
 *  \param[out] none 
 *  \return 	none
 *  \context    
 *  \note       Autosar FEE API.
 *********************************************************************************************************************/
/* SourceId : FEE_SourceId_012 */
/* DesignId : FEE4x_DesignId_014 */
/* Requirements : AR_FEE_SR91, AR_FEE_SR92, AR_FEE_SR93, AR_FEE_SR95 */ 
 #if (FEE_VERSION_INFO_API == STD_ON)
/* This function returns the version information for the Fee module */
void Fee_GetVersionInfo(Std_VersionInfoType* VersionInfoPtr)
{	
	#if (STD_ON == FEE_DEV_ERROR_DETECT)
    /*SAFETYMCUSW 440 S MR:11.3 <INSPECTED> "Reason - Casting is required here."*/
	if (NULL_PTR == VersionInfoPtr)
    {        
		(void)Det_ReportError(FEE_MODULE_ID,FEE_INSTANCE_ID,FEE_SID_GETVERSIONINFO,FEE_E_INVALID_DATA_PTR);     
    }    
	else
	#endif
	{
		VersionInfoPtr->moduleID = FEE_MODULE_ID;
		VersionInfoPtr->vendorID = FEE_VENDOR_ID;
		VersionInfoPtr->sw_major_version = FEE_SW_MAJOR_VERSION;
		VersionInfoPtr->sw_minor_version = FEE_SW_MINOR_VERSION;
		VersionInfoPtr->sw_patch_version = FEE_SW_PATCH_VERSION; 
    }	
}
#endif

/**********************************************************************************************************************
 *  Fee_SetMode
 *********************************************************************************************************************/
/*! \brief      This function sets the Fee module's operation mode to the given "Mode" parameter
 *  \param[in]	MemIf_ModeType Mode
 *  \param[out] none 
 *  \return 	none
 *  \context    
 *  \note       Autosar FEE API.
 *********************************************************************************************************************/
/* SourceId : FEE_SourceId_0xx */
/* DesignId : FEE4x_DesignId_018 */
/* Requirements : AR_FEE_SR32, AR_FEE_SR33, AR_FEE_SR34, AR_FEE_SR35, AR_FEE_SR36 */ 
 void Fee_SetMode(MemIf_ModeType Mode)
{
	/* This is a dummy function */
	/* To remove remark 880-D*/
	 Mode=Mode;
}

/**********************************************************************************************************************
 *  Fee_GetJobResult
 *********************************************************************************************************************/
/*! \brief      This function returns the Job result.
 *  \param[in]  none
 *  \param[out] none
 *  \return     Job Result
 *  \context    Function could be called from task level
 *  \note       TI FEE API.
 *********************************************************************************************************************/
/* SourceId : FEE_SourceId_013 */
/* DesignId : FEE4x_DesignId_016 */
/* Requirements : AR_FEE_SR73, AR_FEE_SR74, AR_FEE_SR75, AR_FEE_SR76, AR_FEE_SR77, AR_FEE_SR78, AR_FEE_SR79, 
                  AR_FEE_SR80, AR_FEE_SR81 */ 
MemIf_JobResultType Fee_GetJobResult(void)
{		
	MemIf_JobResultType JobResult = MEMIF_JOB_OK;
	
	/* Update job result and module as required by MEMIF */
	Fee_InternalUpdateGlobalStructure();		
	
	#if(STD_ON == FEE_DEV_ERROR_DETECT)	
	/* Check if module is Initialized */	
	#if(FEE_NUMBER_OF_EEPS == 2U)
	if(MEMIF_UNINIT == Fee_InternalGetStatus())	
	#elif(FEE_NUMBER_OF_EEPS == 1U)
	if(MEMIF_UNINIT == TI_Fee_GlobalVariables[0].Fee_ModuleState)
	#endif
	{
		/* Module is Not Initialized */		
		(void)Det_ReportError(FEE_MODULE_ID,FEE_INSTANCE_ID,FEE_SID_GETJOBRESULT,FEE_E_UNINIT);						
	}	
	else		
	#endif	
	{
		JobResult = (MemIf_JobResultType)TI_Fee_GlobalVariables[TI_Fee_u8DeviceIndex].Fee_u16JobResult;
	}
	return(JobResult);
}

/**********************************************************************************************************************
 *  Fee_InternalUpdateGlobalStructure
 *********************************************************************************************************************/
/*! \brief      This function updates the module state and job result.
 *  \param[in]	none
 *  \param[out] none 
 *  \return 	none
 *  \context    
 *  \note       FEE Internal API.
 **********************************************************************************************************************/ 
static 
void Fee_InternalUpdateGlobalStructure(void)
{	
	uint8 u8EEPIndex = 0U;	
 
	while(u8EEPIndex<FEE_NUMBER_OF_EEPS)
	{	
		/* Update correct info for MEMIF */		
		switch (TI_Fee_GlobalVariables[u8EEPIndex].Fee_u16JobResult)
		{
			case JOB_OK :
				TI_Fee_GlobalVariables[u8EEPIndex].Fee_u16JobResult = (TI_FeeJobResultType)MEMIF_JOB_OK;
				break;
			case JOB_FAILED:	
				TI_Fee_GlobalVariables[u8EEPIndex].Fee_u16JobResult = (TI_FeeJobResultType)MEMIF_JOB_FAILED;
				break;
			case JOB_PENDING:
				TI_Fee_GlobalVariables[u8EEPIndex].Fee_u16JobResult = (TI_FeeJobResultType)MEMIF_JOB_PENDING;
				break;
			case JOB_CANCELLED:
				TI_Fee_GlobalVariables[u8EEPIndex].Fee_u16JobResult = (TI_FeeJobResultType)MEMIF_JOB_CANCELED;
				break;
			case BLOCK_INCONSISTENT:
				TI_Fee_GlobalVariables[u8EEPIndex].Fee_u16JobResult = (TI_FeeJobResultType)MEMIF_BLOCK_INCONSISTENT;
				break;
			case BLOCK_INVALID:
				TI_Fee_GlobalVariables[u8EEPIndex].Fee_u16JobResult = (TI_FeeJobResultType)MEMIF_BLOCK_INVALID;
				break;
			default:
				break;
		}				
		switch (TI_Fee_GlobalVariables[u8EEPIndex].Fee_ModuleState)
		{
			case IDLE:
				TI_Fee_GlobalVariables[u8EEPIndex].Fee_ModuleState = (TI_FeeModuleStatusType)MEMIF_IDLE;
				break;
			case BUSY:
				TI_Fee_GlobalVariables[u8EEPIndex].Fee_ModuleState = (TI_FeeModuleStatusType)MEMIF_BUSY;
				break;
			case BUSY_INTERNAL:
				TI_Fee_GlobalVariables[u8EEPIndex].Fee_ModuleState = (TI_FeeModuleStatusType)MEMIF_BUSY_INTERNAL;
				break;
			default :
				TI_Fee_GlobalVariables[u8EEPIndex].Fee_ModuleState = (TI_FeeModuleStatusType)MEMIF_UNINIT;
				break;
		}
		if((TI_Fee_oStatusWord[u8EEPIndex].Fee_StatusWordType_ST.Erase != 0U))
		{
			TI_Fee_GlobalVariables[u8EEPIndex].Fee_u16JobResult = (TI_FeeJobResultType)MEMIF_JOB_PENDING;
		}
		u8EEPIndex++;
	}
}


#if(FEE_NUMBER_OF_EEPS == 2U)
static 
MemIf_StatusType Fee_InternalGetStatus(void)
{
	MemIf_StatusType ModuleState = MEMIF_UNINIT;
	
	if((TI_Fee_GlobalVariables[0].Fee_ModuleState == MEMIF_UNINIT)	
	   &&(TI_Fee_GlobalVariables[1].Fee_ModuleState == MEMIF_UNINIT))
	{
		ModuleState = (MemIf_StatusType)MEMIF_UNINIT;
	}
	else if((TI_Fee_GlobalVariables[0].Fee_ModuleState == MEMIF_UNINIT)	
			&&(TI_Fee_GlobalVariables[1].Fee_ModuleState == MEMIF_IDLE))
	{
		ModuleState = (MemIf_StatusType)MEMIF_IDLE;
	}
	else if((TI_Fee_GlobalVariables[0].Fee_ModuleState == MEMIF_UNINIT)	
			&&(TI_Fee_GlobalVariables[1].Fee_ModuleState == MEMIF_BUSY))	
	{
		ModuleState = (MemIf_StatusType)MEMIF_BUSY;
	}	
	else if((TI_Fee_GlobalVariables[0].Fee_ModuleState == MEMIF_UNINIT)	
			&&(TI_Fee_GlobalVariables[1].Fee_ModuleState == MEMIF_BUSY_INTERNAL))
	{
		ModuleState =(MemIf_StatusType) MEMIF_BUSY_INTERNAL;
	}
	else
	{
		/* MISRA-C Compliance */
	}
	
	
	if((TI_Fee_GlobalVariables[0].Fee_ModuleState == MEMIF_IDLE)	
	   &&(TI_Fee_GlobalVariables[1].Fee_ModuleState == MEMIF_UNINIT))
	{
		ModuleState = (MemIf_StatusType)MEMIF_IDLE;
	}
	else if((TI_Fee_GlobalVariables[0].Fee_ModuleState == MEMIF_IDLE)	
		    &&(TI_Fee_GlobalVariables[1].Fee_ModuleState == MEMIF_IDLE))	
	{
		ModuleState =(MemIf_StatusType) MEMIF_IDLE;
	}
	else if((TI_Fee_GlobalVariables[0].Fee_ModuleState == MEMIF_IDLE)	
			&&(TI_Fee_GlobalVariables[1].Fee_ModuleState == MEMIF_BUSY))	
	{
		ModuleState = (MemIf_StatusType)MEMIF_BUSY;
	}	
	else if((TI_Fee_GlobalVariables[0].Fee_ModuleState == MEMIF_IDLE)	
			&&(TI_Fee_GlobalVariables[1].Fee_ModuleState == MEMIF_BUSY_INTERNAL))
	{
		ModuleState = (MemIf_StatusType)MEMIF_BUSY_INTERNAL;
	}
	else
	{
		/* MISRA-C Compliance */
	}
		
	if((TI_Fee_GlobalVariables[0].Fee_ModuleState == MEMIF_BUSY)	
		&&(TI_Fee_GlobalVariables[1].Fee_ModuleState == MEMIF_UNINIT))
	{
		ModuleState = (MemIf_StatusType)MEMIF_BUSY;
	}
	else if((TI_Fee_GlobalVariables[0].Fee_ModuleState == MEMIF_BUSY)	
			&&(TI_Fee_GlobalVariables[1].Fee_ModuleState == MEMIF_IDLE))
	{
		ModuleState = (MemIf_StatusType)MEMIF_BUSY;
	}
	else if((TI_Fee_GlobalVariables[0].Fee_ModuleState == MEMIF_BUSY)	
			&&(TI_Fee_GlobalVariables[1].Fee_ModuleState == MEMIF_BUSY))	
	{
		ModuleState = (MemIf_StatusType)MEMIF_BUSY;
	}	
	else if((TI_Fee_GlobalVariables[0].Fee_ModuleState == MEMIF_BUSY)	
			&&(TI_Fee_GlobalVariables[1].Fee_ModuleState == MEMIF_BUSY_INTERNAL))
	{
		ModuleState = (MemIf_StatusType)MEMIF_BUSY;
	}
	else
	{
		/* MISRA-C Compliance */
	}
		
	
	if((TI_Fee_GlobalVariables[0].Fee_ModuleState == MEMIF_BUSY_INTERNAL)
		&&(TI_Fee_GlobalVariables[1].Fee_ModuleState == MEMIF_UNINIT))	 	
	{
		ModuleState = (MemIf_StatusType)MEMIF_BUSY_INTERNAL;
	}
	else if((TI_Fee_GlobalVariables[0].Fee_ModuleState == MEMIF_BUSY_INTERNAL)
			&&(TI_Fee_GlobalVariables[1].Fee_ModuleState == MEMIF_IDLE))	
	{
		ModuleState = (MemIf_StatusType)MEMIF_BUSY_INTERNAL;
	}
	else if((TI_Fee_GlobalVariables[0].Fee_ModuleState == MEMIF_BUSY_INTERNAL)
			&&(TI_Fee_GlobalVariables[1].Fee_ModuleState == MEMIF_BUSY))
	{
		ModuleState = (MemIf_StatusType)MEMIF_BUSY;
	}	
	else if((TI_Fee_GlobalVariables[0].Fee_ModuleState == MEMIF_BUSY_INTERNAL)
			&&(TI_Fee_GlobalVariables[1].Fee_ModuleState == MEMIF_BUSY_INTERNAL))
	{
		ModuleState = (MemIf_StatusType)MEMIF_BUSY_INTERNAL;
	}
	else
	{
		/* MISRA-C Compliance */
	}
	
	
	if((TI_Fee_oStatusWord[0].Fee_StatusWordType_ST.Erase != 0U) ||
	   (TI_Fee_oStatusWord[1].Fee_StatusWordType_ST.Erase != 0U) ||
	   (TI_Fee_oStatusWord[0].Fee_StatusWordType_ST.Copy != 0U) ||
	   (TI_Fee_oStatusWord[1].Fee_StatusWordType_ST.Copy != 0U) ||
	   (TI_Fee_GlobalVariables[0].Fee_ModuleState == MEMIF_BUSY_INTERNAL) ||
	   (TI_Fee_GlobalVariables[1].Fee_ModuleState == MEMIF_BUSY_INTERNAL)
	  )
	{
		ModuleState = (MemIf_StatusType)MEMIF_BUSY;
	}	
	return(ModuleState);
}
#endif

/**********************************************************************************************************************
 *  Fee_JobEndNotification
 *********************************************************************************************************************/
/*! \brief      This function notifies upper layer after the job is completed. This is dummy function since FEE only
 *              supports polling mode. 
 *  \param[in]	none
 *  \param[out] none 
 *  \return 	none
 *  \context    
 *  \note       Autosar FEE API.
 **********************************************************************************************************************/ 
void Fee_JobEndNotification(void)
{
	/* This is a dummy function implemented to meet AS spec */
}

/**********************************************************************************************************************
 *  Fee_JobErrorNotification
 *********************************************************************************************************************/
/*! \brief      This function notifies upper layer after the job is completed with error. This is dummy function 
 *              since FEE only supports polling mode. 
 *  \param[in]	none
 *  \param[out] none 
 *  \return 	none
 *  \context    
 *  \note       Autosar FEE API.
 **********************************************************************************************************************/ 
void Fee_JobErrorNotification(void)
{
	/* This is a dummy function implemented to meet AS spec */
}

/*SAFETYMCUSW 580 S MR:1.1 <APPROVED> "Reason - This is the format to use for specifying memorysections."*/
#define FEE_STOP_SEC_CODE
/*SAFETYMCUSW 338 S MR:19.1 <APPROVED> "Reason - This is the format to use for specifying memorysections."*/
#include "MemMap.h"

/**********************************************************************************************************************
 *  END OF FILE: fee.c
 *********************************************************************************************************************/
 
