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

📄 main.c

📁 用于ucosII下的tcpip协议栈
💻 C
字号:
/**	 *  @file main.c * *  Sample main function for compiling NULL OS test set used by uCIP. *     *  Use this as a starting point to adapt uCIP  *  to your own operating system. *///#include "os.h"#include "..\netconf.h"
#include "..\netbuf.h"
#include "..\net.h"
#include "..\netaddrs.h"
#include "..\netether.h"
#include "..\netarp.h"
#include "..\netsock.h"

#include "..\netifdev.h"
#include "..\if_dev\cs89x\if_cs89x.h"
#include "..\neteth.h"

#include <string.h>
#include <stdio.h>
#include "..\netdebug.h"

int repeat = 1;
Interface EthAdaptor;


void StartupNet(void)
{
    etherSetup setup;
    setup.arpExpire = 600;
    memcpy(&setup.hardwareAddr, &myMAC, sizeof(setup.hardwareAddr));
    memcpy(&setup.localAddr, &myIP, sizeof(setup.localAddr));
    setup.localAddr = ntohl(inet_addr("192.168.0.10"));
    setup.subnetMask = ntohl(inet_addr("255.255.255.0"));
    setup.gatewayAddr = ntohl(inet_addr("192.168.0.1"));

//    etherInit();             // call etherInit() before netInit()
//    etherConfig(&setup);
    nBufInit();
    netInit();
//    CS89X_DriverEntry(&EthAdaptor);
//void ipSetDefault(u_int32_t localHost, u_int32_t IPAddr, IfType ifType, int ifID)
    ipSetDefault(htonl(setup.localAddr), 0, IFT_ETH, 0);
    etherInit();
    ethInit(&EthAdaptor);
    etherConfig(&setup);
    arpInit();
    socketInit();
}


int	main(){
    printf("################## uC/OS ###################\n");
    StartupNet();
    printf("done.\n");
}

⌨️ 快捷键说明

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