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.

278 CHAPTER 6. T-KERNEL/DS FUNCTIONS<br />

td hoc dsp<br />

Define Task Dispatch Hook Routine<br />

[C Language Interface]<br />

ER ercd = td_hok_dsp ( TD_HDSP *hdsp ) ;<br />

[Parameters]<br />

TD HDSP hdsp Hook routine definition information<br />

hdsp detail:<br />

FP exec Hook routine when execution starts<br />

FP stop Hook routine when execution stops<br />

[Return Parameters]<br />

ER ercd Error code<br />

[Description]<br />

Sets hook routines in the task dispatcher. A hook routine is canceled by setting NULL in hdsp.<br />

The hook routines are called in dispatch disabled state. The hook routines must not invoke T-<strong>Kernel</strong>/OS<br />

system calls (tk_—) or extended SVC. T-<strong>Kernel</strong>/DS service calls (td_—) may be invoked.<br />

void exec( ID tskid, INT lsid )<br />

tskid Task ID of the started or resumed task<br />

lsid Logical ID of the task designated in tskid<br />

This is called when the designated task starts execution or resumes. At the time exec() is called,<br />

the task designated in tskid is already in RUN state and logical space has been switched. However,<br />

execution of the tskid task program code occurs after the return from exec().<br />

void stop( ID tskid, INT lsid, UINT tskstat )<br />

tskid Task ID of the executed or stopped task<br />

lsid Logical ID of the task designated in tskid<br />

tskstat State of the task designated in tskid<br />

This is called when the designated task executes or stops. tskstat indicates the task state after stopping,<br />

as one of the following states.<br />

TTS RDY READY state<br />

TTS WAI WAIT state<br />

TTS SUS SUSPEND state<br />

TTS WAS WAIT-SUSPEND state<br />

TTS DM TDORMANT state<br />

0 NON-EXISTENT state<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!