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.5.1 Required Structures for a Driver<br />

Within your driver, you must allocate and initialize an END_OBJ. Your driver also<br />

needs to allocate and initialize the structures referenced in END_OBJ structures,<br />

such as DEV_OBJ, NET_FUNCS, and M2_INTERFACETBL. To pass packets up to the<br />

MUX, use an mBlk structure.<br />

Providing Network Device Abstraction: END_OBJ<br />

Your endLoad( ) entry point must allocate, initialize, and return an END_OBJ<br />

structure. The MUX uses this END_OBJ structure as a place to store the tools it<br />

needs to manipulate the stack and the device driver. These tools include data as<br />

well as pointers to functions. The END_OBJ structure is defined in end.h as follows:<br />

typedef struct end_object<br />

{<br />

NODE node; /* root of the device hierarchy */<br />

DEV_OBJ devObject; /* accesses your device’s ctrl struct */<br />

FUNCPTR receiveRtn; /* routine to call on reception */<br />

BOOL attached; /* indicates unit is attached */<br />

SEM_ID txSem; /* transmitter semaphore */<br />

long flags; /* various flags */<br />

struct net_funcs *pFuncTable; /* function table */<br />

M2_INTERFACETBL mib2Tbl; /* MIBII counters */<br />

struct ETHER_MULTI *pAddrList; /* head of the multicast address list */<br />

int nMulti; /* number of elements in the list */<br />

LIST protocols; /* protocol node list */<br />

BOOL snarfProto; /* is someone snarfing us? */<br />

void* pMemPool; /* memory cookie used by MUX bufr mgr. */<br />

M2_ID* pMib2Tbl; /* RFC 2233 MIB objects */<br />

} END_OBJ;<br />

H<br />

Your driver must set and manage some of these members. Other members are<br />

MUX-managed. To know which are which, read the following member<br />

descriptions:<br />

node<br />

The root of the device hierarchy. The MUX sets the value of this member. Your<br />

driver should treat it as opaque.<br />

devObject<br />

The DEV_OBJ structure for this device. Your driver must set this value at load<br />

time. See Tracking Your Device’s Control Structure: DEV_OBJ, p.285.<br />

receiveRtn<br />

A function pointer that references a muxReceive( ) function. The MUX<br />

supplies this pointer by the completion of the muxDevLoad( ) call that loads<br />

283

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

Saved successfully!

Ooh no, something went wrong!