Ejemplo n.º 1
0
int DMA_complete(void* handle)
{
	return ACPY3_complete((IDMA3_Handle)handle);
}
/*
 *  ======== ACPY3_completeLinked ========
 * Non-blocking query to check completion of an individual
 * transfer in a Linked transfer.
 */
Bool ACPY3_completeLinked(IDMA3_Handle handle, unsigned short waitId)
{
#ifndef _ACPY3_CPUCOPY_
    Uns     tcc;
#endif
    Bool status;
   
    GT_2trace(CURTRACE, GT_ENTER,
            "ACPY3_completeLinked> Enter (handle=0x%x, waitId =%d)\n",
            handle, waitId); 

    GT_assert(CURTRACE, (handle != NULL) && (waitId < handle->numTccs));

    ACPY3_INSTR_CALLHOOKFXN(((ACPY3_MoreEnv *)handle->env)->extendedHooks, 
        handle, ACPY3_INSTR_COMPLETELINKED_ENTER);

    if (!handle->transferPending) {

        GT_0trace(CURTRACE, GT_2CLASS,
                "ACPY3_completeLinked> No transfers pending\n");

        /* No transfers pending - channel already waited on since last start */
        ACPY3_INSTR_CALLHOOKFXN(((ACPY3_MoreEnv *)handle->env)->extendedHooks,
                handle, ACPY3_INSTR_COMPLETELINKED_EXIT);

        GT_0trace(CURTRACE, GT_ENTER,
                "ACPY3_completeLinked> Exit (status=TRUE)\n");

        return (TRUE);
    }

    if (waitId == (handle->numTccs - 1)) {

        ACPY3_INSTR_CALLHOOKFXN(((ACPY3_MoreEnv *)handle->env)->extendedHooks,
                handle, ACPY3_INSTR_COMPLETELINKED_EXIT);

        GT_0trace(CURTRACE, GT_4CLASS, "ACPY3_completeLinked> "
                "Waiting for the last in a set of linked transfers\n");

        return (ACPY3_complete(handle));
    }

#ifndef _ACPY3_CPUCOPY_
    tcc = handle->tccTable[waitId + 1];

    /*
     * Wait for a channel only once. Set the 'pending' flag whenever new
     * transfer is submitted, then clear it when ACPY3_wait is issued.
     */
    ACPY3_INSTR_CALLHOOKFXN(((ACPY3_MoreEnv *)handle->env)->extendedHooks, 
            handle, ACPY3_INSTR_COMPLETELINKED_EXIT);

    GT_1trace(CURTRACE, GT_4CLASS,
            "  _ACPY3_completeLinked> Waiting for tcc %d\n", tcc);

    status = checkForCompletion(tcc);

    GT_1trace(CURTRACE, GT_ENTER, "ACPY3_completeLinked> Exit (status=%d)\n",
            status);

    return (status);

#else

    ACPY3_INSTR_CALLHOOKFXN(((ACPY3_MoreEnv *)handle->env)->extendedHooks, 
            handle, ACPY3_INSTR_COMPLETELINKED_EXIT);

    status = ACPY3_complete(handle);

    GT_1trace(CURTRACE, GT_ENTER, "ACPY3_completeLinked> Exit (status=%d)\n",
            status);

    return (status);
#endif
}