YB_Platform/inc/msg_transfer_layer.h
lishuang.xie e32716e367 update feature#1694# merge dev_ck_v2.1_xls_feature#1694# to dev_ck_v2.1
1. Four-channel support
2. modified the public/pet_rfm_spu1/top/src/phy_init.s.c to sendto different apes
3. now case21 no use
4. Test:
   4.1 spu_case0_arm_case0_cpri:  Pass
   4.2 spu_case14_arm_case20_cpri:Pass
   4.3 spu_case20_arm_case20_cpri:Pass
   4.4 spu_case24_arm_case24_cpri:Pass
   4.5 spu_case34_arm_case5:      Pass
   4.6 spu_case44_arm_case5:      Pass
2024-03-18 15:30:04 +08:00

88 lines
2.7 KiB
C

// +FHDR------------------------------------------------------------
// Copyright (c) 2022 SmartLogic.
// ALL RIGHTS RESERVED
// -----------------------------------------------------------------
// Filename : msg_transfer_layer.h
// Author : xianfeng.du
// Created On : 2022-06-29
// Last Modified :
// -----------------------------------------------------------------
// Description:
//
//
// -FHDR------------------------------------------------------------
#ifndef __MSG_TRANSFER_LAYER_H__
#define __MSG_TRANSFER_LAYER_H__
#define MAX_INSTANCE_NUM (4)
#define MAX_PORT_NUM (4)
#define SUCCESS (0)
#define FAILURE (-1)
#define UNINITIALIZED_QUEUE (1)
#define FULLEDED_QUEUE (2)
#define EMPTY_QUEUE (2)
#define OUT_OF_BLOCK_MEMORY (2)
typedef enum e_transfer_type {
NON_CU_SPLIT,
CU_SPLIT,
OAM,
TRANSFER_TYPE_NUM
} transfer_type_e;
#define MAX_TRANS_NUM (TRANSFER_TYPE_NUM-1)
typedef enum e_cu_flag {
C_PLANE,
U_PLANE
} cu_flag_e;
typedef union tHandleId {
uint32_t value;
struct {
uint8_t rsv;
uint8_t type_id;
uint8_t inst_id;
uint8_t port_id;
};
} HandleId_t;
typedef uint32_t (*msg_transfer_callback)(const char* buf,uint32_t payloadSize);
typedef struct t_queue_info {
uint32_t tx_desc_num;
uint32_t rx_desc_num;
uint32_t tx_block_size;
uint32_t rx_block_size;
uint16_t tx_block_num;
uint16_t rx_block_num;
uint16_t directions;
uint16_t rsv;
union {
uint64_t ele0;//aligned 64bit for NPU
msg_transfer_callback tx_callback;
};
union {
uint64_t ele1;//aligned 64bit for NPU
msg_transfer_callback rx_callback;
};
} queue_info_s;
typedef struct t_transfer_type_info {
queue_info_s queue_cplane_info;
queue_info_s queue_uplane_info;
} transfer_type_info_s;
//int32_t msg_transfer_init(uint16_t port_index, uint16_t transfer_type, uint16_t inst_id, const transfer_type_info_s* transfer_type_info);
int32_t msg_transfer_callback_register(uint16_t transfer_type, uint16_t inst_id, uint16_t cu_flag, msg_transfer_callback rx_callback);
int32_t msg_transfer_send_start(int32_t handle_id);
int32_t msg_transfer_alloc_msg(int32_t handle_id, uint16_t cu_flag, uint32_t bufSize, char** buf, uint32_t* availableSize, uint32_t* offset);
int32_t msg_transfer_send_msg(int32_t handle_id, uint16_t cu_flag, uint8_t* msg_ptr, uint32_t offset, uint32_t msg_len);
int32_t msg_transfer_send_end(int32_t handle_id);
int32_t msg_transfer_receive(int32_t handle_id, uint16_t cu_flag, uint32_t offset, uint32_t len, uint8_t** msg_ptr);
int32_t msg_transfer_close(int32_t handle_id);
#endif