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

📄 main.c

📁 blackfin532的一个串口测试代码
💻 C
字号:
/*****************************************************************************************/
//
// Name: 	BF533 EZ-KIT video ITU-656 receive mode
//
/*****************************************************************************************

(C) Copyright 2006 - Analog Devices, Inc.  All rights reserved.

File Name:				Main.c

Date Modified:			10/25/04				Rev 0.2

Software:       		VisualDSP++4.5

Hardware:				BF533 EZ-KIT Board

Special Connections:  	Connect a CVBS video source to the right bottom video jack "AVIN1"
                        change switch #6 of SW3 to on of the ADSP-BF533 EZ-KIT Lite.
						

Purpose:				After reset the ADV7183 is configured to output digital
						video data in ITU656 mode 8bits wide. Additionally, The DSP is 
						configured to receive video data in ITU-656 format via the PPI Interface.
						The DMA channel 0 is dedicated to transfer the data to the 
						external SDRAM immediately (Address 0x0). 

******************************************************************************************/


#include <cdefBF532.h>		//BF533 Register Pointer Definition
#include <stdio.h>
#include <sys\exception.h>		//Interrupt Handling Header
#include "flashsetup.h"
#include <ccblkfn.h>
#include "uartlib.h"

unsigned char *state;
unsigned short *led;
unsigned char *doout;
unsigned char *cmd_in;
unsigned char *sys_stat;
volatile unsigned char	uart_recv_buf[256];
volatile unsigned short	uart_recv_cnt;

void main()
{

	int i = 0;
	unsigned char cmd = 0;
	WORD length;
	
	int a,b,c;
	a = (1-(9<10));
	
	state = (unsigned char *)0x20390000;
	doout = (unsigned char *)0x20390002;
	cmd_in = (unsigned char *)0x20390004;
	sys_stat = (unsigned char *)0x20390006;

	led = (void*)0x203C000C;
	
	//setup;
	uart_recv_cnt = 0;
	Init_PLL();
	Init_EBIU();	//Async Memory Interface Setup
	Init_SDRAM();	//SDRAM Setup to store the video image
	
	*pFIO_DIR = *pFIO_DIR | 0x00C0;	//PF6,PF7输出0
	*pFIO_FLAG_C = 0x00C0;	
	
	init_interrupt();
	UART_Init();
	
	*sys_stat = 0x00;
	//*sys_stat = 0xff;	
	while (1)
	{
	/*	
	    *led = 0xff;
	    for(i=0;i<10000000;i++);
	    *led = 0xfe;
	    for(i=0;i<10000000;i++);
	    *led = 0xfd;
	    for(i=0;i<10000000;i++);
	    *led = 0xfb;
	    for(i=0;i<10000000;i++);
	    *led = 0xf7;
	    for(i=0;i<10000000;i++);
	    *led = 0xef;
	    for(i=0;i<10000000;i++);
	    *led = 0xdf;
	    for(i=0;i<10000000;i++);
	    *led = 0xbf;
	    for(i=0;i<10000000;i++);
	    *led = 0x7f;
	    for(i=0;i<10000000;i++);
	    *led = 0;
	    for(i=0;i<10000000;i++);
	 */   	    
	    cmd = *cmd_in;
	 	//i = 1;
		//*state = 0x00;
	    //for(i=0;i<1000;i++);
		*state = 0xFF;
	    //for(i=0;i<1000;i++);
		*doout = 0x00;
	    //for(i=0;i<100000000;i++);
		//*doout = 0xFF;
	    //for(i=0;i<100000000;i++);
		//*state = 0x00;
	    //for(i=0;i<10000000;i++);
		//*state = 0x01;
	    //for(i=0;i<10000000;i++);
		//*state = 0x02;
	    //for(i=0;i<10000000;i++);
		//*state = 0x03;
	    //for(i=0;i<10000000;i++);
	    if(uart_recv_cnt>6)
	    {
			//*pFIO_FLAG_S = 0x0080;
			*sys_stat = 0x01;	
	        length = uart_recv_cnt;
			uart_recv_cnt = 0;
	        UART_puts((BYTE*)uart_recv_buf,length);
	        while (!(*pUART_LSR & TEMT)){}; //wait
	    	//for(i=0;i<10000000;i++);
	        //*pFIO_FLAG_C = 0x0080;
	        *sys_stat = 0x00;	
		}
	}
}



	

⌨️ 快捷键说明

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