Merge branch 'dev_ck_v2.1_feature#1655#' into 'dev_ck_v2.1'

update New Feature#1655 to dev_ck_V2.1

See merge request ucp/driver/ucp4008_platform_spu!94
This commit is contained in:
Weihua Li 2024-03-08 01:44:03 +00:00
commit 1134739ba4
4 changed files with 632 additions and 622 deletions

View File

@ -1,55 +1,55 @@
// +FHDR------------------------------------------------------------ // +FHDR------------------------------------------------------------
// Copyright (c) 2022 SmartLogic. // Copyright (c) 2022 SmartLogic.
// ALL RIGHTS RESERVED // ALL RIGHTS RESERVED
// ----------------------------------------------------------------- // -----------------------------------------------------------------
// Filename : ucp_handshake.h // Filename : ucp_handshake.h
// Author : xianfeng.du // Author : xianfeng.du
// Created On : 2022-07-22 // Created On : 2022-07-22
// Last Modified : // Last Modified :
// ----------------------------------------------------------------- // -----------------------------------------------------------------
// Description: // Description:
// //
// //
// -FHDR------------------------------------------------------------ // -FHDR------------------------------------------------------------
#ifndef __UCP_HANDSHAKE_H__ #ifndef __UCP_HANDSHAKE_H__
#define __UCP_HANDSHAKE_H__ #define __UCP_HANDSHAKE_H__
#include "typedef.h" #include "typedef.h"
#define MAX_NUM_APE 8 #define MAX_NUM_APE 8
#define MAX_NUM_SPU 12 #define MAX_NUM_SPU 12
#define MAX_NUM_CORE (MAX_NUM_SPU+1) #define MAX_NUM_CORE (MAX_NUM_SPU+1)
#define NPU_CORE_ID MAX_NUM_SPU #define NPU_CORE_ID MAX_NUM_SPU
#define PET_RFM_SPU0_CORE_ID 8 #define PET_RFM_SPU0_CORE_ID 8
#define PET_RFM_SPU1_CORE_ID 9 #define PET_RFM_SPU1_CORE_ID 9
#define ECS_RFM_SPU0_CORE_ID 10 #define ECS_RFM_SPU0_CORE_ID 10
#define ECS_RFM_SPU1_CORE_ID 11 #define ECS_RFM_SPU1_CORE_ID 11
#define HANDSHKAE_REQ_VALUE 0x5A5A5A5A #define HANDSHKAE_REQ_VALUE 0x5A5A5A5A
#define HANDSHKAE_RESP_VALUE 0xA5A5A5A5 #define HANDSHKAE_RESP_VALUE 0xA5A5A5A5
#ifndef PCIE_BACKHAUL #ifndef PCIE_BACKHAUL
#define HANDSHKAE_MASK 0x00000e00//excluded APE cores #define HANDSHKAE_MASK 0x00000e00//excluded APE cores
#else #else
#define HANDSHKAE_MASK 0x00000f00//excluded APE cores #define HANDSHKAE_MASK 0x00000f00//excluded APE cores
#endif #endif
typedef struct tUcpHandshake{ typedef struct tUcpHandshake{
uint32_t request[MAX_NUM_CORE]; uint32_t request[MAX_NUM_CORE];
uint32_t response[MAX_NUM_CORE]; uint32_t response[MAX_NUM_CORE];
uint32_t heartbeat[MAX_NUM_CORE]; uint32_t heartbeat[MAX_NUM_CORE];
} UcpHandshake_t; } UcpHandshake_t;
UcpHandshake_t* get_handshake_info(void); UcpHandshake_t* get_handshake_info(void);
//void handshake_with_host(void); //void handshake_with_host(void);
void handshake_master_with_slave(void); void handshake_master_with_slave(uint32_t u32_core_mask);
void handshake_slave_with_master(void); void handshake_slave_with_master(void);
int32_t get_host_core_id(void); int32_t get_host_core_id(void);
void handshake_request_from_host(int32_t core_id); void handshake_request_from_host(int32_t core_id);
void handshake_response_to_host(int32_t core_id); void handshake_response_to_host(int32_t core_id);
#endif #endif

View File

