td_ref_tsk

Reference Task State

[C Language Interface]

ER ercd = td_ref_tsk ( ID tskid, TD_RTSK *rtsk );

[Parameters]

ID tskid Task ID (TSK_SELF can be designated)

TD_RTSK rtsk Packet address for returning the task state

[Return Parameters]

ER ercd Error code

[Error Codes]

E_OK Normal completion

E_ID Bad identifier

E_NOEXS Object does not exist

[Description]

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