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

UCP4008_SL new feature #1256

See merge request ucp/driver/ucp4008_platform_spu!56
This commit is contained in:
Xianfeng Du 2023-11-02 06:24:21 +00:00
commit c7c2891312
16 changed files with 168 additions and 103 deletions

View File

@ -7,7 +7,7 @@
#define SFN_PERIOD 10000 // 10ms #define SFN_PERIOD 10000 // 10ms
#define SLOT_SYMBOL_NUM 14 #define SLOT_SYMBOL_NUM 14
#define SPU_DRV_SM_ADDR (0x0A4F2000) // (0x0A4D7000) #define SPU_DRV_SM_ADDR (0x0A4F2000) // (0x0A4D7000) //
#define PROTO_SEL_ADDR (SPU_DRV_SM_ADDR+0x0) #define PROTO_SEL_ADDR (SPU_DRV_SM_ADDR+0x0)
#define PROTO_OPT_ADDR (SPU_DRV_SM_ADDR+0x4) #define PROTO_OPT_ADDR (SPU_DRV_SM_ADDR+0x4)

View File

@ -15,10 +15,8 @@ uint32_t* gCpriCsuStopCmd = (uint32_t*)CSU_STOP_CMD_ADDR;
void sfn_para_init(void) void sfn_para_init(void)
{ {
//gScsId = SCS_NULL;
memset(&gCellSfnPara[0], 0, sizeof(stSfnPara) * SCS_MAX_NUM); memset(&gCellSfnPara[0], 0, sizeof(stSfnPara) * SCS_MAX_NUM);
//gMtimerId = SCS_1st_MTIMER_ID; // protecting overflow
gCellSfnPara[SCS_1st_MTIMER_ID].scsId = SCS_NULL; gCellSfnPara[SCS_1st_MTIMER_ID].scsId = SCS_NULL;
gCellSfnPara[SCS_2nd_MTIMER_ID].scsId = SCS_NULL; gCellSfnPara[SCS_2nd_MTIMER_ID].scsId = SCS_NULL;
} }

View File

