VxWorks Reference Manual : Libraries

wdbPipePktDrv

NAME

wdbPipePktDrv - pipe packet driver for lightweight UDP/IP

ROUTINES

wdbPipePktDevInit( ) - initialize a pipe packet device.

DESCRIPTION

OVERVIEW

This module is a pipe for drivers interfacing with the WDB agent's lightweight UDP/IP interpreter. It can be used as a starting point when writing new drivers. Such drivers are the lightweight equivalent of a network interface driver.

These drivers, along with the lightweight UDP-IP interpreter, have two benefits over the stand combination of a netif driver + the full VxWorks networking stack; First, they can run in a much smaller amout of target memory because the lightweight UDP-IP interpreter is much smaller than the VxWorks network stack (about 800 bytes total). Second, they provide a communication path which is independant of the OS, and thus can be used to support an external mode (e.g., monitor style) debug agent.

Throughout this file the word "pipe" is used in place of a real driver name. For example, if you were writing a lightweight driver for the lance ethernet chip, you would want to substitute "pipe" with "ln" throughout this file.

PACKET READY CALLBACK

When the driver detects that a packet has arrived (either in its receiver ISR or in its poll input routine), it invokes a callback to pass the data to the debug agent. Right now the callback routine is called "udpRcv", however other callbacks may be added in the future. The driver's wdbPipeDevInit( ) routine should be passed the callback as a parameter and place it in the device data structure. That way the driver will continue to work if new callbacks are added later.

MODES

Ideally the driver should support both polled and interrupt mode, and be capable of switching modes dynamically. However this is not required. When the agent is not running, the driver will be placed in "interrupt mode" so that the agent can be activated as soon as a packet arrives. If your driver does not support an interrupt mode, you can simulate this mode by spawning a VxWorks task to poll the device at periodic intervals and simulate a receiver ISR when a packet arrives.

For dynamically mode switchable drivers, be aware that the driver may be asked to switch modes in the middle of its input ISR. A driver's input ISR will look something like this:

   doSomeStuff();
   pPktDev->wdbDrvIf.stackRcv (pMbuf);   /* invoke the callback */
   doMoreStuff();
If this channel is used as a communication path to an external mode debug agent, then the agent's callback will lock interrupts, switch the device to polled mode, and use the device in polled mode for awhile. Later on the agent will unlock interrupts, switch the device back to interrupt mode, and return to the ISR. In particular, the callback can cause two mode switches, first to polled mode and then back to interrupt mode, before it returns. This may require careful ordering of the callback within the interrupt handler. For example, you may need to acknowledge the interrupt within the doSomeStuff( ) processing rather than the doMoreStuff( ) processing.

USAGE

The driver is typically only called only from usrWdb.c. The only directly callable routine in this module is wdbPipePktDevInit( ). You will need to modify usrWdb.c to allow your driver to be initialized by the debug agent. You will want to modify usrWdb.c to include your driver's header file, which should contain a definition of WDB_PIPE_PKT_MTU. There is a default user-selectable macro called WDB_MTU, which must be no larger than WDB_PIPE_PKT_MTU. Modify the begining of usrWdb.c to insure that this is the case by copying the way it is done for the other drivers. The routine wdbCommIfInit( ) also needs to be modified so that if your driver is selected as the WDB_COMM_TYPE, then your drivers init routine will be called. Search usrWdb.c for the macro "WDB_COMM_CUSTOM" and mimic that style of initialization for your driver.

DATA BUFFERING

The drivers only need to handle one input packet at a time because the WDB protocol only supports one outstanding host-request at a time. If multiple input packets arrive, the driver can simply drop them. The driver then loans the input buffer to the WDB agent, and the agent invokes a driver callback when it is done with the buffer.

For output, the agent will pass the driver a chain of mbufs, which the driver must send as a packet. When it is done with the mbufs, it calls wdbMbufChainFree( ) to free them. The header file wdbMbuflib.h provides the calls for allocating, freeing, and initializing mbufs for use with the lightweight UDP/IP interpreter. It ultimatly makes calls to the routines wdbMbufAlloc and wdbMbufFree, which are provided in source code in usrWdb.c.

SEE ALSO

wdbPipePktDrv


Libraries : Routines

wdbPipePktDevInit( )

NAME

wdbPipePktDevInit( ) - initialize a pipe packet device.

SYNOPSIS

STATUS wdbPipePktDevInit
    (
    WDB_PIPE_PKT_DEV * pPktDev,    /* pipe device structure to init */
    void (*            stackRcv)() /* receive packet callback (udpRcv) */
    )

DESCRIPTION

SEE ALSO

wdbPipePktDrv