/*==================================================================================================
*   Project              : RTD AUTOSAR 4.4
*   Platform             : CORTEXM
*   Peripheral           : DMA,CACHE,TRGMUX,LCU,EMIOS,FLEXIO
*   Dependencies         : none
*
*   Autosar Version      : 4.4.0
*   Autosar Revision     : ASR_REL_4_4_REV_0000
*   Autosar Conf.Variant :
*   SW Version           : 0.9.0
*   Build Version        : S32K3_RTD_0_9_0__ASR_REL_4_4_REV_0000_20210326
*
*   (c) Copyright 2020 - 2021 NXP Semiconductors
*   All Rights Reserved.
*
*   NXP Confidential. This software is owned or controlled by NXP and may only be
*   used strictly in accordance with the applicable license terms. By expressly
*   accepting such terms or by downloading, installing, activating and/or otherwise
*   using the software, you are agreeing that you have read, and that you agree to
*   comply with and are bound by, such license terms. If you do not agree to be
*   bound by the applicable license terms, then you may not retain, install,
*   activate or otherwise use the software.
==================================================================================================*/

/**
*   @file    Flexio_Mcl_Ip_Irq.c
*
*   @version 0.9.0
*
*   @brief   AUTOSAR Mcl - Flexio Common Irq source file.
*   @details
*
*   @addtogroup FLEXIO_IP_IRQ_DRIVER FLEXIO IP IRQ Driver
*   @{
*/

