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.

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

(4) Device Descriptor (ID type)<br />

A device descriptor (> 0) is an identifier used for accessing a device, assigned by T-<strong>Kernel</strong>/SM when a<br />

device is opened.<br />

A device descriptor belongs to a resource group. Operations using a device descriptor can be performed<br />

only by tasks belonging to the same resource group as the device descriptor. Error code (E OACV) is<br />

returned for requests from tasks belonging to a different resource group.<br />

(5) Request ID (ID type)<br />

When an IO request is made to a device, a request ID (> 0) is assigned identifying the request. This<br />

ID can be used to wait for IO completion.<br />

(6) Data Number (INT type)<br />

Device data is designated by a data number. Data is classified into device-specific data and attribute<br />

data as follows.<br />

Device-specific data: Data number ≥ 0<br />

As device-specific data, the data numbers are defined separately for each device.<br />

Examples<br />

Disk<br />

Serial port<br />

Attribute data: Data number < 0<br />

Data number = physical block number<br />

Data number = 0 only<br />

Attribute data designates driver or device state acquisition and setting modes, and special functions,<br />

etc.<br />

Data numbers common to devices are defined, but device-dependent attribute data can also be<br />

defined. Details are given later.<br />

5.3.2 Application Interface<br />

The functions below are provided as application interface functions, called as extended SVC. These<br />

functions cannot be called from a task-independent portion or while dispatch or interrupts are disabled<br />

(E CTX).<br />

ID tk_opn_dev( UB *devnm, UINT omode )<br />

ER tk_cls_dev( ID dd, UINT option )<br />

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

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

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

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

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

INT tk_sus_dev( UINT mode )<br />

INT tk_get_dev( ID devid, UB *devnm )<br />

ID tk_ref_dev( UB *devnm, T_RDEV *rdev )<br />

ID tk_oref_dev( ID dd, T_RDEV *rdev )<br />

INT tk_lst_dev( T_LDEV *ldev, INT start, INT ndev )<br />

INT tk_evt_dev( ID devid, INT evttyp, VP evtinf )<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!