/**
*   @file    Spi_IPW.h
*   @version 1.0.0
*
*   @brief   AUTOSAR Spi - Spi middle level driver header file.
*   @details This file is the header containing all the necessary information for SPI
*            LLD.
*   @addtogroup [SPI_MODULE]
*   @{
*/
/*==================================================================================================
*   Project              : AUTOSAR 4.3 MCAL
*   Platform             : PA
*   Peripheral           : DSPI
*   Dependencies         : 
*
*   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 SPI_IPW_H
#define SPI_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. 
* 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 name space shall be distinct. 
* The used compilers use more than 31 chars for identifiers.
*
* @section [global]
* Violates MISRA 2012 Required Rule 5.4, Macro identifiers shall be distinct. 
* The used compilers use more than 31 chars for identifiers.
*
* @section [global]
* Violates MISRA 2012 Required Rule 5.5, Identifiers shall be distinct from macro names.
* The used compilers use more than 31 chars for identifiers.
*
*/

/*==================================================================================================
*                                        INCLUDE FILES
* 1) system and project includes
* 2) needed interfaces from external units
* 3) internal and external interfaces from this unit
==================================================================================================*/

#include "Spi_DSPI.h"

/*==================================================================================================
*                               SOURCE FILE VERSION INFORMATION
==================================================================================================*/
#define SPI_IPW_VENDOR_ID                       43
#define SPI_IPW_AR_RELEASE_MAJOR_VERSION        4
#define SPI_IPW_AR_RELEASE_MINOR_VERSION        3
#define SPI_IPW_AR_RELEASE_REVISION_VERSION     1
#define SPI_IPW_SW_MAJOR_VERSION                1
#define SPI_IPW_SW_MINOR_VERSION                0
#define SPI_IPW_SW_PATCH_VERSION                0

/*==================================================================================================
*                                     FILE VERSION CHECKS
==================================================================================================*/
/* Check if this header file and Spi_Cfg.h are of the same vendor */
#if (SPI_IPW_VENDOR_ID != SPI_VENDOR_ID_DSPI)
    #error "Spi_IPW.h and Spi_DSPI.h have different vendor ids"
#endif

#if (( SPI_IPW_AR_RELEASE_MAJOR_VERSION    != SPI_AR_RELEASE_MAJOR_VERSION_DSPI) || \
     ( SPI_IPW_AR_RELEASE_MINOR_VERSION    != SPI_AR_RELEASE_MINOR_VERSION_DSPI) || \
     ( SPI_IPW_AR_RELEASE_REVISION_VERSION != SPI_AR_RELEASE_REVISION_VERSION_DSPI))
#error "AutoSar Version Numbers of Spi_DSPI.h and Spi_IPW.h are different"
#endif

#if (( SPI_IPW_SW_MAJOR_VERSION != SPI_SW_MAJOR_VERSION_DSPI) || \
     ( SPI_IPW_SW_MINOR_VERSION != SPI_SW_MINOR_VERSION_DSPI) || \
     ( SPI_IPW_SW_PATCH_VERSION != SPI_SW_PATCH_VERSION_DSPI))
#error "Software Version Numbers of Spi_IPW.h and Spi_DSPI.h are different"
#endif
/*==================================================================================================
*                                          CONSTANTS
==================================================================================================*/


/*==================================================================================================
*                                      DEFINES AND MACROS
==================================================================================================*/

#if (SPI_DUAL_CLOCK_MODE == STD_ON)
/*
* @violates @ref Spi_IPW_h_REF_2 C macros shall only expand to a braced initialiser, a constant, a string literal,
* a parenthesised expression, a type qualifier, a storage class specifier, or a do-while-zero construct.
*/
#define SPI_IPW_SET_CLOCK_MODE DSPI_SET_CLOCK_MODE
#endif /* #if (SPI_DUAL_CLOCK_MODE == STD_ON) */
/*==================================================================================================
*                                            ENUMS
==================================================================================================*/


/*==================================================================================================
*                                STRUCTURES AND OTHER TYPEDEFS
==================================================================================================*/

