Commit d11a22aa authored by Wilson W.K. Thong's avatar Wilson W.K. Thong

added more logs for debugging false DCI0

parent fce9f0b5
...@@ -5591,8 +5591,11 @@ uint8_t subframe2harq_pid(LTE_DL_FRAME_PARMS *frame_parms,uint32_t frame,uint8_t ...@@ -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); printf("dci_tools.c: subframe2_harq_pid, subframe %d for FDD \n",subframe);
#endif #endif
*/ */
uint8_t ret = 255;
if (frame_parms->frame_type == FDD) { if (frame_parms->frame_type == FDD) {
return(((frame<<1)+subframe)&7); ret = (((frame<<1)+subframe)&7);
} else { } else {
switch (frame_parms->tdd_config) { switch (frame_parms->tdd_config) {
...@@ -5605,17 +5608,17 @@ uint8_t subframe2harq_pid(LTE_DL_FRAME_PARMS *frame_parms,uint32_t frame,uint8_t ...@@ -5605,17 +5608,17 @@ uint8_t subframe2harq_pid(LTE_DL_FRAME_PARMS *frame_parms,uint32_t frame,uint8_t
switch (subframe) { switch (subframe) {
case 2: case 2:
case 3: case 3:
return(subframe-2); ret = (subframe-2);
break; break;
case 7: case 7:
case 8: case 8:
return(subframe-5); ret = (subframe-5);
break; break;
default: default:
LOG_E(PHY,"subframe2_harq_pid, Illegal subframe %d for TDD mode %d\n",subframe,frame_parms->tdd_config); LOG_E(PHY,"subframe2_harq_pid, Illegal subframe %d for TDD mode %d\n",subframe,frame_parms->tdd_config);
return(255); ret = (255);
break; break;
} }
...@@ -5625,72 +5628,78 @@ uint8_t subframe2harq_pid(LTE_DL_FRAME_PARMS *frame_parms,uint32_t frame,uint8_t ...@@ -5625,72 +5628,78 @@ uint8_t subframe2harq_pid(LTE_DL_FRAME_PARMS *frame_parms,uint32_t frame,uint8_t
if ((subframe!=2) && (subframe!=7)) { if ((subframe!=2) && (subframe!=7)) {
LOG_E(PHY,"subframe2_harq_pid, Illegal subframe %d for TDD mode %d\n",subframe,frame_parms->tdd_config); 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"); mac_xface->macphy_exit("subframe2_harq_pid, Illegal subframe");
return(255); ret = (255);
} }
return(subframe/7); ret = (subframe/7);
break; break;
case 3: case 3:
if ((subframe<2) || (subframe>4)) { if ((subframe<2) || (subframe>4)) {
LOG_E(PHY,"subframe2_harq_pid, Illegal subframe %d for TDD mode %d\n",subframe,frame_parms->tdd_config); 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; break;
case 4: case 4:
if ((subframe<2) || (subframe>3)) { if ((subframe<2) || (subframe>3)) {
LOG_E(PHY,"subframe2_harq_pid, Illegal subframe %d for TDD mode %d\n",subframe,frame_parms->tdd_config); 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; break;
case 5: case 5:
if (subframe!=2) { if (subframe!=2) {
LOG_E(PHY,"subframe2_harq_pid, Illegal subframe %d for TDD mode %d\n",subframe,frame_parms->tdd_config); 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; break;
default: default:
LOG_E(PHY,"subframe2_harq_pid, Unsupported TDD mode %d\n",frame_parms->tdd_config); 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 pdcch_alloc2ul_subframe(LTE_DL_FRAME_PARMS *frame_parms,uint8_t n)
{ {
uint8_t ul_subframe = 255;
if ((frame_parms->frame_type == TDD) && if ((frame_parms->frame_type == TDD) &&
(frame_parms->tdd_config == 1) && (frame_parms->tdd_config == 1) &&
((n==1)||(n==6))) // tdd_config 0,1 SF 1,5 ((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) && else if ((frame_parms->frame_type == TDD) &&
(frame_parms->tdd_config == 6) && (frame_parms->tdd_config == 6) &&
((n==0)||(n==1)||(n==5)||(n==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) && else if ((frame_parms->frame_type == TDD) &&
(frame_parms->tdd_config == 6) && (frame_parms->tdd_config == 6) &&
(n==9)) // tdd_config 6 SF 9 (n==9)) // tdd_config 6 SF 9
return((n+5)%10); ul_subframe = ((n+5)%10);
else 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) uint8_t ul_subframe2pdcch_alloc_subframe(LTE_DL_FRAME_PARMS *frame_parms,uint8_t n)
{ {
if ((frame_parms->frame_type == TDD) && if ((frame_parms->frame_type == TDD) &&
(frame_parms->tdd_config == 1) && (frame_parms->tdd_config == 1) &&
((n==7)||(n==2))) // tdd_config 0,1 SF 1,5 ((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 ...@@ -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 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) && if ((frame_parms->frame_type == TDD) &&
(frame_parms->tdd_config == 1) && (frame_parms->tdd_config == 1) &&
((n==1)||(n==6))) // tdd_config 0,1 SF 1,5 ((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) && else if ((frame_parms->frame_type == TDD) &&
(frame_parms->tdd_config == 6) && (frame_parms->tdd_config == 6) &&
((n==0)||(n==1)||(n==5)||(n==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) && else if ((frame_parms->frame_type == TDD) &&
(frame_parms->tdd_config == 6) && (frame_parms->tdd_config == 6) &&
(n==9)) // tdd_config 6 SF 9 (n==9)) // tdd_config 6 SF 9
return(frame+1); ul_frame = (frame+1);
else 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;
} }
......
...@@ -142,125 +142,134 @@ unsigned char subframe2_ul_harq(LTE_DL_FRAME_PARMS *frame_parms,unsigned char su ...@@ -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 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) { if (frame_parms->frame_type == FDD) {
return((subframe<4) ? (frame - 1) : frame); pusch_frame = ((subframe<4) ? (frame - 1) : frame);
} else { } else {
// Note this is not true, but it doesn't matter, the frame number is irrelevant for TDD! // 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 phich_subframe2_pusch_subframe(LTE_DL_FRAME_PARMS *frame_parms,uint8_t subframe)
{ {
uint8_t pusch_subframe = 255;
if (frame_parms->frame_type == FDD) 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) { switch (frame_parms->tdd_config) {
case 0: case 0:
if (subframe == 0) if (subframe == 0)
return(3); pusch_subframe = (3);
else if (subframe == 5) { else if (subframe == 5) {
return (8); pusch_subframe = (8);
} else if (subframe == 6) } else if (subframe == 6)
return (2); pusch_subframe = (2);
else if (subframe == 1) else if (subframe == 1)
return (7); pusch_subframe = (7);
else { else {
LOG_E(PHY, "phich.c: phich_subframe2_pusch_subframe, illegal subframe %d for tdd_config %d\n", LOG_E(PHY, "phich.c: phich_subframe2_pusch_subframe, illegal subframe %d for tdd_config %d\n",
subframe,frame_parms->tdd_config); subframe,frame_parms->tdd_config);
return(0); pusch_subframe = (0);
} }
break; break;
case 1: case 1:
if (subframe == 6) if (subframe == 6)
return(2); pusch_subframe = (2);
else if (subframe == 9) else if (subframe == 9)
return (3); pusch_subframe = (3);
else if (subframe == 1) else if (subframe == 1)
return (7); pusch_subframe = (7);
else if (subframe == 4) else if (subframe == 4)
return (8); pusch_subframe = (8);
else { else {
LOG_E(PHY,"phich.c: phich_subframe2_pusch_subframe, illegal subframe %d for tdd_config %d\n", LOG_E(PHY,"phich.c: phich_subframe2_pusch_subframe, illegal subframe %d for tdd_config %d\n",
subframe,frame_parms->tdd_config); subframe,frame_parms->tdd_config);
return(0); pusch_subframe = (0);
} }
break; break;
case 2: case 2:
if (subframe == 8) if (subframe == 8)
return(2); pusch_subframe = (2);
else if (subframe == 3) else if (subframe == 3)
return (7); pusch_subframe = (7);
else { else {
LOG_E(PHY,"phich.c: phich_subframe2_pusch_subframe, illegal subframe %d for tdd_config %d\n", LOG_E(PHY,"phich.c: phich_subframe2_pusch_subframe, illegal subframe %d for tdd_config %d\n",
subframe,frame_parms->tdd_config); subframe,frame_parms->tdd_config);
return(0); pusch_subframe = (0);
} }
break; break;
case 3: case 3:
if ( (subframe == 8) || (subframe == 9) ) { if ( (subframe == 8) || (subframe == 9) ) {
return(subframe-6); pusch_subframe = (subframe-6);
} else if (subframe==0) } else if (subframe==0)
return(4); pusch_subframe = (4);
else { else {
LOG_E(PHY,"phich.c: phich_subframe2_pusch_subframe, illegal subframe %d for tdd_config %d\n", LOG_E(PHY,"phich.c: phich_subframe2_pusch_subframe, illegal subframe %d for tdd_config %d\n",
subframe,frame_parms->tdd_config); subframe,frame_parms->tdd_config);
return(0); pusch_subframe = (0);
} }
break; break;
case 4: case 4:
if ( (subframe == 8) || (subframe == 9) ) { if ( (subframe == 8) || (subframe == 9) ) {
return(subframe-6); pusch_subframe = (subframe-6);
} else { } else {
LOG_E(PHY,"phich.c: phich_subframe2_pusch_subframe, illegal subframe %d for tdd_config %d\n", LOG_E(PHY,"phich.c: phich_subframe2_pusch_subframe, illegal subframe %d for tdd_config %d\n",
subframe,frame_parms->tdd_config); subframe,frame_parms->tdd_config);
return(0); pusch_subframe = (0);
} }
break; break;
case 5: case 5:
if (subframe == 8) { if (subframe == 8) {
return(2); pusch_subframe = (2);
} else { } else {
LOG_E(PHY,"phich.c: phich_subframe2_pusch_subframe, illegal subframe %d for tdd_config %d\n", LOG_E(PHY,"phich.c: phich_subframe2_pusch_subframe, illegal subframe %d for tdd_config %d\n",
subframe,frame_parms->tdd_config); subframe,frame_parms->tdd_config);
return(0); pusch_subframe = (0);
} }
break; break;
case 6: case 6:
if (subframe == 6) { if (subframe == 6) {
return(2); pusch_subframe = (2);
} else if (subframe == 9) { } else if (subframe == 9) {
return(3); pusch_subframe = (3);
} else if (subframe == 0) { } else if (subframe == 0) {
return(4); pusch_subframe = (4);
} else if (subframe == 1) { } else if (subframe == 1) {
return(7); pusch_subframe = (7);
} else if (subframe == 5) { } else if (subframe == 5) {
return(8); pusch_subframe = (8);
} else { } else {
LOG_E(PHY,"phich.c: phich_subframe2_pusch_subframe, illegal subframe %d for tdd_config %d\n", LOG_E(PHY,"phich.c: phich_subframe2_pusch_subframe, illegal subframe %d for tdd_config %d\n",
subframe,frame_parms->tdd_config); subframe,frame_parms->tdd_config);
return(0); pusch_subframe = (0);
} }
break; 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) int check_pcfich(LTE_DL_FRAME_PARMS *frame_parms,uint16_t reg)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment