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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

90 CHAPTER 4. T-KERNEL/OS FUNCTIONS<br />

tk set flg<br />

tk clr flg<br />

Set Event Flag<br />

Clear Event Flag<br />

[C Language Interface]<br />

ER ercd = tk_set_flg ( ID flgid, UINT setptn ) ;<br />

ER ercd = tk_clr_flg ( ID flgid, UINT clrptn ) ;<br />

[Parameters]<br />

For tk set flg<br />

ID flgid Event flag ID<br />

UINT setptn Bit pattern to be set<br />

For tk clr flg<br />

ID flgid Event flag ID<br />

UINT clrptn Bit pattern to be cleared<br />

[Return Parameters]<br />

ER ercd Error code<br />

[Error Codes]<br />

E OK<br />

E ID<br />

E NOEXS<br />

Normal completion<br />

Invalid ID number (flgid is invalid or cannot be used)<br />

Object does not exist (the event flag designated in flgid does not exist)<br />

[Description]<br />

tk set flg sets the bits indicated in setptn in a one-word event flag designated in flgid. That is,<br />

a logical sum is taken of the values of the event flag designated in flgid and the values indicated in<br />

setptn. tk clr flg clears the bits of the one-word event flag based on the corresponding zero bits of<br />

clrptn. That is, a logical product is taken of the values of the event flag designated in flgid and the<br />

values indicated in clrptn.<br />

After event flag values are changed by tk set flg, if the condition for releasing the wait state of a<br />

task that called tk wai flg is met, the WAIT state of that task is cleared, putting it in RUN state or<br />

READY state (or SUSPEND state if the waiting task was in WAIT-SUSPEND state).<br />

Issuing tk clr flg never results in wait conditions being released for a task waiting for the designated<br />

event flag; that is, dispatching never occurs with tk clr flg.<br />

Nothing will happen to the event flag if all bits of setptn are cleared to 0 with tk set flg or if all bits<br />

of clrptn are set to 1 with tk clr flg. No error will result in either case.<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!