update feature#1250 Support hearbeat function

1. SPU and ARM both update
2. 8 APE and 3 RFM(no pet_rfm_spu0) support hearbeat
3. ARM support new function get_heartbeat_status() to get the cores status
4. test:
   4.1 spu(case34)+arm(case5): Pass
   4.2 spu(case44)+arm(case5): Pass --> spu(case44)should use previous version
   4.3 spu(case21)+arm(case21):Pass
   4.4 spu(case14)+arm(case3): Pass
This commit is contained in:
lishuang.xie 2023-11-01 11:38:08 +08:00
parent e259a1af07
commit f25cbc7f98
4 changed files with 67 additions and 21 deletions

View File

@ -78,6 +78,14 @@ brief: drv function init
*/
int32_t drv_init(void);
/*
name: get_heartbeat_status
para: null
brief: get the status of spu cores
return value: 0:success other:bitmap for all cores(1:missing heartbeat)
*/
uint32_t get_heartbeat_status(void);
/**********************************************************************************************/
/* testmac interface */

View File

@ -10,5 +10,7 @@ typedef struct __OspHeartBeatInfo_t
int8_t OspHeartbeatPro(void);
uint32_t get_heartbeat_status(void);
#endif /* __OSP_HEARTBEAT__ */

View File

@ -45,6 +45,38 @@ uint8_t* gu8virRegAddr = NULL;
uint8_t* gu8VirSubctrlAddr = NULL;
uint8_t* gu8VirRstCfgAddr = NULL;
uint32_t g32heartbeatCounter[MAX_NUM_SPU] = {0};
uint32_t get_heartbeat_status(void)
{
volatile uint32_t vu32counter = 0;
uint32_t u32coreHeartbeatBitmap = SUCCESS;
uint32_t u32coreHeartbeatMask = 0xEFF;
uint8_t u8loop = 0;
PetSmLocalMgt_t* pPetSmLocalMgt = get_pet_sm_local_mgt();
UcpHandshake_t* pHandshake = pPetSmLocalMgt->pHandshake;
for (u8loop = 0; u8loop < MAX_NUM_SPU; u8loop++)
{
vu32counter = pHandshake->heartbeat[u8loop];
if (vu32counter == g32heartbeatCounter[u8loop])
{
u32coreHeartbeatBitmap |= (1 << u8loop);
}
/* update */
g32heartbeatCounter[u8loop] = vu32counter;
}
u32coreHeartbeatBitmap &= u32coreHeartbeatMask;
UCP_PRINT_WARN("[get_heartbeat_status]: HeartbeatBitMap = 0x%x\r\n", u32coreHeartbeatBitmap);
return u32coreHeartbeatBitmap;
}
/* 获取对应核的心跳计数 */
uint32_t OspGetHeartbeat(uint8_t u8CoreId)
{

View File

@ -21,6 +21,7 @@
#include "ospSwQueue.h"
#include "pet_sm_mgt.h"
#include "msg_transfer_layer.h"
#include "ospHeartbeat.h"
#define MAX_CMD_LEN (150) /*the max length of a shell command */
@ -69,6 +70,7 @@ OSP_CMD_RTN ospCmdRtnTbl[MAX_CMD_NUM] =
//{"s", (OSP_FUNCPTR)osp_shell_mem_wrapper, (OSP_FUNCPTR)osp_shell_set_mem, "s addr val: set addr memory(length is 4)", 2},
//{"phym", (OSP_FUNCPTR)osp_shell_mem_wrapper, (OSP_FUNCPTR)osp_display_phy_mem, "show phy mempry info", 2},
//{"c", (OSP_FUNCPTR)osp_shell_wrapper, (OSP_FUNCPTR)osp_show_tsk_diag_cnt, "show Task Diag Cnt", 1},
//{"sw", (OSP_FUNCPTR)osp_shell_wrapper, (OSP_FUNCPTR)osp_show_swqueue_info, "show arm print level", 0},
{"net", (OSP_FUNCPTR)osp_show_udp, NULL, "show net info", 0},
//{"sw", (OSP_FUNCPTR)osp_shell_wrapper, (OSP_FUNCPTR)osp_show_swqueue_info, "show arm print level", 0},
{"level", (OSP_FUNCPTR)osp_shell_wrapper, (OSP_FUNCPTR)osp_set_print_level, "set arm print level", 1},
@ -92,6 +94,8 @@ OSP_CMD_RTN ospCmdRtnTbl[MAX_CMD_NUM] =
//{"set_clock", (OSP_FUNCPTR)osp_shell_wrapper, (OSP_FUNCPTR)osp_set_clk_mode, "set clock module", 1},
{"recmd_ape", (OSP_FUNCPTR)osp_shell_wrapper, (OSP_FUNCPTR)osp_reget_ape_cmd, "get ape cmd again", 0},
{"intr_ape", (OSP_FUNCPTR)osp_shell_wrapper, (OSP_FUNCPTR)osp_ape_csu_int_cnt, "show intr info", 0},
{"hb", (OSP_FUNCPTR)osp_shell_wrapper, (OSP_FUNCPTR)get_heartbeat_status, "test heartbeat", 0},
//{"level_ape", (OSP_FUNCPTR)osp_shell_wrapper,(OSP_FUNCPTR)osp_ape_set_log_level, "set ape log level", 1},
//{"csu_stop_ape", (OSP_FUNCPTR)osp_shell_wrapper,(OSP_FUNCPTR)osp_ape_csu_stop_cfg, "set csu start or stop", 2},
//{"i_ape", (OSP_FUNCPTR)osp_shell_wrapper, (OSP_FUNCPTR)osp_show_ape_taskinfo, "show ape task info", 0},