VxWorks Reference Manual : Libraries
ne2000End - NE2000 END network interface driver
ne2000EndLoad( ) - initialize the driver and device
ne2000Parse( ) - parse the init string
This module implements the NE2000 Ethernet network interface driver.
The only external interface is the ne2000EndLoad( ) routine, which expects the initString parameter as input. This parameter passes in a colon-delimited string of the format:
unit:adrs:vecNum:intLvl:byteAccess:usePromEnetAddr:offset
The ne2000EndLoad( ) 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.
- adrs
- Tells the driver where to find the ne2000.
- vecNum
- Configures the ne2000 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 generated as a result of the ne2000 interrupt.
- intLvl
- 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 ne2000 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.
- byteAccess
- Tells the driver the NE2000 is jumpered to operate in 8-bit mode. Requires that SYS_IN_WORD_STRING( ) and SYS_OUT_WORD_STRING( ) be written to properly access the device in this mode.
- usePromEnetAddr
- Attempt to get the ethernet address for the device from the on-chip (board) PROM attached to the NE2000. Will fall back to using the BSP-supplied ethernet address if this parameter is 0 or if unable to read the ethernet address.
- offset
- Specifies the memory alignment offset.
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_IN_CHAR(pDrvCtrl, reg, pData) SYS_OUT_CHAR(pDrvCtrl, reg, pData) SYS_IN_WORD_STRING(pDrvCtrl, reg, pData) SYS_OUT_WORD_STRING(pDrvCtrl, reg, pData)These macros 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. By default this is the routine sysLanIntEnable( ), defined in the module sysLib.o.
The macro SYS_ENET_ADDR_GET is used to get the ethernet address (MAC) for the device. The single argument to this routine is the END_DEVICE pointer. By default this routine copies the ethernet address stored in the global variable ne2000EndEnetAddr into the END_DEVICE structure.
The macros SYS_IN_CHAR, SYS_OUT_CHAR, SYS_IN_WORD_STRING and SYS_OUT_WORD_STRING are used for accessing the ne2000 device. The default macros map these operations onto sysInByte( ), sysOutByte( ), sysInWordString( ) and sysOutWordString( ).
end.h endLib.h etherMultiLib.h
ne2000End, muxLib, endLib Writing and Enhanced Network Driver
ne2000EndLoad( ) - initialize the driver and device
END_OBJ* ne2000EndLoad ( char* initString, /* String to be parsed by the driver. */ void* pBSP /* for BSP group */ )
This routine initializes the driver and the device to the operational state. All of the device specific parameters are passed in the initString.
The string contains the target specific parameters like this:
"unit:register addr:int vector:int level:shmem addr:shmem size:shmem width"
An END object pointer or NULL on error.
ne2000Parse( ) - parse the init string
STATUS ne2000Parse ( NE2000END_DEVICE * pDrvCtrl, char * initString )
Parse the input string. Fill in values in the driver control structure.
The initialization string format is:
"unit:adrs:vecnum:intLvl:byteAccess:usePromEnetAddr:offset"
- unit
- Device unit number, a small integer.
- adrs
- Base address
- vecNum
- Interrupt vector number (used with sysIntConnect)
- intLvl
- Interrupt level (used with sysLanIntEnable)
- byteAccess
- Use 8-bit access mode.
- usePromEnetAddr
- get ethernet address from PROM.
- offset
- offset for memory alignment
OK or ERROR for invalid arguments.