VxWorks Reference Manual : Libraries

ei82596End

NAME

ei82596End - END style Intel 82596 Ethernet network interface driver

ROUTINES

ei82596EndLoad( ) - initialize the driver and device

DESCRIPTION

This module implements an Intel 82596 Ethernet network interface driver. This driver is designed to be moderately generic. It operates unmodified across the range of architectures and targets supported by VxWorks. To achieve this, this driver requires some external support routines as well as several target-specific parameters. These parameters (and the mechanisms used to communicate them to the driver) are detailed below.

This driver can run with the device configured in either big-endian or little-endian modes. Error recovery code has been added to deal with some of the known errata in the A0 version of the device. This driver supports up to four individual units per CPU.

BOARD LAYOUT

This device is on-board. No jumpering diagram is necessary.

EXTERNAL INTERFACE

The driver provides one standard external interface, ei82596EndLoad( ). As input, this routine takes a string of colon-separated parameters. The parameters should be specified in hexadecimal (optionally preceded by "0x" or a minus sign "-"). The parameter string is parsed using strtok_r( ), and each parameter is converted from string to binary by a call to:

    strtoul(parameter, NULL, 16).

TARGET-SPECIFIC PARAMETERS

The format of the parameter string is:

    unit:ivec:sysbus:memBase:nTfds:nRfds:offset

unit
A convenient holdover from the former model. It is only used in the string name for the driver.

ivec
This is the interrupt vector number of the hardware interrupt generated by this ethernet device. The driver uses intConnect( ) to attach an interrupt handler to this interrupt.

sysbus
This parameter tells the device about the system bus. To determine the correct value for a target, see Intel 32-bit Local Area Network (LAN) Component User's Manual.

memBase
This parameter specifies the base address of a DMA-able cache-free pre-allocated memory region for use as a memory pool for transmit/receive descriptors, buffers, and other device control structures. If there is no pre-allocated memory available for the driver, this parameter should be -1 (NONE). In which case, the driver calls cacheDmaAlloc( ) to allocate cache-safe memory.

nTfds
This parameter specifies the number of transmit descriptor/buffers to be allocated. If this parameter is zero or -1 (NULL), a default of 32 is used.

nRfds
This parameter specifies the number of receive descriptor/buffers to be allocated. If this parameter is zero or -1 (NULL), a default of 32 is used.

offset
Specifies the memory alignment offset.

EXTERNAL SUPPORT REQUIREMENTS

This driver requires seven external support functions:

sys596IntEnable( )
    void sys596IntEnable (int unit)
This routine provides a target-specific interface to enable Ethernet device interrupts for a given device unit.

sys596IntDisable( )
    void sys596IntDisable (int unit)
This routine provides a target-specific interface to disable Ethernet device interrupts for a given device unit.

sysEnetAddrGet( )
    STATUS sysEnetAddrGet (int unit, char *enetAdrs)
This routine provides a target-specific interface to access a device Ethernet address. This routine should provide a six-byte Ethernet address in the enetAdrs parameter and return OK or ERROR.

sys596Init( )
    STATUS sys596Init (int unit)
This routine performs any target-specific initialization required before the 82596 is initialized. Typically, it is empty. This routine must return OK or ERROR.

sys596Port( )
    void sys596Port (int unit, int cmd, UINT32 addr)
This routine provides access to the special port function of the 82596. It delivers the command and address arguments to the port of the specified unit. The driver calls this routine primarily during initialization and, under some conditions, during error recovery procedures.

sys596ChanAtn( )
    void sys596ChanAtn (int unit)
This routine provides the channel attention signal to the 82596 for the specified unit. The driver calls this routine frequently throughout all phases of operation.

sys596IntAck( )
void sys596IntAck (int unit)
This routine must perform any required interrupt acknowledgment or clearing. Typically, this involves an operation to some interrupt control hardware. Note that the INT signal from the 82596 behaves in an "edge-triggered" mode. Therefore, this routine typically clears a latch within the control circuitry. The driver calls this routine from the interrupt handler.

SYSTEM RESOURCE USAGE

The driver uses cacheDmaMalloc( ) to allocate memory to share with the 82596. The fixed-size pieces in this area total 160 bytes. The variable-size pieces in this area are affected by the configuration parameters specified in the eiattach( ) call. The size of one RFD (Receive Frame Descriptor) is 1536 bytes. The size of one TFD (Transmit Frame Descriptor) is 1534 bytes. For more on RFDs and TFDs, see the Intel 82596 User's Manual.

The 82596 requires ether that this shared memory region is non-cacheable or that the hardware implements bus snooping. The driver cannot maintain cache coherency for the device. This is because fields within the command structures are asynchronously modified by both the driver and the device, and these fields might share the same cache line.

TUNING HINTS

The only adjustable parameters are the number of TFDs and RFDs that are created at run-time. These parameters are given to the driver when eiattach( ) is called. There is one TFD and one RFD associated with each transmitted frame and each received frame respectively. For memory-limited applications, decreasing the number of TFDs and RFDs might be a good idea. Increasing the number of TFDs provides no performance benefit after a certain point. Increasing the number of RFDs provides more buffering before packets are dropped. This can be useful if there are tasks running at a higher priority than the net task.

SEE ALSO

ei82596End, ifLib, Intel 82596 User's Manual, Intel 32-bit Local Area Network (LAN) Component User's Manual


Libraries : Routines

ei82596EndLoad( )

NAME

ei82596EndLoad( ) - initialize the driver and device

SYNOPSIS

END_OBJ *ei82596EndLoad
    (
    char * initString /* parameter string */
    )

DESCRIPTION

This routine initializes both driver and device to an operational state using the device-specific values specified by initString. The initString parameter expects an ordered list of colon-separated values.

The format of the initString is:

    unit:ivec:sysbus:memBase:nTfds:nRfds

unit
Specifies the unit number for this device.

ivec
This is the interrupt vector number of the hardware interrupt generated by this Ethernet device. The driver uses intConnect( ) to attach an interrupt handler for this interrupt.

sysbus
Passes in values as described in the Intel manual for the 82596. A default number of transmit/receive frames of 32 can be selected by passing zero in the parameters nTfds and nRfds. In other cases, the number of frames selected should be greater than two.

memBase
Informs the driver about the shared memory region. The 82596 shares a region of memory with the driver. The caller of this routine can specify the address of this memory region, or can specify that the driver must obtain this memory region from the system resources. If this parameter is set to the constant "NONE", this routine tries to allocate the shared memory from the system. Any other value for this parameter is interpreted by this routine as the address of the shared memory region to be used.

If the caller provides the shared memory region, the driver assumes that this region does not require cache-coherency operations, nor does it require conversions between virtual and physical addresses. If the caller indicates that this routine must allocate the shared memory region, this routine uses cacheDmaMalloc( ) to obtain some non-cacheable memory. The attributes of this memory are checked, and, if the memory is not both read- and write-coherent, this routine aborts.

RETURNS

An END object pointer or NULL.

SEE ALSO

ei82596End, ifLib, Intel 82596 User's Manual