?? edma.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>
#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 = 0x0010; /* enable external int 4 to edma */
*(volatile Uns *) ECR = 0xffff; /* Clear all pending events */
*(volatile Uns *) CIER = 0x0350; /* enable edma int 4 6 8 9 */
*(volatile Uns *) CIPR = 0xffff; /* Clear all pending Queued EDMA ints */
*(volatile Uns *) CCER = 0x0000;
/*----------------------------------------------------------------------*/
// *(volatile Uns *) ESR = 0x0010;
// *(unsigned volatile int *) ECR = 0xffff;
// *(unsigned volatile int *) EER = 0xffff;
// *(unsigned volatile int *) CIPR = 0xffff;
// *(unsigned volatile int *) CIER = 0xffff;
/*----------------------------------------------------------------------*/
/* Enable Events and Interrupts */
//*(volatile Uns *) CIER = 0x0010; /* Enable Rx/Tx Complete Interrupts */
//*(volatile Uns *) ECR = 0xffff; /* Clear all pending events */
}
//| 31-28 | 27-24 | 23 - 20 | 19-16 |15-12|12-8|7-4|3-0|
//OPT 31-29 28-27 26 25-24 23 22-21 20 19-16 15 - 2 1 0
//BIT PRI ESIZE 2DS SUM 2DD DUM TCINT TCC rsvd LINK FS
//
void EDMA4_channel(unsigned int destibuff_addr)/*0060- 0077*/
{
*(volatile Uns *) ECR = 0xffff;
*(volatile Uns *) EDMA_EVENT4_OPT = 0x21340001;//0x28710000; // TCC = 1 for Receive
*(volatile Uns *) EDMA_EVENT4_SRC = 0xb000F7E0;//0xB0000000;//McBSP0_DRR; // Source = McBSP Rcv
*(volatile Uns *) EDMA_EVENT4_CNT = 0x000001f4;//1F5 Count = not known yet
*(volatile Uns *) EDMA_EVENT4_DST = destibuff_addr;// 0x0; // Dst = not known yet
*(volatile Uns *) EDMA_EVENT4_IDX = 0x00000000; // 4 byte offset (load low 16)
*(volatile Uns *) EDMA_EVENT4_LNK = 0x00000000; // No auto reload parameters
}
void EDMA6_channel(unsigned int src_addr,unsigned int dst_addr)/*0090-00a7*/
{
*(volatile Uns *) ECR = 0xffff;
*(volatile Uns *) EDMA_EVENT6_OPT = 0x25360001; //0x25360001,0x28710000; // TCC = 1 for Receive
*(volatile Uns *) EDMA_EVENT6_SRC = src_addr; // Source = McBSP Rcv
*(volatile Uns *) EDMA_EVENT6_CNT = 0x003F0010; //0x003F0010, 3F=63行數(shù) 10=16 (*4BYTE)單位是雙字
*(volatile Uns *) EDMA_EVENT6_DST = dst_addr; // Dst = not known yet
*(volatile Uns *) EDMA_EVENT6_IDX = 0x07C00000; //fc0,0x07FC0000 0x7fc=0x800-4(0x800=2K)
*(volatile Uns *) EDMA_EVENT6_LNK = 0x00000000; //0x00100000 reload
}
void EDMA8_channel(unsigned char framecount)/*00c0-00d7*/
{
*(volatile Uns *) ECR = 0xffff;//temp1=temp1&0x07;
*(volatile Uns *) EDMA_EVENT8_OPT = 0x41380001;//0x28710000; // TCC = 1 for Receive
*(volatile Uns *) EDMA_EVENT8_SRC = 0x80500000+0x800*framecount;//0xB0000000;//McBSP0_DRR; // Source = McBSP Rcv
*(volatile Uns *) EDMA_EVENT8_CNT = 0x000001f4; // Count = not known yet
*(volatile Uns *) EDMA_EVENT8_DST = 0xa0004000+0x800*(framecount&0x07);// 0x0; // Dst = not known yet
*(volatile Uns *) EDMA_EVENT8_IDX = 0x00000000; // 4 byte offset (load low 16)
*(volatile Uns *) EDMA_EVENT8_LNK = 0x00000000; // No auto reload parameters
}
void EDMA9_channel()/*00d8-00ef 80504000 */
{
*(volatile Uns *) ECR = 0xffff;
*(volatile Uns *) EDMA_EVENT9_OPT = 0x41390001;//0x28710000; // TCC = 1 for Receive
*(volatile Uns *) EDMA_EVENT9_SRC = 0x80520000;//0xB0000000; /*128k*/
*(volatile Uns *) EDMA_EVENT9_CNT = 0x00001000; // Count = not known yet
*(volatile Uns *) EDMA_EVENT9_DST = 0xa0004000;// 0x0; // Dst = not known yet
*(volatile Uns *) EDMA_EVENT9_IDX = 0x00000000; // 4 byte offset (load low 16)
*(volatile Uns *) EDMA_EVENT9_LNK = 0x00000000; // No auto reload parameters
}
/*
void Changeramdata(int k)
{
unsigned int buff= 0x80d000000;
unsigned int i;
for(i=0;i<0x10000;i++)
*(volatile Uns *)(buff+4*i)=i+k;
}
* ======= EDMA_rxStart ========
*/
void EDMA_Set(unsigned int channel)
{
unsigned int temp;
temp=0x0001;
temp<<=channel;
*(volatile Uns *) EER = 0x0000; /* Enable McBSP0 Rx/Tx Events */
*(volatile Uns *) ESR = temp; /* Force Rx Event Start */
}
void EDMA_Enable(unsigned int channel)
{
unsigned int temp;
temp=0x0001;
temp<<=channel;
*(volatile Uns *) EER = temp; /* Enable McBSP0 Rx/Tx Events */
// *(volatile Uns *) CIER = temp;
// *(volatile Uns *) ESR = temp; /* Force Rx Event Start */
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -