tk_wri_dev

Write Device

See Also

[C Language Interface]




ID reqid = tk_wri_dev ( ID dd, W start, VP buf, W size, TMO tmout ) ;

[Parameters]

ID	dd	Device descriptor


W	start	Write start location (( 0: Device-specific data, < 0: Attribute data)


VP	buf	Buffer holding data to be written


W	size	Size of data to be written


TMO	tmout	Request acceptance timeout (ms)

[Return Parameters]

ID	reqid	Request ID


	or	Error code

[Error Codes]

E_ID	dd is invalid or not open


E_OACV	Open mode is invalid (write not permitted)


E_RONLY	Read-only device


E_LIMIT	Number of requests exceeds the limit


E_TMOUT	Busy processing other requests


E_ABORT	Processing aborted


Other	Errors returned by device driver

[Description]

Starts writing device-specific data or attribute data to a device. This function only starts the writing, returning to its caller without waiting for the write operation to finish. The space specified in buf must be retained until the write operation completes. Write completion is waited for by tk_wai_dev.

The time required for processing the start of the write operation differs with the device; return of control is not necessarily immediate.

In the case of device-specific data, the start and size units are specified for each device. With attribute data, start is an attribute data number and size is in bytes. The attribute data of the data number specified in start is written. Normally size must be at least as large as the size of the attribute data to be written. Multiple attribute data cannot be written in one operation.

When size = 0 is specified, actual writing does not take place but the current size of data that can be written is checked.

Whether or not a new request can be accepted while a read or write operation is in progress depends on the device driver. If a new request cannot be accepted, the request is queued. The timeout for request waiting is set in tmout. The TMO_POL or TMO_FEVR attribute can be specified for tmout. Note that what times out is request acceptance. Once a request has been accepted, this function does not time out.

[Difference with T-Kernel 1.00.00]

The type of start and size is W instead of INT.

However, since these items are implementation-dependent, implementation for start and size may be in the INT data type. These arguments are target system-dependent. For example, upper bits may always be unused if the implementation in W type is specified for a 16-bit CPU. Only in such cases, implementation in INT type instead of W type is allowed for the purpose of speeding the execution and making the program smaller.

Comments

Click here to Post a Comment