Commit 23e63be7 authored by Javier Morgade's avatar Javier Morgade

FeMBMS PBCH (Physical Broadcast Channel) 3GPP TS 36.211 version 14.2.0 Release 14 Section 6.6

	Code cleanup
parent a25f4b08
......@@ -19,6 +19,17 @@
* contact@openairinterface.org
*/
/*! \file config_ue.c
* \brief This includes FeMBMS UE Channel Estimation Procedures for FeMBMS 1.25KHz Carrier Spacing
* \author Javier Morgade
* \date 2019
* \version 0.1
* \email: javier.morgade@ieee.org
* @ingroup _phy
*/
#include <string.h>
#include "PHY/defs_UE.h"
#include "lte_estimation.h"
......
......@@ -22,6 +22,18 @@
#include "PHY/defs_eNB.h"
#include "PHY/phy_extern.h"
/*! \file PHY/LTE_TRANSPORT/pmch_common.c
* \brief This includes routines for decoding the UE FeMBMS/PMCH physical/multicast/transport channel 3GPP TS 36.211 version 14.2.0 Release 14 Sections 6.5/6.10.2
* \author J. Morgade
* \date 2019
* \version 0.1
* \company Vicomtech
* \email: javier.morgade@ieee.org
* \note
* \warning
*/
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
int is_fembms_cas_subframe(uint32_t frame, int subframe, LTE_DL_FRAME_PARMS *frame_parms){
......
......@@ -29,6 +29,8 @@
* \note
* \warning
*/
#include "PHY/defs_UE.h"
#include "PHY/CODING/coding_defs.h"
#include "PHY/CODING/coding_extern.h"
......@@ -630,3 +632,201 @@ uint16_t rx_pbch(LTE_UE_COMMON *lte_ue_common_vars,
}
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
void pbch_unscrambling_fembms(LTE_DL_FRAME_PARMS *frame_parms,
int8_t* llr,
uint32_t length,
uint8_t frame_mod4)
{
int i;
uint8_t reset;
uint32_t x1, x2, s=0;
reset = 1;
// x1 is set in first call to lte_gold_generic
x2 = frame_parms->Nid_cell+(1<<9); //this is c_init for FeMBMS in 36.211 Sec 6.6.1
printf("pbch_unscrambling: Nid_cell = %d, x2 = %d, frame_mod4 %d length %d\n",frame_parms->Nid_cell,x2,frame_mod4,length);
for (i=0; i<length; i++) {
if (i%32==0) {
s = lte_gold_generic(&x1, &x2, reset);
// printf("lte_gold[%d]=%x\n",i,s);
reset = 0;
}
// take the quarter of the PBCH that corresponds to this frame
if ((i>=(frame_mod4*(length>>2))) && (i<((1+frame_mod4)*(length>>2)))) {
if (((s>>(i%32))&1)==0)
llr[i] = -llr[i];
}
}
}
uint16_t rx_pbch_fembms(LTE_UE_COMMON *lte_ue_common_vars,
LTE_UE_PBCH *lte_ue_pbch_vars,
LTE_DL_FRAME_PARMS *frame_parms,
uint8_t eNB_id,
MIMO_mode_t mimo_mode,
uint32_t high_speed_flag,
uint8_t frame_mod4)
{
uint8_t log2_maxh;//,aatx,aarx;
int max_h=0;
int symbol,i;
uint32_t nsymb = (frame_parms->Ncp==0) ? 14:12;
uint16_t pbch_E;
uint8_t pbch_a[8];
uint8_t RCC;
int8_t *pbch_e_rx;
uint8_t *decoded_output = lte_ue_pbch_vars->decoded_output;
uint16_t crc;
// pbch_D = 16+PBCH_A;
pbch_E = (frame_parms->Ncp==0) ? 1920 : 1728; //RE/RB * #RB * bits/RB (QPSK)
pbch_e_rx = &lte_ue_pbch_vars->llr[frame_mod4*(pbch_E>>2)];
#ifdef DEBUG_PBCH
LOG_D(PHY,"[PBCH] starting symbol loop (Ncp %d, frame_mod4 %d,mimo_mode %d\n",frame_parms->Ncp,frame_mod4,mimo_mode);
#endif
// clear LLR buffer
memset(lte_ue_pbch_vars->llr,0,pbch_E);
for (symbol=(nsymb>>1); symbol<(nsymb>>1)+4; symbol++) {
#ifdef DEBUG_PBCH
LOG_D(PHY,"[PBCH] starting extract\n");
#endif
pbch_extract(lte_ue_common_vars->common_vars_rx_data_per_thread[0].rxdataF,
lte_ue_common_vars->common_vars_rx_data_per_thread[0].dl_ch_estimates[eNB_id],
lte_ue_pbch_vars->rxdataF_ext,
lte_ue_pbch_vars->dl_ch_estimates_ext,
symbol,
high_speed_flag,
frame_parms);
#ifdef DEBUG_PBCH
LOG_D(PHY,"[PHY] PBCH Symbol %d\n",symbol);
LOG_D(PHY,"[PHY] PBCH starting channel_level\n");
#endif
max_h = pbch_channel_level(lte_ue_pbch_vars->dl_ch_estimates_ext,
frame_parms,
symbol);
log2_maxh = 3+(log2_approx(max_h)/2);
#ifdef DEBUG_PBCH
LOG_D(PHY,"[PHY] PBCH log2_maxh = %d (%d)\n",log2_maxh,max_h);
#endif
pbch_channel_compensation(lte_ue_pbch_vars->rxdataF_ext,
lte_ue_pbch_vars->dl_ch_estimates_ext,
lte_ue_pbch_vars->rxdataF_comp,
frame_parms,
symbol,
log2_maxh); // log2_maxh+I0_shift
if (frame_parms->nb_antennas_rx > 1)
pbch_detection_mrc(frame_parms,
lte_ue_pbch_vars->rxdataF_comp,
symbol);
if (mimo_mode == ALAMOUTI) {
pbch_alamouti(frame_parms,lte_ue_pbch_vars->rxdataF_comp,symbol);
} else if (mimo_mode != SISO) {
LOG_D(PHY,"[PBCH][RX] Unsupported MIMO mode\n");
return(-1);
}
if (symbol>(nsymb>>1)+1) {
pbch_quantize(pbch_e_rx,
(short*)&(lte_ue_pbch_vars->rxdataF_comp[0][(symbol%(nsymb>>1))*72]),
144);
pbch_e_rx+=144;
} else {
pbch_quantize(pbch_e_rx,
(short*)&(lte_ue_pbch_vars->rxdataF_comp[0][(symbol%(nsymb>>1))*72]),
96);
pbch_e_rx+=96;
}
}
pbch_e_rx = lte_ue_pbch_vars->llr;
//un-scrambling
#ifdef DEBUG_PBCH
LOG_D(PHY,"[PBCH] doing unscrambling\n");
#endif
pbch_unscrambling_fembms(frame_parms,
pbch_e_rx,
pbch_E,
frame_mod4);
//un-rate matching
#ifdef DEBUG_PBCH
LOG_D(PHY,"[PBCH] doing un-rate-matching\n");
#endif
memset(dummy_w_rx,0,3*3*(16+PBCH_A));
RCC = generate_dummy_w_cc(16+PBCH_A,
dummy_w_rx);
lte_rate_matching_cc_rx(RCC,pbch_E,pbch_w_rx,dummy_w_rx,pbch_e_rx);
sub_block_deinterleaving_cc((unsigned int)(PBCH_A+16),
&pbch_d_rx[96],
&pbch_w_rx[0]);
memset(pbch_a,0,((16+PBCH_A)>>3));
phy_viterbi_lte_sse2(pbch_d_rx+96,pbch_a,16+PBCH_A);
// Fix byte endian of PBCH (bit 23 goes in first)
for (i=0; i<(PBCH_A>>3); i++)
decoded_output[(PBCH_A>>3)-i-1] = pbch_a[i];
#ifdef DEBUG_PBCH
for (i=0; i<(PBCH_A>>3); i++)
LOG_I(PHY,"[PBCH] pbch_a[%d] = %x\n",i,decoded_output[i]);
#endif //DEBUG_PBCH
#ifdef DEBUG_PBCH
LOG_I(PHY,"PBCH CRC %x : %x\n",
crc16(pbch_a,PBCH_A),
((uint16_t)pbch_a[PBCH_A>>3]<<8)+pbch_a[(PBCH_A>>3)+1]);
#endif
crc = (crc16(pbch_a,PBCH_A)>>16) ^
(((uint16_t)pbch_a[PBCH_A>>3]<<8)+pbch_a[(PBCH_A>>3)+1]);
if (crc == 0x0000)
return(1);
else if (crc == 0xffff)
return(2);
else if (crc == 0x5555)
return(4);
else
return(-1);
}
#endif
......@@ -19,6 +19,18 @@
* contact@openairinterface.org
*/
/*! \file PHY/LTE_UE_TRANSPORT/pmch_ue.c
* \brief This includes routines for decoding the UE FeMBMS/PMCH physical/multicast/transport channel 3GPP TS 36.211 version 14.2.0 Release 14 Sections 6.5/6.10.2
* \author J. Morgade
* \date 2019
* \version 0.1
* \company Vicomtech
* \email: javier.morgade@ieee.org
* \note
* \warning
*/
#include "PHY/defs_UE.h"
#include "PHY/phy_extern_ue.h"
#include "PHY/sse_intrin.h"
......
......@@ -1125,6 +1125,20 @@ uint16_t rx_pbch(LTE_UE_COMMON *lte_ue_common_vars,
uint32_t high_speed_flag,
uint8_t frame_mod4);
#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0))
/*! \brief receiver for the PBCH FeMBMS
\returns number of tx antennas or -1 if error
*/
uint16_t rx_pbch_fembms(LTE_UE_COMMON *lte_ue_common_vars,
LTE_UE_PBCH *lte_ue_pbch_vars,
LTE_DL_FRAME_PARMS *frame_parms,
uint8_t eNB_id,
MIMO_mode_t mimo_mode,
uint32_t high_speed_flag,
uint8_t frame_mod4);
#endif
uint16_t rx_pbch_emul(PHY_VARS_UE *phy_vars_ue,
uint8_t eNB_id,
uint8_t pbch_phase);
......
......@@ -20,12 +20,12 @@
*/
/*! \file phy_procedures_lte_ue.c
* \brief Implementation of UE procedures from 36.213 LTE specifications
* \author R. Knopp, F. Kaltenberger, N. Nikaein
* \brief Implementation of UE procedures from 36.213 LTE specifications / This includes FeMBMS UE procedures from 36.213 v14.2.0 specification
* \author R. Knopp, F. Kaltenberger, N. Nikaein, J. Morgade
* \date 2011
* \version 0.1
* \company Eurecom
* \email: knopp@eurecom.fr,florian.kaltenberger@eurecom.fr, navid.nikaein@eurecom.fr
* \email: knopp@eurecom.fr,florian.kaltenberger@eurecom.fr, navid.nikaein@eurecom.fr, javier.morgade@ieee.org
* \note
* \warning
*/
......
......@@ -20,16 +20,18 @@
* contact@openairinterface.org
*/
/*! \file config.c
* \brief UE and eNB configuration performed by RRC or as a consequence of RRC procedures
* \author Navid Nikaein and Raymond Knopp
* \date 2010 - 2014
/*! \file config_ue.c
* \brief UE configuration performed by RRC or as a consequence of RRC procedures / This includes FeMBMS UE procedures
* \author Navid Nikaein, Raymond Knopp and Javier Morgade
* \date 2010 - 2014 / 2019
* \version 0.1
* \email: navid.nikaein@eurecom.fr
* \email: navid.nikaein@eurecom.fr, javier.morgade@ieee.org
* @ingroup _mac
*/
#include "COMMON/platform_types.h"
#include "COMMON/platform_constants.h"
#include "SCHED_UE/sched_UE.h"
......
......@@ -19,14 +19,14 @@
* contact@openairinterface.org
*/
/*! \file ue_procedures.c
* \brief procedures related to UE
* \author Navid Nikaein and Raymond Knopp
* \date 2010 - 2014
* \version 1
* \email: navid.nikaein@eurecom.fr
* @ingroup _mac
/*! \file asn1_msg.c
* \brief primitives to build the asn1 messages / primitives to build FeMBMS asn1 messages
* \author Raymond Knopp, Navid Nikaein and Javier Morgade
* \date 2011 / 2019
* \version 1.0
* \company Eurecom
* \email: raymond.knopp@eurecom.fr, navid.nikaein@eurecom.fr javier.morgade@ieee.org
*/
#ifdef EXMIMO
......
......@@ -20,12 +20,12 @@
*/
/*! \file rrc_UE.c
* \brief rrc procedures for UE
* \author Navid Nikaein and Raymond Knopp
* \date 2011 - 2014
* \brief rrc procedures for UE / rrc procedures for FeMBMS UE
* \author Navid Nikaein, Raymond Knopp and Javier Morgade
* \date 2011 - 2014 / FeMBMS 2019
* \version 1.0
* \company Eurecom
* \email: navid.nikaein@eurecom.fr and raymond.knopp@eurecom.fr
* \company Eurecom, Vicomtech
* \email: navid.nikaein@eurecom.fr, raymond.knopp@eurecom.fr and javier.morgade@ieee.org
*/
#define RRC_UE
......
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