VxWorks Reference Manual : Libraries

if_sn

NAME

if_sn - National Semiconductor DP83932B SONIC Ethernet network driver

ROUTINES

snattach( ) - publish the sn network interface and initialize the driver and device

DESCRIPTION

This module implements the National Semiconductor DP83932 SONIC Ethernet network interface driver.

This driver is designed to be moderately generic, operating unmodified across the range of architectures and targets supported by VxWorks. To achieve this, the driver must be given several target-specific parameters, and some external support routines must be provided. These parameters, and the mechanisms used to communicate them to the driver, are detailed below. If any of the assumptions stated below are not true for your particular hardware, this driver will probably not function correctly with it. This driver supports up to four individual units per CPU.

BOARD LAYOUT

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

EXTERNAL INTERFACE

This driver provides the standard external interface with the following exceptions. All initialization is performed within the attach routine; there is no separate initialization routine. Therefore, in the global interface structure, the function pointer to the initialization routine is NULL.

There is one user-callable routine, snattach( ); for details, see the manual entry for this routine.

TARGET-SPECIFIC PARAMETERS

device I/O address
This parameter is passed to the driver by snattach( ). It specifies the base address of the device's I/O register set.

interrupt vector
This parameter is passed to the driver by snattach( ). It specifies the interrupt vector to be used by the driver to service an interrupt from the SONIC device. The driver will connect the interrupt handler to this vector by calling intConnect( ).

Ethernet address
This parameter is obtained by calling an external support routine. It specifies the unique, six-byte address assigned to the VxWorks target on the Ethernet.

EXTERNAL SUPPORT REQUIREMENTS

This driver requires five external support functions:

void sysEnetInit (int unit)
This routine performs any target-specific operations that must be executed before the SONIC device is initialized. The driver calls this routine, once per unit, from snattach( ).

STATUS sysEnetAddrGet (int unit, char *pCopy)
This routine provides the six-byte Ethernet address used by unit. It must copy the six-byte address to the space provided by pCopy. This routine returns OK, or ERROR if it fails. The driver calls this routine, once per unit, from snattach( ).

void sysEnetIntEnable (int unit), void sysEnetIntDisable (int unit)
These routines enable or disable the interrupt from the SONIC device for the specified unit. Typically, this involves interrupt controller hardware, either internal or external to the CPU. The driver calls these routines only during initialization, from snattach( ).

void sysEnetIntAck (int unit)
This routine performs any interrupt acknowledgement or clearing that may be required. This typically involves an operation to some interrupt control hardware. The driver calls this routine from the interrupt handler.

DEVICE CONFIGURATION

Two global variables, snDcr and snDcr2, are used to set the SONIC device configuration registers. By default, the device is programmed in 32-bit mode with zero wait states. If these values are not suitable, the snDcr and snDcr2 variables should be modified before calling snattach( ). See the SONIC manual to change these parameters.

SYSTEM RESOURCE USAGE

When implemented, this driver requires the following system resources:

    - one interrupt vector
    - 0 bytes in the initialized data section (data)
    - 696 bytes in the uninitialized data section (BSS)

The above data and BSS requirements are for the MC68020 architecture and may vary for other architectures. Code size (text) varies greatly between architectures and is therefore not quoted here.

This driver uses cacheDmaMalloc( ) to allocate the memory to be shared with the SONIC device. The size requested is 117,188 bytes.

The SONIC device can only be operated if the shared memory region is write-coherent with the data cache. The driver cannot maintain cache coherency for the device for data that is written by the driver because fields within the shared structures are asynchronously modified by the driver and the device, and these fields may share the same cache line.

NOTE 1

The previous transmit descriptor does not exist until the transmitter has been asked to send at least one packet. Unfortunately the test for this condition must be done every time a new descriptor is to be added, even though the condition is only true the first time. However, it is a valuable test, since we should not use the fragment count field as an index if it is 0.

NOTE 2

There are some things unsupported in this version:

    a) buffer loaning on receive
    b) output hooks
    c) trailer protocol
    d) promiscuous mode

Also, the receive setup needs work so that the number of RRA descriptors is not fixed at four. It would be a nice addition to allow all the sizes of the shared memory structures to be specified by the runtime functions that call our init routines.

SEE ALSO

if_sn, ifLib


Libraries : Routines

snattach( )

NAME

snattach( ) - publish the sn network interface and initialize the driver and device

SYNOPSIS

STATUS snattach
    (
    int    unit,     /* unit number */
    char * pDevRegs, /* addr of device's regs */
    int    ivec      /* vector number */
    )

DESCRIPTION

This routine publishes the sn interface by filling in a network interface record and adding this record to the system list. It also initializes the driver and the device to the operational state.

RETURNS

OK or ERROR.

SEE ALSO

if_sn