@ -1,170 +1,170 @@
// +FHDR------------------------------------------------------------ // +FHDR------------------------------------------------------------
// Copyright (c) 2022 SmartLogic. // Copyright (c) 2022 SmartLogic.
// ALL RIGHTS RESERVED // ALL RIGHTS RESERVED
// ----------------------------------------------------------------- // -----------------------------------------------------------------
// Filename : ucp_handshake.c // Filename : ucp_handshake.c
// Author : xianfeng.du // Author : xianfeng.du
// Created On : 2022-06-25 // Created On : 2022-06-25
// Last Modified : // Last Modified :
// ----------------------------------------------------------------- // -----------------------------------------------------------------
// Description: // Description:
// //
// //
// -FHDR------------------------------------------------------------ // -FHDR------------------------------------------------------------
#include "typedef.h" #include "typedef.h"
#include "ucp_utility.h" #include "ucp_utility.h"
#include "ucp_printf.h" #include "ucp_printf.h"
//#include "ucp_handshake.h" //#include "ucp_handshake.h"
//#include "msg_transfer_queue.h" //#include "msg_transfer_queue.h"
#include "msg_transfer_mem.h" #include "msg_transfer_mem.h"
#include "pet_sm_mgt.h" #include "pet_sm_mgt.h"
UcpHandshake_t* get_handshake_info(void) UcpHandshake_t* get_handshake_info(void)
{ {
PetSmLocalMgt_t* pPetSmLocalMgt = get_pet_sm_local_mgt(); PetSmLocalMgt_t* pPetSmLocalMgt = get_pet_sm_local_mgt();
return pPetSmLocalMgt->pHandshake; return pPetSmLocalMgt->pHandshake;
} }
int32_t get_host_core_id(void) int32_t get_host_core_id(void)
{ {
int32_t core_id; int32_t core_id;
#ifndef PCIE_BACKHAUL #ifndef PCIE_BACKHAUL
/*ARM A72 will call msg_transfer_init on TMAC_BACKHAUL mode*/ /*ARM A72 will call msg_transfer_init on TMAC_BACKHAUL mode*/
core_id = NPU_CORE_ID; core_id = NPU_CORE_ID;
#else #else
/*PET RFM SPU0 will call msg_transfer_init on PCIE_BACKHAUL mode*/ /*PET RFM SPU0 will call msg_transfer_init on PCIE_BACKHAUL mode*/
core_id = PET_RFM_SPU0_CORE_ID; core_id = PET_RFM_SPU0_CORE_ID;
#endif #endif
return core_id; return core_id;
} }
//host is the core which called msg_transfer_init //host is the core which called msg_transfer_init
void handshake_request_from_host(int32_t core_id) void handshake_request_from_host(int32_t core_id)
{ {
volatile uint32_t request = 0; volatile uint32_t request = 0;
UcpHandshake_t* pHandshake = (UcpHandshake_t *)get_handshake_info(); UcpHandshake_t* pHandshake = (UcpHandshake_t *)get_handshake_info();
while(1) { while(1) {
request = do_read_volatile(&pHandshake->request[core_id]); request = do_read_volatile(&pHandshake->request[core_id]);
if (request == (core_id + HANDSHKAE_REQ_VALUE)) { if (request == (core_id + HANDSHKAE_REQ_VALUE)) {
UCP_PRINT_EMPTY("Recieved handshake request message from core[0x%08x],value[0x%08x].",core_id,request); UCP_PRINT_EMPTY("Recieved handshake request message from core[0x%08x],value[0x%08x].",core_id,request);
break; break;
} }
} }
return; return;
} }
//host is the core which called msg_transfer_init //host is the core which called msg_transfer_init
void handshake_response_to_host(int32_t core_id) void handshake_response_to_host(int32_t core_id)
{ {
uint32_t response= (core_id + HANDSHKAE_RESP_VALUE); uint32_t response= (core_id + HANDSHKAE_RESP_VALUE);
UcpHandshake_t* pHandshake = (UcpHandshake_t *)get_handshake_info(); UcpHandshake_t* pHandshake = (UcpHandshake_t *)get_handshake_info();
do_write(&pHandshake->response[core_id], response); do_write(&pHandshake->response[core_id], response);
UCP_PRINT_EMPTY("Sent handshake response message to core[0x%08x],value[0x%08x].",core_id,response); UCP_PRINT_EMPTY("Sent handshake response message to core[0x%08x],value[0x%08x].",core_id,response);
return; return;
} }
//msgagent is the core which agented msg_transfer_init,PET_RFM_SPU1_CORE_ID //msgagent is the core which agented msg_transfer_init,PET_RFM_SPU1_CORE_ID
void handshake_response_to_msgagent(int32_t core_id) void handshake_response_to_msgagent(int32_t core_id)
{ {
volatile uint32_t request = 0; volatile uint32_t request = 0;
volatile uint32_t response = core_id + HANDSHKAE_RESP_VALUE; volatile uint32_t response = core_id + HANDSHKAE_RESP_VALUE;
UcpHandshake_t* pHandshake = (UcpHandshake_t *)get_handshake_info(); UcpHandshake_t* pHandshake = (UcpHandshake_t *)get_handshake_info();
while(1) { while(1) {
request = do_read_volatile(&pHandshake->request[core_id]); request = do_read_volatile(&pHandshake->request[core_id]);
if (request == (core_id + HANDSHKAE_REQ_VALUE)) { if (request == (core_id + HANDSHKAE_REQ_VALUE)) {
UCP_PRINT_EMPTY("Recieved handshake request message from core[0x%08x],value[0x%08x].",core_id,request); UCP_PRINT_EMPTY("Recieved handshake request message from core[0x%08x],value[0x%08x].",core_id,request);
do_write(&pHandshake->response[core_id], response); do_write(&pHandshake->response[core_id], response);
UCP_PRINT_EMPTY("Sent handshake response message to core[0x%08x],value[0x%08x].",core_id,response); UCP_PRINT_EMPTY("Sent handshake response message to core[0x%08x],value[0x%08x].",core_id,response);
break; break;
} }
} }
return; return;
} }
//master is the core which controlled the handshake flow //master is the core which controlled the handshake flow
#if 0 #if 0
void handshake_with_host(void) void handshake_with_host(void)
{ {
int32_t core_id = get_host_core_id(); int32_t core_id = get_host_core_id();
handshake_request_from_host(core_id); handshake_request_from_host(core_id);
handshake_response_to_host(core_id); handshake_response_to_host(core_id);
return; return;
} }
#endif #endif
//master is the core which controlled the handshake flow //master is the core which controlled the handshake flow
void handshake_master_with_slave(void) void handshake_master_with_slave(uint32_t u32_core_mask)
{ {
volatile uint32_t request = 0; volatile uint32_t request = 0;
uint32_t response; uint32_t response;
uint32_t core_id,coreReadyBitMap,coreMask; uint32_t core_id,coreReadyBitMap,coreMask;
UcpHandshake_t* pHandshake = (UcpHandshake_t *)get_handshake_info(); UcpHandshake_t* pHandshake = (UcpHandshake_t *)get_handshake_info();
uint32_t ape_core_mask = APE_CORE_MASK & 0xff; uint32_t ape_core_mask = u32_core_mask;
uint32_t handshake_coremask = HANDSHKAE_MASK | ape_core_mask; uint32_t handshake_coremask = HANDSHKAE_MASK | ape_core_mask;
core_id = get_core_id(); core_id = get_core_id();
coreReadyBitMap = 1 << core_id; coreReadyBitMap = 1 << core_id;
debug_write(DBG_DDR_COMMON_IDX(core_id,90), handshake_coremask); debug_write(DBG_DDR_COMMON_IDX(core_id,90), handshake_coremask);
//msgagent need to run before other cores. //msgagent need to run before other cores.
handshake_response_to_msgagent(PET_RFM_SPU1_CORE_ID); handshake_response_to_msgagent(PET_RFM_SPU1_CORE_ID);
while(1) { while(1) {
for(uint32_t i = 0; i < MAX_NUM_SPU; i++) { for(uint32_t i = 0; i < MAX_NUM_SPU; i++) {
coreMask = (handshake_coremask >> i) & 0x1; coreMask = (handshake_coremask >> i) & 0x1;
if (coreMask) { if (coreMask) {
request = do_read_volatile(&pHandshake->request[i]); request = do_read_volatile(&pHandshake->request[i]);
if (request == (i + HANDSHKAE_REQ_VALUE)) { if (request == (i + HANDSHKAE_REQ_VALUE)) {
UCP_PRINT_EMPTY("Recieved handshake request message from core[0x%08x],value[0x%08x].",core_id,request); UCP_PRINT_EMPTY("Recieved handshake request message from core[0x%08x],value[0x%08x].",core_id,request);
response= (i + HANDSHKAE_RESP_VALUE); response= (i + HANDSHKAE_RESP_VALUE);
do_write(&pHandshake->response[i], response); do_write(&pHandshake->response[i], response);
UCP_PRINT_EMPTY("Sent handshake response message to core[0x%08x],value[0x%08x].",core_id,response); UCP_PRINT_EMPTY("Sent handshake response message to core[0x%08x],value[0x%08x].",core_id,response);
coreReadyBitMap |= (1 << i); coreReadyBitMap |= (1 << i);
} }
} }
} }
if (handshake_coremask == (coreReadyBitMap & handshake_coremask)) { if (handshake_coremask == (coreReadyBitMap & handshake_coremask)) {
UCP_PRINT_EMPTY("all cores are ready."); UCP_PRINT_EMPTY("all cores are ready.");
break; break;
} }
} }
return; return;
} }
//master is the core which controlled the handshake flow //master is the core which controlled the handshake flow
void handshake_slave_with_master(void) void handshake_slave_with_master(void)
{ {
uint32_t core_id = get_core_id(); uint32_t core_id = get_core_id();
uint32_t request= (core_id + HANDSHKAE_REQ_VALUE); uint32_t request= (core_id + HANDSHKAE_REQ_VALUE);
volatile uint32_t response; volatile uint32_t response;
UcpHandshake_t* pHandshake = (UcpHandshake_t *)get_handshake_info(); UcpHandshake_t* pHandshake = (UcpHandshake_t *)get_handshake_info();
do_write(&pHandshake->request[core_id], request); do_write(&pHandshake->request[core_id], request);
UCP_PRINT_EMPTY("core[0x%08x] sent handshake request message,value[0x%08x].",core_id,request); UCP_PRINT_EMPTY("core[0x%08x] sent handshake request message,value[0x%08x].",core_id,request);
while(1) { while(1) {
response = do_read_volatile(&pHandshake->response[core_id]); response = do_read_volatile(&pHandshake->response[core_id]);
if (response == (core_id + HANDSHKAE_RESP_VALUE)) { if (response == (core_id + HANDSHKAE_RESP_VALUE)) {
UCP_PRINT_EMPTY("core[0x%08x] recieved handshake response message,value[0x%08x].",core_id,response); UCP_PRINT_EMPTY("core[0x%08x] recieved handshake response message,value[0x%08x].",core_id,response);
break; break;
} }
} }
return; return;
} }

