02.03.2014 Views

BSP Developer's Guide

BSP Developer's Guide

BSP Developer's Guide

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

H<br />

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

H.2.3 Executing Calls Waiting in the Network Job Queue<br />

The tNetTask task sleeps on an incoming work queue. In response to an incoming<br />

packet, your interrupt service routine calls netJobAdd( ). As parameters to<br />

netJobAdd( ), your interrupt service routine specifies your driver’s entry point for<br />

handling task-level packet reception. The netJobAdd( ) call adds this entry point<br />

to tNetTask’s work queue. The netJobAdd( ) call also automatically gives the<br />

appropriate semaphore for awakening tNetTask.<br />

Upon awakening, tNetTask dequeues function calls and associated arguments<br />

from its work queue. It then executes these functions in its context. The tNetTask<br />

task runs as long as there is work on its queue. When the queue is empty and all<br />

packets have been successfully handed off to the MUX, tNetTask goes back to<br />

sleep on the queue.<br />

H.2.4 Adding Your Network Interface Driver to VxWorks<br />

Adding your driver to the target VxWorks system is much like adding any other<br />

application. The first step is to compile and include the driver code in the VxWorks<br />

image. For a description of the general procedures, see the Tornado User’s <strong>Guide</strong>.It<br />

tells you how to compile source code to produce target-suitable object code.<br />

Including most software modules in the VxWorks image is usually just a matter of<br />

setting a few #define statements. Adding a network interface driver does not<br />

require much more. However, because VxWorks allows you to create more than<br />

one network device, you must also set up a table that groups the #define<br />

statements into device-specific groups. This table is defined in<br />

target/src/config/<strong>BSP</strong>/configNet.h where <strong>BSP</strong> is the name of your Board Support<br />

Package, such as mv162, pc486, and the like.<br />

For example, if you wanted VxWorks to create two network devices, one that<br />

supported buffer loaning and one that did not, you would first edit configNet.h to<br />

include the following statements:<br />

H<br />

/* Parameters for loading the driver supporting buffer loaning. */<br />

#define LOAD_FUNC_0 ln7990EndLoad<br />

#define LOAD_STRING_0 "0xfffffe0:0xffffffe2:0:1:1"<br />

#define <strong>BSP</strong>_0 NULL<br />

/* Parameters for loading the driver NOT supporting buffer loaning. */<br />

#define LOAD_FUNC_1 LOAD_FUNC_0<br />

#define LOAD_STRING_1 "0xffffee0:0xfffffee2:4:1:1"<br />

#define <strong>BSP</strong>_1 NULL<br />

273

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

Saved successfully!

Ooh no, something went wrong!