Commit 02ecf9fd authored by Cedric Roux's avatar Cedric Roux

Merge branch 'bugfix-156' into develop_integration_wk01

parents 6bba411e d11a22aa
This diff is collapsed.
...@@ -5627,8 +5627,11 @@ uint8_t subframe2harq_pid(LTE_DL_FRAME_PARMS *frame_parms,uint32_t frame,uint8_t ...@@ -5627,8 +5627,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) {
...@@ -5641,17 +5644,17 @@ uint8_t subframe2harq_pid(LTE_DL_FRAME_PARMS *frame_parms,uint32_t frame,uint8_t ...@@ -5641,17 +5644,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;
} }
...@@ -5661,72 +5664,78 @@ uint8_t subframe2harq_pid(LTE_DL_FRAME_PARMS *frame_parms,uint32_t frame,uint8_t ...@@ -5661,72 +5664,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
...@@ -5746,21 +5755,25 @@ uint8_t ul_subframe2pdcch_alloc_subframe(LTE_DL_FRAME_PARMS *frame_parms,uint8_t ...@@ -5746,21 +5755,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)
......
...@@ -1098,6 +1098,14 @@ typedef enum { ...@@ -1098,6 +1098,14 @@ typedef enum {
typedef enum {SF_DL, SF_UL, SF_S} lte_subframe_t; typedef enum {SF_DL, SF_UL, SF_S} lte_subframe_t;
#endif typedef enum {
/// do not detect any DCIs in the current subframe
NO_DCI = 0x0,
/// detect only downlink DCIs in the current subframe
UL_DCI = 0x1,
/// detect only uplink DCIs in the current subframe
DL_DCI = 0x2,
/// detect both uplink and downlink DCIs in the current subframe
UL_DL_DCI = 0x3} dci_detect_mode_t;
#endif
...@@ -212,6 +212,13 @@ void prach_procedures(PHY_VARS_eNB *eNB); ...@@ -212,6 +212,13 @@ void prach_procedures(PHY_VARS_eNB *eNB);
lte_subframe_t subframe_select(LTE_DL_FRAME_PARMS *frame_parms,uint8_t subframe); lte_subframe_t subframe_select(LTE_DL_FRAME_PARMS *frame_parms,uint8_t subframe);
/*! \brief Function to compute which type of DCIs to detect in the given subframe
@param frame_parms Pointer to DL frame parameter descriptor
@param subframe Subframe index
@returns DCI detetion mode type (no DCIs, uplink DCIs, downlink DCIs, both uplink and downlink DCIs)
*/
dci_detect_mode_t dci_detect_mode_select(LTE_DL_FRAME_PARMS *frame_parms,uint8_t subframe);
/*! \brief Function to compute subframe type as a function of Frame type and TDD Configuration (implements Table 4.2.2 from 36.211, p.11 from version 8.6) and subframe index. Same as subframe_select, except that it uses the Mod_id and is provided as a service to the MAC scheduler. /*! \brief Function to compute subframe type as a function of Frame type and TDD Configuration (implements Table 4.2.2 from 36.211, p.11 from version 8.6) and subframe index. Same as subframe_select, except that it uses the Mod_id and is provided as a service to the MAC scheduler.
@param Mod_id Index of eNB @param Mod_id Index of eNB
@param CC_id Component Carrier Index @param CC_id Component Carrier Index
......
...@@ -518,6 +518,34 @@ lte_subframe_t subframe_select(LTE_DL_FRAME_PARMS *frame_parms,unsigned char sub ...@@ -518,6 +518,34 @@ lte_subframe_t subframe_select(LTE_DL_FRAME_PARMS *frame_parms,unsigned char sub
} }
} }
dci_detect_mode_t dci_detect_mode_select(LTE_DL_FRAME_PARMS *frame_parms,uint8_t subframe)
{
dci_detect_mode_t ret = 0;
static dci_detect_mode_t Table_8_2_3gpp_36_213[][10] = {
//subf0 , subf1 , subf2 , subf3 , subf4 , subf5 , subf6 , subf7 , subf8 , subf9
{UL_DL_DCI, UL_DL_DCI , NO_DCI , NO_DCI , NO_DCI , UL_DL_DCI , UL_DL_DCI , NO_DCI, NO_DCI , NO_DCI }, // tdd0
{DL_DCI , UL_DL_DCI , NO_DCI , NO_DCI , UL_DL_DCI , DL_DCI , UL_DL_DCI , NO_DCI, NO_DCI , UL_DL_DCI }, // tdd1
{DL_DCI , DL_DCI , NO_DCI , UL_DL_DCI , DL_DCI , DL_DCI , DL_DCI , NO_DCI, UL_DL_DCI , DL_DCI }, // tdd2
{UL_DL_DCI, DL_DCI , NO_DCI , NO_DCI , NO_DCI , DL_DCI , DL_DCI , DL_DCI, UL_DL_DCI , UL_DL_DCI }, // tdd3
{DL_DCI , DL_DCI , NO_DCI , NO_DCI , DL_DCI , DL_DCI , DL_DCI , DL_DCI, UL_DL_DCI , UL_DL_DCI }, // tdd4
{DL_DCI , DL_DCI , NO_DCI , DL_DCI , DL_DCI , DL_DCI , DL_DCI , DL_DCI, UL_DL_DCI , DL_DCI }, // tdd5
{UL_DL_DCI, UL_DL_DCI , NO_DCI , NO_DCI , NO_DCI , UL_DL_DCI , UL_DL_DCI , NO_DCI, NO_DCI , UL_DL_DCI }}; // tdd6
DevAssert(subframe>=0 && subframe<=9);
DevAssert((frame_parms->tdd_config)>=0 && (frame_parms->tdd_config)<=6);
if (frame_parms->frame_type == FDD) {
ret = UL_DL_DCI;
} else {
ret = Table_8_2_3gpp_36_213[frame_parms->tdd_config][subframe];
}
LOG_D(PHY, "subframe %d: detect UL_DCI=%d, detect DL_DCI=%d\n", subframe, (ret & UL_DCI)>0, (ret & DL_DCI)>0);
return ret;
}
lte_subframe_t get_subframe_direction(uint8_t Mod_id,uint8_t CC_id,uint8_t subframe) lte_subframe_t get_subframe_direction(uint8_t Mod_id,uint8_t CC_id,uint8_t subframe)
{ {
......
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