📄 main.c
字号:
/* * Copyright (C) 2004 MITSUBISHI ELECTRIC CORPORATION and * RENESAS SOLUTIONS CORPORATION * All rights reserved. * * TCP/IP functions subsystem: * main function definitions. */// #define DEBUG/* #include <stdlib.h> */#include <ctype.h>#include "tcpip_fn.h"#include "tcpip_def.h"extern void _InitLibtk(void);extern int init_uif(void);extern ER init_net(void);extern int sn_lan_init(void);#if defined(DEBUG)extern int ifconfig(void);#endifstatic ER initialize( PRI priority );static ER erase( void );/* Entry point of subsystem */int main(void){ int i, ret = 0; ER ercd; PRI priority = 0; /* initialize T-Kernel library for using Kmalloc() */ _InitLibtk(); /* * initialize TCP/IP function. */ /* init UNIX interfacer module */ ret = init_uif(); if (ret == -1) {#if defined(DEBUG) tm_putstring("init_uif() is FAILED.\n");#endif goto error1; }#if defined(DEBUG) tm_putstring("init_uif() is OK.\n");#endif /* init TCP/IP protocol and socket modules */ ret = init_net(); if ((ER)ret != E_OK) {#if defined(DEBUG) tm_putstring("init_net() is FAILED.\n");#endif goto error1; }#if defined(DEBUG) tm_putstring("init_net() is OK.\n");#endif /* initialize LAN driver */ ret = sn_lan_init(); if (ret == -1) {#if defined(DEBUG) tm_putstring("sn_lan_init() is FAILED.\n");#endif goto error1; }#if defined(DEBUG) tm_putstring("sn_lan_init() is OK.\n");#endif#if 0// #if defined(DEBUG) /* set my IP address */ ret = ifconfig(); if (ret == -1) { tm_putstring("ifconfig() is FAILED.\n"); goto error1; } tm_putstring("ifconfig() is OK.\n");#endif /* DEBUG */ /* register subsystem */ ercd = initialize(priority); if (ercd == E_OK) { tm_putstring("TCP/IP Subsystem is Loadded.\n"); } else { ret = -1; tm_putstring("TCP/IP Subsystem is FAILED.\n"); }error1:#if 0 // #if defined(DEBUG) tk_exd_tsk();#endif return (ret);}/* register subsystem */static ER initialize(PRI priority){ ER er; T_DSSY dssy; if (priority <= 0) priority = DEFAULT_PRIORITY; dssy.ssyatr = TA_NULL; /* subsystem attlibute */ dssy.ssypri = priority; /* subsystem priority */ dssy.svchdr = (FP)svc_handler; /* extend SVC handler */ dssy.breakfn = break_fn; dssy.startupfn = startup_fn; dssy.cleanupfn = cleanup_fn; dssy.eventfn = (FP)event_fn; dssy.resblksz = 0; /* size of resource management block */ er = tk_def_ssy( TCPIP_SVC, &dssy ); return(er);}/* remove subsystem */static ER erase(void){ ER er; er = tk_def_ssy( TCPIP_SVC, NULL ); return(er);}/* EOF */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -