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.

5.3. DEVICE MANAGEMENT FUNCTIONS 231<br />

The time required for read 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 read. Normally size must be at least as large as the size of<br />

the attribute data to be read. Reading of multiple attribute data in one operation is not possible.<br />

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

can be read 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 LIMIT<br />

E TMOUT<br />

E ABORT<br />

Other<br />

dd is invalid or not open<br />

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

Number of requests exceeds the limit<br />

Busy processing other requests<br />

Processing aborted<br />

Errors returned by device driver<br />

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

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

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

{<br />

ER er, ioer;<br />

er = tk_rea_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 = ioerr;<br />

}<br />

return er;<br />

}<br />

• ID tk_wri_dev( ID dd, INT start, VP buf, INT size, TMO tmout )<br />

dd<br />

start<br />

buf<br />

size<br />

tmout<br />

return code<br />

Device descriptor<br />

write start location (≥ 0: Device-specific data, < 0: Attribute data)<br />

Buffer holding data to be written<br />

Size of data to be written<br />

Request acceptance timeout (ms)<br />

Request ID or error<br />

Starts writing device-specific data or attribute data to a device. This function starts writing only,<br />

returning to its caller without waiting for the write operation to finish. The space designated<br />

in buf must be retained until the write operation completes. Write completion is waited for by<br />

tk wai dev.<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!