@ -136,15 +136,18 @@ typedef struct _tagCpriFrameHeadOffsetReq {
uint16_t u16frame_head_offset; uint16_t u16frame_head_offset;
uint8_t u8rsv[2]; uint8_t u8rsv[2];
} stCpriFrameHeadOffsetReq; } stCpriFrameHeadOffsetReq;
typedef struct _tagCpriFrameHeadOffsetRsp { typedef struct _tagCpriFrameHeadOffsetRsp {
uint8_t u8result; uint8_t u8result;
uint8_t u8rsv[3]; uint8_t u8rsv[3];
} stCpriFrameHeadOffsetRsp; } stCpriFrameHeadOffsetRsp;
typedef struct _tagCpriGetFrameHeadOffset { typedef struct _tagCpriGetFrameHeadOffset {
uint8_t u8result; uint8_t u8result;
uint8_t u8rsv; uint8_t u8rsv;
uint16_t u16frame_head_offset; uint16_t u16frame_head_offset;
}stCpriGetFrameHeadOffset; }stCpriGetFrameHeadOffset;
typedef struct _tagOamMsgTransferHeader { typedef struct _tagOamMsgTransferHeader {
uint8_t numMsg; uint8_t numMsg;
uint8_t cellIndex; uint8_t cellIndex;

View File

@ -38,6 +38,7 @@ typedef struct tEcsRfmDmLocalMgt {
stCpriCsuCmdFifoInfo* tx_cmd_fifo_ptr; stCpriCsuCmdFifoInfo* tx_cmd_fifo_ptr;
stCpriCsuCmdFifoInfo* rx_cmd_fifo_ptr; stCpriCsuCmdFifoInfo* rx_cmd_fifo_ptr;
JesdOrxPara_t* jesd_orx_para_ptr; JesdOrxPara_t* jesd_orx_para_ptr;
JesdDelay_t* jesd_delay_ptr;
} EcsRfmDmLocalMgt_t; } EcsRfmDmLocalMgt_t;
EcsRfmDmLocalMgt_t* get_ecs_rfm_dm_local_mgt(void); EcsRfmDmLocalMgt_t* get_ecs_rfm_dm_local_mgt(void);

View File

@ -3,6 +3,20 @@
#include "typedef.h" #include "typedef.h"
typedef struct JesdDelay
{
// 10ms offset, us as unit
uint32_t tx_offset;
uint32_t rx_offset;
uint32_t tdd_offset;
uint32_t gps_offset;
// 10ms tx/rx offset to pp1s
int32_t jesd_10ms2pp1s_txoffset;
int32_t jesd_10ms2pp1s_rxoffset;
int32_t jesd_tdd2pp1s_offset;
}JesdDelay_t;
typedef struct JesdOrxPara typedef struct JesdOrxPara
{ {
uint32_t orx_calldrv_cnt; uint32_t orx_calldrv_cnt;

View File

@ -40,11 +40,13 @@ int32_t ecs_rfm_dm_alloc(void)
{ {
return -1; return -1;
} }
pEcsDmLocalMgt->pCpriDelay = (stCpriDelayMeasure*)memSectionAlloc(pMemSection, sizeof(stCpriDelayMeasure), MEM_ALIGNED_4BYTES, "pCpriDelay"); pEcsDmLocalMgt->pCpriDelay = (stCpriDelayMeasure*)memSectionAlloc(pMemSection, sizeof(stCpriDelayMeasure), MEM_ALIGNED_4BYTES, "pCpriDelay");
if (NULL == pEcsDmLocalMgt->pCpriDelay) if (NULL == pEcsDmLocalMgt->pCpriDelay)
{ {
return -1; return -1;
} }
//stGpioOnBoard* pGpioInfo = (stGpioOnBoard*)0x0A4D7400; //stGpioOnBoard* pGpioInfo = (stGpioOnBoard*)0x0A4D7400;
pEcsDmLocalMgt->pGpioInfo = (stGpioOnBoard*)memSectionAlloc(pMemSection, sizeof(stGpioOnBoard), MEM_ALIGNED_4BYTES, "pGpioInfo"); // (stGpioOnBoard*)0x0A4D7400; pEcsDmLocalMgt->pGpioInfo = (stGpioOnBoard*)memSectionAlloc(pMemSection, sizeof(stGpioOnBoard), MEM_ALIGNED_4BYTES, "pGpioInfo"); // (stGpioOnBoard*)0x0A4D7400;
if (NULL == pEcsDmLocalMgt->pGpioInfo) if (NULL == pEcsDmLocalMgt->pGpioInfo)
@ -57,21 +59,25 @@ int32_t ecs_rfm_dm_alloc(void)
{ {
return -1; return -1;
} }
pEcsDmLocalMgt->pOamMsgPtr = (stOamMsgTransferHeader*)memSectionAlloc(pMemSection, sizeof(stOamMsgTransferHeader), MEM_ALIGNED_4BYTES, "pOamMsg"); pEcsDmLocalMgt->pOamMsgPtr = (stOamMsgTransferHeader*)memSectionAlloc(pMemSection, sizeof(stOamMsgTransferHeader), MEM_ALIGNED_4BYTES, "pOamMsg");
if (NULL == pEcsDmLocalMgt->pOamMsgPtr) if (NULL == pEcsDmLocalMgt->pOamMsgPtr)
{ {
return -1; return -1;
} }
pEcsDmLocalMgt->pOamBaseDelaySetRspPtr = (stCpriSetLinkDelay*)memSectionAlloc(pMemSection, sizeof(stCpriSetLinkDelay), MEM_ALIGNED_4BYTES, "pOamBaseDelaySetRsp"); pEcsDmLocalMgt->pOamBaseDelaySetRspPtr = (stCpriSetLinkDelay*)memSectionAlloc(pMemSection, sizeof(stCpriSetLinkDelay), MEM_ALIGNED_4BYTES, "pOamBaseDelaySetRsp");
if (NULL == pEcsDmLocalMgt->pOamBaseDelaySetRspPtr) if (NULL == pEcsDmLocalMgt->pOamBaseDelaySetRspPtr)
{ {
return -1; return -1;
} }
pEcsDmLocalMgt->pOamBaseDelayQryRspPtr = (stCpriGetLinkDelay*)memSectionAlloc(pMemSection, sizeof(stCpriGetLinkDelay), MEM_ALIGNED_4BYTES, "pOamBaseDelayQryRsp"); pEcsDmLocalMgt->pOamBaseDelayQryRspPtr = (stCpriGetLinkDelay*)memSectionAlloc(pMemSection, sizeof(stCpriGetLinkDelay), MEM_ALIGNED_4BYTES, "pOamBaseDelayQryRsp");
if (NULL == pEcsDmLocalMgt->pOamBaseDelayQryRspPtr) if (NULL == pEcsDmLocalMgt->pOamBaseDelayQryRspPtr)
{ {
return -1; return -1;
} }
pEcsDmLocalMgt->pOamFiberDelayQryRspPtr = (stCpriGetRndDelay*)memSectionAlloc(pMemSection, sizeof(stCpriGetRndDelay), MEM_ALIGNED_4BYTES, "OamFiberDelayQryRsp"); pEcsDmLocalMgt->pOamFiberDelayQryRspPtr = (stCpriGetRndDelay*)memSectionAlloc(pMemSection, sizeof(stCpriGetRndDelay), MEM_ALIGNED_4BYTES, "OamFiberDelayQryRsp");
if (NULL == pEcsDmLocalMgt->pOamFiberDelayQryRspPtr) if (NULL == pEcsDmLocalMgt->pOamFiberDelayQryRspPtr)
{ {
@ -83,11 +89,13 @@ int32_t ecs_rfm_dm_alloc(void)
{ {
return -1; return -1;
} }
pEcsDmLocalMgt->pOamFrameHeadOffsetQryRspPtr = (stCpriGetFrameHeadOffset*)memSectionAlloc(pMemSection, sizeof(stCpriGetFrameHeadOffset), MEM_ALIGNED_4BYTES, "pOamFrameHeadOffsetQryRspPtr"); pEcsDmLocalMgt->pOamFrameHeadOffsetQryRspPtr = (stCpriGetFrameHeadOffset*)memSectionAlloc(pMemSection, sizeof(stCpriGetFrameHeadOffset), MEM_ALIGNED_4BYTES, "pOamFrameHeadOffsetQryRspPtr");
if (NULL == pEcsDmLocalMgt->pOamFrameHeadOffsetQryRspPtr) if (NULL == pEcsDmLocalMgt->pOamFrameHeadOffsetQryRspPtr)
{ {
return -1; return -1;
} }
for (int i = 0; i < MTIMER_INTEGRATED_MAX_NUM; i++) for (int i = 0; i < MTIMER_INTEGRATED_MAX_NUM; i++)
{ {
pEcsDmLocalMgt->pMtimerPara[i] = (stMtimerPara*)memSectionAlloc(pMemSection, sizeof(stMtimerPara), MEM_ALIGNED_4BYTES, "pMtimerPara[i]"); pEcsDmLocalMgt->pMtimerPara[i] = (stMtimerPara*)memSectionAlloc(pMemSection, sizeof(stMtimerPara), MEM_ALIGNED_4BYTES, "pMtimerPara[i]");
@ -115,6 +123,12 @@ int32_t ecs_rfm_dm_alloc(void)
return -1; return -1;
} }
pEcsDmLocalMgt->jesd_delay_ptr = (JesdDelay_t*)memSectionAlloc(pMemSection, sizeof(JesdDelay_t), MEM_ALIGNED_4BYTES, "jesd_delay");
if (NULL == pEcsDmLocalMgt->jesd_delay_ptr)
{
return -1;
}
return 0; return 0;
} }
@ -213,6 +227,12 @@ int32_t ecs_rfm1_dm_init(void)
} }
memset_ucp(pEcsDmLocalMgt->jesd_orx_para_ptr, 0, sizeof(JesdOrxPara_t)); memset_ucp(pEcsDmLocalMgt->jesd_orx_para_ptr, 0, sizeof(JesdOrxPara_t));
if (NULL == pEcsDmLocalMgt->jesd_delay_ptr)
{
return -1;
}
memset_ucp(pEcsDmLocalMgt->jesd_delay_ptr, 0, sizeof(JesdDelay_t));
return 0; return 0;
} }

View File

