📄 main.c
字号:
/*********************************************************************************************
* File: main.c
* Author: embest
* Desc: c main entry
* History:
*********************************************************************************************/
/*------------------------------------------------------------------------------------------*/
/* includes files */
/*------------------------------------------------------------------------------------------*/
#include "2410lib.h"
char isDone=0;
int AFC_BUFLEN=100;
char * txdataFl;
char * txdataPt;
char tx_cnt=0;
char tx_end=0;
//extern const UINT8T g_ucWave[155760] ;
void __irq Uart0_AfcTx(void)
{
rINTSUBMSK|=(BIT_SUB_RXD0|BIT_SUB_TXD0|BIT_SUB_ERR0);
if(tx_cnt<AFC_BUFLEN)
{
// Uart_Printf("%d,",*txdataPt);
while((rUFSTAT0 & 0xF0)>0x30);
WrUTXH0(*txdataPt++);
isDone=*txdataPt;
tx_cnt++;
ClearPending(BIT_UART0);
rSUBSRCPND=(BIT_SUB_TXD0);
rINTSUBMSK&=~(BIT_SUB_TXD0);
}
else
{
tx_end=1;
while(rUFSTAT0 & 0x2f1); //Until FIFO is empty
ClearPending(BIT_UART0);
rSUBSRCPND=(BIT_SUB_TXD0);
rINTMSK|=BIT_UART0;
}
}
init_uart()
{
// char i;
/*********** UART0 Tx test with DMA0 ***********/
char uart0TxStr[]={"ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890->UART0 Tx Test by DMA0 is good!!!!\r\n"};
txdataFl=(char *)uart0TxStr;
txdataPt=(char *)uart0TxStr;
pISR_UART0=(unsigned) Uart0_AfcTx;
rULCON0=(0<<6)|(0<<3)|(0<<2)|(3); // Normal,No parity,One stop bit, 8bit
rUCON0 &= 0x400; // For the PCLK <-> UCLK fuction
rUCON0 |= (1<<9)|(1<<8)|(0<<7)|(0<<6)|(0<<5)|(0<<4)|(1<<2)|(1);
//Clock,Tx:Lev,Rx:Lev,Rx timeout:x,Rx error int:x,Loop-back:x,Send break:x,Tx:int,Rx:int
rUFCON0=(1<<6)|(0<<4)|(1<<2)|(1<<1)|(1);
//Tx and Rx FIFO Trigger Level:4byte,Tx and Rx FIFO Reset,FIFO on
rUMCON0=0x10; // Enable Uart0 AFC
rINTMSK=~(BIT_UART0);
rINTSUBMSK=~(BIT_SUB_RXD0|BIT_SUB_TXD0|BIT_SUB_ERR0);
while(!tx_end);
}
/*********************************************************************************************
* name: main
* func: memory test
* para: none
* ret: none
* modify:
* comment:
*********************************************************************************************/
int main(int argc,char **argv)
{
sys_init(); /* Initial s3c2410's Clock, MMU, Interrupt,Port and UART */
init_uart();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -