26.02.2014 Views

Getting Started with QNX Neutrino - QNX Software Systems

Getting Started with QNX Neutrino - QNX Software Systems

Getting Started with QNX Neutrino - QNX Software Systems

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

© 2009, <strong>QNX</strong> <strong>Software</strong> <strong>Systems</strong> GmbH & Co. KG. Alphabetical listing of connect and I/O functions<br />

io_devctl()<br />

int io_devctl (resmgr_context_t *ctp, io_devctl_t *msg,<br />

RESMGR_OCB_T *ocb)<br />

Classification: I/O<br />

Default handler: iofunc_devctl_default()<br />

Helper functions: iofunc_devctl()<br />

Client functions: devctl(), ioctl()<br />

Messages: _IO_DEVCTL<br />

Data structure:<br />

struct _io_devctl {<br />

uint16_t type;<br />

uint16_t combine_len;<br />

int32_t dcmd;<br />

int32_t nbytes;<br />

int32_t zero;<br />

};<br />

struct _io_devctl_reply {<br />

uint32_t zero;<br />

int32_t ret_val;<br />

int32_t nbytes;<br />

int32_t zero2;<br />

};<br />

typedef union {<br />

struct _io_devctl i;<br />

struct _io_devctl_reply o;<br />

} io_devctl_t;<br />

Description: Performs the device I/O operation as passed from the client’s devctl() in<br />

dcmd. The client encodes a direction into the top two bits of dcmd, indicating how the<br />

devctl() is to transfer data (the “to” field refers to the _POSIX_DEVDIR_TO bit; the<br />

“from” field refers to the _POSIX_DEVDIR_FROM bit):<br />

to field from field Meaning<br />

0 0 No data transfer<br />

0 1 Transfer from driver to client<br />

1 0 Transfer from client to driver<br />

1 1 Transfer bidirectionally<br />

In the case of no data transfer, the driver is expected to simply perform the command<br />

given in dcmd. In the case of a data transfer, the driver is expected to transfer the data<br />

from and/or to the client, using the helper functions resmgr_msgreadv() and<br />

resmgr_msgwritev(). The client indicates the size of the transfer in the nbytes<br />

April 30, 2009 Chapter 5 • Resource Managers 233

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!