📄 uit_type.h
字号:
#ifndef CYGONCE_COMPAT_UITRON_UIT_TYPE_H#define CYGONCE_COMPAT_UITRON_UIT_TYPE_H//===========================================================================//// uit_type.h//// uITRON specific data types as required by the API////===========================================================================//####COPYRIGHTBEGIN####//// -------------------------------------------// The contents of this file are subject to the Cygnus eCos Public License// Version 1.0 (the "License"); you may not use this file except in// compliance with the License. You may obtain a copy of the License at// http://sourceware.cygnus.com/ecos// // Software distributed under the License is distributed on an "AS IS"// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the// License for the specific language governing rights and limitations under// the License.// // The Original Code is eCos - Embedded Cygnus Operating System, released// September 30, 1998.// // The Initial Developer of the Original Code is Cygnus. Portions created// by Cygnus are Copyright (C) 1998,1999 Cygnus Solutions. All Rights Reserved.// -------------------------------------------////####COPYRIGHTEND####//===========================================================================//#####DESCRIPTIONBEGIN####//// Author(s): hmt// Contributors: hmt// Date: 1998-03-13// Purpose: uITRON specific data types as required by the API// Description: ////####DESCRIPTIONEND####////===========================================================================#include <pkgconf/uitron.h> // uITRON setup CYGNUM_UITRON_SEMAS // CYGPKG_UITRON et al#ifdef CYGPKG_UITRON// ------------------------------------------------------------------------// uITRON types//// from this section of the uITRON 3.02 manual:// ***********************************************************************// *** 6.4 Data Types ***// ***********************************************************************//// *** General-Purpose Data Types ***************************************typedef cyg_int8 B; // signed 8-bit integertypedef cyg_int16 H; // signed 16-bit integertypedef cyg_int32 W; // signed 32-bit integertypedef cyg_uint8 UB; // unsigned 8-bit integertypedef cyg_uint16 UH; // unsigned 16-bit integertypedef cyg_uint32 UW; // unsigned 32-bit integer // typedef cyg_uint32 VW; // unpredictable data type (32-bit size)typedef cyg_uint16 VH; // unpredictable data type (16-bit size)typedef cyg_uint8 VB; // unpredictable data type (8-bit size) typedef void * VP; // pointer to an unpredictable data type typedef CYG_ADDRWORD FP; // program start address// * The difference between VB, VH and VW and B, H and W is that only the// number of bits is known for the former, not the data type of the// contents. The latter clearly represent integers.//// *** Data Types Dependent on ITRON Specification ***//// In order to clarify the meanings of certain parameters, the following// names are used for data types which appear frequently and/or have// special meanings.typedef cyg_int32 INT; // Signed integer (bit width of processor)typedef cyg_uint32 UINT; // Unsigned integer (bit width of processor)typedef cyg_int32 BOOL; // Boolean value. TRUE (1) or FALSE (0).typedef cyg_uint16 FN; // Function code. Signed integer. Maximum 2 bytes.typedef INT ID; // Object ID number (???id)typedef INT BOOL_ID;// Boolean value or ID numbertypedef INT HNO; // Handler numbertypedef INT RNO; // Rendezvous numbertypedef INT NODE; // Node Number. Usually a signed integer.typedef UINT ATR; // Object or handler attribute. An unsigned integer.typedef INT ER; // Error code. A signed integer.typedef INT PRI; // Task priority. A signed integer.typedef UB T_MSG; // Message packet data structure used for mailboxestypedef INT TMO; // Timeout value. A signed integer. // TMO_POL = 0 indicates polling, // while TMO_FEVR = -1 indicates wait forever.typedef cyg_uint64 CYGTM;typedef CYGTM SYSTIME;// Data types used for specifying times.typedef CYGTM CYCTIME;// Often split into upper and lower sections.typedef CYGTM ALMTIME;// For details, see the chapter giving systemtypedef CYGTM DLYTIME;// call descriptions;.// ***********************************************************************// *** 6.7 Error Codes ***// ***********************************************************************enum {//------------------------------------------------------//Mnemonic Value Description//------------------------------------------------------E_OK = 0, // Normal completion// - - - - - - - - // - - - - - - - - - - - - - - - - - -E_SYS = (-5), // System error// - - - - - - - - // - - - - - - - - - - - - - - - - - -E_NOMEM = (-10), // Insufficient memory// - - - - - - - - // - - - - - - - - - - - - - - - - - -E_NOSPT = (-17), // Feature not supportedE_INOSPT = (-18), // Feature not supported by ITRON/FILE specificationE_RSFN = (-20), // Reserved function code numberE_RSATR = (-24), // Reserved attribute// - - - - - - - - // - - - - - - - - - - - - - - - - - -E_PAR = (-33), // Parameter errorE_ID = (-35), // Invalid ID number// - - - - - - - - // - - - - - - - - - - - - - - - - - -E_NOEXS = (-52), // Object does not existE_OBJ = (-63), // Invalid object state// - - - - - - - - // - - - - - - - - - - - - - - - - - -E_MACV = (-65), // Memory access disabled or memory access violationE_OACV = (-66), // Object access violation// - - - - - - - - // - - - - - - - - - - - - - - - - - -E_CTX = (-69), // Context error// - - - - - - - - // - - - - - - - - - - - - - - - - - -E_QOVR = (-73), // Queuing or nesting overflow// - - - - - - - - // - - - - - - - - - - - - - - - - - -E_DLT = (-81), // Object being waited for was deleted// - - - - - - - - // - - - - - - - - - - - - - - - - - -E_TMOUT = (-85), // Polling failure or timeout exceededE_RLWAI = (-86), // WAIT state was forcibly released// - - - - - - - - // - - - - - - - - - - - - - - - - - - -#if 0 // CONNECTION FUNCTIONS ARE NOT SUPPORTEDEN_NOND = (-113), // Target node does not exist or cannot be accessedEN_OBJNO = (-114), // Specifies an object number which could not be // accessed on the target nodeEN_PROTO = (-115), // Protocol not supported on target nodeEN_RSFN = (-116), // System call or function not supported on target nodeEN_COMM = (-117), // No response from target nodeEN_RLWAI = (-118), // Connection function response wait state was forcibly // releasedEN_PAR = (-119), // A value outside the range supported by the target // node and/or transmission packet format was specified // as a parameterEN_RPAR = (-120), // A value outside the range supported by the issuing // node and/or transmission packet format was returned // as a return parameterEN_CTXID = (-121), // An object on another node was specified to a system // call issued from a task in dispatch disabled state // or from a task-independent portionEN_EXEC = (-122), // System call could not be executed due to // insufficient resources on the target nodeEN_NOSPT = (-123), // Connection function not supported#endif // 0 CONNECTION FUNCTIONS ARE NOT SUPPORTED// - - - - - - - - // - - - - - - - - - - - - - - - - - - -};// *******************************************************************// *** 6.6 Common Constants and Data Structure Packet Formats ***// *******************************************************************/* --- overall ----------------------- *//* invalid address or pointer value */#define NADR ((void *)(-1)) enum { TRUE = 1, /* true */ FALSE = 0, /* false */};/* TMO tmout: */enum { TMO_POL = 0, /* polling */ TMO_FEVR = (-1) /* wait forever */};/* --- for task management functions ----------------------- */// cre_tsk: typedef struct t_ctsk { VP exinf; /* extended information */ ATR tskatr; /* task attributes */ FP task; /* task start address */ PRI itskpri; /* initial task priority */ INT stksz; /* stack size */ // ... /* additional information may be included depending on the implementation */ // ... } T_CTSK;// tskatr:enum { TA_ASM = 0x00, /* program written in assembly language */ TA_HLNG = 0x01, /* program written in high-level language */ TA_COP0 = 0x8000, /* uses coprocessor having ID = 0 */ TA_COP1 = 0x4000, /* uses coprocessor having ID = 1 */ TA_COP2 = 0x2000, /* uses coprocessor having ID = 2 */ TA_COP3 = 0x1000, /* uses coprocessor having ID = 3 */ TA_COP4 = 0x0800, /* uses coprocessor having ID = 4 */ TA_COP5 = 0x0400, /* uses coprocessor having ID = 5 */ TA_COP6 = 0x0200, /* uses coprocessor having ID = 6 */ TA_COP7 = 0x0100, /* uses coprocessor having ID = 7 */};// tskid:enum { TSK_SELF = 0, /* task specifies itself */ /* FALSE = 0, */ /* indicates a task-independent portion (return parameters only) */};// tskpri:enum { TPRI_INI = 0, /* specifies the initial priority on task startup (chg_pri) */ TPRI_RUN = 0, /* specifies the highest priority during execution (rot_rdq) */}; /* ref_tsk */ typedef struct t_rtsk { VP exinf; /* extended information */ PRI tskpri; /* current priority */ UINT tskstat; /* task state */ /* the following are represent extended features of support [level X] (implementation-dependent) */#if 0 // NOT SUPPORTED UINT tskwait; /* cause of wait */ ID wid; /* ID of object being waited for */ INT wupcnt; /* wakeup request count */ INT suscnt; /* SUSPEND request count */ ATR tskatr; /* task attributes */ FP task; /* task start address */ PRI itskpri; /* initial task priority */ INT stksz; /* stack size */ // ...#endif } T_RTSK;// tskstat:enum { TTS_RUN = 0x01, /* RUN */ TTS_RDY = 0x02, /* READY */ TTS_WAI = 0x04, /* WAIT */ TTS_SUS = 0x08, /* SUSPEND */ TTS_WAS = 0x0C, /* WAIT-SUSPEND */ TTS_DMT = 0x10, /* DORMANT */};// tskwait:enum { TTW_SLP = 0x0001, /* wait due to slp_tsk or tslp_tsk */ TTW_DLY = 0x0002, /* wait due to dly_tsk */ TTW_NOD = 0x0008, /* connection function response wait */ TTW_FLG = 0x0010, /* wait due to wai_flg or twai_flg */ TTW_SEM = 0x0020, /* wait due to wai_sem or twai_sem */ TTW_MBX = 0x0040, /* wait due to rcv_msg or trcv_msg */ TTW_SMBF = 0x0080, /* wait due to snd_mbf or tsnd_mbf */ TTW_MBF = 0x0100, /* wait due to rcv_mbf or trcv_mbf */ TTW_CAL = 0x0200, /* wait for rendezvous call */ TTW_ACP = 0x0400, /* wait for rendezvous accept */ TTW_RDV = 0x0800, /* wait for rendezvous completion */ TTW_MPL = 0x1000, /* wait due to get_blk or tget_blk */ TTW_MPF = 0x2000, /* wait due to get_blf or tget_blf */}; /* Since the task states given by tskstat and tskwait are expressed by bit correspondences, they are convenient when looking for OR conditions (such as whether a task is in WAIT or READY state). *//* --- for semaphore functions ----------------------- */ /* cre_sem */ typedef struct t_csem { VP exinf; /* extended information */ ATR sematr; /* semaphore attributes */ /* Following is the extended function for [level X]. */ INT isemcnt; /* initial semaphore count */ /* INT maxsem; NOT SUPPORTED maximum semaphore count */ // ... /* additional information may be included depending on the implementation */ // ... } T_CSEM; /* ref_sem */ typedef struct t_rsem { VP exinf; /* extended information */ BOOL_ID wtsk; /* indicates whether or not there is a waiting task */ INT semcnt; /* current semaphore count */ // ... /* additional information may be included depending on the implementation */ // ... } T_RSEM;/* --- for eventflag functions ----------------------- */ /* cre_flg */ typedef struct t_cflg { VP exinf; /* extended information */ ATR flgatr; /* eventflag attribute */ UINT iflgptn; /* initial eventflag */ // ... /* additional information may be included depending on the implementation */ // ... } T_CFLG;// flgatr:enum { TA_WSGL = 0x00, /* multiple tasks are not allowed to wait (Wait Single Task) */ TA_WMUL = 0x08, /* multiple tasks are allowed to wait (Wait Multiple Task) */};// wfmode:enum { TWF_ANDW = 0x00, /* AND wait */ TWF_ORW = 0x02, /* OR wait */ TWF_CLR = 0x01, /* clear specification */}; /* ref_flg */ typedef struct t_rflg { VP exinf; /* extended information */ BOOL_ID wtsk; /* indicates whether or not there is a
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -