30.12.2013 Views

T-Kernel Specification (1.B0.02)

T-Kernel Specification (1.B0.02)

T-Kernel Specification (1.B0.02)

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

18 CHAPTER 3. COMMON T-KERNEL SPECIFICATIONS<br />

/*<br />

* Boolean values<br />

* TRUE = 1 is defined, but any value other than 0 is TRUE.<br />

* A decision such as bool == TRUE must be avoided for this reason.<br />

* Instead use bool != FALSE.<br />

*/<br />

typedef INT<br />

BOOL;<br />

#define TRUE 1 /* True */<br />

#define FALSE 0 /* False */<br />

/*<br />

* TRON character codes<br />

*/<br />

typedef UH TC; /* TRON character code */<br />

#define TNULL ((TC)0) /* TRON code string termination */<br />

• VB, VH, and VW differ from B, H, and W in that the former mean only the bit width is known, not<br />

the contents of the data type, whereas the latter clearly indicate integer type.<br />

• Processor bit width must be 32 bits or above. INT and UINT must therefore always have a width<br />

of 32 bits or more.<br />

• BOOL defines TRUE = 1, but any value other than 0 is also TRUE. For this reason a decision such as<br />

bool == TRUE must be avoided. Instead use bool != FALSE.<br />

[Additional Notes]<br />

Parameters such as stksz, wupcnt, and message size that clearly do not take negative values are also<br />

in principle signed integer (INT) data type. This is in keeping with the overall TRON rule that integers<br />

should be treated as signed numbers to the extent possible. As for the timeout (TMO tmout) parameter,<br />

its being a signed integer enables the use of TMO FEVR(= −1) having special meaning. Parameters with<br />

unsigned data type are those treated as bit patterns (object attribute, event flag, etc.).<br />

3.1.2 Other Defined Data Types<br />

The following names are used for other data types that appear frequently or have special meaning, in<br />

order to make the parameter meaning clear.<br />

typedef INT FN; /* Function code */<br />

typedef INT RNO; /* Rendezvous number */<br />

typedef UINT ATR; /* Object/handler attributes */<br />

typedef INT ER; /* Error code */<br />

typedef INT PRI; /* Priority */<br />

typedef INT TMO; /* Timeout designation */<br />

typedef UINT RELTIM; /* Relative time */<br />

typedef struct systim { /* System time */<br />

W hi; /* High 32 bits */<br />

UW lo; /* Low 32 bits */<br />

} SYSTIM;<br />

Copyright c○ 2002, 2003 by T-Engine Forum<br />

T-<strong>Kernel</strong> <strong>1.B0.02</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!