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 243<br />

abortfn starts abort processing only, returning promptly without waiting for the abort to complete.<br />

abortfn is called in the following cases.<br />

– When a break function is executing after a task exception and the task that raised the<br />

exception requests abort processing, abortfn is used to abort the request being processed by<br />

that task.<br />

– When a device is being closed by tk cls dev and by subsystem cleanup processing, and<br />

a device descriptor was processing a request, abortfn is used to abort the request being<br />

processed by that device descriptor.<br />

• Event Handling Function: INT eventfn( INT evttyp, VP evtinf, VP exinf )<br />

evttyp<br />

evtinf<br />

exinf<br />

return code<br />

Driver request event type<br />

Information for each event type<br />

Extended information set at device registration<br />

Return code defined for each event type or error<br />

The following driver request event types are defined. Those with positive values are called by<br />

tk evt dev, and those with negative values are called inside device management.<br />

#define TDV_SUSPEND (-1) /* suspend */<br />

#define TDV_RESUME (-2) /* resume */<br />

#define TDV_CARDEVT 1 /* PC Card event (see Card Manager */<br />

#define TDV_USBEVT 2 /* USB event (see USB Manager) */<br />

p<br />

The processing performed by an event function is defined for each event type. Suspend and resume<br />

processing are discussed later below.<br />

When a device event is called by tk evt dev, the eventfn return code is set transparently as the<br />

tk evt dev return code.<br />

Requests to event functions must be accepted even if another request is processing and must be<br />

processed as quickly as possible.<br />

5.3.5 Attribute Data<br />

Attribute data is classified broadly into the following three kinds of data.<br />

• Common attributes<br />

Attributes defined in common for all devices (device drivers).<br />

• Device kind attributes<br />

Attributes defined in common for devices (device drivers) of the same kind.<br />

• Device-specific attributes<br />

Attributes defined independently for each device (device driver).<br />

For the device kind attributes and device-specific attributes, see the specifications for each device. Only<br />

the common attributes are defined here.<br />

Common attributes are assigned attribute data numbers in the range from −1 to −99. While common<br />

attribute data numbers are the same for all devices, not all devices necessarily support all common<br />

attributes. If an unsupported data number is designated, error code E PAR is returned.<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!