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

📄 testrtl.c

📁 实现在ARM上的ICP/IP功能的源代码。
💻 C
字号:
#include "true_false.h"
#include "stdlib.h"
#include "typedef.h"
#include "mem_man.h"
#include "rtl8019.h"
#include "netif.h"
#include "etherif.h"
#include "ip.h"
#include "arp.h"
#include "utilities.h"
#include "tcp.h"

unsigned char  arpbuf[]={
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF ,//关拨地址
0x12, 0x23, 0x34, 0x45, 0x56, 0x67,//我的地址
0x08, 0x06,//
0x00, 0x01,//
0x08, 0x00, //
0x06,//
0x04, //
0x00, 0x01,// 
0x12, 0x23, 0x34, 0x45, 0x56, 0x67,//
0xC0, 0xA8, 0x02, 0x0d, //我的ip
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,//对方的mac
0xC0, 0xA8, 0x02, 0x13//对方的ip地址
};
/*
void RTLInit(BYTE LocalMACAddr[]) ;
BOOL RTLSendPacket(BYTE  * buffer,WORD size)  ;
struct SMemHead  * RTLReceivePacket()  ;
*/
delay(){
int i=0xff,j=0xff;
while(--i){
while(--j);
j=0xff;
}}
void testrtl(void)
{
    u32_t i ;
    struct SMemHead *p1;
    MemInit();
    RTLInit((u8_t*)(6+arpbuf));
    for(;;)
    {
        RTLSendPacket(arpbuf,100);
		delay();
		Uart_Printf("\nRCVING DATA ");
        p1=RTLReceivePacket();
        if(p1!=NULL)
        {
            Uart_Printf("\nRCV DATA ,LEN IS %d, THEY ARE BELOW:\n");
            for(i=0;i<p1->pEnd-p1->pStart;++i)
            {
                if(i%16==0)
                Uart_Printf("\n");
                Uart_Printf(" 0x%2x",*(u8_t*)(p1->pStart+i));
            }
            MemFree(p1);
        }
    }
}

⌨️ 快捷键说明

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