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

📄 systsk.h

📁 一个操作系统源代码 用于嵌入式设备 在Vc++环境下仿真 成功移植到多款处理器上
💻 H
字号:
#ifndef SYSTSK_H
#define SYSTSK_H

#include <asixdef.h>
#include <kernel\ros33\Ros33.h>

#define	IDLETIME			2
//#define MAX_COLUM			120/* ??????????????*/
//#define MAX_PAGE			160

#define KEYSCANTIMER		2
#define TOUCHTIMER			4

/* Task's Status: it's not same as Ros33 task's status .
   These macros are used in message handler of systask() */
#define DORMANT				0x00000000L
#define RUNNING				0x00000001L

/* Event Flag ID for Interrupt & Tasks' Message */
#define SYS_EVENT			2		// Systask Event Flag ID
#define TIMER_EVENT			3		// Timer Task Event Flag ID
#define UART_EVENT			4		// Uart Server Event Flag ID
#define UART0_RBUF_EVENT 	5
#define UART1_RBUF_EVENT 	6
#define UART0_WBUF_EVENT 	7
#define UART1_WBUF_EVENT 	8

#define ALLINT_FLG				0xFFFFFFFFL

// Systask Event Flag
#define TASKMSG_FLG				0x00000001L
#define INTAT_FLG				0x00000002L
#define INTKEY_FLG				0x00000004L
#define INTPEN_FLG				0x00000008L
#define INTTIMER_FLG			0x00000010L
// Timer Task Event Flag
#define TIMER_FLG				0x00000001L
// Uart Server Event Flag
#define INTUART0_DR_FLG			0x00000020L
#define INTUART1_DR_FLG			0x00000040L

/* Interrupt & Tasks' Message Definition */

/* Semphore ID for task */
#define UART0_OWN_SEM 		1
#define UART0_WRITE_SEM 	2
#define UART0_READ_SEM 		3
#define UART1_OWN_SEM 		4
#define UART1_WRITE_SEM 	5
#define UART1_READ_SEM 		6

struct asix_window;
struct _taskdescription;
struct _atvcb;
struct _gc;

/* Define Task Control Block in System Layer */
typedef struct _systcb
{
	struct _systcb	*next;
//	struct _taskdescription	*description;	/*point to the task's description */
	struct _tskdesplst	*description;	/*point to the task's description */
	DWORD	id;				/* task id : actually, it's SYSTCB's address */
//	BYTE	group;			/* the group this task belongs to */
//	CHAR 	*icon;			/* the icon of this task */
	struct _gc 		*gc;/* pointer to GC(Graphic Context) */
	struct _atvcb 	*atvcb;	/* pointer to Active Area Control Block */
	DWORD	devices;		/* devices used by this task 
						 	 * descriped by one bit per device */
	struct asix_window 	*wnd_ptr;		/* it will be used by Asixwin */
	DWORD	status;			/* when created, it is DORMANT;
							   when started, it is RUNNING; */
	DWORD	(*entryCallback)(DWORD);	/* pointer to function called before task begins */
	DWORD 	(*exitCallback)(DWORD);		/* pointer to function called after task exits */
	/* Message Cache */
	/* reserved */
//	DWORD	*stack;			/* pointer to the stack of this task */
} SYSTCB;

PUBLIC void SysTcbTableInit( void );

EXTERN	SYSTCB	gSysTcbTbl[];
//EXTERN	SYSTCB	*CurTask;		//point to current task's link entry
EXTERN	SYSTCB	*TaskHead;		//the head of the task link
EXTERN	SYSTCB	*SysDeamonTask;	//the Deamon's entry
EXTERN	SYSTCB	*SysSleepTask;	//the sleep deamon's entry

#define vDisableInterrupt()\
		loc_cpu()//asm("ld.w %r9, %psr\nand %r9, 0x2f\nld.w %psr, %r9")
#define vEnableInterrupt()\
		unl_cpu()//asm("ld.w %r10, %psr\nor %r9, 0x10\nld.w %psr, %r9")

#define vDisableDispatch()	dis_dsp()
#define vEnableDispatch()	ena_dsp()

#endif /* SYSTSK_H */

⌨️ 快捷键说明

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