From d734e714d5d68c2f92670edf5af5cf0d166c9d03 Mon Sep 17 00:00:00 2001 From: "lishuang.xie" Date: Wed, 23 Aug 2023 16:02:18 +0800 Subject: [PATCH] 1. New Feature#1006 2. add case0 : LTE 2 ape testcase 3. add case20: NR 4 ape testcase 4. add case21: NR 8 ape testcase 5. add case22: LTE 8 ape testcase 6. add case50: PCIE EP: arm read cfg for phy --- app/src/main.c | 4 +- app/src/ucp_handshake.c | 2 +- test/case0/2ape_case(15K).txt | 0 test/case0/src/testcase.c | 498 ++++++++++++--------------- test/case20/4ape_case(30K).txt | 0 test/case20/src/testcase20.c | 312 +++++++++++++++++ test/case21/8ape_case(30K).txt | 0 test/case21/src/testcase21.c | 401 +++++++++++++++++++++ test/case22/8ape_case(15K).txt | 0 test/case22/src/testcase22.c | 402 +++++++++++++++++++++ test/case50/PCIE_EP_arm_read_cfg.txt | 0 test/case50/src/testcase50.c | 32 ++ 12 files changed, 1370 insertions(+), 281 deletions(-) create mode 100644 test/case0/2ape_case(15K).txt create mode 100644 test/case20/4ape_case(30K).txt create mode 100644 test/case20/src/testcase20.c create mode 100644 test/case21/8ape_case(30K).txt create mode 100644 test/case21/src/testcase21.c create mode 100644 test/case22/8ape_case(15K).txt create mode 100644 test/case22/src/testcase22.c create mode 100644 test/case50/PCIE_EP_arm_read_cfg.txt create mode 100644 test/case50/src/testcase50.c diff --git a/app/src/main.c b/app/src/main.c index 4bb78b5..383ced5 100644 --- a/app/src/main.c +++ b/app/src/main.c @@ -37,6 +37,8 @@ extern int32_t UCP_API_RFIC_CellSetup(uint64_t txLo, uint64_t rxLo, uint64_t bw, #define MAX_PARA_NUM 4 + +uint8_t gu8_main_flag = 1; /* main fun while(): 1 while; 0: out */ int32_t main(int32_t argc, char* argvp[]) { //uint32_t stc_cnt = 0, stc_cnt1 = 0; @@ -73,7 +75,7 @@ int32_t main(int32_t argc, char* argvp[]) test_case(count, args); #endif - while (1) + while (gu8_main_flag) { usleep(100); } diff --git a/app/src/ucp_handshake.c b/app/src/ucp_handshake.c index 3161086..4f83e44 100644 --- a/app/src/ucp_handshake.c +++ b/app/src/ucp_handshake.c @@ -29,7 +29,7 @@ void ucp_handshake(void) UcpHandshake_t* pHandshake = pPetSmLocalMgt->pHandshake; pHandshake->request[core_id] = request; - UCP_PRINT_DEBUG("core[0x%08x] sent handshake request message,value[0x%08x].",core_id,request); + UCP_PRINT_DEBUG("core[0x%08x] send handshake request message,value[0x%08x].",core_id,request); while(1) { response = pHandshake->response[core_id]; diff --git a/test/case0/2ape_case(15K).txt b/test/case0/2ape_case(15K).txt new file mode 100644 index 0000000..e69de29 diff --git a/test/case0/src/testcase.c b/test/case0/src/testcase.c index 5dd7f4e..ffe6268 100644 --- a/test/case0/src/testcase.c +++ b/test/case0/src/testcase.c @@ -1,95 +1,82 @@ -// +FHDR------------------------------------------------------------ -// Copyright (c) 2022 SmartLogic. -// ALL RIGHTS RESERVED -// ----------------------------------------------------------------- -// Filename : test.c -// Author : xianfeng.du -// Created On : 2022-11-25 -// Last Modified : -// ----------------------------------------------------------------- -// Description: -// -// -// -FHDR------------------------------------------------------------ - -#include -#include -#include -#include - -#include "typedef.h" -#include "ucp_printf.h" -#include "msg_transfer_mem.h" -#include "pet_sm_mgt.h" -#include "ucp_handshake.h" -#include "ospShell.h" -#include "ospLog.h" +// +FHDR------------------------------------------------------------ +// Copyright (c) 2022 SmartLogic. +// ALL RIGHTS RESERVED +// ----------------------------------------------------------------- +// Filename : test.c +// Author : xianfeng.du +// Created On : 2022-11-25 +// Last Modified : +// ----------------------------------------------------------------- +// Description: +// +// +// -FHDR------------------------------------------------------------ + +#include +#include +#include +#include + +#include "typedef.h" +#include "ucp_printf.h" +#include "msg_transfer_mem.h" +#include "pet_sm_mgt.h" +#include "ucp_handshake.h" +#include "ospShell.h" +#include "ospLog.h" #include "ospCfgToBin.h" -#include "drv_init.h" - -uint32_t slot_ind_flag = 0; -uint32_t slot_ind_time_flag = 0; -uint32_t g_slot_time = 0; -uint32_t gu32_value = 0; -uint32_t gu32_tick_receive_ctrl = 0; -uint32_t gu32_tick_from_tx_ctrl = 0; - -uint32_t rx_callback_data(const char* buf,uint32_t payloadSize) -{ - uint32_t stc_cnt = read_stc_local_timer(); - - uint32_t value = *(uint32_t *)buf; - uint16_t sfn = value >> 16; - uint16_t slot = value & 0xffff; - - uint32_t tick_from_tx_ctrl = *(uint32_t *)(buf+4); - - slot_ind_flag = 1; - gu32_value = value; - gu32_tick_receive_ctrl = stc_cnt; - gu32_tick_from_tx_ctrl = tick_from_tx_ctrl; - uint32_t diff = stc_cnt - tick_from_tx_ctrl; - //UCP_PRINT_LOG("a72_rx[%d], ape_tx[%d],offset[%d]",stc_cnt,tick_from_tx_ctrl,diff); - //UCP_PRINT_LOG("qNO[%d],sfn[%d],slot[%d]",UCP4008_TRAFFIC_NR_eMBB_DATA,sfn,slot); - - if(0 == slot_ind_time_flag) - { - slot_ind_time_flag = 1; - diff = 500000; - } - else - { - diff = stc_cnt - g_slot_time; - } - g_slot_time = stc_cnt; - - if ((diff > 520000) || (diff < 480000)) - { - UCP_PRINT_ERROR("qNO[%d],sfn[%d],slot[%d],diff[%d]",UCP4008_TRAFFIC_NR_eMBB_DATA,sfn,slot,diff); - } - - //EcsSmLocalMgt_t* pEcsSmLocalMgt = get_ecs_sm_local_mgt(); - ///MsgQueueCommonInfo_t* chCommon = pEcsSmLocalMgt->pUlQueue[0][UCP4008_TRAFFIC_NR_eMBB_DATA]; - //UCP_PRINT_DEBUG("rx_callback_data chCommon info alloc[%d],in[%d],out[%d]",chCommon->alloc,chCommon->in,chCommon->out); - - return payloadSize; -} - -uint32_t rx1_callback_data(const char* buf,uint32_t payloadSize) -{ - return payloadSize; -} - -uint32_t rx_callback_ctrl(const char* buf,uint32_t payloadSize) -{ -#if 0 - EcsSmLocalMgt_t* pEcsSmLocalMgt = get_ecs_sm_local_mgt(); - MsgQueueCommonInfo_t* chCommon = pEcsSmLocalMgt->pUlQueue[0][UCP4008_TRAFFIC_NR_eMBB_CTRL]; - UCP_PRINT_DEBUG("rx_callback_ctrl chCommon info alloc[%d],in[%d],out[%d]",chCommon->alloc,chCommon->in,chCommon->out); -#endif - return payloadSize; -} - +#include "drv_init.h" + +uint32_t slot_ind_flag = 0; +uint32_t slot_ind_time_flag = 0; +uint32_t g_slot_time = 0; +uint32_t gu32_value = 0; +uint32_t gu32_tick_receive_ctrl = 0; +uint32_t gu32_tick_from_tx_ctrl = 0; + +uint32_t rx_callback_data(const char* buf,uint32_t payloadSize) +{ + uint32_t stc_cnt = read_stc_local_timer(); + uint32_t value = *(uint32_t *)buf; + uint16_t sfn = value >> 16; + uint16_t slot = value & 0xffff; + + uint32_t tick_from_tx_ctrl = *(uint32_t *)(buf+4); + + slot_ind_flag = 1; + gu32_value = value; + gu32_tick_receive_ctrl = stc_cnt; + gu32_tick_from_tx_ctrl = tick_from_tx_ctrl; + uint32_t diff = stc_cnt - tick_from_tx_ctrl; + + if(0 == slot_ind_time_flag) + { + slot_ind_time_flag = 1; + diff = 1000000; + } + else + { + diff = stc_cnt - g_slot_time; + } + g_slot_time = stc_cnt; + + if ((diff > 1020000) || (diff < 980000)) + { + UCP_PRINT_ERROR("qNO[%d],sfn[%d],slot[%d],diff[%d]",UCP4008_TRAFFIC_NR_eMBB_DATA,sfn,slot,diff); + } + return payloadSize; +} + +uint32_t rx1_callback_data(const char* buf,uint32_t payloadSize) +{ + return payloadSize; +} + +uint32_t rx_callback_ctrl(const char* buf,uint32_t payloadSize) +{ + return payloadSize; +} + static inline void get_msg_transfer_info(uint16_t port_index, uint16_t inst_id, uint16_t transfer_type, transfer_type_info_s* transfer_type_info_ptr) { queue_info_s c_plane,u_plane; @@ -105,15 +92,15 @@ static inline void get_msg_transfer_info(uint16_t port_index, uint16_t inst_id, u_plane.rx_block_size = 0x28000; u_plane.rx_block_num = 8; - //u_plane.rx_callback = rx_callback_data; - if (0 == inst_id) - { + //u_plane.rx_callback = rx_callback_data; + if (0 == inst_id) + { u_plane.rx_callback = rx_callback_data; - } - else - { - u_plane.rx_callback = rx1_callback_data; - } + } + else + { + u_plane.rx_callback = rx1_callback_data; + } u_plane.tx_block_size = 0x28000; u_plane.tx_block_num = 8; u_plane.tx_callback = NULL; @@ -138,7 +125,7 @@ static inline void get_msg_transfer_info(uint16_t port_index, uint16_t inst_id, return; } - + static inline void msg_transfer_cfg(void) { uint8_t port_id = 0; @@ -164,206 +151,159 @@ static inline void msg_transfer_cfg(void) UCP_PRINT_ERROR("phy_cfg_init transfer_type:OAM, handle_id[0x%08x] error.",handle_id); } } - - PetSmLocalMgt_t* pPetSmLocalMgt = get_pet_sm_local_mgt(); - MsgQueueLocalMgt_t* pMsgQueueLocalMgt = get_msg_queue_local_mgt(); - pPetSmLocalMgt->pSyncInfo->queueCfgFlag = ++pMsgQueueLocalMgt->localSyncInfo.queueCfgFlag; - + + PetSmLocalMgt_t* pPetSmLocalMgt = get_pet_sm_local_mgt(); + MsgQueueLocalMgt_t* pMsgQueueLocalMgt = get_msg_queue_local_mgt(); + pPetSmLocalMgt->pSyncInfo->queueCfgFlag = ++pMsgQueueLocalMgt->localSyncInfo.queueCfgFlag; + + return; +} + +static inline void msg_transfer_queue_polling(void) +{ + uint8_t port_id = 0; + HandleId_t handler; + uint16_t cu_flag; + uint32_t offset = 0; + uint32_t len = 0; + uint8_t* msg_ptr; + + for (uint32_t i = 0; i < MAX_INSTANCE_NUM; i++) { + handler.port_id = port_id; + handler.inst_id = i; + handler.type_id = CU_SPLIT; + cu_flag = C_PLANE; + msg_transfer_receive(handler.value, cu_flag, offset, len, &msg_ptr); + + cu_flag = U_PLANE; + msg_transfer_receive(handler.value, cu_flag, offset, len, &msg_ptr); + + handler.type_id = OAM; + msg_transfer_receive(handler.value, cu_flag, offset, len, &msg_ptr); + } + return; } - -static inline void msg_transfer_queue_polling(void) -{ - uint8_t port_id = 0; - HandleId_t handler; - uint16_t cu_flag; - uint32_t offset = 0; - uint32_t len = 0; - uint8_t* msg_ptr; - - for (uint32_t i = 0; i < MAX_INSTANCE_NUM; i++) { - handler.port_id = port_id; - handler.inst_id = i; - handler.type_id = CU_SPLIT; - cu_flag = C_PLANE; - msg_transfer_receive(handler.value, cu_flag, offset, len, &msg_ptr); - - cu_flag = U_PLANE; - msg_transfer_receive(handler.value, cu_flag, offset, len, &msg_ptr); - - handler.type_id = OAM; - msg_transfer_receive(handler.value, cu_flag, offset, len, &msg_ptr); - } - - return; -} #define CELL_SETUP_TYPE_SIMULATION (0x5a6b7c8d) void cell_setup_simulation() { - uint32_t size = 16; - char* buf; - uint32_t availableSize,offset; - - uint16_t cu_flag = C_PLANE; - HandleId_t handler; - handler.port_id = 0; - handler.inst_id = 0; - handler.type_id = CU_SPLIT; + uint32_t size = 16; + char* buf; + uint32_t availableSize,offset; + + uint16_t cu_flag = C_PLANE; + HandleId_t handler; + handler.port_id = 0; + handler.inst_id = 0; + handler.type_id = CU_SPLIT; //usleep(10000); sleep(1); - int32_t ret = msg_transfer_send_start(handler.value,cu_flag); - - /************C_PLANE***************/ - ret = msg_transfer_alloc_msg(handler.value, cu_flag, size, &buf, &availableSize, &offset); - if ( SUCCESS != ret) { + int32_t ret = msg_transfer_send_start(handler.value,cu_flag); + + /************C_PLANE***************/ + ret = msg_transfer_alloc_msg(handler.value, cu_flag, size, &buf, &availableSize, &offset); + if ( SUCCESS != ret) { UCP_PRINT_ERROR("cell_setup_simulation call msg_transfer_alloc_msg err."); return ; - //continue; - } + //continue; + } - *(uint32_t*)(buf + 0) = CELL_SETUP_TYPE_SIMULATION; - *(uint32_t*)(buf + 4) = read_stc_local_timer(); + *(uint32_t*)(buf + 0) = CELL_SETUP_TYPE_SIMULATION; + *(uint32_t*)(buf + 4) = read_stc_local_timer(); - ret = msg_transfer_send_msg(handler.value, cu_flag, (uint8_t *)buf, offset, size); + ret = msg_transfer_send_msg(handler.value, cu_flag, (uint8_t *)buf, offset, size); ret = msg_transfer_send_end(handler.value,cu_flag); return; } - -int32_t test_case(uint32_t argc, int32_t* argvp) -{ - UCP_PRINT_DEBUG("start running testcase 0."); + +int32_t test_case(uint32_t argc, int32_t* argvp) +{ + UCP_PRINT_DEBUG("start running testcase 0."); osp_read_spe_cfg_file("/ramfs/cfgDat"); - msg_transfer_mem_init(); - msg_transfer_cfg(); - ucp_handshake(); - - UCP_PRINT_DEBUG("start transfering message."); - - uint32_t size = 100; - char* buf; - uint32_t availableSize,offset; - uint8_t* ptr; - - uint16_t cu_flag = C_PLANE; - HandleId_t handler; - handler.port_id = 0; - handler.inst_id = 0; - handler.type_id = CU_SPLIT; - - int32_t ret; + msg_transfer_mem_init(); + msg_transfer_cfg(); + ucp_handshake(); - cell_setup_simulation(); + UCP_PRINT_DEBUG("start transfering message."); + + uint32_t size = 100; + char* buf; + uint32_t availableSize,offset; + uint8_t* ptr; + + uint16_t cu_flag = C_PLANE; + HandleId_t handler; + handler.port_id = 0; + handler.inst_id = 0; + handler.type_id = CU_SPLIT; + + int32_t ret; + + cell_setup_simulation(); + + while(1) { + msg_transfer_queue_polling(); + + if(1 == slot_ind_flag) + { + slot_ind_flag = 0; + + handler.inst_id = 0; + + /************C_PLANE***************/ + cu_flag = C_PLANE; + ret = msg_transfer_send_start(handler.value,cu_flag); + + ret = msg_transfer_alloc_msg(handler.value, cu_flag, size, &buf, &availableSize, &offset); + if ( SUCCESS != ret) { + UCP_PRINT_ERROR("0,c_plane alloc error\r\n"); + continue; + } + + ptr = (uint8_t *)buf; + *(uint32_t*)(ptr + 0) = gu32_value; + *(uint32_t*)(ptr + 4) = gu32_tick_from_tx_ctrl; + *(uint32_t*)(ptr + 8) = gu32_tick_receive_ctrl; + *(uint32_t*)(ptr + 12) = read_stc_local_timer(); + + ret = msg_transfer_send_msg(handler.value, cu_flag, (uint8_t *)buf, offset, size); + if ( SUCCESS != ret) { + UCP_PRINT_ERROR("0,c_plane send error\r\n"); + } + + ret = msg_transfer_send_end(handler.value,cu_flag); + + /************U_PLANE***************/ + cu_flag = U_PLANE; + ret = msg_transfer_send_start(handler.value,cu_flag); + + ret = msg_transfer_alloc_msg(handler.value, cu_flag, size, &buf, &availableSize, &offset); + if ( SUCCESS != ret) { + UCP_PRINT_ERROR("0,u_plane alloc error\r\n"); + continue; + } + + ptr = (uint8_t *)buf; + *(uint32_t*)(ptr + 0) = gu32_value; + *(uint32_t*)(ptr + 4) = gu32_tick_from_tx_ctrl; + *(uint32_t*)(ptr + 8) = gu32_tick_receive_ctrl; + *(uint32_t*)(ptr + 12) = read_stc_local_timer(); + + ret = msg_transfer_send_msg(handler.value, cu_flag, (uint8_t *)buf, offset, size); + if ( SUCCESS != ret) { + UCP_PRINT_ERROR("0,u_plane send error\r\n"); + } + + ret = msg_transfer_send_end(handler.value,cu_flag); + } + } + return 0; +} - while(1) { - msg_transfer_queue_polling(); - - if(1 == slot_ind_flag) - { - slot_ind_flag = 0; - - handler.inst_id = 0; - - /************C_PLANE***************/ - cu_flag = C_PLANE; - ret = msg_transfer_send_start(handler.value,cu_flag); - - ret = msg_transfer_alloc_msg(handler.value, cu_flag, size, &buf, &availableSize, &offset); - if ( SUCCESS != ret) { - UCP_PRINT_ERROR("0,c_plane alloc error\r\n"); - continue; - } - - ptr = (uint8_t *)buf; - *(uint32_t*)(ptr + 0) = gu32_value; - *(uint32_t*)(ptr + 4) = gu32_tick_from_tx_ctrl; - *(uint32_t*)(ptr + 8) = gu32_tick_receive_ctrl; - *(uint32_t*)(ptr + 12) = read_stc_local_timer(); - - ret = msg_transfer_send_msg(handler.value, cu_flag, (uint8_t *)buf, offset, size); - if ( SUCCESS != ret) { - UCP_PRINT_ERROR("0,c_plane send error\r\n"); - } - - ret = msg_transfer_send_end(handler.value,cu_flag); - - /************U_PLANE***************/ - cu_flag = U_PLANE; - ret = msg_transfer_send_start(handler.value,cu_flag); - - ret = msg_transfer_alloc_msg(handler.value, cu_flag, size, &buf, &availableSize, &offset); - if ( SUCCESS != ret) { - UCP_PRINT_ERROR("0,u_plane alloc error\r\n"); - continue; - } - - ptr = (uint8_t *)buf; - *(uint32_t*)(ptr + 0) = gu32_value; - *(uint32_t*)(ptr + 4) = gu32_tick_from_tx_ctrl; - *(uint32_t*)(ptr + 8) = gu32_tick_receive_ctrl; - *(uint32_t*)(ptr + 12) = read_stc_local_timer(); - - ret = msg_transfer_send_msg(handler.value, cu_flag, (uint8_t *)buf, offset, size); - if ( SUCCESS != ret) { - UCP_PRINT_ERROR("0,u_plane send error\r\n"); - } - - ret = msg_transfer_send_end(handler.value,cu_flag); - - handler.inst_id = 1; - /************C_PLANE***************/ - cu_flag = C_PLANE; - ret = msg_transfer_send_start(handler.value,cu_flag); - - ret = msg_transfer_alloc_msg(handler.value, cu_flag, size, &buf, &availableSize, &offset); - if ( SUCCESS != ret) { - UCP_PRINT_ERROR("1,c_plane alloc error\r\n"); - continue; - } - - ptr = (uint8_t *)buf; - *(uint32_t*)(ptr + 0) = gu32_value; - *(uint32_t*)(ptr + 4) = gu32_tick_from_tx_ctrl; - *(uint32_t*)(ptr + 8) = gu32_tick_receive_ctrl; - *(uint32_t*)(ptr + 12) = read_stc_local_timer(); - - ret = msg_transfer_send_msg(handler.value, cu_flag, (uint8_t *)buf, offset, size); - if ( SUCCESS != ret) { - UCP_PRINT_ERROR("1,c_plane send error\r\n"); - } - - ret = msg_transfer_send_end(handler.value,cu_flag); - - /************U_PLANE***************/ - cu_flag = U_PLANE; - ret = msg_transfer_send_start(handler.value,cu_flag); - - ret = msg_transfer_alloc_msg(handler.value, cu_flag, size, &buf, &availableSize, &offset); - if ( SUCCESS != ret) { - UCP_PRINT_ERROR("1,u_plane alloc error\r\n"); - continue; - } - - ptr = (uint8_t *)buf; - *(uint32_t*)(ptr + 0) = gu32_value; - *(uint32_t*)(ptr + 4) = gu32_tick_from_tx_ctrl; - *(uint32_t*)(ptr + 8) = gu32_tick_receive_ctrl; - *(uint32_t*)(ptr + 12) = read_stc_local_timer(); - - ret = msg_transfer_send_msg(handler.value, cu_flag, (uint8_t *)buf, offset, size); - if ( SUCCESS != ret) { - UCP_PRINT_ERROR("1,u_plane send error\r\n"); - } - - ret = msg_transfer_send_end(handler.value,cu_flag); - } - } - return 0; -} - diff --git a/test/case20/4ape_case(30K).txt b/test/case20/4ape_case(30K).txt new file mode 100644 index 0000000..e69de29 diff --git a/test/case20/src/testcase20.c b/test/case20/src/testcase20.c new file mode 100644 index 0000000..2281efa --- /dev/null +++ b/test/case20/src/testcase20.c @@ -0,0 +1,312 @@ +// +FHDR------------------------------------------------------------ +// Copyright (c) 2022 SmartLogic. +// ALL RIGHTS RESERVED +// ----------------------------------------------------------------- +// Filename : test.c +// Author : xianfeng.du +// Created On : 2022-11-25 +// Last Modified : +// ----------------------------------------------------------------- +// Description: +// +// +// -FHDR------------------------------------------------------------ + +#include +#include +#include +#include + +#include "typedef.h" +#include "ucp_printf.h" +#include "msg_transfer_mem.h" +#include "pet_sm_mgt.h" +#include "ucp_handshake.h" +#include "ospShell.h" +#include "ospLog.h" +#include "ospCfgToBin.h" +#include "drv_init.h" + +uint32_t slot_ind_flag = 0; +uint32_t slot_ind_time_flag = 0; +uint32_t g_slot_time = 0; +uint32_t gu32_value = 0; +uint32_t gu32_tick_receive_ctrl = 0; +uint32_t gu32_tick_from_tx_ctrl = 0; + +uint32_t rx_callback_data(const char* buf,uint32_t payloadSize) +{ + uint32_t stc_cnt = read_stc_local_timer(); + + uint32_t value = *(uint32_t *)buf; + uint16_t sfn = value >> 16; + uint16_t slot = value & 0xffff; + + uint32_t tick_from_tx_ctrl = *(uint32_t *)(buf+4); + + slot_ind_flag = 1; + gu32_value = value; + gu32_tick_receive_ctrl = stc_cnt; + gu32_tick_from_tx_ctrl = tick_from_tx_ctrl; + uint32_t diff = stc_cnt - tick_from_tx_ctrl; + + if(0 == slot_ind_time_flag) + { + slot_ind_time_flag = 1; + diff = 500000; + } + else + { + diff = stc_cnt - g_slot_time; + } + g_slot_time = stc_cnt; + + if ((diff > 520000) || (diff < 480000)) + { + UCP_PRINT_ERROR("qNO[%d],sfn[%d],slot[%d],diff[%d]",UCP4008_TRAFFIC_NR_eMBB_DATA,sfn,slot,diff); + } + + return payloadSize; +} + +uint32_t rx1_callback_data(const char* buf,uint32_t payloadSize) +{ + return payloadSize; +} + +uint32_t rx_callback_ctrl(const char* buf,uint32_t payloadSize) +{ + return payloadSize; +} + +static inline void get_msg_transfer_info(uint16_t port_index, uint16_t inst_id, uint16_t transfer_type, transfer_type_info_s* transfer_type_info_ptr) +{ + queue_info_s c_plane,u_plane; + + switch (transfer_type) { + case CU_SPLIT: + c_plane.rx_block_size = 0x25800; + c_plane.rx_block_num = 32; + c_plane.rx_callback = rx_callback_ctrl; + c_plane.tx_block_size = 0x8000; + c_plane.tx_block_num = 8; + c_plane.tx_callback = NULL; + + u_plane.rx_block_size = 0x28000; + u_plane.rx_block_num = 8; + //u_plane.rx_callback = rx_callback_data; + if (0 == inst_id) + { + u_plane.rx_callback = rx_callback_data; + } + else + { + u_plane.rx_callback = rx1_callback_data; + } + u_plane.tx_block_size = 0x28000; + u_plane.tx_block_num = 8; + u_plane.tx_callback = NULL; + + transfer_type_info_ptr->queue_cplane_info = c_plane; + transfer_type_info_ptr->queue_uplane_info = u_plane; + break; + case OAM: + c_plane.rx_block_size = 0x100000; + c_plane.rx_block_num = 32; + c_plane.rx_callback = rx_callback_oam; + c_plane.tx_block_size = 0x8000; + c_plane.tx_block_num = 8; + c_plane.tx_callback = NULL; + + transfer_type_info_ptr->queue_cplane_info = c_plane; + break; + default: + UCP_PRINT_ERROR("get_msg_queue_cfg doesn't support transfer_type[%d] .",transfer_type); + break; + } + + return; +} + +static inline void msg_transfer_cfg(void) +{ + uint8_t port_id = 0; + uint16_t inst_id = 0; + uint16_t transfer_type = 0; + int32_t handle_id = 0; + transfer_type_info_s transfer_type_info; + + for (inst_id=0; inst_idpSyncInfo->queueCfgFlag = ++pMsgQueueLocalMgt->localSyncInfo.queueCfgFlag; + + return; +} + +static inline void msg_transfer_queue_polling(void) +{ + uint8_t port_id = 0; + HandleId_t handler; + uint16_t cu_flag; + uint32_t offset = 0; + uint32_t len = 0; + uint8_t* msg_ptr; + + for (uint32_t i = 0; i < MAX_INSTANCE_NUM; i++) { + handler.port_id = port_id; + handler.inst_id = i; + handler.type_id = CU_SPLIT; + cu_flag = C_PLANE; + msg_transfer_receive(handler.value, cu_flag, offset, len, &msg_ptr); + + cu_flag = U_PLANE; + msg_transfer_receive(handler.value, cu_flag, offset, len, &msg_ptr); + + handler.type_id = OAM; + msg_transfer_receive(handler.value, cu_flag, offset, len, &msg_ptr); + } + + return; +} + +#define CELL_SETUP_TYPE_SIMULATION (0x5a6b7c8d) + +void cell_setup_simulation() +{ + uint32_t size = 16; + char* buf; + uint32_t availableSize,offset; + + uint16_t cu_flag = C_PLANE; + HandleId_t handler; + handler.port_id = 0; + handler.inst_id = 0; + handler.type_id = CU_SPLIT; + + //usleep(10000); + sleep(1); + + int32_t ret = msg_transfer_send_start(handler.value,cu_flag); + + /************C_PLANE***************/ + ret = msg_transfer_alloc_msg(handler.value, cu_flag, size, &buf, &availableSize, &offset); + if ( SUCCESS != ret) { + UCP_PRINT_ERROR("cell_setup_simulation call msg_transfer_alloc_msg err."); + return ; + //continue; + } + + *(uint32_t*)(buf + 0) = CELL_SETUP_TYPE_SIMULATION; + *(uint32_t*)(buf + 4) = read_stc_local_timer(); + + ret = msg_transfer_send_msg(handler.value, cu_flag, (uint8_t *)buf, offset, size); + ret = msg_transfer_send_end(handler.value,cu_flag); + + return; +} + +int32_t test_case(uint32_t argc, int32_t* argvp) +{ + UCP_PRINT_DEBUG("start running testcase 20 (4 ape 30K case)."); + + osp_read_spe_cfg_file("/ramfs/cfgDat"); + + msg_transfer_mem_init(); + msg_transfer_cfg(); + ucp_handshake(); + + UCP_PRINT_DEBUG("start transfering message."); + + uint32_t size = 100; + char* buf; + uint32_t availableSize,offset; + uint8_t* ptr; + + uint16_t cu_flag = C_PLANE; + HandleId_t handler; + handler.port_id = 0; + handler.inst_id = 0; + handler.type_id = CU_SPLIT; + + int32_t ret; + + cell_setup_simulation(); + + while(1) + { + msg_transfer_queue_polling(); + + if(1 == slot_ind_flag) + { + slot_ind_flag = 0; + + handler.inst_id = 0; + + /************C_PLANE***************/ + cu_flag = C_PLANE; + ret = msg_transfer_send_start(handler.value,cu_flag); + + ret = msg_transfer_alloc_msg(handler.value, cu_flag, size, &buf, &availableSize, &offset); + if ( SUCCESS != ret) { + UCP_PRINT_ERROR("0,c_plane alloc error\r\n"); + continue; + } + + ptr = (uint8_t *)buf; + *(uint32_t*)(ptr + 0) = gu32_value; + *(uint32_t*)(ptr + 4) = gu32_tick_from_tx_ctrl; + *(uint32_t*)(ptr + 8) = gu32_tick_receive_ctrl; + *(uint32_t*)(ptr + 12) = read_stc_local_timer(); + + ret = msg_transfer_send_msg(handler.value, cu_flag, (uint8_t *)buf, offset, size); + if ( SUCCESS != ret) { + UCP_PRINT_ERROR("0,c_plane send error\r\n"); + } + + ret = msg_transfer_send_end(handler.value,cu_flag); + + /************U_PLANE***************/ + cu_flag = U_PLANE; + ret = msg_transfer_send_start(handler.value,cu_flag); + + ret = msg_transfer_alloc_msg(handler.value, cu_flag, size, &buf, &availableSize, &offset); + if ( SUCCESS != ret) { + UCP_PRINT_ERROR("0,u_plane alloc error\r\n"); + continue; + } + + ptr = (uint8_t *)buf; + *(uint32_t*)(ptr + 0) = gu32_value; + *(uint32_t*)(ptr + 4) = gu32_tick_from_tx_ctrl; + *(uint32_t*)(ptr + 8) = gu32_tick_receive_ctrl; + *(uint32_t*)(ptr + 12) = read_stc_local_timer(); + + ret = msg_transfer_send_msg(handler.value, cu_flag, (uint8_t *)buf, offset, size); + if ( SUCCESS != ret) { + UCP_PRINT_ERROR("0,u_plane send error\r\n"); + } + + ret = msg_transfer_send_end(handler.value,cu_flag); + } + } + return 0; +} + diff --git a/test/case21/8ape_case(30K).txt b/test/case21/8ape_case(30K).txt new file mode 100644 index 0000000..e69de29 diff --git a/test/case21/src/testcase21.c b/test/case21/src/testcase21.c new file mode 100644 index 0000000..8024544 --- /dev/null +++ b/test/case21/src/testcase21.c @@ -0,0 +1,401 @@ +// +FHDR------------------------------------------------------------ +// Copyright (c) 2022 SmartLogic. +// ALL RIGHTS RESERVED +// ----------------------------------------------------------------- +// Filename : test5.c +// Author : xianfeng.du +// Created On : 2022-11-25 +// Last Modified : +// ----------------------------------------------------------------- +// Description: +// 8 ape case +// +// -FHDR------------------------------------------------------------ + +#include +#include +#include +#include +#include + +#include "typedef.h" +#include "ucp_printf.h" +#include "msg_transfer_mem.h" +#include "pet_sm_mgt.h" +#include "ucp_handshake.h" +#include "ospShell.h" +#include "ospLog.h" +#include "ospCfgToBin.h" +#include "drv_init.h" + +uint32_t slot_ind_flag = 0; +uint32_t slot_ind_time_flag = 0; +uint32_t g_slot_time = 0; +uint32_t gu32_value = 0; +uint32_t gu32_tick_receive_ctrl = 0; +uint32_t gu32_tick_from_tx_ctrl = 0; + +uint32_t gu32_rx_callback_data_cnt = 0; + +uint32_t rx_callback_data(const char* buf,uint32_t payloadSize) +{ + uint32_t stc_cnt = read_stc_local_timer(); + uint32_t value = *(uint32_t *)buf; + uint16_t sfn = value >> 16; + uint16_t slot = value & 0xffff; + + uint32_t tick_from_tx_ctrl = *(uint32_t *)(buf+4); + + ++gu32_rx_callback_data_cnt; + slot_ind_flag = 1; + gu32_value = value; + gu32_tick_receive_ctrl = stc_cnt; + gu32_tick_from_tx_ctrl = tick_from_tx_ctrl; + uint32_t diff = stc_cnt - tick_from_tx_ctrl; + + if(0 == slot_ind_time_flag) + { + slot_ind_time_flag = 1; + diff = 500000; + } + else + { + diff = stc_cnt - g_slot_time; + } + g_slot_time = stc_cnt; + + if ((diff > 520000) || (diff < 480000)) + { + UCP_PRINT_ERROR("[0],qNO[%d],sfn[%d],slot[%d],diff[%d]",UCP4008_TRAFFIC_NR_eMBB_DATA,sfn,slot,diff); + } + return payloadSize; +} + +uint32_t gu32_rx1_slot_ind_flag = 0; +uint32_t gu32_rx1_slot_ind_time_flag = 0; +uint32_t gu32_rx1_slot_time = 0; + +uint32_t rx1_callback_data(const char* buf,uint32_t payloadSize) +{ + uint32_t stc_cnt = read_stc_local_timer(); + uint32_t value = *(uint32_t *)buf; + uint16_t sfn = value >> 16; + uint16_t slot = value & 0xffff; + uint32_t diff = 0; + + gu32_rx1_slot_ind_flag = 1; + if(0 == gu32_rx1_slot_ind_time_flag) + { + gu32_rx1_slot_ind_time_flag = 1; + diff = 500000; + } + else + { + diff = stc_cnt - gu32_rx1_slot_time; + } + gu32_rx1_slot_time = stc_cnt; + + if ((diff > 520000) || (diff < 480000)) + { + UCP_PRINT_ERROR("[1],qNO[%d],sfn[%d],slot[%d],diff[%d]",UCP4008_TRAFFIC_NR_eMBB_DATA,sfn,slot,diff); + } + + return payloadSize; +} + +uint32_t rx_callback_ctrl(const char* buf,uint32_t payloadSize) +{ + return payloadSize; +} + +static inline void get_msg_transfer_info(uint16_t port_index, uint16_t inst_id, uint16_t transfer_type, transfer_type_info_s* transfer_type_info_ptr) +{ + queue_info_s c_plane,u_plane; + + switch (transfer_type) { + case CU_SPLIT: + c_plane.rx_block_size = 0x25800; + c_plane.rx_block_num = 32; + c_plane.rx_callback = rx_callback_ctrl; + c_plane.tx_block_size = 0x8000; + c_plane.tx_block_num = 8; + c_plane.tx_callback = NULL; + + u_plane.rx_block_size = 0x28000; + u_plane.rx_block_num = 8; + //u_plane.rx_callback = rx_callback_data; + if (0 == inst_id) + { + u_plane.rx_callback = rx_callback_data; + } + else + { + u_plane.rx_callback = rx1_callback_data; + } + u_plane.tx_block_size = 0x28000; + u_plane.tx_block_num = 8; + u_plane.tx_callback = NULL; + + transfer_type_info_ptr->queue_cplane_info = c_plane; + transfer_type_info_ptr->queue_uplane_info = u_plane; + break; + case OAM: + c_plane.rx_block_size = 0x100000; + c_plane.rx_block_num = 32; + c_plane.rx_callback = rx_callback_oam; + c_plane.tx_block_size = 0x8000; + c_plane.tx_block_num = 8; + c_plane.tx_callback = NULL; + + transfer_type_info_ptr->queue_cplane_info = c_plane; + break; + default: + UCP_PRINT_ERROR("get_msg_queue_cfg doesn't support transfer_type[%d] .",transfer_type); + break; + } + + return; +} + +static inline void msg_transfer_cfg(void) +{ + uint8_t port_id = 0; + uint16_t inst_id = 0; + uint16_t transfer_type = 0; + int32_t handle_id = 0; + transfer_type_info_s transfer_type_info; + + for (inst_id=0; inst_idpSyncInfo->queueCfgFlag = ++pMsgQueueLocalMgt->localSyncInfo.queueCfgFlag; + + return; +} + +static inline void msg_transfer_queue_polling(void) +{ + uint8_t port_id = 0; + HandleId_t handler; + uint16_t cu_flag; + uint32_t offset = 0; + uint32_t len = 0; + uint8_t* msg_ptr; + + for (uint32_t i = 0; i < MAX_INSTANCE_NUM; i++) { + handler.port_id = port_id; + handler.inst_id = i; + handler.type_id = CU_SPLIT; + cu_flag = C_PLANE; + msg_transfer_receive(handler.value, cu_flag, offset, len, &msg_ptr); + + cu_flag = U_PLANE; + msg_transfer_receive(handler.value, cu_flag, offset, len, &msg_ptr); + + handler.type_id = OAM; + msg_transfer_receive(handler.value, cu_flag, offset, len, &msg_ptr); + } + + return; +} + +#define CELL_SETUP_TYPE_SIMULATION (0x5a6b7c8d) + +void cell_setup_simulation() +{ + uint32_t size = 16; + char* buf; + uint32_t availableSize,offset; + + uint16_t cu_flag = C_PLANE; + HandleId_t handler; + handler.port_id = 0; + handler.inst_id = 0; + handler.type_id = CU_SPLIT; + + int32_t ret = msg_transfer_send_start(handler.value,cu_flag); + + /************C_PLANE***************/ + ret = msg_transfer_alloc_msg(handler.value, cu_flag, size, &buf, &availableSize, &offset); + if ( SUCCESS != ret) { + UCP_PRINT_ERROR("cell_setup_simulation call msg_transfer_alloc_msg err."); + return ; + //continue; + } + + *(uint32_t*)(buf + 0) = CELL_SETUP_TYPE_SIMULATION; + *(uint32_t*)(buf + 4) = read_stc_local_timer(); + + ret = msg_transfer_send_msg(handler.value, cu_flag, (uint8_t *)buf, offset, size); + ret = msg_transfer_send_end(handler.value,cu_flag); + + return; +} + +int32_t test_case(uint32_t argc, int32_t* argvp) +{ + UCP_PRINT_DEBUG("start running testcase 21 (8 ape 30K case)."); + + osp_read_spe_cfg_file("/ramfs/cfgDat"); + + msg_transfer_mem_init(); + msg_transfer_cfg(); + ucp_handshake(); + + UCP_PRINT_DEBUG("start transfering message."); + + uint32_t size = 100; + char* buf; + uint32_t availableSize,offset; + uint8_t* ptr; + uint8_t u8_cell_flag = 0; + + uint16_t cu_flag = C_PLANE; + HandleId_t handler; + handler.port_id = 0; + handler.inst_id = 0; + handler.type_id = CU_SPLIT; + + int32_t ret; + + sleep(1); + + cell_setup_simulation(); /* the first cell */ + UCP_PRINT_DEBUG("call cell setup(1)"); + + while(1) + { + if ((20000 == gu32_rx_callback_data_cnt) && (0 == u8_cell_flag)) + { + /* 1st cell build ok after 10s */ + cell_setup_simulation(); /* the second cell */ + u8_cell_flag = 1; + UCP_PRINT_DEBUG("call cell setup(2)"); + } + + msg_transfer_queue_polling(); + + if(1 == slot_ind_flag) + { + slot_ind_flag = 0; + + handler.inst_id = 0; + + /************C_PLANE***************/ + cu_flag = C_PLANE; + ret = msg_transfer_send_start(handler.value,cu_flag); + + ret = msg_transfer_alloc_msg(handler.value, cu_flag, size, &buf, &availableSize, &offset); + if ( SUCCESS != ret) { + UCP_PRINT_ERROR("0,c_plane alloc error\r\n"); + continue; + } + + ptr = (uint8_t *)buf; + *(uint32_t*)(ptr + 0) = gu32_value; + *(uint32_t*)(ptr + 4) = gu32_tick_from_tx_ctrl; + *(uint32_t*)(ptr + 8) = gu32_tick_receive_ctrl; + *(uint32_t*)(ptr + 12) = read_stc_local_timer(); + + ret = msg_transfer_send_msg(handler.value, cu_flag, (uint8_t *)buf, offset, size); + if ( SUCCESS != ret) { + UCP_PRINT_ERROR("0,c_plane send error\r\n"); + } + + ret = msg_transfer_send_end(handler.value,cu_flag); + + /************U_PLANE***************/ + cu_flag = U_PLANE; + ret = msg_transfer_send_start(handler.value,cu_flag); + + ret = msg_transfer_alloc_msg(handler.value, cu_flag, size, &buf, &availableSize, &offset); + if ( SUCCESS != ret) { + UCP_PRINT_ERROR("0,u_plane alloc error\r\n"); + continue; + } + + ptr = (uint8_t *)buf; + *(uint32_t*)(ptr + 0) = gu32_value; + *(uint32_t*)(ptr + 4) = gu32_tick_from_tx_ctrl; + *(uint32_t*)(ptr + 8) = gu32_tick_receive_ctrl; + *(uint32_t*)(ptr + 12) = read_stc_local_timer(); + + ret = msg_transfer_send_msg(handler.value, cu_flag, (uint8_t *)buf, offset, size); + if ( SUCCESS != ret) { + UCP_PRINT_ERROR("0,u_plane send error\r\n"); + } + + ret = msg_transfer_send_end(handler.value,cu_flag); + } + if (1 == gu32_rx1_slot_ind_flag) + { + gu32_rx1_slot_ind_flag = 0; + + handler.inst_id = 1; + /************C_PLANE***************/ + cu_flag = C_PLANE; + ret = msg_transfer_send_start(handler.value,cu_flag); + + ret = msg_transfer_alloc_msg(handler.value, cu_flag, size, &buf, &availableSize, &offset); + if ( SUCCESS != ret) { + UCP_PRINT_ERROR("1,c_plane alloc error\r\n"); + continue; + } + + ptr = (uint8_t *)buf; + *(uint32_t*)(ptr + 0) = gu32_value; + *(uint32_t*)(ptr + 4) = gu32_tick_from_tx_ctrl; + *(uint32_t*)(ptr + 8) = gu32_tick_receive_ctrl; + *(uint32_t*)(ptr + 12) = read_stc_local_timer(); + + ret = msg_transfer_send_msg(handler.value, cu_flag, (uint8_t *)buf, offset, size); + if ( SUCCESS != ret) { + UCP_PRINT_ERROR("1,c_plane send error\r\n"); + } + + ret = msg_transfer_send_end(handler.value,cu_flag); + + /************U_PLANE***************/ + cu_flag = U_PLANE; + ret = msg_transfer_send_start(handler.value,cu_flag); + + ret = msg_transfer_alloc_msg(handler.value, cu_flag, size, &buf, &availableSize, &offset); + if ( SUCCESS != ret) { + UCP_PRINT_ERROR("1,u_plane alloc error\r\n"); + continue; + } + + ptr = (uint8_t *)buf; + *(uint32_t*)(ptr + 0) = gu32_value; + *(uint32_t*)(ptr + 4) = gu32_tick_from_tx_ctrl; + *(uint32_t*)(ptr + 8) = gu32_tick_receive_ctrl; + *(uint32_t*)(ptr + 12) = read_stc_local_timer(); + + ret = msg_transfer_send_msg(handler.value, cu_flag, (uint8_t *)buf, offset, size); + if ( SUCCESS != ret) { + UCP_PRINT_ERROR("1,u_plane send error\r\n"); + } + + ret = msg_transfer_send_end(handler.value,cu_flag); + } + } + return 0; +} + diff --git a/test/case22/8ape_case(15K).txt b/test/case22/8ape_case(15K).txt new file mode 100644 index 0000000..e69de29 diff --git a/test/case22/src/testcase22.c b/test/case22/src/testcase22.c new file mode 100644 index 0000000..bdfa131 --- /dev/null +++ b/test/case22/src/testcase22.c @@ -0,0 +1,402 @@ +// +FHDR------------------------------------------------------------ +// Copyright (c) 2022 SmartLogic. +// ALL RIGHTS RESERVED +// ----------------------------------------------------------------- +// Filename : test.c +// Author : xianfeng.du +// Created On : 2022-11-25 +// Last Modified : +// ----------------------------------------------------------------- +// Description: +// +// +// -FHDR------------------------------------------------------------ + +#include +#include +#include +#include + +#include "typedef.h" +#include "ucp_printf.h" +#include "msg_transfer_mem.h" +#include "pet_sm_mgt.h" +#include "ucp_handshake.h" +#include "ospShell.h" +#include "ospLog.h" +#include "ospCfgToBin.h" +#include "drv_init.h" + +uint32_t slot_ind_flag = 0; +uint32_t slot_ind_time_flag = 0; +uint32_t g_slot_time = 0; +uint32_t gu32_value = 0; +uint32_t gu32_tick_receive_ctrl = 0; +uint32_t gu32_tick_from_tx_ctrl = 0; + +uint32_t gu32_rx_callback_data_cnt = 0; + +uint32_t rx_callback_data(const char* buf,uint32_t payloadSize) +{ + uint32_t stc_cnt = read_stc_local_timer(); + uint32_t value = *(uint32_t *)buf; + uint16_t sfn = value >> 16; + uint16_t slot = value & 0xffff; + + uint32_t tick_from_tx_ctrl = *(uint32_t *)(buf+4); + + ++gu32_rx_callback_data_cnt; + slot_ind_flag = 1; + gu32_value = value; + gu32_tick_receive_ctrl = stc_cnt; + gu32_tick_from_tx_ctrl = tick_from_tx_ctrl; + uint32_t diff = stc_cnt - tick_from_tx_ctrl; + + if(0 == slot_ind_time_flag) + { + slot_ind_time_flag = 1; + diff = 1000000; + } + else + { + diff = stc_cnt - g_slot_time; + } + g_slot_time = stc_cnt; + + if ((diff > 1020000) || (diff < 980000)) + { + UCP_PRINT_ERROR("[0],qNO[%d],sfn[%d],slot[%d],diff[%d]",UCP4008_TRAFFIC_NR_eMBB_DATA,sfn,slot,diff); + } + return payloadSize; +} + +uint32_t gu32_rx1_slot_ind_flag = 0; +uint32_t gu32_rx1_slot_ind_time_flag = 0; +uint32_t gu32_rx1_slot_time = 0; + +uint32_t rx1_callback_data(const char* buf,uint32_t payloadSize) +{ + uint32_t stc_cnt = read_stc_local_timer(); + uint32_t value = *(uint32_t *)buf; + uint16_t sfn = value >> 16; + uint16_t slot = value & 0xffff; + uint32_t diff = 0; + + gu32_rx1_slot_ind_flag = 1; + if(0 == gu32_rx1_slot_ind_time_flag) + { + gu32_rx1_slot_ind_time_flag = 1; + diff = 1000000; + } + else + { + diff = stc_cnt - gu32_rx1_slot_time; + } + gu32_rx1_slot_time = stc_cnt; + + if ((diff > 1020000) || (diff < 980000)) + { + UCP_PRINT_ERROR("[1],qNO[%d],sfn[%d],slot[%d],diff[%d]",UCP4008_TRAFFIC_NR_eMBB_DATA,sfn,slot,diff); + } + + return payloadSize; +} + +uint32_t rx_callback_ctrl(const char* buf,uint32_t payloadSize) +{ + return payloadSize; +} + +static inline void get_msg_transfer_info(uint16_t port_index, uint16_t inst_id, uint16_t transfer_type, transfer_type_info_s* transfer_type_info_ptr) +{ + queue_info_s c_plane,u_plane; + + switch (transfer_type) { + case CU_SPLIT: + c_plane.rx_block_size = 0x25800; + c_plane.rx_block_num = 32; + c_plane.rx_callback = rx_callback_ctrl; + c_plane.tx_block_size = 0x8000; + c_plane.tx_block_num = 8; + c_plane.tx_callback = NULL; + + u_plane.rx_block_size = 0x28000; + u_plane.rx_block_num = 8; + //u_plane.rx_callback = rx_callback_data; + if (0 == inst_id) + { + u_plane.rx_callback = rx_callback_data; + } + else + { + u_plane.rx_callback = rx1_callback_data; + } + u_plane.tx_block_size = 0x28000; + u_plane.tx_block_num = 8; + u_plane.tx_callback = NULL; + + transfer_type_info_ptr->queue_cplane_info = c_plane; + transfer_type_info_ptr->queue_uplane_info = u_plane; + break; + case OAM: + c_plane.rx_block_size = 0x100000; + c_plane.rx_block_num = 32; + c_plane.rx_callback = rx_callback_oam; + c_plane.tx_block_size = 0x8000; + c_plane.tx_block_num = 8; + c_plane.tx_callback = NULL; + + transfer_type_info_ptr->queue_cplane_info = c_plane; + break; + default: + UCP_PRINT_ERROR("get_msg_queue_cfg doesn't support transfer_type[%d] .",transfer_type); + break; + } + + return; +} + +static inline void msg_transfer_cfg(void) +{ + uint8_t port_id = 0; + uint16_t inst_id = 0; + uint16_t transfer_type = 0; + int32_t handle_id = 0; + transfer_type_info_s transfer_type_info; + + for (inst_id=0; inst_idpSyncInfo->queueCfgFlag = ++pMsgQueueLocalMgt->localSyncInfo.queueCfgFlag; + + return; +} + +static inline void msg_transfer_queue_polling(void) +{ + uint8_t port_id = 0; + HandleId_t handler; + uint16_t cu_flag; + uint32_t offset = 0; + uint32_t len = 0; + uint8_t* msg_ptr; + + for (uint32_t i = 0; i < MAX_INSTANCE_NUM; i++) { + handler.port_id = port_id; + handler.inst_id = i; + handler.type_id = CU_SPLIT; + cu_flag = C_PLANE; + msg_transfer_receive(handler.value, cu_flag, offset, len, &msg_ptr); + + cu_flag = U_PLANE; + msg_transfer_receive(handler.value, cu_flag, offset, len, &msg_ptr); + + handler.type_id = OAM; + msg_transfer_receive(handler.value, cu_flag, offset, len, &msg_ptr); + } + + return; +} + +#define CELL_SETUP_TYPE_SIMULATION (0x5a6b7c8d) + +void cell_setup_simulation() +{ + uint32_t size = 16; + char* buf; + uint32_t availableSize,offset; + + uint16_t cu_flag = C_PLANE; + HandleId_t handler; + handler.port_id = 0; + handler.inst_id = 0; + handler.type_id = CU_SPLIT; + + int32_t ret = msg_transfer_send_start(handler.value,cu_flag); + + /************C_PLANE***************/ + ret = msg_transfer_alloc_msg(handler.value, cu_flag, size, &buf, &availableSize, &offset); + if ( SUCCESS != ret) { + UCP_PRINT_ERROR("cell_setup_simulation call msg_transfer_alloc_msg err."); + return ; + //continue; + } + + *(uint32_t*)(buf + 0) = CELL_SETUP_TYPE_SIMULATION; + *(uint32_t*)(buf + 4) = read_stc_local_timer(); + + ret = msg_transfer_send_msg(handler.value, cu_flag, (uint8_t *)buf, offset, size); + ret = msg_transfer_send_end(handler.value,cu_flag); + + return; +} + +int32_t test_case(uint32_t argc, int32_t* argvp) +{ + UCP_PRINT_DEBUG("start running testcase 22 (8 ape 15K case)."); + + osp_read_spe_cfg_file("/ramfs/cfgDat"); + + msg_transfer_mem_init(); + msg_transfer_cfg(); + ucp_handshake(); + + UCP_PRINT_DEBUG("start transfering message."); + + uint32_t size = 100; + char* buf; + uint32_t availableSize,offset; + uint8_t* ptr; + uint8_t u8_cell_flag = 0; + + uint16_t cu_flag = C_PLANE; + HandleId_t handler; + handler.port_id = 0; + handler.inst_id = 0; + handler.type_id = CU_SPLIT; + + int32_t ret; + + sleep(1); + + cell_setup_simulation(); /* the first cell */ + UCP_PRINT_DEBUG("call cell setup(1)"); + + while(1) + { + #if 1 + if ((10000 == gu32_rx_callback_data_cnt) && (0 == u8_cell_flag)) + { + /* 1st cell build ok after 10s */ + cell_setup_simulation(); /* the second cell */ + u8_cell_flag = 1; + UCP_PRINT_DEBUG("call cell setup(2)"); + } + #endif + + msg_transfer_queue_polling(); + + if(1 == slot_ind_flag) + { + slot_ind_flag = 0; + + handler.inst_id = 0; + + /************C_PLANE***************/ + cu_flag = C_PLANE; + ret = msg_transfer_send_start(handler.value,cu_flag); + + ret = msg_transfer_alloc_msg(handler.value, cu_flag, size, &buf, &availableSize, &offset); + if ( SUCCESS != ret) { + UCP_PRINT_ERROR("0,c_plane alloc error\r\n"); + continue; + } + + ptr = (uint8_t *)buf; + *(uint32_t*)(ptr + 0) = gu32_value; + *(uint32_t*)(ptr + 4) = gu32_tick_from_tx_ctrl; + *(uint32_t*)(ptr + 8) = gu32_tick_receive_ctrl; + *(uint32_t*)(ptr + 12) = read_stc_local_timer(); + + ret = msg_transfer_send_msg(handler.value, cu_flag, (uint8_t *)buf, offset, size); + if ( SUCCESS != ret) { + UCP_PRINT_ERROR("0,c_plane send error\r\n"); + } + + ret = msg_transfer_send_end(handler.value,cu_flag); + + /************U_PLANE***************/ + cu_flag = U_PLANE; + ret = msg_transfer_send_start(handler.value,cu_flag); + + ret = msg_transfer_alloc_msg(handler.value, cu_flag, size, &buf, &availableSize, &offset); + if ( SUCCESS != ret) { + UCP_PRINT_ERROR("0,u_plane alloc error\r\n"); + continue; + } + + ptr = (uint8_t *)buf; + *(uint32_t*)(ptr + 0) = gu32_value; + *(uint32_t*)(ptr + 4) = gu32_tick_from_tx_ctrl; + *(uint32_t*)(ptr + 8) = gu32_tick_receive_ctrl; + *(uint32_t*)(ptr + 12) = read_stc_local_timer(); + + ret = msg_transfer_send_msg(handler.value, cu_flag, (uint8_t *)buf, offset, size); + if ( SUCCESS != ret) { + UCP_PRINT_ERROR("0,u_plane send error\r\n"); + } + + ret = msg_transfer_send_end(handler.value,cu_flag); + } + if (1 == gu32_rx1_slot_ind_flag) + { + gu32_rx1_slot_ind_flag = 0; + + handler.inst_id = 1; + /************C_PLANE***************/ + cu_flag = C_PLANE; + ret = msg_transfer_send_start(handler.value,cu_flag); + + ret = msg_transfer_alloc_msg(handler.value, cu_flag, size, &buf, &availableSize, &offset); + if ( SUCCESS != ret) { + UCP_PRINT_ERROR("1,c_plane alloc error\r\n"); + continue; + } + + ptr = (uint8_t *)buf; + *(uint32_t*)(ptr + 0) = gu32_value; + *(uint32_t*)(ptr + 4) = gu32_tick_from_tx_ctrl; + *(uint32_t*)(ptr + 8) = gu32_tick_receive_ctrl; + *(uint32_t*)(ptr + 12) = read_stc_local_timer(); + + ret = msg_transfer_send_msg(handler.value, cu_flag, (uint8_t *)buf, offset, size); + if ( SUCCESS != ret) { + UCP_PRINT_ERROR("1,c_plane send error\r\n"); + } + + ret = msg_transfer_send_end(handler.value,cu_flag); + + /************U_PLANE***************/ + cu_flag = U_PLANE; + ret = msg_transfer_send_start(handler.value,cu_flag); + + ret = msg_transfer_alloc_msg(handler.value, cu_flag, size, &buf, &availableSize, &offset); + if ( SUCCESS != ret) { + UCP_PRINT_ERROR("1,u_plane alloc error\r\n"); + continue; + } + + ptr = (uint8_t *)buf; + *(uint32_t*)(ptr + 0) = gu32_value; + *(uint32_t*)(ptr + 4) = gu32_tick_from_tx_ctrl; + *(uint32_t*)(ptr + 8) = gu32_tick_receive_ctrl; + *(uint32_t*)(ptr + 12) = read_stc_local_timer(); + + ret = msg_transfer_send_msg(handler.value, cu_flag, (uint8_t *)buf, offset, size); + if ( SUCCESS != ret) { + UCP_PRINT_ERROR("1,u_plane send error\r\n"); + } + + ret = msg_transfer_send_end(handler.value,cu_flag); + } + } + return 0; +} + diff --git a/test/case50/PCIE_EP_arm_read_cfg.txt b/test/case50/PCIE_EP_arm_read_cfg.txt new file mode 100644 index 0000000..e69de29 diff --git a/test/case50/src/testcase50.c b/test/case50/src/testcase50.c new file mode 100644 index 0000000..e00da93 --- /dev/null +++ b/test/case50/src/testcase50.c @@ -0,0 +1,32 @@ +// +FHDR------------------------------------------------------------ +// Copyright (c) 2022 SmartLogic. +// ALL RIGHTS RESERVED +// ----------------------------------------------------------------- +// Filename : test.c +// Author : xianfeng.du +// Created On : 2022-11-25 +// Last Modified : +// ----------------------------------------------------------------- +// Description: +// +// +// -FHDR------------------------------------------------------------ + +#include +#include +#include + +#include "typedef.h" +#include "ucp_printf.h" + +extern uint8_t gu8_main_flag; + +int32_t test_case(uint32_t argc, int32_t* argvp) +{ + UCP_PRINT_DEBUG("start running testcase 50."); + + gu8_main_flag = 0; + + return 0; +} +