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

📄 root.c

📁 经典的psos编程实例源码
💻 C
字号:
/* root.c */#include "sys_conf.h"#include <psos.h>#include <prepc.h>#include <stdio.h>#include "misc.h"#include "appl.h"/* ROOT task */voidroot(){	void	* dummy;	ULONG	ioretval, iopb[4], rc, args[4], tid, ignored, ev, pend;	/* Initialize all drivers */	de_init(DEV_TIMER, 0, &ioretval, &dummy);	de_init(DEV_SERIAL, 0, &ioretval, &dummy);	bpinit(128*100);	bprintf("\nRoot task begin\n");	/* Create and start the other task */	args[2] = args[3] = 0;	args[0] = (ULONG) T1_NAM;	/* Other task's name */	t_ident(0, 0, & (args[1]));	/* My task's ID */	if (rc = t_create(T1_NAM, 1, 1024, 1024, 0, &tid))		fail(rc, "root: t_create(%s)", T1_NAM);	if (rc = t_start(tid, 0, (void(*)()) tsk1, args))		fail(rc, "root: t_start(%s)", T1_NAM);	for (;;) {		rc = ev_receive(0x0000aaaa, EV_ANY, 4*TENTH, & ev);		if (rc == 0)			bprintf("\t\t\tGot 0x%08x", ev);		else if (rc == ERR_TIMEOUT)			bprintf("\t\t\tTime-out .....");		else			fail(rc, "root: ev_receive");		ev_receive(0, EV_NOWAIT, 0, & pend);		bprintf(" (0x%08x still pending)\n", pend);		if ((rc == 0) && (ev & FINAL_EV))			break;	}	/* Example finished */	bprintf("Root task end\n");	bpflush();	exit(0); /* Terminate */}

⌨️ 快捷键说明

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