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

you need to know the context in which the entry point executes. Thus, you need to<br />

know the following:<br />

■<br />

■<br />

■<br />

The task that makes the calls that actually load and start your driver.<br />

The task that typically registers the interrupt handler for your driver.<br />

The task that uses your driver to do most of the processing on a packet.<br />

H.2.1 Launching Your Driver<br />

At system startup, VxWorks spawns the task tUsrRoot to handle the following:<br />

■<br />

■<br />

■<br />

■<br />

Initializing the network task’s job queue.<br />

Spawning tNetTask to process items on the network task’s job queue.<br />

Calling muxDevLoad( ) to load your network driver.<br />

Calling muxDevStart( ) to start your driver.<br />

Loading Your Driver into the MUX<br />

To load your network driver, tUsrRoot calls muxDevLoad( ). As input to the call,<br />

tUsrRoot specifies your driver’s endLoad( ) entry point. Internally, the<br />

muxDevLoad( ) call executes the specified endLoad( ) entry point. This<br />

endLoad( ) entry point is analogous to the xxattach( ) entry point, the only public<br />

entry point into the 4.3 BSD style drivers.<br />

The endLoad( ) routine handles any device-specific initialization and returns an<br />

END_OBJ structure. Your endLoad( ) must populate most of this structure (see,<br />

Providing Network Device Abstraction: END_OBJ, p.283). This includes providing a<br />

pointer to a NET_FUNCS structure populated with function pointers to your<br />

driver’s entry points for handling sends, receives, and so on.<br />

After control returns from endLoad( ) to muxDevLoad( ), the MUX completes the<br />

END_OBJ structure (by giving it a pointer to a function your driver can use to pass<br />

packets up to the MUX). The MUX then adds the returned END_OBJ to a linked list<br />

of END_OBJ structures. This list maintains the state of all the currently active<br />

network devices on the system. After control returns from muxDevLoad( ), your<br />

driver is loaded and ready to use.<br />

H<br />

Registering Your Driver’s Interrupt Routine<br />

To register your driver’s interrupt handler, you must call sysIntConnect( ). The<br />

most typical place to make this call is in your driver’s endStart( ) entry point.<br />

271

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

Saved successfully!

Ooh no, something went wrong!