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

📄 sdram_coreb.c

📁 blackfin的MDMA程序
💻 C
字号:
/***************************************************************************** * Core B * EBIU_DMA_p_CoreB.c *****************************************************************************//* Declare shared data items as external (via extern), as they are declared in   a separate source module. Refer to Core A抯 Shared.c. This code is   simply an example; define your own shared data as needed. */#include <ccblkfn.h>#include <main.h>

extern volatile char shared_variable;
unsigned char Dst_Array_1[360];						//定义传输的数组
unsigned char Dst_Array_2[360];

unsigned char movement_detective[45*288];
int dma_count=0;
int test=0;
bool Array1_empty=1;
bool Array2_empty=1;

void read_DMA(void)
{
	int i,j,k;
	unsigned char temp_r,temp;
	j=0;
	dma_count++;
	
	Disable_MDMA();	
	Init_MemDMA0();	
	
	dma_count = dma_count - 1;
	ssync();
	if(dma_count%2 == 0) 
	{
		ssync();
		for(j=0;j<45;j++)
		{
			temp_r=0;
			for(k=0;k<8;k++)
			{
				temp = Dst_Array_1[j*8+k];
				asm("nop;"); 
				temp_r+=(temp<<(7-k));
				asm("nop;"); 
			}
			movement_detective[dma_count*45+j] = temp_r;
		}
		Array1_empty = 1;
	}
	else
	{
		ssync();
		for(j=0;j<45;j++)
		{
			temp_r=0;
			for(k=0;k<8;k++)
			{
				temp = Dst_Array_2[j*8+k];
				asm("nop;"); 
				temp_r+=(temp<<(7-k));
				asm("nop;"); 
			}
			movement_detective[dma_count*45+j] = temp_r;
		}
		Array2_empty = 1;
	}
	dma_count++;
}

void main()
{
	int i,j,k,l;
	unsigned char data;
	unsigned short kk;
	
	Init_PLL_B(1);
	j=0;
	
	for(i=0;i<360;i++)
	{
		Dst_Array_1[i]=0;
		Dst_Array_2[i]=0;
	}
	
	Setup_SDRAM();
//	Init_Interrupts();
	Init_MemDMA0();	
	
	while(j<100)		//加入延时,避免第一次传数会有问题,可能DMA未完成就开始传数了
	{
		ssync();
		j++;	
	}
	
	while(dma_count < 288)
	{		
		if((dma_count >= 169)&&(dma_count <= 183))
		{
			while(j<100)		//加入延时,避免第一次传数会有问题,可能DMA未完成就开始传数了
			{
				ssync();
				j++;	
			}
		}
		read_DMA();
		ssync();
	}	
}

⌨️ 快捷键说明

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