dma.c

来自「开发板外设接口实验(1~7)」· C语言 代码 · 共 44 行

C
44
字号
/*
 *	uart.c   -  uart api & driver 
 *	
 *	Author: 	li ming <admin@lumit.org>
 *	Date:		2008-4-16
 *	Copyleft:	http://www.lumit.org
 */
 
#include "dma.h"

#define SFR_BASE      0x03FF0000
/* GDMA Interface */

#define GDMACON0		*((volatile unsigned *)(SFR_BASE+0xB000))
#define GDMACON0EN		*((volatile unsigned *)(SFR_BASE+0xB020))
#define GDMACON1		*((volatile unsigned *)(SFR_BASE+0xC000))
#define GDMACON1EN		*((volatile unsigned *)(SFR_BASE+0xC020))
#define GDMASRC0		*((volatile unsigned *)(SFR_BASE+0xB004))
#define GDMASRC1		*((volatile unsigned *)(SFR_BASE+0xC004))
#define GDMADST0		*((volatile unsigned *)(SFR_BASE+0xB008))
#define GDMADST1		*((volatile unsigned *)(SFR_BASE+0xC008))
#define GDMACNT0		*((volatile unsigned *)(SFR_BASE+0xB00C))
#define GDMACNT1		*((volatile unsigned *)(SFR_BASE+0xC00C))

/* GDMA Initialization*/
char source[8]={'1','2','3','4','5','6',0xa,0xd},dst[50]={0,};
void GDMA_Init(void)
{
	GDMASRC0= (int)source;    //source address
	//GDMADST0= (int)dst0;		//destination address
	GDMACON0= 0x8409;					//0x8D09
	GDMACNT0= 0x4;		   		//the number of transmittion
	
	//GDMASRC1= (int)source1;    //source address
	GDMADST1= (int)dst;		//destination address
	GDMACON1= 0x8009;					//0x8D09
	GDMACNT1= 50;		   		//the number of receive
}

void GDMA_Start(void)
{
	GDMACON0EN= 0x01;	//enable GDMA0
	GDMACON1EN= 0x01;	//enable GDMA1
}

⌨️ 快捷键说明

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