@ -69,4 +69,7 @@ uint32_t UCP_API_CPRI_GetTxXCnt();
uint32_t UCP_API_CPRI_GetRxHfnCnt(); uint32_t UCP_API_CPRI_GetRxHfnCnt();
int32_t set_cpri_rru_msg(CpriRruMsg_t rru_msg); int32_t set_cpri_rru_msg(CpriRruMsg_t rru_msg);
uint32_t get_cpri_rru_msg_addr(); uint32_t get_cpri_rru_msg_addr();

View File

@ -7,7 +7,7 @@
//void phy_cell_para_init(int32_t nScsId); //void phy_cell_para_init(int32_t nScsId);
void mtimer_init4phy(phy_timer_config_ind_t *mtmr); int32_t mtimer_init4phy(phy_timer_config_ind_t *mtmr);
// 建小区先走ecs rfm1的建小区流程再通知APE // 建小区先走ecs rfm1的建小区流程再通知APE
int32_t mtimer_reconfig(phy_timer_config_ind_t *my_mtmr); int32_t mtimer_reconfig(phy_timer_config_ind_t *my_mtmr);

View File

@ -5,7 +5,7 @@
void ecs_rfm1_drv_init(void); void ecs_rfm1_drv_init(void);
void check_phy_cell(void); int32_t check_phy_cell(void);
void check_10ms_offset(void); void check_10ms_offset(void);

View File

