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

📄 edma.c

📁 该代码实现了 两次下载法在dspC6713平台上 烧写flash的操作过程
💻 C
字号:
/*
 *  Copyright 2002 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.4.14 12-06-02 (xdas-d11.16)" */
/*
 *  ======== edma.c ========
 */

//#include <std.h>
extern unsigned int pci_cnt,edmastartflag;

#include "EDMA.h"
#include "INTR.H"
#include "c6711dsk.h"
#define Uns unsigned int

/*
 *  ======== 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 */
	*(volatile Uns *) CCER = 0x0000; 
    /*----------------------------------------------------------------------*/
    *(volatile Uns *) EDMA_EVENTN_OPT   = 0x0;//0x28710000;   // TCC = 1 for Receive
    *(volatile Uns *) EDMA_EVENTN_SRC   = 0x0;//McBSP0_DRR;   // Source = McBSP Rcv  
    *(volatile Uns *) EDMA_EVENTN_CNT   = 0x0;          // Count = not known yet
    *(volatile Uns *) EDMA_EVENTN_DST   = 0x0;// 0x0;          // Dst = not known yet
    *(volatile Uns *) EDMA_EVENTN_IDX   = 0x0;    // 4 byte offset (load low 16)
    *(volatile Uns *) EDMA_EVENTN_LNK   = 0x0;    // No auto reload parameters
    
    
    *(volatile Uns *) EDMA_EVENTD_OPT   = 0;//0x28710000;   // TCC = 1 for Receive
    *(volatile Uns *) EDMA_EVENTD_SRC   = 0;//McBSP0_DRR;   // Source = McBSP Rcv  
    *(volatile Uns *) EDMA_EVENTD_CNT   = 0;          // Count = not known yet
    *(volatile Uns *) EDMA_EVENTD_DST   = 0;// 0x0;          // Dst = not known yet
    *(volatile Uns *) EDMA_EVENTD_IDX   = 0;    // 4 byte offset (load low 16)
    *(volatile Uns *) EDMA_EVENTD_LNK   = 0; 
	*(volatile Uns *) ESR = 0x0010;
	
    /* Initialise EDMA for Transfer from McBSP_0 on Receipt of New Sample   */
    *(volatile Uns *) EDMA_EVENTD_OPT   = 0x20200003;//0x28710000;   // TCC = 1 for Receive
    *(volatile Uns *) EDMA_EVENTD_SRC   = 0xB0000000;//McBSP0_DRR;   // Source = McBSP Rcv  
    *(volatile Uns *) EDMA_EVENTD_CNT   = 0x000000F9;          // Count = not known yet
    *(volatile Uns *) EDMA_EVENTD_DST   = 0xA0004000;// 0x0;          // Dst = not known yet
    *(volatile Uns *) EDMA_EVENTD_IDX   = 0;    // 4 byte offset (load low 16)
    *(volatile Uns *) EDMA_EVENTD_LNK   = 0x00F40090;    // No auto reload parameters
    
	//*(volatile Uns *) ESR = 0x0010;
    /*----------------------------------------------------------------------*/
    /* 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 = 0xffff;    /* Enable Rx/Tx Complete Interrupts */
    *(volatile Uns *) ECR = 0xffff;     /* Clear all pending events */
}

/*
 *  ======= EDMA_rxStart ========
 */
void EDMA_rxStart(unsigned int cnt)
{

//	int addr=0x80100000;
//	for(i=0;i<450;i+=4);
	//*(volatile Uns *)(addr+i)=(0x88990099+pci_flag);
    /* Reconfig EDMA channel for next receive buffer */
    *(volatile Uns *) EDMA_EVENTD_CNT   = cnt;//0x00000F9;
    *(volatile Uns *) EDMA_EVENTD_DST   = 0xA0004000+pci_cnt*0x400;
    cnt<<=16;
    cnt+=0x0090;
	*(volatile Uns *) EDMA_EVENTD_LNK   = cnt;//0x00F40090;    // No auto reload parameters
	
    *(volatile Uns *) EER = 0x0010;     /* Enable McBSP0 Rx/Tx Events */
    *(volatile Uns *) ESR = 0x0010;     /* Force Rx Event Start */
	pci_cnt++;
	if(pci_cnt>=16) //注意 修改  匹配  
		pci_cnt = 0;
}


⌨️ 快捷键说明

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