VxWorks API Reference : USB libraries

usbListLib [USB]

NAME

usbListLib [USB] - Linked list utility functions

ROUTINES

usbListLink( ) - Add an element to a linked list
usbListLinkProt( ) - Add an element to a list guarded by a mutex
usbListUnlink( ) - Remove an entry from a linked list
usbListUnlinkProt( ) - Removes an element from a list guarged by a mutex
usbListFirst( ) - Returns first entry on a linked list
usbListNext( ) - Retrieves next pStruct in a linked list

DESCRIPTION

This file inmplements a set of general-purpose linked-list functions which are portable across OS's. Linked lists are a collection of LINK structures. Each LINK structure contains a forward a backward list pointer. Each LINK structure also contains a pStruct field which points (typically) to the caller's structure which contains the LINK structure.

usbListLink( ) and usbListUnlink( ) are used to add and remove LINK structures in a linked list. The LINK field may be placed anywhere in the client's structure, and the client's structure may even contain more than one LINK field - allowing the structure to be linked into multiple lists simultaneously.

usbListFirst( ) retrieves the first structure on a linked list and usbListNext( ) retrieves subsequent structures.


USB libraries : Routines

usbListLink( )

NAME

usbListLink( ) - Add an element to a linked list

SYNOPSIS

VOID usbListLink
    (
    pLIST_HEAD pHead,         /* list head */
    pVOID      pStruct,       /* ptr to base of structure to be linked */
    pLINK      pLink,         /* ptr to LINK structure to be linked */
    UINT16     flag           /* indicates LINK_HEAD or LINK_TAIL */
    )

DESCRIPTION

Using the LINK structure pLink, add pStruct to the list of which the list head is pHead. flag must be LINK_HEAD or LINK_TAIL.

RETURNS

N/A

SEE ALSO

usbListLib


USB libraries : Routines

usbListLinkProt( )

NAME

usbListLinkProt( ) - Add an element to a list guarded by a mutex

SYNOPSIS

VOID usbListLinkProt
    (
    pLIST_HEAD   pHead,       /* list head */
    pVOID        pStruct,     /* ptr to base of structure to be linked */
    pLINK        pLink,       /* ptr to LINK structure to be linked */
    UINT16       flag,        /* indicates LINK_HEAD or LINK_TAIL */
    MUTEX_HANDLE mutex        /* list guard mutex */
    )

DESCRIPTION

This function is similar to linkList( ) with the addition that this function will take the mutex prior to manipulating the list.

NOTE

The function will block forever if the mutex does not become available.

RETURNS

N/A

SEE ALSO

usbListLib


USB libraries : Routines

usbListUnlink( )

NAME

usbListUnlink( ) - Remove an entry from a linked list

SYNOPSIS

VOID usbListUnlink
    (
    pLINK pLink               /* LINK structure to be unlinked */
    )

DESCRIPTION

Removes pLink from a linked list.

RETURNS

N/A

SEE ALSO

usbListLib


USB libraries : Routines

usbListUnlinkProt( )

NAME

usbListUnlinkProt( ) - Removes an element from a list guarged by a mutex

SYNOPSIS

VOID usbListUnlinkProt
    (
    pLINK        pLink,       /* LINK structure to be unlinked */
    MUTEX_HANDLE mutex        /* list guard mutex */
    )

DESCRIPTION

This function is the same as usbListUnlink( ) with the addition that this function will take the mutex prior to manipulating the list.

NOTE

The function will block forever if the mutex does not become available.

RETURNS

N/A

SEE ALSO

usbListLib


USB libraries : Routines

usbListFirst( )

NAME

usbListFirst( ) - Returns first entry on a linked list

SYNOPSIS

pVOID usbListFirst
    (
    pLIST_HEAD pListHead      /* head of linked list */
    )

DESCRIPTION

Returns the pointer to the first structure in a linked list given a pointer to the LIST_HEAD.

RETURNS

pStruct of first structure on list or NULL if list empty.

SEE ALSO

usbListLib


USB libraries : Routines

usbListNext( )

NAME

usbListNext( ) - Retrieves next pStruct in a linked list

SYNOPSIS

pVOID usbListNext
    (
    pLINK pLink               /* LINK structure */
    )

DESCRIPTION

Returns the pointer to the next structure in a linked list given a pLink pointer. The value returned is the pStruct of the element in the linked list which follows the current pLink, not a pointer to the following pLink. (Typically, a client is more interested in walking its own list of structures rather than the LINK structures used to maintain the linked list.

RETURNS

pStruct of next structure in list or NULL if end of list.

SEE ALSO

usbListLib