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.

H<br />

Implementing a MUX-Based Network Interface Driver<br />

H.3 <strong>Guide</strong>lines for Handling Packet Reception in Your Driver<br />

The list of END entry points (see Table H-1) makes no mention of an endReceive( )<br />

entry point. That is because an END does not require one. Of course, your driver<br />

must include code that handles packet reception, but the MUX never calls this code<br />

directly. Thus, the specifics of the code for packet reception are left to you.<br />

However, even if the MUX API does not require an endReceive( ) entry point, you<br />

need to consider the VxWorks system when designing your driver’s packet<br />

reception code. For example, your network interface driver must include an entry<br />

point that acts as your device’s interrupt service routine. In addition, your driver<br />

also needs a different entry point for completing packet reception at the task level.<br />

Internally, your task-level packet-reception entry point should do whatever is<br />

necessary to prepare the packet for handing off to the MUX, such as assuring data<br />

coherency. Likewise, this entry point might use a level of indirection in order to<br />

check for and avoid race conditions before it attempts to do any processing on the<br />

received data. 3 When all is ready, your driver should pass the packet up to the<br />

MUX. To do this, it calls the function referenced in the receiveRtn member of the<br />

END_OBJ structure (see Providing Network Device Abstraction: END_OBJ, p.283).<br />

Although your driver’s endLoad( ) entry point allocated this END_OBJ structure<br />

and set the values of most of its members, it did not and could not set the value of<br />

the receiveRtn member. The MUX does this for you upon completion of the<br />

muxDevLoad( ) call that loaded your driver. However, there is a very brief interval<br />

between the time the driver becomes active and the completion of muxDevLoad( ).<br />

During that time, receiveRtn might not be set. Thus, it is a good practice always to<br />

check receiveRtn for NULL before you try to execute the function referenced there.<br />

H<br />

Removing Etherhook Code in Ported Drivers<br />

The BSD 4.3 model for a VxWorks network interface drivers support a set of input<br />

and output hooks that you can use to intercept packets as they pass between the<br />

driver and protocol. These input and output hooks are referred to as the etherhooks.<br />

When porting a driver to the END model, you must remove the code (if any) that<br />

implements etherhooks. ENDs have no need of etherhooks. That functionality is<br />

built into the MUX. For more information, see the discussion of etherhooks in the<br />

Tornado User’s <strong>Guide</strong>, 1.0.1.<br />

3. See the sample driver in target/src/drv/end/ln7990End.c.<br />

275

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

Saved successfully!

Ooh no, something went wrong!