📄 main56.c
字号:
/* * Copyright (C) 2004 MITSUBISHI ELECTRIC CORPORATION and * RENESAS SOLUTIONS CORPORATION and * RENESAS TECHNOLOGY CORPORATION * All rights reserved. * * BSD socket communication test program used for TCP/IP subsystem. */#include <basic.h>#include <tk/tkernel.h>#define INIT_TASK_PRIO 10#define INIT_TASK_STACK 0x8000 /* 32KB */extern void _InitLibtk(void);extern int renesas_tcpip_ifconfig(void);extern void test_task1(int, void *);extern void test_task2(int, void *);extern void test_task3(int, void *);int main(void){ T_CTSK pk_ctsk; int tid1, tid2, tid3; int ret; ER ercd = E_OK; tm_putstring("comm2test is loadded.\n"); /* initialize T-Kernel library for using memset() */ _InitLibtk(); /* set my IP address */ ret = renesas_tcpip_ifconfig(); if (ret == -1) { tm_putstring("renesas_tcpip_ifconfig() is NG.\n"); return; } else { tm_putstring("renesas_tcpip_ifconfig() is OK.\n"); } /* create user "init" task */ memset((char *)&pk_ctsk, 0, sizeof(pk_ctsk)); pk_ctsk.exinf = (VP)0; pk_ctsk.tskatr = (ATR)TA_HLNG; pk_ctsk.task = (FP)test_task1; pk_ctsk.itskpri = (PRI)INIT_TASK_PRIO; pk_ctsk.stksz = (INT)INIT_TASK_STACK; tid1 = tk_cre_tsk(&pk_ctsk); if (tid1 < E_OK) goto error2; pk_ctsk.task = (FP)test_task2; tid2 = tk_cre_tsk(&pk_ctsk); if (tid2 < E_OK) goto error2; pk_ctsk.task = (FP)test_task3; tid3 = tk_cre_tsk(&pk_ctsk); if (tid3 < E_OK) goto error2; ercd = tk_sta_tsk(tid1, (INT)0); ercd = tk_sta_tsk(tid2, (INT)0); ercd = tk_sta_tsk(tid3, (INT)0);error2: tk_slp_tsk(TMO_FEVR); return;}/* EOF */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -