IxOsalBufferMgtDefault.h 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /**
  2. * @file IxOsalBufferMgtDefault.h
  3. *
  4. * @brief Default buffer pool management and buffer management
  5. * definitions.
  6. *
  7. * Design Notes:
  8. *
  9. * @par
  10. * IXP400 SW Release version 2.0
  11. *
  12. * -- Copyright Notice --
  13. *
  14. * @par
  15. * Copyright 2001-2005, Intel Corporation.
  16. * All rights reserved.
  17. *
  18. * @par
  19. * Redistribution and use in source and binary forms, with or without
  20. * modification, are permitted provided that the following conditions
  21. * are met:
  22. * 1. Redistributions of source code must retain the above copyright
  23. * notice, this list of conditions and the following disclaimer.
  24. * 2. Redistributions in binary form must reproduce the above copyright
  25. * notice, this list of conditions and the following disclaimer in the
  26. * documentation and/or other materials provided with the distribution.
  27. * 3. Neither the name of the Intel Corporation nor the names of its contributors
  28. * may be used to endorse or promote products derived from this software
  29. * without specific prior written permission.
  30. *
  31. * @par
  32. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
  33. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  34. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  35. * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
  36. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  37. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  38. * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  39. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  40. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  41. * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  42. * SUCH DAMAGE.
  43. *
  44. * @par
  45. * -- End of Copyright Notice --
  46. */
  47. #ifndef IX_OSAL_BUFFER_MGT_DEFAULT_H
  48. #define IX_OSAL_BUFFER_MGT_DEFAULT_H
  49. /**
  50. * @enum IxMbufPoolAllocationType
  51. * @brief Used to indicate how the pool memory was allocated
  52. */
  53. typedef enum
  54. {
  55. IX_OSAL_MBUF_POOL_TYPE_SYS_ALLOC = 0, /**< mbuf pool allocated by the system */
  56. IX_OSAL_MBUF_POOL_TYPE_USER_ALLOC /**< mbuf pool allocated by the user */
  57. } IxOsalMbufPoolAllocationType;
  58. /**
  59. * @brief Implementation of buffer pool structure for use with non-VxWorks OS
  60. */
  61. typedef struct
  62. {
  63. IX_OSAL_MBUF *nextFreeBuf; /**< Pointer to the next free mbuf */
  64. void *mbufMemPtr; /**< Pointer to the mbuf memory area */
  65. void *dataMemPtr; /**< Pointer to the data memory area */
  66. int bufDataSize; /**< The size of the data portion of each mbuf */
  67. int totalBufsInPool; /**< Total number of mbufs in the pool */
  68. int freeBufsInPool; /**< Number of free mbufs currently in the pool */
  69. int mbufMemSize; /**< The size of the pool mbuf memory area */
  70. int dataMemSize; /**< The size of the pool data memory area */
  71. char name[IX_OSAL_MBUF_POOL_NAME_LEN + 1]; /**< Descriptive name for pool */
  72. IxOsalMbufPoolAllocationType poolAllocType;
  73. unsigned int poolIdx; /**< Pool Index */
  74. } IxOsalMbufPool;
  75. typedef IxOsalMbufPool IX_OSAL_MBUF_POOL;
  76. PUBLIC IX_STATUS ixOsalBuffPoolUninit (IX_OSAL_MBUF_POOL * pool);
  77. #endif /* IX_OSAL_BUFFER_MGT_DEFAULT_H */