diff --git a/public/ecs_rfm_spu0/top/src/main.s.c b/public/ecs_rfm_spu0/top/src/main.s.c index a122b6b..1ad2318 100644 --- a/public/ecs_rfm_spu0/top/src/main.s.c +++ b/public/ecs_rfm_spu0/top/src/main.s.c @@ -18,12 +18,22 @@ #include "log_client.h" #include "ucp_utility.h" #include "spu_shell.h" +#include "hwque.h" int32_t main(int32_t argc, char* argv[]) { UCP_PRINT_EMPTY("Hello world from ECS RFM SPU0,coreId[0x%x]", get_core_id()); debug_write(DBG_DDR_COMMON_IDX(get_core_id(), 0), PLATFORM_BUILD_DATA); + /* hw_debug_init */ + int32_t core_id = get_core_id(); + int ret = 0; + ret = smart_hq_debug_init((DBG_DDR_HW_ADDR_BASE+DBG_DDR_HW_LEN*core_id), DBG_DDR_HW_LEN); // 推荐384,实际512 + if (0 != ret) + { + debug_write(DBG_DDR_ERR_IDX(core_id, 46), ret); + } + spu_log_client_init(); ecs_rfm_spu0_drv_init(); diff --git a/public/ecs_rfm_spu1/top/src/main.s.c b/public/ecs_rfm_spu1/top/src/main.s.c index de45e96..ad1d4c1 100644 --- a/public/ecs_rfm_spu1/top/src/main.s.c +++ b/public/ecs_rfm_spu1/top/src/main.s.c @@ -1,141 +1,148 @@ -// +FHDR------------------------------------------------------------ -// Copyright (c) 2022 SmartLogic. -// ALL RIGHTS RESERVED -// ----------------------------------------------------------------- -// Filename : main.c -// Author : xianfeng.du -// Created On : 2022-06-25 -// Last Modified : -// ----------------------------------------------------------------- -// Description: -// -// -// -FHDR------------------------------------------------------------ - -#include "ucp_printf.h" -#include "rfm1_drv.h" -#include "ucp_heartbeat.h" -#include "ecs_rfm_spu1_top.h" -#include "msg_transfer_queue.h" +// +FHDR------------------------------------------------------------ +// Copyright (c) 2022 SmartLogic. +// ALL RIGHTS RESERVED +// ----------------------------------------------------------------- +// Filename : main.c +// Author : xianfeng.du +// Created On : 2022-06-25 +// Last Modified : +// ----------------------------------------------------------------- +// Description: +// +// +// -FHDR------------------------------------------------------------ + +#include "ucp_printf.h" +#include "rfm1_drv.h" +#include "ucp_heartbeat.h" +#include "ecs_rfm_spu1_top.h" +#include "msg_transfer_queue.h" #include "log_server.h" #include "ucp_utility.h" #include "phy_queue_proc.h" -#include "cpri_test_mode.h" -#include "spu_shell.h" -#include "gtimer_drv.h" -#include "rfm1_gtimer2.h" -#include "ecs_rfm_spu1_oam.h" -#include "phy_para.h" -#include "hw_cpri.h" - -#ifdef TEST_ENABLE -#include "fh_test.h" -#endif - -extern void ecs_rfm1_build_cell(uint32_t scsId, uint32_t flag); -extern void ecs_rfm1_delete_cell(uint32_t scsId, uint32_t nflag); - -#ifdef DDR_MONITOR -void spu_ddr_monitor() -{ - if (1 == do_read_volatile(DDR_MONITOR_ENABLE)) - { - clear_rfm1_gtimer2_1_intcnt(); - gtimer2_int_enable(0); - do_write(DDR_MONITOR_ENABLE, 0); - } - volatile uint32_t nMonitorCnt = do_read_volatile(DDR_MONITOR_CNT); - __ucps2_synch(0); - if (nMonitorCnt < get_rfm1_gtimer2_1_intcnt()) - { - gtimer2_int_disable(0); - do_write(DDR_MONITOR_CNT, 0); - } -} -#endif - -extern uint32_t gCpriCsuDummyFlag; - -int32_t main(int32_t argc, char* argv[]) -{ - UCP_PRINT_EMPTY("Hello world from ECS RFM SPU1,coreId[0x%x]", get_core_id()); - debug_write(DBG_DDR_COMMON_IDX(get_core_id(), 0), PLATFORM_BUILD_DATA); +#include "cpri_test_mode.h" +#include "spu_shell.h" +#include "gtimer_drv.h" +#include "rfm1_gtimer2.h" +#include "ecs_rfm_spu1_oam.h" +#include "phy_para.h" +#include "hw_cpri.h" +#include "hwque.h" - spu_log_client_init(); +#ifdef TEST_ENABLE +#include "fh_test.h" +#endif + +#ifdef DDR_MONITOR +void spu_ddr_monitor() +{ + if (1 == do_read_volatile(DDR_MONITOR_ENABLE)) + { + clear_rfm1_gtimer2_1_intcnt(); + gtimer2_int_enable(0); + do_write(DDR_MONITOR_ENABLE, 0); + } + volatile uint32_t nMonitorCnt = do_read_volatile(DDR_MONITOR_CNT); + __ucps2_synch(0); + if (nMonitorCnt < get_rfm1_gtimer2_1_intcnt()) + { + gtimer2_int_disable(0); + do_write(DDR_MONITOR_CNT, 0); + } +} +#endif + +extern uint32_t gCpriCsuDummyFlag; + +int32_t main(int32_t argc, char* argv[]) +{ + UCP_PRINT_EMPTY("Hello world from ECS RFM SPU1,coreId[0x%x]", get_core_id()); + debug_write(DBG_DDR_COMMON_IDX(get_core_id(), 0), PLATFORM_BUILD_DATA); + + /* hw_debug_init */ + int32_t core_id = get_core_id(); + int ret = 0; + ret = smart_hq_debug_init((DBG_DDR_HW_ADDR_BASE+DBG_DDR_HW_LEN*core_id), DBG_DDR_HW_LEN); // 推荐384,实际512 + if (0 != ret) + { + debug_write(DBG_DDR_ERR_IDX(core_id, 46), ret); + } + + spu_log_client_init(); spu_log_server_init(); - - ecs_rfm_spu1_drv_init(); - - ecs_rfm_spu1_msg_transfer_init(); - - spu_shell_init(); - - spu_shell_cpri_cmd(); - - oam_msg_init(); - - while (1) - { + + ecs_rfm_spu1_drv_init(); + + ecs_rfm_spu1_msg_transfer_init(); + + spu_shell_init(); + + spu_shell_cpri_cmd(); + + oam_msg_init(); + + while (1) + { #ifdef TEST_ENABLE - do_write(CSU_TX_ADVANCE_SAMPLE, 10000); // 10us - do_write(CSU_RX_TD_SAMPLE, 10000); - - check_test_outcome(0); + do_write(CSU_TX_ADVANCE_SAMPLE, 10000); // 10us + do_write(CSU_RX_TD_SAMPLE, 10000); + + check_test_outcome(0); #endif -#if 0 - if (1 == do_read_volatile(0x0A4D726C)) - { -#ifdef CPRI_TIMING_7D2U_TEST - ecs_rfm1_build_cell(NR_SCS_30K, 1); -#endif -#ifdef CPRI_TIMING_LTE_FDD_TEST - ecs_rfm1_build_cell(LTE_SCS_ID, 1); -#endif - do_write(0x0A4D726C, 2); - } - if (2 == do_read_volatile(0x0A4D726C)) - { - check_phy_cell(); - } - if (3 == do_read_volatile(0x0A4D726C)) - { -#ifdef CPRI_TIMING_7D2U_TEST - ecs_rfm1_delete_cell(NR_SCS_30K, 0); -#endif - -#ifdef CPRI_TIMING_LTE_FDD_TEST - ecs_rfm1_delete_cell(LTE_SCS_ID, 0); -#endif - do_write(0x0A4D726C, 0); - } - if (4 == do_read_volatile(0x0A4D726C)) - { -#ifdef CPRI_TIMING_7D2U_TEST - ecs_rfm1_delete_cell(NR_SCS_30K, 1); -#endif - -#ifdef CPRI_TIMING_LTE_FDD_TEST - ecs_rfm1_delete_cell(LTE_SCS_ID, 1); -#endif - do_write(0x0A4D726C, 0); - } -#endif - +#if 0 + if (1 == do_read_volatile(0x0A4D726C)) + { +#ifdef CPRI_TIMING_7D2U_TEST + ecs_rfm1_build_cell(NR_SCS_30K, 1); +#endif +#ifdef CPRI_TIMING_LTE_FDD_TEST + ecs_rfm1_build_cell(LTE_SCS_ID, 1); +#endif + do_write(0x0A4D726C, 2); + } + if (2 == do_read_volatile(0x0A4D726C)) + { + check_phy_cell(); + } + if (3 == do_read_volatile(0x0A4D726C)) + { +#ifdef CPRI_TIMING_7D2U_TEST + ecs_rfm1_delete_cell(NR_SCS_30K, 0); +#endif + +#ifdef CPRI_TIMING_LTE_FDD_TEST + ecs_rfm1_delete_cell(LTE_SCS_ID, 0); +#endif + do_write(0x0A4D726C, 0); + } + if (4 == do_read_volatile(0x0A4D726C)) + { +#ifdef CPRI_TIMING_7D2U_TEST + ecs_rfm1_delete_cell(NR_SCS_30K, 1); +#endif + +#ifdef CPRI_TIMING_LTE_FDD_TEST + ecs_rfm1_delete_cell(LTE_SCS_ID, 1); +#endif + do_write(0x0A4D726C, 0); + } +#endif + phy_queue_polling(); -#ifdef DISTRIBUTED_BS - check_cpri(); +#ifdef DISTRIBUTED_BS + check_cpri(); check_10ms_offset(); -#endif +#endif spu_log_server_proc(); - spu_shell_task(); -#ifdef DDR_MONITOR - spu_ddr_monitor(); -#endif - } - - return 0; -} - + spu_shell_task(); +#ifdef DDR_MONITOR + spu_ddr_monitor(); +#endif + } + + return 0; +} + diff --git a/public/pet_rfm_spu1/top/src/main.s.c b/public/pet_rfm_spu1/top/src/main.s.c index 4f9ee20..0820230 100644 --- a/public/pet_rfm_spu1/top/src/main.s.c +++ b/public/pet_rfm_spu1/top/src/main.s.c @@ -19,12 +19,22 @@ #include "ucp_utility.h" #include "spu_shell.h" #include "pet_rfm_spu1_oam.h" +#include "hwque.h" int32_t main(int32_t argc, char* argv[]) { UCP_PRINT_EMPTY("Hello world from PET RFM SPU1,coreId[0x%x]", get_core_id()); debug_write(DBG_DDR_COMMON_IDX(get_core_id(), 0), PLATFORM_BUILD_DATA); + /* hw_debug_init */ + int32_t core_id = get_core_id(); + int ret = 0; + ret = smart_hq_debug_init((DBG_DDR_HW_ADDR_BASE+DBG_DDR_HW_LEN*core_id), DBG_DDR_HW_LEN); // 推荐384,实际512 + if (0 != ret) + { + debug_write(DBG_DDR_ERR_IDX(core_id, 46), ret); + } + spu_log_client_init(); pet_rfm_spu1_drv_init(); diff --git a/public/rtos/common/libhwque.a b/public/rtos/common/libhwque.a index 1f6474e..243408a 100644 Binary files a/public/rtos/common/libhwque.a and b/public/rtos/common/libhwque.a differ diff --git a/public/rtos/inc/hwque.h b/public/rtos/inc/hwque.h index 4fffc28..076b7b2 100644 --- a/public/rtos/inc/hwque.h +++ b/public/rtos/inc/hwque.h @@ -34,7 +34,7 @@ typedef unsigned long long uint64_t; #define QUE_NR 16 -#define B_128_16BLCOKS 0 +#define B_128_16BLCOKS 8 #define B_256_32BLOCKS 32 #define BLOCKS_64 64 @@ -84,232 +84,209 @@ typedef struct{ unsigned int in_failed_cnt; unsigned int out_success_cnt; unsigned int in_success_cnt; + unsigned int in_que_depth_val; + unsigned int out_que_depth_val; }hwq_db_info ; typedef struct{ - hwq_db_info per_hwq[QUE_MAX_NR]; - + hwq_db_info per_hwq[QUE_MAX_NR]; + }hwq_debug_t; /* - 函数名称:smart_hq_init - 输入参数: cpuid - 返回类型: int - 返回值: 小于0 表示失败 - 返回?: 0 表示成功 - 函数功能? 硬件队列初始? + 函数名称:smart_hq_init + 输入参数: cpuid + 返回类型: int + 返回值: 小于0 表示失败 + 返回值:等于0 表示成功 + 函数功能:硬件队列初始化 */ extern int smart_hq_init(int cpuid); /* - 函数名称:smart_get_hq_vector - 输入参数: cpuid - 输入参数:queid - 返回类型: int - 返回值:小于等于0 表示失败 - 函数功能? 获取当前硬件队列中断? + 函数名称:smart_get_hq_vector + 输入参数: cpuid + 输入参数:queid + 返回类型: int + 返回值:小于等于0 表示失败 + 函数功能:获取当前硬件队列中断号 */ extern int smart_get_hq_vector(int cpuid,int queid); -/*************** -函数名称:smart_in_que -函数参数:queid 队列编号 -函数参数:val 入队值 -函数功能:硬件队列入队 -函数使用注意点1: 当前函数不能在中断处理函数中调用 -函数使用注意点2: 多核生产者入队时需要加锁 +/******************** + + 函数名称:smart_in_que + 函数参数:queid 队列编号 + 函数参数:val 入队值 + 函数功能:硬件队列入队 + 函数使用注意点1: 多核生产者入队时需要加锁 ******************/ extern int smart_in_que(int queid,uint32_t val); -/*************** -函数名称:smart_intr_in_que -函数参数:queid 队列编号 -函数参数:val 入队值 -函数功能:硬件队列入队 -函数使用注意点1: 当前函数只能在中断处理函数中调用 -函数使用注意点2: 多核生产者入队时需要加锁 - - -******************/ -extern int smart_intr_in_que(int queid,uint32_t val); - -/*************** -函数名称:smart_intr_out_que -函数参数:queid 队列编号 -函数参数:val 入队值 -函数功能:硬件队列入队 -函数使用注意点1: 当前函数只能在中断处理函数中调用 - -******************/ - -extern int smart_intr_out_que(int queid,uint32_t *val); - - /* - 函数名称:smart_que_is_full - 输入参数: queid - 返回类型:int - 返回值: 1 表示 true - 返回?: 0 表示 false - 说明:下?版本返回值会更改enum ? - enum hwque_status smart_que_is_full(int queid); - 返回值只能?择 hwque_false 和hwque_true + 函数名称:smart_que_is_full + 输入参数: queid + 返回类型:int + 返回值: 1 表示 true + 返回值: 0 表示 false */ extern int smart_que_is_full(int queid); /********************* -函数名称:smart_out_que -函数参数:queid 队列编号 -输出参数:idx 获取当前队列的索引值 -函数功能:队列出队获取当前队列的索引值 -函数使用注意点1:当前函数不能在中断处理函数中调用 - + 函数名称:smart_out_que + 函数参数:queid 队列编号 + 输出参数:idx 获取当前队列的索引值 + 函数功能:队列出队获取当前队列的索引值 *********************/ - extern int smart_out_que(int queid,uint32_t *val); /* - 函数名称:smart_que_is_empty - 输入参数: queid - 返回类型: int - 返回值: 1 表示true - 返回值:0 表示false + 函数名称:smart_que_is_empty + 输入参数: queid + 返回类型: int + 返回值: 1 表示true + 返回值:0 表示false */ extern int smart_que_is_empty(int queid); /* - 函数名称:smart_get_que_info - 输入参数: queid - 输出参数 *dep - 输出参数: *width - 输出参数: *used - 输出参数?*cpuid - 返回类型: int - 返回值: ?0 表示失败 - 返回?: 0 表示成功 - + 函数名称:smart_get_que_info + 输入参数: queid + 输出参数 *dep + 输出参数: *width + 输出参数: *used + 输出参数: *cpuid + 返回类型: int + 返回值:0 表示成功,非0 表示失败 + */ extern int smart_get_que_info(int queid,int *dep,int *width,int *used,int *cpuid); /* - 函数名称:smart_enable_q_nempty - 输入参数: queid - 返回值: ? +// 函数名称:smart_enable_q_nempty + 函数名称:smart_hq_nempty_int_enable + 输入参数: queid + 返回值:int + 函数功能:使能非空中断 */ extern void smart_enable_q_nempty(int queid); +//extern void smart_hq_nempty_int_enable(int queid); -/******************************** - 函数名称:smart_disable_q_nempty - 输入参数: queid - 返回值: ? - 函数功能:使能非空中? - -************************************/ - -extern void smart_disable_q_nempty(int queid); /* - 函数名称:smart_que_bind - 输入参数: queid - 输入参数;cpuid - 返回类型:int - 返回? ? ?0 表示失败 - 返回值: 0 表示成功 - 函数功能:去使能非空中断 - +// 函数名称:smart_disable_q_nempty + 函数名称:smart_hq_nempty_int_disable + 输入参数: queid + 返回值:int + 函数功能:去使能非空中断 + +*/ + +extern void smart_disable_q_nempty(int queid); +//extern void smart_hq_nempty_int_disable(int queid); + + +/* + 函数名称:smart_que_bind + 输入参数: queid + 输入参数;cpuid + 返回类型:int + 返回值 : 0 表示返回成功,非0 表示返回失败 + + 函数功能:去使能非空中断 + */ extern int smart_que_bind(int cpuid,int queid); /* - 函数名称:smart_hq_debug_init - 输入参数: debug_base_addr - 输入参数;len_bytes - 返回类型:int - 返回? ? ?0 表示失败 - 返回值:0 表示成功 - 函数功能:调试初始化接口 + 函数名称:smart_hq_debug_init + 输入参数: debug_base_addr + 输入参数;len_bytes + 返回类型:int + 返回值:0 表示成功 + 函数功能:调试初始化接口 - 注意? - 通过地址与,长度指定相应的buf 数据空间,存放相应的中断调试信息? - 这些调试信息已经格式化,地址由用户指定,len_bytes 不能小于sizeof(hwq_debug_t) - 数据格式化内容是 hwq_debug_t + 注意: + 通过地址与,长度指定相应的buf 数据空间,存放相应的中断调试信息 + 这些调试信息已经格式化,地址由用户指定,len_bytes 不能小于sizeof(hwq_debug_t) + 数据格式化结构是: hwq_debug_t - 数据格式 example: - typedef struct{ - unsigned int out_failed_cnt; - unsigned int in_failed_cnt; - unsigned int out_success_cnt; - unsigned int in_success_cnt; - unsigned int cur_que_depth; - unsigned int bind_cpuid; - - }hwq_db_info ; - - typedef struct{ - hwq_db_info per_hwq[HW_QUE_NR]; - - }hwq_debug_t; + 数据格式 example: + typedef struct{ + unsigned int out_failed_cnt; + unsigned int in_failed_cnt; + unsigned int out_success_cnt; + unsigned int in_success_cnt; + unsigned int cur_que_depth; + unsigned int bind_cpuid; + + }hwq_db_info ; + + typedef struct{ + hwq_db_info per_hwq[HW_QUE_NR]; + + }hwq_debug_t; */ extern int smart_hq_debug_init( uint32_t debug_base_addr, uint32_t len_bytes); /* - 函数名称:smart_get_inque_ok_cnt - 输入参数: queid - 返回类型:int - 返回? ? 小于等于0表示失败 - 函数功能:获取当前入队成功计? + 函数名称:smart_get_inque_ok_cnt + 输入参数: queid + 返回类型:int + 返回值 : 小于等于0表示失败 + 函数功能:获取当前入队成功计数 */ extern int smart_get_inque_ok_cnt(int queid); /* - 函数名称:smart_get_inque_failed_cnt - 输入参数: queid - 返回类型:int - 返回? ? 小于等于0表示失败 - 函数功能:获取当前入队失败计? + 函数名称:smart_get_inque_failed_cnt + 输入参数: queid + 返回类型:int + 返回值 : 小于等于0表示失败 + 函数功能:获取当前入队失败计数 */ extern int smart_get_inque_failed_cnt(int queid); /* - 函数名称:smart_get_outque_ok_cnt - 输入参数: queid - 返回类型:int - 返回? ? 小于等于0表示失败 - 函数功能:获取当前出队成功计? + 函数名称:smart_get_outque_ok_cnt + 输入参数: queid + 返回类型:int + 返回值:小于等于0表示失败 + 函数功能:获取当前出队成功计数 */ extern int smart_get_outque_ok_cnt(int queid); /* - 函数名称:smart_get_outque_failed_cnt - 输入参数: queid - 返回类型:int - 返回? ? 小于等于0表示失败 - 函数功能:获取当前出队失败计? + 函数名称:smart_get_outque_failed_cnt + 输入参数: queid + 返回类型:int + 返回值: 0表示成功,非0表示失败 + 函数功能:获取当前出队失败计数 */ extern int smart_get_outque_failed_cnt(int queid);