📄 main.c.bak
字号:
//#include "stdio.h"
#include "240x.h"
#include "8019head.h"
#include "tcp_ip.h"
#include "global.h"
//BYTE EthTxBuf[400];
//int MAC_Add[3]={0030,6E1C,EEE1};
BYTE test_packet1[]={0x00,0x00,0xe8,0xe6,0xab,0x03,0x00,0xd0,0xf8,0x0e,0xde,0x11,0x08,0x00,0x45,0x00,0x00,0x3c,0x00,0xc5,0x00,0x00,0x80,0x01,0x08,0xce,0xca,0x74,0x4e,0x36,0xca,0x74,0x4e,0x0f,0x08,0x00,0x46,0x5c,0x02,0x00,0x05,0x00,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6a,0x6b,0x6c,0x6d,0x6e,0x6f,0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69};
BYTE test_packet3[]={0x00,0x00,0xe8,0xe6,0xab,0x03,0x00,0xd0,0xf8,0x0e,0xde,0x11,0x08,0x00,0x45,0x00,0x00,0x3c,0x00,0xc6,0x00,0x00,0x80,0x01,0x08,0xcd,0xca,0x74,0x4e,0x36,0xca,0x74,0x4e,0x0f,0x08,0x00,0x45,0x5c,0x02,0x00,0x06,0x00,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6a,0x6b,0x6c,0x6d,0x6e,0x6f,0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69};
void InitDSP()
{
asm(" SETC INTM"); /// Disable all interrupt
asm(" CLRC SXM"); //
asm(" CLRC OVM"); ///-----
asm(" CLRC CNF"); ///B0---data
SCSR1 =0x0E00; // 1*fin disable all clock
SCSR2 =0x000E; //disable rom;/mc;don=1,pon=0
WDCR =0x0E8;
IMR =0x01;
IFR =0x0FFFF;
WSGR =0x0FFF;
XINT1CR =0x01; /// high Lever, Enable XINT1, 下降
}
void main()
{
int tempwh;
int temp2;
int temp3,temp;
int i;
int test_packet1_size,test_packet3_size;
InitDSP();
Reset8019();
Init8019();
PFDATDIR=0XFF00;
CR=0x22;
for(i=0;i<10;i++);
temp3=RTL8019ID0;
for(i=0;i<10;i++);
for(i=0;i<10;i++);
temp2=RTL8019ID1;;
for(i=0;i<10;i++);
for(i=0;i<10;i++);
////////////////////////////////////////////////////
RTL8019IMR = 0x00;
test_packet1_size = sizeof(test_packet1);
test_packet3_size = sizeof(test_packet3);
/* 'code' is important.. other command is of no use for example static.. remember this situation */
/* content express that client tried to connect http web server i.e. one of three way handshaking */
while(1)
{
for (i=0;i<1;i++){ /* if you transmit packets above 3, this chip was out of order.. */
while (CR & 0x04);
DMA_write(test_packet1, 0x4000, test_packet1_size);
TPSR = 0x40; // Transmit starting page
TBCR0 = test_packet1_size; // Low byte of tx byte count
TBCR1 = 0; // High byte of tx byte count Transmit byte count register
CR = 0x26;//EN_PAGE0 + EN_NODMA + EN_TRANS + EN_START; // Transmit a frame
while(CR & 0X04);
temp = TSR;
for(i=0;i<10000;i++) ;
//delay(100);
//print("\n\r");
DMA_write(test_packet3, 0x4000, test_packet3_size);
TPSR = 0x40;//NE_START_PG; // Transmit starting page
TBCR0 = test_packet3_size; // Low byte of tx byte count
TBCR1 = 0; // High byte of tx byte count Transmit byte count register
CR = 0X26;//EN_PAGE0 + EN_NODMA + EN_TRANS + EN_START; // Transmit a frame
while(CR & 0X04);
temp = TSR;
for(i=0;i<10000;i++) ;
}
}
RTL8019IMR = 0x35;//ENISR_ALL; /* INTerrupt mask reg */
while(1);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -