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.

G<br />

Upgrading 4.3 BSD Network Drivers<br />

! CAUTION: When converting a BSD 4.3 network driver code to an END, you must<br />

replace all calls into the protocol with appropriate calls to the MUX. Also, you must<br />

remove all code that implements or uses the etherInputHook( ) and<br />

etherOutputHook( ) routines.<br />

Rewrite xxattach( ) to Use an endLoad( ) Interface<br />

Rewrite the interface of your xxattach( ) to match the endLoad( ) entry point<br />

described in Loading the Device: endLoad( ), p.290.<br />

Much of the code that handles the specifics of hardware initialization should be the<br />

same. However, when allocating the memory for packet reception buffers that are<br />

passed up to the protocol, you should use the MUX buffer management utilities.<br />

See H.3.1 Setting Up and Using a Memory Pool for Receive and Transmit Buffers, as well<br />

as the reference entry for muxBufInit( ).<br />

Remove any code your xxattach( ) included to support the implementation of the<br />

etherInputHook( ) and etherOutputHook( ) routines.<br />

xxReceive( ) Still Handles Task-Level Packet Reception<br />

Because the MUX does not directly call the driver’s packet reception code, there is<br />

no endReceive( ) entry point. However, your driver still needs to handle packet<br />

reception at the task level. Unfortunately, most of the code in this driver routine<br />

requires extensive revision. Instead of calling the protocol directly, this routine<br />

uses a MUX-supplied function to pass a packet up to the protocol (see<br />

H.3 <strong>Guide</strong>lines for Handling Packet Reception in Your Driver). Also, your receive<br />

routine should use the MUX-managed memory pool as its receive buffer area.<br />

G<br />

Rewrite xxOutput( ) to Use an endSend( ) Interface<br />

Rewrite the interface of your xxOutput( ) to match the endSend( ) routine<br />

described in Sending Data Out on the Device: endSend( ), p.293.<br />

Much of the code that dealt directly with putting the packet on the hardware<br />

should need little if any revision. However, you should change your code to use<br />

mblk chains allocated out of an endBufLib-managed memory pool. For more<br />

information, see the reference entry for netBufLib.<br />

265

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

Saved successfully!

Ooh no, something went wrong!