Commit 1b53fd40 authored by Thomas Schlichter's avatar Thomas Schlichter

mcch logical channel properly decoded

This commit was developed at Fraunhofer IIS (https://www.iis.fraunhofer.de) by Javier Morgade, Ph.D.
parent 02f94bf3
...@@ -3128,7 +3128,7 @@ void ue_pmch_procedures(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc,int eNB_id,int abs ...@@ -3128,7 +3128,7 @@ void ue_pmch_procedures(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc,int eNB_id,int abs
// LOG_D(PHY,"ue calling pmch subframe ..\n "); // LOG_D(PHY,"ue calling pmch subframe ..\n ");
LOG_D(PHY,"[UE %d] Frame %d, subframe %d: Querying for PMCH demodulation\n", LOG_D(PHY,"[UE %d] Frame %d, subframe %d: Querying for PMCH demodulation\n",
ue->Mod_id,(subframe_rx==9?-1:0)+frame_rx,subframe_rx); ue->Mod_id,frame_rx,subframe_rx);
#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) #if (RRC_VERSION >= MAKE_VERSION(10, 0, 0))
pmch_mcs = ue_query_mch(ue->Mod_id, pmch_mcs = ue_query_mch(ue->Mod_id,
...@@ -3147,9 +3147,7 @@ void ue_pmch_procedures(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc,int eNB_id,int abs ...@@ -3147,9 +3147,7 @@ void ue_pmch_procedures(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc,int eNB_id,int abs
LOG_D(PHY,"[UE %d] Frame %d, subframe %d: Programming PMCH demodulation for mcs %d\n",ue->Mod_id,frame_rx,subframe_rx,pmch_mcs); LOG_D(PHY,"[UE %d] Frame %d, subframe %d: Programming PMCH demodulation for mcs %d\n",ue->Mod_id,frame_rx,subframe_rx,pmch_mcs);
fill_UE_dlsch_MCH(ue,pmch_mcs,1,0,0); fill_UE_dlsch_MCH(ue,pmch_mcs,1,0,0);
for (l=2; l<12; l++) { for (l=2; l<12; l++) {
slot_fep_mbsfn(ue, slot_fep_mbsfn(ue,
l, l,
subframe_rx, subframe_rx,
...@@ -3164,6 +3162,8 @@ void ue_pmch_procedures(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc,int eNB_id,int abs ...@@ -3164,6 +3162,8 @@ void ue_pmch_procedures(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc,int eNB_id,int abs
} }
ue->dlsch_MCH[0]->harq_processes[0]->Qm = get_Qm(pmch_mcs);
ue->dlsch_MCH[0]->harq_processes[0]->G = get_G(&ue->frame_parms, ue->dlsch_MCH[0]->harq_processes[0]->G = get_G(&ue->frame_parms,
ue->dlsch_MCH[0]->harq_processes[0]->nb_rb, ue->dlsch_MCH[0]->harq_processes[0]->nb_rb,
ue->dlsch_MCH[0]->harq_processes[0]->rb_alloc_even, ue->dlsch_MCH[0]->harq_processes[0]->rb_alloc_even,
...@@ -3178,6 +3178,13 @@ void ue_pmch_procedures(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc,int eNB_id,int abs ...@@ -3178,6 +3178,13 @@ void ue_pmch_procedures(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc,int eNB_id,int abs
ue->dlsch_MCH[0]->harq_processes[0]->G, ue->dlsch_MCH[0]->harq_processes[0]->G,
ue->pdsch_vars_MCH[0]->llr[0],0,subframe_rx<<1); ue->pdsch_vars_MCH[0]->llr[0],0,subframe_rx<<1);
LOG_D(PHY,"start turbo decode for MCH %d.%d --> nb_rb %d \n", frame_rx, subframe_rx, ue->dlsch_MCH[0]->harq_processes[0]->nb_rb);
LOG_D(PHY,"start turbo decode for MCH %d.%d --> rb_alloc_even %x \n", frame_rx, subframe_rx, (unsigned int)((intptr_t)ue->dlsch_MCH[0]->harq_processes[0]->rb_alloc_even));
LOG_D(PHY,"start turbo decode for MCH %d.%d --> Qm %d \n", frame_rx, subframe_rx, ue->dlsch_MCH[0]->harq_processes[0]->Qm);
LOG_D(PHY,"start turbo decode for MCH %d.%d --> Nl %d \n", frame_rx, subframe_rx, ue->dlsch_MCH[0]->harq_processes[0]->Nl);
LOG_D(PHY,"start turbo decode for MCH %d.%d --> G %d \n", frame_rx, subframe_rx, ue->dlsch_MCH[0]->harq_processes[0]->G);
LOG_D(PHY,"start turbo decode for MCH %d.%d --> Kmimo %d \n", frame_rx, subframe_rx, ue->dlsch_MCH[0]->Kmimo);
ret = dlsch_decoding(ue, ret = dlsch_decoding(ue,
ue->pdsch_vars_MCH[0]->llr[0], ue->pdsch_vars_MCH[0]->llr[0],
&ue->frame_parms, &ue->frame_parms,
...@@ -3206,7 +3213,7 @@ void ue_pmch_procedures(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc,int eNB_id,int abs ...@@ -3206,7 +3213,7 @@ void ue_pmch_procedures(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc,int eNB_id,int abs
ue->dlsch_MCH[0]->harq_processes[0]->TBS>>3, ue->dlsch_MCH[0]->harq_processes[0]->TBS>>3,
ue->dlsch_MCH[0]->max_turbo_iterations, ue->dlsch_MCH[0]->max_turbo_iterations,
ue->dlsch_MCH[0]->harq_processes[0]->G); ue->dlsch_MCH[0]->harq_processes[0]->G);
dump_mch(ue,0,ue->dlsch_MCH[0]->harq_processes[0]->G,subframe_rx); // dump_mch(ue,0,ue->dlsch_MCH[0]->harq_processes[0]->G,subframe_rx);
LOG_DEBUG_BEGIN(DEBUG_UE_PHYPROC) LOG_DEBUG_BEGIN(DEBUG_UE_PHYPROC)
for (int i=0; i<ue->dlsch_MCH[0]->harq_processes[0]->TBS>>3; i++) { for (int i=0; i<ue->dlsch_MCH[0]->harq_processes[0]->TBS>>3; i++) {
......
...@@ -442,7 +442,7 @@ typedef struct { ...@@ -442,7 +442,7 @@ typedef struct {
/*!\brief LCID of MCCH for DL */ /*!\brief LCID of MCCH for DL */
#define MCCH_LCHANID 0 #define MCCH_LCHANID 0
/*!\brief LCID of MCH scheduling info for DL */ /*!\brief LCID of MCH scheduling info for DL */
#define MCH_SCHDL_INFO 3 #define MCH_SCHDL_INFO 30
/*!\brief LCID of Carrier component activation/deactivation */ /*!\brief LCID of Carrier component activation/deactivation */
#define CC_ACT_DEACT 27 #define CC_ACT_DEACT 27
//TTN (for D2D) //TTN (for D2D)
...@@ -1502,7 +1502,16 @@ typedef struct { ...@@ -1502,7 +1502,16 @@ typedef struct {
/// MCCH status /// MCCH status
uint8_t mcch_status; uint8_t mcch_status;
/// MSI status /// MSI status
uint8_t msi_status; // could be an array if there are >1 MCH in one MBSFN area uint8_t msi_status_v[28];
uint8_t msi_current_alloc;
uint8_t msi_pmch;
struct MBSFN_SubframeConfig *commonSF_Alloc_r9_mbsfn_SubframeConfig[8]; // FIXME replace 8 by MAX_MBSFN_AREA?
uint8_t commonSF_AllocPeriod_r9;
int common_num_sf_alloc;
uint8_t pmch_lcids[28];
uint16_t pmch_stop_mtch[28];
#endif #endif
//#ifdef CBA //#ifdef CBA
/// CBA RNTI for each group /// CBA RNTI for each group
......
...@@ -750,7 +750,7 @@ ue_send_mch_sdu(module_id_t module_idP, uint8_t CC_id, frame_t frameP, ...@@ -750,7 +750,7 @@ ue_send_mch_sdu(module_id_t module_idP, uint8_t CC_id, frame_t frameP,
uint8_t sync_area) uint8_t sync_area)
{ {
unsigned char num_sdu, i, *payload_ptr; unsigned char num_sdu, i, j, *payload_ptr;
unsigned char rx_lcids[NB_RB_MAX]; unsigned char rx_lcids[NB_RB_MAX];
unsigned short rx_lengths[NB_RB_MAX]; unsigned short rx_lengths[NB_RB_MAX];
#if UE_TIMING_TRACE #if UE_TIMING_TRACE
...@@ -772,35 +772,64 @@ ue_send_mch_sdu(module_id_t module_idP, uint8_t CC_id, frame_t frameP, ...@@ -772,35 +772,64 @@ ue_send_mch_sdu(module_id_t module_idP, uint8_t CC_id, frame_t frameP,
for (i = 0; i < num_sdu; i++) { for (i = 0; i < num_sdu; i++) {
if (rx_lcids[i] == MCH_SCHDL_INFO) { if (rx_lcids[i] == MCH_SCHDL_INFO) {
if (UE_mac_inst[module_idP].mcch_status == 1) { if (rx_lengths[i] & 0x01) {
LOG_I(MAC, LOG_E(MAC,"MCH Scheduling Information MAC Control Element should have an even size\n");
"[UE %d] Frame %d : MCH->MSI for sync area %d (eNB %d, %d bytes)\n", }
module_idP, frameP, sync_area, eNB_index,
rx_lengths[i]); LOG_D(MAC,"MCH Scheduling Information, len(%d)\n",rx_lengths[i]);
// ??store necessary scheduling info to ue_mac_inst in order to
// calculate exact position of interested service (for the complex case has >1 mtch) for (j=0; j<rx_lengths[i]/2; j++) {
// set msi_status to 1 uint16_t stop_mtch_val = ((uint16_t)(payload_ptr[2*j] & 0x07) << 8) | (uint16_t)payload_ptr[2*j+1];
UE_mac_inst[module_idP].msi_status = 1;
UE_mac_inst[module_idP].pmch_lcids[j] = (payload_ptr[2*j] & 0xF8) >> 3;
UE_mac_inst[module_idP].pmch_stop_mtch[j] = stop_mtch_val;
LOG_D(MAC,"lcid(%d),stop_mtch_val %d frameP(%d)\n", UE_mac_inst[module_idP].pmch_lcids[j], stop_mtch_val, frameP);
if ((stop_mtch_val >= 2043) && (stop_mtch_val <= 2046)) {
LOG_D(MAC,"(reserved)\n");
}
UE_mac_inst[module_idP].msi_status_v[j] = 0;
if (UE_mac_inst[module_idP].mcch_status==1) {
LOG_D(MAC,"[UE %d] Frame %d : MCH->MSI for sync area %d (eNB %d, %d bytes), i(%d)\n", module_idP, frameP, sync_area, eNB_index, rx_lengths[i], UE_mac_inst[module_idP].pmch_stop_mtch[j]);
if (UE_mac_inst[module_idP].pmch_stop_mtch[j] < 2043) {
UE_mac_inst[module_idP].pmch_stop_mtch[j] += UE_mac_inst[module_idP].msi_current_alloc;
UE_mac_inst[module_idP].msi_status_v[j] = 1;
}
}
} }
} else if (rx_lcids[i] == MCCH_LCHANID) { } else if (rx_lcids[i] == MCCH_LCHANID) {
LOG_I(MAC, LOG_D(MAC,"[UE %d] Frame %d : SDU %d MCH->MCCH for sync area %d (eNB %d, %d bytes)\n",module_idP,frameP, i, sync_area, eNB_index, rx_lengths[i]);
"[UE %d] Frame %d : SDU %d MCH->MCCH for sync area %d (eNB %d, %d bytes)\n", mac_rrc_data_ind_ue(module_idP,
module_idP, frameP, i, sync_area, eNB_index, CC_id,
rx_lengths[i]); frameP,0, // unknown subframe
mac_rrc_data_ind_ue(module_idP, CC_id, frameP, 0, // unknown subframe
M_RNTI, M_RNTI,
MCCH, MCCH,
payload_ptr, rx_lengths[i], eNB_index, payload_ptr + 1, // Skip RLC layer 1st byte
rx_lengths[i] - 1,
eNB_index,
sync_area); sync_area);
} else if (rx_lcids[i] == MTCH) { } else if (rx_lcids[i] <= 28) {
if (UE_mac_inst[module_idP].msi_status == 1) { for (j=0; j<28; j++) {
LOG_I(MAC, if (rx_lcids[i] == UE_mac_inst[module_idP].pmch_lcids[j])
"[UE %d] Frame %d : MCH->MTCH for sync area %d (eNB %d, %d bytes)\n", break;
module_idP, frameP, sync_area, eNB_index, }
rx_lengths[i]);
mac_rlc_data_ind(module_idP, UE_mac_inst[module_idP].crnti, eNB_index, frameP, ENB_FLAG_NO, MBMS_FLAG_YES, MTCH, /*+ (maxDRB + 3), */ if (j<28 && UE_mac_inst[module_idP].msi_status_v[j]==1) {
(char *) payload_ptr, rx_lengths[i], 1, LOG_D(MAC,"[UE %d] Frame %d : MCH->MTCH for sync area %d (eNB %d, %d bytes), j=%d\n", module_idP, frameP, sync_area, eNB_index, rx_lengths[i], j);
mac_rlc_data_ind(
module_idP,
UE_mac_inst[module_idP].crnti,
eNB_index,
frameP,
ENB_FLAG_NO,
MBMS_FLAG_YES,
rx_lcids[i], /*+ (maxDRB + 3),*/
(char *)payload_ptr,
rx_lengths[i],
1,
NULL); NULL);
} }
...@@ -916,60 +945,211 @@ int8_t ue_get_mbsfn_sf_alloction (module_id_t module_idP, uint8_t mbsfn_sync_are ...@@ -916,60 +945,211 @@ int8_t ue_get_mbsfn_sf_alloction (module_id_t module_idP, uint8_t mbsfn_sync_are
} }
} }
int int ue_query_p_mch_info(module_id_t module_idP, uint32_t frameP, uint32_t subframe, int commonSFAlloc_period, int commonSFAlloc_offset, int num_sf_alloc, int *mtch_active, int *msi_active, uint8_t *mch_lcid)
ue_query_mch(module_id_t module_idP, uint8_t CC_id, uint32_t frameP,
uint32_t subframe, uint8_t eNB_index, uint8_t * sync_area,
uint8_t * mcch_active)
{ {
int i, mtch_mcs = -1;
int mtch_flag = 0;
int msi_flag = 0;
int i = 0, j = 0, ii = 0, msi_pos = 0, mcch_mcs = -1; for (i = 0; i < 4; i++) {
int mcch_flag = 0, mtch_flag = 0, msi_flag = 0; if (UE_mac_inst[module_idP].pmch_Config[i] == NULL)
int mbsfn_period = 0; // 1<<(UE_mac_inst[module_idP].mbsfn_SubframeConfig[0]->radioframeAllocationPeriod); continue;
int mcch_period = 0; // 32<<(UE_mac_inst[module_idP].mbsfn_AreaInfo[0]->mcch_Config_r9.mcch_RepetitionPeriod_r9);
int mch_scheduling_period = -1; int mch_scheduling_period = 8 << UE_mac_inst[module_idP].pmch_Config[i]->mch_SchedulingPeriod_r9;
uint8_t sf_AllocEnd_r9 = UE_mac_inst[module_idP].pmch_Config[i]->sf_AllocEnd_r9;
if (sf_AllocEnd_r9 == 2047) {
msi_flag = 1;
break;
}
if ((frameP % mch_scheduling_period) == (commonSFAlloc_offset + (frameP % 4))) {
if (i == 0) {
//msi and mtch are mutally excluded then the break is safe
if ((num_sf_alloc == 0) && (sf_AllocEnd_r9 >= 1)) {
msi_flag = 1;
LOG_D(MAC,"msi(%d) should be allocated:frame(%d),submframe(%d),num_sf_alloc(%d),sf_AllocEnd_r9(%d),common_num_sf_alloc(%d)\n",i,frameP,subframe,num_sf_alloc,sf_AllocEnd_r9,UE_mac_inst[module_idP].common_num_sf_alloc);
UE_mac_inst[module_idP].msi_current_alloc = num_sf_alloc;
UE_mac_inst[module_idP].msi_pmch = i;
}
} else { //more that one MCH ?? check better this condition
//msi and mtch are mutally excluded then the break is safe
if ((num_sf_alloc == UE_mac_inst[module_idP].pmch_Config[i-1]->sf_AllocEnd_r9 + 1) && (sf_AllocEnd_r9 >= (num_sf_alloc+1))) {
//msi should be just after
msi_flag = 1;
LOG_D(MAC,"msi(%d) should be allocated:frame(%d),submframe(%d),num_sf_alloc(%d),sf_AllocEnd_r9(%d),common_num_sf_alloc(%d)\n",i,frameP,subframe,num_sf_alloc,sf_AllocEnd_r9,UE_mac_inst[module_idP].common_num_sf_alloc);
UE_mac_inst[module_idP].msi_current_alloc = num_sf_alloc;
UE_mac_inst[module_idP].msi_pmch = i;
}
}
}
}
for (i = 0; i < 28; i++) {
if (UE_mac_inst[module_idP].pmch_stop_mtch[i] >= num_sf_alloc) {
if (UE_mac_inst[module_idP].pmch_stop_mtch[i] != 2047) {
mtch_flag = 1;
if (UE_mac_inst[module_idP].pmch_Config[UE_mac_inst[module_idP].msi_pmch] != NULL)
mtch_mcs = UE_mac_inst[module_idP].pmch_Config[UE_mac_inst[module_idP].msi_pmch]->dataMCS_r9;
else
mtch_mcs = -1;
*mch_lcid = (uint8_t)i;
LOG_D(MAC,"mtch should be allocated:frame(%d),submframe(%d),num_sf_alloc(%d),mtch_mcs(%d),pmch_stop_mtch(%d),lcid(%d),msi_pmch(%d)\n",frameP,subframe,num_sf_alloc,mtch_mcs,UE_mac_inst[module_idP].pmch_stop_mtch[i],UE_mac_inst[module_idP].pmch_lcids[i],UE_mac_inst[module_idP].msi_pmch);
break;
}
}
}
*mtch_active = mtch_flag;
*msi_active = msi_flag;
return mtch_mcs;
}
int ue_query_p_mch(module_id_t module_idP, uint32_t frameP, uint32_t subframe, int *mtch_active, int *msi_active, uint8_t *mch_lcid)
{
int i, j, mtch_mcs = -1;
int mtch_flag = 0;
// Acount for sf_allocable in CSA
int num_sf_alloc = 0;
for (i = 0; i < 8; i++) {
if (UE_mac_inst[module_idP].commonSF_Alloc_r9_mbsfn_SubframeConfig[i] == NULL)
continue;
if (UE_mac_inst[module_idP].commonSF_Alloc_r9_mbsfn_SubframeConfig[i]->subframeAllocation.present == MBSFN_SubframeConfig__subframeAllocation_PR_oneFrame) // one-frameP format
continue;
// four-frameP format
uint32_t common_mbsfn_SubframeConfig = UE_mac_inst[module_idP].commonSF_Alloc_r9_mbsfn_SubframeConfig[i]->subframeAllocation.choice.oneFrame.buf[2] |
(UE_mac_inst[module_idP].commonSF_Alloc_r9_mbsfn_SubframeConfig[i]->subframeAllocation.choice.oneFrame.buf[1]<<8) |
(UE_mac_inst[module_idP].commonSF_Alloc_r9_mbsfn_SubframeConfig[i]->subframeAllocation.choice.oneFrame.buf[0]<<16);
for (j = 0; j < 24; j++)
num_sf_alloc += ((common_mbsfn_SubframeConfig & (0x800000 >> j)) == (0x800000 >> j));
}
for (i = 0; i < 8; i++ ) {
if (UE_mac_inst[module_idP].commonSF_Alloc_r9_mbsfn_SubframeConfig[i] == NULL)
continue;
if (UE_mac_inst[module_idP].commonSF_Alloc_r9_mbsfn_SubframeConfig[i]->subframeAllocation.present == MBSFN_SubframeConfig__subframeAllocation_PR_oneFrame) // one-frameP format
continue;
// four-frameP format
int common_mbsfn_alloc_offset = UE_mac_inst[module_idP].commonSF_Alloc_r9_mbsfn_SubframeConfig[i]->radioframeAllocationOffset;
int common_mbsfn_period = 1 << UE_mac_inst[module_idP].commonSF_Alloc_r9_mbsfn_SubframeConfig[i]->radioframeAllocationPeriod;
int commonSF_AllocPeriod = 4 << UE_mac_inst[module_idP].commonSF_AllocPeriod_r9;
uint32_t common_mbsfn_SubframeConfig = UE_mac_inst[module_idP].commonSF_Alloc_r9_mbsfn_SubframeConfig[i]->subframeAllocation.choice.oneFrame.buf[2] |
(UE_mac_inst[module_idP].commonSF_Alloc_r9_mbsfn_SubframeConfig[i]->subframeAllocation.choice.oneFrame.buf[1]<<8) |
(UE_mac_inst[module_idP].commonSF_Alloc_r9_mbsfn_SubframeConfig[i]->subframeAllocation.choice.oneFrame.buf[0]<<16);
int jj = frameP % 4;
if ((frameP % common_mbsfn_period) != (common_mbsfn_alloc_offset + jj))
continue;
if(UE_mac_inst[module_idP].tdd_Config == NULL){
switch (subframe) {
case 1:
if ((common_mbsfn_SubframeConfig & (0x800000 >> (jj*6))) == (0x800000 >> (jj*6))) {
mtch_flag = 1;
mtch_mcs = ue_query_p_mch_info(module_idP,frameP,subframe,common_mbsfn_period,common_mbsfn_alloc_offset,UE_mac_inst[module_idP].common_num_sf_alloc,mtch_active,msi_active,mch_lcid);
UE_mac_inst[module_idP].common_num_sf_alloc++;
UE_mac_inst[module_idP].common_num_sf_alloc = UE_mac_inst[module_idP].common_num_sf_alloc % (num_sf_alloc * commonSF_AllocPeriod / common_mbsfn_period);//48;
}
break;
case 2:
if ((common_mbsfn_SubframeConfig & (0x400000 >> (jj*6))) == (0x400000 >> (jj*6))) {
mtch_flag = 1;
mtch_mcs = ue_query_p_mch_info(module_idP,frameP,subframe,common_mbsfn_period,common_mbsfn_alloc_offset,UE_mac_inst[module_idP].common_num_sf_alloc,mtch_active,msi_active,mch_lcid);
UE_mac_inst[module_idP].common_num_sf_alloc++;
UE_mac_inst[module_idP].common_num_sf_alloc = UE_mac_inst[module_idP].common_num_sf_alloc % (num_sf_alloc * commonSF_AllocPeriod / common_mbsfn_period);//48;
}
break;
case 3:
if ((common_mbsfn_SubframeConfig & (0x200000 >> (jj*6))) == (0x200000 >> (jj*6))) {
mtch_flag = 1;
mtch_mcs = ue_query_p_mch_info(module_idP,frameP,subframe,common_mbsfn_period,common_mbsfn_alloc_offset,UE_mac_inst[module_idP].common_num_sf_alloc,mtch_active,msi_active,mch_lcid);
UE_mac_inst[module_idP].common_num_sf_alloc++;
UE_mac_inst[module_idP].common_num_sf_alloc = UE_mac_inst[module_idP].common_num_sf_alloc % (num_sf_alloc * commonSF_AllocPeriod / common_mbsfn_period);//48;
}
break;
case 6:
if ((common_mbsfn_SubframeConfig & (0x100000 >> (jj*6))) == (0x100000 >> (jj*6))) {
mtch_flag = 1;
mtch_mcs = ue_query_p_mch_info(module_idP,frameP,subframe,common_mbsfn_period,common_mbsfn_alloc_offset,UE_mac_inst[module_idP].common_num_sf_alloc,mtch_active,msi_active,mch_lcid);
UE_mac_inst[module_idP].common_num_sf_alloc++;
UE_mac_inst[module_idP].common_num_sf_alloc = UE_mac_inst[module_idP].common_num_sf_alloc % (num_sf_alloc * commonSF_AllocPeriod / common_mbsfn_period);//48;
}
break;
case 7:
if ((common_mbsfn_SubframeConfig & (0x80000 >> (jj*6))) == (0x80000 >> (jj*6))) {
mtch_flag = 1;
mtch_mcs = ue_query_p_mch_info(module_idP,frameP,subframe,common_mbsfn_period,common_mbsfn_alloc_offset,UE_mac_inst[module_idP].common_num_sf_alloc,mtch_active,msi_active,mch_lcid);
UE_mac_inst[module_idP].common_num_sf_alloc++;
UE_mac_inst[module_idP].common_num_sf_alloc = UE_mac_inst[module_idP].common_num_sf_alloc % (num_sf_alloc * commonSF_AllocPeriod / common_mbsfn_period);//48;
}
break;
case 8:
if ((common_mbsfn_SubframeConfig & (0x40000 >> (jj*6))) == (0x40000 >> (jj*6))) {
mtch_flag = 1;
mtch_mcs = ue_query_p_mch_info(module_idP,frameP,subframe,common_mbsfn_period,common_mbsfn_alloc_offset,UE_mac_inst[module_idP].common_num_sf_alloc,mtch_active,msi_active,mch_lcid);
UE_mac_inst[module_idP].common_num_sf_alloc++;
UE_mac_inst[module_idP].common_num_sf_alloc = UE_mac_inst[module_idP].common_num_sf_alloc% ( num_sf_alloc*commonSF_AllocPeriod/common_mbsfn_period);//48;
}
break;
}
} else {
// TODO TDD
}
if (mtch_flag == 1)
break;
}
return mtch_mcs;
}
int frame_FDD = 1; int ue_query_mch(module_id_t module_idP, uint8_t CC_id, uint32_t frameP, uint32_t subframe, uint8_t eNB_index,uint8_t *sync_area, uint8_t *mcch_active)
{
int i = 0, j = 0, ii = 0, jj = 0, msi_pos = 0, mcch_mcs = -1, mtch_mcs = -1;
int mcch_flag = 0, mtch_flag = 0, msi_flag = 0;
long mch_scheduling_period = -1;
uint8_t mch_lcid = 0;
#if UE_TIMING_TRACE #if UE_TIMING_TRACE
start_meas(&UE_mac_inst[module_idP].ue_query_mch); start_meas(&UE_mac_inst[module_idP].ue_query_mch);
#endif #endif
if (UE_mac_inst[module_idP].pmch_Config[0]) { if (UE_mac_inst[module_idP].pmch_Config[0]) {
mch_scheduling_period = mch_scheduling_period = 8 << UE_mac_inst[module_idP].pmch_Config[0]->mch_SchedulingPeriod_r9;
8 << (UE_mac_inst[module_idP].
pmch_Config[0]->mch_SchedulingPeriod_r9);
} }
for (i = 0; i < UE_mac_inst[module_idP].num_active_mbsfn_area; i++) { for (i = 0;
i < UE_mac_inst[module_idP].num_active_mbsfn_area;
i++ )
{
// assume, that there is always a mapping // assume, that there is always a mapping
if ((j = if ((j = ue_get_mbsfn_sf_alloction(module_idP,i,eNB_index)) == -1) {
ue_get_mbsfn_sf_alloction(module_idP, i, eNB_index)) == -1) {
return -1; // continue; return -1; // continue;
} }
ii = 0; ii = 0;
msi_pos = 0; msi_pos = 0;
mbsfn_period =
1 << (UE_mac_inst[module_idP]. long mbsfn_period = 1 << UE_mac_inst[module_idP].mbsfn_SubframeConfig[j]->radioframeAllocationPeriod;
mbsfn_SubframeConfig[0]->radioframeAllocationPeriod); long mbsfn_alloc_offset = UE_mac_inst[module_idP].mbsfn_SubframeConfig[j]->radioframeAllocationOffset;
mcch_period = long mcch_period = 32 << UE_mac_inst[module_idP].mbsfn_AreaInfo[j]->mcch_Config_r9.mcch_RepetitionPeriod_r9;
32 << (UE_mac_inst[module_idP]. long mcch_offset = UE_mac_inst[module_idP].mbsfn_AreaInfo[j]->mcch_Config_r9.mcch_Offset_r9;
mbsfn_AreaInfo[0]->mcch_Config_r9.
mcch_RepetitionPeriod_r9);
LOG_D(MAC, LOG_D(MAC,
"[UE %d] Frame %d subframe %d: Checking MBSFN Sync Area %d/%d with SF allocation %d/%d for MCCH and MTCH (mbsfn period %d, mcch period %d,mac sched period (%d,%ld))\n", "[UE %d] Frame %d subframe %d: Checking MBSFN Sync Area %d/%d with SF allocation %d/%d for MCCH and MTCH (mbsfn period %ld, mcch period %ld,mac sched period (%ld,%ld))\n",
module_idP, frameP, subframe, i, module_idP,frameP, subframe,i,UE_mac_inst[module_idP].num_active_mbsfn_area,
UE_mac_inst[module_idP].num_active_mbsfn_area, j, j,UE_mac_inst[module_idP].num_sf_allocation_pattern,mbsfn_period,mcch_period,
UE_mac_inst[module_idP].num_sf_allocation_pattern, mcch_offset,mbsfn_alloc_offset);
mbsfn_period, mcch_period, mch_scheduling_period,
UE_mac_inst[module_idP].
mbsfn_SubframeConfig[j]->radioframeAllocationOffset);
// get the real MCS value // get the real MCS value
switch (UE_mac_inst[module_idP].mbsfn_AreaInfo[i]-> switch (UE_mac_inst[module_idP].mbsfn_AreaInfo[i]->mcch_Config_r9.signallingMCS_r9) {
mcch_Config_r9.signallingMCS_r9) {
case 0: case 0:
mcch_mcs = 2; mcch_mcs = 2;
break; break;
...@@ -987,48 +1167,30 @@ ue_query_mch(module_id_t module_idP, uint8_t CC_id, uint32_t frameP, ...@@ -987,48 +1167,30 @@ ue_query_mch(module_id_t module_idP, uint8_t CC_id, uint32_t frameP,
break; break;
} }
if (frameP % mbsfn_period == UE_mac_inst[module_idP].mbsfn_SubframeConfig[j]->radioframeAllocationOffset) { // MBSFN frameP
if (UE_mac_inst[module_idP].mbsfn_SubframeConfig[j]->subframeAllocation.present == MBSFN_SubframeConfig__subframeAllocation_PR_oneFrame) { // one-frameP format if (UE_mac_inst[module_idP].mbsfn_SubframeConfig[j]->subframeAllocation.present == MBSFN_SubframeConfig__subframeAllocation_PR_oneFrame) { // one-frameP format
if (frameP % mbsfn_period == mbsfn_alloc_offset) { // MBSFN frameP
if (UE_mac_inst[module_idP].pmch_Config[0]) { if (UE_mac_inst[module_idP].pmch_Config[0]) {
// Find the first subframe in this MCH to transmit MSI // Find the first subframe in this MCH to transmit MSI
if (frameP % mch_scheduling_period == if (frameP % mch_scheduling_period == mbsfn_alloc_offset) {
UE_mac_inst[module_idP].
mbsfn_SubframeConfig
[j]->radioframeAllocationOffset) {
while (ii == 0) { while (ii == 0) {
ii = UE_mac_inst[module_idP]. ii = UE_mac_inst[module_idP].mbsfn_SubframeConfig[j]->subframeAllocation.choice.oneFrame.buf[0] & (0x80 >> msi_pos);
mbsfn_SubframeConfig[j]->
subframeAllocation.choice.
oneFrame.buf[0] & (0x80 >> msi_pos);
msi_pos++; msi_pos++;
} }
} }
} }
if (UE_mac_inst[module_idP].tdd_Config == NULL)
frame_FDD = 1;
else
frame_FDD = 0;
// Check if the subframe is for MSI, MCCH or MTCHs and Set the correspoding flag to 1 // Check if the subframe is for MSI, MCCH or MTCHs and Set the correspoding flag to 1
switch (subframe) { switch (subframe) {
case 1: case 1:
if (frame_FDD == 1) { if (UE_mac_inst[module_idP].tdd_Config == NULL) {
if ((UE_mac_inst[module_idP].mbsfn_SubframeConfig if ((UE_mac_inst[module_idP].mbsfn_SubframeConfig[j]->subframeAllocation.choice.oneFrame.buf[0] & MBSFN_FDD_SF1) == MBSFN_FDD_SF1) {
[j]->subframeAllocation.choice.oneFrame.
buf[0] & MBSFN_FDD_SF1) == MBSFN_FDD_SF1) {
if (msi_pos == 1) { if (msi_pos == 1) {
msi_flag = 1; msi_flag = 1;
} }
if ((frameP % mcch_period == if ((frameP % mcch_period == mcch_offset) &&
UE_mac_inst[module_idP].mbsfn_AreaInfo ((UE_mac_inst[module_idP].mbsfn_AreaInfo[i]->mcch_Config_r9.sf_AllocInfo_r9.buf[0] & MBSFN_FDD_SF1) == MBSFN_FDD_SF1)) {
[i]->mcch_Config_r9.mcch_Offset_r9)
&&
((UE_mac_inst[module_idP].mbsfn_AreaInfo
[i]->mcch_Config_r9.sf_AllocInfo_r9.
buf[0] & MBSFN_FDD_SF1) ==
MBSFN_FDD_SF1)) {
mcch_flag = 1; mcch_flag = 1;
} }
...@@ -1039,22 +1201,14 @@ ue_query_mch(module_id_t module_idP, uint8_t CC_id, uint32_t frameP, ...@@ -1039,22 +1201,14 @@ ue_query_mch(module_id_t module_idP, uint8_t CC_id, uint32_t frameP,
break; break;
case 2: case 2:
if (frame_FDD == 1) { if (UE_mac_inst[module_idP].tdd_Config == NULL) {
if ((UE_mac_inst[module_idP].mbsfn_SubframeConfig if ((UE_mac_inst[module_idP].mbsfn_SubframeConfig[j]->subframeAllocation.choice.oneFrame.buf[0] & MBSFN_FDD_SF2) == MBSFN_FDD_SF2) {
[j]->subframeAllocation.choice.oneFrame.
buf[0] & MBSFN_FDD_SF2) == MBSFN_FDD_SF2) {
if (msi_pos == 2) { if (msi_pos == 2) {
msi_flag = 1; msi_flag = 1;
} }
if ((frameP % mcch_period == if ((frameP % mcch_period == mcch_offset) &&
UE_mac_inst[module_idP].mbsfn_AreaInfo ((UE_mac_inst[module_idP].mbsfn_AreaInfo[i]->mcch_Config_r9.sf_AllocInfo_r9.buf[0] & MBSFN_FDD_SF2) == MBSFN_FDD_SF2)) {
[i]->mcch_Config_r9.mcch_Offset_r9)
&&
((UE_mac_inst[module_idP].mbsfn_AreaInfo
[i]->mcch_Config_r9.sf_AllocInfo_r9.
buf[0] & MBSFN_FDD_SF2) ==
MBSFN_FDD_SF2)) {
mcch_flag = 1; mcch_flag = 1;
} }
...@@ -1065,43 +1219,27 @@ ue_query_mch(module_id_t module_idP, uint8_t CC_id, uint32_t frameP, ...@@ -1065,43 +1219,27 @@ ue_query_mch(module_id_t module_idP, uint8_t CC_id, uint32_t frameP,
break; break;
case 3: case 3:
if (frame_FDD == 0) { //TDD if (UE_mac_inst[module_idP].tdd_Config != NULL) { // TDD
if ((UE_mac_inst[module_idP].mbsfn_SubframeConfig if ((UE_mac_inst[module_idP].mbsfn_SubframeConfig[j]->subframeAllocation.choice.oneFrame.buf[0] & MBSFN_TDD_SF3) == MBSFN_TDD_SF3) {
[j]->subframeAllocation.choice.oneFrame.
buf[0] & MBSFN_TDD_SF3) == MBSFN_TDD_SF3) {
if (msi_pos == 1) { if (msi_pos == 1) {
msi_flag = 1; msi_flag = 1;
} }
if ((frameP % mcch_period == if ((frameP % mcch_period == mcch_offset) &&
UE_mac_inst[module_idP].mbsfn_AreaInfo ((UE_mac_inst[module_idP].mbsfn_AreaInfo[i]->mcch_Config_r9.sf_AllocInfo_r9.buf[0] & MBSFN_TDD_SF3) == MBSFN_TDD_SF3)) {
[i]->mcch_Config_r9.mcch_Offset_r9)
&&
((UE_mac_inst[module_idP].mbsfn_AreaInfo
[i]->mcch_Config_r9.sf_AllocInfo_r9.
buf[0] & MBSFN_TDD_SF3) ==
MBSFN_TDD_SF3)) {
mcch_flag = 1; mcch_flag = 1;
} }
mtch_flag = 1; mtch_flag = 1;
} }
} else { // FDD } else { // FDD
if ((UE_mac_inst[module_idP].mbsfn_SubframeConfig if ((UE_mac_inst[module_idP].mbsfn_SubframeConfig[j]->subframeAllocation.choice.oneFrame.buf[0] & MBSFN_FDD_SF3) == MBSFN_FDD_SF3) {
[j]->subframeAllocation.choice.oneFrame.
buf[0] & MBSFN_FDD_SF3) == MBSFN_FDD_SF3) {
if (msi_pos == 3) { if (msi_pos == 3) {
msi_flag = 1; msi_flag = 1;
} }
if ((frameP % mcch_period == if ((frameP % mcch_period == mcch_offset) &&
UE_mac_inst[module_idP].mbsfn_AreaInfo ((UE_mac_inst[module_idP].mbsfn_AreaInfo[i]->mcch_Config_r9.sf_AllocInfo_r9.buf[0] & MBSFN_FDD_SF3) == MBSFN_FDD_SF3)) {
[i]->mcch_Config_r9.mcch_Offset_r9)
&&
((UE_mac_inst[module_idP].mbsfn_AreaInfo
[i]->mcch_Config_r9.sf_AllocInfo_r9.
buf[0] & MBSFN_FDD_SF3) ==
MBSFN_FDD_SF3)) {
mcch_flag = 1; mcch_flag = 1;
} }
...@@ -1112,22 +1250,14 @@ ue_query_mch(module_id_t module_idP, uint8_t CC_id, uint32_t frameP, ...@@ -1112,22 +1250,14 @@ ue_query_mch(module_id_t module_idP, uint8_t CC_id, uint32_t frameP,
break; break;
case 4: case 4:
if (frame_FDD == 0) { if (UE_mac_inst[module_idP].tdd_Config != NULL) {
if ((UE_mac_inst[module_idP].mbsfn_SubframeConfig if ((UE_mac_inst[module_idP].mbsfn_SubframeConfig[j]->subframeAllocation.choice.oneFrame.buf[0] & MBSFN_TDD_SF4) == MBSFN_TDD_SF4) {
[j]->subframeAllocation.choice.oneFrame.
buf[0] & MBSFN_TDD_SF4) == MBSFN_TDD_SF4) {
if (msi_pos == 2) { if (msi_pos == 2) {
msi_flag = 1; msi_flag = 1;
} }
if ((frameP % mcch_period == if ((frameP % mcch_period == mcch_offset) &&
UE_mac_inst[module_idP].mbsfn_AreaInfo ((UE_mac_inst[module_idP].mbsfn_AreaInfo[i]->mcch_Config_r9.sf_AllocInfo_r9.buf[0] & MBSFN_TDD_SF4) == MBSFN_TDD_SF4)) {
[i]->mcch_Config_r9.mcch_Offset_r9)
&&
((UE_mac_inst[module_idP].mbsfn_AreaInfo
[i]->mcch_Config_r9.sf_AllocInfo_r9.
buf[0] & MBSFN_TDD_SF4) ==
MBSFN_TDD_SF4)) {
mcch_flag = 1; mcch_flag = 1;
} }
...@@ -1138,22 +1268,14 @@ ue_query_mch(module_id_t module_idP, uint8_t CC_id, uint32_t frameP, ...@@ -1138,22 +1268,14 @@ ue_query_mch(module_id_t module_idP, uint8_t CC_id, uint32_t frameP,
break; break;
case 6: case 6:
if (frame_FDD == 1) { if (UE_mac_inst[module_idP].tdd_Config == NULL) {
if ((UE_mac_inst[module_idP].mbsfn_SubframeConfig if ((UE_mac_inst[module_idP].mbsfn_SubframeConfig[j]->subframeAllocation.choice.oneFrame.buf[0] & MBSFN_FDD_SF6) == MBSFN_FDD_SF6) {
[j]->subframeAllocation.choice.oneFrame.
buf[0] & MBSFN_FDD_SF6) == MBSFN_FDD_SF6) {
if (msi_pos == 4) { if (msi_pos == 4) {
msi_flag = 1; msi_flag = 1;
} }
if ((frameP % mcch_period == if ((frameP % mcch_period == mcch_offset) &&
UE_mac_inst[module_idP].mbsfn_AreaInfo ((UE_mac_inst[module_idP].mbsfn_AreaInfo[i]->mcch_Config_r9.sf_AllocInfo_r9.buf[0] & MBSFN_FDD_SF6) == MBSFN_FDD_SF6)) {
[i]->mcch_Config_r9.mcch_Offset_r9)
&&
((UE_mac_inst[module_idP].mbsfn_AreaInfo
[i]->mcch_Config_r9.sf_AllocInfo_r9.
buf[0] & MBSFN_FDD_SF6) ==
MBSFN_FDD_SF6)) {
mcch_flag = 1; mcch_flag = 1;
} }
...@@ -1164,43 +1286,27 @@ ue_query_mch(module_id_t module_idP, uint8_t CC_id, uint32_t frameP, ...@@ -1164,43 +1286,27 @@ ue_query_mch(module_id_t module_idP, uint8_t CC_id, uint32_t frameP,
break; break;
case 7: case 7:
if (frame_FDD == 0) { // TDD if (UE_mac_inst[module_idP].tdd_Config != NULL) { // TDD
if ((UE_mac_inst[module_idP].mbsfn_SubframeConfig if ((UE_mac_inst[module_idP].mbsfn_SubframeConfig[j]->subframeAllocation.choice.oneFrame.buf[0] & MBSFN_TDD_SF7) == MBSFN_TDD_SF7) {
[j]->subframeAllocation.choice.oneFrame.
buf[0] & MBSFN_TDD_SF7) == MBSFN_TDD_SF7) {
if (msi_pos == 3) { if (msi_pos == 3) {
msi_flag = 1; msi_flag = 1;
} }
if ((frameP % mcch_period == if ((frameP % mcch_period == mcch_offset) &&
UE_mac_inst[module_idP].mbsfn_AreaInfo ((UE_mac_inst[module_idP].mbsfn_AreaInfo[i]->mcch_Config_r9.sf_AllocInfo_r9.buf[0] & MBSFN_TDD_SF7) == MBSFN_TDD_SF7)) {
[i]->mcch_Config_r9.mcch_Offset_r9)
&&
((UE_mac_inst[module_idP].mbsfn_AreaInfo
[i]->mcch_Config_r9.sf_AllocInfo_r9.
buf[0] & MBSFN_TDD_SF7) ==
MBSFN_TDD_SF7)) {
mcch_flag = 1; mcch_flag = 1;
} }
mtch_flag = 1; mtch_flag = 1;
} }
} else { // FDD } else { // FDD
if ((UE_mac_inst[module_idP].mbsfn_SubframeConfig if ((UE_mac_inst[module_idP].mbsfn_SubframeConfig[j]->subframeAllocation.choice.oneFrame.buf[0] & MBSFN_FDD_SF7) == MBSFN_FDD_SF7) {
[j]->subframeAllocation.choice.oneFrame.
buf[0] & MBSFN_FDD_SF7) == MBSFN_FDD_SF7) {
if (msi_pos == 5) { if (msi_pos == 5) {
msi_flag = 1; msi_flag = 1;
} }
if ((frameP % mcch_period == if ((frameP % mcch_period == mcch_offset) &&
UE_mac_inst[module_idP].mbsfn_AreaInfo ((UE_mac_inst[module_idP].mbsfn_AreaInfo[i]->mcch_Config_r9.sf_AllocInfo_r9.buf[0] & MBSFN_FDD_SF7) == MBSFN_FDD_SF7)) {
[i]->mcch_Config_r9.mcch_Offset_r9)
&&
((UE_mac_inst[module_idP].mbsfn_AreaInfo
[i]->mcch_Config_r9.sf_AllocInfo_r9.
buf[0] & MBSFN_FDD_SF7) ==
MBSFN_FDD_SF7)) {
mcch_flag = 1; mcch_flag = 1;
} }
...@@ -1211,43 +1317,27 @@ ue_query_mch(module_id_t module_idP, uint8_t CC_id, uint32_t frameP, ...@@ -1211,43 +1317,27 @@ ue_query_mch(module_id_t module_idP, uint8_t CC_id, uint32_t frameP,
break; break;
case 8: case 8:
if (frame_FDD == 0) { //TDD if (UE_mac_inst[module_idP].tdd_Config != NULL) { //TDD
if ((UE_mac_inst[module_idP].mbsfn_SubframeConfig if ((UE_mac_inst[module_idP].mbsfn_SubframeConfig[j]->subframeAllocation.choice.oneFrame.buf[0] & MBSFN_TDD_SF8) == MBSFN_TDD_SF8) {
[j]->subframeAllocation.choice.oneFrame.
buf[0] & MBSFN_TDD_SF8) == MBSFN_TDD_SF8) {
if (msi_pos == 4) { if (msi_pos == 4) {
msi_flag = 1; msi_flag = 1;
} }
if ((frameP % mcch_period == if ((frameP % mcch_period == mcch_offset) &&
UE_mac_inst[module_idP].mbsfn_AreaInfo ((UE_mac_inst[module_idP].mbsfn_AreaInfo[i]->mcch_Config_r9.sf_AllocInfo_r9.buf[0] & MBSFN_TDD_SF8) == MBSFN_TDD_SF8)) {
[i]->mcch_Config_r9.mcch_Offset_r9)
&&
((UE_mac_inst[module_idP].mbsfn_AreaInfo
[i]->mcch_Config_r9.sf_AllocInfo_r9.
buf[0] & MBSFN_TDD_SF8) ==
MBSFN_TDD_SF8)) {
mcch_flag = 1; mcch_flag = 1;
} }
mtch_flag = 1; mtch_flag = 1;
} }
} else { // FDD } else { // FDD
if ((UE_mac_inst[module_idP].mbsfn_SubframeConfig if ((UE_mac_inst[module_idP].mbsfn_SubframeConfig[j]->subframeAllocation.choice.oneFrame.buf[0] & MBSFN_FDD_SF8) == MBSFN_FDD_SF8) {
[j]->subframeAllocation.choice.oneFrame.
buf[0] & MBSFN_FDD_SF8) == MBSFN_FDD_SF8) {
if (msi_pos == 6) { if (msi_pos == 6) {
msi_flag = 1; msi_flag = 1;
} }
if ((frameP % mcch_period == if ((frameP % mcch_period == mcch_offset) &&
UE_mac_inst[module_idP].mbsfn_AreaInfo ((UE_mac_inst[module_idP].mbsfn_AreaInfo[i]->mcch_Config_r9.sf_AllocInfo_r9.buf[0] & MBSFN_FDD_SF8) == MBSFN_FDD_SF8)) {
[i]->mcch_Config_r9.mcch_Offset_r9)
&&
((UE_mac_inst[module_idP].mbsfn_AreaInfo
[i]->mcch_Config_r9.sf_AllocInfo_r9.
buf[0] & MBSFN_FDD_SF8) ==
MBSFN_FDD_SF8)) {
mcch_flag = 1; mcch_flag = 1;
} }
...@@ -1258,22 +1348,14 @@ ue_query_mch(module_id_t module_idP, uint8_t CC_id, uint32_t frameP, ...@@ -1258,22 +1348,14 @@ ue_query_mch(module_id_t module_idP, uint8_t CC_id, uint32_t frameP,
break; break;
case 9: case 9:
if (frame_FDD == 0) { if (UE_mac_inst[module_idP].tdd_Config != NULL) {
if ((UE_mac_inst[module_idP].mbsfn_SubframeConfig if ((UE_mac_inst[module_idP].mbsfn_SubframeConfig[j]->subframeAllocation.choice.oneFrame.buf[0] & MBSFN_TDD_SF9) == MBSFN_TDD_SF9) {
[j]->subframeAllocation.choice.oneFrame.
buf[0] & MBSFN_TDD_SF9) == MBSFN_TDD_SF9) {
if (msi_pos == 5) { if (msi_pos == 5) {
msi_flag = 1; msi_flag = 1;
} }
if ((frameP % mcch_period == if ((frameP % mcch_period == mcch_offset) &&
UE_mac_inst[module_idP].mbsfn_AreaInfo ((UE_mac_inst[module_idP].mbsfn_AreaInfo[i]->mcch_Config_r9.sf_AllocInfo_r9.buf[0] & MBSFN_TDD_SF9) == MBSFN_TDD_SF9)) {
[i]->mcch_Config_r9.mcch_Offset_r9)
&&
((UE_mac_inst[module_idP].mbsfn_AreaInfo
[i]->mcch_Config_r9.sf_AllocInfo_r9.
buf[0] & MBSFN_TDD_SF9) ==
MBSFN_TDD_SF9)) {
mcch_flag = 1; mcch_flag = 1;
} }
...@@ -1282,23 +1364,140 @@ ue_query_mch(module_id_t module_idP, uint8_t CC_id, uint32_t frameP, ...@@ -1282,23 +1364,140 @@ ue_query_mch(module_id_t module_idP, uint8_t CC_id, uint32_t frameP,
} }
break; break;
} // end switch }// end switch
// Acount for sf_allocable in CSA
int num_sf_alloc = 0;
for (i = 0; i < 8; i++) {
if (UE_mac_inst[module_idP].commonSF_Alloc_r9_mbsfn_SubframeConfig[i] == NULL)
continue;
if (UE_mac_inst[module_idP].commonSF_Alloc_r9_mbsfn_SubframeConfig[i]->subframeAllocation.present != MBSFN_SubframeConfig__subframeAllocation_PR_oneFrame)
continue;
uint32_t common_mbsfn_SubframeConfig = UE_mac_inst[module_idP].commonSF_Alloc_r9_mbsfn_SubframeConfig[i]->subframeAllocation.choice.oneFrame.buf[0];
for (j = 0; j < 6; j++)
num_sf_alloc += ((common_mbsfn_SubframeConfig & (0x80 >> j)) == (0x80 >> j));
}
for (i = 0; i < 28; i++) {
if (UE_mac_inst[module_idP].pmch_stop_mtch[i] >= num_sf_alloc) {
if (UE_mac_inst[module_idP].pmch_stop_mtch[i] != 2047) {
if (UE_mac_inst[module_idP].pmch_Config[UE_mac_inst[module_idP].msi_pmch] != NULL)
mtch_mcs = UE_mac_inst[module_idP].pmch_Config[UE_mac_inst[module_idP].msi_pmch]->dataMCS_r9;
else
mtch_mcs = -1;
mch_lcid = (uint8_t)i;
break;
}
}
}
// sf allocation is non-overlapping // sf allocation is non-overlapping
if ((msi_flag == 1) || (mcch_flag == 1) if ((msi_flag==1) || (mcch_flag==1) || (mtch_flag==1)) {
|| (mtch_flag == 1)) { LOG_D(MAC,"[UE %d] Frame %d Subframe %d: sync area %d SF alloc %d: msi flag %d, mcch flag %d, mtch flag %d\n",
LOG_D(MAC, module_idP, frameP, subframe,i,j,msi_flag,mcch_flag,mtch_flag);
"[UE %d] Frame %d Subframe %d: sync area %d SF alloc %d: msi flag %d, mcch flag %d, mtch flag %d\n",
module_idP, frameP, subframe, i, j, msi_flag,
mcch_flag, mtch_flag);
*sync_area = i; *sync_area=i;
break; break;
} }
}
} else { // four-frameP format } else { // four-frameP format
uint32_t mbsfn_SubframeConfig = UE_mac_inst[module_idP].mbsfn_SubframeConfig[j]->subframeAllocation.choice.oneFrame.buf[2] |
(UE_mac_inst[module_idP].mbsfn_SubframeConfig[j]->subframeAllocation.choice.oneFrame.buf[1]<<8) |
(UE_mac_inst[module_idP].mbsfn_SubframeConfig[j]->subframeAllocation.choice.oneFrame.buf[0]<<16);
uint32_t MCCH_mbsfn_SubframeConfig = /* UE_mac_inst[module_idP].mbsfn_AreaInfo[i]->mcch_Config_r9.sf_AllocInfo_r9.buf[2] |
(UE_mac_inst[module_idP].mbsfn_AreaInfo[i]->mcch_Config_r9.sf_AllocInfo_r9.buf[1]<<8) | */
(UE_mac_inst[module_idP].mbsfn_AreaInfo[i]->mcch_Config_r9.sf_AllocInfo_r9.buf[0]<<16);
jj=frameP%4;
if ((frameP % mbsfn_period) == (mbsfn_alloc_offset+jj)) {
if (UE_mac_inst[module_idP].tdd_Config == NULL) {
switch (subframe) {
case 1:
if ((mbsfn_SubframeConfig & (0x800000>>(jj*6))) == (0x800000>>(jj*6))) {
if ((frameP % mcch_period == (mcch_offset+jj)) && ((MCCH_mbsfn_SubframeConfig & (0x800000>>(jj*6))) == (0x800000>>(jj*6)))) {
mcch_flag=1;
LOG_D(MAC,"frameP(%d),mcch_period(%ld),mbsfn_SubframeConfig(%x),MCCH_mbsfn_SubframeConfig(%x),mask(%x),jj(%d),num_sf_alloc(%d)\n",
frameP, mcch_period, mbsfn_SubframeConfig, MCCH_mbsfn_SubframeConfig, (0x800000>>(jj*6)), jj, UE_mac_inst[module_idP].common_num_sf_alloc);
if(UE_mac_inst[module_idP].commonSF_Alloc_r9_mbsfn_SubframeConfig[0]==NULL)
UE_mac_inst[module_idP].common_num_sf_alloc++;
}
}
break;
case 2:
if ((mbsfn_SubframeConfig & (0x400000>>(jj*6))) == (0x400000>>(jj*6))) {
if ((frameP % mcch_period == (mcch_offset+jj)) && ((MCCH_mbsfn_SubframeConfig & (0x400000>>(jj*6))) == (0x400000>>(jj*6)))) {
mcch_flag=1;
LOG_D(MAC,"frameP(%d),mcch_period(%ld),mbsfn_SubframeConfig(%x),MCCH_mbsfn_SubframeConfig(%x),mask(%x),jj(%d),num_sf_alloc(%d)\n",
frameP, mcch_period, mbsfn_SubframeConfig, MCCH_mbsfn_SubframeConfig, (0x400000>>(jj*6)), jj, UE_mac_inst[module_idP].common_num_sf_alloc);
if(UE_mac_inst[module_idP].commonSF_Alloc_r9_mbsfn_SubframeConfig[0]==NULL)
UE_mac_inst[module_idP].common_num_sf_alloc++;
}
}
break;
case 3:
if ((mbsfn_SubframeConfig & (0x200000>>(jj*6))) == (0x200000>>(jj*6))) {
if ((frameP % mcch_period == (mcch_offset+jj)) && ((MCCH_mbsfn_SubframeConfig & (0x200000>>(jj*6))) == (0x200000>>(jj*6)))) {
LOG_D(MAC,"frameP(%d),mcch_period(%ld),mbsfn_SubframeConfig(%x),MCCH_mbsfn_SubframeConfig(%x),mask(%x),jj(%d),num_sf_alloc(%d)\n",
frameP, mcch_period, mbsfn_SubframeConfig, MCCH_mbsfn_SubframeConfig, (0x200000>>(jj*6)), jj, UE_mac_inst[module_idP].common_num_sf_alloc);
mcch_flag=1;
if(UE_mac_inst[module_idP].commonSF_Alloc_r9_mbsfn_SubframeConfig[0]==NULL)
UE_mac_inst[module_idP].common_num_sf_alloc++;
}
}
break;
case 6:
if ((mbsfn_SubframeConfig & (0x100000>>(jj*6))) == (0x100000>>(jj*6))) {
if ((frameP % mcch_period == (mcch_offset+jj)) && ((MCCH_mbsfn_SubframeConfig & (0x100000>>(jj*6))) == (0x100000>>(jj*6)))) {
LOG_D(MAC,"frameP(%d),mcch_period(%ld),mbsfn_SubframeConfig(%x),MCCH_mbsfn_SubframeConfig(%x),mask(%x),jj(%d),num_sf_alloc(%d)\n",
frameP, mcch_period, mbsfn_SubframeConfig, MCCH_mbsfn_SubframeConfig, (0x100000>>(jj*6)), jj, UE_mac_inst[module_idP].common_num_sf_alloc);
mcch_flag=1;
if(UE_mac_inst[module_idP].commonSF_Alloc_r9_mbsfn_SubframeConfig[0]==NULL)
UE_mac_inst[module_idP].common_num_sf_alloc++;
}
}
break;
case 7:
if ((mbsfn_SubframeConfig & (0x80000>>(jj*6))) == (0x80000>>(jj*6))) {
if ((frameP % mcch_period == (mcch_offset+jj)) && ((MCCH_mbsfn_SubframeConfig & (0x80000>>(jj*6))) == (0x80000>>(jj*6)))) {
LOG_D(MAC,"frameP(%d),mcch_period(%ld),mbsfn_SubframeConfig(%x),MCCH_mbsfn_SubframeConfig(%x),mask(%x),jj(%d),num_sf_alloc(%d)\n",
frameP, mcch_period, mbsfn_SubframeConfig, MCCH_mbsfn_SubframeConfig, (0x80000>>(jj*6)), jj, UE_mac_inst[module_idP].common_num_sf_alloc);
if(UE_mac_inst[module_idP].commonSF_Alloc_r9_mbsfn_SubframeConfig[0]==NULL)
UE_mac_inst[module_idP].common_num_sf_alloc++;
mcch_flag=1;
}
}
break;
case 8:
if ((mbsfn_SubframeConfig & (0x40000>>(jj*6))) == (0x40000>>(jj*6))) {
if ((frameP % mcch_period == (mcch_offset+jj)) && ((MCCH_mbsfn_SubframeConfig & (0x40000>>(jj*6))) == (0x40000>>(jj*6)))) {
LOG_D(MAC,"frameP(%d),mcch_period(%ld),mbsfn_SubframeConfig(%x),MCCH_mbsfn_SubframeConfig(%x),mask(%x),jj(%d),num_sf_alloc(%d)\n",
frameP, mcch_period, mbsfn_SubframeConfig, MCCH_mbsfn_SubframeConfig, (0x40000>>(jj*6)), jj, UE_mac_inst[module_idP].common_num_sf_alloc);
if(UE_mac_inst[module_idP].commonSF_Alloc_r9_mbsfn_SubframeConfig[0]==NULL)
UE_mac_inst[module_idP].common_num_sf_alloc++;
mcch_flag=1;
}
}
break;
}// end switch
} else {
// TODO TDD
}
mtch_mcs = ue_query_p_mch(module_idP, frameP, subframe, &mtch_flag, &msi_flag, &mch_lcid);
// sf allocation is non-overlapping
if ((msi_flag==1) || (mcch_flag==1) || (mtch_flag==1)) {
LOG_D(MAC,"[UE %d] Frame %d Subframe %d: sync area %d SF alloc %d: msi flag %d, mcch flag %d, mtch flag %d\n",
module_idP, frameP, subframe,i,j,msi_flag,mcch_flag,mtch_flag);
*sync_area=i;
break;
}
} }
} }
} // end of for } // end of for
#if UE_TIMING_TRACE #if UE_TIMING_TRACE
stop_meas(&UE_mac_inst[module_idP].ue_query_mch); stop_meas(&UE_mac_inst[module_idP].ue_query_mch);
#endif #endif
...@@ -1307,12 +1506,27 @@ ue_query_mch(module_id_t module_idP, uint8_t CC_id, uint32_t frameP, ...@@ -1307,12 +1506,27 @@ ue_query_mch(module_id_t module_idP, uint8_t CC_id, uint32_t frameP,
*mcch_active = 1; *mcch_active = 1;
} }
if ((mcch_flag == 1) if ( (mcch_flag==1) || ((msi_flag==1) && (UE_mac_inst[module_idP].mcch_status==1)) ) {
|| ((msi_flag == 1) && (UE_mac_inst[module_idP].mcch_status == 1))) { if (msi_flag!=1) {
for (i=0; i<8; i++)
UE_mac_inst[module_idP].commonSF_Alloc_r9_mbsfn_SubframeConfig[i] = NULL;
for (i=0; i<15; i++)
UE_mac_inst[module_idP].pmch_Config[i] = NULL;
for (i=0; i<28 ;i++) {
UE_mac_inst[module_idP].pmch_lcids[i] = -1;
UE_mac_inst[module_idP].pmch_stop_mtch[i] = 2047;
UE_mac_inst[module_idP].msi_status_v[i] = 0;
}
} else {
for (i=0; i<28; i++) {
UE_mac_inst[module_idP].pmch_lcids[i] = -1;
UE_mac_inst[module_idP].pmch_stop_mtch[i] = 2047;
UE_mac_inst[module_idP].msi_status_v[i] = 0;
}
}
return mcch_mcs; return mcch_mcs;
} else if ((mtch_flag == 1) } else if ((mtch_flag==1) && (UE_mac_inst[module_idP].msi_status_v[(mch_lcid > 27) ? 27 : mch_lcid] == 1)) {
&& (UE_mac_inst[module_idP].msi_status == 1)) { return mtch_mcs;
return UE_mac_inst[module_idP].pmch_Config[0]->dataMCS_r9;
} else { } else {
return -1; return -1;
} }
......
...@@ -4594,10 +4594,30 @@ int decode_MCCH_Message( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB ...@@ -4594,10 +4594,30 @@ int decode_MCCH_Message( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void decode_MBSFNAreaConfiguration( module_id_t ue_mod_idP, uint8_t eNB_index, frame_t frameP, uint8_t mbsfn_sync_area ) void decode_MBSFNAreaConfiguration( module_id_t ue_mod_idP, uint8_t eNB_index, frame_t frameP, uint8_t mbsfn_sync_area )
{ {
uint8_t i;
protocol_ctxt_t ctxt; protocol_ctxt_t ctxt;
LOG_I(RRC,"[UE %d] Frame %d : Number of MCH(s) in the MBSFN Sync Area %d is %d\n", LOG_I(RRC,"[UE %d] Frame %d : Number of MCH(s) in the MBSFN Sync Area %d is %d\n",
ue_mod_idP, frameP, mbsfn_sync_area, UE_rrc_inst[ue_mod_idP].mcch_message[eNB_index]->pmch_InfoList_r9.list.count); ue_mod_idP, frameP, mbsfn_sync_area, UE_rrc_inst[ue_mod_idP].mcch_message[eNB_index]->pmch_InfoList_r9.list.count);
// Configure commonSF_Alloc
for(i=0; i< UE_rrc_inst[ue_mod_idP].mcch_message[eNB_index]->commonSF_Alloc_r9.list.count;i++){
LOG_W(RRC,"[UE %d] Frame %d, commonSF_Alloc_r9: radioframeAllocationPeriod(%ldn),radioframeAllocationOffset(%ld), subframeAllocation(%x,%x,%x)\n",
ue_mod_idP, frameP,
UE_rrc_inst[ue_mod_idP].mcch_message[eNB_index]->commonSF_Alloc_r9.list.array[i]->radioframeAllocationPeriod<<1,
UE_rrc_inst[ue_mod_idP].mcch_message[eNB_index]->commonSF_Alloc_r9.list.array[i]->radioframeAllocationOffset,
UE_rrc_inst[ue_mod_idP].mcch_message[eNB_index]->commonSF_Alloc_r9.list.array[i]->subframeAllocation.choice.oneFrame.buf[0],
UE_rrc_inst[ue_mod_idP].mcch_message[eNB_index]->commonSF_Alloc_r9.list.array[i]->subframeAllocation.choice.oneFrame.buf[1],
UE_rrc_inst[ue_mod_idP].mcch_message[eNB_index]->commonSF_Alloc_r9.list.array[i]->subframeAllocation.choice.oneFrame.buf[2]);
UE_mac_inst[ue_mod_idP].commonSF_Alloc_r9_mbsfn_SubframeConfig[i] = UE_rrc_inst[ue_mod_idP].mcch_message[eNB_index]->commonSF_Alloc_r9.list.array[i];
}
LOG_W(RRC,"[UE %d] Frame %d, commonSF_AllocPeriod_r9 %drf \n",
ue_mod_idP, frameP,
4<<UE_rrc_inst[ue_mod_idP].mcch_message[eNB_index]->commonSF_AllocPeriod_r9);
// Configure commonSF_AllocPeriod
UE_mac_inst[ue_mod_idP].commonSF_AllocPeriod_r9 = UE_rrc_inst[ue_mod_idP].mcch_message[eNB_index]->commonSF_AllocPeriod_r9;
// store to MAC/PHY necessary parameters for receiving MTCHs // store to MAC/PHY necessary parameters for receiving MTCHs
rrc_mac_config_req_ue(ue_mod_idP,0,eNB_index, rrc_mac_config_req_ue(ue_mod_idP,0,eNB_index,
......
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