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.

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

evtmbfid designates the system default message buffer ID for event notification. If there is no<br />

system default event notification message buffer, 0 is set.<br />

Notification like the following is made to each subsystem when a device is registered or deleted.<br />

devid is the device ID of the physical device registered or deleted.<br />

Device registration or update:<br />

Device deletion:<br />

E LIMIT<br />

E NOEXS<br />

tk_evt_ssy(0, TSEVT_DEVICE_REGIST, 0, devid)<br />

tk_evt_ssy(0, TSEVT_DEVICE_DELETE, 0, devid)<br />

Number of registrations exceeds the system limit<br />

The device designated in devnm does not exist (when ddev = NULL)<br />

• ER tk_ref_idv( T_IDEV *idev )<br />

idev<br />

return code<br />

Returns device initialization information<br />

Error<br />

Gets device initialization information.<br />

The contents are the same as the information obtained by tk dev def().<br />

5.3.4 Device Driver Interface<br />

The device driver interface consists of processing functions designated when registering a device. These<br />

functions are called by device management and run as a quasi-task portion. They must be reentrant.<br />

The mutually exclusive calling of these processing functions is not guaranteed. If, for example, there<br />

are simultaneous requests from multiple devices for the same device, different tasks might call the same<br />

processing function at the same time. The device driver must apply mutual exclusion control in such<br />

cases as necessary.<br />

IO requests to a device driver are made by means of the following request packet mapped to a request<br />

ID.<br />

typedef struct t_devreq {<br />

struct t_devreq *next; /* I: Link to request packet (NULL: termination) */<br />

VP exinf; /* X: Extended information */<br />

ID devid; /* I: Target device ID */<br />

INT cmd:4; /* I: Request command */<br />

BOOL abort:1; /* I: TRUE if abort request */<br />

BOOL nolock:1; /* I: TRUE if lock (making resident) not needed */<br />

INT rsv:26; /* I: reserved (always 0) */<br />

T_TSKSPC tskspc; /* I: Task space of requesting task */<br />

INT start; /* I: Starting data number */<br />

INT size; /* I: Request size */<br />

VP buf; /* I: IO buffer address */<br />

INT asize; /* O: Size of result */<br />

ER error; /* O: Error result */<br />

/* Implementation-dependent information may be added beyond this point. */<br />

} T_DEVREQ;<br />

I indicates an input parameter and O an output parameter. Input parameters must not be changed<br />

by the device driver. Parameters other than input parameters (I) are initially cleared to 0 by device<br />

management. After that, device management does not modify them.<br />

next is used to link the request packet. In addition to use for keeping track of request packets in device<br />

management, it is used also by the completion wait function (waitfn) and abort function (abortfn).<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!