VxWorks API Reference : USB libraries
usbListLib [USB] - Linked list utility functions
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
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.
usbListLink( ) - Add an element to a linked list
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 */ )
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.
N/A
usbListLinkProt( ) - Add an element to a list guarded by a mutex
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 */ )
This function is similar to linkList( ) with the addition that this function will take the mutex prior to manipulating the list.
The function will block forever if the mutex does not become available.
N/A
usbListUnlink( ) - Remove an entry from a linked list
VOID usbListUnlink ( pLINK pLink /* LINK structure to be unlinked */ )
Removes pLink from a linked list.
N/A
usbListUnlinkProt( ) - Removes an element from a list guarged by a mutex
VOID usbListUnlinkProt ( pLINK pLink, /* LINK structure to be unlinked */ MUTEX_HANDLE mutex /* list guard mutex */ )
This function is the same as usbListUnlink( ) with the addition that this function will take the mutex prior to manipulating the list.
The function will block forever if the mutex does not become available.
N/A
usbListFirst( ) - Returns first entry on a linked list
pVOID usbListFirst ( pLIST_HEAD pListHead /* head of linked list */ )
Returns the pointer to the first structure in a linked list given a pointer to the LIST_HEAD.
pStruct of first structure on list or NULL if list empty.
usbListNext( ) - Retrieves next pStruct in a linked list
pVOID usbListNext ( pLINK pLink /* LINK structure */ )
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.
pStruct of next structure in list or NULL if end of list.