User`s guide
VxWorks
BSP Developer’s Guide, 6.0
100
parameter to the devEndLoad( ) routine is a character pointer. In order for each
Ethernet device to be controlled by a given driver, the devEndLoad( ) routine is
called twice. The first time, it is called with a pointer to a zero-length string. At this
time, the driver is required to copy its own device name into the string. The
network stack then fills in the unit number and initialization string from a table
provided by the BSP and calls the devEndLoad( ) routine again. This time, the
driver initializes the device and prepares itself for operation.
For this process to work, the BSP must provide a table called endDevTbl[ ]
containing the end load strings. This table is usually defined in configNet.h and is
generally organized in one of two ways.
The simplest organization is that the table is initialized at compile time to contain
the initialization strings for the supported devices. This is the most
straightforward organization because it is a simple list of devices that are available.
Also, because the BSP puts the driver’s devEndLoad( ) routine into the appropriate
field of endDevTbl[ ], no additional code is required. The drawback to this method
is that the system may print a warning message if any of the supported devices are
not actually present when the system boots. Also, configuration of the
initialization string must be done statically at compile time using a constant string,
rather than being configurable with descriptive macros.
A better organization is for endDevTbl[ ] to be allocated for several entries with
the values for each entry being filled as each device is discovered at boot time.
During the discovery phase of system initialization, the individual fields of the
initialization string are filled in according to the value of descriptive configuration
options, and then the driver’s devEndLoad( ) routine is called. For this method to
work, the BSP must provide a wrapper function for the driver’s load routine. A list
of sample routines is as follows:
sysDec21x40EndLoad( ) creates a load string and loads a dec21x40 (dc) device
sysEl3c90xEndLoad( ) loads an instance of the el3c90xEnd driver
sysEndLoad( ) creates a load string and loads the END devices
sysFei82557EndLoad( ) loads a fei82557 (fei) device
sysLn97xEndLoad( ) creates a load string and loads a ln97x (lnPci) device
sysMotCpmEndLoad( ) loads an instance of the motCpmEnd driver
sysMotFecEndLoad( ) loads an instance of the motFecEnd driver