⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 edma.c

📁 使用在dsp TI DSK6711中 很多controller 的例子
💻 C
字号:
/*

 *  Copyright 2003 by Texas Instruments Incorporated.

 *  All rights reserved. Property of Texas Instruments Incorporated.

 *  Restricted rights to use, duplicate or disclose this code are

 *  granted through contract.

 *

 *  @(#) XDAS 2.51.00 11-29-2003 (xdas-2.50.00.9)

 */

/*

 *  ======== edma.c ========

 */



#include <std.h>



#include <dss.h>

#include <edma.h>



#include "c6211dsk.h"





/*

 *  ======== EDMA_init ========

 *  Initialise EDMA Controller

 */

Void EDMA_init(Void)

{

    /* General EDMA Initialisation */

    *(volatile Uns *) EER = 0x0000;     /* Disable all events */

    *(volatile Uns *) ECR = 0xffff;     /* Clear all pending events */

    *(volatile Uns *) CIER = 0x0000;    /* Disable all events to Interrupt */

    *(volatile Uns *) CIPR = 0xffff;    /* Clear all pending Queued EDMA ints */



    /*----------------------------------------------------------------------*/

    /* Initialise EDMA for Transfer from McBSP_0 on Receipt of New Sample   */

    *(volatile Uns *) EDMA_EVENTD_OPT   = 0x28710000;   // TCC = 1 for Receive

    *(volatile Uns *) EDMA_EVENTD_SRC   = McBSP0_DRR;   // Source = McBSP Rcv  

    *(volatile Uns *) EDMA_EVENTD_CNT   = 0x0;          // Count = not known yet

    *(volatile Uns *) EDMA_EVENTD_DST   = 0x0;          // Dst = not known yet

    *(volatile Uns *) EDMA_EVENTD_IDX   = 4;    // 4 byte offset (load low 16)

    *(volatile Uns *) EDMA_EVENTD_LNK   = 0;    // No auto reload parameters



    /*----------------------------------------------------------------------*/

    /* Initialise EDMA for Transfer Samples back to McBSP_0 when TXer Ready */

    *(volatile Uns *) EDMA_EVENTC_OPT   = 0x4B120000;   // TCC = 2 for Transmit

    *(volatile Uns *) EDMA_EVENTC_SRC   = 0x0;          // Src = not known yet

    *(volatile Uns *) EDMA_EVENTC_CNT   = 0x0;          // Cnt = not known yet

    *(volatile Uns *) EDMA_EVENTC_DST   = McBSP0_DXR;   // Dst = McBSP Transmit

    *(volatile Uns *) EDMA_EVENTC_IDX   = 4;    // 4 byte offset (load low 16)

    *(volatile Uns *) EDMA_EVENTC_LNK   = 0;    // No auto reload parameters

    

    /*----------------------------------------------------------------------*/

    /* Enable Events and Interrupts                                     */

    *(volatile Uns *) CIER = 0x0006;    /* Enable Rx/Tx Complete Interrupts */

}



/*

 *  ======= EDMA_rxStart ========

 */

Void EDMA_rxStart(Void *dst, Int nwords)

{

    /* Reconfig EDMA channel for next receive buffer */

    *(volatile Uns *) EDMA_EVENTD_CNT   = (Uns) DSS_rxCnt;

    *(volatile Uns *) EDMA_EVENTD_DST   = (Uns) DSS_rxPtr;



    *(volatile Uns *) EER = 0x3000;     /* Enable McBSP0 Rx/Tx Events */

    *(volatile Uns *) ESR = 0x2000;     /* Force Rx Event Start */

}



/*

 *  ======= EDMA_txStart ========

 */

Void EDMA_txStart(Void *src, Int nwords)

{

    /* Reconfig EDMA channel for next transmit buffer */

    *(volatile Uns *) EDMA_EVENTC_SRC   = (Uns) DSS_txPtr;

    *(volatile Uns *) EDMA_EVENTC_CNT   = (Uns) DSS_txCnt;



    *(volatile Uns *) EER = 0x3000;     /* Enable McBSP0 Rx/Tx Events */

    *(volatile Uns *) ESR = 0x1000;     /* Force Tx Event Start */

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -