TMS320C6678: QDMA Inerrupt by csl and bios

Part Number: TMS320C6678

Tool/software:

Setup:            

  • Board: EVM6678
  • SDK: Processor SDK 6.03.00.106
  • Example: Nimu_emacExample (includes NDK library and Daemon function)
  • Added module: H.265 encoder example (h265venc_ti_c66x)

Both the NIMU/NDK example and the H.265 encoder are running correctly.

static Int32 qdma_link_xfer_region (Int32 instNum, Uint8 channelNum, Int32 regionNum , Int32 myParam, Uint8 tcc)
{
    CSL_Edma3Handle             hModule;
    CSL_Edma3Obj                edmaObj;
    CSL_Edma3ParamHandle        hParamPong,hParamPing;
    CSL_Edma3ChannelObj         chObj;
    CSL_Edma3CmdIntr            regionIntr;
    CSL_Edma3CmdDrae            regionAccess;
    CSL_Edma3ChannelHandle      hChannel;
    CSL_Edma3ParamSetup         myParamSetup;
    CSL_Edma3Context            context;
    CSL_Edma3ChannelAttr        chAttr;
    CSL_Edma3CmdQrae            qraeSetup;
    CSL_Status                  status;   
    Uint32                      loopIndex;

    /* Module initialization */
    if (CSL_edma3Init(&context) != CSL_SOK)
    {
        printf ("Error: EDMA module initialization failed\n");   
        return -1;
    }

    /* Module level open */
    hModule = CSL_edma3Open(&edmaObj,instNum,NULL,&status);
    if ((hModule == NULL) || (status != CSL_SOK))
    {
        printf ("Error: EDMA module open failed\n");
        return -1;
    }

    /* Is this for GLOBAL or SHADOW Region */
    if (regionNum != CSL_EDMA3_REGION_GLOBAL)
    {
        /* Shadow Region: Enable DRAE enable(Bits 0-15) it. */
        regionAccess.region = regionNum;
        regionAccess.drae   = 0xFFFF;   
        regionAccess.draeh  = 0x0000;
        if (CSL_edma3HwControl(hModule,CSL_EDMA3_CMD_DMAREGION_ENABLE, &regionAccess) != CSL_SOK)
        {
             printf ("Error: EDMA region enable command failed\n");
             return -1;
        }

        /* Enable access for all QDMA channels in the SHADOW Region. */
        qraeSetup.region = regionNum;
        qraeSetup.qrae   = 0xFF;
        if (CSL_edma3HwControl(hModule,CSL_EDMA3_CMD_QDMAREGION_ENABLE, &qraeSetup) != CSL_SOK)
        {
             printf ("Error: EDMA QDMA region enable command failed\n");
             return -1;
        }
    }
    
    regionIntr.region = regionNum;
    regionIntr.intr   = (1u << tcc);
    regionIntr.intrh  = 0;
    CSL_edma3HwControl(hModule, CSL_EDMA3_CMD_INTR_ENABLE, &regionIntr);
    
    /* QDMA Channel Open */
    chAttr.regionNum = regionNum;
    chAttr.chaNum    = channelNum;
    hChannel = CSL_edma3ChannelOpen(&chObj, instNum, &chAttr, &status);   
    if ((hChannel == NULL) || (status != CSL_SOK))
    {
        printf ("Error: EDMA channel open failed\n");    
        return -1;
    }
 
    CSL_edma3HwChannelSetupParam (hChannel, myParam);

    /* Setup the trigger word for the QDMA Channel. */
    CSL_edma3HwChannelSetupTriggerWord(hChannel, CSL_EDMA3_TRIGWORD_SRC);
        

    hParamPing = CSL_edma3GetParamHandle(hChannel, myParam, &status);
    if (hParamPing == NULL)
    {
        printf ("Error: EDMA get handle for param entry 1 failed\n");    
        return -1;
    }
 
    /* Setup param entry */                                     
    myParamSetup.option = CSL_EDMA3_OPT_MAKE(CSL_EDMA3_ITCCH_DIS, \
                                             CSL_EDMA3_TCCH_DIS, \
                                             CSL_EDMA3_ITCINT_DIS, \
                                             CSL_EDMA3_TCINT_EN,\
                                             tcc,CSL_EDMA3_TCC_NORMAL,\
                                             CSL_EDMA3_FIFOWIDTH_NONE, \
                                             CSL_EDMA3_STATIC_EN, \
                                             CSL_EDMA3_SYNC_A, \
                                             CSL_EDMA3_ADDRMODE_INCR, \
                                             CSL_EDMA3_ADDRMODE_INCR);
    myParamSetup.srcAddr    = (Uint32)srcBuff1;         
    myParamSetup.aCntbCnt   = CSL_EDMA3_CNT_MAKE(256,1);       
    myParamSetup.dstAddr    = (Uint32)dstBuff1;        
    myParamSetup.srcDstBidx = CSL_EDMA3_BIDX_MAKE(1,1);     
    myParamSetup.linkBcntrld= CSL_EDMA3_LINKBCNTRLD_MAKE(CSL_EDMA3_LINK_NULL,0);     
    myParamSetup.srcDstCidx = CSL_EDMA3_CIDX_MAKE(0,1);     
    myParamSetup.cCnt       = 1;


    if (CSL_edma3ParamSetup(hParamPing, &myParamSetup) != CSL_SOK)
    {
         printf ("Error: EDMA param setup failed\n");
         return -1;
    }
    
    /* Enable Channel */
    if (CSL_edma3HwChannelControl(hChannel,CSL_EDMA3_CMD_CHANNEL_ENABLE, NULL) != CSL_SOK)
    {
         printf ("Error: EDMA channel enable command failed\n");
         return -1;
    }

    /* Trigger the word by writing to the trigger word... */    
    if (CSL_edma3ParamWriteWord(hParamPing,CSL_EDMA3_TRIGWORD_SRC,(Uint32)srcBuff1) != CSL_SOK) {
         printf ("Error: EDMA param write word failed\n");
         return -1;
    }
    
    /* Poll IPR bit */
    regionIntr.region = regionNum;
    do {
        CSL_edma3GetHwStatus(hModule,CSL_EDMA3_QUERY_INTRPEND,&regionIntr);
    } while (!(regionIntr.intr & (1 << tcc)));
    
    /* Clear pending interrupt */
    if (CSL_edma3HwControl(hModule,CSL_EDMA3_CMD_INTRPEND_CLEAR, &regionIntr) != CSL_SOK)
    {
         printf ("Error: EDMA clear interrupt pend command failed\n");
         return -1;
    }

}


