02.03.2014 Views

BSP Developer's Guide

BSP Developer's Guide

BSP Developer's Guide

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.

VxWorks 5.5<br />

<strong>BSP</strong> Developer’s <strong>Guide</strong><br />

Providing an Opaque Control Interface to Your Driver: endIoctl( )<br />

Your endIoctl( ) entry point should handle all requests for changes to the state of<br />

the device, such as bringing it up, shutting it down, turning on promiscuous mode,<br />

and so on. You can also use your endIoctl( ) is to provide access to MIB-II interface<br />

statistics.<br />

! WARNING: If you are porting a driver from the BSD 4.3 model, you might be<br />

tempted to use the existing xxIoctl( ) entry point as your endIoctl( ) entry point,<br />

skipping the creation of separate entry points for the MCastAddr entry points. Do<br />

not do this! Your driver must implement all entry points shown in Table H-1.<br />

Your endIoctl( ) must take the following form:<br />

STATUS endIoctl<br />

(<br />

void* pCookie, /* pointer to device-identifying END_OBJ */<br />

int cmd, /* value identifying command */<br />

caddr_t data /* data needed to complete command */<br />

)<br />

This function should return OK or ERROR. If an error occurs, it should set errno.<br />

The parameters are:<br />

pCookie<br />

Passes a pointer to the END_OBJ structure returned by endLoad( ).<br />

cmd<br />

Can pass any of the values shown in the first column of Table H-2. Your<br />

endIoctl( ) must have an appropriate response to each.<br />

data<br />

Passes the data or a pointer to the data that your endIoctl( ) needs to carry out<br />

the command specified in cmd.<br />

Table H-2<br />

Ioctl Commands and Data Types<br />

Command Function Data Type<br />

EIOCSFLAGS Set device flags. int; see description of<br />

END_OBJ.flags (flags, p.284)<br />

EIOCGFLAGS Get device flags. int<br />

EIOCSADDR Set device address. char*<br />

EIOCGADDR Get device address. char*<br />

292

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

Saved successfully!

Ooh no, something went wrong!