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

📄 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], tid1, tid2, ignored;	/* 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 two test tasks */	args[2] = args[3] = 0;	args[0] = (ULONG) T1_NAM;	/* This task's name */	args[1] = (ULONG) T2_NAM;	/* Other task's name */	if (rc = t_create(T1_NAM, 128, 1024, 1024, 0, &tid1))		fail(rc, "root: t_create(%s)", T1_NAM);	if (rc = t_start(tid1, 0, (void(*)()) tsk1, args))		fail(rc, "root: t_start(%s)", T1_NAM);	args[0] = (ULONG) T2_NAM;	/* This task's name */	args[1] = (ULONG) T1_NAM;	/* Other task's name */	if (rc = t_create(T2_NAM, 128, 1024, 1024, 0, &tid2))		fail(rc, "root: t_create(%s)", T2_NAM);	if (rc = t_start(tid2, 0, (void(*)()) tsk2, args))		fail(rc, "root: t_start(%s)", T2_NAM);	/* Now wait until they have both been deleted */	while (0 == (rc = t_getreg(tid1, 0, &ignored)))		tm_wkafter(10);	if (rc != ERR_OBJDEL)		fail(rc, "root: t_getreg(%s)", T1_NAM);	while (0 == (rc = t_getreg(tid2, 0, &ignored)))		tm_wkafter(10);	if (rc != ERR_OBJDEL)		fail(rc, "root: t_getreg(%s)", T2_NAM);	/* Example finished */	bprintf("Root task end\n");	bpflush();	exit(0);}

⌨️ 快捷键说明

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