View File

@ -1,70 +1,74 @@
// +FHDR------------------------------------------------------------ // +FHDR------------------------------------------------------------
// Copyright (c) 2022 SmartLogic. // Copyright (c) 2022 SmartLogic.
// ALL RIGHTS RESERVED // ALL RIGHTS RESERVED
// ----------------------------------------------------------------- // -----------------------------------------------------------------
// Filename : ecs_rfm_spu1.c // Filename : ecs_rfm_spu1.c
// Author : xianfeng.du // Author : xianfeng.du
// Created On : 2022-06-25 // Created On : 2022-06-25
// Last Modified : // Last Modified :
// ----------------------------------------------------------------- // -----------------------------------------------------------------
// Description: // Description:
// //
// //
// -FHDR------------------------------------------------------------ // -FHDR------------------------------------------------------------
#include "typedef.h" #include "typedef.h"
#include "rfm1_drv.h" #include "rfm1_drv.h"
#include "ucp_handshake.h" #include "ucp_handshake.h"
//#include "cpri_timer.h" //#include "cpri_timer.h"
#include "ucp_utility.h" #include "ucp_utility.h"
#include "ucp_printf.h" #include "ucp_printf.h"
#include "phy_para.h" #include "phy_para.h"
#include "pet_sm_mgt.h" #include "pet_sm_mgt.h"
#include "ecs_rfm_dm_mgt.h" #include "ecs_rfm_dm_mgt.h"
#include "msg_transfer_mem.h" #include "msg_transfer_mem.h"
#ifdef TEST_ENABLE #ifdef TEST_ENABLE
#include "fh_test.h" #include "fh_test.h"
#endif #endif
void phy_init(void); void phy_init(void);
ALWAYS_INLINE int32_t get_core_id(void)
{
return ECS_RFM_SPU1_CORE_ID;
}
void ecs_rfm_spu1_drv_init(void)
{
ecs_rfm_dm_alloc();
ecs_rfm1_dm_init();
pet_sm_alloc();
ucp_spinlock_init(); uint32_t get_core_mask_by_phy(void);
ecs_rfm1_drv_init(); ALWAYS_INLINE int32_t get_core_id(void)
UCP_PRINT_EMPTY("ECS: rfm drv init finished.\r\n"); {
return ECS_RFM_SPU1_CORE_ID;
}
void ecs_rfm_spu1_drv_init(void)
{
ecs_rfm_dm_alloc();
ecs_rfm1_dm_init();
pet_sm_alloc();
ucp_spinlock_init();
ecs_rfm1_drv_init();
UCP_PRINT_EMPTY("ECS: rfm drv init finished.\r\n");
return;
}
void ecs_rfm_spu1_msg_transfer_init(void)
{
msg_transfer_mem_alloc();
int32_t core_id = get_host_core_id();
handshake_request_from_host(core_id);
//handshake_with_host();
msg_transfer_queue_init();//initialized local queuecfg from common queuecfg
uint32_t u32_core_mask = get_core_mask_by_phy();
debug_write(DBG_DDR_COMMON_IDX(core_id, 3), u32_core_mask);
handshake_master_with_slave(u32_core_mask);
return;
}
void ecs_rfm_spu1_msg_transfer_init(void)
{
msg_transfer_mem_alloc();
int32_t core_id = get_host_core_id();
handshake_request_from_host(core_id);
//handshake_with_host();
msg_transfer_queue_init();//initialized local queuecfg from common queuecfg
handshake_master_with_slave();
handshake_response_to_host(core_id); handshake_response_to_host(core_id);
phy_init();//phy application function:msg_transfer_cfg phy_init();//phy application function:msg_transfer_cfg
return; return;
} }

