VxWorks Reference Manual : Libraries

smNetLib

NAME

smNetLib - VxWorks interface to the shared memory network (backplane) driver

ROUTINES

smNetInit( ) - initialize the shared memory network driver
smNetAttach( ) - attach the shared memory network interface
smNetInetGet( ) - get an address associated with a shared memory network interface

DESCRIPTION

This library implements the VxWorks-specific portions of the shared memory network interface driver. It provides the interface between VxWorks and the network driver modules (e.g., how the OS initializes and attaches the driver, interrupt handling, etc.), as well as VxWorks-dependent system calls.

There are three user-callable routines: smNetInit( ), smNetAttach( ), and smNetInetGet( ).

The backplane master initializes the backplane shared memory and network structures by first calling smNetInit( ). Once the backplane has been initialized, all processors can be attached to the shared memory network via the smNetAttach( ) routine. Both smNetInit( ) and smNetAttach( ) are called automatically in usrConfig.c when backplane parameters are specified in the boot line.

The smNetInetGet( ) routine gets the Internet address associated with a backplane interface.

INCLUDE FILES

smPktLib.h, smUtilLib.h

SEE ALSO

smNetLib, ifLib, if_sm, VxWorks Programmer's Guide: Network


Libraries : Routines

smNetInit( )

NAME

smNetInit( ) - initialize the shared memory network driver

SYNOPSIS

STATUS smNetInit
    (
    SM_ANCHOR * pAnchor,     /* local addr of anchor */
    char *      pMem,        /* local addr of shared memory */
    int         memSize,     /* size of shared memory */
    BOOL        tasType,     /* TRUE = hardware supports TAS */
    int         cpuMax,      /* max numbers of cpus */
    int         maxPktBytes, /* size of data packets */
    u_long      startAddr    /* beginning address */
    )

DESCRIPTION

This routine is called once by the backplane master. It sets up and initializes the shared memory region of the shared memory network and starts the shared memory heartbeat.

The pAnchor parameter is the local memory address by which the master CPU accesses the shared memory anchor. pMem contains either the local address of shared memory or the value NONE (-1), which implies that shared memory is to be allocated dynamically. memSize is the size, in bytes, of the shared memory region.

The tasType parameter specifies the test-and-set operation to be used to obtain exclusive access to the shared data structures. It is preferable to use a genuine test-and-set instruction, if the hardware permits it. In this case, tasType should be SM_TAS_HARD. If any of the CPUs on the backplane network do not support the test-and-set instruction, tasType should be SM_TAS_SOFT.

The maxCpus parameter specifies the maximum number of CPUs that may use the shared memory region.

The maxPktBytes parameter specifies the size, in bytes, of the data buffer in shared memory packets. This is the largest amount of data that may be sent in a single packet. If this value is not an exact multiple of 4 bytes, it will be rounded up to the next multiple of 4.

The startAddr parameter is only applicable if sequential addressing is desired. If startAddr is non-zero, it specifies the starting address to use for sequential addressing on the backplane. If startAddr is zero, sequential addressing is disabled.

RETURNS

OK, or ERROR if the shared memory network cannot be initialized.

SEE ALSO

smNetLib


Libraries : Routines

smNetAttach( )

NAME

smNetAttach( ) - attach the shared memory network interface

SYNOPSIS

STATUS smNetAttach
    (
    int         unit,         /* interface unit number */
    SM_ANCHOR * pAnchor,      /* addr of anchor */
    int         maxInputPkts, /* max queued packets */
    int         intType,      /* interrupt method */
    int         intArg1,      /* interrupt argument #1 */
    int         intArg2,      /* interrupt argument #2 */
    int         intArg3       /* interrupt argument #3 */
    )

DESCRIPTION

This routine attaches the shared memory interface to the network. It is called once by each CPU on the shared memory network. The unit parameter specifies the backplane unit number.

The pAnchor parameter is the local address by which the local CPU may access the shared memory anchor.

The maxInputPkts parameter specifies the maximum number of incoming shared memory packets which may be queued to this CPU at one time.

The intType, intArg1, intArg2, and intArg3 parameters allow a CPU to announce the method by which it is to be notified of input packets which have been queued to it.

RETURNS

OK, or ERROR if the shared memory interface cannot be attached.

SEE ALSO

smNetLib


Libraries : Routines

smNetInetGet( )

NAME

smNetInetGet( ) - get an address associated with a shared memory network interface

SYNOPSIS

STATUS smNetInetGet
    (
    char * smName, /* device name */
    char * smInet, /* return inet */
    int    cpuNum  /* cpu number */
    )

DESCRIPTION

This routine returns the Internet address in smInet for the CPU specified by cpuNum on the shared memory network specified by smName. If cpuNum is NONE (-1), this routine returns information about the local (calling) CPU.

This routine can only be called after a call to smNetAttach( ). It will block if the shared memory region has not yet been initialized.

This routine is only applicable if sequential addressing is being used over the backplane.

RETURNS

OK, or ERROR if the Internet address cannot be found.

SEE ALSO

smNetLib