usbListLib.h
上传用户:luoyougen
上传日期:2008-05-12
资源大小:23136k
文件大小:2k
源码类别:

VxWorks

开发平台:

C/C++

  1. /* usbListLib.h - Linked list utility functions */
  2. /* Copyright 2000 Wind River Systems, Inc. */
  3. /*
  4. Modification history
  5. --------------------
  6. 01a,10jun99,rcb  First.
  7. */
  8. /*
  9. DESCRIPTION
  10. This file defines a set of general-purpose linked-list functions which are
  11. portable across OS's.
  12. */
  13. #ifndef __INCusbListLibh
  14. #define __INCusbListLibh
  15. #ifdef __cplusplus
  16. extern "C" {
  17. #endif
  18. /* includes */
  19. #include "usb/ossLib.h"
  20. /* defines */
  21. /* Arguments passed to the usbListLink/usbListLinkProt utility function. */
  22. #define LINK_HEAD   0
  23. #define LINK_TAIL   1
  24. /* Arguments passed to the usbListFind utility function. */
  25. #define LINK_TEST   0
  26. #define LINK_REMOVE 1
  27. /* typedefs */
  28. /*
  29.  * LINK
  30.  * 
  31.  * Linked-list management structure. 
  32.  *
  33.  * NOTE: Code relies on the fact that LINK.linkFwd and LIST_HEAD.pLink are 
  34.  * both the first fields in their respective structures.
  35.  */
  36. typedef struct link 
  37.     {
  38.     struct link *linkFwd; /* Link to next entry */
  39.     struct link *linkBack; /* Link to previous entry */
  40.     pVOID pStruct; /* Points to base of structure being linked */
  41.     } LINK, *pLINK;
  42. /*
  43.  * LIST_HEAD
  44.  *
  45.  * Defines the head of a linked list.
  46.  */
  47. typedef struct list_head
  48.     {
  49.     pLINK pLink; /* Pointer to first entry on list */
  50.     } LIST_HEAD, *pLIST_HEAD;
  51.     
  52. /* Function prototypes. */
  53. VOID usbListLink 
  54.     (
  55.     pLIST_HEAD pHead, /* list head */
  56.     pVOID pStruct, /* ptr to base of structure to be linked */
  57.     pLINK pLink, /* ptr to LINK structure to be linked */
  58.     UINT16 flag  /* indicates LINK_HEAD or LINK_TAIL */
  59.     );
  60. VOID usbListLinkProt 
  61.     (
  62.     pLIST_HEAD pHead, /* list head */
  63.     pVOID pStruct, /* ptr to base of structure to be linked */
  64.     pLINK pLink, /* ptr to LINK structure to be linked */
  65.     UINT16 flag, /* indicates LINK_HEAD or LINK_TAIL */
  66.     MUTEX_HANDLE mutex /* list guard mutex */
  67.     );
  68.     
  69. VOID usbListUnlink 
  70.     (
  71.     pLINK pLink  /* LINK structure to be unlinked */
  72.     );
  73. VOID usbListUnlinkProt
  74.     (
  75.     pLINK pLink, /* LINK structure to be unlinked */
  76.     MUTEX_HANDLE mutex /* list guard mutex */
  77.     );
  78. pVOID usbListFirst
  79.     (
  80.     pLIST_HEAD pListHead /* head of linked list */
  81.     );
  82. pVOID usbListNext
  83.     (
  84.     pLINK pLink  /* LINK structure */
  85.     );
  86. #ifdef __cplusplus
  87. }
  88. #endif
  89. #endif /* __INCusbListLibh */
  90. /* End of file. */