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.

4.2. TASK-DEPENDENT SYNCHRONIZATION FUNCTIONS 67<br />

#define TTW_EV4 0x00080000 /* Wait for task event #4 */<br />

#define TTW_EV5 0x00100000 /* Wait for task event #5 */<br />

#define TTW_EV6 0x00200000 /* Wait for task event #6 */<br />

#define TTW_EV7 0x00400000 /* Wait for task event #7 */<br />

#define TTW_EV8 0x00800000 /* Wait for task event #8 */<br />

#define TTX_SVC 0x80000000 /* Extended SVC disabled */<br />

TTX SVC is a special designation disabling not task wait but the calling of an extended SVC. If TTX SVC<br />

is designated when a task attempts to call an extended SVC, E DISWAI is returned without calling the<br />

extended SVC. This designation does not have the effect of terminating an already called extended SVC.<br />

A tskwait value of 0 means the task has not entered WAIT state (or the wait was released). If tskwait<br />

is not 0, this means the task is in WAIT state for a cause other than those disabled in waitmask.<br />

When a task wait is cleared by tk dis wai or the task is prevented from entering WAIT state while this<br />

system call is in effect, E DISWAI is returned. When a system call for which there is the possibility of<br />

entering a WAIT state is invoked during wait disabled state, E DISWAI is returned even if the processing<br />

could be performed without waiting.<br />

For example, even if message buffer space is available when tk snd mbf is called and message buffer<br />

sending is possible without entering a WAIT state, E DISWAI is returned and the message is not sent.<br />

A wait disable set while an extended SVC is executing will be cleared automatically upon return from<br />

the extended SVC to its caller. It is automatically cleared also when an extended SVC is called, reverting<br />

to the original setting upon return from the extended SVC. A wait disable setting is cleared also when<br />

the task reverts to DORMANT state. The setting made while a task is in DORMANT state, however,<br />

is valid and the wait disable is applied the next time the task is started.<br />

In the case of semaphores and most other objects, TA NODISWAI can be designated when the object is<br />

created. An object created with TA NODISWAI designated cannot have waits disabled, and rejects any<br />

wait disable attempt by tk dis wai.<br />

The invoking task can be designated by setting tskid = TSK SELF = 0. Note, however, that when a<br />

system call is issued from a task-independent portion and tskid = TSK SELF = 0 is designated, error<br />

code E ID is returned.<br />

[Additional Notes]<br />

The wait disable function is provided for preventing execution of an extended SVC handler and is for<br />

use mainly (though not exclusively) in break functions.<br />

Wait disable in the case of a rendezvous is more complex than other cases. Essentially, wait disabled<br />

state is detected based on a change in the rendezvous wait state, then the wait is released. Some specific<br />

examples are given here.<br />

When waiting by TTW CAL is not disabled but TTW RDV waits are disabled, a task enters into wait on<br />

rendezvous call state; but when the rendezvous is accepted and a wait for rendezvous completion would<br />

normally begin, the wait is released and E DISWAI is returned. At this time a message is sent to the<br />

receiving task, the receiving task declares acceptance of the message and the task goes to rendezvous<br />

established state. Only when the accepting task replies (tk rpl rdv) does it become clear that there<br />

is no other task in the rendezvous, and error code E OBJ is returned. Wait disable applies also when a<br />

rendezvous is forwarded. In that case the attribute of the destination rendezvous port applies. That is,<br />

if the TA NODISWAI attribute is designated for the destination port, wait disable is rejected. If TTW CAL<br />

wait is disabled after going to wait for rendezvous completion state, and a rendezvous is forwarded in<br />

that state, the state goes to WAIT on rendezvous call as a result of the forwarding, so wait is disabled<br />

by the TTW CAL designation. In that case E DISWAI is returned to both the rendezvous calling task<br />

(tk cal por) and forwarding task (tk fwd por).<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!