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 />

Forming an Address into a Packet for Transmission: endAddressForm( )<br />

The endAddressForm( ) routine must take a source address and a destination<br />

address and copy the information into the data portion of the mBlk structure in a<br />

fashion appropriate to the link level. Implementing this functionality is the<br />

responsibility of the driver writer, although some common cases are provided for<br />

in endLib. After adding the addresses to mBlk, your endAddressForm( ) routine<br />

should adjust the mBlk.mBlkHdr.mLen and mBlk.mBlkHdr.mData members<br />

accordingly. This routine must take the following form:<br />

M_BLK_ID endAddressForm<br />

(<br />

M_BLK_ID pMblk, /* packet data */<br />

M_BLK_ID pSrcAddress, /* source address */<br />

M_BLK_ID pDstAddress /* destination address */<br />

)<br />

This function returns an M_BLK_ID, which is potentially the head of a chain of<br />

mBlk structures.<br />

If the cluster referenced by pMblk does not have enough room to contain both the<br />

header and the packet data, this routine must reserve an additional<br />

mBlk/clBlk/cluster construct to contain the header. This routine must then chain<br />

the mBlk in pMblk onto the just-reserved header mBlk and returns a pointer to the<br />

header mBlk as the function value.<br />

The parameters are:<br />

pMblk<br />

The mBlk that contains the packet to be transmitted.<br />

pSrcAddress<br />

The mBlk that contains the link-level address of the source.<br />

pDstAddress<br />

The mBlk that contains the link-level address of the destination.<br />

H<br />

Getting a Data-Only mBlk: endPacketDataGet( )<br />

This routine must provide a duplicate mBlk that contains packet data in the<br />

original but skips the header information. Some common cases are provided for in<br />

endLib. This routine should return OK or ERROR and set errno if an error occurs.<br />

299

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

Saved successfully!

Ooh no, something went wrong!