/*!
 * @brief The function DSPI_DRV_EdmaIRQHandler passes IRQ control to either the master or
 * slave driver.
 *
 * The address of the IRQ handlers are checked to make sure they are non-zero before
 * they are called. If the IRQ handler's address is zero, it means that driver was
 * not present in the link (because the IRQ handlers are marked as weak). This would
 * actually be a program error, because it means the master/slave config for the IRQ
 * was set incorrectly.
 */
void DSPI_DRV_EdmaIRQHandler(uint32_t instance)
{
    assert(instance < SPI_INSTANCE_COUNT);
    SPI_Type * baseAddr = (SPI_Type *)g_dspiBaseAddr[instance];

    if (DSPI_HAL_IsMaster(baseAddr))
    {
        /* Master mode.*/
        DSPI_DRV_EdmaMasterIRQHandler(instance);
    }
    else
    {
        /* Slave mode.*/
        DSPI_DRV_EdmaSlaveIRQHandler(instance);
    }
}
/*!
 * @brief The function DSPI_DRV_IRQHandler passes IRQ control to either the master or
 * slave driver.
 *
 * The address of the IRQ handlers are checked to make sure they are non-zero before
 * they are called. If the IRQ handler's address is zero, it means that driver was
 * not present in the link (because the IRQ handlers are marked as weak). This would
 * actually be a program error, because it means the master/slave config for the IRQ
 * was set incorrectly.
 */
void DSPI_DRV_IRQHandler(uint32_t instance)
{
    assert(instance < SPI_INSTANCE_COUNT);
    SPI_Type *base = g_dspiBase[instance];

    if (DSPI_HAL_IsMaster(base))
    {
        /* Master mode.*/
        DSPI_DRV_MasterIRQHandler(instance);
    }
    else
    {
        /* Slave mode.*/
        DSPI_DRV_SlaveIRQHandler(instance);
    }
}