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()
This commit is contained in:
lishuang.xie 2023-08-28 17:23:16 +08:00
parent 8450335667
commit ad9bb3d80a
3 changed files with 110 additions and 109 deletions

View File

@ -3,6 +3,7 @@
#define APE_CFG_FILE_NAME_LEN (64) #define APE_CFG_FILE_NAME_LEN (64)
#define APE_CFG_FILE_NUM (64) #define APE_CFG_FILE_NUM (64)
#define APE_SPE_CFG_FILE_NUM (128)
typedef struct OSP_CFG_FILE_REG typedef struct OSP_CFG_FILE_REG
{ {

View File

@ -32,7 +32,7 @@
/* ARM <---> ARM */ /* ARM <---> ARM */
#define ARM_SPE_CFG_PHY_SIZE (0x1400000) /* 约定在20M以内 */ #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_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 */ #define ARM_SPE_CFG_OFFSET (0x8A000000) /* 目前改到APE_PHY段从0x1000 0000开始故需要偏移0x8A00 0000 */
#if 0 #if 0
@ -52,7 +52,7 @@ uint64_t g_static_mem_size = 0;
/***************************************************************************/ /***************************************************************************/
/* ARM <---> ARM */ /* 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; uint32_t g_spe_osp_cfg_file_idx = 0;
void *g_spe_ptr_static_mem = NULL; void *g_spe_ptr_static_mem = NULL;
uint64_t g_spe_static_mem_size = 0; 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/*.*"); system("rm -rf /ramfs/config_bak/*.*");
/* 遍历原始目录,获取所有文件的文件名及路径输出到:tmpfile */ /* 遍历原始目录,获取所有文件的文件名及路径输出到:tmpfile */
sprintf(cmd_string, "find /%s/* -name '*.dat' > tmpfile", in_path); sprintf(cmd_string, "find %s/* -name '*.dat' > tmpfile", in_path);
system(cmd_string); system(cmd_string);
/* 遍历原始目录,获取所有文件的文件名输出到:tmpfilename */ /* 遍历原始目录,获取所有文件的文件名输出到:tmpfilename */
@ -380,7 +380,7 @@ int32_t osp_read_spe_cfg_to_bin(char* in_path)
return OSP_FILE_ERROR; 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)) 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; 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)) 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"); UCP_PRINT_ERROR("[osp_get_cfg_file]: name too long\r\n");
return OSP_ERROR; 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; head = g_spe_osp_cfg_file_reg + loop;
if (0 == memcmp(head->name, name, strlen(name))) if (0 == memcmp(head->name, name, strlen(name)))

View File

