/******************************************************************
 * @file  phy_msg_func.h
 * @brief:    [file description] 
 * @author: guicheng.liu
 * @Date 2022年6月29日
 * COPYRIGHT NOTICE: (c) smartlogictech. All rights reserved. 
 * Change_date         Owner         Change_content
 * 2022年6月29日        guicheng.liu       create file

*****************************************************************/

#ifndef     FPHY_MSG_FUNC_H
#define     FPHY_MSG_FUNC_H
#include <type_define.h>

#define MAX_RING_BUFFER_NUM 8

typedef struct
{
    uint32_t el_ind;
    uint32_t len;
    char*    buff;
}buffer_info_t;

typedef struct {
    int      num;
    int      head;
    int      tail;
    buffer_info_t buffer[MAX_RING_BUFFER_NUM];
}msg_ring_buffer_t;


void msg_buffer_init();
bool msg_buffer_empty(uint32_t queue_num);
bool msg_buffer_full(msg_ring_buffer_t *ring_buffer);
void enque_msg_buffer(uint32_t queue_num,
                            uint32_t el_ind,
                            char* buf, 
                            uint32_t len);
int deque_msg_buffer(uint32_t queue_num, 
                            uint32_t* el_ind,
                            char** buf, 
                            uint32_t* len);

#endif
