1 #ifndef CYGONCE_COMPAT_UITRON_UIT_TYPE_H
2 #define CYGONCE_COMPAT_UITRON_UIT_TYPE_H
3 //===========================================================================
7 // uITRON specific data types as required by the API
9 //===========================================================================
10 //####ECOSGPLCOPYRIGHTBEGIN####
11 // -------------------------------------------
12 // This file is part of eCos, the Embedded Configurable Operating System.
13 // Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
15 // eCos is free software; you can redistribute it and/or modify it under
16 // the terms of the GNU General Public License as published by the Free
17 // Software Foundation; either version 2 or (at your option) any later version.
19 // eCos is distributed in the hope that it will be useful, but WITHOUT ANY
20 // WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
24 // You should have received a copy of the GNU General Public License along
25 // with eCos; if not, write to the Free Software Foundation, Inc.,
26 // 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
28 // As a special exception, if other files instantiate templates or use macros
29 // or inline functions from this file, or you compile this file and link it
30 // with other works to produce a work based on this file, this file does not
31 // by itself cause the resulting work to be covered by the GNU General Public
32 // License. However the source code for this file must still be made available
33 // in accordance with section (3) of the GNU General Public License.
35 // This exception does not invalidate any other reasons why a work based on
36 // this file might be covered by the GNU General Public License.
38 // Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
39 // at http://sources.redhat.com/ecos/ecos-license/
40 // -------------------------------------------
41 //####ECOSGPLCOPYRIGHTEND####
42 //===========================================================================
43 //#####DESCRIPTIONBEGIN####
48 // Purpose: uITRON specific data types as required by the API
51 //####DESCRIPTIONEND####
53 //===========================================================================
55 #include <pkgconf/uitron.h> // uITRON setup CYGNUM_UITRON_SEMAS
56 // CYGPKG_UITRON et al
60 // ------------------------------------------------------------------------
64 // from this section of the uITRON 3.02 manual:
65 // ***********************************************************************
66 // *** 6.4 Data Types ***
67 // ***********************************************************************
69 // *** General-Purpose Data Types ***************************************
71 typedef cyg_int8 B; // signed 8-bit integer
72 typedef cyg_int16 H; // signed 16-bit integer
73 typedef cyg_int32 W; // signed 32-bit integer
74 typedef cyg_uint8 UB; // unsigned 8-bit integer
75 typedef cyg_uint16 UH; // unsigned 16-bit integer
76 typedef cyg_uint32 UW; // unsigned 32-bit integer
78 typedef cyg_uint32 VW; // unpredictable data type (32-bit size)
79 typedef cyg_uint16 VH; // unpredictable data type (16-bit size)
80 typedef cyg_uint8 VB; // unpredictable data type (8-bit size)
82 typedef void * VP; // pointer to an unpredictable data type
84 typedef CYG_ADDRWORD FP; // program start address
86 // * The difference between VB, VH and VW and B, H and W is that only the
87 // number of bits is known for the former, not the data type of the
88 // contents. The latter clearly represent integers.
90 // *** Data Types Dependent on ITRON Specification ***
92 // In order to clarify the meanings of certain parameters, the following
93 // names are used for data types which appear frequently and/or have
96 typedef cyg_int32 INT; // Signed integer (bit width of processor)
97 typedef cyg_uint32 UINT; // Unsigned integer (bit width of processor)
98 typedef cyg_int32 BOOL; // Boolean value. TRUE (1) or FALSE (0).
99 typedef cyg_uint16 FN; // Function code. Signed integer. Maximum 2 bytes.
100 typedef INT ID; // Object ID number (???id)
101 typedef INT BOOL_ID;// Boolean value or ID number
102 typedef INT HNO; // Handler number
103 typedef INT RNO; // Rendezvous number
104 typedef INT NODE; // Node Number. Usually a signed integer.
105 typedef UINT ATR; // Object or handler attribute. An unsigned integer.
106 typedef INT ER; // Error code. A signed integer.
107 typedef INT PRI; // Task priority. A signed integer.
108 typedef UB T_MSG; // Message packet data structure used for mailboxes
109 typedef INT TMO; // Timeout value. A signed integer.
110 // TMO_POL = 0 indicates polling,
111 // while TMO_FEVR = -1 indicates wait forever.
113 typedef cyg_uint64 CYGTM;
114 typedef CYGTM SYSTIME;// Data types used for specifying times.
115 typedef CYGTM CYCTIME;// Often split into upper and lower sections.
116 typedef CYGTM ALMTIME;// For details, see the chapter giving system
117 typedef CYGTM DLYTIME;// call descriptions;.
119 // ***********************************************************************
120 // *** 6.7 Error Codes ***
121 // ***********************************************************************
124 //------------------------------------------------------
125 //Mnemonic Value Description
126 //------------------------------------------------------
127 E_OK = 0, // Normal completion
128 // - - - - - - - - // - - - - - - - - - - - - - - - - - -
129 E_SYS = (-5), // System error
130 // - - - - - - - - // - - - - - - - - - - - - - - - - - -
131 E_NOMEM = (-10), // Insufficient memory
132 // - - - - - - - - // - - - - - - - - - - - - - - - - - -
133 E_NOSPT = (-17), // Feature not supported
134 E_INOSPT = (-18), // Feature not supported by ITRON/FILE specification
135 E_RSFN = (-20), // Reserved function code number
136 E_RSATR = (-24), // Reserved attribute
137 // - - - - - - - - // - - - - - - - - - - - - - - - - - -
138 E_PAR = (-33), // Parameter error
139 E_ID = (-35), // Invalid ID number
140 // - - - - - - - - // - - - - - - - - - - - - - - - - - -
141 E_NOEXS = (-52), // Object does not exist
142 E_OBJ = (-63), // Invalid object state
143 // - - - - - - - - // - - - - - - - - - - - - - - - - - -
144 E_MACV = (-65), // Memory access disabled or memory access violation
145 E_OACV = (-66), // Object access violation
146 // - - - - - - - - // - - - - - - - - - - - - - - - - - -
147 E_CTX = (-69), // Context error
148 // - - - - - - - - // - - - - - - - - - - - - - - - - - -
149 E_QOVR = (-73), // Queuing or nesting overflow
150 // - - - - - - - - // - - - - - - - - - - - - - - - - - -
151 E_DLT = (-81), // Object being waited for was deleted
152 // - - - - - - - - // - - - - - - - - - - - - - - - - - -
153 E_TMOUT = (-85), // Polling failure or timeout exceeded
154 E_RLWAI = (-86), // WAIT state was forcibly released
155 // - - - - - - - - // - - - - - - - - - - - - - - - - - - -
156 #if 0 // CONNECTION FUNCTIONS ARE NOT SUPPORTED
157 EN_NOND = (-113), // Target node does not exist or cannot be accessed
158 EN_OBJNO = (-114), // Specifies an object number which could not be
159 // accessed on the target node
160 EN_PROTO = (-115), // Protocol not supported on target node
161 EN_RSFN = (-116), // System call or function not supported on target node
162 EN_COMM = (-117), // No response from target node
163 EN_RLWAI = (-118), // Connection function response wait state was forcibly
165 EN_PAR = (-119), // A value outside the range supported by the target
166 // node and/or transmission packet format was specified
168 EN_RPAR = (-120), // A value outside the range supported by the issuing
169 // node and/or transmission packet format was returned
170 // as a return parameter
171 EN_CTXID = (-121), // An object on another node was specified to a system
172 // call issued from a task in dispatch disabled state
173 // or from a task-independent portion
174 EN_EXEC = (-122), // System call could not be executed due to
175 // insufficient resources on the target node
176 EN_NOSPT = (-123), // Connection function not supported
177 #endif // 0 CONNECTION FUNCTIONS ARE NOT SUPPORTED
178 // - - - - - - - - // - - - - - - - - - - - - - - - - - - -
182 // *******************************************************************
183 // *** 6.6 Common Constants and Data Structure Packet Formats ***
184 // *******************************************************************
186 /* --- overall ----------------------- */
188 /* invalid address or pointer value */
189 #define NADR ((void *)(-1))
193 FALSE = 0, /* false */
198 TMO_POL = 0, /* polling */
199 TMO_FEVR = (-1) /* wait forever */
202 /* --- for task management functions ----------------------- */
205 typedef struct t_ctsk {
206 VP exinf; /* extended information */
207 ATR tskatr; /* task attributes */
208 FP task; /* task start address */
209 PRI itskpri; /* initial task priority */
210 INT stksz; /* stack size */
212 /* additional information may be included depending on the
219 TA_ASM = 0x00, /* program written in assembly language */
220 TA_HLNG = 0x01, /* program written in high-level language */
221 TA_COP0 = 0x8000, /* uses coprocessor having ID = 0 */
222 TA_COP1 = 0x4000, /* uses coprocessor having ID = 1 */
223 TA_COP2 = 0x2000, /* uses coprocessor having ID = 2 */
224 TA_COP3 = 0x1000, /* uses coprocessor having ID = 3 */
225 TA_COP4 = 0x0800, /* uses coprocessor having ID = 4 */
226 TA_COP5 = 0x0400, /* uses coprocessor having ID = 5 */
227 TA_COP6 = 0x0200, /* uses coprocessor having ID = 6 */
228 TA_COP7 = 0x0100, /* uses coprocessor having ID = 7 */
233 TSK_SELF = 0, /* task specifies itself */
234 /* FALSE = 0, */ /* indicates a task-independent portion (return
239 TPRI_INI = 0, /* specifies the initial priority on task startup
241 TPRI_RUN = 0, /* specifies the highest priority during execution
245 typedef struct t_rtsk {
246 VP exinf; /* extended information */
247 PRI tskpri; /* current priority */
248 UINT tskstat; /* task state */
249 /* the following are represent extended features of support
250 [level X] (implementation-dependent) */
251 #if 0 // NOT SUPPORTED
252 UINT tskwait; /* cause of wait */
253 ID wid; /* ID of object being waited for */
254 INT wupcnt; /* wakeup request count */
255 INT suscnt; /* SUSPEND request count */
256 ATR tskatr; /* task attributes */
257 FP task; /* task start address */
258 PRI itskpri; /* initial task priority */
259 INT stksz; /* stack size */
266 TTS_RUN = 0x01, /* RUN */
267 TTS_RDY = 0x02, /* READY */
268 TTS_WAI = 0x04, /* WAIT */
269 TTS_SUS = 0x08, /* SUSPEND */
270 TTS_WAS = 0x0C, /* WAIT-SUSPEND */
271 TTS_DMT = 0x10, /* DORMANT */
275 TTW_SLP = 0x0001, /* wait due to slp_tsk or tslp_tsk */
276 TTW_DLY = 0x0002, /* wait due to dly_tsk */
277 TTW_NOD = 0x0008, /* connection function response wait */
278 TTW_FLG = 0x0010, /* wait due to wai_flg or twai_flg */
279 TTW_SEM = 0x0020, /* wait due to wai_sem or twai_sem */
280 TTW_MBX = 0x0040, /* wait due to rcv_msg or trcv_msg */
281 TTW_SMBF = 0x0080, /* wait due to snd_mbf or tsnd_mbf */
282 TTW_MBF = 0x0100, /* wait due to rcv_mbf or trcv_mbf */
283 TTW_CAL = 0x0200, /* wait for rendezvous call */
284 TTW_ACP = 0x0400, /* wait for rendezvous accept */
285 TTW_RDV = 0x0800, /* wait for rendezvous completion */
286 TTW_MPL = 0x1000, /* wait due to get_blk or tget_blk */
287 TTW_MPF = 0x2000, /* wait due to get_blf or tget_blf */
289 /* Since the task states given by tskstat and tskwait are expressed
290 by bit correspondences, they are convenient when looking for OR
291 conditions (such as whether a task is in WAIT or READY state).
294 /* --- for semaphore functions ----------------------- */
297 typedef struct t_csem {
298 VP exinf; /* extended information */
299 ATR sematr; /* semaphore attributes */
300 /* Following is the extended function for [level X]. */
301 INT isemcnt; /* initial semaphore count */
302 /* INT maxsem; NOT SUPPORTED maximum semaphore count */
304 /* additional information may be included depending on the
310 typedef struct t_rsem {
311 VP exinf; /* extended information */
312 BOOL_ID wtsk; /* indicates whether or not there is a
314 INT semcnt; /* current semaphore count */
316 /* additional information may be included depending on the
321 /* --- for eventflag functions ----------------------- */
324 typedef struct t_cflg {
325 VP exinf; /* extended information */
326 ATR flgatr; /* eventflag attribute */
327 UINT iflgptn; /* initial eventflag */
329 /* additional information may be included depending on the
336 TA_WSGL = 0x00, /* multiple tasks are not allowed to wait (Wait
338 TA_WMUL = 0x08, /* multiple tasks are allowed to wait (Wait
343 TWF_ANDW = 0x00, /* AND wait */
344 TWF_ORW = 0x02, /* OR wait */
345 TWF_CLR = 0x01, /* clear specification */
348 typedef struct t_rflg {
349 VP exinf; /* extended information */
350 BOOL_ID wtsk; /* indicates whether or not there is a
352 UINT flgptn; /* eventflag bit pattern */
354 /* additional information may be included depending on the
359 /* --- for mailbox functions ----------------------- */
362 typedef struct t_cmbx {
363 VP exinf; /* extended information */
364 ATR mbxatr; /* mailbox attributes */
365 /* Following is implementation-dependent function */
366 /* INT bufcnt; NOT SUPPORTED ring buffer size IS FIXED */
368 /* additional information may be included depending on the
375 TA_TFIFO = 0x00, /* waiting tasks are handled by FIFO */
376 TA_TPRI = 0x01, /* waiting tasks are handled by priority */
377 TA_MFIFO = 0x00, /* messages are handled by FIFO */
378 TA_MPRI = 0x02, /* messages are handled by priority */
382 typedef struct t_rmbx {
383 VP exinf; /* extended information */
384 BOOL_ID wtsk; /* indicates whether or not there is a
386 T_MSG* pk_msg; /* message to be sent next */
388 /* additional information may be included depending on the
393 /* --- for messagebuffer functions ----------------------- */
395 #if 0 // NOT SUPPORTED
397 typedef struct t_cmbf {
398 VP exinf; /* extended information */
399 ATR mbfatr; /* messagebuffer attributes */
400 INT bufsz; /* messagebuffer size */
401 INT maxmsz; /* maximum size of messages */
403 /* additional information may be included depending on the
411 TMBF_OS = (-4), /* messagebuffer used for OS error log */
412 TMBF_DB = (-3), /* messagebuffer used for debugging */
415 typedef struct t_rmbf {
416 VP exinf; /* extended information */
417 BOOL_ID wtsk; /* indicates whether or not there is a
418 task waiting to receive a message */
419 BOOL_ID stsk; /* indicates whether or not there is a
420 task waiting to send a message */
421 INT msgsz; /* size of message to be sent next */
422 INT frbufsz; /* size of free buffer */
424 /* additional information may be included depending on the
430 /* --- for port or rendezvous functions ----------------------- */
432 #if 0 // NOT SUPPORTED
435 typedef struct t_cpor {
436 VP exinf; /* extended information */
437 ATR poratr; /* port attributes */
438 INT maxcmsz; /* maximum call message size */
439 INT maxrmsz; /* maximum reply message size */
441 /* additional information may be included depending on the
448 TA_NULL = 0, /* specifies no particular attributes */
449 /* TA_NULL should be used in place of zeroes to turn off all
450 attribute features. */
453 typedef struct t_rpor {
454 VP exinf; /* extended information */
455 BOOL_ID wtsk; /* indicates whether or not there is a task
456 waiting to call a rendezvous */
457 BOOL_ID atsk; /* indicates whether or not there is a task
458 waiting to accept a rendezvous */
460 /* additional information may be included depending on the
466 /* --- for interrupt management functions ----------------------- */
468 #if 0 // NOT SUPPORTED
470 typedef struct t_dint {
471 ATR intatr; /* interrupt handler attributes */
472 FP inthdr; /* interrupt handler address */
474 /* additional information may be included depending on the
480 /* --- for memorypool management functions ----------------------- */
483 typedef struct t_cmpl {
484 VP exinf; /* extended information */
485 ATR mplatr; /* memorypool attributes */
486 INT mplsz; /* memorypool size */
488 /* additional information may be included depending on the
496 TMPL_OS = (-4) /* memorypool used by OS */
499 typedef struct t_rmpl {
500 VP exinf; /* extended information */
501 BOOL_ID wtsk; /* indicates whether or not there are
503 INT frsz; /* total size of free memory */
504 INT maxsz; /* size of largest contiguous memory */
506 /* additional information may be included depending on the
512 typedef struct t_cmpf {
513 VP exinf; /* extended information */
514 ATR mpfatr; /* memorypool attributes */
515 INT mpfcnt; /* block count for entire memorypool */
516 INT blfsz; /* fixed-size memory block size */
518 /* additional information may be included depending on the
525 typedef struct t_rmpf {
526 VP exinf; /* extended information */
527 BOOL_ID wtsk; /* indicates whether or not there are
529 INT frbcnt; /* free block count */
530 /* additional information may be included depending on the
532 INT numbcnt; /* total number of blocks */
533 INT bsize; /* block size */
537 /* --- for time management functions ----------------------- */
539 #if 0 // native definition is at head of this file
540 /* example for 32-bit CPUs */
541 typedef struct t_systime {
542 H utime; /* upper 16 bits */
543 UW ltime; /* lower 32 bits */
544 } SYSTIME, CYCTIME, ALMTIME;
546 /* example for 16-bit CPUs */
547 typedef struct t_systime {
548 H utime; /* upper 16 bits */
549 UH mtime; /* middle 16 bits */
550 UH ltime; /* lower 16 bits */
551 } SYSTIME, CYCTIME, ALMTIME;
553 /* Member configuration depends on the bit width of the processor and
554 on the implementation. A total of 48 bits is recommended. */
557 typedef struct t_dcyc {
558 VP exinf; /* extended information */
559 ATR cycatr; /* cyclic handler attributes */
560 FP cychdr; /* cyclic handler address */
561 UINT cycact; /* cyclic handler activation */
562 CYCTIME cyctim; /* cyclic startup period */
567 TCY_OFF = 0x00, /* do not invoke cyclic handler */
568 TCY_ON = 0x01, /* invoke cyclic handler */
569 TCY_INT = 0x02, /* initialize cycle count */
570 /* Following changed from TCY_INT to TCY_INI to match
571 description in the body of the standard. I assume TCY_INT
572 is a hypercorrection/typo; keep both */
573 TCY_INI = 0x02, /* initialize cycle count */
576 typedef struct t_rcyc {
577 VP exinf; /* extended information */
578 CYCTIME lfttim; /* time left before next handler startup */
579 UINT cycact; /* cyclic handler activation */
581 /* additional information may be included depending on the
587 typedef struct t_dalm {
588 VP exinf; /* extended information */
589 ATR almatr; /* alarm handler attributes */
590 FP almhdr; /* alarm handler address */
591 UINT tmmode; /* start time specification mode */
592 ALMTIME almtim; /* handler startup time */
597 TTM_ABS = 0x00, /* specified as an absolute time */
598 TTM_REL = 0x01, /* specified as a relative time */
601 typedef struct t_ralm {
602 VP exinf; /* extended information */
603 ALMTIME lfttim; /* time left before next handler startup */
605 /* additional information may be included depending on the
610 /* --- for system management functions ----------------------- */
613 typedef struct t_ver {
614 UH maker; /* vendor */
615 UH id; /* format number */
616 UH spver; /* specification version */
617 UH prver; /* product version */
618 UH prno[4]; /* product control information */
619 UH cpu; /* CPU information */
620 UH var; /* variation descriptor */
624 typedef struct t_rsys {
625 INT sysstat; /* system state */
627 /* additional information may be included depending on the
634 TSS_TSK = 0, /* normal state in which dispatching is enabled during
635 task portion execution */
636 TSS_DDSP = 1, /* state after dis_dsp has been executed during task
637 portion execution (dispatch disabled) */
638 TSS_LOC = 3, /* state after loc_cpu has been executed during task
639 portion execution (interrupt and dispatch disabled)
641 TSS_INDP = 4, /* state during execution of task-independent portions
642 (interrupt and timer handlers) */
645 typedef struct t_rcfg {
646 /* details concerning members are implementation dependent */
649 #if 0 // NOT SUPPORTED
651 typedef struct t_dsvc {
652 ATR svcatr; /* extended SVC handler attributes */
653 FP svchdr; /* extended SVC handler address */
655 /* additional information may be included depending on the
661 typedef struct t_dexc {
662 ATR excatr; /* exception handler attributes */
663 FP exchdr; /* exception handler address */
665 /* additional information may be included depending on the
671 /* --- for network management functions ----------------------- */
673 #if 0 // NOT SUPPORTED
674 // NODE srcnode, dstnode, node:
676 TND_SELF = 0, /* specifies the local node */
677 TND_OTHR = (-1) /* specifies default remote node */
680 /* ------------------------------------------------------ */
684 #endif // CYGPKG_UITRON
686 #endif // CYGONCE_COMPAT_UITRON_UIT_TYPE_H