02.03.2014 Views

BSP Developer's Guide

BSP Developer's Guide

BSP Developer's Guide

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

VxWorks 5.5<br />

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

etherInputHook( ) decides to prevent others from seeing the packet,<br />

etherInputHook( ) returns a non-zero value and the driver considers the packet to<br />

be delivered. If the etherInputHook( ) returns 0, the driver hands the packet to the<br />

TCP/IP stack.<br />

On packet transmission, an installed etherOutputHook( ) receives a packet just<br />

before it would have been transmitted. If etherOutputHook( ) decides to prevent<br />

the packet from passing on, etherOutputHook( ) returns a non-zero value and the<br />

driver considers the packet to be transmitted. If the etherOutputHook( ) returns 0,<br />

the driver transmits the packet.<br />

It is only possible to install one etherInputHook( ) and one etherOutputHook( )<br />

function per driver. This limits the number of alternate protocols to one, unless<br />

these ether*Hook( ) routines then act as a multiplexor for more protocols.<br />

For more information on etherhooks, see the Tornado User’s <strong>Guide</strong>, 1.0.1:<br />

G.4 Network Interface Hook Routines.<br />

NOTE: Future versions of VxWorks will not support etherhooks.<br />

G.2 Upgrading to 4.4 BSD<br />

To upgrade a driver from 4.3 BSD to 4.4 BSD you must change how the driver uses<br />

ether_attach( ). This routine is almost always called from the driver’s own<br />

xxattach( ) routine and is responsible for placing the driver’s entry points, listed in<br />

Table G-1, into the ifnet structure that the TCP/IP protocol to track drivers.<br />

Consider the call to ether_attach( ) shown below:<br />

ether_attach(<br />

(IFNET *) & pDrvCtrl->idr,<br />

unit,<br />

"xx",<br />

(FUNCPTR) NULL,<br />

(FUNCPTR) xxIoctl,<br />

(FUNCPTR) xxOutput,<br />

(FUNCPTR) xxReset<br />

);<br />

As arguments, this routine expects an Interface Data Record (IDR), a unit number,<br />

and a quoted string that is the name of the device, in this case, “xx”. The next four<br />

arguments are the function pointers to relevant driver routines.<br />

260

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

Saved successfully!

Ooh no, something went wrong!