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.

232 CHAPTER 5. T-KERNEL/SM<br />

The time required for write start processing differs with the device; return of control is not necessarily<br />

immediate.<br />

In the case of device-specific data, the start and size units are decided for each device. With<br />

attribute data, start is an attribute data number and size is in bytes. The attribute data of the<br />

data number designated in start is written. Normally size must be at least as large as the size<br />

of the attribute data to be written. Multiple attribute data cannot be written in one operation.<br />

When size = 0 is designated, actual writing does not take place but the current size of data that<br />

can be written is checked.<br />

Whether or not a new request can be accepted while a read or write operation is in progress<br />

depends on the device driver. If a new request cannot be accepted, the request is queued. The<br />

timeout for request waiting is set in tmout. The TMO POL or TMO FEVR attribute can be designated<br />

for tmout. Note that what times out is request acceptance. Once a request has been accepted,<br />

this function does not time out.<br />

E ID<br />

E OACV<br />

E RONLY<br />

E LIMIT<br />

E TMOUT<br />

E ABORT<br />

Other<br />

dd is invalid or not open<br />

Open mode is invalid (write not permitted)<br />

Read-only device<br />

Number of requests exceeds the limit<br />

Busy processing other requests<br />

Processing aborted<br />

Errors returned by device driver<br />

• ER tk_swri_dev( ID dd, INT start, VP buf, INT size, INT *asize )<br />

Synchronous write. This is equivalent to the following.<br />

ER tk_swri_dev( ID dd, INT start, VP buf, INT size, INT *asize )<br />

{<br />

ER er, ioer;<br />

er = tk_wri_dev(dd, start, buf, size, TMO_FEVR);<br />

if ( er > 0 ) {<br />

er = tk_wai_dev(dd, er, asize, &ioer, TMO_FEVR);<br />

if ( er > 0 ) er = ioer;<br />

}<br />

return er;<br />

}<br />

• ID tk_wai_dev( ID dd, ID reqid, INT *asize, ER *ioer, TMO tmout )<br />

dd<br />

reqid<br />

asize<br />

ioer<br />

tmout<br />

return code<br />

Device descriptor<br />

Request ID<br />

Returns the read/write data size<br />

Returns IO error<br />

Timeout (ms)<br />

Completed request ID or error<br />

Waits for completion of request reqid for device dd.<br />

If reqid = 0 is set, this function waits for completion of any pending request to dd.<br />

This function waits for completion only of requests currently processing when the function is called.<br />

A request issued after tk wai dev was called is not waited for.<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!