@ -823,10 +823,8 @@ void isr_cpri_tdd_offset(void)
uint32_t tmrIntcFlag = 0; uint32_t tmrIntcFlag = 0;
uint32_t tEventFlag = 0; uint32_t tEventFlag = 0;
stMtimerIntStat* pMtimerInt = &gMtimerIntCnt[MTIMER_CPRI_ID]; stMtimerIntStat* pMtimerInt = &gMtimerIntCnt[MTIMER_CPRI_ID];
//#ifdef DISTRIBUTED_BS
stMtimerSfnCal* pMtimerCal = &gMtimerSfnCalPara[MTIMER_CPRI_ID]; stMtimerSfnCal* pMtimerCal = &gMtimerSfnCalPara[MTIMER_CPRI_ID];
stMtimerPhyPara* pMtimerSfn = &gMtimerSfnNum[MTIMER_CPRI_ID]; stMtimerPhyPara* pMtimerSfn = &gMtimerSfnNum[MTIMER_CPRI_ID];
//#endif
uint32_t tmrBaseAddr = mtimer_get_baseaddr(MTIMER_CPRI_ID); uint32_t tmrBaseAddr = mtimer_get_baseaddr(MTIMER_CPRI_ID);
tmrIntcFlag = do_read_volatile(tmrBaseAddr + MTMR_INTC_REG); // &CPRI_TMR_INTC_REG); tmrIntcFlag = do_read_volatile(tmrBaseAddr + MTMR_INTC_REG); // &CPRI_TMR_INTC_REG);
@ -859,8 +857,6 @@ void isr_cpri_tdd_offset(void)
cpri_tdd_start_csu_timing(); cpri_tdd_start_csu_timing();
} }
#endif #endif
//#ifdef CPRI_TIMING_7D2U_TEST
//#ifdef DISTRIBUTED_BS
#if 0 #if 0
if (32 > pMtimerInt->tddOffsetIntCnt) if (32 > pMtimerInt->tddOffsetIntCnt)
{ {
@ -942,7 +938,6 @@ void isr_cpri_tdd_offset(void)
debug_write((DBG_DDR_IDX_DRV_BASE+77), gCpriCsuFifoTxCnt); // 0x134 debug_write((DBG_DDR_IDX_DRV_BASE+77), gCpriCsuFifoTxCnt); // 0x134
} }
#endif #endif
//#endif
//debug_write((DBG_DDR_IDX_DRV_BASE+289), (GET_STC_CNT()-start)); // 0x484 //debug_write((DBG_DDR_IDX_DRV_BASE+289), (GET_STC_CNT()-start)); // 0x484
} }
if (tEventFlag & (1<<MTMR_CSU_INSERT)) // 8ms int if (tEventFlag & (1<<MTMR_CSU_INSERT)) // 8ms int
@ -1059,7 +1054,7 @@ void isr_cpri_slot_offset(void)
debug_write(((DBG_DDR_IDX_DRV_BASE+9728) + (gCpriTimerPara.txSlotIntCnt&0x1FF)), (nowTxSlotStcCnt-lastTxSlotStcCnt)); // 0x9800 debug_write(((DBG_DDR_IDX_DRV_BASE+9728) + (gCpriTimerPara.txSlotIntCnt&0x1FF)), (nowTxSlotStcCnt-lastTxSlotStcCnt)); // 0x9800
lastTxSlotStcCnt = nowTxSlotStcCnt; lastTxSlotStcCnt = nowTxSlotStcCnt;
#endif #endif
#if 1 #if 0
nowTxSlotCnt = GET_STC_CNT(); nowTxSlotCnt = GET_STC_CNT();
if ((nowTxSlotCnt > lastTxSlotCnt) && (2 < pMtimerInt->txSlotIntCnt)) if ((nowTxSlotCnt > lastTxSlotCnt) && (2 < pMtimerInt->txSlotIntCnt))
{ {

View File

@ -40,8 +40,6 @@ extern stMtimerIntStat gMtimerIntCnt[SCS_MAX_NUM];
extern stMtimerPhyPara gMtimerSfnNum[SCS_MAX_NUM]; extern stMtimerPhyPara gMtimerSfnNum[SCS_MAX_NUM];
extern stMtimerSfnCal gMtimerSfnCalPara[SCS_MAX_NUM]; extern stMtimerSfnCal gMtimerSfnCalPara[SCS_MAX_NUM];
stJesdDelay gJesdDelay;
int32_t gCsuTxAdvanceNs = JESD_TX_ADVANCE_NS; int32_t gCsuTxAdvanceNs = JESD_TX_ADVANCE_NS;
int32_t gCsuRxAdvanceNs = JESD_RX_ADVANCE_NS - JESD_RRU_TD; int32_t gCsuRxAdvanceNs = JESD_RX_ADVANCE_NS - JESD_RRU_TD;
@ -101,9 +99,12 @@ void jesd_init()
void jesd_delay_init() void jesd_delay_init()
{ {
gJesdDelay.txOffset = INT_DELAY; //CPRI_RE_TOFFSET; EcsRfmDmLocalMgt_t* pEcsDmLocalMgt = get_ecs_rfm_dm_local_mgt();
gJesdDelay.rxOffset = INT_DELAY; //CPRI_RE_TOFFSET; JesdDelay_t* jesd_delay_ptr = pEcsDmLocalMgt->jesd_delay_ptr;
gJesdDelay.tddOffset = INT_DELAY + EDMA_OFFSET; //CPRI_RE_TOFFSET + CPRI_EDMA_OFFSET;
jesd_delay_ptr->tx_offset = INT_DELAY;
jesd_delay_ptr->rx_offset = INT_DELAY;
jesd_delay_ptr->tdd_offset = INT_DELAY + EDMA_OFFSET;
} }
int32_t jesd_mtimer_init(int32_t nTmrId, int32_t nScsId, int32_t nTddSlotNum) int32_t jesd_mtimer_init(int32_t nTmrId, int32_t nScsId, int32_t nTddSlotNum)
@ -194,7 +195,8 @@ int32_t jesd_timer_get_csu_point(int32_t nTmrId, phy_timer_config_ind_t *my_jesd
EcsRfmDmLocalMgt_t* pEcsDmLocalMgt = get_ecs_rfm_dm_local_mgt(); EcsRfmDmLocalMgt_t* pEcsDmLocalMgt = get_ecs_rfm_dm_local_mgt();
stMtimerPara* pMtimerPara = pEcsDmLocalMgt->pMtimerPara[nTmrId]; stMtimerPara* pMtimerPara = pEcsDmLocalMgt->pMtimerPara[nTmrId];
stMtimerPara* pMtimerTxPara = pEcsDmLocalMgt->pMtimerPara[nTmrId+2]; stMtimerPara* pMtimerTxPara = pEcsDmLocalMgt->pMtimerPara[nTmrId+2];
uint32_t tdd = pMtimerPara->tddPeriod; JesdDelay_t* pJesdDelay = pEcsDmLocalMgt->jesd_delay_ptr;
uint32_t tdd = pMtimerPara->tddPeriod; // us
uint32_t slotUs = pMtimerPara->slotPeriod; uint32_t slotUs = pMtimerPara->slotPeriod;
uint32_t longSymbCost = slotUs*1000*LONGCP_SAM_CNT/SLOT_SAM_CNT; // ns uint32_t longSymbCost = slotUs*1000*LONGCP_SAM_CNT/SLOT_SAM_CNT; // ns
uint32_t shortSymbCost = slotUs*1000*SHORTCP_SAM_CNT/SLOT_SAM_CNT; // ns uint32_t shortSymbCost = slotUs*1000*SHORTCP_SAM_CNT/SLOT_SAM_CNT; // ns
@ -218,11 +220,11 @@ int32_t jesd_timer_get_csu_point(int32_t nTmrId, phy_timer_config_ind_t *my_jesd
dlSlotCnt = my_jesdtmr->num_t_dl[0]; dlSlotCnt = my_jesdtmr->num_t_dl[0];
dlSymbolCnt = my_jesdtmr->num_t_dl_symb[0]; dlSymbolCnt = my_jesdtmr->num_t_dl_symb[0];
} }
pMtimerTxPara->txCsuOn[i].timerPoint = tdd - gCsuTxAdvanceNs/1000; pMtimerTxPara->txCsuOn[i].timerPoint = tdd - gCsuTxAdvanceNs/1000 - pJesdDelay->gps_offset; // pJesdDelay->jesd_10ms2pp1s_txoffset;
get_jesd_timer_point_para(nTmrId+2, pMtimerTxPara->txCsuOn[i].timerPoint, &pMtimerTxPara->txCsuOn[i].pointL, get_jesd_timer_point_para(nTmrId+2, pMtimerTxPara->txCsuOn[i].timerPoint, &pMtimerTxPara->txCsuOn[i].pointL,
&pMtimerTxPara->txCsuOn[i].pointM, &pMtimerTxPara->txCsuOn[i].pointH); &pMtimerTxPara->txCsuOn[i].pointM, &pMtimerTxPara->txCsuOn[i].pointH);
pMtimerTxPara->txCsuOff[i].timerPoint = dlSlotCnt*slotUs + (longSymbCost+(dlSymbolCnt-1)*shortSymbCost)/1000; pMtimerTxPara->txCsuOff[i].timerPoint = dlSlotCnt*slotUs + (longSymbCost+(dlSymbolCnt-1)*shortSymbCost)/1000 - pJesdDelay->gps_offset; // pJesdDelay->jesd_10ms2pp1s_txoffset;
get_jesd_timer_point_para(nTmrId+2, pMtimerTxPara->txCsuOff[i].timerPoint, &pMtimerTxPara->txCsuOff[i].pointL, get_jesd_timer_point_para(nTmrId+2, pMtimerTxPara->txCsuOff[i].timerPoint, &pMtimerTxPara->txCsuOff[i].pointL,
&pMtimerTxPara->txCsuOff[i].pointM, &pMtimerTxPara->txCsuOff[i].pointH); &pMtimerTxPara->txCsuOff[i].pointM, &pMtimerTxPara->txCsuOff[i].pointH);
@ -230,7 +232,7 @@ int32_t jesd_timer_get_csu_point(int32_t nTmrId, phy_timer_config_ind_t *my_jesd
get_jesd_timer_point_para(nTmrId, pMtimerPara->rxCsuOn[i].timerPoint, &pMtimerPara->rxCsuOn[i].pointL, get_jesd_timer_point_para(nTmrId, pMtimerPara->rxCsuOn[i].timerPoint, &pMtimerPara->rxCsuOn[i].pointL,
&pMtimerPara->rxCsuOn[i].pointM, &pMtimerPara->rxCsuOn[i].pointH); &pMtimerPara->rxCsuOn[i].pointM, &pMtimerPara->rxCsuOn[i].pointH);
pMtimerPara->rxCsuOff[i].timerPoint = tdd - gCsuRxAdvanceNs/1000; pMtimerPara->rxCsuOff[i].timerPoint = tdd - gCsuRxAdvanceNs/1000 - pJesdDelay->gps_offset; // pJesdDelay->jesd_10ms2pp1s_txoffset;
get_jesd_timer_point_para(nTmrId, pMtimerPara->rxCsuOff[i].timerPoint, &pMtimerPara->rxCsuOff[i].pointL, get_jesd_timer_point_para(nTmrId, pMtimerPara->rxCsuOff[i].timerPoint, &pMtimerPara->rxCsuOff[i].pointL,
&pMtimerPara->rxCsuOff[i].pointM, &pMtimerPara->rxCsuOff[i].pointH); &pMtimerPara->rxCsuOff[i].pointM, &pMtimerPara->rxCsuOff[i].pointH);
@ -252,6 +254,7 @@ int32_t jesd_timer_get_rf_point(int32_t nTmrId, phy_timer_config_ind_t *my_jesdt
EcsRfmDmLocalMgt_t* pEcsDmLocalMgt = get_ecs_rfm_dm_local_mgt(); EcsRfmDmLocalMgt_t* pEcsDmLocalMgt = get_ecs_rfm_dm_local_mgt();
stMtimerPara* pMtimerPara = pEcsDmLocalMgt->pMtimerPara[nTmrId]; stMtimerPara* pMtimerPara = pEcsDmLocalMgt->pMtimerPara[nTmrId];
JesdDelay_t* pJesdDelay = pEcsDmLocalMgt->jesd_delay_ptr;
uint32_t tdd = pMtimerPara->tddPeriod; uint32_t tdd = pMtimerPara->tddPeriod;
uint32_t slotUs = pMtimerPara->slotPeriod; uint32_t slotUs = pMtimerPara->slotPeriod;
uint32_t longSymbCost = slotUs*1000*LONGCP_SAM_CNT/SLOT_SAM_CNT; // ns uint32_t longSymbCost = slotUs*1000*LONGCP_SAM_CNT/SLOT_SAM_CNT; // ns
@ -276,11 +279,11 @@ int32_t jesd_timer_get_rf_point(int32_t nTmrId, phy_timer_config_ind_t *my_jesdt
dlSlotCnt = my_jesdtmr->num_t_dl[0]; dlSlotCnt = my_jesdtmr->num_t_dl[0];
dlSymbolCnt = my_jesdtmr->num_t_dl_symb[0]; dlSymbolCnt = my_jesdtmr->num_t_dl_symb[0];
} }
pMtimerPara->txRfOn[i].timerPoint = tdd - do_read_volatile(JESD_RF_TXON2PP1S); //JESD_RF_ON_GAP; // tdd-8us pMtimerPara->txRfOn[i].timerPoint = tdd - do_read_volatile(JESD_RF_TXON2PP1S) - pJesdDelay->gps_offset; // pJesdDelay->jesd_10ms2pp1s_txoffset; //JESD_RF_ON_GAP; // tdd-8us
get_jesd_timer_point_para(nTmrId, pMtimerPara->txRfOn[i].timerPoint, &pMtimerPara->txRfOn[i].pointL, get_jesd_timer_point_para(nTmrId, pMtimerPara->txRfOn[i].timerPoint, &pMtimerPara->txRfOn[i].pointL,
&pMtimerPara->txRfOn[i].pointM, &pMtimerPara->txRfOn[i].pointH); &pMtimerPara->txRfOn[i].pointM, &pMtimerPara->txRfOn[i].pointH);
pMtimerPara->txRfOff[i].timerPoint = dlSlotCnt*slotUs + (longSymbCost+(dlSymbolCnt-1)*shortSymbCost)/1000; pMtimerPara->txRfOff[i].timerPoint = dlSlotCnt*slotUs + (longSymbCost+(dlSymbolCnt-1)*shortSymbCost)/1000 - pJesdDelay->gps_offset; // pJesdDelay->jesd_10ms2pp1s_txoffset;
get_jesd_timer_point_para(nTmrId, pMtimerPara->txRfOff[i].timerPoint, &pMtimerPara->txRfOff[i].pointL, get_jesd_timer_point_para(nTmrId, pMtimerPara->txRfOff[i].timerPoint, &pMtimerPara->txRfOff[i].pointL,
&pMtimerPara->txRfOff[i].pointM, &pMtimerPara->txRfOff[i].pointH); &pMtimerPara->txRfOff[i].pointM, &pMtimerPara->txRfOff[i].pointH);
@ -288,7 +291,7 @@ int32_t jesd_timer_get_rf_point(int32_t nTmrId, phy_timer_config_ind_t *my_jesdt
get_jesd_timer_point_para(nTmrId, pMtimerPara->rxRfOn[i].timerPoint, &pMtimerPara->rxRfOn[i].pointL, get_jesd_timer_point_para(nTmrId, pMtimerPara->rxRfOn[i].timerPoint, &pMtimerPara->rxRfOn[i].pointL,
&pMtimerPara->rxRfOn[i].pointM, &pMtimerPara->rxRfOn[i].pointH); &pMtimerPara->rxRfOn[i].pointM, &pMtimerPara->rxRfOn[i].pointH);
pMtimerPara->rxRfOff[i].timerPoint = tdd - do_read_volatile(JESD_RF_TXOFF2RXON); //JESD_TXRX_CHANGE_GAP; // tdd-13us pMtimerPara->rxRfOff[i].timerPoint = tdd - do_read_volatile(JESD_RF_TXOFF2RXON) - pJesdDelay->gps_offset; // pJesdDelay->jesd_10ms2pp1s_txoffset; //JESD_TXRX_CHANGE_GAP; // tdd-13us
get_jesd_timer_point_para(nTmrId, pMtimerPara->rxRfOff[i].timerPoint, &pMtimerPara->rxRfOff[i].pointL, get_jesd_timer_point_para(nTmrId, pMtimerPara->rxRfOff[i].timerPoint, &pMtimerPara->rxRfOff[i].pointL,
&pMtimerPara->rxRfOff[i].pointM, &pMtimerPara->rxRfOff[i].pointH); &pMtimerPara->rxRfOff[i].pointM, &pMtimerPara->rxRfOff[i].pointH);
@ -317,6 +320,19 @@ int32_t jesd_timer_reconfig(int32_t nTmrId, phy_timer_config_ind_t *my_jesdtmr)
stMtimerPara* pMtimerPara = pEcsDmLocalMgt->pMtimerPara[nTmrId]; stMtimerPara* pMtimerPara = pEcsDmLocalMgt->pMtimerPara[nTmrId];
stMtimerPara* pMtimerTxPara = pEcsDmLocalMgt->pMtimerPara[nTmrId+2]; stMtimerPara* pMtimerTxPara = pEcsDmLocalMgt->pMtimerPara[nTmrId+2];
stMtimerPhyPara* pMtimerSfn = &gMtimerSfnNum[nTmrId]; stMtimerPhyPara* pMtimerSfn = &gMtimerSfnNum[nTmrId];
JesdDelay_t* pJesdDelay = pEcsDmLocalMgt->jesd_delay_ptr;
uint32_t addr = (uint32_t)&(phyPara[pMtimerPara->scsId].gpsOffset);
uint16_t gpsOffset = do_read_volatile_short(addr);
pJesdDelay->gps_offset = gpsOffset;
pJesdDelay->jesd_10ms2pp1s_txoffset = pJesdDelay->tx_offset + gpsOffset; // advance us
pJesdDelay->jesd_10ms2pp1s_rxoffset = pJesdDelay->rx_offset + gpsOffset; // gpsOffset - pJesdDelay->rxOffset; // delay us
pJesdDelay->jesd_tdd2pp1s_offset = gpsOffset + pJesdDelay->tdd_offset; // advance us as positive number
do_write(CPRI_TX_ADVANCE_PP1S_ADDR, pJesdDelay->jesd_10ms2pp1s_txoffset);
do_write(CPRI_RX_ADVANCE_PP1S_ADDR, pJesdDelay->jesd_10ms2pp1s_rxoffset);
do_write(CPRI_TDD_ADVANCE_PP1S_ADDR, pJesdDelay->jesd_tdd2pp1s_offset);
int32_t scsId = my_jesdtmr->scsId; int32_t scsId = my_jesdtmr->scsId;
pMtimerPara->frameType = my_jesdtmr->frameType; pMtimerPara->frameType = my_jesdtmr->frameType;
@ -384,14 +400,16 @@ int32_t jesd_timer_reconfig(int32_t nTmrId, phy_timer_config_ind_t *my_jesdtmr)
debug_write((DBG_DDR_IDX_DRV_BASE+3+(apeId<<2)), flag); // 0xBC debug_write((DBG_DDR_IDX_DRV_BASE+3+(apeId<<2)), flag); // 0xBC
#endif #endif
set_jesd_tdd_offset(nTmrId); // 5ms int, dma set_jesd_tx_slot_offset(nTmrId);
set_jesd_rx_slot_offset(nTmrId);
#ifdef PALLADIUM_TEST #ifdef PALLADIUM_TEST
flag++; flag++;
debug_write((DBG_DDR_IDX_DRV_BASE+3+(apeId<<2)), flag); // 0xBC debug_write((DBG_DDR_IDX_DRV_BASE+3+(apeId<<2)), flag); // 0xBC
#endif #endif
set_jesd_tx_slot_offset(nTmrId); if (MTIMER_JESD_RX0_ID == nTmrId)
set_jesd_rx_slot_offset(nTmrId); {
set_jesd_tdd_offset(nTmrId); // 5ms int, dma
#ifdef PALLADIUM_TEST #ifdef PALLADIUM_TEST
flag++; flag++;
debug_write((DBG_DDR_IDX_DRV_BASE+3+(apeId<<2)), flag); // 0xBC debug_write((DBG_DDR_IDX_DRV_BASE+3+(apeId<<2)), flag); // 0xBC
@ -419,6 +437,7 @@ int32_t jesd_timer_reconfig(int32_t nTmrId, phy_timer_config_ind_t *my_jesdtmr)
debug_write((DBG_DDR_IDX_DRV_BASE+3+(apeId<<2)), flag); // 0xBC debug_write((DBG_DDR_IDX_DRV_BASE+3+(apeId<<2)), flag); // 0xBC
#endif #endif
} }
}
reCfgFlag = 1; reCfgFlag = 1;
@ -427,9 +446,10 @@ int32_t jesd_timer_reconfig(int32_t nTmrId, phy_timer_config_ind_t *my_jesdtmr)
int32_t jesd_timer_clear_cell(int32_t nTmrId, uint8_t scsId) int32_t jesd_timer_clear_cell(int32_t nTmrId, uint8_t scsId)
{ {
//UCP_API_CPRI_CSU_STOP(); // 是否需要等几个ms if (MTIMER_JESD_RX0_ID == nTmrId)
{
clear_jesd_tdd_offset(nTmrId); clear_jesd_tdd_offset(nTmrId);
}
clear_jesd_tx_slot_offset(nTmrId); clear_jesd_tx_slot_offset(nTmrId);
clear_jesd_rx_slot_offset(nTmrId); clear_jesd_rx_slot_offset(nTmrId);
if (LTE_SCS_ID == scsId) if (LTE_SCS_ID == scsId)
@ -581,8 +601,8 @@ void set_jesd_1pps_scratch(int32_t nTmrId)
// 10ms // 10ms
void set_jesd_sfn_offset(int32_t nTmrId) void set_jesd_sfn_offset(int32_t nTmrId)
{ {
//EcsRfmDmLocalMgt_t* pEcsDmLocalMgt = get_ecs_rfm_dm_local_mgt(); EcsRfmDmLocalMgt_t* pEcsDmLocalMgt = get_ecs_rfm_dm_local_mgt();
uint32_t tmr0Point = SFN_PERIOD - gJesdDelay.txOffset; // us uint32_t tmr0Point = SFN_PERIOD - pEcsDmLocalMgt->jesd_delay_ptr->jesd_10ms2pp1s_txoffset; // us
set_mtimer_tmrpoint(nTmrId, MTMR_10ms_OFFSET, tmr0Point, MTIMER_MASK_62BIT); set_mtimer_tmrpoint(nTmrId, MTMR_10ms_OFFSET, tmr0Point, MTIMER_MASK_62BIT);
enable_mtimer_tmrpoint_int(nTmrId, MTMR_10ms_OFFSET, MTMR_INT_10ms); enable_mtimer_tmrpoint_int(nTmrId, MTMR_10ms_OFFSET, MTMR_INT_10ms);
@ -592,8 +612,9 @@ void set_jesd_tdd_offset(int32_t nTmrId)
{ {
EcsRfmDmLocalMgt_t* pEcsDmLocalMgt = get_ecs_rfm_dm_local_mgt(); EcsRfmDmLocalMgt_t* pEcsDmLocalMgt = get_ecs_rfm_dm_local_mgt();
stMtimerPara* pMtimerPara = pEcsDmLocalMgt->pMtimerPara[nTmrId]; stMtimerPara* pMtimerPara = pEcsDmLocalMgt->pMtimerPara[nTmrId];
JesdDelay_t* pJesdDelay = pEcsDmLocalMgt->jesd_delay_ptr;
uint32_t tmr2Point = pMtimerPara->tddPeriod - gJesdDelay.tddOffset; // us // 5ms uint32_t tmr2Point = pMtimerPara->tddPeriod - pJesdDelay->jesd_tdd2pp1s_offset; // us // 5ms
set_mtimer_tmrpoint(nTmrId, MTMR_TDD_OFFSET, tmr2Point, MTIMER_MASK_48BIT); set_mtimer_tmrpoint(nTmrId, MTMR_TDD_OFFSET, tmr2Point, MTIMER_MASK_48BIT);
enable_mtimer_tmrpoint_int(nTmrId, MTMR_TDD_OFFSET, MTMR_INT_TDD_OFFSET); enable_mtimer_tmrpoint_int(nTmrId, MTMR_TDD_OFFSET, MTMR_INT_TDD_OFFSET);
} }
@ -605,7 +626,10 @@ void clear_jesd_tdd_offset(int32_t nTmrId)
void set_jesd_tx_slot_offset(int32_t nTmrId) void set_jesd_tx_slot_offset(int32_t nTmrId)
{ {
uint32_t tmr3Point = SFN_PERIOD - gJesdDelay.txOffset; // us EcsRfmDmLocalMgt_t* pEcsDmLocalMgt = get_ecs_rfm_dm_local_mgt();
JesdDelay_t* pJesdDelay = pEcsDmLocalMgt->jesd_delay_ptr;
int32_t tmr3Point = SFN_PERIOD - pJesdDelay->jesd_10ms2pp1s_txoffset; // pJesdDelay->tx_offset; // us
set_mtimer_tmrpoint(nTmrId, MTMR_TXSLOT_OFFSET, tmr3Point, MTIMER_MASK_32BIT); set_mtimer_tmrpoint(nTmrId, MTMR_TXSLOT_OFFSET, tmr3Point, MTIMER_MASK_32BIT);
enable_mtimer_tmrpoint_int(nTmrId, MTMR_TXSLOT_OFFSET, MTMR_INT_SLOT_OFFSET); enable_mtimer_tmrpoint_int(nTmrId, MTMR_TXSLOT_OFFSET, MTMR_INT_SLOT_OFFSET);
} }
@ -617,10 +641,14 @@ void clear_jesd_tx_slot_offset(int32_t nTmrId)
void set_jesd_rx_slot_offset(int32_t nTmrId) void set_jesd_rx_slot_offset(int32_t nTmrId)
{ {
int32_t tmr4Point = SFN_PERIOD - gJesdDelay.txOffset; //gJesdDelay.rxOffset; // // us EcsRfmDmLocalMgt_t* pEcsDmLocalMgt = get_ecs_rfm_dm_local_mgt();
JesdDelay_t* pJesdDelay = pEcsDmLocalMgt->jesd_delay_ptr;
int32_t tmr4Point = SFN_PERIOD - pJesdDelay->jesd_10ms2pp1s_txoffset; //gJesdDelay.rxOffset; // // us
set_mtimer_tmrpoint(nTmrId, MTMR_RXSLOT_OFFSET, tmr4Point, MTIMER_MASK_32BIT); set_mtimer_tmrpoint(nTmrId, MTMR_RXSLOT_OFFSET, tmr4Point, MTIMER_MASK_32BIT);
enable_mtimer_tmrpoint_int(nTmrId, MTMR_RXSLOT_OFFSET, MTMR_INT_SLOT_OFFSET); enable_mtimer_tmrpoint_int(nTmrId, MTMR_RXSLOT_OFFSET, MTMR_INT_SLOT_OFFSET);
} }
void clear_jesd_rx_slot_offset(int32_t nTmrId) void clear_jesd_rx_slot_offset(int32_t nTmrId)
{ {
disable_mtimer_tmrpoint_int(nTmrId, MTMR_RXSLOT_OFFSET, MTMR_INT_SLOT_OFFSET); disable_mtimer_tmrpoint_int(nTmrId, MTMR_RXSLOT_OFFSET, MTMR_INT_SLOT_OFFSET);
@ -637,9 +665,10 @@ int32_t set_jesd_ape_slot_offset(int32_t nTmrId, uint32_t apeCoreId)
EcsRfmDmLocalMgt_t* pEcsDmLocalMgt = get_ecs_rfm_dm_local_mgt(); EcsRfmDmLocalMgt_t* pEcsDmLocalMgt = get_ecs_rfm_dm_local_mgt();
stMtimerPara* pMtimerPara = pEcsDmLocalMgt->pMtimerPara[nTmrId]; stMtimerPara* pMtimerPara = pEcsDmLocalMgt->pMtimerPara[nTmrId];
JesdDelay_t* pJesdDelay = pEcsDmLocalMgt->jesd_delay_ptr;
pMtimerPara->runCoreId = apeCoreId; pMtimerPara->runCoreId = apeCoreId;
txOffset = gJesdDelay.txOffset; txOffset = pJesdDelay->jesd_10ms2pp1s_txoffset;
rxOffset = gJesdDelay.rxOffset; rxOffset = pJesdDelay->jesd_10ms2pp1s_txoffset;
uint32_t tmr3Point = SFN_PERIOD - txOffset; // us uint32_t tmr3Point = SFN_PERIOD - txOffset; // us
uint32_t tmr4Point = SFN_PERIOD - txOffset; // us uint32_t tmr4Point = SFN_PERIOD - txOffset; // us
@ -1050,7 +1079,6 @@ void jesd_10ms_callback(uint8_t nTmrId)
stMtimerPara* pMtimerPara = pEcsDmLocalMgt->pMtimerPara[nTmrId]; stMtimerPara* pMtimerPara = pEcsDmLocalMgt->pMtimerPara[nTmrId];
stMtimerSfnCal* pMtimerCal = &gMtimerSfnCalPara[nTmrId]; stMtimerSfnCal* pMtimerCal = &gMtimerSfnCalPara[nTmrId];
stMtimerIntStat* pMtimerInt = &gMtimerIntCnt[nTmrId]; stMtimerIntStat* pMtimerInt = &gMtimerIntCnt[nTmrId];
//stMtimerPhyPara* pMtimerSfn = &gMtimerSfnNum[nTmrId];
tmrIntcFlag = do_read_volatile(tmrBaseAddr+MTMR_INTC_REG) ; tmrIntcFlag = do_read_volatile(tmrBaseAddr+MTMR_INTC_REG) ;
__ucps2_synch(0); __ucps2_synch(0);

View File

@ -165,6 +165,7 @@ int32_t mtimer_1pps_func(uint8_t nTmrId)
orx_para_ptr->pp1s_adjust_flag = 0; orx_para_ptr->pp1s_adjust_flag = 0;
} }
// gps unlock -> lock, adjust pp1s
pMtimerCal->pp1sLockFlag = do_read_volatile(ARM_LOCK_FLAG_ADDR); pMtimerCal->pp1sLockFlag = do_read_volatile(ARM_LOCK_FLAG_ADDR);
__ucps2_synch(f_SMR); __ucps2_synch(f_SMR);
if ((0 == pMtimerCal->pp1sLockFlagPre) && (1 == pMtimerCal->pp1sLockFlag)) // pp1s刚锁定 if ((0 == pMtimerCal->pp1sLockFlagPre) && (1 == pMtimerCal->pp1sLockFlag)) // pp1s刚锁定
@ -181,6 +182,7 @@ int32_t mtimer_1pps_func(uint8_t nTmrId)
} }
pMtimerCal->pp1sLockFlagPre = pMtimerCal->pp1sLockFlag; pMtimerCal->pp1sLockFlagPre = pMtimerCal->pp1sLockFlag;
// sfn num calibration
pMtimerCal->sfnValidFlag = do_read_volatile(ARM_SFN_VALID_ADDR); pMtimerCal->sfnValidFlag = do_read_volatile(ARM_SFN_VALID_ADDR);
pMtimerCal->sfnFlipFlag = do_read_volatile(ARM_SFN_FLIP_ADDR); pMtimerCal->sfnFlipFlag = do_read_volatile(ARM_SFN_FLIP_ADDR);
__ucps2_synch(f_SMR); __ucps2_synch(f_SMR);

View File

@ -16,9 +16,9 @@ extern uint32_t gMtimerId;
extern stPhyScsPara* phyPara; extern stPhyScsPara* phyPara;
extern uint32_t reCfgFlag; extern uint32_t reCfgFlag;
extern void check_phy_cell(void); extern int32_t check_phy_cell(void);
void mtimer_init4phy(phy_timer_config_ind_t *mtmr) int32_t mtimer_init4phy(phy_timer_config_ind_t *mtmr)
{ {
uint8_t nBsType = get_protocol_sel(); uint8_t nBsType = get_protocol_sel();
//phy_cell_para_init(mtmr->scsId); //phy_cell_para_init(mtmr->scsId);
@ -37,7 +37,7 @@ void mtimer_init4phy(phy_timer_config_ind_t *mtmr)
do_write((&(pPhyCellPara->flag)), PHY_CELL_FLAG); do_write((&(pPhyCellPara->flag)), PHY_CELL_FLAG);
__ucps2_synch(f_SM); __ucps2_synch(f_SM);
check_phy_cell(); return check_phy_cell();
} }
// 建小区先走ecs rfm1的建小区流程再通知APE // 建小区先走ecs rfm1的建小区流程再通知APE

View File

@ -117,7 +117,7 @@ void ecs_rfm1_drv_init(void)
#endif #endif
} }
void check_phy_cell(void) int32_t check_phy_cell(void)
{ {
//uint32_t clockBegin,clockEnd; //uint32_t clockBegin,clockEnd;
//int32_t clockCnt; //int32_t clockCnt;
@ -142,10 +142,10 @@ void check_phy_cell(void)
//clockCnt = clockEnd - clockBegin; //clockCnt = clockEnd - clockBegin;
//debug_write((DBG_DDR_IDX_DRV_BASE+900), clockCnt); // 0xe10 //debug_write((DBG_DDR_IDX_DRV_BASE+900), clockCnt); // 0xe10
if (-1 == ret) if (0 != ret)
{ {
UCP_PRINT_ERROR("mtimer_reconfig failed. \r\n"); UCP_PRINT_ERROR("mtimer_reconfig failed. \r\n");
return; return ret;
} }
//debug_write(DBG_DDR_COMMON_IDX(get_core_id(),6), 6); //debug_write(DBG_DDR_COMMON_IDX(get_core_id(),6), 6);
@ -153,6 +153,8 @@ void check_phy_cell(void)
__ucps2_synch(f_SM); __ucps2_synch(f_SM);
//debug_write(DBG_DDR_COMMON_IDX(get_core_id(),7), 7); //debug_write(DBG_DDR_COMMON_IDX(get_core_id(),7), 7);
} }
return 0;
} }
void check_10ms_offset(void) void check_10ms_offset(void)

View File

@ -178,7 +178,11 @@ void ecs_rfm1_build_cell(uint32_t scsId, uint32_t cellId, uint32_t coreId)
return; return;
} }
mtimer_init4phy(&my_cpritmr); int32_t ret = mtimer_init4phy(&my_cpritmr);
if (0 != ret)
{
return;
}
uint32_t apeId = 0; uint32_t apeId = 0;
uint32_t runCore = my_cpritmr.runCoreId; uint32_t runCore = my_cpritmr.runCoreId;
@ -196,11 +200,6 @@ void ecs_rfm1_build_cell(uint32_t scsId, uint32_t cellId, uint32_t coreId)
runCore &= (~(1 << apeId)); runCore &= (~(1 << apeId));
h1Pos = __builtin_clz(runCore); h1Pos = __builtin_clz(runCore);
} }
//for (int32_t coreId = 0; coreId < 4; coreId++)
{
//ecs_rfm1_send_create_task_info(coreId);
}
} }
void ecs_rfm1_delete_cell(uint32_t scsId, uint32_t cellId, uint32_t coreId) void ecs_rfm1_delete_cell(uint32_t scsId, uint32_t cellId, uint32_t coreId)