PageRenderTime 43ms CodeModel.GetById 17ms RepoModel.GetById 1ms app.codeStats 0ms

/drivers/net/wireless/tiwlan1251/common/src/TNETW_Driver/TNETWIF/Inc/TNETWArb_buffer.h

http://github.com/CyanogenMod/cm-kernel
C Header | 150 lines | 43 code | 38 blank | 69 comment | 1 complexity | b7ed1c70790ba4346708ec51ef948217 MD5 | raw file
Possible License(s): AGPL-1.0, GPL-2.0, LGPL-2.0
  1. /****************************************************************************
  2. **+-----------------------------------------------------------------------+**
  3. **| |**
  4. **| Copyright(c) 1998 - 2008 Texas Instruments. All rights reserved. |**
  5. **| All rights reserved. |**
  6. **| |**
  7. **| Redistribution and use in source and binary forms, with or without |**
  8. **| modification, are permitted provided that the following conditions |**
  9. **| are met: |**
  10. **| |**
  11. **| * Redistributions of source code must retain the above copyright |**
  12. **| notice, this list of conditions and the following disclaimer. |**
  13. **| * Redistributions in binary form must reproduce the above copyright |**
  14. **| notice, this list of conditions and the following disclaimer in |**
  15. **| the documentation and/or other materials provided with the |**
  16. **| distribution. |**
  17. **| * Neither the name Texas Instruments nor the names of its |**
  18. **| contributors may be used to endorse or promote products derived |**
  19. **| from this software without specific prior written permission. |**
  20. **| |**
  21. **| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |**
  22. **| "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |**
  23. **| LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |**
  24. **| A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |**
  25. **| OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |**
  26. **| SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |**
  27. **| LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |**
  28. **| DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |**
  29. **| THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |**
  30. **| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |**
  31. **| OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |**
  32. **| |**
  33. **+-----------------------------------------------------------------------+**
  34. ****************************************************************************/
  35. #ifndef TNETWARB_H
  36. #define TNETWARB_H
  37. #include "osTIType.h"
  38. /*----------------------------------------------------------------------*/
  39. /* GKI Definitions */
  40. /*----------------------------------------------------------------------*/
  41. /* Define the total number of buffer pools supported, fixed and dynamic.
  42. */
  43. #define NUM_TNETWARB_TOTAL_BUF_POOLS 3
  44. /* Set this flag to non zero if you want to do buffer ownership checks.
  45. ** Note that to do these checks, you should have all tasks that free
  46. ** buffers as GKI tasks.
  47. */
  48. #define TNETWARB_ENABLE_OWNER_CHECK 0
  49. /* Set this flag to non zero if you want to do buffer corruption checks.
  50. ** If set, GKI will check buffer tail corruption every time it processes
  51. ** a buffer. This is very useful for debug, and is minimal overhead in
  52. ** a running system.
  53. */
  54. #define TNETWARB_ENABLE_BUF_CORRUPTION_CHECK 0
  55. /* Set this flag to non zero if you want to do pool id checks.
  56. ** If set, GKI will check if pool id exceeds the number of pools.
  57. ** This is useful for debug, but not for release version.
  58. */
  59. #define TNETWARB_ENABLE_POOL_ID_CHECK 0
  60. /***********************************************************************
  61. ** This queue is a general purpose buffer queue, for application use.
  62. *************************************************************************/
  63. typedef struct
  64. {
  65. void *p_first;
  66. void *p_last;
  67. UINT16 count;
  68. } BUFFER_Q;
  69. #define TNETWARB_IS_QUEUE_EMPTY(p_q) (p_q.count == 0)
  70. /* Define the value that create pool will return if it fails
  71. */
  72. #define TNETWARB_INVALID_POOL 0xFF
  73. /********************************************************************/
  74. /** Buffer Management Data Structures **/
  75. /********************************************************************/
  76. typedef struct _buffer_hdr
  77. {
  78. struct _buffer_hdr *p_next;
  79. UINT8 q_id;
  80. UINT8 status;
  81. } BUFFER_HDR_T;
  82. /* Buffer related defines
  83. */
  84. #define BUFFER_HDR_SIZE (sizeof(BUFFER_HDR_T))
  85. #define MAGIC_NO 0xAA55AA55
  86. #define BUF_STATUS_UNLINKED 0
  87. #define BUF_STATUS_FREE 1
  88. #define BUF_STATUS_QUEUED 2
  89. /***********************************************************************
  90. ** Function prototypes
  91. */
  92. #ifdef __cplusplus
  93. extern "C" {
  94. #endif
  95. /* To get and release buffers, change owner and get size
  96. */
  97. void TNETWArb_buffer_init(UINT8 *pTNETWArb_Client_Array);
  98. void *TNETWArb_getpoolbuf (TI_HANDLE hTNETWArb,UINT8 module_id);
  99. void TNETWArb_freebuf(void *bptr);
  100. /* User buffer queue management
  101. */
  102. void TNETWArb_init_q (BUFFER_Q *p_q);
  103. void TNETWArb_Enqueue (BUFFER_Q *p_q, void *p_buf);
  104. void TNETWArb_Enqueue_head (BUFFER_Q *p_q, void *p_buf);
  105. void *TNETWArb_Dequeue (BUFFER_Q *p_q);
  106. void *TNETWArb_remove_from_queue (BUFFER_Q *p_q, void *p_buf);
  107. void *TNETWArb_getfirst (BUFFER_Q *p_q);
  108. void *TNETWArb_getnext (void *p_buf);
  109. #ifdef __cplusplus
  110. }
  111. #endif /* of __cplusplus */
  112. #endif /* of GKI_H */