添加获取版本信息接口
This commit is contained in:
parent
1d09dc6a16
commit
827398e7d8
8
build.sh
8
build.sh
@ -27,6 +27,9 @@ test_option="no"
|
|||||||
case_id=21
|
case_id=21
|
||||||
ape_core_mask=0xf
|
ape_core_mask=0xf
|
||||||
platform_build_data=0x20230926
|
platform_build_data=0x20230926
|
||||||
|
spu_version=`git log -1 --format="%H"`
|
||||||
|
spu_tag=`git tag | sed -n '$p'`
|
||||||
|
spu_build_date=`date +"%Y-%m-%d-%H:%M:%S"`
|
||||||
|
|
||||||
while [[ "$#" > 0 ]]; do
|
while [[ "$#" > 0 ]]; do
|
||||||
case $1 in
|
case $1 in
|
||||||
@ -101,8 +104,13 @@ export test_option=${test_option}
|
|||||||
export test_id=${case_id}
|
export test_id=${case_id}
|
||||||
export ape_core_mask=$((ape_core_mask))
|
export ape_core_mask=$((ape_core_mask))
|
||||||
export platform_build_data=$((platform_build_data))
|
export platform_build_data=$((platform_build_data))
|
||||||
|
export spu_version=${spu_version}
|
||||||
|
export spu_tag=${spu_tag}
|
||||||
|
export spu_build_date=${spu_build_date}
|
||||||
|
|
||||||
#echo "# ape_core_mask:$ape_core_mask,platform_build_data:$platform_build_data"
|
#echo "# ape_core_mask:$ape_core_mask,platform_build_data:$platform_build_data"
|
||||||
printf "#ape_core_mask[0x%x], #platform_build_data[0x%x]\n" $ape_core_mask $platform_build_data
|
printf "#ape_core_mask[0x%x], #platform_build_data[0x%x]\n" $ape_core_mask $platform_build_data
|
||||||
|
printf "#spu_version[%s], spu_tag[%s], spu_build_date:[%s]\n" $spu_version $spu_tag $spu_build_date
|
||||||
|
|
||||||
make -f ${MAKE_DIR}/makefile.lib
|
make -f ${MAKE_DIR}/makefile.lib
|
||||||
makefile_set="makefile.ape_spu makefile.ecs_rfm_spu0 makefile.ecs_rfm_spu1 makefile.pet_rfm_spu0 makefile.pet_rfm_spu1"
|
makefile_set="makefile.ape_spu makefile.ecs_rfm_spu0 makefile.ecs_rfm_spu1 makefile.pet_rfm_spu0 makefile.pet_rfm_spu1"
|
||||||
|
@ -2,9 +2,35 @@
|
|||||||
#define __OSP_APE_INTERFACE_H__
|
#define __OSP_APE_INTERFACE_H__
|
||||||
|
|
||||||
/****************************UCP2.0 Platform start***********************************/
|
/****************************UCP2.0 Platform start***********************************/
|
||||||
|
|
||||||
|
#define MAX_BUF_VERSION_LEN (128)
|
||||||
|
|
||||||
|
typedef struct SpuVersionInfo {
|
||||||
|
char platform_commit[MAX_BUF_VERSION_LEN];
|
||||||
|
char platform_tag[MAX_BUF_VERSION_LEN];
|
||||||
|
char platform_build_date[MAX_BUF_VERSION_LEN/2];
|
||||||
|
} SpuVersionInfo_t;
|
||||||
|
|
||||||
/************************************************************************************/
|
/************************************************************************************/
|
||||||
/* shell相关接口定义 */
|
/* shell相关接口定义 */
|
||||||
/************************************************************************************/
|
/************************************************************************************/
|
||||||
|
/*
|
||||||
|
* 函数名称: spu_show_version
|
||||||
|
* 函数入参: void
|
||||||
|
* 函数功能:输出SPU侧的版本信息
|
||||||
|
* ret: void
|
||||||
|
*/
|
||||||
|
void spu_show_version(void);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 函数名称: 获取SPU侧的版本信息
|
||||||
|
* 函数入参: pVersion [out]: 版本信息结构体指针
|
||||||
|
* 函数功能:返回SPU侧版本信息
|
||||||
|
* ret: 0-success, 1-error
|
||||||
|
*/
|
||||||
|
int32_t spu_version_get(SpuVersionInfo_t *pVersion);
|
||||||
|
|
||||||
|
|
||||||
/* shell命令回调函数类型 */
|
/* shell命令回调函数类型 */
|
||||||
typedef unsigned long (*OSP_FUNCPTR)();
|
typedef unsigned long (*OSP_FUNCPTR)();
|
||||||
|
|
||||||
|
17
public/common/platform/inc/spu_version.h
Normal file
17
public/common/platform/inc/spu_version.h
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
#ifndef __SPU_VERSION__
|
||||||
|
#define __SPU_VERSION__
|
||||||
|
|
||||||
|
#define MAX_BUF_VERSION_LEN (128)
|
||||||
|
|
||||||
|
typedef struct SpuVersionInfo {
|
||||||
|
char platform_commit[MAX_BUF_VERSION_LEN];
|
||||||
|
char platform_tag[MAX_BUF_VERSION_LEN];
|
||||||
|
char platform_build_date[MAX_BUF_VERSION_LEN/2];
|
||||||
|
} SpuVersionInfo_t;
|
||||||
|
|
||||||
|
|
||||||
|
void spu_show_version(void);
|
||||||
|
int32_t spu_version_get(SpuVersionInfo_t *pVersion);
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* __SPU_VERSION__ */
|
@ -7,6 +7,7 @@
|
|||||||
#include "ucp_utility.h"
|
#include "ucp_utility.h"
|
||||||
#include "typedef.h"
|
#include "typedef.h"
|
||||||
#include "phy_para.h"
|
#include "phy_para.h"
|
||||||
|
#include "spu_version.h"
|
||||||
|
|
||||||
OSP_CMD_RTN gastCmdRtnTblExt[MAX_EXT_CMD_NUM];
|
OSP_CMD_RTN gastCmdRtnTblExt[MAX_EXT_CMD_NUM];
|
||||||
|
|
||||||
@ -147,6 +148,10 @@ int spu_shell_init(void)
|
|||||||
spu_insert_cmd_ext("csu_ape", (OSP_FUNCPTR)spu_csu_stop_cfg, "cfg csu info", 2);
|
spu_insert_cmd_ext("csu_ape", (OSP_FUNCPTR)spu_csu_stop_cfg, "cfg csu info", 2);
|
||||||
spu_insert_cmd_ext("level_ape", (OSP_FUNCPTR)spu_log_level_set, "cfg ape print level", 1);
|
spu_insert_cmd_ext("level_ape", (OSP_FUNCPTR)spu_log_level_set, "cfg ape print level", 1);
|
||||||
spu_insert_cmd_ext("slevel_ape", (OSP_FUNCPTR)spu_log_level_get, "get ape print level", 0);
|
spu_insert_cmd_ext("slevel_ape", (OSP_FUNCPTR)spu_log_level_get, "get ape print level", 0);
|
||||||
|
/* 注册版本信息 */
|
||||||
|
if (11 == g_core_id) {
|
||||||
|
spu_insert_cmd_ext("ver_spu", (OSP_FUNCPTR)spu_show_version, "show spu soft version", 0);
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
51
public/common/platform/src/spu_version.c
Normal file
51
public/common/platform/src/spu_version.c
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include "spu_shell.h"
|
||||||
|
#include "ucp_printf.h"
|
||||||
|
#include "spu_log.h"
|
||||||
|
#include "ucp_drv_common.h"
|
||||||
|
#include "ucp_utility.h"
|
||||||
|
#include "typedef.h"
|
||||||
|
#include "spu_version.h"
|
||||||
|
|
||||||
|
/* print spu软件版本信息 */
|
||||||
|
void spu_show_version()
|
||||||
|
{
|
||||||
|
char pbuf[2048];
|
||||||
|
int len = 0;
|
||||||
|
|
||||||
|
len = sprintf(pbuf, "[SPU]\n\rVersion:\t%s\n\rTag:\t\t%s\n\rBuild Date:\t%s\n\r", SPU_VERSION, SPU_TAG, SPU_BUILD_DATE);
|
||||||
|
|
||||||
|
spu_shellinfo_to_arm(pbuf, len, UCP4008_OSP_SHELL);
|
||||||
|
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @brief: 获取SPU版本信息
|
||||||
|
* @author: haochen.zhang
|
||||||
|
* @Date: 2024.5.14
|
||||||
|
* @param: pVersion [out] : 版本信息结构体
|
||||||
|
*/
|
||||||
|
int32_t spu_version_get(SpuVersionInfo_t *pVersion)
|
||||||
|
{
|
||||||
|
if (NULL == pVersion)
|
||||||
|
return -2;
|
||||||
|
|
||||||
|
if ((sizeof(SPU_VERSION) > MAX_BUF_VERSION_LEN) || (sizeof(SPU_TAG) > MAX_BUF_VERSION_LEN) || (sizeof(SPU_TAG) > MAX_BUF_VERSION_LEN/2)) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
memcpy((void *)&pVersion->platform_commit, (void *)SPU_VERSION, sizeof(SPU_VERSION));
|
||||||
|
memcpy((void *)&pVersion->platform_tag, (void *)SPU_TAG, sizeof(SPU_TAG));
|
||||||
|
memcpy((void *)&pVersion->platform_build_date, (void *)SPU_BUILD_DATE, sizeof(SPU_BUILD_DATE));
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -15,6 +15,11 @@ endif
|
|||||||
#DEFINES += APE_CORE_MASK=\"$(ape_core_mask)\"
|
#DEFINES += APE_CORE_MASK=\"$(ape_core_mask)\"
|
||||||
DEFINES += APE_CORE_MASK=$(ape_core_mask)
|
DEFINES += APE_CORE_MASK=$(ape_core_mask)
|
||||||
DEFINES += PLATFORM_BUILD_DATA=$(platform_build_data)
|
DEFINES += PLATFORM_BUILD_DATA=$(platform_build_data)
|
||||||
|
|
||||||
|
DEFINES += SPU_VERSION=\"${spu_version}\"
|
||||||
|
DEFINES += SPU_TAG=\"${spu_tag}\"
|
||||||
|
DEFINES += SPU_BUILD_DATE=\"${spu_build_date}\"
|
||||||
|
|
||||||
ifeq ($(backhaul_option), pcie)
|
ifeq ($(backhaul_option), pcie)
|
||||||
DEFINES += PCIE_BACKHAUL
|
DEFINES += PCIE_BACKHAUL
|
||||||
endif
|
endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user