From ad9bb3d80aa19688cfc2615a46e79934d8598aca Mon Sep 17 00:00:00 2001 From: "lishuang.xie" Date: Mon, 28 Aug 2023 17:23:16 +0800 Subject: [PATCH] merge dev_ck_v2.1_feature#994#986 to dev_ck_v2.1 1. support New Feature#994 2. support New Feature#986 3. fix case3 by New Feature#1019 4. SPU(case34)+ARM(case0) pass 5. SPU(case44)+ARM(case0) pass 6. SPU(case21)+ARM(case21) pass 7. SPU(case14)+ARM(case3) pass 8. local case: test osp_read_spe_cfg_file() --- osp/inc/ospCfgToBin.h | 1 + osp/src/ospCfgToBin.c | 12 +-- test/case3/src/testcase.c | 206 +++++++++++++++++++------------------- 3 files changed, 110 insertions(+), 109 deletions(-) diff --git a/osp/inc/ospCfgToBin.h b/osp/inc/ospCfgToBin.h index d6e9ad9..313af0c 100644 --- a/osp/inc/ospCfgToBin.h +++ b/osp/inc/ospCfgToBin.h @@ -3,6 +3,7 @@ #define APE_CFG_FILE_NAME_LEN (64) #define APE_CFG_FILE_NUM (64) +#define APE_SPE_CFG_FILE_NUM (128) typedef struct OSP_CFG_FILE_REG { diff --git a/osp/src/ospCfgToBin.c b/osp/src/ospCfgToBin.c index 5702f17..87a843b 100644 --- a/osp/src/ospCfgToBin.c +++ b/osp/src/ospCfgToBin.c @@ -32,7 +32,7 @@ /* ARM <---> ARM */ #define ARM_SPE_CFG_PHY_SIZE (0x1400000) /* 约定在20M以内 */ #define ARM_SPE_CFG_INFO_ONE sizeof(osp_spe_cfg_file_reg) -#define ARM_SPE_CFG_INFO_SIZE (ARM_SPE_CFG_INFO_ONE * APE_CFG_FILE_NUM) +#define ARM_SPE_CFG_INFO_SIZE (ARM_SPE_CFG_INFO_ONE * APE_SPE_CFG_FILE_NUM) #define ARM_SPE_CFG_OFFSET (0x8A000000) /* 目前改到APE_PHY段,从0x1000 0000开始,故需要偏移0x8A00 0000 */ #if 0 @@ -52,7 +52,7 @@ uint64_t g_static_mem_size = 0; /***************************************************************************/ /* ARM <---> ARM */ -osp_spe_cfg_file_reg g_spe_osp_cfg_file_reg[APE_CFG_FILE_NUM]; +osp_spe_cfg_file_reg g_spe_osp_cfg_file_reg[APE_SPE_CFG_FILE_NUM]; uint32_t g_spe_osp_cfg_file_idx = 0; void *g_spe_ptr_static_mem = NULL; uint64_t g_spe_static_mem_size = 0; @@ -366,7 +366,7 @@ int32_t osp_read_spe_cfg_to_bin(char* in_path) system("rm -rf /ramfs/config_bak/*.*"); /* 遍历原始目录,获取所有文件的文件名及路径输出到:tmpfile */ - sprintf(cmd_string, "find /%s/* -name '*.dat' > tmpfile", in_path); + sprintf(cmd_string, "find %s/* -name '*.dat' > tmpfile", in_path); system(cmd_string); /* 遍历原始目录,获取所有文件的文件名输出到:tmpfilename */ @@ -380,7 +380,7 @@ int32_t osp_read_spe_cfg_to_bin(char* in_path) return OSP_FILE_ERROR; } /* 逐一转化(文本文件 --> 二进制文件 */ - while(osp_cfg_file_idx < APE_CFG_FILE_NUM) + while(osp_cfg_file_idx < APE_SPE_CFG_FILE_NUM) { /* 每行是原始文件的全路径 */ if (NULL == fgets(line_file_name_full, sizeof(line_file_name_full), file)) @@ -463,7 +463,7 @@ int32_t osp_spe_bin_cfg_file_to_ddr() return OSP_FILE_ERROR; } - while(osp_cfg_file_idx < APE_CFG_FILE_NUM) + while(osp_cfg_file_idx < APE_SPE_CFG_FILE_NUM) { /* 每行是原始文件的全路径 */ if (NULL == fgets(line_file_full_name, sizeof(line_file_full_name), file)) @@ -583,7 +583,7 @@ int32_t osp_get_cfg_file(char* name, uint64_t *paddr, uint32_t *psize) UCP_PRINT_ERROR("[osp_get_cfg_file]: name too long\r\n"); return OSP_ERROR; } - for (loop = 0; loop < APE_CFG_FILE_NUM; loop++) + for (loop = 0; loop < APE_SPE_CFG_FILE_NUM; loop++) { head = g_spe_osp_cfg_file_reg + loop; if (0 == memcmp(head->name, name, strlen(name))) diff --git a/test/case3/src/testcase.c b/test/case3/src/testcase.c index 97c5b7e..2a3c1b0 100644 --- a/test/case3/src/testcase.c +++ b/test/case3/src/testcase.c @@ -1,34 +1,34 @@ -// +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 "msg_transfer_layer.h" -#include "ucp_handshake.h" -#include "typedef.h" -#include "ucp_printf.h" -#include "msg_transfer_mem.h" -#include "ecs_sm_mgt.h" -#include "ucp_handshake.h" -#include "ospShell.h" -#include "ospLog.h" -#include "ospDump.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 "msg_transfer_layer.h" +#include "ucp_handshake.h" +#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 "ospDump.h" + 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; @@ -44,15 +44,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 = NULL; - } - else - { - u_plane.rx_callback = NULL; - } + } + else + { + u_plane.rx_callback = NULL; + } u_plane.tx_block_size = 0x28000; u_plane.tx_block_num = 8; u_plane.tx_callback = NULL; @@ -77,7 +77,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; @@ -103,67 +103,67 @@ 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; -} - -OSP_FUNCPTR arm_log_test() -{ - char abuf1[128] = "test1234test1234test1234test1234test1234test1234test1234test1234test1234test1234test1234test1234test1234test1234test1234test567"; - char abuf2[10] = "abcdefg\n"; - - osp_write_diaglog(abuf1, strlen(abuf1), 13, 0x61); - osp_write_diaglog(abuf2, strlen(abuf2), 13, 0x60); - - return OSP_OK; - -} - -int32_t test_case(uint32_t argc, int32_t* argvp) -{ - UCP_PRINT_DEBUG("start running testcase 3."); - - msg_transfer_mem_init(); - msg_transfer_cfg(); - ucp_handshake(); - - UCP_PRINT_DEBUG("start transfering message."); - - while(1) { - usleep(500); - msg_transfer_queue_polling(); - } - - return 0; -} - +} + +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; +} + +OSP_FUNCPTR arm_log_test() +{ + char abuf1[128] = "test1234test1234test1234test1234test1234test1234test1234test1234test1234test1234test1234test1234test1234test1234test1234test567"; + char abuf2[10] = "abcdefg\n"; + + osp_write_diaglog(abuf1, strlen(abuf1), 13, 0x61); + osp_write_diaglog(abuf2, strlen(abuf2), 13, 0x60); + + return OSP_OK; + +} + +int32_t test_case(uint32_t argc, int32_t* argvp) +{ + UCP_PRINT_DEBUG("start running testcase 3."); + + msg_transfer_mem_init(); + msg_transfer_cfg(); + ucp_handshake(); + + UCP_PRINT_DEBUG("start transfering message."); + + while(1) { + usleep(500); + msg_transfer_queue_polling(); + } + + return 0; +} +