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.

DMA 是否可以用于CAN 和 SCI 的收发?

如题,如果可以的话,是否可以有这方面的例子程序提供一下?

  • http://www.deyisupport.com/question_answer/microcontrollers/hercules/f/70/t/45136.aspx

    http://www.deyisupport.com/question_answer/microcontrollers/hercules/f/70/t/62677.aspx

    SCI

    -----------------

    经测试能够在RM49L952上运行,仅供参考:

    sciInit();
    load_data();
    /* - DMA Configuration */

    /* Enable DMA */
    dmaEnable();

    /* assigning dma request: channel-0 with request line - 1 - TX*/
    /* DMA Request 29 is for LIN ( SCI2) Transmit */
    /* Refer Data sheet - Default DMA Request Map section */
    dmaReqAssign(DMA_CH0,29);

    /* - configuring dma control packets */
    g_dmaCTRLPKT.SADD = (uint32)(&TX_DATA); /* source address */
    g_dmaCTRLPKT.DADD = (uint32)(&scilinREG->TD); /* destination address */
    g_dmaCTRLPKT.CHCTRL = 0; /* channel control */
    g_dmaCTRLPKT.FRCNT = D_SIZE; /* frame count */
    g_dmaCTRLPKT.ELCNT = 1; /* element count */
    g_dmaCTRLPKT.ELDOFFSET = 0; /* element destination offset - is required? */
    g_dmaCTRLPKT.ELSOFFSET = 0; /* element source offset - is required? */
    g_dmaCTRLPKT.FRDOFFSET = 0; /* frame detination offset - is required? */
    g_dmaCTRLPKT.FRSOFFSET = 0; /* frame source offset - is required? */
    g_dmaCTRLPKT.PORTASGN = 4; /* port b */
    g_dmaCTRLPKT.RDSIZE = ACCESS_8_BIT; /* read size */
    g_dmaCTRLPKT.WRSIZE = ACCESS_8_BIT; /* write size */
    g_dmaCTRLPKT.TTYPE = FRAME_TRANSFER ; /* transfer type */
    g_dmaCTRLPKT.ADDMODERD = ADDR_INC1; /* address mode read */
    g_dmaCTRLPKT.ADDMODEWR = ADDR_FIXED; /* address mode write */
    g_dmaCTRLPKT.AUTOINIT = AUTOINIT_OFF; /* autoinit (loop) */
    dmaSetCtrlPacket(DMA_CH0,g_dmaCTRLPKT);
    /* - setting dma control packets for transmit */
    dmaSetCtrlPacket(DMA_CH0,g_dmaCTRLPKT);

    /* - setting the dma channel to trigger on h/w request */
    dmaSetChEnable(DMA_CH0, DMA_HW);

    /* Enable TX DMA */
    scilinREG->SETINT = (1 << 16);