update New Feature#1423 to dev_ck_v2.1

1. modifide: os/src/ospCfgToBin.c
    2. old: the spe cfg file write into ddr
       now: the spe cfg file write into malloc memory
    3. old: the spe cfg file's size less 20M
       now: the spe cfg file's size less 128M
    4. old: osp_get_cfg_file return the ddr address
       now: osp_get_cfg_file return the vir address
    5. Test:
       5.1 spu(case0)+arm(case0):  Pass
       5.2 spu(case14)+arm(case20):Pass
       5.3 spu(case20)+arm(case20):Pass
       5.4 spu(case21)+arm(case21):Pass
       5.5 spu(case34)+arm(case5): Pass
       5.6 spu(case44)+arm(case5): Pass
This commit is contained in:
lishuang.xie 2023-12-28 10:59:18 +08:00
parent 4485230eaa
commit 16c7a083f6

View File

@ -30,9 +30,10 @@
/***************************************************************************/ /***************************************************************************/
/* ARM <---> ARM */ /* ARM <---> ARM */
#define ARM_SPE_CFG_PHY_SIZE (0x1400000) /* 约定在20M以内 */ #define ARM_SPE_CFG_PHY_SIZE (0x8000000) /* 改到系统内存约定大小为128M */ //(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_SPE_CFG_FILE_NUM) #define ARM_SPE_CFG_INFO_SIZE (ARM_SPE_CFG_INFO_ONE * APE_SPE_CFG_FILE_NUM)
#define ARM_SPE_CFG_FILE_SIZE (ARM_SPE_CFG_PHY_SIZE - ARM_SPE_CFG_INFO_SIZE - ARM_CFG_INDXN) /* 特殊配置文件总长度 */
#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
@ -322,16 +323,19 @@ int32_t osp_spe_cfg_file_init()
g_spe_osp_cfg_file_idx = 0; g_spe_osp_cfg_file_idx = 0;
g_spe_static_mem_size = 0; g_spe_static_mem_size = 0;
#if 0 #if 1
/* 改成从系统内存中分配128M */
g_spe_ptr_static_mem = malloc(ARM_SPE_CFG_PHY_SIZE); g_spe_ptr_static_mem = malloc(ARM_SPE_CFG_PHY_SIZE);
if (NULL == g_spe_ptr_static_mem) if (NULL == g_spe_ptr_static_mem)
{ {
UCP_PRINT_ERROR("get_static_mem(ARM_STACK) error......\r\n"); UCP_PRINT_ERROR("malloc(128M) for spe cfg error......\r\n");
return OSP_ERROR; return OSP_ERROR;
} }
g_spe_static_mem_size = ARM_SPE_CFG_PHY_SIZE;
return OSP_OK; return OSP_OK;
#endif #endif
#if 0
g_spe_ptr_static_mem = get_static_mem(APE_PHY, &g_spe_static_mem_size); g_spe_ptr_static_mem = get_static_mem(APE_PHY, &g_spe_static_mem_size);
if (0 == g_spe_static_mem_size) if (0 == g_spe_static_mem_size)
{ {
@ -339,7 +343,7 @@ int32_t osp_spe_cfg_file_init()
return OSP_ERROR; return OSP_ERROR;
} }
g_spe_ptr_static_mem += ARM_SPE_CFG_OFFSET; /* 在内存规划中,配置文件的起始地址需要偏移 */ g_spe_ptr_static_mem += ARM_SPE_CFG_OFFSET; /* 在内存规划中,配置文件的起始地址需要偏移 */
#endif
return OSP_OK; return OSP_OK;
} }
@ -503,6 +507,16 @@ int32_t osp_spe_bin_cfg_file_to_ddr()
file_len = (uint32_t)ftell(read_file); file_len = (uint32_t)ftell(read_file);
UCP_PRINT_DEBUG("[to_ddr]: file: %s ,Size: %d\r\n", line_file_full_name, file_len); UCP_PRINT_DEBUG("[to_ddr]: file: %s ,Size: %d\r\n", line_file_full_name, file_len);
/* 保护:文件太多,空间不够 */
if ((file_len + ddr_offset) > ARM_SPE_CFG_FILE_SIZE)
{
UCP_PRINT_ERROR("[to_ddr]: too much file, no space... \r\n");
fclose(read_file);
fclose(file);
system("rm tmpfile");
return OSP_ERROR;
}
/* 回到文件头部 */ /* 回到文件头部 */
ret = fseek(read_file, 0, SEEK_SET); ret = fseek(read_file, 0, SEEK_SET);
@ -583,14 +597,14 @@ 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_SPE_CFG_FILE_NUM; loop++) for (loop = 0; loop < g_spe_osp_cfg_file_idx; 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)))
{ {
/* 物理层需要物理地址,而还是虚拟地址 */ /* 物理层需要物理地址,而还是虚拟地址 */
osp_virt_to_phy(APE_PHY, head->vir_addr, paddr); //osp_virt_to_phy(APE_PHY, head->vir_addr, paddr);
//*paddr = head->vir_addr; *paddr = head->vir_addr;
*psize = head->len; *psize = head->len;
return OSP_OK; return OSP_OK;
} }