/* ISR for the GPMI dma complete IRQ. 
Then clears and enables the interrupt.  */
void gpmi_dma_complete_isr()
/* ISR for the GPMI dma complete IRQ. 
Then clears and enables the interrupt.  */
void gpmi_dma_complete_isr()
{
    GpmiDmaInfo_t * pWaitStruct = &g_gpmi.dmaInfo;
    bool bSomeError = FALSE;
    if ((HW_APBH_CTRL2_RD() & (BM_APBH_CTRL2_CH0_ERROR_IRQ << (pWaitStruct->dmaChannel))) != 0)
    {
        HW_APBH_CTRL2_CLR(BP_APBH_CTRL2_CH0_ERROR_IRQ << pWaitStruct->dmaChannel);
        bSomeError = TRUE;
    }
    pWaitStruct->u16DmaWaitStatus |= kNandGpmiDmaWaitMask_GpmiDma;
    if (pWaitStruct->u16DmaWaitMask == pWaitStruct->u16DmaWaitStatus)
    {
        if ( !bSomeError )
        {
            spinlock_unlock(&g_gpmi.dmaInfo.irqSpinlock);
        }
    }
    gpmi_clear_dma_isr_enable( pWaitStruct->dmaChannel );
}