yb_arm/app/inc/msg_transfer_queue.h
2023-07-12 14:14:31 +08:00

89 lines
2.5 KiB
C

// +FHDR------------------------------------------------------------
// Copyright (c) 2022 SmartLogic.
// ALL RIGHTS RESERVED
// -----------------------------------------------------------------
// Filename : msg_transfer_queue.h
// Author : xianfeng.du
// Created On : 2022-12-21
// Last Modified :
// -----------------------------------------------------------------
// Description:
//
//
// -FHDR------------------------------------------------------------
#ifndef __MSG_TRANSFER_QUEUE_H__
#define __MSG_TRANSFER_QUEUE_H__
#include "typedef.h"
#include "msg_transfer_layer.h"
#define MAX_M_BUFFER_NUM 128
typedef enum eMsgQueueType {
UCP4008_TRAFFIC_NR_eMBB_DATA,
UCP4008_TRAFFIC_NR_eMBB_CTRL,
UCP4008_TRAFFIC_OAM,
UCP4008_TRAFFIC_MAX_NUM
} MsgQueueType_e;
typedef struct tQueueCfg {
uint32_t block_size;
uint16_t block_num;
uint16_t rsv;
//msg_transfer_callback* tx_callback;
msg_transfer_callback rx_callback;
} QueueCfg_t;
typedef struct tMsgQueueCfg {
HandleId_t handler;
QueueCfg_t tx_queue;
QueueCfg_t rx_queue;
} MsgQueueCfg_t;
typedef struct tMsgQueueCommonInfo{
uint32_t alloc;
uint32_t in;
uint32_t out;
uint32_t free;
uint16_t ringSize;
uint16_t ringMask;
uint32_t bufBase;
uint32_t bufSize;
uint32_t bufIdxBase;
} MsgQueueCommonInfo_t;
typedef struct tMsgQueueLocalInfo{
uint8_t* bufBase;
uint8_t* bufIdxBase;
uint64_t bufAddr;
uint32_t availableSize;
uint32_t offset;
uint16_t idx;
uint16_t msgCnt;
uint8_t rsv[4];
} MsgQueueLocalInfo_t;
typedef struct tSyncInfo {
uint8_t queueCfgFlag;
uint8_t rsv[15];
} SyncInfo_t;
typedef struct tMsgQueueLocalMgt {
SyncInfo_t localSyncInfo;
MsgQueueCfg_t localQueueCfg[MAX_INSTANCE_NUM][UCP4008_TRAFFIC_MAX_NUM];//local
MsgQueueLocalInfo_t localDlQueue[MAX_INSTANCE_NUM][UCP4008_TRAFFIC_MAX_NUM]; //local
MsgQueueLocalInfo_t localUlQueue[MAX_INSTANCE_NUM][UCP4008_TRAFFIC_MAX_NUM]; //local
} MsgQueueLocalMgt_t;
int32_t msg_queue_dl_block_init(uint8_t inst_id, uint8_t que_id);
int32_t msg_queue_dl_alloc_buf(uint8_t inst_id, uint8_t que_id);
int32_t msg_queue_dl_put_buf(uint8_t inst_id, uint8_t que_id);
uint8_t* msg_queue_ul_get_buf(uint8_t inst_id, uint8_t que_id);
void msg_transfer_queue_setup(uint8_t inst_id, uint8_t que_id);
void msg_transfer_queue_free(uint8_t inst_id, uint8_t que_id);
#endif