@ -1,34 +1,34 @@
// +FHDR------------------------------------------------------------ // +FHDR------------------------------------------------------------
// Copyright (c) 2022 SmartLogic. // Copyright (c) 2022 SmartLogic.
// ALL RIGHTS RESERVED // ALL RIGHTS RESERVED
// ----------------------------------------------------------------- // -----------------------------------------------------------------
// Filename : test.c // Filename : test.c
// Author : xianfeng.du // Author : xianfeng.du
// Created On : 2022-11-25 // Created On : 2022-11-25
// Last Modified : // Last Modified :
// ----------------------------------------------------------------- // -----------------------------------------------------------------
// Description: // Description:
// //
// //
// -FHDR------------------------------------------------------------ // -FHDR------------------------------------------------------------
#include <stddef.h> #include <stddef.h>
#include <string.h> #include <string.h>
#include <sys/time.h> #include <sys/time.h>
#include <unistd.h> #include <unistd.h>
#include "typedef.h" #include "typedef.h"
#include "msg_transfer_layer.h" #include "msg_transfer_layer.h"
#include "ucp_handshake.h" #include "ucp_handshake.h"
#include "typedef.h" #include "typedef.h"
#include "ucp_printf.h" #include "ucp_printf.h"
#include "msg_transfer_mem.h" #include "msg_transfer_mem.h"
#include "ecs_sm_mgt.h" #include "pet_sm_mgt.h"
#include "ucp_handshake.h" #include "ucp_handshake.h"
#include "ospShell.h" #include "ospShell.h"
#include "ospLog.h" #include "ospLog.h"
#include "ospDump.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) 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; 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_size = 0x28000;
u_plane.rx_block_num = 8; u_plane.rx_block_num = 8;
//u_plane.rx_callback = rx_callback_data; //u_plane.rx_callback = rx_callback_data;
if (0 == inst_id) if (0 == inst_id)
{ {
u_plane.rx_callback = NULL; u_plane.rx_callback = NULL;
} }
else else
{ {
u_plane.rx_callback = NULL; u_plane.rx_callback = NULL;
} }
u_plane.tx_block_size = 0x28000; u_plane.tx_block_size = 0x28000;
u_plane.tx_block_num = 8; u_plane.tx_block_num = 8;
u_plane.tx_callback = NULL; 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; return;
} }
static inline void msg_transfer_cfg(void) static inline void msg_transfer_cfg(void)
{ {
uint8_t port_id = 0; 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); UCP_PRINT_ERROR("phy_cfg_init transfer_type:OAM, handle_id[0x%08x] error.",handle_id);
} }
} }
PetSmLocalMgt_t* pPetSmLocalMgt = get_pet_sm_local_mgt(); PetSmLocalMgt_t* pPetSmLocalMgt = get_pet_sm_local_mgt();
MsgQueueLocalMgt_t* pMsgQueueLocalMgt = get_msg_queue_local_mgt(); MsgQueueLocalMgt_t* pMsgQueueLocalMgt = get_msg_queue_local_mgt();
pPetSmLocalMgt->pSyncInfo->queueCfgFlag = ++pMsgQueueLocalMgt->localSyncInfo.queueCfgFlag; pPetSmLocalMgt->pSyncInfo->queueCfgFlag = ++pMsgQueueLocalMgt->localSyncInfo.queueCfgFlag;
return; return;
} }
static inline void msg_transfer_queue_polling(void) static inline void msg_transfer_queue_polling(void)
{ {
uint8_t port_id = 0; uint8_t port_id = 0;
HandleId_t handler; HandleId_t handler;
uint16_t cu_flag; uint16_t cu_flag;
uint32_t offset = 0; uint32_t offset = 0;
uint32_t len = 0; uint32_t len = 0;
uint8_t* msg_ptr; uint8_t* msg_ptr;
for (uint32_t i = 0; i < MAX_INSTANCE_NUM; i++) { for (uint32_t i = 0; i < MAX_INSTANCE_NUM; i++) {
handler.port_id = port_id; handler.port_id = port_id;
handler.inst_id = i; handler.inst_id = i;
handler.type_id = CU_SPLIT; handler.type_id = CU_SPLIT;
cu_flag = C_PLANE; cu_flag = C_PLANE;
msg_transfer_receive(handler.value, cu_flag, offset, len, &msg_ptr); msg_transfer_receive(handler.value, cu_flag, offset, len, &msg_ptr);
cu_flag = U_PLANE; cu_flag = U_PLANE;
msg_transfer_receive(handler.value, cu_flag, offset, len, &msg_ptr); msg_transfer_receive(handler.value, cu_flag, offset, len, &msg_ptr);
handler.type_id = OAM; handler.type_id = OAM;
msg_transfer_receive(handler.value, cu_flag, offset, len, &msg_ptr); msg_transfer_receive(handler.value, cu_flag, offset, len, &msg_ptr);
} }
return; return;
} }
OSP_FUNCPTR arm_log_test() OSP_FUNCPTR arm_log_test()
{ {
char abuf1[128] = "test1234test1234test1234test1234test1234test1234test1234test1234test1234test1234test1234test1234test1234test1234test1234test567"; char abuf1[128] = "test1234test1234test1234test1234test1234test1234test1234test1234test1234test1234test1234test1234test1234test1234test1234test567";
char abuf2[10] = "abcdefg\n"; char abuf2[10] = "abcdefg\n";
osp_write_diaglog(abuf1, strlen(abuf1), 13, 0x61); osp_write_diaglog(abuf1, strlen(abuf1), 13, 0x61);
osp_write_diaglog(abuf2, strlen(abuf2), 13, 0x60); osp_write_diaglog(abuf2, strlen(abuf2), 13, 0x60);
return OSP_OK; return OSP_OK;
} }
int32_t test_case(uint32_t argc, int32_t* argvp) int32_t test_case(uint32_t argc, int32_t* argvp)
{ {
UCP_PRINT_DEBUG("start running testcase 3."); UCP_PRINT_DEBUG("start running testcase 3.");
msg_transfer_mem_init(); msg_transfer_mem_init();
msg_transfer_cfg(); msg_transfer_cfg();
ucp_handshake(); ucp_handshake();
UCP_PRINT_DEBUG("start transfering message."); UCP_PRINT_DEBUG("start transfering message.");
while(1) { while(1) {
usleep(500); usleep(500);
msg_transfer_queue_polling(); msg_transfer_queue_polling();
} }
return 0; return 0;
} }