12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- /********************************************************************************
- * File Name: MsgQueue.h
- * Function Describe: Header file for MsgQueue.c
- * Explain:
- * Writer: ShiLiangWen
- * Date: 2015-6-29
- *******************************************************************************/
- #ifndef __MSG_QUEUE_H
- #define __MSG_QUEUE_H
- /************************************file begin*******************************/
-
- #define MSG_QUEUE_NUM_MAX 10 //每个消息队列允许最大消息数
- //消息结构体
- typedef struct{
- unsigned short MsgLen;//消息数据长度
- unsigned short DataStartIndex;//消息数据在数据缓冲区中的开始位置索引
- }SUT_MESSAGE;
- //消息队列结构体
- typedef struct{
- unsigned short MsgIn;//加入新消息的位置索引
- unsigned short MsgOut;//取出已有消息的位置索引
- unsigned short MsgNum;//当前消息个数
- SUT_MESSAGE MsgQueue[MSG_QUEUE_NUM_MAX];//消息队列
- //--数据缓冲区
- unsigned short DataBufferLenMax;
- unsigned short DataBufferLen;
- unsigned short DataBufferIn;
- unsigned short DataBufferOut;
- char *DataBuffer;//数据缓冲区
- }SUT_MSG_QUEUE;
- void MsgQueueInit(SUT_MSG_QUEUE *pMsgQueue,char *pDataBuffer,unsigned short DataBufferLenMax);
- void MsgQueuePost(SUT_MSG_QUEUE *pMsgQueue,char *pData,unsigned short DataLen);
- int MsgQueueAccept(SUT_MSG_QUEUE *pMsgQueue,char *pBuf,unsigned short BufLen);
- void MsgQueuePostLoopBuf(SUT_MSG_QUEUE *pMsgQueue,char *pLoopBuf,unsigned short LoopDataBufLen,unsigned short LoopDataStart,unsigned short DataLen);
- /************************************file end*******************************/
- #endif
|