From d11a22aa8d78891d61317f0cc9c4c39f0f81f060 Mon Sep 17 00:00:00 2001 From: "Wilson W.K. Thong" <wilsonthong@astri.org> Date: Thu, 15 Dec 2016 10:39:22 +0800 Subject: [PATCH] added more logs for debugging false DCI0 --- openair1/PHY/LTE_TRANSPORT/dci_tools.c | 59 +++++++++++++--------- openair1/PHY/LTE_TRANSPORT/phich.c | 69 +++++++++++++++----------- 2 files changed, 75 insertions(+), 53 deletions(-) diff --git a/openair1/PHY/LTE_TRANSPORT/dci_tools.c b/openair1/PHY/LTE_TRANSPORT/dci_tools.c index a1c118529a..396331a0f8 100644 --- a/openair1/PHY/LTE_TRANSPORT/dci_tools.c +++ b/openair1/PHY/LTE_TRANSPORT/dci_tools.c @@ -5591,8 +5591,11 @@ uint8_t subframe2harq_pid(LTE_DL_FRAME_PARMS *frame_parms,uint32_t frame,uint8_t printf("dci_tools.c: subframe2_harq_pid, subframe %d for FDD \n",subframe); #endif */ + + uint8_t ret = 255; + if (frame_parms->frame_type == FDD) { - return(((frame<<1)+subframe)&7); + ret = (((frame<<1)+subframe)&7); } else { switch (frame_parms->tdd_config) { @@ -5605,17 +5608,17 @@ uint8_t subframe2harq_pid(LTE_DL_FRAME_PARMS *frame_parms,uint32_t frame,uint8_t switch (subframe) { case 2: case 3: - return(subframe-2); + ret = (subframe-2); break; case 7: case 8: - return(subframe-5); + ret = (subframe-5); break; default: LOG_E(PHY,"subframe2_harq_pid, Illegal subframe %d for TDD mode %d\n",subframe,frame_parms->tdd_config); - return(255); + ret = (255); break; } @@ -5625,72 +5628,78 @@ uint8_t subframe2harq_pid(LTE_DL_FRAME_PARMS *frame_parms,uint32_t frame,uint8_t if ((subframe!=2) && (subframe!=7)) { LOG_E(PHY,"subframe2_harq_pid, Illegal subframe %d for TDD mode %d\n",subframe,frame_parms->tdd_config); mac_xface->macphy_exit("subframe2_harq_pid, Illegal subframe"); - return(255); + ret = (255); } - return(subframe/7); + ret = (subframe/7); break; case 3: if ((subframe<2) || (subframe>4)) { LOG_E(PHY,"subframe2_harq_pid, Illegal subframe %d for TDD mode %d\n",subframe,frame_parms->tdd_config); - return(255); + ret = (255); } - return(subframe-2); + ret = (subframe-2); break; case 4: if ((subframe<2) || (subframe>3)) { LOG_E(PHY,"subframe2_harq_pid, Illegal subframe %d for TDD mode %d\n",subframe,frame_parms->tdd_config); - return(255); + ret = (255); } - return(subframe-2); + ret = (subframe-2); break; case 5: if (subframe!=2) { LOG_E(PHY,"subframe2_harq_pid, Illegal subframe %d for TDD mode %d\n",subframe,frame_parms->tdd_config); - return(255); + ret = (255); } - return(subframe-2); + ret = (subframe-2); break; default: LOG_E(PHY,"subframe2_harq_pid, Unsupported TDD mode %d\n",frame_parms->tdd_config); - return(255); + ret = (255); } } - return(255); + if (ret == 255) { + LOG_E(PHY, "invalid harq_pid(%d) at SFN/SF = %d/%d\n", ret, frame, subframe); + mac_xface->macphy_exit("invalid harq_pid"); + } + return ret; } uint8_t pdcch_alloc2ul_subframe(LTE_DL_FRAME_PARMS *frame_parms,uint8_t n) { + uint8_t ul_subframe = 255; if ((frame_parms->frame_type == TDD) && (frame_parms->tdd_config == 1) && ((n==1)||(n==6))) // tdd_config 0,1 SF 1,5 - return((n+6)%10); + ul_subframe = ((n+6)%10); else if ((frame_parms->frame_type == TDD) && (frame_parms->tdd_config == 6) && ((n==0)||(n==1)||(n==5)||(n==6))) - return((n+7)%10); + ul_subframe = ((n+7)%10); else if ((frame_parms->frame_type == TDD) && (frame_parms->tdd_config == 6) && (n==9)) // tdd_config 6 SF 9 - return((n+5)%10); + ul_subframe = ((n+5)%10); else - return((n+4)%10); + ul_subframe = ((n+4)%10); + LOG_D(PHY, "subframe %d: PUSCH subframe = %d\n", n, ul_subframe); + return ul_subframe; } uint8_t ul_subframe2pdcch_alloc_subframe(LTE_DL_FRAME_PARMS *frame_parms,uint8_t n) { - if ((frame_parms->frame_type == TDD) && (frame_parms->tdd_config == 1) && ((n==7)||(n==2))) // tdd_config 0,1 SF 1,5 @@ -5710,21 +5719,25 @@ uint8_t ul_subframe2pdcch_alloc_subframe(LTE_DL_FRAME_PARMS *frame_parms,uint8_t uint32_t pdcch_alloc2ul_frame(LTE_DL_FRAME_PARMS *frame_parms,uint32_t frame, uint8_t n) { + uint32_t ul_frame = 255; if ((frame_parms->frame_type == TDD) && (frame_parms->tdd_config == 1) && ((n==1)||(n==6))) // tdd_config 0,1 SF 1,5 - return(frame + (n==1 ? 0 : 1)); + ul_frame = (frame + (n==1 ? 0 : 1)); else if ((frame_parms->frame_type == TDD) && (frame_parms->tdd_config == 6) && ((n==0)||(n==1)||(n==5)||(n==6))) - return(frame + (n>=5 ? 1 : 0)); + ul_frame = (frame + (n>=5 ? 1 : 0)); else if ((frame_parms->frame_type == TDD) && (frame_parms->tdd_config == 6) && (n==9)) // tdd_config 6 SF 9 - return(frame+1); + ul_frame = (frame+1); else - return(frame+(n>=6 ? 1 : 0)); + ul_frame = (frame+(n>=6 ? 1 : 0)); + + LOG_D(PHY, "frame %d subframe %d: PUSCH frame = %d\n", frame, n, ul_frame); + return ul_frame; } diff --git a/openair1/PHY/LTE_TRANSPORT/phich.c b/openair1/PHY/LTE_TRANSPORT/phich.c index 989567ca34..73ecb0e17b 100644 --- a/openair1/PHY/LTE_TRANSPORT/phich.c +++ b/openair1/PHY/LTE_TRANSPORT/phich.c @@ -142,125 +142,134 @@ unsigned char subframe2_ul_harq(LTE_DL_FRAME_PARMS *frame_parms,unsigned char su uint8_t phich_frame2_pusch_frame(LTE_DL_FRAME_PARMS *frame_parms,frame_t frame,uint8_t subframe) { + uint8_t pusch_frame = 255; if (frame_parms->frame_type == FDD) { - return((subframe<4) ? (frame - 1) : frame); + pusch_frame = ((subframe<4) ? (frame - 1) : frame); } else { // Note this is not true, but it doesn't matter, the frame number is irrelevant for TDD! - return(frame); + pusch_frame = (frame); } + + LOG_D(PHY, "frame %d subframe %d: PUSCH frame = %d\n", frame, subframe, pusch_frame); + return pusch_frame; } uint8_t phich_subframe2_pusch_subframe(LTE_DL_FRAME_PARMS *frame_parms,uint8_t subframe) { + uint8_t pusch_subframe = 255; if (frame_parms->frame_type == FDD) - return(subframe<4 ? (subframe+6) : (subframe-4)); + pusch_subframe = (subframe<4 ? (subframe+6) : (subframe-4)); switch (frame_parms->tdd_config) { case 0: if (subframe == 0) - return(3); + pusch_subframe = (3); else if (subframe == 5) { - return (8); + pusch_subframe = (8); } else if (subframe == 6) - return (2); + pusch_subframe = (2); else if (subframe == 1) - return (7); + pusch_subframe = (7); else { LOG_E(PHY, "phich.c: phich_subframe2_pusch_subframe, illegal subframe %d for tdd_config %d\n", subframe,frame_parms->tdd_config); - return(0); + pusch_subframe = (0); } break; case 1: if (subframe == 6) - return(2); + pusch_subframe = (2); else if (subframe == 9) - return (3); + pusch_subframe = (3); else if (subframe == 1) - return (7); + pusch_subframe = (7); else if (subframe == 4) - return (8); + pusch_subframe = (8); else { LOG_E(PHY,"phich.c: phich_subframe2_pusch_subframe, illegal subframe %d for tdd_config %d\n", subframe,frame_parms->tdd_config); - return(0); + pusch_subframe = (0); } break; case 2: if (subframe == 8) - return(2); + pusch_subframe = (2); else if (subframe == 3) - return (7); + pusch_subframe = (7); else { LOG_E(PHY,"phich.c: phich_subframe2_pusch_subframe, illegal subframe %d for tdd_config %d\n", subframe,frame_parms->tdd_config); - return(0); + pusch_subframe = (0); } break; case 3: if ( (subframe == 8) || (subframe == 9) ) { - return(subframe-6); + pusch_subframe = (subframe-6); } else if (subframe==0) - return(4); + pusch_subframe = (4); else { LOG_E(PHY,"phich.c: phich_subframe2_pusch_subframe, illegal subframe %d for tdd_config %d\n", subframe,frame_parms->tdd_config); - return(0); + pusch_subframe = (0); } break; case 4: if ( (subframe == 8) || (subframe == 9) ) { - return(subframe-6); + pusch_subframe = (subframe-6); } else { LOG_E(PHY,"phich.c: phich_subframe2_pusch_subframe, illegal subframe %d for tdd_config %d\n", subframe,frame_parms->tdd_config); - return(0); + pusch_subframe = (0); } break; case 5: if (subframe == 8) { - return(2); + pusch_subframe = (2); } else { LOG_E(PHY,"phich.c: phich_subframe2_pusch_subframe, illegal subframe %d for tdd_config %d\n", subframe,frame_parms->tdd_config); - return(0); + pusch_subframe = (0); } break; case 6: if (subframe == 6) { - return(2); + pusch_subframe = (2); } else if (subframe == 9) { - return(3); + pusch_subframe = (3); } else if (subframe == 0) { - return(4); + pusch_subframe = (4); } else if (subframe == 1) { - return(7); + pusch_subframe = (7); } else if (subframe == 5) { - return(8); + pusch_subframe = (8); } else { LOG_E(PHY,"phich.c: phich_subframe2_pusch_subframe, illegal subframe %d for tdd_config %d\n", subframe,frame_parms->tdd_config); - return(0); + pusch_subframe = (0); } break; + default: + LOG_E(PHY, "no implementation for TDD UL/DL-config = %d!\n", frame_parms->tdd_config); + pusch_subframe = (0); } - return(0); + LOG_D(PHY, "subframe %d: PUSCH subframe = %d\n", subframe, pusch_subframe); + return pusch_subframe; } int check_pcfich(LTE_DL_FRAME_PARMS *frame_parms,uint16_t reg) -- GitLab