#ifdef __cplusplus
extern "C"{
#endif

/*==================================================================================================
*                                         INCLUDE FILES
* 1) system and project includes
* 2) needed interfaces from external units
* 3) internal and external interfaces from this unit
==================================================================================================*/
#include "Flexio_Mcl_Ip.h"
#include "S32K344_FLEXIO.h"
#include "Mcal.h"

#ifdef USE_LIN_MODULE
    #include "Flexio_Lin_Ip_Irq.h"
#endif

#ifdef USE_SPI_MODULE
    #include "Flexio_Spi_Ip_Irq.h"
#endif

#ifdef USE_I2C_MODULE
    #include "Flexio_I2c_Ip_Irq.h"
#endif

#ifdef USE_SENT_MODULE
    #include "Flexio_Sent_Ip_Irq.h"
#endif

#ifdef USE_UART_MODULE
      #include "Flexio_Uart_Ip_Irq.h"
#endif

#ifdef USE_PWM_MODULE
    #include "Flexio_Pwm_Ip_Irq.h"

    #define FLEXIO_IP_PIN_ISR_USED (STD_ON)

    #ifdef PWM_CHANNEL_0_USED
        #define PWM_CHANNEL_0_PIN_ISR_MASK FLEXIO_PWM_IP_CHANNEL_0_PINMASK
    #endif
    #ifdef PWM_CHANNEL_1_USED
        #define PWM_CHANNEL_1_PIN_ISR_MASK FLEXIO_PWM_IP_CHANNEL_1_PINMASK
    #endif
    #ifdef PWM_CHANNEL_2_USED
        #define PWM_CHANNEL_2_PIN_ISR_MASK FLEXIO_PWM_IP_CHANNEL_2_PINMASK
    #endif
    #ifdef PWM_CHANNEL_3_USED
        #define PWM_CHANNEL_3_PIN_ISR_MASK FLEXIO_PWM_IP_CHANNEL_3_PINMASK
    #endif
    #ifdef PWM_CHANNEL_4_USED
        #define PWM_CHANNEL_4_PIN_ISR_MASK FLEXIO_PWM_IP_CHANNEL_4_PINMASK
    #endif
    #ifdef PWM_CHANNEL_5_USED
        #define PWM_CHANNEL_5_PIN_ISR_MASK FLEXIO_PWM_IP_CHANNEL_5_PINMASK
    #endif
    #ifdef PWM_CHANNEL_6_USED
        #define PWM_CHANNEL_6_PIN_ISR_MASK FLEXIO_PWM_IP_CHANNEL_6_PINMASK
    #endif
    #ifdef PWM_CHANNEL_7_USED
        #define PWM_CHANNEL_7_PIN_ISR_MASK FLEXIO_PWM_IP_CHANNEL_7_PINMASK
    #endif
#endif


/*==================================================================================================
*                              SOURCE FILE VERSION INFORMATION
==================================================================================================*/
#define FLEXIO_MCL_IP_IRQ_VENDOR_ID_C                      43
#define FLEXIO_MCL_IP_IRQ_AR_RELEASE_MAJOR_VERSION_C       4
#define FLEXIO_MCL_IP_IRQ_AR_RELEASE_MINOR_VERSION_C       4
#define FLEXIO_MCL_IP_IRQ_AR_RELEASE_REVISION_VERSION_C    0
#define FLEXIO_MCL_IP_IRQ_SW_MAJOR_VERSION_C               0
#define FLEXIO_MCL_IP_IRQ_SW_MINOR_VERSION_C               9
#define FLEXIO_MCL_IP_IRQ_SW_PATCH_VERSION_C               0

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

/*==================================================================================================
*                          LOCAL TYPEDEFS (STRUCTURES, UNIONS, ENUMS)
==================================================================================================*/

/*==================================================================================================
*                                       LOCAL CONSTANTS
==================================================================================================*/
#define FLEXIO_CHANNEL_0_MASK ((uint8)0x01U)
#define FLEXIO_CHANNEL_1_MASK ((uint8)0x02U)
#define FLEXIO_CHANNEL_2_MASK ((uint8)0x04U)
#define FLEXIO_CHANNEL_3_MASK ((uint8)0x08U)
#define FLEXIO_CHANNEL_4_MASK ((uint8)0x10U)
#define FLEXIO_CHANNEL_5_MASK ((uint8)0x20U)
#define FLEXIO_CHANNEL_6_MASK ((uint8)0x40U)
#define FLEXIO_CHANNEL_7_MASK ((uint8)0x80U)
#define FLEXIO_CHANNEL_0 ((uint8)0U)
#define FLEXIO_CHANNEL_1 ((uint8)1U)
#define FLEXIO_CHANNEL_2 ((uint8)2U)
#define FLEXIO_CHANNEL_3 ((uint8)3U)
#define FLEXIO_CHANNEL_4 ((uint8)4U)
#define FLEXIO_CHANNEL_5 ((uint8)5U)
#define FLEXIO_CHANNEL_6 ((uint8)6U)
#define FLEXIO_CHANNEL_7 ((uint8)7U)
#define FLEXIO_INSTANCE_NO ((uint8)0U)
/*==================================================================================================
*                                       LOCAL VARIABLES
==================================================================================================*/

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

/*==================================================================================================
*                                       GLOBAL VARIABLES
==================================================================================================*/

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

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

/*==================================================================================================
*                                   GLOBAL FUNCTIONS PROTOTYPES
==================================================================================================*/
#ifdef USE_PWM_MODULE
extern void Flexio_Pwm_Ip_IrqHandler (uint8 channelId, uint8 timerFlags, uint32 pinFlags);
#endif
#ifdef USE_UART_MODULE
extern void Flexio_Uart_Ip_IrqHandler(uint8 u8Channel, uint8 u8ShifterMaskFlag, uint8 u8ShifterErrorMaskFlag, uint8 u8TimerMaskFlag);
#endif
#ifdef USE_LIN_MODULE
extern void Flexio_Lin_Ip_IrqHandler (uint8 u8Channel, uint8 u8ShifterMaskFlag, uint8 u8ShifterErrorMaskFlag, uint8 u8TimerMaskFlag);
#endif
#ifdef USE_I2C_MODULE
extern void Flexio_I2c_Ip_IrqHandler (uint8 u8Channel, uint8 u8ShifterMaskFlag, uint8 u8ShifterErrorMaskFlag, uint8 u8TimerMaskFlag);
#endif
#ifdef USE_SPI_MODULE
extern void Flexio_Spi_Ip_IrqHandler (uint8 u8Channel, uint8 u8ShifterMaskFlag, uint8 u8ShifterErrorMaskFlag);
#endif
#ifdef USE_SENT_MODULE
extern void Flexio_Sent_Ip_IrqHandler(uint8 u8Channel, uint8 u8TimerMaskFlag);
#endif
static void Flexio_Mcl_Ip_CommonIrq(void);
/*==================================================================================================
                                       GLOBAL FUNCTIONS
==================================================================================================*/
#define MCL_START_SEC_CODE
#include "Mcl_MemMap.h"

static void Flexio_Mcl_Ip_CommonIrq(void)
{
    FLEXIO_Type *baseAddr;
    baseAddr                       = flexioBase[FLEXIO_INSTANCE_NO];

#if defined(USE_UART_MODULE) || defined(USE_LIN_MODULE) || defined(USE_I2C_MODULE) || defined(USE_SPI_MODULE)
    uint8 u8ShifterMaskFlag        = (uint8)Flexio_Mcl_Ip_GetAllShifterStatus(baseAddr);
    uint8 u8ShifterEnabledIrq      = (uint8)Flexio_Mcl_Ip_GetAllShifterInterrupt(baseAddr);
    uint8 u8ShifterErrEnabledIrq   = (uint8)Flexio_Mcl_Ip_GetAllShifterErrorInterrupt(baseAddr);
#endif

    uint8 u8ShifterErrMaskFlag     = (uint8)Flexio_Mcl_Ip_GetAllShifterErrorStatus(baseAddr);

    uint8 u8TimerMaskFlag          = (uint8)Flexio_Mcl_Ip_GetAllTimerStatus(baseAddr);
#if defined(USE_UART_MODULE) || defined(USE_LIN_MODULE) || defined(USE_I2C_MODULE) || defined(USE_PWM_MODULE) || defined(USE_SENT_MODULE)
    uint8 u8TimerEnabledIrq        = (uint8)Flexio_Mcl_Ip_GetAllTimerInterrupt(baseAddr);
#endif

#ifdef FLEXIO_IP_PIN_ISR_USED
    uint32 u32PinMaskFlag          = Flexio_Mcl_Ip_GetAllPinsStatus(baseAddr);
    uint32 u32PinEnabledIrq        = Flexio_Mcl_Ip_GetAllPinsInterrupt(baseAddr);
#endif

    if (Flexio_Ip_IpIsInitialized[FLEXIO_INSTANCE_NO])
    {
#if defined(USE_UART_MODULE) || defined(USE_LIN_MODULE) || defined(USE_I2C_MODULE) || defined(USE_SPI_MODULE)

        /* Clear the flags */
        baseAddr->SHIFTERR      |= (uint32) (u8ShifterErrMaskFlag & u8ShifterErrEnabledIrq);
#endif
#if defined(USE_UART_MODULE) || defined(USE_LIN_MODULE) || defined(USE_I2C_MODULE) || defined(USE_PWM_MODULE) || defined(USE_SENT_MODULE)

        /* Clear the flags */
        baseAddr->TIMSTAT       |= (uint32) (u8TimerMaskFlag & u8TimerEnabledIrq);
#endif
#ifdef FLEXIO_IP_PIN_ISR_USED

        /* Clear the flags */
        baseAddr->PINSTAT       |= u32PinMaskFlag & u32PinEnabledIrq;
#endif

#ifdef FLEXIO_0_CH_0_USED
    #if defined(LIN_CHANNEL_0_USED) || defined(UART_CHANNEL_0_USED) || defined(I2C_CHANNEL_0_USED)
        if  ( ((uint8)0U != (u8ShifterMaskFlag & u8ShifterEnabledIrq & FLEXIO_CHANNEL_0_MASK)) ||
              ((uint8)0U != (u8ShifterErrMaskFlag & u8ShifterErrEnabledIrq & FLEXIO_CHANNEL_0_MASK)) ||
              ((uint8)0U != (u8TimerMaskFlag & u8TimerEnabledIrq & FLEXIO_CHANNEL_0_MASK))
            )
        {
#ifdef LIN_CHANNEL_0_USED
            Flexio_Lin_Ip_IrqHandler(FLEXIO_CHANNEL_0, u8ShifterMaskFlag, u8ShifterErrMaskFlag, u8TimerMaskFlag);
#endif
#ifdef UART_CHANNEL_0_USED
            Flexio_Uart_Ip_IrqHandler(FLEXIO_CHANNEL_0, u8ShifterMaskFlag, u8ShifterErrMaskFlag, u8TimerMaskFlag);
#endif
#ifdef I2C_CHANNEL_0_USED
            Flexio_I2c_Ip_IrqHandler(FLEXIO_CHANNEL_0, u8ShifterMaskFlag, u8ShifterErrMaskFlag, u8TimerMaskFlag);
#endif
        }
    #elif defined(SPI_CHANNEL_0_USED)
        if  ( ((uint8)0U != (u8ShifterMaskFlag & u8ShifterEnabledIrq & FLEXIO_CHANNEL_0_MASK)) ||
              ((uint8)0U != (u8ShifterErrMaskFlag & u8ShifterErrEnabledIrq & FLEXIO_CHANNEL_0_MASK))
            )
        {
            Flexio_Spi_Ip_IrqHandler(FLEXIO_CHANNEL_0, u8ShifterMaskFlag, u8ShifterErrMaskFlag);
        }
    #elif defined(SENT_CHANNEL_0_USED)

        if ((uint8)0U != (u8TimerMaskFlag & u8TimerEnabledIrq & FLEXIO_CHANNEL_0_MASK))
        {
            Flexio_Sent_Ip_IrqHandler(FLEXIO_CHANNEL_0, u8TimerMaskFlag);
        }

    #elif defined(PWM_CHANNEL_0_USED)

        if ((uint8)0U != (u8TimerMaskFlag & u8TimerEnabledIrq & FLEXIO_CHANNEL_0_MASK) ||
            (uint8)0U != (u32PinMaskFlag & u32PinEnabledIrq & PWM_CHANNEL_0_PIN_ISR_MASK)
           )
        {
            Flexio_Pwm_Ip_IrqHandler(FLEXIO_CHANNEL_0, u8TimerMaskFlag, u32PinMaskFlag);
        }

    #endif /*if defined(LIN_CHANNEL_0_USED) || defined(UART_CHANNEL_0_USED) || defined(I2C_CHANNEL_0_USED) */
#endif /*ifdef FLEXIO_0_CH_0_USED*/

#ifdef FLEXIO_0_CH_1_USED
    #if defined(LIN_CHANNEL_1_USED) || defined(UART_CHANNEL_1_USED) || defined(I2C_CHANNEL_1_USED)
        if  ( ((uint8)0U != (u8ShifterMaskFlag & u8ShifterEnabledIrq & FLEXIO_CHANNEL_1_MASK)) ||
              ((uint8)0U != (u8ShifterErrMaskFlag & u8ShifterErrEnabledIrq & FLEXIO_CHANNEL_1_MASK)) ||
              ((uint8)0U != (u8TimerMaskFlag & u8TimerEnabledIrq & FLEXIO_CHANNEL_1_MASK))
            )
        {
#ifdef LIN_CHANNEL_1_USED
            Flexio_Lin_Ip_IrqHandler(FLEXIO_CHANNEL_1, u8ShifterMaskFlag, u8ShifterErrMaskFlag, u8TimerMaskFlag);
#endif
#ifdef UART_CHANNEL_1_USED
            Flexio_Uart_Ip_IrqHandler(FLEXIO_CHANNEL_1, u8ShifterMaskFlag, u8ShifterErrMaskFlag, u8TimerMaskFlag);
#endif
#ifdef I2C_CHANNEL_1_USED
            Flexio_I2c_Ip_IrqHandler(FLEXIO_CHANNEL_1, u8ShifterMaskFlag, u8ShifterErrMaskFlag, u8TimerMaskFlag);
#endif
        }
    #elif defined(SPI_CHANNEL_1_USED)
        if  ( ((uint8)0U != (u8ShifterMaskFlag & u8ShifterEnabledIrq & FLEXIO_CHANNEL_1_MASK)) ||
              ((uint8)0U != (u8ShifterErrMaskFlag & u8ShifterErrEnabledIrq & FLEXIO_CHANNEL_1_MASK))
            )
        {
            Flexio_Spi_Ip_IrqHandler(FLEXIO_CHANNEL_1, u8ShifterMaskFlag, u8ShifterErrMaskFlag);
        }
    #elif defined(SENT_CHANNEL_1_USED)

        if ((uint8)0U != (u8TimerMaskFlag & u8TimerEnabledIrq & FLEXIO_CHANNEL_1_MASK))
        {
            Flexio_Sent_Ip_IrqHandler(FLEXIO_CHANNEL_1, u8TimerMaskFlag);
        }

    #elif defined(PWM_CHANNEL_1_USED)

        if ((uint8)0U != (u8TimerMaskFlag & u8TimerEnabledIrq & FLEXIO_CHANNEL_1_MASK) ||
            (uint8)0U != (u32PinMaskFlag & u32PinEnabledIrq & PWM_CHANNEL_1_PIN_ISR_MASK)
           )
        {
            Flexio_Pwm_Ip_IrqHandler(FLEXIO_CHANNEL_1, u8TimerMaskFlag, u32PinMaskFlag);
        }

    #endif /*if defined(LIN_CHANNEL_1_USED) || defined(UART_CHANNEL_1_USED) || defined(I2C_CHANNEL_1_USED) */
#endif /*ifdef FLEXIO_0_CH_1_USED*/

#ifdef FLEXIO_0_CH_2_USED
    #if defined(LIN_CHANNEL_2_USED) || defined(UART_CHANNEL_2_USED) || defined(I2C_CHANNEL_2_USED)
        if  ( ((uint8)0U != (u8ShifterMaskFlag & u8ShifterEnabledIrq & FLEXIO_CHANNEL_2_MASK)) ||
              ((uint8)0U != (u8ShifterErrMaskFlag & u8ShifterErrEnabledIrq & FLEXIO_CHANNEL_2_MASK)) ||
              ((uint8)0U != (u8TimerMaskFlag & u8TimerEnabledIrq & FLEXIO_CHANNEL_2_MASK))
            )
        {
#ifdef LIN_CHANNEL_2_USED
            Flexio_Lin_Ip_IrqHandler(FLEXIO_CHANNEL_2, u8ShifterMaskFlag, u8ShifterErrMaskFlag, u8TimerMaskFlag);
#endif
#ifdef UART_CHANNEL_2_USED
            Flexio_Uart_Ip_IrqHandler(FLEXIO_CHANNEL_2, u8ShifterMaskFlag, u8ShifterErrMaskFlag, u8TimerMaskFlag);
#endif
#ifdef I2C_CHANNEL_2_USED
            Flexio_I2c_Ip_IrqHandler(FLEXIO_CHANNEL_2, u8ShifterMaskFlag, u8ShifterErrMaskFlag, u8TimerMaskFlag);
#endif
        }
    #elif  defined(SPI_CHANNEL_2_USED)
        if  ( ((uint8)0U != (u8ShifterMaskFlag & u8ShifterEnabledIrq & FLEXIO_CHANNEL_2_MASK)) ||
              ((uint8)0U != (u8ShifterErrMaskFlag & u8ShifterErrEnabledIrq & FLEXIO_CHANNEL_2_MASK))
            )
        {
            Flexio_Spi_Ip_IrqHandler(FLEXIO_CHANNEL_2, u8ShifterMaskFlag, u8ShifterErrMaskFlag);
        }
    #elif defined(SENT_CHANNEL_2_USED)

        if ((uint8)0U != (u8TimerMaskFlag & u8TimerEnabledIrq & FLEXIO_CHANNEL_2_MASK))
        {
            Flexio_Sent_Ip_IrqHandler(FLEXIO_CHANNEL_2, u8TimerMaskFlag);
        }
    #elif defined(PWM_CHANNEL_2_USED)

        if ((uint8)0U != (u8TimerMaskFlag & u8TimerEnabledIrq & FLEXIO_CHANNEL_2_MASK) ||
            (uint8)0U != (u32PinMaskFlag & u32PinEnabledIrq & PWM_CHANNEL_2_PIN_ISR_MASK)
           )
        {
            Flexio_Pwm_Ip_IrqHandler(FLEXIO_CHANNEL_2, u8TimerMaskFlag, u32PinMaskFlag);
        }

    #endif /*if defined(LIN_CHANNEL_2_USED) || defined(UART_CHANNEL_2_USED) || defined(I2C_CHANNEL_2_USED) */
#endif /*ifdef FLEXIO_0_CH_2_USED*/

#ifdef FLEXIO_0_CH_3_USED
    #if defined(LIN_CHANNEL_3_USED) || defined(UART_CHANNEL_3_USED) || defined(I2C_CHANNEL_3_USED)
        if  ( ((uint8)0U != (u8ShifterMaskFlag & u8ShifterEnabledIrq & FLEXIO_CHANNEL_3_MASK)) ||
              ((uint8)0U != (u8ShifterErrMaskFlag & u8ShifterErrEnabledIrq & FLEXIO_CHANNEL_3_MASK)) ||
              ((uint8)0U != (u8TimerMaskFlag & u8TimerEnabledIrq & FLEXIO_CHANNEL_3_MASK))
            )
        {
#ifdef LIN_CHANNEL_3_USED
            Flexio_Lin_Ip_IrqHandler(FLEXIO_CHANNEL_3, u8ShifterMaskFlag, u8ShifterErrMaskFlag, u8TimerMaskFlag);
#endif
#ifdef UART_CHANNEL_3_USED
            Flexio_Uart_Ip_IrqHandler(FLEXIO_CHANNEL_3, u8ShifterMaskFlag, u8ShifterErrMaskFlag, u8TimerMaskFlag);
#endif
#ifdef I2C_CHANNEL_3_USED
            Flexio_I2c_Ip_IrqHandler(FLEXIO_CHANNEL_3, u8ShifterMaskFlag, u8ShifterErrMaskFlag, u8TimerMaskFlag);
#endif
        }
    #elif defined(SPI_CHANNEL_3_USED)
        if  ( ((uint8)0U != (u8ShifterMaskFlag & u8ShifterEnabledIrq & FLEXIO_CHANNEL_3_MASK)) ||
              ((uint8)0U != (u8ShifterErrMaskFlag & u8ShifterErrEnabledIrq & FLEXIO_CHANNEL_3_MASK))
            )
        {
            Flexio_Spi_Ip_IrqHandler(FLEXIO_CHANNEL_3, u8ShifterMaskFlag, u8ShifterErrMaskFlag);
        }
    #elif defined(SENT_CHANNEL_3_USED)

        if ((uint8)0U != (u8TimerMaskFlag & u8TimerEnabledIrq & FLEXIO_CHANNEL_3_MASK))
        {
            Flexio_Sent_Ip_IrqHandler(FLEXIO_CHANNEL_3, u8TimerMaskFlag);
        }
    #elif defined(PWM_CHANNEL_3_USED)

        if ((uint8)0U != (u8TimerMaskFlag & u8TimerEnabledIrq & FLEXIO_CHANNEL_3_MASK) ||
            (uint8)0U != (u32PinMaskFlag & u32PinEnabledIrq & PWM_CHANNEL_3_PIN_ISR_MASK)
           )
        {
            Flexio_Pwm_Ip_IrqHandler(FLEXIO_CHANNEL_3, u8TimerMaskFlag, u32PinMaskFlag);
        }

    #endif /*if defined(LIN_CHANNEL_3_USED) || defined(UART_CHANNEL_3_USED) || defined(I2C_CHANNEL_3_USED) */
#endif /*ifdef FLEXIO_0_CH_3_USED*/

#ifdef FLEXIO_0_CH_4_USED
    #if defined(LIN_CHANNEL_4_USED) || defined(UART_CHANNEL_4_USED) || defined(I2C_CHANNEL_4_USED)
        if  ( ((uint8)0U != (u8ShifterMaskFlag & u8ShifterEnabledIrq & FLEXIO_CHANNEL_4_MASK)) ||
              ((uint8)0U != (u8ShifterErrMaskFlag & u8ShifterErrEnabledIrq & FLEXIO_CHANNEL_4_MASK)) ||
              ((uint8)0U != (u8TimerMaskFlag & u8TimerEnabledIrq & FLEXIO_CHANNEL_4_MASK))
            )
        {
#ifdef LIN_CHANNEL_4_USED
            Flexio_Lin_Ip_IrqHandler(FLEXIO_CHANNEL_4, u8ShifterMaskFlag, u8ShifterErrMaskFlag, u8TimerMaskFlag);
#endif
#ifdef UART_CHANNEL_4_USED
            Flexio_Uart_Ip_IrqHandler(FLEXIO_CHANNEL_4, u8ShifterMaskFlag, u8ShifterErrMaskFlag, u8TimerMaskFlag);
#endif
#ifdef I2C_CHANNEL_4_USED
            Flexio_I2c_Ip_IrqHandler(FLEXIO_CHANNEL_4, u8ShifterMaskFlag, u8ShifterErrMaskFlag, u8TimerMaskFlag);
#endif
        }
    #elif defined(SPI_CHANNEL_4_USED)
        if  ( ((uint8)0U != (u8ShifterMaskFlag & u8ShifterEnabledIrq & FLEXIO_CHANNEL_4_MASK)) ||
              ((uint8)0U != (u8ShifterErrMaskFlag & u8ShifterErrEnabledIrq & FLEXIO_CHANNEL_4_MASK))
            )
        {
            Flexio_Spi_Ip_IrqHandler(FLEXIO_CHANNEL_4, u8ShifterMaskFlag, u8ShifterErrMaskFlag);
        }
    #elif defined(SENT_CHANNEL_4_USED)

        if ((uint8)0U != (u8TimerMaskFlag & u8TimerEnabledIrq & FLEXIO_CHANNEL_4_MASK))
        {
            Flexio_Sent_Ip_IrqHandler(FLEXIO_CHANNEL_4, u8TimerMaskFlag);
        }

    #elif defined(PWM_CHANNEL_4_USED)

        if ((uint8)0U != (u8TimerMaskFlag & u8TimerEnabledIrq & FLEXIO_CHANNEL_4_MASK) ||
            (uint8)0U != (u32PinMaskFlag & u32PinEnabledIrq & PWM_CHANNEL_4_PIN_ISR_MASK)
           )
        {
            Flexio_Pwm_Ip_IrqHandler(FLEXIO_CHANNEL_4, u8TimerMaskFlag, u32PinMaskFlag);
        }

    #endif /*if defined(LIN_CHANNEL_4_USED) || defined(UART_CHANNEL_4_USED) || defined(I2C_CHANNEL_4_USED) */
#endif /*ifdef FLEXIO_0_CH_4_USED*/

#ifdef FLEXIO_0_CH_5_USED
    #if defined(LIN_CHANNEL_5_USED) || defined(UART_CHANNEL_5_USED) || defined(I2C_CHANNEL_5_USED)
        if  ( ((uint8)0U != (u8ShifterMaskFlag & u8ShifterEnabledIrq & FLEXIO_CHANNEL_5_MASK)) ||
              ((uint8)0U != (u8ShifterErrMaskFlag & u8ShifterErrEnabledIrq & FLEXIO_CHANNEL_5_MASK)) ||
              ((uint8)0U != (u8TimerMaskFlag & u8TimerEnabledIrq & FLEXIO_CHANNEL_5_MASK))
            )
        {
#ifdef LIN_CHANNEL_5_USED
            Flexio_Lin_Ip_IrqHandler(FLEXIO_CHANNEL_5, u8ShifterMaskFlag, u8ShifterErrMaskFlag, u8TimerMaskFlag);
#endif
#ifdef UART_CHANNEL_5_USED
            Flexio_Uart_Ip_IrqHandler(FLEXIO_CHANNEL_5, u8ShifterMaskFlag, u8ShifterErrMaskFlag, u8TimerMaskFlag);
#endif
#ifdef I2C_CHANNEL_5_USED
            Flexio_I2c_Ip_IrqHandler(FLEXIO_CHANNEL_5, u8ShifterMaskFlag, u8ShifterErrMaskFlag, u8TimerMaskFlag);
#endif
        }
    #elif defined(SPI_CHANNEL_5_USED)
        if  ( ((uint8)0U != (u8ShifterMaskFlag & u8ShifterEnabledIrq & FLEXIO_CHANNEL_5_MASK)) ||
              ((uint8)0U != (u8ShifterErrMaskFlag & u8ShifterErrEnabledIrq & FLEXIO_CHANNEL_5_MASK))
            )
        {
            Flexio_Spi_Ip_IrqHandler(FLEXIO_CHANNEL_5, u8ShifterMaskFlag, u8ShifterErrMaskFlag);
        }
    #elif defined(SENT_CHANNEL_5_USED)

        if ((uint8)0U != (u8TimerMaskFlag & u8TimerEnabledIrq & FLEXIO_CHANNEL_5_MASK))
        {
            Flexio_Sent_Ip_IrqHandler(FLEXIO_CHANNEL_5, u8TimerMaskFlag);
        }

    #elif defined(PWM_CHANNEL_5_USED)

        if ((uint8)0U != (u8TimerMaskFlag & u8TimerEnabledIrq & FLEXIO_CHANNEL_5_MASK) ||
            (uint8)0U != (u32PinMaskFlag & u32PinEnabledIrq & PWM_CHANNEL_5_PIN_ISR_MASK)
           )
        {
            Flexio_Pwm_Ip_IrqHandler(FLEXIO_CHANNEL_5, u8TimerMaskFlag, u32PinMaskFlag);
        }

    #endif /*if defined(LIN_CHANNEL_5_USED) || defined(UART_CHANNEL_5_USED) || defined(I2C_CHANNEL_5_USED) */
#endif /*ifdef FLEXIO_0_CH_5_USED*/

#ifdef FLEXIO_0_CH_6_USED
    #if defined(LIN_CHANNEL_6_USED) || defined(UART_CHANNEL_6_USED) || defined(I2C_CHANNEL_6_USED)
        if  ( ((uint8)0U != (u8ShifterMaskFlag & u8ShifterEnabledIrq & FLEXIO_CHANNEL_6_MASK)) ||
              ((uint8)0U != (u8ShifterErrMaskFlag & u8ShifterErrEnabledIrq & FLEXIO_CHANNEL_6_MASK)) ||
              ((uint8)0U != (u8TimerMaskFlag & u8TimerEnabledIrq & FLEXIO_CHANNEL_6_MASK))
            )
        {
#ifdef LIN_CHANNEL_6_USED
            Flexio_Lin_Ip_IrqHandler(FLEXIO_CHANNEL_6, u8ShifterMaskFlag, u8ShifterErrMaskFlag, u8TimerMaskFlag);
#endif
#ifdef UART_CHANNEL_6_USED
            Flexio_Uart_Ip_IrqHandler(FLEXIO_CHANNEL_6, u8ShifterMaskFlag, u8ShifterErrMaskFlag, u8TimerMaskFlag);
#endif
#ifdef I2C_CHANNEL_6_USED
            Flexio_I2c_Ip_IrqHandler(FLEXIO_CHANNEL_6, u8ShifterMaskFlag, u8ShifterErrMaskFlag, u8TimerMaskFlag);
#endif
        }
    #elif defined(SPI_CHANNEL_6_USED)
        if  ( ((uint8)0U != (u8ShifterMaskFlag & u8ShifterEnabledIrq & FLEXIO_CHANNEL_6_MASK)) ||
              ((uint8)0U != (u8ShifterErrMaskFlag & u8ShifterErrEnabledIrq & FLEXIO_CHANNEL_6_MASK))
            )
        {
            Flexio_Spi_Ip_IrqHandler(FLEXIO_CHANNEL_6, u8ShifterMaskFlag, u8ShifterErrMaskFlag);
        }
    #elif defined(SENT_CHANNEL_6_USED)

        if ((uint8)0U != (u8TimerMaskFlag & u8TimerEnabledIrq & FLEXIO_CHANNEL_6_MASK))
        {
            Flexio_Sent_Ip_IrqHandler(FLEXIO_CHANNEL_6, u8TimerMaskFlag);
        }

    #elif defined(PWM_CHANNEL_6_USED)

        if ((uint8)0U != (u8TimerMaskFlag & u8TimerEnabledIrq & FLEXIO_CHANNEL_6_MASK) ||
            (uint8)0U != (u32PinMaskFlag & u32PinEnabledIrq & PWM_CHANNEL_6_PIN_ISR_MASK)
           )
        {
            Flexio_Pwm_Ip_IrqHandler(FLEXIO_CHANNEL_6, u8TimerMaskFlag, u32PinMaskFlag);
        }

    #endif /*if defined(LIN_CHANNEL_6_USED) || defined(UART_CHANNEL_6_USED) || defined(I2C_CHANNEL_6_USED) */
#endif /*ifdef FLEXIO_0_CH_6_USED*/

#ifdef FLEXIO_0_CH_7_USED
    #if defined(LIN_CHANNEL_7_USED) || defined(UART_CHANNEL_7_USED) || defined(I2C_CHANNEL_7_USED)
        if  ( ((uint8)0U != (u8ShifterMaskFlag & u8ShifterEnabledIrq & FLEXIO_CHANNEL_7_MASK)) ||
              ((uint8)0U != (u8ShifterErrMaskFlag & u8ShifterErrEnabledIrq & FLEXIO_CHANNEL_7_MASK)) ||
              ((uint8)0U != (u8TimerMaskFlag & u8TimerEnabledIrq & FLEXIO_CHANNEL_7_MASK))
            )
        {

#ifdef LIN_CHANNEL_7_USED
            Flexio_Lin_Ip_IrqHandler(FLEXIO_CHANNEL_7, u8ShifterMaskFlag, u8ShifterErrMaskFlag, u8TimerMaskFlag);
#endif
#ifdef UART_CHANNEL_7_USED
            Flexio_Uart_Ip_IrqHandler(FLEXIO_CHANNEL_7, u8ShifterMaskFlag, u8ShifterErrMaskFlag, u8TimerMaskFlag);
#endif
#ifdef I2C_CHANNEL_7_USED
            Flexio_I2c_Ip_IrqHandler(FLEXIO_CHANNEL_7, u8ShifterMaskFlag, u8ShifterErrMaskFlag, u8TimerMaskFlag);
#endif
        }
    #elif defined(SPI_CHANNEL_7_USED)
        if  ( ((uint8)0U != (u8ShifterMaskFlag & u8ShifterEnabledIrq & FLEXIO_CHANNEL_7_MASK)) ||
              ((uint8)0U != (u8ShifterErrMaskFlag & u8ShifterErrEnabledIrq & FLEXIO_CHANNEL_7_MASK))
            )
        {
            Flexio_Spi_Ip_IrqHandler(FLEXIO_CHANNEL_7, u8ShifterMaskFlag, u8ShifterErrMaskFlag);
        }
    #elif defined(SENT_CHANNEL_7_USED)

        if ((uint8)0U != (u8TimerMaskFlag & u8TimerEnabledIrq & FLEXIO_CHANNEL_7_MASK))
        {
            Flexio_Sent_Ip_IrqHandler(FLEXIO_CHANNEL_7, u8TimerMaskFlag);
        }

    #elif defined(PWM_CHANNEL_7_USED)

        if ((uint8)0U != (u8TimerMaskFlag & u8TimerEnabledIrq & FLEXIO_CHANNEL_7_MASK) ||
            (uint8)0U != (u32PinMaskFlag & u32PinEnabledIrq & PWM_CHANNEL_7_PIN_ISR_MASK)
           )
        {
            Flexio_Pwm_Ip_IrqHandler(FLEXIO_CHANNEL_7, u8TimerMaskFlag, u32PinMaskFlag);
        }
    #endif /*if defined(LIN_CHANNEL_7_USED) || defined(UART_CHANNEL_7_USED) || defined(I2C_CHANNEL_7_USED) */
#endif /*ifdef FLEXIO_0_CH_7_USED*/

    }
    else /* Flexio_Ip_IpIsInitialized[FLEXIO_INSTANCE_NO] */
    {
       /* Clear ALL the flags in case of the uninitialized driver
       The status flag can also be cleared by writing a logic one to the flag for all modes except Match Continuous/ State /Logic.
       */
       baseAddr->SHIFTERR  =  (uint32) u8ShifterErrMaskFlag ;
       baseAddr->TIMSTAT   =  (uint32) u8TimerMaskFlag ;
#ifdef FLEXIO_IP_PIN_ISR_USED
       baseAddr->PINSTAT   =  (uint32) u32PinMaskFlag;
#endif

    }
}

ISR(MCL_FLEXIO_ISR)
{
    Flexio_Mcl_Ip_CommonIrq();
}

#define MCL_STOP_SEC_CODE
#include "Mcl_MemMap.h"

#ifdef __cplusplus
}
#endif

/** @} */
