📄 sysstruct.h
字号:
#ifndef __SYSSTRUCT_H__
#define __SYSSTRUCT_H__
// write your header here
//system enumeration structure
enum Tsk_status {
Unused = 0x00,
Ready = 0x01,
Running = 0x02,
Suspend = 0x04,
Delay = 0x08,
WaitSem = 0x10,
WaitMail = 0x20,
WaitQueue = 0x40,
waitFlag = 0x80,
waitMem = 0x100,
SemDly = 0x18,
MailDly = 0x28,
QDly = 0x48,
FlagDly = 0x88,
MemDly = 0x108,
SemSus = 0x14,
MailSus = 0x24,
QSus = 0x44,
FlagSus = 0x84,
MemSus = 0x104,
SemDlySus = 0x1C,
MailDlySus = 0x2C,
MQDlySus = 0x4C,
FlagDlySus = 0x8C,
MemDlySus = 0x10C
};
enum Event_type { //Event type
None = 0, //none
Semaphore, //semaphore
Mailbox, //mailbox
Queue, //message queue
Flag //event flag
};
enum Event_state { //Event log state
Send = 0, //It is send
Receive //It is receive
};
typedef struct TCB_reg {
unsigned int reserved;
unsigned int SB;
unsigned int R1;
unsigned int R2;
unsigned int R3;
unsigned int R4;
unsigned int BP;
unsigned int SR;
unsigned int PC;
} TCB_reg;
//system Data structure
//TCB
typedef struct TCB_struct {
TCB_reg* SP; //Register struct
enum Tsk_status taskState; //task state
unsigned int taskTimeDly; //Time delay count
struct ECB_struct* eventPtr; //waiting event handle
} TCB_struct;
//ECB
typedef struct ECB_struct {
enum Event_type eventType; //event type
unsigned int waitTable[2]; //waiting task table map
union {
unsigned int count; //semaphore count
unsigned int flag_Grp; //flag group
void *msg; //pointer of mail
struct QCB_struct *p_QCB; //pointer of queue control block
} comm;
} ECB_struct;
//QCB
typedef struct QCB_struct {
void *start; //quque start address
void *end; //queue end address
void *in; //enter queue address
void *out; //out queue address
unsigned int entries; //message number
} QCB_struct;
//IFT Interrupt function Table
typedef struct IFT_struct {
struct IFT_struct *next; //pointer of next function
unsigned int SR; //function segment
void (*function)(void); //pointer of function offset
} IFT_struct;
typedef struct MCB_struct {
void *MCB_freeList;
int waitTable[2];
} MCB_struct;
//Flag Node
/*typedef struct Flag_struct {
unsigned int waitType;
unsigned int waitFlag;
} Flag_struct;
//Event log structure
typedef struct EventLog {
unsigned long int time;
unsigned int taskID : 4;
enum Event_type eventType : 3;
enum Event_state receive : 1;
} EventLog; */
typedef void (*pTask)(void*); //Pointer of task function
typedef ECB_struct* HEvent; //
typedef MCB_struct* HMem; //memory handle
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -