📄 neti.c
字号:
/***********************************************************************
* $Workfile: neti.c $
* $Revision: 1.1.1.1 $
* $Author: meterchen $
* $Date: 2003/11/10 17:00:55 $
*
* Project: Shenzhen-Nucleus-Net
*
* Description:
* Netstack and device initialize
*
* Revision History:
*
***********************************************************************
*
* Copyright (c) 2003 CHENMENG
*
* All rights reserved
*
**********************************************************************/
#include "plus\nucleus.h"
#include "net\inc\nu_net.h" /* socket interface structures */
STATUS Rtl8019_Initialize(DV_DEVICE_ENTRY *dev_ptr);
/* Target specific. */
/* CONFIGURABLE PARAMETERS */
#define NO_MAC 1 /* 1 MAC */
CHAR NETI_Device_Name[NO_MAC][7] = { "RTL8019"};
UINT8 NETI_MAC_Address[NO_MAC][6] = {
{0x00, 0x00, 0xf0, 0x90, 0x11, 0x11},
};
NU_DEVICE NETI_Devices[NO_MAC] = {
{
NETI_Device_Name[0], /* CHAR *dv_name; */
0, /* INT32 dv_flags; */
(UINT32)NETI_MAC_Address[0], /* UINT32 dv_driver_options; */
Rtl8019_Initialize, /* STATUS (*dv_init) (DV_DEVICE_ENTRY *); */
{ 192, 168, 1, 21}, /* UINT8 dv_ip_addr[4]; */
{ 255, 255, 255, 0}, /* UINT8 dv_subnet_mask[4]; */
{ 192, 168, 1, 100}, /* UINT8 dv_gw[4]; */
/* This union defines the hardware specific portion of the device
initialization structure. */
{ 0, 0, 0 } /* ETHER_DEV ether; */
},
};
CHAR NETI_SMTP_Server[] = {(CHAR) 12, (CHAR) 25, (CHAR)115, (CHAR) 10};
CHAR NETI_FTP_Server[] = {(CHAR) 12, (CHAR) 25, (CHAR)115, (CHAR) 10};
/* end target specific. */
extern NU_EVENT_GROUP Init_Complete;
extern VOID *next_available_memory;
NU_MEMORY_POOL NETI_NET_Memory_Pool;
/* Function Prototypes */
VOID NETI_Exit(INT);
VOID NETI_Init_Task(UNSIGNED argc, VOID *argv);
VOID NU_Printf(CHAR *string, ...);
VOID NETI_Init_Task(UNSIGNED argc, VOID *argv)
{
STATUS status;
UNUSED_PARAMETER(argv);
UNUSED_PARAMETER(argc);
/* Create the memory pool for use by NET. It will contain
the NET memory buffers. */
status = NU_Create_Memory_Pool(&NETI_NET_Memory_Pool, "NETMEM",
next_available_memory, NU_NET_BUFFER_POOL_SIZE, 50, NU_FIFO);
/* Make sure the allocation worked. */
if (status != NU_SUCCESS)
{
NU_Printf("error at call to NU_Create_Memory_Pool().\n");
NETI_Exit (-1);
}
/* call network initialization */
if(NU_Init_Net(&NETI_NET_Memory_Pool) != NU_SUCCESS)
{
NU_Printf("error at call to NU_Init_Net().\n");
NETI_Exit (-1);
}
/* begin target specific. */
if (NU_Init_Devices(NETI_Devices, NO_MAC) != NU_SUCCESS)
{
NU_Printf("error at call to NU_Init_Devices().\n");
NETI_Exit (-3);
}
/* Now that NET initialization is complete set the even to start
all the other tasks. */
NU_Set_Events (&Init_Complete, NU_TRUE, NU_OR);
}
VOID NETI_Exit(INT n)
{
UNUSED_PARAMETER(n);
for(;;)
{
NU_Sleep(TICKS_PER_SECOND);
}
}
/* This function is stubbed out. It may be filled in for debugging purposes */
VOID NU_Printf(CHAR *string, ...)
{
UNUSED_PARAMETER(string);
/* Nothing to do. */
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -