program9.c

来自「嵌入式系统基础课件」· C语言 代码 · 共 36 行

C
36
字号
#include "libepc.h"
#include "os_cpu.h"
#include "os_cfg.h"
#include "ucos_ii.h"
#include "inbound.h"
#include "elapsed.h"
#include "packet.h"
#include <dos.h>

#define	STACK_SIZE	1000

extern void OutboundThread() ;

PRIVATE OS_STK *CreateStack(void)
	{
	OS_STK *top = (OS_STK *) malloc(STACK_SIZE) + STACK_SIZE ;
	if (!top) for (;;) ;
	return top ;
	}

int main()
	{
	ClearScreen(0x07) ;
	SetCursorVisible(TRUE) ;

	OSInit() ;
	OSTaskCreate(ReceivePackets,	NULL, CreateStack(), 0) ;
	OSTaskCreate(InboundTime,	NULL, CreateStack(), 1) ;
	OSTaskCreate(InboundText,	NULL, CreateStack(), 2) ;
	OSTaskCreate(OutboundThread,	NULL, CreateStack(), 3) ;
	OSTaskCreate(ElapsedLocal,	NULL, CreateStack(), 4) ;
	OSStart() ;

	return 0 ;
	}

⌨️ 快捷键说明

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