/**
*   @file    Fls_IPW.h
*   @version 1.0.0
*
*   @brief   AUTOSAR Fls - AUTOSAR Module Flash Driver.
*   @details Definitions of all Flash driver IP wrapper declarations.
*
*   @addtogroup [FLS]
*   @{
*/
/*==================================================================================================
*   Project              : AUTOSAR 4.3 MCAL
*   Platform             : PA
*   Peripheral           : IPV_FLASHV2
*   Dependencies         : none
*
*   Autosar Version      : 4.3.1
*   Autosar Revision     : ASR_REL_4_3_REV_0001
*   Autosar Conf.Variant :
*   SW Version           : 1.0.0
*   Build Version        : MPC5777C_MCAL_1_0_0_RTM_ASR_REL_4_3_REV_0001_20190315
*
*   (c) Copyright 2006-2016 Freescale Semiconductor, Inc. 
*       Copyright 2017-2019 NXP
*   All Rights Reserved.
==================================================================================================*/
/*==================================================================================================
==================================================================================================*/

#ifndef FLS_IPW_H
#define FLS_IPW_H

#ifdef __cplusplus
extern "C"{
#endif
/**
* @page misra_violations MISRA-C:2012 violations
*
* @section [global]
* Violates MISRA 2012 Required Rule 5.1, External identifiers shall be distinct.
* Identifiers (internal and external) shall not rely on the significance of more than 31 characters. 
* The used compilers use more than 31 chars for identifiers.
*
* @section [global]
* Violates MISRA 2012 Required Rule 5.2, Identifiers declared in the same scope and namespace shall be distinct.
* This violation is due to the requirement that requests to have a file version check.
*
* @section [global]
* Violates MISRA 2012 Required Rule 5.4, Macro identifiers shall be distinct.
* This violation is due to the requirement that requests to have a file version check.
*
* @section [global]
* Violates MISRA 2012 Required Rule 5.5, Identifiers shall be distinct from macro names.
* This violation is due to the requirement that requests to have a file version check.
*
* @section Fls_IPW_h_REF_1
* Violates MISRA 2012 Required Directive 4.10, Precautions shall be taken in order to prevent the contents of a header file being included more than once.
* This violation is not fixed since the inclusion of <MA>_MemMap.h is as per AUTOSAR requirement [SWS_MemMap_00003].
*
* @section Fls_IPW_h_REF_2
* Violates MISRA 2012 Required Directive 8.5, A external object or function shall be declared once in one and only one file.
* Those objects are declared in multi files to support multi IPVs
*
*/
/*==================================================================================================
                                         INCLUDE FILES
 1) system and project includes
 2) needed interfaces from external units
 3) internal and external interfaces from this unit
==================================================================================================*/
#include "Fls.h"

/*==================================================================================================
*                              SOURCE FILE VERSION INFORMATION
==================================================================================================*/

/**
* @{
* @file           Fls_IPW.h
* @brief          Source file version information
* 
*/
#define FLS_IPW_VENDOR_ID_H                       43
#define FLS_IPW_AR_RELEASE_MAJOR_VERSION_H        4
#define FLS_IPW_AR_RELEASE_MINOR_VERSION_H        3
#define FLS_IPW_AR_RELEASE_REVISION_VERSION_H     1
#define FLS_IPW_SW_MAJOR_VERSION_H                1
#define FLS_IPW_SW_MINOR_VERSION_H                0
#define FLS_IPW_SW_PATCH_VERSION_H                0
/** @} */

/*==================================================================================================
*                                     FILE VERSION CHECKS
==================================================================================================*/
/* Check if current file and Fls header file are of the same vendor */
#if (FLS_IPW_VENDOR_ID_H != FLS_VENDOR_ID)
    #error "Fls_IPW.c and Fls.h have different vendor ids"
#endif
#ifndef DISABLE_MCAL_INTERMODULE_ASR_CHECK
    /* Check if current file and Fls header file are of the same Autosar version */
    #if ((FLS_IPW_AR_RELEASE_MAJOR_VERSION_H    != FLS_AR_RELEASE_MAJOR_VERSION) || \
         (FLS_IPW_AR_RELEASE_MINOR_VERSION_H    != FLS_AR_RELEASE_MINOR_VERSION) \
        )
        #error "AutoSar Version Numbers of Fls_IPW.c and Fls.h are different"
    #endif
#endif
/* Check if current file and Fls header file are of the same Software version */
#if ((FLS_IPW_SW_MAJOR_VERSION_H != FLS_SW_MAJOR_VERSION) || \
     (FLS_IPW_SW_MINOR_VERSION_H != FLS_SW_MINOR_VERSION) || \
     (FLS_IPW_SW_PATCH_VERSION_H != FLS_SW_PATCH_VERSION) \
    )
    #error "Software Version Numbers of Fls_IPW.c and Fls.h are different"
