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

📄 dec5502_uartonchip.c.bak

📁 DSP的片子上程序
💻 BAK
字号:


/******************************************************************************/
/*  Copyright 2004 by SEED Electronic Technology LTD.                         */
/*  All rights reserved. SEED Electronic Technology LTD.                      */
/*  Restricted rights to use, duplicate or disclose this code are             */
/*  granted through contract.                                                 */
/*                                                                            */
/*                                                                            */
/******************************************************************************/
/* MODULE NAME... UART														  */
/* FILENAME...... DEC5502_UART0NCHIP.c										  */
/* DATE CREATED.. Wed 6/11/2004 											  */
/* PROJECT....... Communicate with PC by on-chip UART of 5502			      */
/* COMPONENT..... 															  */
/* PREREQUISITS.. 															  */
/*----------------------------------------------------------------------------*/
/* DESCRIPTION:  															  */
/*   																		  */
/* This is an example for on-chip UART of C5502								  */
/******************************************************************************/

#include <stdio.h>
#include <csl.h>
#include <csl_pll.h>
#include <csl_chip.h>
#include <csl_irq.h>
#include <csl_uart.h>
#include "Uart_Function.h"
#include "Timer.h"


#define SYSCNTL0 (*(volatile unsigned int *)(0x280000))	
Uint16 i=0;
Uint16 Temp;

void main(void)
{
	/* Initialize CSL library - This is REQUIRED !!! */
	CSL_init();
	
	/* Config PLL */
	PLL_setFreq(1,		// PLL mode
	 		  0xF, 		// Multiply factor, Valid values are (multiply by)10
	 		    0,		// Sysclk 0 Divide Down
	 		    1,		// Sysclk1 Divider 150MHz
	 		    3,		// Sysclk2 Divider 75MHz
	 		    3,		// Sysclk3 Divider
	 		    0);		// CLKOUT3(DSP core clock) divider 300MHz	 
	 		    
	/* 配置定时器 */
	Config_Timer();
	
	/* Select on-chip uart */
	SYSCNTL0 = 0x0;
	
	/* Perform two dummy read */
	Temp = (*(volatile ioport Uint16*)(0x9C00)); 
	Temp = (*(volatile ioport Uint16*)(0x9C00));
	
	/* Configure UART registers */
    Uart_Config();
    
	/* Clear recerver data structure */
	for(i=0; i<LENGTH; i++)
	{
	 	DestData[i] = 0;
	}
		
	DataCount = 0;
	
	for(;;)
	{ 
		// Enter system dead loop and waiting for uart receiver interrupt
		if(PctoDsp == TRUE)
	 	{
	 		Write_Uart(LENGTH);
	 		PctoDsp = FALSE;
	 	}
	}	

}

/*****************************************************************************************/
//	No	more
/*****************************************************************************************/

⌨️ 快捷键说明

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