⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ixosalbuffermgt.h

📁 AMCC POWERPC 44X系列的U-BOOT文件
💻 H
📖 第 1 页 / 共 2 页
字号:
 * * @def IX_OSAL_MBUF_ALLOCATED_BUFF_LEN(m_blk_ptr) * * @brief Return the allocated buffer size */#define IX_OSAL_MBUF_ALLOCATED_BUFF_LEN(m_blk_ptr)  \        (m_blk_ptr)->ix_ctrl.ix_allocated_len/** * @ingroup IxOsalBufferMgt * * @def IX_OSAL_MBUF_ALLOCATED_BUFF_DATA(m_blk_ptr) * * @brief Return the allocated buffer pointer */#define IX_OSAL_MBUF_ALLOCATED_BUFF_DATA(m_blk_ptr)  \        (m_blk_ptr)->ix_ctrl.ix_allocated_data/* Name length */#define IX_OSAL_MBUF_POOL_NAME_LEN  64/**************************************************** * Macros for buffer pool management ****************************************************//** * @ingroup IxOsalBufferMgt * * @def IX_OSAL_MBUF_POOL_FREE_COUNT(m_pool_ptr * * @brief Return the total number of freed buffers left in the pool. */#define IX_OSAL_MBUF_POOL_FREE_COUNT(m_pool_ptr) \                    ixOsalBuffPoolFreeCountGet(m_pool_ptr)/** * @ingroup IxOsalBufferMgt * * @def IX_OSAL_MBUF_POOL_SIZE_ALIGN * * @brief This macro takes an integer as an argument and * rounds it up to be a multiple of the memory cache-line  * size. * * @param int [in] size - the size integer to be rounded up * * @return int - the size, rounded up to a multiple of *               the cache-line size */#define IX_OSAL_MBUF_POOL_SIZE_ALIGN(size)                 \    ((((size) + (IX_OSAL_CACHE_LINE_SIZE - 1)) /      \        IX_OSAL_CACHE_LINE_SIZE) *                  \            IX_OSAL_CACHE_LINE_SIZE)/* Don't use this directly, use macro */PUBLIC UINT32 ixOsalBuffPoolMbufAreaSizeGet (int count);/** * @ingroup IxOsalBufferMgt * * @def IX_OSAL_MBUF_POOL_MBUF_AREA_SIZE_ALIGNED * * @brief This macro calculates, from the number of mbufs required, the  * size of the memory area required to contain the mbuf headers for the * buffers in the pool.  The size to be used for each mbuf header is  * rounded up to a multiple of the cache-line size, to ensure * each mbuf header aligns on a cache-line boundary. * This macro is used by IX_OSAL_MBUF_POOL_MBUF_AREA_ALLOC() * * @param int [in] count - the number of buffers the pool will contain * * @return int - the total size required for the pool mbuf area (aligned) */#define IX_OSAL_MBUF_POOL_MBUF_AREA_SIZE_ALIGNED(count) \        ixOsalBuffPoolMbufAreaSizeGet(count)/* Don't use this directly, use macro */PUBLIC UINT32 ixOsalBuffPoolDataAreaSizeGet (int count, int size);/** * @ingroup IxOsalBufferMgt * * @def IX_OSAL_MBUF_POOL_DATA_AREA_SIZE_ALIGNED * * @brief This macro calculates, from the number of mbufs required and the * size of the data portion for each mbuf, the size of the data memory area * required. The size is adjusted to ensure alignment on cache line boundaries. * This macro is used by IX_OSAL_MBUF_POOL_DATA_AREA_ALLOC() * * * @param int [in] count - The number of mbufs in the pool. * @param int [in] size  - The desired size for each mbuf data portion. *                         This size will be rounded up to a multiple of the *                         cache-line size to ensure alignment on cache-line *                         boundaries for each data block. * * @return int - the total size required for the pool data area (aligned) */#define IX_OSAL_MBUF_POOL_DATA_AREA_SIZE_ALIGNED(count, size) \        ixOsalBuffPoolDataAreaSizeGet((count), (size))/** * @ingroup IxOsalBufferMgt * * @def IX_OSAL_MBUF_POOL_MBUF_AREA_ALLOC * * @brief Allocates the memory area needed for the number of mbuf headers * specified by <i>count</i>. * This macro ensures the mbuf headers align on cache line boundaries. * This macro evaluates to a pointer to the memory allocated. * * @param int [in] count - the number of mbufs the pool will contain * @param int [out] memAreaSize - the total amount of memory allocated * * @return void * - a pointer to the allocated memory area */#define IX_OSAL_MBUF_POOL_MBUF_AREA_ALLOC(count, memAreaSize) \    IX_OSAL_CACHE_DMA_MALLOC((memAreaSize =                 \        IX_OSAL_MBUF_POOL_MBUF_AREA_SIZE_ALIGNED(count)))/** * @ingroup IxOsalBufferMgt * * @def IX_OSAL_MBUF_POOL_DATA_AREA_ALLOC * * @brief Allocates the memory pool for the data portion of the pool mbufs. * The number of mbufs is specified by <i>count</i>.  The size of the data * portion of each mbuf is specified by <i>size</i>. * This macro ensures the mbufs are aligned on cache line boundaries * This macro evaluates to a pointer to the memory allocated. * * @param int [in] count - the number of mbufs the pool will contain * @param int [in] size - the desired size (in bytes) required for the data *                        portion of each mbuf.  Note that this size may be *                        rounded up to ensure alignment on cache-line *                        boundaries. * @param int [out] memAreaSize - the total amount of memory allocated * * @return void * - a pointer to the allocated memory area */#define IX_OSAL_MBUF_POOL_DATA_AREA_ALLOC(count, size, memAreaSize) \    IX_OSAL_CACHE_DMA_MALLOC((memAreaSize =                     \        IX_OSAL_MBUF_POOL_DATA_AREA_SIZE_ALIGNED(count,size)))/** * @ingroup IxOsalBufferMgt * * @def IX_OSAL_MBUF_POOL_INIT * * @brief Wrapper macro for ixOsalPoolInit()  * See function description below for details. */#define IX_OSAL_MBUF_POOL_INIT(count, size, name) \    ixOsalPoolInit((count), (size), (name))/** * @ingroup IxOsalBufferMgt * * @def IX_OSAL_MBUF_NO_ALLOC_POOL_INIT * * @return Pointer to the new pool or NULL if the initialization failed. * * @brief Wrapper macro for ixOsalNoAllocPoolInit()  * See function description below for details. *  */#define IX_OSAL_MBUF_NO_ALLOC_POOL_INIT(bufPtr, dataPtr, count, size, name) \    ixOsalNoAllocPoolInit( (bufPtr), (dataPtr), (count), (size), (name))/** * @ingroup IxOsalBufferMgt * * @def IX_OSAL_MBUF_POOL_GET * * @brief Wrapper macro for ixOsalMbufAlloc()  * See function description below for details. */#define IX_OSAL_MBUF_POOL_GET(poolPtr) \        ixOsalMbufAlloc(poolPtr)/** * @ingroup IxOsalBufferMgt * * @def IX_OSAL_MBUF_POOL_PUT * * @brief Wrapper macro for ixOsalMbufFree()  * See function description below for details. */#define IX_OSAL_MBUF_POOL_PUT(bufPtr) \    ixOsalMbufFree(bufPtr)/** * @ingroup IxOsalBufferMgt * * @def IX_OSAL_MBUF_POOL_PUT_CHAIN * * @brief Wrapper macro for ixOsalMbufChainFree()  * See function description below for details. */#define IX_OSAL_MBUF_POOL_PUT_CHAIN(bufPtr) \    ixOsalMbufChainFree(bufPtr)/** * @ingroup IxOsalBufferMgt * * @def IX_OSAL_MBUF_POOL_SHOW * * @brief Wrapper macro for ixOsalMbufPoolShow()  * See function description below for details. */#define IX_OSAL_MBUF_POOL_SHOW(poolPtr) \    ixOsalMbufPoolShow(poolPtr)/** * @ingroup IxOsalBufferMgt * * @def IX_OSAL_MBUF_POOL_MDATA_RESET * * @brief Wrapper macro for ixOsalMbufDataPtrReset()  * See function description below for details. */#define IX_OSAL_MBUF_POOL_MDATA_RESET(bufPtr) \    ixOsalMbufDataPtrReset(bufPtr)/** * @ingroup IxOsalBufferMgt * * @def IX_OSAL_MBUF_POOL_UNINIT * * @brief Wrapper macro for ixOsalBuffPoolUninit()  * See function description below for details. */#define IX_OSAL_MBUF_POOL_UNINIT(m_pool_ptr)  \        ixOsalBuffPoolUninit(m_pool_ptr)/*  * Include OS-specific bufferMgt definitions  */#include "IxOsalOsBufferMgt.h"/** * @ingroup IxOsalBufferMgt * * @def IX_OSAL_CONVERT_OSBUF_TO_IXPBUF( osBufPtr, ixpBufPtr) * * @brief Convert pre-allocated os-specific buffer format to OSAL IXP_BUF (IX_OSAL_MBUF) format.  * It is users' responsibility to provide pre-allocated and valid buffer pointers. * @param osBufPtr (in) - a pre-allocated os-specific buffer pointer. * @param ixpBufPtr (in)- a pre-allocated OSAL IXP_BUF pointer * @return None */#define IX_OSAL_CONVERT_OSBUF_TO_IXPBUF( osBufPtr, ixpBufPtr) \        IX_OSAL_OS_CONVERT_OSBUF_TO_IXPBUF( osBufPtr, ixpBufPtr)        /** * @ingroup IxOsalBufferMgt * * @def IX_OSAL_CONVERT_IXPBUF_TO_OSBUF( ixpBufPtr, osBufPtr) * * @brief Convert pre-allocated OSAL IXP_BUF (IX_OSAL_MBUF) format to os-specific buffer pointers. * @param ixpBufPtr (in) - OSAL IXP_BUF pointer * @param osBufPtr (out) - os-specific buffer pointer. * @return None */#define IX_OSAL_CONVERT_IXPBUF_TO_OSBUF( ixpBufPtr, osBufPtr)  \        IX_OSAL_OS_CONVERT_IXPBUF_TO_OSBUF( ixpBufPtr, osBufPtr)PUBLIC IX_OSAL_MBUF_POOL *ixOsalPoolInit (UINT32 count,                      UINT32 size, const char *name);PUBLIC IX_OSAL_MBUF_POOL *ixOsalNoAllocPoolInit (void *poolBufPtr,                         void *poolDataPtr,						 UINT32 count,						 UINT32 size,						 const char *name);PUBLIC IX_OSAL_MBUF *ixOsalMbufAlloc (IX_OSAL_MBUF_POOL * pool);PUBLIC IX_OSAL_MBUF *ixOsalMbufFree (IX_OSAL_MBUF * mbuf);PUBLIC void ixOsalMbufChainFree (IX_OSAL_MBUF * mbuf);PUBLIC void ixOsalMbufDataPtrReset (IX_OSAL_MBUF * mbuf);PUBLIC void ixOsalMbufPoolShow (IX_OSAL_MBUF_POOL * pool);PUBLIC IX_STATUS ixOsalBuffPoolUninit (IX_OSAL_MBUF_POOL * pool);PUBLIC UINT32 ixOsalBuffPoolFreeCountGet(IX_OSAL_MBUF_POOL * pool);/** * @} IxOsalBufferMgt */#endif /* IxOsalBufferMgt_H */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -