📄 main.c
字号:
/***************************************************************************\
Copyright (c) 2004-2007 threewater@up-tech.com, All rights reserved.
by threewter 2004.5.12
\***************************************************************************/
/***************************************************************************\
#说明: C main 函数,ucos-ii初始化等定义
---------------------------------- Bug --------------------------------------
---------------------------------- TODO list --------------------------------------
----------------------------------修正--------------------------------------
2004-5-12 创建
\***************************************************************************/
#define U8 unsigned char
#include <string.h>
#include <stdio.h>
#include "..inc/exio.h"
#define TRUE 1
#define FALSE 0
#pragma import(__use_no_semihosting_swi) // ensure no functions that use semihosting
#define rUTRSTAT0 (*(volatile unsigned *)0x50000010)
#define rUTRSTAT1 (*(volatile unsigned *)0x50004010)
#define WrUTXH0(ch) (*(volatile unsigned char *)0x50000020)=(unsigned char)(ch)
#define WrUTXH1(ch) (*(volatile unsigned char *)0x50004020)=(unsigned char)(ch)
#define RdURXH0() (*(volatile unsigned char *)0x50000024)
#define RdURXH1() (*(volatile unsigned char *)0x50004024)
//void Uart_SendByten(int Uartnum, U8 data);
void Uart_SendByten(int,U8);
char Uart_Getchn(char* Revdata, int Uartnum);
void hudelay(int time);
void ARMTargetInit(void);
//void hudelay(int time);
//int argc, char **argv
main()
{
//int ch;
char i,*Revdata;
//Uart_Init(0,115200); //串口0 初始化
while(1)
{
if(i>=30)i=1;
LED_CONTROL=i++;
//FPGA_IOP1_L=0xffff;
//FPGA_IOP1_H=0xffff;
//FPGA_IOP2_L=0xffff;
//FPGA_IOP2_H=0xffff;
//FPGA_IOP3_L=0xffff;
//FPGA_IOP3_H=0xffff;
//FPGA_RESET=0xffff;
//ch=FPGA_IOP1_L;
//ch=FPGA_IOP1_H;
//ch=FPGA_IOP2_L;
//ch=FPGA_IOP2_H;
//ch=FPGA_IOP3_L;
//ch=FPGA_IOP3_H;
//ch=LED_CONTROL;
// hudelay(1000);
// Uart_SendByten(0,i+'0');
Uart_SendByten(0,0xa); //换行
Uart_SendByten(0,0xd); //回车
Uart_SendByten(0,(U8)Uart_Getchn(Revdata,0));
}
//return 0;
}
void Uart_SendByten(int Uartnum, U8 data)//ok eric rong
{ //int i;
if(Uartnum==0)
{
while(!(rUTRSTAT0 & 0x4)); //Wait until THR is empty.
hudelay(10);
WrUTXH0(data);
}
else
{
while(!(rUTRSTAT1 & 0x4)); //Wait until THR is empty.
hudelay(10);
WrUTXH1(data);
}
}
char Uart_Getchn(char* Revdata, int Uartnum)
{
if(Uartnum==0){
while(!(rUTRSTAT0 & 0x1)); //Receive data read
*Revdata=RdURXH0();
return TRUE;
}
else{
while(!(rUTRSTAT1 & 0x1));//Receive data read
*Revdata=RdURXH1();
return TRUE;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -