// +FHDR------------------------------------------------------------
//                 Copyright (c) 2022 SmartLogic.
//                       ALL RIGHTS RESERVED
// -----------------------------------------------------------------
// Filename      : msg_transfer_mbuffer.h
// Author        : xianfeng.du
// Created On    : 2022-12-21
// Last Modified :
// -----------------------------------------------------------------
// Description:
//
//
// -FHDR------------------------------------------------------------

#ifndef __MSG_TRANSFER_MEM_BUFFER_H__
#define __MSG_TRANSFER_MEM_BUFFER_H__

#include "typedef.h"

#if 0
typedef struct tMsgMemBufCfg {
    uint8_t* bufBase;
    uint32_t offset;
    uint32_t bufSize;
    uint32_t numOfBufs;
} MsgMemBufCfg_t;

typedef struct tMsgMemBufMgt {
    MsgMemBufCfg_t dl[MAX_INSTANCE_NUM][UCP4008_TRAFFIC_MAX_NUM];
    MsgMemBufCfg_t ul[MAX_INSTANCE_NUM][UCP4008_TRAFFIC_MAX_NUM];
} MsgMemBufMgt_t;
#endif

typedef union tMsgMemBufAttribute{
    uint32_t ele[4];      //aligned
    struct {
        uint32_t msgSize; // in bytes
        uint8_t  qNo;
		uint8_t  state;  
        int16_t  idx;
		//uint8_t  msgType; // 0=data, 1=control		
        //uint8_t  eop;
        //uint8_t  nSegs;			
    };
} MsgMemBufAttr_t;

#define MSG_MBUF_HEAD_SIZE   (sizeof(MsgMemBufAttr_t))
#define MSG_MBUF_ATTR(pBuf)   ((MsgMemBufAttr_t *)((uint8_t *)pBuf - MSG_MBUF_HEAD_SIZE))

#endif

