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

📄 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	retval, iopb[4], rc, args[4],		tid1, tid2, tid3, tid4, ignored;	/* Initialize all drivers */	de_init(DEV_TIMER, 0, &retval, &dummy);	de_init(DEV_SERIAL, 0, &retval, &dummy);	bpinit(128*100);	bprintf("\nRoot task begin\n");	/* Create and start the tasks */	args[1] = args[2] = args[3] = 0;	args[0] = (ULONG) T1_NAM;	/* This 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(*)()) task, args))		fail(rc, "root: t_start(%s)", T1_NAM);	args[0] = (ULONG) T2_NAM;	/* This 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(*)()) task, args))		fail(rc, "root: t_start(%s)", T2_NAM);	args[0] = (ULONG) T3_NAM;	/* This task's name */	if (rc = t_create(T3_NAM, 200, 1024, 1024, 0, &tid3))		fail(rc, "root: t_create(%s)", T3_NAM);	if (rc = t_start(tid3, 0, (void(*)()) task, args))		fail(rc, "root: t_start(%s)", T3_NAM);	args[0] = (ULONG) T4_NAM;	/* This task's name */	if (rc = t_create(T4_NAM, 100, 1024, 1024, 0, &tid4))		fail(rc, "root: t_create(%s)", T4_NAM);	if (rc = t_start(tid4, 0, (void(*)()) task, args))		fail(rc, "root: t_start(%s)", T4_NAM);	/* Delay one second */	tm_wkafter(1*SECOND);	/* Example finished */	bprintf("Root task end\n");	bpflush();	exit(0);}

⌨️ 快捷键说明

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