?? main.c
字號:
#include <reg51.h>
#include <stdio.h>
#include "config.h"
#include "GloblDef.h"
#include "TCPIPmem.h"
#include "RTL8019.h"
//#include "IP.h"
//#include "etherif.h"
//#include "ARP.h"
//#include "Netif.h"
//#include "ICMP.h"
//#include "TCP.h"
//#include "UDP.h"
//#include "I2C.h"
//#include "w77e58.h"
#include <absacc.h>
/******************************************************************************
函數:Delay()
功能:延時chDelay ms
參數:
unsigned char chDelay:要延時的時長,<=255MS
返回:無
說明:請根據具體情況調整延時值
******************************************************************************/
void delay(unsigned int iDly)
{
unsigned char chTmpIn;
unsigned int iTmpOut;
for(iTmpOut = 0;iTmpOut < iDly;iTmpOut++)
//針對24MHZ的主頻
for(chTmpIn = 0;chTmpIn < 250;chTmpIn++)
{
;
}
}
/******************************************************************************
函數:SerialInit()
功能:對串口進行初始化,設置工作模式、波特率等
參數:無
返回:無
說明:
*****************************************************************************
void SerialInit()
{
//set TI to 1, set TR1 to 1
SCON = 0x52;// SM0 SM1 =1 SM2 REN TB8 RB8 TI RI
TMOD = 0x20;// GATE=0 C/T-=0 M1 M0=2 GATE C/T- M1 M0
TH1 = 0xE6; // TH1=E6 4800 when at 24MHz,TH1=F3,9600,24MHz
PCON = 0x80;
TCON = 0x40;// 01101001 TF1 TR1 TF0 TR0 IE1 IT1 IE0 IT
}*/
/******************************************************************************
函數:InterruptInit()
功能:對定時中斷進行初始化,設置定時器及其中斷時長
參數:無
返回:無
說明:
*****************************************************************************
void InterruptInit()
{
TMOD |= 0x01;
TH0 = 0x3C; //TIMER_24M_25MS_H;
TL0 = 0xAA; //TIMER_24M_25MS_L;
TR0 = 1;
//open interrupt for rtl and timer
EA = 1;
// EX0 = 1;
ET0 = 1;
} */
/******************************************************************************
主程序
******************************************************************************/
void main()
{
//分配顯示緩沖,每屏顯示32個字
//unsigned int xdata chDisplayBuf[64];
//unsigned char chtmp = 0;
//分配網絡緩沖
//struct SMemHead xdata *MemHead;
//struct SEtherDevice xdata DevRTL;
//struct SNetIf xdata *pNetIf;
//unsigned long IPAddr = 0xc0a80103; //本機IP地址:192.168.1.3
//unsigned long NetMask = 0xffffff00; //子網掩碼:255.255.255.0 */
//unsigned long GateWay = 0xc0a80101; //網關地址:192.168.1.1 */
//unsigned char xdata EtherAddr[6] = {0x52,0x54,0x4C,0x30,0x2e,0x2f}; //本機MAC地址
// 顯示驅動流程 //
//SerialInit();
//LEDInit();
//中斷
//InterruptInit();
// 網絡驅動流程 //
RTL8019Init();
// 協議棧處理流程 //
//MemInit();
//NetIfInit();
//ARPInit();
//TCPInit();
/* init Devcie struct and init this device */
//EtherDevInit(&DevRTL,EtherAddr,&RTLSendPacket,RTLReceivePacket);
/* add this device to NetIf */
//pNetIf = NetIfAdd(IPAddr,NetMask,GateWay,EtherInput,EtherOutput,&DevRTL);
// 解碼驅動流程 //
//I2CInit();
//Sta013Init();
// 主循環 //
while(1)
{
RTL8019SendPacketTest();
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -