/**
* @file    Port_Ipw.h
*
* @version 1.0.0
* @brief   AUTOSAR Port - PORT driver low level driver interface.
* @details Interface between the high level driver (Autosar dependent) and the low level driver(IP dependent).
*          It is platform specific.
*
* @addtogroup  Port
* @{
*/
/*=================================================================================================
*   Project              : AUTOSAR 4.3 MCAL
*   Platform             : PA
*   Peripheral           : SIU,IGF
*   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 PORT_IPW_H
#define PORT_IPW_H

#ifdef __cplusplus
extern "C"{
#endif

/**
* @page misra_violations MISRA-C:2012 violations
*
* @section Port_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 
*          Port_MemMap.h is as per AUTOSAR requirement [SWS_MemMap_00003].
*
* @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 "Port_Siu.h"
#include "Port_Igf.h"

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

/**
* @brief Parameters that shall be published within the Port driver header file and also in the
*        module's description file.
*
*/
#define PORT_VENDOR_ID_IPW_H                    43
#define PORT_AR_RELEASE_MAJOR_VERSION_IPW_H     4
#define PORT_AR_RELEASE_MINOR_VERSION_IPW_H     3
#define PORT_AR_RELEASE_REVISION_VERSION_IPW_H  1
#define PORT_SW_MAJOR_VERSION_IPW_H             1
#define PORT_SW_MINOR_VERSION_IPW_H             0
#define PORT_SW_PATCH_VERSION_IPW_H             0

/*=================================================================================================
*                                     FILE VERSION CHECKS
=================================================================================================*/

/* Check if Port_Ipw.h and Port_Siu.h file are of the same vendor */
#if (PORT_VENDOR_ID_IPW_H != PORT_SIU_VENDOR_ID_H)
    #error "Port_Ipw.h and Port_Siu.h have different vendor ids"
#endif

/* Check if Port_Ipw.h and Port_Siu.h file are of the same Autosar version */
#if ((PORT_AR_RELEASE_MAJOR_VERSION_IPW_H    != PORT_SIU_AR_RELEASE_MAJOR_VERSION_H) || \
     (PORT_AR_RELEASE_MINOR_VERSION_IPW_H    != PORT_SIU_AR_RELEASE_MINOR_VERSION_H) || \
     (PORT_AR_RELEASE_REVISION_VERSION_IPW_H != PORT_SIU_AR_RELEASE_REVISION_VERSION_H) \
    )
   #error "AutoSar Version Numbers of Port_Ipw.h and Port_Siu.h are different"
#endif

/* Check if Port_Ipw.h and Port_Siu.h file are of the same software version */
#if ((PORT_SW_MAJOR_VERSION_IPW_H != PORT_SIU_SW_MAJOR_VERSION_H) || \
     (PORT_SW_MINOR_VERSION_IPW_H != PORT_SIU_SW_MINOR_VERSION_H) || \
     (PORT_SW_PATCH_VERSION_IPW_H != PORT_SIU_SW_PATCH_VERSION_H)    \
    )
   #error "Software Version Numbers of Port_Ipw.h and Port_Siu.h are different"
#endif

/* Check if Port_Ipw.h and Port_Igf.h file are of the same vendor */
#if (PORT_VENDOR_ID_IPW_H != PORT_IGF_VENDOR_ID_H)
    #error "Port_Ipw.h and Port_Igf.h have different vendor ids"
#endif

/* Check if Port_Ipw.h and Port_Igf.h file are of the same Autosar version */
#if ((PORT_AR_RELEASE_MAJOR_VERSION_IPW_H    != PORT_IGF_AR_RELEASE_MAJOR_VERSION_H) || \
     (PORT_AR_RELEASE_MINOR_VERSION_IPW_H    != PORT_IGF_AR_RELEASE_MINOR_VERSION_H) || \
     (PORT_AR_RELEASE_REVISION_VERSION_IPW_H != PORT_IGF_AR_RELEASE_REVISION_VERSION_H) \
    )
   #error "AutoSar Version Numbers of Port_Ipw.h and Port_Igf.h are different"
#endif

/* Check if Port_Ipw.h and Port_Igf.h file are of the same software version */
#if ((PORT_SW_MAJOR_VERSION_IPW_H != PORT_IGF_SW_MAJOR_VERSION_H) || \
     (PORT_SW_MINOR_VERSION_IPW_H != PORT_IGF_SW_MINOR_VERSION_H) || \
     (PORT_SW_PATCH_VERSION_IPW_H != PORT_IGF_SW_PATCH_VERSION_H)    \
    )
   #error "Software Version Numbers of Port_Ipw.h and Port_Igf.h are different"
#endif

/*=================================================================================================
*                                          CONSTANTS
=================================================================================================*/

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

#if (STD_ON == PORT_SET_PIN_MODE_API)
    #define SIU_MODE_BIT_OFFSET_MASK_U8     ((uint8)0x0F)
#endif

#if (STD_ON == PORT_SET_PIN_DIRECTION_API)
/**
* @brief  Mapping between low level layer and high level layer for Port_Ipw_SetPinDirection.
*/
    #define Port_Ipw_SetPinDirection       (Port_Siu_SetPinDirection)

#endif /* (STD_ON == PORT_SET_PIN_DIRECTION_API) */

/**
* @brief  Mapping between low level layer and high level layer for Port_Ipw_RefreshPortDirection function.
*/
#define Port_Ipw_RefreshPortDirection  (Port_Siu_RefreshPortDirection)

/*=================================================================================================
*                                             ENUMS
=================================================================================================*/


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


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


/*=================================================================================================
*                                     FUNCTION PROTOTYPES
=================================================================================================*/

/* Allocate defined section for PORT code */
#define PORT_START_SEC_CODE
/** @violates @ref Port_Ipw_h_REF_1 Precautions shall be taken in order to prevent the contents of a header file being included more than once. */
#include "Port_MemMap.h"

/**
* Initializes the port driver.
*/
FUNC(void, PORT_CODE) Port_Ipw_Init
(
    P2CONST(Port_ConfigType, AUTOMATIC, PORT_APPL_CONST) pConfigPtr
);

#if (STD_ON == PORT_SET_PIN_MODE_API)
/**
* Sets the port pin mode.
*/
FUNC(Std_ReturnType, PORT_CODE) Port_Ipw_SetPinMode
( 
    VAR     (Port_PinType,      AUTOMATIC                 ) PinIndex,
    VAR     (Port_PinModeType,  AUTOMATIC                 ) PinMode,
    P2CONST (Port_ConfigType,   AUTOMATIC, PORT_APPL_CONST) pConfigPtr
);
#endif /* (STD_ON == PORT_SET_PIN_MODE_API) */

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


#ifdef __cplusplus
}
#endif

#endif /*PORT_IPW_H*/
/** @} */
