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.

EDMA 自链接



请问,

EDMA在发送初始化和发送完成中断中,都会用到的这个函数设置为自链接,是什么作用?

/*
** Assigns loop job for a parameter set
*/
static void ParamTxLoopJobSet(unsigned short parId)
{
EDMA3CCPaRAMEntry paramSet;

memcpy(&paramSet, &txDefaultPar, SIZE_PARAMSET - 2);

/* link the paRAM to itself */
paramSet.linkAddr = parId * SIZE_PARAMSET;

EDMA3SetPaRAM(SOC_EDMA30CC_0_REGS, parId, &paramSet);
}

  • 请教 @

    还有个问题,每次启动发送前 不需要判断下这个通道是否处于空闲状态吗?(官方mcsap-edma demo)

    while(1)
    {
    if(lastFullRxBuf != lastSentTxBuf)
    {
    /*
    ** Start the transmission from the link paramset. The param set
    ** 1 will be linked to param set at PAR_TX_START. So do not
    ** update paRAM set1.
    */
    parToSend = PAR_TX_START + (parOffTxToSend % NUM_PAR);
    parOffTxToSend = (parOffTxToSend + 1) % NUM_PAR;
    parToLink = PAR_TX_START + parOffTxToSend;

    lastSentTxBuf = (lastSentTxBuf + 1) % NUM_BUF;

    /* Copy the buffer */
    memcpy((void *)txBufPtr[lastSentTxBuf],
    (void *)rxBufPtr[lastFullRxBuf],
    AUDIO_BUF_SIZE);

    /*
    ** Send the buffer by setting the DMA params accordingly.
    ** Here the buffer to send and number of samples are passed as
    ** parameters. This is important, if only transmit section
    ** is to be used.
    */
    BufferTxDMAActivate(lastSentTxBuf, NUM_SAMPLES_PER_AUDIO_BUF,
    (unsigned short)parToSend,
    (unsigned short)parToLink);
    }
    }

  • while(1)里的if判断:

    zc wang 说:
    if(lastFullRxBuf != lastSentTxBuf)

    以及中断服务函数里对这个全局变量的更新

    static void McASPRxDMAComplHandler(void)
    {
    unsigned short nxtParToUpdate;

    /*
    ** Update lastFullRxBuf to indicate a new buffer reception
    ** is completed.
    */
    lastFullRxBuf = (lastFullRxBuf + 1) % NUM_BUF;

    while(1)的if不是每次都进去的。

    更重要的是,这是事件触发的EDMA,没有空闲的说话。只有配置好参数,使能后,等事件来触发传输。

  • 从上在代码来说就是更新EDMA的参数表.

  • hi,@

    1、接收中断里 ParamTxLoopJobSet() 和 while(1)里BufferTxDMAActivate(),都对 paramSet 重新赋值,他们有什么联系和区别呢?

    另外,我把其中接收中断ParamTxLoopJobSet()注释掉,声音播放不受影响呀?

    2、我的理解 :EDMA一直由McASP不间断的触发,每次EDMA发送完成,中断里 ParamTxLoopJobSet() link地址是自己,是为了防止underflow 而循环有数据发送吗? BufferTxDMAActivate()是真正更新数据地址的。

    期待您的回复~