update New Feature#1737 from dev_ck_v2.1_featuer#1737# to dev_ck_v2.1
1. modified the function: int32_t osp_read_spe_cfg_file(char* path, uint8_t cellid), add the cellid 2. modified the function: int32_t osp_get_cfg_file(char* name, uint8_t cellid, uint64_t *paddr, uint32_t *psize);, add the cellid 3. modified the interface file 4. modified the testcase which used the functions 5. Test: 5.1 spu_case0_arm_case0_cpri: Pass 5.2 spu_case14_arm_caes20_cpri:Pass 5.3 spu_case20_arm_case20_cpri:Pass 5.4 spu_case24_arm_case24_cpri:Pass 5.5 spu_case34_arm_case5: Pass 5.6 spu_case44_arm_case5: Pass
This commit is contained in:
parent
97f95befc5
commit
fe2787d53f
@ -104,18 +104,20 @@ OSP_STATUS osp_arm_log_proc(char *pbuf, uint32_t len ,uint32_t logid, uint32_t m
|
||||
/*
|
||||
name: osp_read_spe_cfg_file
|
||||
para: Input: path: the config file's path
|
||||
para: Input: cellid: the index of the cell
|
||||
brief: load the spe config file by the path
|
||||
*/
|
||||
int32_t osp_read_spe_cfg_file(char* path);
|
||||
int32_t osp_read_spe_cfg_file(char* path, uint8_t cellid);
|
||||
|
||||
/*
|
||||
name: osp_get_cfg_file
|
||||
para: Input: name: the config file's name
|
||||
para: Input: cellid: the index of the cell
|
||||
para: Output: paddr: the config file's address
|
||||
para: Output: psize: the config file's size
|
||||
brief: get a config file's address and size
|
||||
*/
|
||||
int32_t osp_get_cfg_file(char* name, uint64_t *paddr, uint32_t *psize);
|
||||
int32_t osp_get_cfg_file(char* name, uint8_t cellid, uint64_t *paddr, uint32_t *psize);
|
||||
|
||||
int32_t get_clock_module_status(volatile clock_module_status_s* clk_module_status_ptr);
|
||||
int32_t set_clk_mode(clk_flag_e pseudo_flag);
|
||||
|
@ -25,8 +25,8 @@ extern int32_t osp_read_cfg_file(void);
|
||||
|
||||
|
||||
/* TestMac interface */
|
||||
extern int32_t osp_read_spe_cfg_file(char* path);
|
||||
extern int32_t osp_get_cfg_file(char* name, uint64_t *paddr, uint32_t *psize);
|
||||
extern int32_t osp_read_spe_cfg_file(char* path, uint8_t cellid);
|
||||
extern int32_t osp_get_cfg_file(char* name, uint8_t cellid, uint64_t *paddr, uint32_t *psize);
|
||||
|
||||
#ifdef HEARTBEAT_ENABLE
|
||||
extern int8_t osp_get_im2ddr_to_file(uint8_t u8CoreId);
|
||||
|
@ -31,11 +31,25 @@
|
||||
/***************************************************************************/
|
||||
/* ARM <---> ARM */
|
||||
#define ARM_SPE_CFG_PHY_SIZE (0x3000000) /* 改到系统内存,约定大小为128M */ //(0x1400000) /* 约定在20M以内 */
|
||||
#define ARM_SPE_CFG_PHY_SIZE0 (0x03000000)
|
||||
#define ARM_SPE_CFG_PHY_SIZE1 (0x02000000)
|
||||
#define ARM_SPE_CFG_PHY_SIZE2 (0x01000000)
|
||||
#define ARM_SPE_CFG_PHY_SIZE3 (0x01000000)
|
||||
#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_FILE_SIZE (ARM_SPE_CFG_PHY_SIZE - ARM_SPE_CFG_INFO_SIZE - ARM_CFG_INDXN) /* 特殊配置文件总长度 */
|
||||
//#define ARM_SPE_CFG_FILE_SIZE (ARM_SPE_CFG_PHY_SIZE - ARM_SPE_CFG_INFO_SIZE - ARM_CFG_INDXN) /* 特殊配置文件总长度 */
|
||||
#define ARM_SPE_CFG_FILE_SIZE0 (ARM_SPE_CFG_PHY_SIZE0 - ARM_SPE_CFG_INFO_SIZE - ARM_CFG_INDXN) /* 特殊配置文件总长度 */
|
||||
#define ARM_SPE_CFG_FILE_SIZE1 (ARM_SPE_CFG_PHY_SIZE1 - ARM_SPE_CFG_INFO_SIZE - ARM_CFG_INDXN) /* 特殊配置文件总长度 */
|
||||
#define ARM_SPE_CFG_FILE_SIZE2 (ARM_SPE_CFG_PHY_SIZE2 - ARM_SPE_CFG_INFO_SIZE - ARM_CFG_INDXN) /* 特殊配置文件总长度 */
|
||||
#define ARM_SPE_CFG_FILE_SIZE3 (ARM_SPE_CFG_PHY_SIZE3 - ARM_SPE_CFG_INFO_SIZE - ARM_CFG_INDXN) /* 特殊配置文件总长度 */
|
||||
|
||||
#define ARM_SPE_CFG_OFFSET (0x89000000) /* 目前改到APE_PHY段,从0x1000 0000开始,故需要偏移0x8900 0000 */
|
||||
|
||||
#define ARM_SPE_CFG_OFFSET_CELL0 (0x85000000) /* 目前在APE_PHY段,CELL0在0x9500 0000开始48M */
|
||||
#define ARM_SPE_CFG_OFFSET_CELL1 (0x88000000) /* 目前在APE_PHY段,CELL1在0x9800 0000开始32M */
|
||||
#define ARM_SPE_CFG_OFFSET_CELL2 (0x8A000000) /* 目前在APE_PHY段,CELL2在0x9A00 0000开始16M */
|
||||
#define ARM_SPE_CFG_OFFSET_CELL3 (0x8B000000) /* 目前在APE_PHY段,CELL3在0x9B00 0000开始16M */
|
||||
|
||||
#if 0
|
||||
#define ARM_SPE_CFG_PHY_ADDR (0xB8000000) /* 指定配置文件首地址 */
|
||||
#define ARM_SPE_CFG_PHY_SIZE (0x10000) /* 指定配置文件区域长度:64K */
|
||||
@ -53,9 +67,12 @@ uint64_t g_static_mem_size = 0;
|
||||
|
||||
/***************************************************************************/
|
||||
/* ARM <---> ARM */
|
||||
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;
|
||||
#define SPE_OSP_CFG_CELL_ID (4)
|
||||
|
||||
osp_spe_cfg_file_reg g_spe_osp_cfg_file_reg[SPE_OSP_CFG_CELL_ID][APE_SPE_CFG_FILE_NUM];
|
||||
uint32_t g_spe_osp_cfg_file_idx[SPE_OSP_CFG_CELL_ID] = {0};
|
||||
void *g_spe_ptr_static_mem = NULL;
|
||||
void *g_spe_ptr_static_mem_bycell[SPE_OSP_CFG_CELL_ID] = {0};
|
||||
uint64_t g_spe_static_mem_size = 0;
|
||||
|
||||
/***************************************************************************/
|
||||
@ -317,11 +334,10 @@ int32_t osp_read_cfg_file(void)
|
||||
|
||||
/***************************************************************************/
|
||||
/* ARM <---> ARM */
|
||||
int32_t osp_spe_cfg_file_init()
|
||||
int32_t osp_spe_cfg_file_init(uint8_t cellid)
|
||||
{
|
||||
memset(&g_spe_osp_cfg_file_reg, 0, sizeof(g_spe_osp_cfg_file_reg));
|
||||
g_spe_osp_cfg_file_idx = 0;
|
||||
//g_spe_static_mem_size = 0;
|
||||
memset(&g_spe_osp_cfg_file_reg[cellid], 0, sizeof(osp_spe_cfg_file_reg)*APE_SPE_CFG_FILE_NUM);
|
||||
g_spe_osp_cfg_file_idx[cellid] = 0;
|
||||
|
||||
#if 0
|
||||
/* 改成从系统内存中分配128M */
|
||||
@ -340,7 +356,11 @@ int32_t osp_spe_cfg_file_init()
|
||||
UCP_PRINT_ERROR("get_static_mem(ARM_STACK) error......\r\n");
|
||||
return OSP_ERROR;
|
||||
}
|
||||
g_spe_ptr_static_mem += ARM_SPE_CFG_OFFSET; /* 在内存规划中,配置文件的起始地址需要偏移 */
|
||||
g_spe_ptr_static_mem_bycell[0] = g_spe_ptr_static_mem + ARM_SPE_CFG_OFFSET_CELL0;
|
||||
g_spe_ptr_static_mem_bycell[1] = g_spe_ptr_static_mem + ARM_SPE_CFG_OFFSET_CELL1;
|
||||
g_spe_ptr_static_mem_bycell[2] = g_spe_ptr_static_mem + ARM_SPE_CFG_OFFSET_CELL2;
|
||||
g_spe_ptr_static_mem_bycell[3] = g_spe_ptr_static_mem + ARM_SPE_CFG_OFFSET_CELL3;
|
||||
//g_spe_ptr_static_mem += ARM_SPE_CFG_OFFSET; /* 在内存规划中,配置文件的起始地址需要偏移 */
|
||||
#endif
|
||||
return OSP_OK;
|
||||
}
|
||||
@ -437,7 +457,7 @@ int32_t osp_read_spe_cfg_to_bin(char* in_path)
|
||||
return OSP_OK;
|
||||
}
|
||||
|
||||
int32_t osp_spe_bin_cfg_file_to_ddr()
|
||||
int32_t osp_spe_bin_cfg_file_to_ddr(uint8_t cellid)
|
||||
{
|
||||
char *p_line_file_name = NULL;
|
||||
char *p_line_file_name_begin = NULL;
|
||||
@ -446,10 +466,11 @@ int32_t osp_spe_bin_cfg_file_to_ddr()
|
||||
|
||||
uint32_t len = 0;
|
||||
uint32_t tmp_len = 0;
|
||||
uint8_t osp_cfg_file_idx = 0; /* 文件个数 */
|
||||
uint8_t osp_cfg_file_idx = 0; /* 文件个数 */
|
||||
uint32_t ret = 0; /* 返回值判断 */
|
||||
uint32_t file_len = 0; /* 文件长度 */
|
||||
uint32_t ddr_offset = 0;
|
||||
uint32_t u32file_all_size = 0;
|
||||
|
||||
FILE *file = NULL;
|
||||
FILE *read_file = NULL;
|
||||
@ -506,7 +527,32 @@ int32_t osp_spe_bin_cfg_file_to_ddr()
|
||||
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)
|
||||
if (0 == cellid)
|
||||
{
|
||||
u32file_all_size = ARM_SPE_CFG_FILE_SIZE0;
|
||||
}
|
||||
else if (1 == cellid)
|
||||
{
|
||||
u32file_all_size = ARM_SPE_CFG_FILE_SIZE1;
|
||||
}
|
||||
else if (2 == cellid)
|
||||
{
|
||||
u32file_all_size = ARM_SPE_CFG_FILE_SIZE2;
|
||||
}
|
||||
else if (3 == cellid)
|
||||
{
|
||||
u32file_all_size = ARM_SPE_CFG_FILE_SIZE3;
|
||||
}
|
||||
else
|
||||
{
|
||||
UCP_PRINT_ERROR("[to_ddr]: too much file, no space... \r\n");
|
||||
fclose(read_file);
|
||||
fclose(file);
|
||||
system("rm tmpfile");
|
||||
return OSP_ERROR;
|
||||
}
|
||||
|
||||
if ((file_len + ddr_offset) > u32file_all_size)
|
||||
{
|
||||
UCP_PRINT_ERROR("[to_ddr]: too much file, no space... \r\n");
|
||||
fclose(read_file);
|
||||
@ -522,18 +568,19 @@ int32_t osp_spe_bin_cfg_file_to_ddr()
|
||||
len = 0;
|
||||
while(len < file_len)
|
||||
{
|
||||
tmp_len = fread((char*)(g_spe_ptr_static_mem+ARM_CFG_INDXN+ARM_SPE_CFG_INFO_SIZE+ddr_offset+len), 1, file_len, read_file);
|
||||
tmp_len = fread((char*)(g_spe_ptr_static_mem_bycell[cellid]+ARM_CFG_INDXN+ARM_SPE_CFG_INFO_SIZE+ddr_offset+len), 1, file_len, read_file);
|
||||
//tmp_len = fread((char*)(g_spe_ptr_static_mem+ARM_CFG_INDXN+ARM_SPE_CFG_INFO_SIZE+ddr_offset+len), 1, file_len, read_file);
|
||||
len += tmp_len;
|
||||
}
|
||||
|
||||
/* 更新全局变量 */
|
||||
g_spe_osp_cfg_file_reg[g_spe_osp_cfg_file_idx].len = file_len;
|
||||
memcpy(g_spe_osp_cfg_file_reg[g_spe_osp_cfg_file_idx].name, file_name, strlen(file_name));
|
||||
g_spe_osp_cfg_file_reg[g_spe_osp_cfg_file_idx].vir_addr = (uint64_t)(g_spe_ptr_static_mem
|
||||
g_spe_osp_cfg_file_reg[cellid][osp_cfg_file_idx].len = file_len;
|
||||
memcpy(g_spe_osp_cfg_file_reg[cellid][osp_cfg_file_idx].name, file_name, strlen(file_name));
|
||||
g_spe_osp_cfg_file_reg[cellid][osp_cfg_file_idx].vir_addr = (uint64_t)(g_spe_ptr_static_mem_bycell[cellid]
|
||||
+ ARM_CFG_INDXN
|
||||
+ ARM_SPE_CFG_INFO_SIZE
|
||||
+ ddr_offset);
|
||||
g_spe_osp_cfg_file_idx++;
|
||||
g_spe_osp_cfg_file_idx[cellid]++;
|
||||
ddr_offset += file_len;
|
||||
|
||||
osp_cfg_file_idx++;
|
||||
@ -541,9 +588,9 @@ int32_t osp_spe_bin_cfg_file_to_ddr()
|
||||
}
|
||||
|
||||
/* 更新配置文件头信息 */
|
||||
*(uint32_t *)(g_spe_ptr_static_mem+ARM_CFG_NUM) = g_spe_osp_cfg_file_idx;
|
||||
memcpy((g_spe_ptr_static_mem + ARM_CFG_INDXN), g_spe_osp_cfg_file_reg, ARM_SPE_CFG_INFO_ONE * g_spe_osp_cfg_file_idx);
|
||||
*(uint32_t *)g_spe_ptr_static_mem = ARM_READ_CFG_FILE_OK;
|
||||
*(uint32_t *)(g_spe_ptr_static_mem_bycell[cellid]+ARM_CFG_NUM) = g_spe_osp_cfg_file_idx[cellid];
|
||||
memcpy((g_spe_ptr_static_mem_bycell[cellid] + ARM_CFG_INDXN), g_spe_osp_cfg_file_reg[cellid], ARM_SPE_CFG_INFO_ONE * g_spe_osp_cfg_file_idx[cellid]);
|
||||
*(uint32_t *)g_spe_ptr_static_mem_bycell[cellid] = ARM_READ_CFG_FILE_OK;
|
||||
|
||||
fclose(file);
|
||||
system("rm tmpfile");
|
||||
@ -556,12 +603,12 @@ int32_t osp_spe_bin_cfg_file_to_ddr()
|
||||
/********************************************************************/
|
||||
/* TestMac Interface */
|
||||
/********************************************************************/
|
||||
int32_t osp_read_spe_cfg_file(char* path)
|
||||
int32_t osp_read_spe_cfg_file(char* path, uint8_t cellid)
|
||||
{
|
||||
uint32_t ret = 0;
|
||||
|
||||
/* 每次调用前,清空全局变量 */
|
||||
ret = osp_spe_cfg_file_init();
|
||||
ret = osp_spe_cfg_file_init(cellid);
|
||||
if (OSP_OK != ret)
|
||||
{
|
||||
UCP_PRINT_ERROR("[osp_read_spe_cfg_file]: osp_cfg_file_init return error: %d\r\n", ret);
|
||||
@ -577,7 +624,7 @@ int32_t osp_read_spe_cfg_file(char* path)
|
||||
}
|
||||
|
||||
/* 转化 */
|
||||
ret = osp_spe_bin_cfg_file_to_ddr();
|
||||
ret = osp_spe_bin_cfg_file_to_ddr(cellid);
|
||||
if (OSP_OK != ret)
|
||||
{
|
||||
UCP_PRINT_ERROR("[osp_read_spe_cfg_file]: osp_spe_bin_cfg_file_to_ddr return error: %d\r\n", ret);
|
||||
@ -586,7 +633,7 @@ int32_t osp_read_spe_cfg_file(char* path)
|
||||
return OSP_OK;
|
||||
}
|
||||
|
||||
int32_t osp_get_cfg_file(char* name, uint64_t *paddr, uint32_t *psize)
|
||||
int32_t osp_get_cfg_file(char* name, uint8_t cellid, uint64_t *paddr, uint32_t *psize)
|
||||
{
|
||||
uint16_t loop = 0;
|
||||
osp_spe_cfg_file_reg *head = NULL;
|
||||
@ -595,9 +642,9 @@ 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 < g_spe_osp_cfg_file_idx; loop++)
|
||||
for (loop = 0; loop < g_spe_osp_cfg_file_idx[cellid]; loop++)
|
||||
{
|
||||
head = g_spe_osp_cfg_file_reg + loop;
|
||||
head = g_spe_osp_cfg_file_reg[cellid] + loop;
|
||||
if (0 == memcmp(head->name, name, strlen(name)))
|
||||
{
|
||||
/* 物理层需要物理地址,而还是虚拟地址 */
|
||||
|
@ -228,7 +228,7 @@ int32_t test_case(uint32_t argc, int32_t* argvp)
|
||||
{
|
||||
UCP_PRINT_DEBUG("start running testcase 0.");
|
||||
|
||||
osp_read_spe_cfg_file("/ramfs/cfgDat");
|
||||
osp_read_spe_cfg_file("/ramfs/cfgDat", 0);
|
||||
|
||||
msg_transfer_mem_init();
|
||||
msg_transfer_cfg();
|
||||
|
@ -230,7 +230,7 @@ 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");
|
||||
osp_read_spe_cfg_file("/ramfs/cfgDat", 0);
|
||||
|
||||
msg_transfer_mem_init();
|
||||
msg_transfer_cfg();
|
||||
|
@ -261,7 +261,7 @@ 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");
|
||||
osp_read_spe_cfg_file("/ramfs/cfgDat", 0);
|
||||
|
||||
msg_transfer_mem_init();
|
||||
msg_transfer_cfg();
|
||||
|
@ -260,7 +260,7 @@ 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");
|
||||
osp_read_spe_cfg_file("/ramfs/cfgDat", 0);
|
||||
|
||||
msg_transfer_mem_init();
|
||||
msg_transfer_cfg();
|
||||
|
@ -260,7 +260,7 @@ int32_t test_case(uint32_t argc, int32_t* argvp)
|
||||
{
|
||||
UCP_PRINT_DEBUG("start running testcase 23 (dual mode case).");
|
||||
|
||||
osp_read_spe_cfg_file("/ramfs/cfgDat");
|
||||
osp_read_spe_cfg_file("/ramfs/cfgDat", 0);
|
||||
|
||||
msg_transfer_mem_init();
|
||||
msg_transfer_cfg();
|
||||
|
@ -352,7 +352,19 @@ int32_t test_case(uint32_t argc, int32_t* argvp)
|
||||
{
|
||||
UCP_PRINT_DEBUG("start running testcase 24 (8 ape 15K case, 4 cells).");
|
||||
|
||||
osp_read_spe_cfg_file("/ramfs/cfgDat");
|
||||
uint64_t addr = 0;
|
||||
uint32_t fsize = 0;
|
||||
|
||||
osp_read_spe_cfg_file("/ramfs/cfgDat", 0);
|
||||
osp_read_spe_cfg_file("/ramfs/cfgDat", 1);
|
||||
osp_read_spe_cfg_file("/ramfs/cfgDat", 2);
|
||||
osp_read_spe_cfg_file("/ramfs/cfgDat", 3);
|
||||
|
||||
|
||||
osp_get_cfg_file("nr_csirs_cfg.dat", 0, &addr, &fsize);
|
||||
osp_get_cfg_file("nr_csirs_lut.dat", 1, &addr, &fsize);
|
||||
osp_get_cfg_file("nr_csirs_lut.dat", 2, &addr, &fsize);
|
||||
osp_get_cfg_file("nr_csirs_cfg.dat", 3, &addr, &fsize);
|
||||
|
||||
msg_transfer_mem_init();
|
||||
msg_transfer_cfg();
|
||||
|
@ -307,7 +307,7 @@ int32_t test_case(uint32_t argc, int32_t* argvp)
|
||||
{
|
||||
UCP_PRINT_DEBUG("start running testcase 45.");
|
||||
|
||||
osp_read_spe_cfg_file("/ramfs/cfgDat");
|
||||
osp_read_spe_cfg_file("/ramfs/cfgDat", 0);
|
||||
|
||||
msg_transfer_mem_init();
|
||||
msg_transfer_cfg();
|
||||
|
@ -307,7 +307,7 @@ int32_t test_case(uint32_t argc, int32_t* argvp)
|
||||
{
|
||||
UCP_PRINT_DEBUG("start running testcase 46.");
|
||||
|
||||
osp_read_spe_cfg_file("/ramfs/cfgDat");
|
||||
osp_read_spe_cfg_file("/ramfs/cfgDat", 0);
|
||||
|
||||
msg_transfer_mem_init();
|
||||
msg_transfer_cfg();
|
||||
|
@ -235,7 +235,7 @@ int32_t test_case(uint32_t argc, int32_t* argvp)
|
||||
{
|
||||
UCP_PRINT_DEBUG("start running testcase 48.");
|
||||
|
||||
osp_read_spe_cfg_file("/ramfs/cfgDat");
|
||||
osp_read_spe_cfg_file("/ramfs/cfgDat", 0);
|
||||
|
||||
msg_transfer_mem_init();
|
||||
msg_transfer_cfg();
|
||||
|
@ -228,7 +228,7 @@ int32_t test_case(uint32_t argc, int32_t* argvp)
|
||||
{
|
||||
UCP_PRINT_DEBUG("start running testcase 5.");
|
||||
|
||||
osp_read_spe_cfg_file("/ramfs/cfgDat");
|
||||
osp_read_spe_cfg_file("/ramfs/cfgDat", 0);
|
||||
|
||||
msg_transfer_mem_init();
|
||||
msg_transfer_cfg();
|
||||
|
Loading…
x
Reference in New Issue
Block a user