Merge branch 'dev_ck_v2.1_bug#1968' into 'dev_ck_v2.1'

UCP4008-SL bug#1968

See merge request ucp/driver/ucp4008_platform_spu!110
This commit is contained in:
Weihua Li 2024-05-23 02:40:56 +00:00
commit f90410f55c

View File

@ -13,7 +13,7 @@
#include "ape_ecpri_timer.h"
//#endif
extern void osp_timer_call_task_spe(uint8_t u8slot, uint8_t u8taskidx); /* 定时点任务从首位开始 */
extern void osp_timer_call_task_spe(uint8_t u8slot, uint8_t u8taskidx); /* ?¨ê±μ?è???′óê×???aê? */
//extern void osp_timer_restart(void);
extern void osp_timer_call_task();
@ -154,7 +154,7 @@ int32_t ape_cal_sfn(uint8_t nTmrId)
{
for (i = 0; i < PHY_SCS_MAX_NUM; i++)
{
if (nTmrId == do_read_volatile_short(&(phyPara[i].mtimerId))) // 已建了第一个子载波小区
if (nTmrId == do_read_volatile_short(&(phyPara[i].mtimerId))) // ò??¨á?μúò???×ó??2¨D???
{
gCellSfnPara[nTmrId].scsId = i;
scsId = i;
@ -204,17 +204,17 @@ void ape_slot_ctw_set(uint8_t nTmrId)
{
gStcTimerPara.curSlotNum = slotIdx;
gStcTimerPara.curSlotTmrPointId = 0;
// debug_write(((DBG_DDR_IDX_DRV_BASE+9216) + (gSfnPara.txSlotIntCnt&0x1FF) + (apeId << 9)), GET_STC_CNT()); // 0x9000 // 更新完时隙号
// debug_write(((DBG_DDR_IDX_DRV_BASE+9216) + (gSfnPara.txSlotIntCnt&0x1FF) + (apeId << 9)), GET_STC_CNT()); // 0x9000 // ?üD?íêê±??o?
int32_t pointIdx = gStcTimerPara.curSlotNum * gStcTimerPara.slotPointNum + 0;
if (1 != gStcTimerPara.tmrPoint[pointIdx].lastFlag) // not the last point of this slot, set the next ctw point
{
stc_timer_set_next_ctw(1);
stc_timer_ctwint_enable();
}
debug_write(((DBG_DDR_IDX_DRV_BASE+15360) + (gCellSfnPara[nTmrId].txSlotIntCnt&0x1FF) + (apeId << 9)), GET_STC_CNT()); // 0xd000 // 设置完下一个stc点
debug_write(((DBG_DDR_IDX_DRV_BASE+15360) + (gCellSfnPara[nTmrId].txSlotIntCnt&0x1FF) + (apeId << 9)), GET_STC_CNT()); // 0xd000 // éè??íê??ò???stcμ?
//osp_timer_call_task();
osp_timer_call_task_spe(gStcTimerPara.curSlotNum, 0); /* 定时点任务从首位开始 */
osp_timer_call_task_spe(gStcTimerPara.curSlotNum, 0); /* ?¨ê±μ?è???′óê×???aê? */
gStcTimerPara.apeSlotCallCnt++;
#ifdef PALLADIUM_TEST
debug_write((DBG_DDR_IDX_DRV_BASE+100+(apeId<<1)), gStcTimerPara.apeSlotCallCnt); // 0x190
@ -277,7 +277,7 @@ int32_t mtimer_ape_slot_callback(uint8_t nTmrId)
{
if (tEventFlag & (1<<txSlotTmrId)) // tx slot offset
{
// debug_write(((DBG_DDR_IDX_DRV_BASE+8192) + (gSfnPara.txSlotIntCnt&0x1FF) + (apeId << 9)), GET_STC_CNT()); // 0x8000 // 刚进时隙中断
// debug_write(((DBG_DDR_IDX_DRV_BASE+8192) + (gSfnPara.txSlotIntCnt&0x1FF) + (apeId << 9)), GET_STC_CNT()); // 0x8000 // ????ê±???D??
uint32_t crVal = (1<<txSlotTmrId);
do_write((tmrBaseAddr+MTMR_TEVENT0_REG), crVal);
@ -303,7 +303,7 @@ int32_t mtimer_ape_slot_callback(uint8_t nTmrId)
// about stc timer point
ape_slot_ctw_set(nTmrId);
// debug_write(((DBG_DDR_IDX_DRV_BASE+14336) + (gSfnPara.txSlotIntCnt&0x1FF) + (apeId << 9)), GET_STC_CNT()); // 0xe000 // 中断即将退出
// debug_write(((DBG_DDR_IDX_DRV_BASE+14336) + (gSfnPara.txSlotIntCnt&0x1FF) + (apeId << 9)), GET_STC_CNT()); // 0xe000 // ?D?????í?3?
#ifdef PALLADIUM_TEST
if (8 > gCellSfnPara[nTmrId].txSlotIntCnt)
{
@ -409,58 +409,73 @@ int32_t get_tx_lte_subframe()
int32_t get_rx_nr_sfn()
{
int32_t txSfn = get_tx_nr_sfn();
int32_t txSlotNum = get_tx_nr_slot();
int32_t rxSlotNum = get_rx_nr_slot();
if (-1 == rxSlotNum)
if (txSlotNum)
{
return -1;
}
if (txSlotNum >= rxSlotNum)
{
return get_tx_nr_sfn();
return txSfn;
}
else
{
return (get_tx_nr_sfn()-1);
//规避tx slot19和slot0跨Sfn问题在slot0用后取sfn做保护
txSfn = get_tx_nr_sfn();
if (get_rx_slot_cycle() < 0)
{
return (txSfn - 1 + 1024) % 1024;
}
else
{
return txSfn;
}
}
}
int32_t get_rx_lte_sfn()
{
int32_t txSfn = get_tx_lte_sfn();
int32_t txSlotNum = get_tx_lte_subframe();
int32_t rxSlotNum = get_rx_lte_subframe();
if (-1 == rxSlotNum)
if (txSlotNum)
{
return -1;
}
if (txSlotNum >= rxSlotNum)
{
return get_tx_lte_sfn();
return txSfn;
}
else
{
return (get_tx_lte_sfn()-1);
//规避tx slot19和slot0跨Sfn问题在slot0用后取sfn做保护
txSfn = get_tx_lte_sfn();
if (get_rx_slot_cycle() < 0)
{
return (txSfn - 1 + 1024) % 1024;
}
else
{
return txSfn;
}
}
}
int32_t get_rx_nr_slot()
{
int32_t rxSlotNum = 0;
int32_t offsetCycle = get_rx_slot_cycle();
if (-1 != offsetCycle)
{
if (0 <= offsetCycle)
{
rxSlotNum = gCellSfnPara[gMtimerId].txSlotNum - (offsetCycle)/(gCellSfnPara[gMtimerId].slotPeriod*1000);
}
else
{
rxSlotNum = gCellSfnPara[gMtimerId].txSlotNum - 1 - __ucps2_abs(offsetCycle)/(gCellSfnPara[gMtimerId].slotPeriod*1000);
}
if (0 > rxSlotNum)
{
rxSlotNum = (rxSlotNum + gCellSfnPara[gMtimerId].slotMaxNum) % gCellSfnPara[gMtimerId].slotMaxNum;
}
//规避txSlotNum模糊值当offsetCycle<0时txSlotNum2与当offsetCycle匹配反之txSlotNum1与当offsetCycle匹配
int32_t txSlotNum = gCellSfnPara[gMtimerId].txSlotNum;
int32_t offsetCycle = get_rx_slot_cycle();
if (-1 != offsetCycle)
{ /*考虑到txrx_interval为非负数若offsetCycle>0则rxslotNum=txslotNum*/
if (0 <= offsetCycle)
{
rxSlotNum = txSlotNum;// - (offsetCycle)/(gCellSfnPara[gMtimerId].slotPeriod*1000);
}
else
{
txSlotNum = gCellSfnPara[gMtimerId].txSlotNum;
rxSlotNum = txSlotNum - 1; //+ (offsetCycle)/(gCellSfnPara[gMtimerId].slotPeriod*1000);
if (0 > rxSlotNum)
{
rxSlotNum = rxSlotNum + gCellSfnPara[gMtimerId].slotMaxNum;
}
}
return rxSlotNum;
}
@ -473,21 +488,25 @@ int32_t get_rx_nr_slot()
int32_t get_rx_lte_subframe()
{
int32_t rxSlotNum = 0;
int32_t offsetCycle = get_rx_slot_cycle();
if (-1 != offsetCycle)
{
if (0 <= offsetCycle)
{
rxSlotNum = gCellSfnPara[gMtimerId].txSlotNum - (offsetCycle)/(gCellSfnPara[gMtimerId].slotPeriod*1000);
}
else
{
rxSlotNum = gCellSfnPara[gMtimerId].txSlotNum - 1 - __ucps2_abs(offsetCycle)/(gCellSfnPara[gMtimerId].slotPeriod*1000);
}
if (0 > rxSlotNum)
{
rxSlotNum = (rxSlotNum + gCellSfnPara[gMtimerId].slotMaxNum) % gCellSfnPara[gMtimerId].slotMaxNum;
}
//规避txSlotNum模糊值当offsetCycle<0时txSlotNum2与当offsetCycle匹配反之txSlotNum1与当offsetCycle匹配
int32_t txSlotNum = gCellSfnPara[gMtimerId].txSlotNum;
int32_t offsetCycle = get_rx_slot_cycle();
if (-1 != offsetCycle)
{ /*考虑到txrx_interval为非负数若offsetCycle>0则rxslotNum=txslotNum*/
if (0 <= offsetCycle)
{
rxSlotNum = txSlotNum;// - (offsetCycle)/(gCellSfnPara[gMtimerId].slotPeriod*1000);
}
else
{
txSlotNum = gCellSfnPara[gMtimerId].txSlotNum;
rxSlotNum = txSlotNum - 1; //+ (offsetCycle)/(gCellSfnPara[gMtimerId].slotPeriod*1000);
if (0 > rxSlotNum)
{
rxSlotNum = rxSlotNum + gCellSfnPara[gMtimerId].slotMaxNum;
}
}
return rxSlotNum;
}
@ -495,6 +514,7 @@ int32_t get_rx_lte_subframe()
{
return -1;
}
}
int32_t get_tx_nr_slot_cycle()
@ -502,10 +522,17 @@ int32_t get_tx_nr_slot_cycle()
uint32_t txSlotTiming = (uint32_t)gCellSfnPara[gMtimerId].txSlotTiming;
__ucps2_synch(0);
int32_t offsetCycle = GET_STC_CNT() - txSlotTiming;
int32_t slotPeriodns = gCellSfnPara[gMtimerId].slotPeriod * 1000;
if (0 > offsetCycle)
{
/*slot长度不会超过1s不需要求余计算*/
uint32_t limitVal = 1000000000;
offsetCycle = (offsetCycle+limitVal)%limitVal;
//offsetCycle = (offsetCycle+limitVal)%limitVal;
offsetCycle += limitVal;
}
if (offsetCycle >= slotPeriodns)//考虑跨slot场景
{
offsetCycle -= slotPeriodns;
}
return offsetCycle;
@ -516,10 +543,17 @@ int32_t get_tx_lte_subframe_cycle()
uint32_t txSlotTiming = (uint32_t)gCellSfnPara[gMtimerId].txSlotTiming;
__ucps2_synch(0);
int32_t offsetCycle = GET_STC_CNT() - txSlotTiming;
int32_t slotPeriodns = gCellSfnPara[gMtimerId].slotPeriod * 1000;
if (0 > offsetCycle)
{
/*slot长度不会超过1s不需要求余计算*/
uint32_t limitVal = 1000000000;
offsetCycle = (offsetCycle+limitVal)%limitVal;
//offsetCycle = (offsetCycle+limitVal)%limitVal;
offsetCycle += limitVal;
}
if (offsetCycle >= slotPeriodns)//考虑跨slot场景
{
offsetCycle -= slotPeriodns;
}
return offsetCycle;
@ -533,10 +567,17 @@ int32_t get_rx_slot_cycle()
uint32_t txSlotTiming = (uint32_t)gCellSfnPara[gMtimerId].txSlotTiming;
__ucps2_synch(0);
int32_t offsetCycle = GET_STC_CNT() - txSlotTiming;
int32_t slotPeriodns = gCellSfnPara[gMtimerId].slotPeriod * 1000;
if (0 > offsetCycle)
{
/*slot长度不会超过1s不需要求余计算*/
uint32_t limitVal = 1000000000;
offsetCycle = (offsetCycle+limitVal)%limitVal;
//offsetCycle = (offsetCycle+limitVal)%limitVal;
offsetCycle += limitVal;
}
if (offsetCycle >= slotPeriodns)//考虑跨slot场景
{
offsetCycle -= slotPeriodns;
}
offsetCycle -= interval;
@ -556,15 +597,22 @@ int32_t get_rx_nr_slot_cycle()
uint32_t txSlotTiming = (uint32_t)gCellSfnPara[gMtimerId].txSlotTiming;
__ucps2_synch(0);
int32_t offsetCycle = GET_STC_CNT() - txSlotTiming;
int32_t slotPeriodns = gCellSfnPara[gMtimerId].slotPeriod * 1000;
if (0 > offsetCycle)
{
/*slot长度不会超过1s不需要求余计算*/
uint32_t limitVal = 1000000000;
offsetCycle = (offsetCycle+limitVal)%limitVal;
//offsetCycle = (offsetCycle+limitVal)%limitVal;
offsetCycle += limitVal;
}
if (offsetCycle >= slotPeriodns)//考虑跨slot场景
{
offsetCycle -= slotPeriodns;
}
offsetCycle -= interval;
if (0 > offsetCycle)
{
offsetCycle += (gCellSfnPara[gMtimerId].slotPeriod*1000);
offsetCycle += slotPeriodns;
}
return offsetCycle;
@ -577,21 +625,28 @@ int32_t get_rx_nr_slot_cycle()
int32_t get_rx_lte_subframe_cycle()
{
int32_t interval = get_tx_rx_interval();
int32_t interval = get_tx_rx_interval();
if (0 <= interval)
{
uint32_t txSlotTiming = (uint32_t)gCellSfnPara[gMtimerId].txSlotTiming;
__ucps2_synch(0);
int32_t offsetCycle = GET_STC_CNT() - txSlotTiming;
int32_t slotPeriodns = gCellSfnPara[gMtimerId].slotPeriod * 1000;
if (0 > offsetCycle)
{
/*slot长度不会超过1s不需要求余计算*/
uint32_t limitVal = 1000000000;
offsetCycle = (offsetCycle+limitVal)%limitVal;
//offsetCycle = (offsetCycle+limitVal)%limitVal;
offsetCycle += limitVal;
}
if (offsetCycle >= slotPeriodns)//考虑跨slot场景
{
offsetCycle -= slotPeriodns;
}
offsetCycle -= interval;
if (0 > offsetCycle)
{
offsetCycle += (gCellSfnPara[gMtimerId].slotPeriod*1000);
offsetCycle += slotPeriodns;
}
return offsetCycle;