VxWorks Reference Manual : Libraries
elt3c509End - END network interface driver for 3COM 3C509
elt3c509Load( ) - initialize the driver and device
elt3c509Parse( ) - parse the init string
This module implements the 3COM 3C509 EtherLink III Ethernet network interface driver. This driver is designed to be moderately generic. Thus, it operates unmodified across the range of architectures and targets supported by VxWorks. To achieve this, the driver load routine requires an input string consisting of several target-specific values. The driver also requires some external support routines. These target-specific values and the external support routines are described below.
This device is on-board. No jumpering diagram is necessary.
The only external interface is the elt3c509Load( ) routine, which expects the initString parameter as input. This parameter passes in a colon-delimited string of the format:
unit:port:intVector:intLevel:attachementType:nRxFrames
The elt3c509Load( ) 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.
- intVector
- Configures the ELT device to generate hardware interrupts for various events within the device. Thus, it contains an interrupt handler routine. The driver calls intConnect( ) to connect its interrupt handler to the interrupt vector generated as a result of the ELT interrupt.
- intLevel
- This parameter is passed to an external support routine, sysEltIntEnable( ), 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 ELT 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.
- attachmentType
- This parameter is used to select the transceiver hardware attachment. This is then used by the elt3c509BoardInit( ) routine to activate the selected attachment. elt3c509BoardInit( ) is called as a part of the driver's initialization.
- nRxFrames
- This parameter is used as number of receive frames by the driver.
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) SYS_INT_DISABLE(pDrvCtrl) SYS_OUT_BYTE(pDrvCtrl, reg, data) SYS_IN_BYTE(pDrvCtrl, reg, data) SYS_OUT_WORD(pDrvCtrl, reg, data) SYS_IN_WORD(pDrvCtrl, reg, data) SYS_OUT_WORD_STRING(pDrvCtrl, reg, pData, len) SYS_IN_WORD_STRING(pDrvCtrl, reg, pData, len) sysEltIntEnable(pDrvCtrl->intLevel) sysEltIntDisable(pDrvCtrl->intLevel)There are default values in the source code for these macros. They presume IO-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.The macros SYS_INT_CONNECT, SYS_INT_DISCONNECT, and SYS_INT_ENABLE allow the driver to be customized for BSPs that use special versions of these routines.
The macro SYS_INT_CONNECT is used to connect the interrupt handler to the appropriate vector. By default it is the routine intConnect( ).
The macro SYS_INT_DISCONNECT is used to disconnect the interrupt handler prior to unloading the module. By default this is a dummy routine that returns OK.
The macro SYS_INT_ENABLE is used to enable the interrupt level for the end device. It is called once during initialization. It calls an external board level routine sysEltIntEnable( ).
The macro SYS_INT_DISABLE is used to disable the interrupt level for the end device. It is called during stop. It calls an external board level routine sysEltIntDisable( ).
When implemented, this driver requires the following system resources:
- one interrupt vector
- 9720 bytes of text
- 88 bytes in the initialized data section (data)
- 0 bytes of bssThe driver requires 1520 bytes of preallocation for Transmit Buffer and 1520*nRxFrames of receive buffers. The default value of nRxFrames is 64 therefore total pre-allocation is (64 + 1)*1520.
nRxFrames parameter can be used for tuning no of receive frames to be used for handling packet receive. More no. of these could help receiving more loaning in case of massive reception.
end.h endLib.h etherMultiLib.h elt3c509End.h
elt3c509End, muxLib, endLib Writing and Enhanced Network Driver
elt3c509Load( ) - initialize the driver and device
END_OBJ * elt3c509Load ( char * initString /* String to be parsed 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:port:intVector:intLevel:attachementType:noRxFrames
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, "elt") 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.
elt3c509Parse( ) - parse the init string
STATUS elt3c509Parse ( ELT3C509_DEVICE * pDrvCtrl, /* device pointer */ char * initString /* initialization info string */ )
Parse the input string. Fill in values in the driver control structure.
The initialization string format is:
<unit>:<port>:<intVector>:<intLevel>:<attachementType>:<noRxFrames>
- unit
- Device unit number, a small integer.
- port
- base I/O address
- intVector
- Interrupt vector number (used with sysIntConnect)
- intLevel
- Interrupt level
- attachmentType
- type of Ethernet connector
- nRxFrames
- no. of Rx Frames in integer format
OK or ERROR for invalid arguments.