td_ref_tsk
Reference Task State
ER ercd = td_ref_tsk ( ID tskid, TD_RTSK *rtsk );
ID tskid Task ID (TSK_SELF can be designated)
TD_RTSK rtsk Packet address for returning the task state
ER ercd Error code
E_OK Normal completion
E_ID Bad identifier
E_NOEXS Object does not exist
Gets the state of the task designated in tskid. This function is similar to tk_ref_tsk, with the task start address and stack information added to the state information obtained.
typedef struct td_rtsk {
VP exinf; /* extended information */
PRI tskpri; /* current priority */
PRI tskbpri; /* base priority */
UINT tskstat; /* task state */
UINT tskwait; /* wait factor */
ID wid; /* waiting object ID */
INT wupcnt; /* queued wakeup request count */
INT suscnt; /* SUSPEND request nesting count */
RELTIM slicetime; /* maximum continuous run time ms) */
UINT waitmask; /* masked wait factors */
UINT texmask; /* allowed task exceptions */
UINT tskevent; /* raised task event */
FP task; /* task start address */
INT stksz; /* user stack size (in bytes) */
INT sstksz; /* system stack size (in bytes) */
VP istack; /* user stack pointer initial value */
VP isstack; /* system stack pointer initial alue */
} TD_RTSK;
The stack area extends from the stack pointer initial value toward the low addresses for the number of bytes designated as the stack size.
istack – stksz < user stack area < istack
isstack – sstksz < system stack area < isstack
Note that the stack pointer initial value (istack, isstack) is not the same as its current position. The stack area may be used even before a task is started. Calling td_get_reg gets the stack pointer current position.

Comments