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

📄 main.c

📁 实现在ARM上的ICP/IP功能的源代码。
💻 C
字号:
#include "..\inc\option.h"
#include "..\inc\def.h"
#include "..\inc\44b.h"
#include "..\inc\44blib.h"
#include "stdlib.h"
#include "typedef.h"
#include "mem_man.h"
#include "rtl8019.h"
#include "etherif.h"
#include "utilities.h"

void testrtl(void);
static U32 TimerCnt=0;
static int LedStatus=0;

void __irq Timer_Tick(void)
{	
    rI_ISPC=BIT_TIMER3;
    
    if(TimerCnt++ == 10) {
		TimerCnt=0;
		Led_Display(LedStatus);
		LedStatus=(~(LedStatus)&0x7);
	//	Uart_Printf("\nTIMER 3 interrupt... ");
    }
    NetIfTimer();
	ARPTimer();
	TCPTimer();
 
}
void Timer_Init(void)
{
/*	
 *	Timer Clock Frequency = MCLK/pre/mux
 */	
    rTCFG0=0x00000f00;	//dead zone=0,pre2=0,pre1=0xf,pre0=0
    rTCFG1=0x00001000;	//all interrupt,mux5=1/2,mux2=1/2,mux3=1/4,mux2=1/2,mux1=1/2,mux0=1/2
    
    rTCNTB3=0x2320;		//(1/(60MHz/4/15))*0xc350=50ms
    					//(1/(60MHz/4/15))*0x4320=20ms
    rTCMPB3=0x0;

    rTCON=0x0020000;	//update T3
    rTCON=0x0090000;	//T3=auto reload,start	
    
    rINTCON=0x5;    //Non-vectored,IRQ enable,FIQ disable 
    rINTMOD=0x0;    //All=IRQ mode
    
    pISR_TIMER3=(unsigned)Timer_Tick;
    rINTMSK=BIT_GLOBAL;
    rINTMSK=~(BIT_GLOBAL|BIT_TIMER3);	//start timer INT
}




void Main(void)
{
	rNCACHBE0 = ((Non_Cache_End>>12)<<16)|(Non_Cache_Start>>12);//在上面的数据区域不使用高速缓存
	rSYSCFG = CACHECFG;    //8K字节cache,写缓冲使能,data abort使能
    Port_Init();		//IO口初始化
	Uart_Select( 0 ) ;		//选择串口0
	Uart_Init( 32000000, 115200 ) ;	//串口初始化,波特率为115200(系统主频为32MHz)
  	Uart_Printf( "Http://www.openmcu.com\n\n" ) ;
    Timer_Init();
   // teststrin();
    //teststrout();
    
    test();
    while(1);
}

⌨️ 快捷键说明

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