/*==================================================================================================
*                                GLOBAL VARIABLE DECLARATIONS
==================================================================================================*/


/*==================================================================================================
*                                    FUNCTION PROTOTYPES
==================================================================================================*/
FUNC(void, SPI_CODE) Spi_Ipw_Init(VAR(Spi_HWUnitType, AUTOMATIC) HWUnit, P2VAR(Spi_StatusType, AUTOMATIC, SPI_APPL_DATA) pStatus);

FUNC(void, SPI_CODE) Spi_Ipw_DeInit(VAR(Spi_HWUnitType, AUTOMATIC) HWUnit);

#if (((SPI_LEVEL_DELIVERED == LEVEL2) || (SPI_LEVEL_DELIVERED == LEVEL0)) && \
    (SPI_OPTIMIZE_ONE_JOB_SEQUENCES == STD_ON))
FUNC(void, SPI_CODE) Spi_Ipw_PrepareCacheInformation(void);
#endif  /* #if (((SPI_LEVEL_DELIVERED == LEVEL2) || (SPI_LEVEL_DELIVERED == LEVEL0)) && \
    (SPI_OPTIMIZE_ONE_JOB_SEQUENCES == STD_ON))*/

#if ( (SPI_LEVEL_DELIVERED == LEVEL2) || (SPI_LEVEL_DELIVERED == LEVEL0) )
FUNC(Std_ReturnType, SPI_CODE) Spi_Ipw_SyncTransmit(VAR(Spi_SequenceType, AUTOMATIC) Sequence);
#endif /* #if ( (SPI_LEVEL_DELIVERED == LEVEL2) || (SPI_LEVEL_DELIVERED == LEVEL0) ) */

#if ((SPI_LEVEL_DELIVERED == LEVEL1) || (SPI_LEVEL_DELIVERED == LEVEL2))
FUNC(void, SPI_CODE) Spi_Ipw_JobTransfer(P2CONST(Spi_JobConfigType, AUTOMATIC, SPI_APPL_CONST) pcJobConfig);
#endif

#if ((SPI_LEVEL_DELIVERED == LEVEL1) || (SPI_LEVEL_DELIVERED == LEVEL2))
FUNC(void, SPI_CODE) Spi_Ipw_IrqConfig(VAR(Spi_HWUnitType, AUTOMATIC) HWUnit, VAR(Spi_AsyncModeType, AUTOMATIC) AsyncMode);
#endif

#if ((SPI_LEVEL_DELIVERED == LEVEL1) || (SPI_LEVEL_DELIVERED == LEVEL2))
FUNC(void, SPI_CODE) Spi_Ipw_IrqPoll(VAR(Spi_HWUnitType, AUTOMATIC) HWUnit);
#endif

#if ((SPI_CANCEL_API == STD_ON) && (SPI_SLAVE_SUPPORT == STD_ON))
FUNC(void, SPI_CODE) Spi_Ipw_SlaveCancel(VAR(Spi_SequenceType, AUTOMATIC) Sequence);
#endif /* #if ((SPI_CANCEL_API == STD_ON) && (SPI_SLAVE_SUPPORT == STD_ON)) */

#ifdef TSB_MODE_SUPPORTED
#if (SPI_TSB_MODE == STD_ON)
FUNC(void, SPI_CODE) Spi_Ipw_SetTSBMode(VAR(Spi_JobType, AUTOMATIC) TSBJob);

FUNC(void, SPI_CODE) Spi_Ipw_StopTSBMode(VAR(Spi_JobType, AUTOMATIC) TSBJob);

FUNC(void, SPI_CODE) Spi_Ipw_TSB_ASDR_DataUpdate
(
VAR(Spi_JobType, AUTOMATIC) TSBJob,\
P2CONST(uint32, AUTOMATIC,SPI_APPL_DATA) ASDR_Data
);
#endif
#endif

#ifdef __cplusplus
}
#endif

#endif /*SPI_IPW_H*/

/** @} */
