This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Problem with ACPY3 on DM8168

Dear all,

I've added the EDMA interface to a modified VLPB OMX component to copy external memory content to the DSP internal memory.I've followed the fastcopy example.

I've added the ACPY3 and DMAN3 variables to DspAppMain.cfg, using for the heapInternal and heapExternal variables the value "DSKT2_HEAP". Then I added in my OMX component init function the following code:

    //INITIALIZING THE DMA
    /*
     * Initialize DMA manager and ACPY3 library for XDAIS algorithms
     * and grant DMA resources
     */
    DMAN3_init();
    ACPY3_init();
    //activate channels
    IDMA3_ChannelRec dmaTab;
    Int status;
    /* Set up the DMA Channel descriptor with the transfer parameters  */
    dmaTab.numTransfers = 1;
    dmaTab.numWaits = 1;
    dmaTab.priority = IDMA3_PRIORITY_URGENT;
    /*
     * The ACPY3 transfer protocol will be used as the IDMA3 protocol object
     * This object defines the memory requirements and the initialization and
     * de-initialization functions for the protocol's environment
     */
    dmaTab.protocol = &ACPY3_PROTOCOL;
    dmaTab.persistent = FALSE;
    /*
     * On success this call will return a valid DMA channel handle with the
     * attributes defined above
     */
    status = DMAN3_createChannels(0, &dmaTab, 1);
    if (status == DMAN3_SOK )
    {
        h = dmaTab.handle;
        ACPY3_activate(h);
        Log_print1(Diags_USER1,"ACPY3_activate(0x%x)",h);
    }
    else
    {
        Log_prin12(Diags_USER1,"ERROR in ACPY3_activate(0x%x[%d])",h);
        eError = OMX_ErrorInsufficientResources;
        goto EXIT;
    }

The code compiles successfully, and I see on the log that the structures are initialized without a problem. However, when I try to copy a segment of memory, the application stalls at ACPY3_start(). How can I debug this interface? Is there any more necessary steps to add DMA3 to my OMX component ?

Thanks,

Danillo

  • Hi Danillo, you should be using ECPY rather than ACPY3. There are examples in the Codec Engine folder I believe.

    Ralph

  • Hi Ralph,

    thanks for your answer. I could not find any examples on codec engine that uses ECPY, but I did find a couple of examples at {fc_path}/examples/ti/sdo/fc/rman/examples.

    I was able to successfully add and compile the code with ECPY, but I still get the same problem. The program hangs waiting for the copy function to end, which never happens. Here are the lines I added to my configuration file:

    var RMAN = xdc.useModule('ti.sdo.fc.rman.RMAN');
    RMAN.useDSKT2 = true; 
    RMAN.yieldSamePriority = true;
    var ECPY = xdc.useModule('ti.sdo.fc.ecpy.ECPY');
    ECPY.persistentAllocFxn = "DSKT2_allocPersistent";
    ECPY.persistentFreeFxn = "DSKT2_freePersistent";
    var EDMA3CHAN = xdc.useModule('ti.sdo.fc.ires.edma3chan.EDMA3CHAN');
    var META = xdc.useModule('ti.sdo.fc.edma3.Settings');
    META.eventQueueSetup = true;
    META.queueTCMap[0] = 3;       
    META.queuePriority[0] = 3;     
    META.maxPaRams = [10,10,0,0];
    META.maxTccs = [4,4,0,0];
    META.maxEdmaChannels = [4,4,0,0];
    META.maxQdmaChannels = [1,0,0,0];

    Here is the initialization code for my OMX component

         _DSKT2_init();
         status = RMAN_init();
         if (status != IRES_OK) {
             Log_print0(Diags_USER1,"ERROR in RMAN_init");
             eError = OMX_ErrorInsufficientResources;
             goto EXIT;
         }
         resourceDesc[0].resourceName = IRES_EDMA3CHAN_PROTOCOLNAME;
         IRES_EDMA3CHAN_SETPROTOCOLREVISION_2_0_0(&edmaProtocolRev);
         resourceDesc[0].revision = &edmaProtocolRev;
         /* set EDMA3 Request Descriptor's protocol args */
         edmaProtocolArgs.size                         = sizeof(IRES_EDMA3CHAN_ProtocolArgs);
         edmaProtocolArgs.mode                      = IRES_SCRATCH;
         edmaProtocolArgs.numPaRams         = 3;
         edmaProtocolArgs.paRamIndex         = IRES_EDMA3CHAN_PARAM_ANY;
         edmaProtocolArgs.tccIndex                  = IRES_EDMA3CHAN_TCC_ANY;
         edmaProtocolArgs.numTccs                 = 1;
         edmaProtocolArgs.qdmaChan             = IRES_EDMA3CHAN_CHAN_NONE;
         edmaProtocolArgs.edmaChan             = IRES_EDMA3CHAN_EDMACHAN_ANY;
         edmaProtocolArgs.contiguousAllocation            = TRUE;
         edmaProtocolArgs.shadowPaRamsAllocation  = FALSE;
         resourceDesc[0].protocolArgs     = (IRES_ProtocolArgs *)&edmaProtocolArgs;
         resourceDesc[0].handle         = (IRES_Handle)NULL;
         status = RMAN_allocateResources(1/*taskId*/,resourceDesc, 1, 1/*scratchId*/);
         if (status != IRES_OK) {
             Log_print0(Diags_USER1,"ERROR in RMAN_allocateResources");
             eError = OMX_ErrorInsufficientResources;
             goto EXIT;
         }
         hECPY = ECPY_createHandle((IRES_EDMA3CHAN2_Handle)resourceDesc[0].handle,(IALG_Handle)1/*taskId*/);
         ECPY_activate(hECPY);

    And here is the code where I perform a copy of a content from the DSP internal memory to the output buffer

        ECPY_Params p;
        p.transferType = ECPY_1D2D;
        p.elementSize = lineLen;
        p.numElements = lineCnt;
        p.srcElementIndex = lineLen;
        p.dstElementIndex = linePitch;
        p.srcFrameIndex = 0;
        p.dstFrameIndex = 0;
        p.numFrames = 1;
        p.srcAddr = (void*)pInTextBuf;
        p.dstAddr = (void*)pOutTextBuf;
        Log_print5(Diags_USER1,"ECPY_configure:(0x%x,0x%x,%d,%d,%d,%d)",p.srcAddr,p.dstAddr,lineLen,lineCnt,linePitch);
        ECPY_configure(hECPY &p, 1);
        Log_print0(Diags_USER1,"ECPY_start");
        ECPY_start(hECPY);
        Log_print0(Diags_USER1,"ECPY_wait");
        ECPY_wait(hECPY);
        Log_print0(Diags_USER1,"Leaving CopyTextWarped2Ext");

    As I said before, the application hangs at ECPY_wait. Do you have any ideas why the copy is not being made, and how I can debug this interface? I do not see any log messages from the RMAN or DMA3 interfaces.

    Thank you very much for your help.

    Best regards,

    Danillo

  • Hi Danillo, there is an example in this location:

    framework_components-3_24_02_15/examples/archive/TI816X_bios_elf_ezsdk/ex22_universal_ecpy_dsp.zip


    Make sure you have the full version of framework components. Your code looks fine to me so I'm not sure why it isn't working but this example may help you.

    Ralph