1 /******************************************************************************
2 ###############################################################################
3 # Copyright (c) [2017-2020] [ICT/CAS] #
4 # Licensed under the ORAN Software License v1.0 (License) #
5 ###############################################################################
6 ******************************************************************************/
12 #include "vos_types.h"
13 #include "vos_string.h"
15 extern ULONG gMsgbFreeCount;
19 UINT16 maxHeadLen; /* Head域预留的长度 */
20 UINT16 maxDataLen; /* Data域预留的长度 */
21 UINT16 headSpareLen; /* Head域空闲的长度 */
22 UINT16 tailOffset; /* 数据尾端到dataBuff[]起始位置的距离,包括1.整个Head域 2.Data域的使用部分 */
28 UINT8 dataBuff[0]; /* DataBuff域的起始地址,指向msgbInfo变量后面的地址,该成员不占用内存 */
32 INT32 msgbCheck(MsgbBuff_t *pMsgBuff);
33 MsgbBuff_t *msgbAllocWithDebug(UINT16 dataLen, UINT16 maxHeadLen, ULONG moduleId,unsigned char *file, unsigned long line);
34 UINT8 *msgbDataWithDebug(MsgbBuff_t *pMsgBuff,unsigned char *fun, unsigned long line);
35 UINT8 *msgbTailWithDebug(MsgbBuff_t *pMsgBuff,unsigned char *fun, unsigned long line);
36 UINT16 msgbDataUsedLenWithDebug(MsgbBuff_t *pMsgBuff,unsigned char *fun, unsigned long line);
37 UINT16 msgbDataAllocLenWithDebug(MsgbBuff_t *pMsgBuff,unsigned char *fun, unsigned long line);
38 UINT8 *msgbHeadPushWithDebug(MsgbBuff_t *pMsgBuff, UINT32 len,unsigned char *fun, unsigned long line);
39 UINT8 *msgbHeadPullWithDebug(MsgbBuff_t *pMsgBuff, UINT32 len,unsigned char *fun, unsigned long line);
40 UINT8 *msgbTailPushWithDebug(MsgbBuff_t *pMsgBuff, UINT32 len,unsigned char *fun, unsigned long line);
41 UINT8 *msgbTailPullWithDebug(MsgbBuff_t *pMsgBuff, UINT32 len,unsigned char *fun, unsigned long line);
44 #define msgbAlloc( dataLen, maxHeadLen, moduleId) msgbAllocWithDebug( dataLen, maxHeadLen, moduleId,(UCHAR *)__func__,__LINE__)
48 #define msgbData(pMsgBuff) msgbDataWithDebug(pMsgBuff,(UCHAR *)__func__,__LINE__)
50 #define msgbTail(pMsgBuff) msgbTailWithDebug(pMsgBuff,(UCHAR *)__func__,__LINE__)
52 #define msgbDataUsedLen(pMsgBuff) msgbDataUsedLenWithDebug(pMsgBuff,(UCHAR *)__func__,__LINE__)
54 #define msgbDataAllocLen(pMsgBuff) msgbDataAllocLenWithDebug(pMsgBuff,(UCHAR *)__func__,__LINE__)
56 extern UINT16 msgbHeadLeftRoom(MsgbBuff_t *pMsgBuff);
58 extern UINT16 msgbTailLeftRoom(MsgbBuff_t *pMsgBuff);
61 #define msgbFree(pMsgBuff)\
65 vos_err_print("input is NULL!\n");\
72 #define msgbHeadPush(pMsgBuff, len) msgbHeadPushWithDebug(pMsgBuff, len,(UCHAR *)__func__,__LINE__)
74 #define msgbHeadPull(pMsgBuff, len) msgbHeadPullWithDebug(pMsgBuff, len,(UCHAR *)__func__,__LINE__)
76 #define msgbTailPush(pMsgBuff, len) msgbTailPushWithDebug(pMsgBuff, len,(UCHAR *)__func__,__LINE__)
78 #define msgbTailPull(pMsgBuff, len) msgbTailPullWithDebug(pMsgBuff, len,(UCHAR *)__func__,__LINE__)