void main (void)
{
    Uint8  channelNum = 16;
    Int32  regionNum = 0;
    Uint8  instNum = 0;
    Int32  myParamNum = 1;
    Uint8  tccNum = 0;
    
    qdma_link_xfer_region(instNum, channelNum, regionNum , myParamNum, tccNum);
 
    return;
}

upper code worked ok and QDMA is passed .we want to have interrupt of transfer complete on code so add this downner code:

    Hwi_Params_init(&hwiParams);
    hwiParams.enableInt = TRUE;
    hwiParams.eventId = CSL_INTC0_CPU_2_EDMA3CCINT0;
    hwi = Hwi_create(CSL_INTC0_CPU_2_EDMA3CCINT0, callbackFunc, &hwiParams, NULL);
    if (hwi == NULL) {
        System_printf("Hwi_create failed\n");
        return -1;
    }

but call back function never called. so what is the problem ?

  • Hi,

    Could you please confirm the eventId is configured correctly?

    www.ti.com/.../tms320c6678.pdf

    Regards,

    Betsy Varughese

  • By Respect :

    Since we are using TPCC0, Region0 (Core0), and based on the Table 7-38 page171  the value 38 has been selected.

    (  38   ,  EDMA3CC0 CCINT0      ,EDMA3CC0 individual completion interrupt  )

    If possible:

    1. Please explain on what basis the correct value of hwiParams.eventId and the first argument of Hwi_create should be assigned, and what they should be.

    2. Is there any other  c code that also needs to be added to the above code or the .cfg file?

    Thank you."

  • Hi Amir,

    Looks good.

    Please explain on what basis the correct value of hwiParams.eventId and the first argument of Hwi_create should be assigned, and what they should be.

    HWi_create API argument definition is clearly mentioned the Bios_User_Guide(Attached the screenshot) [ you can also see an example from the document].

    id ---> Interrupt number (CPU Vector) i.e Which ISR slot to use.

    HWi_Create API usage:

    hwiParams.eventId is the peripheral interrupt event number. (These numbers are mentioned in TRM as you mentioned above).

    Regards,

    Betsy Varughese