VxWorks Reference Manual : Libraries
nicEvbEnd - National Semiconductor ST-NIC Chip network interface driver
nicEndLoad( ) - initialize the driver and device
nicEvbInitParse( ) - parse the initialization string
This module implements the National Semiconductor 83902A ST-NIC Ethernet network interface driver.
This driver is non-generic and is for use on the IBM EVB403 board. The driver must be given several target-specific parameters. These parameters, and the mechanisms used to communicate them to the driver, are detailed below.
This device is on-board. No jumpering diagram is necessary.
The only external interface is the nicEvbEndLoad( ) routine, which expects the initString parameter as input. This parameter passes in a colon-delimited string of the format:
unit:nic_addr:int_vector:int_level
The nicEvbEndLoad( ) function uses strtok( ) to parse the string.
- unit
- A convenient holdover from the former model. This parameter is used only in the string name for the driver.
- nic_addr
- Base address for NIC chip
- int_vector
- Configures the NIC device to generate hardware interrupts for various events within the device. Thus, it contains an interrupt handler routine. The driver calls sysIntConnect( ) to connect its interrupt handler to the interrupt vector.
- int_level
- This parameter is passed to an external support routine, sysLanIntEnable( ), which is described below in "External Support Requirements." This routine is called during as part of driver's initialization. It handles any board-specific operations required to allow the servicing of a NIC interrupt on targets that use additional interrupt controller devices to help organize and service the various interrupt sources. This parameter makes it possible for this driver to avoid all board-specific knowledge of such devices.
- device restart/reset delay
- The global variable nicRestartDelay (UINT32), defined in this file, should be initialized in the BSP sysHwInit( ) routine. nicRestartDelay is used only with PowerPC platform and is equal to the number of time base increments which makes for 1.6 msec. This corresponds to the delay necessary to respect when restarting or resetting the device.
This driver requires several external support functions, defined as macros:
SYS_INT_CONNECT(pDrvCtrl, routine, arg) SYS_INT_DISCONNECT (pDrvCtrl, routine, arg) SYS_INT_ENABLE(pDrvCtrl)There are default values in the source code for these macros. They presume memory-mapped accesses to the device registers and the normal intConnect( ), and intEnable( ) BSP functions. The first argument to each is the device controller structure. Thus, each has access back to all the device-specific information. Having the pointer in the macro facilitates the addition of new features to this driver.
When implemented, this driver requires the following system resources:
- one mutual exclusion semaphore
- one interrupt vector
nicEndLoad( ) - initialize the driver and device
END_OBJ* nicEvbEndLoad ( char* initString /* string to be parse by the driver */ )
This routine initializes the driver and the device to the operational state. All of the device-specific parameters are passed in initString, which expects a string of the following format:
unit:base_addr:int_vector:int_level
This routine can be called in two modes. If it is called with an empty but allocated string, it places the name of this device (that is, "ln") into the initString and returns 0.
If the string is allocated and not empty, the routine attempts to load the driver using the values specified in the string.
An END object pointer, or NULL on error, or 0 and the name of the device if the initString was NULL.
nicEvbInitParse( ) - parse the initialization string
STATUS nicEvbInitParse ( NICEVB_END_DEVICE * pDrvCtrl, char * initString )
Parse the input string. Fill in values in the driver control structure. The initialization string format is: unit:base_adrs:vecnum:intLvl
- unit
- Device unit number, a small integer.
- base_adrs
- Base address for NIC device
- vecNum
- Interrupt vector number (used with sysIntConnect( ) ).
- intLvl
- Interrupt level.
OK, or ERROR if any arguments are invalid.