#endif
/*==================================================================================================
*                                    VARIABLE DECLARATIONS
==================================================================================================*/
#define FLS_START_SEC_VAR_INIT_UNSPECIFIED
/* @violates @ref Fls_IPW_h_REF_1 Precautions shall be taken in order to prevent the contents of a header file being included more than once */
#include "Fls_MemMap.h"

/** 
* @brief Index of flash sector currently processed by a job
* @details Used by all types of job
*/
/* @violates @ref Fls_IPW_h_REF_2 A external object or function shall be declared once in one and only one file */
extern VAR(volatile Fls_SectorIndexType, FLS_VAR) Fls_u32JobSectorIt;

/** 
* @brief Index of last flash sector by current job
* @details Used to check status of all external flash chips before start jobs
*/
/* @violates @ref Fls_IPW_h_REF_2 A external object or function shall be declared once in one and only one file */
extern VAR( Fls_SectorIndexType, FLS_VAR) Fls_u32JobSectorEnd;

/** 
    @brief Result of last flash hardware job
*/
/* @violates @ref Fls_IPW_h_REF_2 A external object or function shall be declared once in one and only one file */
extern VAR(volatile MemIf_JobResultType, FLS_VAR) Fls_eLLDJobResult;
/** 
    @brief Type of current flash hardware job - used for asynchronous operating mode.
*/
/* @violates @ref Fls_IPW_h_REF_2 A external object or function shall be declared once in one and only one file */
extern VAR(Fls_LLDJobType, FLS_VAR) Fls_eLLDJob;
/** 
* @brief Pointer to current flash module configuration set
*/
/* @violates @ref Fls_IPW_h_REF_2 A external object or function shall be declared once in one and only one file */
extern P2CONST(Fls_ConfigType, FLS_VAR, FLS_APPL_CONST) Fls_pConfigPtr;
/* @violates @ref Fls_IPW_h_REF_2 A external object or function shall be declared once in one and only one file */
extern VAR(volatile Fls_LLDIrqJobType, FLS_VAR) Fls_eLLDIrqJob;



#define FLS_STOP_SEC_VAR_INIT_UNSPECIFIED
/* @violates @ref Fls_IPW_h_REF_1 Precautions shall be taken in order to prevent the contents of a header file being included more than once */
#include "Fls_MemMap.h"

/*==================================================================================================
*                                    DEFINES AND MACROS
==================================================================================================*/
/*==================================================================================================
*                                    FUNCTION PROTOTYPES
==================================================================================================*/
#define FLS_START_SEC_CODE
/* @violates @ref Fls_IPW_h_REF_1 Precautions shall be taken in order to prevent the contents of a header file being included more than once */
#include "Fls_MemMap.h"

FUNC(void, FLS_CODE) Fls_IPW_Init(void);

FUNC(void, FLS_CODE) Fls_IPW_AbortSuspended(void);



FUNC(void, FLS_CODE) Fls_IPW_Cancel(void);
FUNC( void, FLS_CODE ) Fls_IPW_LLDMainFunction( void );
FUNC( Fls_LLDReturnType, FLS_CODE ) Fls_IPW_SectorRead
(
    CONST(Fls_AddressType, AUTOMATIC) u32SectorOffset,
    CONST(Fls_AddressType, AUTOMATIC) u32Length,
    P2VAR(uint8, AUTOMATIC, FLS_APPL_DATA) pJobDataDestPtr
);
FUNC( Fls_LLDReturnType, FLS_CODE ) Fls_IPW_SectorCompare
(
    CONST(Fls_AddressType, AUTOMATIC) u32SectorOffset,
    CONST(Fls_AddressType, AUTOMATIC) u32Length,
    P2CONST(uint8, AUTOMATIC, FLS_APPL_CONST) pJobDataSrcPtr
);
FUNC( Fls_LLDReturnType, FLS_CODE ) Fls_IPW_SectorErase
(
#if( FLS_ERASE_VERIFICATION_ENABLED == STD_ON )
    CONST( Fls_LengthType, AUTOMATIC ) u32PhysicalSectorSize,
#endif
    CONST( boolean, AUTOMATIC ) bAsynch
);
FUNC( Fls_LLDReturnType, FLS_CODE ) Fls_IPW_SectorWrite
(
    CONST(Fls_AddressType, AUTOMATIC) u32SectorOffset,
    CONST(Fls_AddressType, AUTOMATIC) u32Length,
    P2CONST(uint8, AUTOMATIC, FLS_APPL_CONST) pJobDataSrcPtr,
    CONST( boolean, AUTOMATIC ) bAsynch
);
#define FLS_STOP_SEC_CODE
/* @violates @ref Fls_IPW_h_REF_1 Precautions shall be taken in order to prevent the contents of a header file being included more than once */
#include "Fls_MemMap.h"

#ifdef __cplusplus
}
#endif

#endif /* FLS_IPW_H */

/** @}*/