View File

@ -1,352 +1,358 @@
// +FHDR------------------------------------------------------------ // +FHDR------------------------------------------------------------
// Copyright (c) 2022 SmartLogic. // Copyright (c) 2022 SmartLogic.
// ALL RIGHTS RESERVED // ALL RIGHTS RESERVED
// ----------------------------------------------------------------- // -----------------------------------------------------------------
// Filename : phy_init.c // Filename : phy_init.c
// Author : xianfeng.du // Author : xianfeng.du
// Created On : 2022-12-27 // Created On : 2022-12-27
// Last Modified : // Last Modified :
// ----------------------------------------------------------------- // -----------------------------------------------------------------
// Description: // Description:
// ecs_rfm_spu1 phy_init // ecs_rfm_spu1 phy_init
// //
// -FHDR------------------------------------------------------------ // -FHDR------------------------------------------------------------
#include "phy_para.h" #include "phy_para.h"
#include "mtimer_cell.h" #include "mtimer_cell.h"
#include "ucp_utility.h" #include "ucp_utility.h"
#include "app_interface.h" #include "app_interface.h"
#include "phy_para.h" #include "phy_para.h"
#include "rfm1_drv.h" #include "rfm1_drv.h"
#include "jesd_orx_timer.h" #include "jesd_orx_timer.h"
#include "ecs_rfm_dm_mgt.h" #include "ecs_rfm_dm_mgt.h"
#define CELL_SETUP_TYPE_SIMULATION (0x5a6b7c8d) #define CELL_SETUP_TYPE_SIMULATION (0x5a6b7c8d)
#define ORX_MSG_TYPE_SIMULATION (0xaabb7788) #define ORX_MSG_TYPE_SIMULATION (0xaabb7788)
#define ECS_RFM1_TEST_MSG_SIZE (8) #define ECS_RFM1_TEST_MSG_SIZE (8)
#define ECS_RFM1_MSG_TYPE (0) #define ECS_RFM1_MSG_TYPE (0)
uint8_t gu8_send_create_task_cnt = 0;
uint8_t gu8_send_del_task_cnt = 0;
int32_t phy_fh_drv_init()
{
stFrontHaulDrvPara fhDrvPara;
memset_ucp(&fhDrvPara, 0, sizeof(stFrontHaulDrvPara));
#ifdef DISTRIBUTED_BS
fhDrvPara.protocolSel = PROTOCOL_CPRI;
fhDrvPara.rateOption = CPRI_OPTION_8;
fhDrvPara.mapOption = OTIC_MAP_FIGURE12;
#endif
#ifdef ECPRI_DISTRIBUTED_BS uint8_t gu8_send_create_task_cnt = 0;
fhDrvPara.protocolSel = PROTOCOL_ECPRI; uint8_t gu8_send_del_task_cnt = 0;
fhDrvPara.rateOption = ECPRI_OPTION_10G;
#endif
#ifdef INTEGRATED_BS int32_t phy_fh_drv_init()
fhDrvPara.protocolSel = PROTOCOL_JESD; {
fhDrvPara.rateOption = JESD_OPTION_204B; stFrontHaulDrvPara fhDrvPara;
#endif memset_ucp(&fhDrvPara, 0, sizeof(stFrontHaulDrvPara));
#ifdef INTEGRATED_204C_BS
fhDrvPara.protocolSel = PROTOCOL_JESD; #ifdef DISTRIBUTED_BS
fhDrvPara.rateOption = JESD_OPTION_204C; fhDrvPara.protocolSel = PROTOCOL_CPRI;
#endif fhDrvPara.rateOption = CPRI_OPTION_8;
fhDrvPara.mapOption = OTIC_MAP_FIGURE12;
fronthaul_drv_cfg(&fhDrvPara); #endif
return 0; #ifdef ECPRI_DISTRIBUTED_BS
} fhDrvPara.protocolSel = PROTOCOL_ECPRI;
fhDrvPara.rateOption = ECPRI_OPTION_10G;
void ecs_rfm1_send_create_task_info(uint8_t dst_core_id) #endif
{
uint32_t core_id = get_core_id(); #ifdef INTEGRATED_BS
int32_t ret = 0; fhDrvPara.protocolSel = PROTOCOL_JESD;
char* addr = NULL; fhDrvPara.rateOption = JESD_OPTION_204B;
addr = osp_alloc_msg(ECS_RFM1_TEST_MSG_SIZE); #endif
if (NULL == addr) #ifdef INTEGRATED_204C_BS
{ fhDrvPara.protocolSel = PROTOCOL_JESD;
debug_write(DBG_DDR_COMMON_IDX(core_id, 58), 0xa1); fhDrvPara.rateOption = JESD_OPTION_204C;
debug_write(DBG_DDR_COMMON_IDX(core_id, 59), dst_core_id); #endif
return ;
} fronthaul_drv_cfg(&fhDrvPara);
debug_write(DBG_DDR_COMMON_IDX(core_id, 4), (uint32_t)addr);
do_write(addr, 0xa1a2a3a4); return 0;
do_write((addr+4), 0xb1b2b3b4); }
ret = osp_send_msg((uint32_t)(addr),
ECS_RFM1_TEST_MSG_SIZE, void ecs_rfm1_send_create_task_info(uint8_t dst_core_id)
ECS_RFM1_MSG_TYPE, {
11, // src que id uint32_t core_id = get_core_id();
dst_core_id, // dst que id int32_t ret = 0;
50, // src task id char* addr = NULL;
50); // dst task id addr = osp_alloc_msg(ECS_RFM1_TEST_MSG_SIZE);
if (NULL == addr)
if (0 != ret) {
{ debug_write(DBG_DDR_COMMON_IDX(core_id, 58), 0xa1);
debug_write(DBG_DDR_COMMON_IDX(core_id, 58), 0xa2); debug_write(DBG_DDR_COMMON_IDX(core_id, 59), dst_core_id);
debug_write(DBG_DDR_COMMON_IDX(core_id, 59), dst_core_id); return ;
return ; }
} debug_write(DBG_DDR_COMMON_IDX(core_id, 4), (uint32_t)addr);
debug_write(DBG_DDR_COMMON_IDX(core_id, 60), ++gu8_send_create_task_cnt); do_write(addr, 0xa1a2a3a4);
return ; do_write((addr+4), 0xb1b2b3b4);
} ret = osp_send_msg((uint32_t)(addr),
ECS_RFM1_TEST_MSG_SIZE,
void ecs_rfm1_send_del_task_info(uint8_t dst_core_id) ECS_RFM1_MSG_TYPE,
{ 11, // src que id
uint32_t core_id = get_core_id(); dst_core_id, // dst que id
int32_t ret = 0; 50, // src task id
char* addr = NULL; 50); // dst task id
addr = osp_alloc_msg(ECS_RFM1_TEST_MSG_SIZE);
if (NULL == addr) if (0 != ret)
{ {
debug_write(DBG_DDR_COMMON_IDX(core_id, 61), 0xa1); debug_write(DBG_DDR_COMMON_IDX(core_id, 58), 0xa2);
debug_write(DBG_DDR_COMMON_IDX(core_id, 62), dst_core_id); debug_write(DBG_DDR_COMMON_IDX(core_id, 59), dst_core_id);
return ; return ;
} }
debug_write(DBG_DDR_COMMON_IDX(core_id, 4), (uint32_t)addr); debug_write(DBG_DDR_COMMON_IDX(core_id, 60), ++gu8_send_create_task_cnt);
do_write(addr, 0xa1a2a3a4); return ;
do_write((addr+4), 0xb1b2b3b4); }
ret = osp_send_msg((uint32_t)(addr),
ECS_RFM1_TEST_MSG_SIZE, void ecs_rfm1_send_del_task_info(uint8_t dst_core_id)
ECS_RFM1_MSG_TYPE, {
11, // src que id uint32_t core_id = get_core_id();
dst_core_id, // dst que id int32_t ret = 0;
51, // src task id char* addr = NULL;
51); // dst task id addr = osp_alloc_msg(ECS_RFM1_TEST_MSG_SIZE);
if (NULL == addr)
if (0 != ret) {
{ debug_write(DBG_DDR_COMMON_IDX(core_id, 61), 0xa1);
debug_write(DBG_DDR_COMMON_IDX(core_id, 61), 0xa2); debug_write(DBG_DDR_COMMON_IDX(core_id, 62), dst_core_id);
debug_write(DBG_DDR_COMMON_IDX(core_id, 62), dst_core_id); return ;
return ; }
} debug_write(DBG_DDR_COMMON_IDX(core_id, 4), (uint32_t)addr);
debug_write(DBG_DDR_COMMON_IDX(core_id, 63), ++gu8_send_del_task_cnt); do_write(addr, 0xa1a2a3a4);
return ; do_write((addr+4), 0xb1b2b3b4);
} ret = osp_send_msg((uint32_t)(addr),
ECS_RFM1_TEST_MSG_SIZE,
void ecs_rfm1_build_cell(uint32_t scsId, uint32_t cellId, uint32_t coreId, uint32_t frame_type) ECS_RFM1_MSG_TYPE,
{ 11, // src que id
phy_timer_config_ind_t my_cpritmr; dst_core_id, // dst que id
51, // src task id
my_cpritmr.scsId = scsId; 51); // dst task id
if ((0 <= cellId) || ((3 >= cellId)))
{ if (0 != ret)
my_cpritmr.runCoreId = coreId; {
} debug_write(DBG_DDR_COMMON_IDX(core_id, 61), 0xa2);
else debug_write(DBG_DDR_COMMON_IDX(core_id, 62), dst_core_id);
{ return ;
my_cpritmr.runCoreId = 0; }
} debug_write(DBG_DDR_COMMON_IDX(core_id, 63), ++gu8_send_del_task_cnt);
return ;
my_cpritmr.frameType = frame_type; }
if (TDD_2500US_DOUBLE == frame_type)
{ void ecs_rfm1_build_cell(uint32_t scsId, uint32_t cellId, uint32_t coreId, uint32_t frame_type)
my_cpritmr.t_period = 5000; {
my_cpritmr.t_us = 500; phy_timer_config_ind_t my_cpritmr;
my_cpritmr.num_tti = 10;
my_cpritmr.num_tti_per_sfn = 20; my_cpritmr.scsId = scsId;
if ((0 <= cellId) || ((3 >= cellId)))
my_cpritmr.num_t_dl[0] = 3; // dl slot num {
my_cpritmr.num_t_dl_symb[0] = 6; // dl symbol num my_cpritmr.runCoreId = coreId;
my_cpritmr.num_t_ul_symb[0] = 4; // ul symbol num }
my_cpritmr.num_ants[0] = 4; else
{
my_cpritmr.num_t_dl[1] = 2; // dl slot num my_cpritmr.runCoreId = 0;
my_cpritmr.num_t_dl_symb[1] = 6; // dl symbol num }
my_cpritmr.num_t_ul_symb[1] = 4; // ul symbol num
my_cpritmr.num_ants[1] = 4; my_cpritmr.frameType = frame_type;
} if (TDD_2500US_DOUBLE == frame_type)
else {
{ my_cpritmr.t_period = 5000;
if (NR_SCS_30K == scsId) my_cpritmr.t_us = 500;
{ my_cpritmr.num_tti = 10;
//my_cpritmr.frameType = TDD_MODE; my_cpritmr.num_tti_per_sfn = 20;
//my_cpritmr.frameType = FDD_MODE;
my_cpritmr.t_period = 5000; my_cpritmr.num_t_dl[0] = 3; // dl slot num
my_cpritmr.t_us = 500; my_cpritmr.num_t_dl_symb[0] = 6; // dl symbol num
my_cpritmr.num_tti = 10; my_cpritmr.num_t_ul_symb[0] = 4; // ul symbol num
my_cpritmr.num_tti_per_sfn = 20; my_cpritmr.num_ants[0] = 4;
my_cpritmr.num_t_dl[0] = 7; // dl slot num my_cpritmr.num_t_dl[1] = 2; // dl slot num
my_cpritmr.num_t_dl_symb[0] = 6; // dl symbol num my_cpritmr.num_t_dl_symb[1] = 6; // dl symbol num
my_cpritmr.num_t_ul_symb[0] = 4; // ul symbol num my_cpritmr.num_t_ul_symb[1] = 4; // ul symbol num
my_cpritmr.num_ants[0] = 4; my_cpritmr.num_ants[1] = 4;
} }
else if (LTE_SCS_ID == scsId) else
{ {
//my_cpritmr.frameType = TDD_MODE; if (NR_SCS_30K == scsId)
//my_cpritmr.frameType = FDD_MODE; {
my_cpritmr.t_period = 10000; //my_cpritmr.frameType = TDD_MODE;
my_cpritmr.t_us = 1000; //my_cpritmr.frameType = FDD_MODE;
my_cpritmr.num_tti = 10; my_cpritmr.t_period = 5000;
my_cpritmr.num_tti_per_sfn = 10; my_cpritmr.t_us = 500;
my_cpritmr.num_tti = 10;
my_cpritmr.num_t_dl[0] =10;// 7; // dl slot num my_cpritmr.num_tti_per_sfn = 20;
my_cpritmr.num_t_dl_symb[0] = 14;//6; // dl symbol num
my_cpritmr.num_t_ul_symb[0] = 14;//4; // ul symbol num my_cpritmr.num_t_dl[0] = 7; // dl slot num
my_cpritmr.num_ants[0] = 2; my_cpritmr.num_t_dl_symb[0] = 6; // dl symbol num
} my_cpritmr.num_t_ul_symb[0] = 4; // ul symbol num
else my_cpritmr.num_ants[0] = 4;
{ }
return; else if (LTE_SCS_ID == scsId)
} {
} //my_cpritmr.frameType = TDD_MODE;
//my_cpritmr.frameType = FDD_MODE;
int32_t ret = mtimer_init4phy(&my_cpritmr); my_cpritmr.t_period = 10000;
if (0 != ret) my_cpritmr.t_us = 1000;
{ my_cpritmr.num_tti = 10;
return; my_cpritmr.num_tti_per_sfn = 10;
}
my_cpritmr.num_t_dl[0] =10;// 7; // dl slot num
uint32_t apeId = 0; my_cpritmr.num_t_dl_symb[0] = 14;//6; // dl symbol num
uint32_t runCore = my_cpritmr.runCoreId; my_cpritmr.num_t_ul_symb[0] = 14;//4; // ul symbol num
volatile uint32_t h1Pos = __builtin_clz(runCore); // 从高bit开始第一个1前面的0的个数 my_cpritmr.num_ants[0] = 2;
while (h1Pos != 32) }
{ else
apeId = 31 - h1Pos; {
if (8 <= apeId) return;
{ }
return; }
}
int32_t ret = mtimer_init4phy(&my_cpritmr);
ecs_rfm1_send_create_task_info(apeId); if (0 != ret)
{
runCore &= (~(1 << apeId)); return;
h1Pos = __builtin_clz(runCore); }
}
} uint32_t apeId = 0;
uint32_t runCore = my_cpritmr.runCoreId;
void ecs_rfm1_delete_cell(uint32_t scsId, uint32_t cellId, uint32_t coreId) volatile uint32_t h1Pos = __builtin_clz(runCore); // 从高bit开始第一个1前面的0的个数
{ while (h1Pos != 32)
int32_t ret = 0; {
#ifdef PALLADIUM_TEST apeId = 31 - h1Pos;
int32_t flag = 1; if (8 <= apeId)
debug_write((DBG_DDR_IDX_DRV_BASE+52), flag); // 0xb7e060d0 {
#endif return;
}
stPhyDelCell myDelCell;
myDelCell.scsId = scsId; ecs_rfm1_send_create_task_info(apeId);
if ((0 <= cellId) || (3 >= cellId))
{ runCore &= (~(1 << apeId));
myDelCell.delCoreId = coreId; h1Pos = __builtin_clz(runCore);
} }
else }
{
myDelCell.delCoreId = 0; void ecs_rfm1_delete_cell(uint32_t scsId, uint32_t cellId, uint32_t coreId)
} {
int32_t ret = 0;
uint32_t apeId = 0; #ifdef PALLADIUM_TEST
uint32_t runCore = myDelCell.delCoreId; int32_t flag = 1;
volatile uint32_t h1Pos = __builtin_clz(runCore); // 从高bit开始第一个1前面的0的个数 debug_write((DBG_DDR_IDX_DRV_BASE+52), flag); // 0xb7e060d0
while (h1Pos != 32) #endif
{
apeId = 31 - h1Pos; stPhyDelCell myDelCell;
if (8 <= apeId) myDelCell.scsId = scsId;
{ if ((0 <= cellId) || (3 >= cellId))
return; {
} myDelCell.delCoreId = coreId;
}
ecs_rfm1_send_del_task_info(apeId); else
{
runCore &= (~(1 << apeId)); myDelCell.delCoreId = 0;
h1Pos = __builtin_clz(runCore); }
}
#ifdef PALLADIUM_TEST uint32_t apeId = 0;
flag++; uint32_t runCore = myDelCell.delCoreId;
debug_write((DBG_DDR_IDX_DRV_BASE+52), flag); // 0xb7e060d0 volatile uint32_t h1Pos = __builtin_clz(runCore); // 从高bit开始第一个1前面的0的个数
#endif while (h1Pos != 32)
{
ret = mtimer_del_cell_cfg(&myDelCell); apeId = 31 - h1Pos;
#ifdef PALLADIUM_TEST if (8 <= apeId)
flag++; {
debug_write((DBG_DDR_IDX_DRV_BASE+52), flag); // 0xb7e060d0 return;
#endif }
}
ecs_rfm1_send_del_task_info(apeId);
volatile uint32_t gCellFlag = 0;
void phy_init(void) runCore &= (~(1 << apeId));
{ h1Pos = __builtin_clz(runCore);
gCellFlag = 0; }
return; #ifdef PALLADIUM_TEST
} flag++;
debug_write((DBG_DDR_IDX_DRV_BASE+52), flag); // 0xb7e060d0
#endif
ret = mtimer_del_cell_cfg(&myDelCell);
#ifdef PALLADIUM_TEST
flag++;
debug_write((DBG_DDR_IDX_DRV_BASE+52), flag); // 0xb7e060d0
#endif
}
volatile uint32_t gCellFlag = 0;
void phy_init(void)
{
gCellFlag = 0;
return;
}
void phy_oam_msg_proc(uint32_t u32msg_addr, uint32_t u32msg_size) void phy_oam_msg_proc(uint32_t u32msg_addr, uint32_t u32msg_size)
{ {
return ; return ;
} }
void phy_msg_proc(uint32_t u32msg_addr, uint32_t u32msg_size) void phy_msg_proc(uint32_t u32msg_addr, uint32_t u32msg_size)
{ {
uint32_t msg_buf = do_read(u32msg_addr); uint32_t msg_buf = do_read(u32msg_addr);
uint32_t msg_type = do_read(msg_buf); uint32_t msg_type = do_read(msg_buf);
// EcsRfmDmLocalMgt_t* pEcsDmLocalMgt = get_ecs_rfm_dm_local_mgt(); // EcsRfmDmLocalMgt_t* pEcsDmLocalMgt = get_ecs_rfm_dm_local_mgt();
// JesdOrxPara_t* orx_para_ptr = pEcsDmLocalMgt->jesd_orx_para_ptr; // JesdOrxPara_t* orx_para_ptr = pEcsDmLocalMgt->jesd_orx_para_ptr;
//memcpy_ucp(0x60000000, msg_buf, 32); // temp code //memcpy_ucp(0x60000000, msg_buf, 32); // temp code
if (CELL_SETUP_TYPE_SIMULATION == msg_type) if (CELL_SETUP_TYPE_SIMULATION == msg_type)
{ {
uint32_t msg_new_del = do_read(msg_buf+12); // 0; // uint32_t msg_new_del = do_read(msg_buf+12); // 0; //
uint32_t scs_id = do_read(msg_buf+16); // 1; // uint32_t scs_id = do_read(msg_buf+16); // 1; //
uint32_t cell_id = do_read(msg_buf+20); // 0; // uint32_t cell_id = do_read(msg_buf+20); // 0; //
uint32_t run_core = do_read(msg_buf+24); uint32_t run_core = do_read(msg_buf+24);
uint32_t frame_type = do_read(msg_buf+28); uint32_t frame_type = do_read(msg_buf+28);
if (1 < msg_new_del) if (1 < msg_new_del)
{ {
return; return;
} }
if (NR_SCS_120K < scs_id) if (NR_SCS_120K < scs_id)
{ {
return; return;
} }
if (0 == msg_new_del) if (0 == msg_new_del)
{ {
ecs_rfm1_build_cell(scs_id, cell_id, run_core, frame_type); ecs_rfm1_build_cell(scs_id, cell_id, run_core, frame_type);
} }
else else
{ {
ecs_rfm1_delete_cell(scs_id, cell_id, run_core); ecs_rfm1_delete_cell(scs_id, cell_id, run_core);
} }
debug_write(DBG_DDR_COMMON_IDX(get_core_id(),1), 0x12345678); debug_write(DBG_DDR_COMMON_IDX(get_core_id(),1), 0x12345678);
}
else if (ORX_MSG_TYPE_SIMULATION == msg_type)
{
//if (1 > orx_para_ptr->orx_calldrv_cnt)
{
phy_sniffer_start(10000);
debug_write(DBG_DDR_COMMON_IDX(get_core_id(),2), ORX_MSG_TYPE_SIMULATION);
}
} }
else if (ORX_MSG_TYPE_SIMULATION == msg_type)
return; {
} //if (1 > orx_para_ptr->orx_calldrv_cnt)
{
uint32_t gDdrCallCnt = 0; phy_sniffer_start(10000);
void ddr_wr_callback() debug_write(DBG_DDR_COMMON_IDX(get_core_id(),2), ORX_MSG_TYPE_SIMULATION);
{ }
gDdrCallCnt++; }
debug_write((DBG_DDR_IDX_DRV_BASE+127), gDdrCallCnt); // 0x1fc
} return;
}
uint32_t gFapiCallCnt = 0;
void rfm1_fapi_callback() uint32_t gDdrCallCnt = 0;
{ void ddr_wr_callback()
gFapiCallCnt++; {
debug_write((DBG_DDR_IDX_DRV_BASE+123), gFapiCallCnt); // 0x1ec gDdrCallCnt++;
} debug_write((DBG_DDR_IDX_DRV_BASE+127), gDdrCallCnt); // 0x1fc
}
uint32_t gOrxCallCnt = 0;
void phy_sniffer_data_proc() uint32_t gFapiCallCnt = 0;
{ void rfm1_fapi_callback()
gOrxCallCnt++; {
debug_write((DBG_DDR_IDX_DRV_BASE+123), gOrxCallCnt); // 0x1ec gFapiCallCnt++;
} debug_write((DBG_DDR_IDX_DRV_BASE+123), gFapiCallCnt); // 0x1ec
}
uint32_t gOrxCallCnt = 0;
void phy_sniffer_data_proc()
{
gOrxCallCnt++;
debug_write((DBG_DDR_IDX_DRV_BASE+123), gOrxCallCnt); // 0x1ec
}
void Mem_Init(void) void Mem_Init(void)
{ {
return ; return ;
} }
uint32_t get_core_mask_by_phy(void)
{
return APE_CORE_MASK & 0xff;
}