📄 message.h
字号:
/* *---------------------------------------------------------------------- * T-Kernel / Standard Extension * * Copyright (C) 2006 by Ken Sakamura. All rights reserved. * T-Kernel / Standard Extension is distributed * under the T-License for T-Kernel / Standard Extension. *---------------------------------------------------------------------- * * Version: 1.00.00 * Released by T-Engine Forum(http://www.t-engine.org) at 2006/8/11. * *---------------------------------------------------------------------- *//* * message.h (extension) * * Message management */#ifndef __EXTENSION_MESSAGE_H__#define __EXTENSION_MESSAGE_H__#include <basic.h>#include "typedef.h"#ifdef __cplusplusextern "C" {#endif/* Process message definitions */typedef union { struct { /* MS_ABORT */ ID pid; W code; } ABORT; struct { /* MS_EXIT */ ID pid; W code; } EXIT; struct { /* MS_TERM */ ID pid; W code; } TERM; struct { /* MS_TMOUT */ W code; } TMOUT; struct { /* MS_SYSEVT */ W code; } SYSEVT; struct { /* Others in general */ UB msg_str[32]; } ANYMSG;} MSGBODY;struct message { W msg_type; /* Message type */ W msg_size; /* Message body size (bytes) */ MSGBODY msg_body; /* Message body */};#ifndef __message__typedef struct message MESSAGE;#define __message__#endif#define MSGSIZE(msgsz) (offsetof(MESSAGE,msg_body) + (msgsz))/* Message type */#define MS_ABORT (1) /* Process abnormal termination */#define MS_EXIT (2) /* Process normal termination */#define MS_TERM (3) /* Process forced termination */#define MS_TMOUT (4) /* Timeout */#define MS_SYSEVT (5) /* System event (forced termination) */#define MS_SYS1 (6) /* System reservation */#define MS_SYS2 (7) /* System reservation */#define MS_SYS3 (8) /* System reservation */#define MS_SYS4 (9) /* System reservation */#define MS_SYS5 (10) /* System reservation */#define MS_MNG0 (11) /* Outer shell reservation */#define MS_MNG1 (12) /* Outer shell reservation (hmi) */#define MS_MNG2 (13) /* Outer shell reservation (hmi) */#define MS_MNG3 (14) /* Outer shell reservation (omgr) */#define MS_MNG4 (15) /* Outer shell reservation (spooler) */#define MS_MNG5 (16) /* Outer shell reservation */#define MS_MNG6 (17) /* Outer shell reservation */#define MS_MNG7 (18) /* Outer shell reservation (hmi) */#define MS_MNG8 (19) /* Outer shell reservation (hmi) */#define MS_MNG9 (20) /* Outer shell reservation (hmi) */#define MS_MNG10 (21) /* Outer shell reservation (hmi) */#define MS_MNG11 (22) /* Outer shell reservation */#define MS_MNG12 (23) /* Outer shell reservation */#define MS_TYPE0 (24) /* Application message */#define MS_TYPE1 (25)#define MS_TYPE2 (26)#define MS_TYPE3 (27)#define MS_TYPE4 (28)#define MS_TYPE5 (29)#define MS_TYPE6 (30)#define MS_TYPE7 (31)#define MS_MIN (1) /* Minimum message type */#define MS_MAX (31) /* Maximum message type *//* Message type mask */#define MSGMASK(msgtype) (0x00000001U << ((msgtype) - 1))#define MM_ABORT MSGMASK(MS_ABORT)#define MM_EXIT MSGMASK(MS_EXIT)#define MM_TERM MSGMASK(MS_TERM)#define MM_TMOUT MSGMASK(MS_TMOUT)#define MM_SYSEVT MSGMASK(MS_SYSEVT)#define MM_SYS1 MSGMASK(MS_SYS1)#define MM_SYS2 MSGMASK(MS_SYS2)#define MM_SYS3 MSGMASK(MS_SYS3)#define MM_SYS4 MSGMASK(MS_SYS4)#define MM_SYS5 MSGMASK(MS_SYS5)#define MM_MNG0 MSGMASK(MS_MNG0)#define MM_MNG1 MSGMASK(MS_MNG1)#define MM_MNG2 MSGMASK(MS_MNG2)#define MM_MNG3 MSGMASK(MS_MNG3)#define MM_MNG4 MSGMASK(MS_MNG4)#define MM_MNG5 MSGMASK(MS_MNG5)#define MM_MNG6 MSGMASK(MS_MNG6)#define MM_MNG7 MSGMASK(MS_MNG7)#define MM_MNG8 MSGMASK(MS_MNG8)#define MM_MNG9 MSGMASK(MS_MNG9)#define MM_MNG10 MSGMASK(MS_MNG10)#define MM_MNG11 MSGMASK(MS_MNG11)#define MM_MNG12 MSGMASK(MS_MNG12)#define MM_TYPE0 MSGMASK(MS_TYPE0)#define MM_TYPE1 MSGMASK(MS_TYPE1)#define MM_TYPE2 MSGMASK(MS_TYPE2)#define MM_TYPE3 MSGMASK(MS_TYPE3)#define MM_TYPE4 MSGMASK(MS_TYPE4)#define MM_TYPE5 MSGMASK(MS_TYPE5)#define MM_TYPE6 MSGMASK(MS_TYPE6)#define MM_TYPE7 MSGMASK(MS_TYPE7)#define MM_ALL (0x7fffffff) /* All mask */#define MM_NULL (0) /* Empty mask *//* Message option */#define WAIT 0x0000 /* Wait */#define NOWAIT 0x0001 /* Not wait */#define CONFM 0x0002 /* Wait for reception (confirmation) */#define CHECK 0x0002 /* Check message */#define WAIEVT 0x0004 /* Wait for message and event *//* Special option */#define STARTMSG 0x80000000U /* Receive startup message *//* Default message handler */#define MH_NONE ((FUNCP)1) /* Ignore */#define MH_BREAK ((FUNCP)2) /* Suspend processing */#define MH_TERM ((FUNCP)3) /* Terminate process *//* Destination of special message */#define MSGHDR_PID (-2) /* Message handler definition process *//* * Definitions for automatic generation of interface library (mkiflib) *//*** DEFINE_IFLIB[INCLUDE FILE]<extension/message.h>[PREFIX]MSG***//* * Message management system call *//* [BEGIN SYSCALLS] */IMPORT ER tkse_snd_msg(ID pid, MESSAGE *msg, W opt);IMPORT ER tkse_rcv_msg(W t_mask, MESSAGE *msg, W msgsz, W opt);/* RESERVE_NO */IMPORT ER tkse_clr_msg(W t_mask, W last_mask);IMPORT ER tkse_DefMsgHdr(W t_mask, FUNCP msg_hdr, FUNCP *hdrs);IMPORT ER tkse_RetMsgHdr(W abort);IMPORT ER tkse_req_tmg(TMOUT tmo, W code);IMPORT ER tkse_can_tmg(void);IMPORT ER tkse_brk_msg(void);/* [END SYSCALLS] */IMPORT ER tkse_def_msg(W t_mask, FUNCP msg_hdr);IMPORT ER tkse_ret_msg(W ret);#ifdef __cplusplus}#endif#endif /* __EXTENSION_MESSAGE_H__ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -