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:32:46 +08:00
parent 639c48815c
commit ebf95caf37
5 changed files with 45 additions and 34 deletions

View File

@ -17,9 +17,9 @@
//#include "typedef.h"
#define HEARTBEAT_ENABLE
void heart_beat_write(void);
#endif

View File

@ -15,58 +15,58 @@
#include "typedef.h"
#include "ucp_handshake.h"
#include "ucp_utility.h"
#include "ucp_heartbeat.h"
//#include "ucp_printf.h"
#define HEART_BEAT_CNT_THRESHOLD 500000
#define HEART_BEAT_CNT_THRESHOLD (500000)
static uint32_t gLocalHeartBeatCounter = 0;
static inline void init_heart_beat_cnt_local(void)
{
gLocalHeartBeatCounter = 0;
return;
gLocalHeartBeatCounter = 0;
return;
}
static inline void inc_heart_beat_cnt_local(void)
{
gLocalHeartBeatCounter += 1;
return;
gLocalHeartBeatCounter += 1;
return;
}
static inline uint32_t get_heart_beat_cnt_local(void)
{
return gLocalHeartBeatCounter;
return gLocalHeartBeatCounter;
}
static inline void inc_heart_beat_cnt_sm(uint32_t core_id)
{
#ifdef HEARTBEAT_ENABLE
UcpHandshake_t* pHandshake = (UcpHandshake_t *)get_handshake_info();
//uint32_t core_id = get_core_id();
uint32_t heartBeatShareMem = do_read_volatile(&pHandshake->heartbeat[core_id]);
heartBeatShareMem++;
do_write(&pHandshake->heartbeat[core_id], heartBeatShareMem);
#endif
return;
UcpHandshake_t* pHandshake = (UcpHandshake_t *)get_handshake_info();
//uint32_t core_id = get_core_id();
uint32_t heartBeatShareMem = do_read_volatile(&pHandshake->heartbeat[core_id]);
heartBeatShareMem++;
do_write(&pHandshake->heartbeat[core_id], heartBeatShareMem);
#endif
return;
}
void heart_beat_write(void)
{
uint32_t heartBeatLocal = 0;
uint32_t core_id = get_core_id();
if (core_id >= PET_RFM_SPU0_CORE_ID) {//RFM
inc_heart_beat_cnt_local();
heartBeatLocal = get_heart_beat_cnt_local();
if (heartBeatLocal >= HEART_BEAT_CNT_THRESHOLD) {
inc_heart_beat_cnt_sm(core_id);
init_heart_beat_cnt_local();
}
} else{//APE
inc_heart_beat_cnt_sm(core_id);
}
return;
uint32_t heartBeatLocal = 0;
uint32_t core_id = get_core_id();
if (core_id >= PET_RFM_SPU0_CORE_ID) {//RFM
inc_heart_beat_cnt_local();
heartBeatLocal = get_heart_beat_cnt_local();
if (heartBeatLocal >= HEART_BEAT_CNT_THRESHOLD) {
inc_heart_beat_cnt_sm(core_id);
init_heart_beat_cnt_local();
}
} else{//APE
inc_heart_beat_cnt_sm(core_id);
}
return;
}

View File

@ -23,7 +23,7 @@
#include "ecpri_queue_proc.h"
#include "ecpri_csu.h"
#include "lib_debug_init.h"
#include "ucp_heartbeat.h"
int32_t main(int32_t argc, char* argv[])
{
@ -61,6 +61,9 @@ int32_t main(int32_t argc, char* argv[])
do_write(ECPRI_DBG_BUF_ADDR + 0x0C, 0x00);
}
}
/* update heartbeat count */
heart_beat_write();
}
return 0;

View File

@ -99,7 +99,7 @@ int32_t main(int32_t argc, char* argv[])
while (1)
{
if (PROTOCOL_CPRI == get_protocol_sel())
if (PROTOCOL_CPRI == get_protocol_sel())
{
check_cpri();
@ -115,7 +115,13 @@ int32_t main(int32_t argc, char* argv[])
phy_queue_polling();
spu_log_server_proc();
/* check whether shell commands exist */
spu_shell_task();
/* update heartbeat count */
heart_beat_write();
#ifdef DDR_MONITOR
spu_ddr_monitor();
#endif

View File

@ -17,6 +17,7 @@
#include "msg_transfer_queue.h"
#include "log_client.h"
#include "ucp_utility.h"
#include "ucp_heartbeat.h"
#include "spu_shell.h"
#include "pet_rfm_spu1_oam.h"
#include "hwque.h"
@ -49,9 +50,10 @@ int32_t main(int32_t argc, char* argv[])
//spu_shell_task();
//msg_transfer_queue_recfg();
//heart_beat_write();
/* update heartbeat count */
heart_beat_write();
}
return 0;
}