td_ref_tsk

Reference Task State

See Also

[C Language Interface]

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

[Parameters]

ID	tskid	Task ID (TSK_SELF can be specified)


TD_RTSK	rtsk	Address of Packet 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	*/
	UW	tskwait;	/* wait factor	*/
	ID	wid;	/* waiting object ID	*/
	INT	wupcnt;	/* queued wakeup request count	*/
	INT	suscnt;	/* SUSPEND request nesting count	*/
	FP	task;	/* task start address	*/
	W	stksz;	/* user stack size (in bytes)	*/
	VP	istack;	/* user stack pointer initial value	*/
} 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

Note that the stack pointer initial value (istack) 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 current value of the stack pointer.

[Difference with T-Kernel]

Maximum continuous execution time (slicetime), disabled waiting factor (waitmask), permitted task exception (texmask), and occurred task event (tskevent) do not exist in td_rtsk. This is because µT-Kernel does not have functions related to timesharing execution, wait disabled, task exception, and task event.

For the same reason, TTS_NODISWAI (non-disabled wait state) does not exist in the values set to tskstat, and the value relating to task event (TTW_EVn) does not exist in the values set to tskwait.

The members (sstksz, isstack) relating to the system stack do not exist. This is because in µT-Kernel, it is assumed that each task has one stack.

[Difference with T-Kernel 1.00.00]

stksz, the member of TD_RTSK, is of W type instead of INT type.

tskwait, the member of TD_RTSK, is of UW type instead of UINT type. In µT-Kernel, 16-bit width is sufficient for this member, but 32-bit width is required in the T-Kernel. Therefore, this member is modified to UW type based on the policy that those fields that require 32-bit width are set to the W/UW types since their bit widths are specifically defined.

Comments

Click here to Post a Comment