Commit 79c80bc7 authored by Matthieu Kanj's avatar Matthieu Kanj

adding broadcast channel + bug fixes for physical layer

parent 30ee1222
......@@ -68,7 +68,7 @@ int lte_dl_cell_spec_NB_IoT(PHY_VARS_eNB *phy_vars_eNB,
NB_IoT_start = phy_vars_eNB->frame_parms.ofdm_symbol_size - 12*(phy_vars_eNB->frame_parms.N_RB_DL/2) - (bandwidth_even_odd*6) + 12*(RB_IoT_ID%((int)(ceil(phy_vars_eNB->frame_parms.N_RB_DL/(float)2))));
} else {
//XXX invalid mod operation (put a cast for the moment)
NB_IoT_start = (bandwidth_even_odd*6) + 12*(RB_IoT_ID%((int)(ceil(phy_vars_eNB->frame_parms.N_RB_DL/(float)2))));
NB_IoT_start = 1 + (bandwidth_even_odd*6) + 12*(RB_IoT_ID%((int)(ceil(phy_vars_eNB->frame_parms.N_RB_DL/(float)2))));
}
k+=NB_IoT_start;
......
......@@ -52,6 +52,9 @@ uint16_t get_UL_sc_start_NB_IoT(uint16_t I_sc)
}
if (I_sc>18){
return -1;
} else {
return -1; // this was added to remove warning since it is not a void function
}
}
......
......@@ -24,6 +24,7 @@
#include "PHY/LTE_REFSIG/defs_NB_IoT.h"
#include "PHY/impl_defs_lte_NB_IoT.h"
#include "PHY/impl_defs_top_NB_IoT.h"
#include "PHY/impl_defs_lte.h"
//#ifdef PHY_ABSTRACTION
//#include "SIMULATION/TOOLS/defs.h"
......@@ -35,7 +36,7 @@
#define NPBCH_A 34 // 34 for NB-IoT and 24 for LTE
int allocate_npbch_REs_in_RB(NB_IoT_DL_FRAME_PARMS *frame_parms,
int allocate_npbch_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
int32_t **txdataF,
uint32_t *jj,
uint32_t symbol_offset,
......@@ -45,7 +46,7 @@ int allocate_npbch_REs_in_RB(NB_IoT_DL_FRAME_PARMS *frame_parms,
unsigned short id_offset,
uint32_t *re_allocated) // not used variable ??!!
{
MIMO_mode_NB_IoT_t mimo_mode = (frame_parms->mode1_flag==1)?SISO_NB_IoT:ALAMOUTI_NB_IoT;
MIMO_mode_t mimo_mode = (frame_parms->mode1_flag==1)?SISO:ALAMOUTI;
uint32_t tti_offset,aa;
uint8_t re;
......@@ -64,7 +65,7 @@ int allocate_npbch_REs_in_RB(NB_IoT_DL_FRAME_PARMS *frame_parms,
if (pilots != 1 || re%3 != id_offset) // if re is not a pilot
{
// diff_re = re%3 - id_offset;
if (mimo_mode == SISO_NB_IoT) { //SISO mapping
if (mimo_mode == SISO) { //SISO mapping
*re_allocated = *re_allocated + 1; // variable incremented but never used
for (aa=0; aa<frame_parms->nb_antennas_tx; aa++) {
((int16_t*)&txdataF[aa][tti_offset])[0] += (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; //I //b_i
......@@ -74,7 +75,7 @@ int allocate_npbch_REs_in_RB(NB_IoT_DL_FRAME_PARMS *frame_parms,
((int16_t*)&txdataF[aa][tti_offset])[1] += (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; //Q //b_{i+1}
}
*jj = *jj + 1;
} else if (mimo_mode == ALAMOUTI_NB_IoT) {
} else if (mimo_mode == ALAMOUTI) {
*re_allocated = *re_allocated + 1;
((int16_t*)&tmp_sample1)[0] = (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK;
......@@ -123,7 +124,7 @@ int allocate_npbch_REs_in_RB(NB_IoT_DL_FRAME_PARMS *frame_parms,
int generate_npbch(NB_IoT_eNB_NPBCH_t *eNB_npbch,
int32_t **txdataF,
int amp,
NB_IoT_DL_FRAME_PARMS *frame_parms,
LTE_DL_FRAME_PARMS *frame_parms,
uint8_t *npbch_pdu,
uint8_t frame_mod64,
unsigned short NB_IoT_RB_ID)
......@@ -199,7 +200,7 @@ int generate_npbch(NB_IoT_eNB_NPBCH_t *eNB_npbch,
{
NB_IoT_start = frame_parms->ofdm_symbol_size - 12*(frame_parms->N_RB_DL/2) - (bandwidth_even_odd*6) + 12*(RB_IoT_ID%(int)(ceil(frame_parms->N_RB_DL/(float)2)));
} else {
NB_IoT_start = (bandwidth_even_odd*6) + 12*(RB_IoT_ID%(int)(ceil(frame_parms->N_RB_DL/(float)2)));
NB_IoT_start = 1 + (bandwidth_even_odd*6) + 12*(RB_IoT_ID%(int)(ceil(frame_parms->N_RB_DL/(float)2)));
}
symbol_offset = frame_parms->ofdm_symbol_size*l + NB_IoT_start; // symbol_offset = 512 * L + NB_IOT_RB start
......@@ -220,7 +221,7 @@ return(0);
}
/**********************************************************
**********************************************************/
void npbch_scrambling(NB_IoT_DL_FRAME_PARMS *frame_parms,
void npbch_scrambling(LTE_DL_FRAME_PARMS *frame_parms,
uint8_t *npbch_e,
uint32_t length) // 1600
{
......
......@@ -49,7 +49,7 @@ int generate_npss_NB_IoT(int32_t **txdataF,
{
NB_IoT_start = frame_parms->ofdm_symbol_size - 12*(frame_parms->N_RB_DL/2) - (bandwidth_even_odd*6) + 12*(RB_IoT_ID%(int)(ceil(frame_parms->N_RB_DL/(float)2)));
} else {
NB_IoT_start = (bandwidth_even_odd*6) + 12*(RB_IoT_ID%(int)(ceil(frame_parms->N_RB_DL/(float)2)));
NB_IoT_start = 1 + (bandwidth_even_odd*6) + 12*(RB_IoT_ID%(int)(ceil(frame_parms->N_RB_DL/(float)2)));
}
// For the In-band or Stand-alone case the REs of NPSS signal have the same positions
for (s=0; s<11; s++ ) // loop on OFDM symbols
......
......@@ -115,7 +115,7 @@ int generate_sss_NB_IoT(int32_t **txdataF,
{
NB_IoT_start = frame_parms->ofdm_symbol_size - 12*(frame_parms->N_RB_DL/2) - (bandwidth_even_odd*6) + 12*(RB_IoT_ID%(int)(ceil(frame_parms->N_RB_DL/(float)2)));
} else {
NB_IoT_start = (bandwidth_even_odd*6) + 12*(RB_IoT_ID%(int)(ceil(frame_parms->N_RB_DL/(float)2)));
NB_IoT_start = 1 + (bandwidth_even_odd*6) + 12*(RB_IoT_ID%(int)(ceil(frame_parms->N_RB_DL/(float)2)));
}
// For the In-band or Stand-alone case the REs of NPSS signal have the same positions
for (s=0; s<11; s++ ) // loop on OFDM symbols
......
......@@ -76,7 +76,7 @@ void generate_pilots_NB_IoT(PHY_VARS_eNB *phy_vars_eNB,
//NPBCH
int allocate_npbch_REs_in_RB(NB_IoT_DL_FRAME_PARMS *frame_parms,
int allocate_npbch_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
int32_t **txdataF,
uint32_t *jj,
uint32_t symbol_offset,
......@@ -90,13 +90,13 @@ int allocate_npbch_REs_in_RB(NB_IoT_DL_FRAME_PARMS *frame_parms,
int generate_npbch(NB_IoT_eNB_NPBCH_t *eNB_npbch,
int32_t **txdataF,
int amp,
NB_IoT_DL_FRAME_PARMS *frame_parms,
LTE_DL_FRAME_PARMS *frame_parms,
uint8_t *npbch_pdu,
uint8_t frame_mod64,
unsigned short NB_IoT_RB_ID);
void npbch_scrambling(NB_IoT_DL_FRAME_PARMS *frame_parms,
void npbch_scrambling(LTE_DL_FRAME_PARMS *frame_parms,
uint8_t *npbch_e,
uint32_t length);
......
......@@ -120,6 +120,8 @@ static inline void* malloc16_clear( size_t size )
#include "impl_defs_top.h"
#include "impl_defs_lte.h"
#include "PHY/LTE_TRANSPORT/defs_NB_IoT.h"
#include "PHY/TOOLS/time_meas.h"
#include "PHY/CODING/defs.h"
#include "PHY/TOOLS/defs.h"
......@@ -500,6 +502,14 @@ typedef struct PHY_VARS_eNB_s {
/// Pointer for ifdevice buffer struct
if_buffer_t ifbuffer;
/////////////// NB-IoT testing ////////////////////////////
NB_IoT_eNB_NPBCH_t npbch;
//////////////////// END /////////////////////////////////
} PHY_VARS_eNB;
#define debug_msg if (((mac_xface->frame%100) == 0) || (mac_xface->frame < 50)) msg
......
......@@ -33,6 +33,7 @@
#include "PHY/defs.h"
#include "PHY/defs_NB_IoT.h"
#include "PHY/LTE_ESTIMATION/defs_NB_IoT.h"
#include "PHY/LTE_TRANSPORT/defs_NB_IoT.h"
//#include "PHY/extern_NB_IoT.h" //where we get the global Sched_Rsp_t structure filled
//#include "SCHED/defs.h"
#include "SCHED/extern_NB_IoT.h"
......@@ -46,7 +47,7 @@
// for NB-IoT
#include "SCHED/defs_NB_IoT.h"
#include "openair2/RRC/LITE/proto_NB_IoT.h"
//#define DEBUG_PHY_PROC (Already defined in cmake)
//#define DEBUG_ULSCH
......@@ -217,13 +218,14 @@ void common_signal_procedures_NB_IoT(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc)
{
//LTE_DL_FRAME_PARMS *fp = &eNB->frame_parms_NB_IoT;
LTE_DL_FRAME_PARMS *fp = &eNB->frame_parms;
NB_IoT_eNB_NPBCH_t *broadcast_str = &eNB->npbch;
int **txdataF = eNB->common_vars.txdataF[0];
int subframe = proc->subframe_tx;
int frame = proc->frame_tx;
//uint16_t Ntti = 10; //ntti = 10
int RB_IoT_ID=2 ; // XXX should be initialized (RB reserved for NB-IoT, PRB index)
int With_NSSS=0; // With_NSSS = 1; if the frame include a sub-Frame with NSSS signal
uint8_t *npbch_pdu = get_NB_IoT_MIB();
//NSSS only happened in the even frame
if(frame%2==0)
......@@ -236,8 +238,6 @@ void common_signal_procedures_NB_IoT(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc)
}
if(subframe == 5)
{
......@@ -250,7 +250,7 @@ void common_signal_procedures_NB_IoT(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc)
}
else if((subframe == 9)&&(With_NSSS == 1))
{
//printf("NSSS");
generate_sss_NB_IoT(txdataF,
AMP,
fp,
......@@ -268,6 +268,17 @@ void common_signal_procedures_NB_IoT(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc)
RB_IoT_ID,
With_NSSS);
if(subframe == 0)
{
generate_npbch(broadcast_str,
txdataF,
AMP,
fp,
npbch_pdu,
frame%64,
RB_IoT_ID);
}
}
void phy_procedures_eNB_uespec_RX_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,eNB_rxtx_proc_t *proc,UL_IND_NB_IoT_t *UL_INFO)
......
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