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

📄 task.c

📁 T-kernel Tcp/ip Protocol Stack Sample
💻 C
字号:
/*
 *  Copyright (C) 2004 MITSUBISHI ELECTRIC CORPORATION and
 *  RENESAS SOLUTIONS CORPORATION
 *  All rights reserved.
 *
 *  Sample Application program used for TCP/IP subsystem.
 */

#include <basic.h>
#include <tk/tkernel.h>

extern void *memset(void *, int, size_t);

/* mili seconds */
#define DELAY_TIME (1000)	/* mili-sec */


void
samp_cychdr(VP exinf)
{
	// tm_putstring("LED off.\n");
	return;
}

void
init_task(int stacd, void *exinf)
{
	ER ercd;
	INT i, cid;
	T_CCYC pk_ccyc;
	UINT intsts;

	tm_putstring("init_task() is executed.\n");

	/* create ans start cyclic handler */
	memset((char *)&pk_ccyc, 0, sizeof(T_CCYC));
	pk_ccyc.cycatr = TA_HLNG;
	pk_ccyc.cychdr = (FP)samp_cychdr;
	pk_ccyc.cyctim = (UINT)DELAY_TIME;
	cid = tk_cre_cyc(&pk_ccyc);
	if (cid < E_OK) goto error1;

	ercd = tk_sta_cyc(cid);
	if (ercd != E_OK) goto error1;

	ercd = tk_dly_tsk((DELAY_TIME)/2);
	if (ercd != E_OK) goto error1;

	for (i=1; ; i++) {
		DI(intsts);
		// tm_putstring("LED on.\n");
		EI(intsts);

		ercd = tk_dly_tsk(DELAY_TIME);
		if (ercd != E_OK) break;
	}

error1:
	tk_ext_tsk();
}

/* EOF */

⌨️ 快捷键说明

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