Commit 060cdd70 authored by Matthieu Kanj's avatar Matthieu Kanj

removing some warnings + NPUSCH update

parent 03769bdb
......@@ -39,6 +39,9 @@
#include "PHY/LTE_TRANSPORT/extern_NB_IoT.h"
//#define DEBUG_CH
#include "PHY/LTE_TRANSPORT/sc_rotation_NB_IoT.h"
#include "T.h"
// For Channel Estimation in Distributed Alamouti Scheme
......@@ -95,7 +98,7 @@ void rotate_channel_single_carrier_NB_IoT(int16_t *estimated_channel,unsigned ch
/////////////////////////////////////////// temporary functions for channel estimation and rotation
/*
void rotate_channel_sc_tmp_NB_IoT(int16_t *estimated_channel,
uint8_t l,
uint8_t Qm,
......@@ -154,6 +157,118 @@ void rotate_channel_sc_tmp_NB_IoT(int16_t *estimated_channel,
}
}
*/
///////////////////////////////////////////////////////////
void rotate_channel_sc_tmp_NB_IoT(int16_t *estimated_channel,
uint8_t l,
uint8_t Qm,
uint8_t counter_msg3,
uint16_t N_SF_per_word,
uint16_t ul_sc_start,
uint8_t flag)
{
//uint32_t I_sc = 10;//eNB->ulsch_NB_IoT[UE_id]->harq_process->I_sc; // NB_IoT: subcarrier indication field: must be defined in higher layer
//uint16_t ul_sc_start; // subcarrier start index into UL RB
int16_t pi_2_re[2] = {32767 , 0};
int16_t pi_2_im[2] = {0 , 32767};
int16_t pi_4_re[2] = {32767 , 23170};
int16_t pi_4_im[2] = {0 , 23170};
int k;
int16_t est_channel_re, est_channel_im, est_channel_re2, est_channel_im2;
int16_t *e_phi_re,*e_phi_im;
switch(ul_sc_start) /// only for single tone and 15 KHz spacing ? // missing the other configs
{
case 0:
e_phi_re = e_phi_re_m6;
e_phi_im = e_phi_im_m6;
break;
case 1:
e_phi_re = e_phi_re_m5;
e_phi_im = e_phi_im_m5;
break;
case 2:
e_phi_re = e_phi_re_m4;
e_phi_im = e_phi_im_m4;
break;
case 3:
e_phi_re = e_phi_re_m3;
e_phi_im = e_phi_im_m3;
break;
case 4:
e_phi_re = e_phi_re_m2;
e_phi_im = e_phi_im_m2;
break;
case 5:
e_phi_re = e_phi_re_m1;
e_phi_im = e_phi_im_m1;
break;
case 6:
e_phi_re = e_phi_re_0;
e_phi_im = e_phi_im_0;
break;
case 7:
e_phi_re = e_phi_re_p1;
e_phi_im = e_phi_im_p1;
break;
case 8:
e_phi_re = e_phi_re_p2;
e_phi_im = e_phi_im_p2;
break;
case 9:
e_phi_re = e_phi_re_p3;
e_phi_im = e_phi_im_p3;
break;
case 10:
e_phi_re = e_phi_re_p4;
e_phi_im = e_phi_im_p4;
break;
case 11:
e_phi_re = e_phi_re_p5;
e_phi_im = e_phi_im_p5;
break;
}
//ul_sc_start = get_UL_sc_start_NB_IoT(I_sc); // NB-IoT: get the used subcarrier in RB
for (k=0;k<12;k++)
{
est_channel_re = estimated_channel[k<<1];
est_channel_im = estimated_channel[(k<<1)+1];
if (Qm == 1) // rotation due to pi/2 BPSK
{
est_channel_re2 = (int16_t)(((int32_t)pi_2_re[l%2] * (int32_t)est_channel_re +
(int32_t)pi_2_im[l%2] * (int32_t)est_channel_im)>>15);
est_channel_im2 = (int16_t)(((int32_t)pi_2_re[l%2] * (int32_t)est_channel_im -
(int32_t)pi_2_im[l%2] * (int32_t)est_channel_re)>>15);
}
if(Qm == 2) // rotation due to pi/4 QPSK
{
est_channel_re2 = (int16_t)(((int32_t)pi_4_re[l%2] * (int32_t)est_channel_re +
(int32_t)pi_4_im[l%2] * (int32_t)est_channel_im)>>15);
est_channel_im2 = (int16_t)(((int32_t)pi_4_re[l%2] * (int32_t)est_channel_im -
(int32_t)pi_4_im[l%2] * (int32_t)est_channel_re)>>15);
}
if(flag==0) // rotation of msg3
{
estimated_channel[k<<1] = (int16_t)(((int32_t)e_phi_re[14*(N_SF_per_word-counter_msg3) + l] * (int32_t)est_channel_re2 +
(int32_t)e_phi_im[14*(N_SF_per_word-counter_msg3) + l] * (int32_t)est_channel_im2)>>15);
estimated_channel[(k<<1)+1] = (int16_t)(((int32_t)e_phi_re[14*(N_SF_per_word-counter_msg3) + l] * (int32_t)est_channel_im2 -
(int32_t)e_phi_im[14*(N_SF_per_word-counter_msg3) + l] * (int32_t)est_channel_re2)>>15);
}
if(flag==1) // rotation of msg5
{
estimated_channel[k<<1] = (int16_t)(((int32_t)e_phi_re[14*(2-counter_msg3) + l] * (int32_t)est_channel_re2 +
(int32_t)e_phi_im[14*(2-counter_msg3) + l] * (int32_t)est_channel_im2)>>15);
estimated_channel[(k<<1)+1] = (int16_t)(((int32_t)e_phi_re[14*(2-counter_msg3) + l] * (int32_t)est_channel_im2 -
(int32_t)e_phi_im[14*(2-counter_msg3) + l] * (int32_t)est_channel_re2)>>15);
}
}
}
//////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////
///////////////// for ACK ////////////
int ul_chest_tmp_f2_NB_IoT(int32_t **rxdataF_ext,
......@@ -225,7 +340,7 @@ int ul_chest_tmp_f2_NB_IoT(int32_t **rxdataF_ext,
(int32_t)received_data[k<<1]*(int32_t)pilot_sig[(k<<1)+1])>>15); //imaginary part of estimated channel
}
/// Apply inverse rotation to the channel
rotate_channel_sc_tmp_NB_IoT(estimated_channel,symbol,Qm,counter_msg5,0,flag);
rotate_channel_sc_tmp_NB_IoT(estimated_channel,symbol,Qm,counter_msg5,0,ul_sc_start,flag);
ul_ch_estimates_re = estimated_channel[ul_sc_start<<1];
ul_ch_estimates_im = estimated_channel[(ul_sc_start<<1)+1];
......@@ -325,7 +440,7 @@ int ul_chest_tmp_NB_IoT(int32_t **rxdataF_ext,
(int32_t)received_data[k<<1]*(int32_t)pilot_sig[(k<<1)+1])>>15); //imaginary part of estimated channel
}
rotate_channel_sc_tmp_NB_IoT(estimated_channel,symbol,Qm,counter_msg3,N_SF_per_word,0); // 0 is used to indicate msg3
rotate_channel_sc_tmp_NB_IoT(estimated_channel,symbol,Qm,counter_msg3,N_SF_per_word,ul_sc_start,0); // 0 is used to indicate msg3
//printf("\n");
/*for (k=11;k<12;k++)
{
......
......@@ -45,8 +45,8 @@
uint16_t sequence_length[4] = {100,100,100,100}; //the "32" value corresponds to the max gold sequence length
// int16_t *ul_ref_sigs[30][33];
int16_t *ul_ref_sigs_f2_rx_NB_IoT[16]; //this table contain the 16 possible pilots for format 2 NPUSCH
int16_t *ul_ref_sigs_rx_NB_IoT[30][4]; //these contain the sequences in repeated format and quantized to QPSK ifdef IFFT_FPGA
int16_t *ul_ref_sigs_f2_rx_NB_IoT[16]; //this table contain the 16 possible pilots for format 2 NPUSCH
uint16_t u_max[4] = {16,12,14,30}; // maximum u value, see 36.211, Section 10.1.4
/* 36.211 table 5.5.1.2-1 */
......@@ -233,17 +233,18 @@ void generate_ul_ref_sigs_rx_NB_IoT(void)
{
unsigned int u,index_Nsc_RU,n,m; // Vincent: index_Nsc_RU 0,1,2,3 ---> number of sc 1,3,6,12
uint8_t npusch_format = 1; // NB-IoT: format 1 (data), or 2: ack. Should be defined in higher layer
//uint8_t npusch_format = 1; // NB-IoT: format 1 (data), or 2: ack. Should be defined in higher layer
int16_t a;
int16_t qpsk[2];
unsigned int x1, x2=35; // NB-IoT: defined in 36.211, Section 10.1.4.1.1
int16_t ref_sigs_sc1[2*sequence_length[0]];
unsigned int x1, x2; // NB-IoT: defined in 36.211, Section 10.1.4.1.1
int16_t ref_sigs_sc1[2*sequence_length[0]]; // this is for format 1
//int16_t ref_sigs_sc1_f2[2*sequence_length[0]]; // this is for format 2
uint32_t s;
a = ONE_OVER_SQRT2_Q15_NB_IoT;
qpsk[0] = a;
qpsk[1] = -a;
s = lte_gold_generic_NB_IoT(&x1, &x2, 1);
//printf("\n\n\n in generate_ul_ref_sigs_rx_NB_IoT %d \n\n\n",a);
for (index_Nsc_RU=0; index_Nsc_RU<4; index_Nsc_RU++)
{
......@@ -253,33 +254,36 @@ void generate_ul_ref_sigs_rx_NB_IoT(void)
switch (index_Nsc_RU)
{
case 0: // 36.211, Section 10.1.4.1.1
x2=35;
s = lte_gold_generic_NB_IoT(&x1, &x2, 1);
ul_ref_sigs_rx_NB_IoT[u][index_Nsc_RU] = (int16_t*)malloc(sizeof(int16_t)*(2*sequence_length[index_Nsc_RU]*12+24)); // *12 is mandatory to fit channel estimation functions
ul_ref_sigs_f2_rx_NB_IoT[u] = (int16_t*)malloc(sizeof(int16_t)*(2*12*12+24)); // first "*12" is mandatory to fit channel estimation functions; first "*12" is the length of pilot sequence for
ul_ref_sigs_f2_rx_NB_IoT[u] = (int16_t*)malloc(sizeof(int16_t)*(2*12*12+24)); // first "*12" is mandatory to fit channel estimation functions; first "*12" is the length of pilot sequence for format 2
// NB-IoT: for same reason, +24 is added in order to fit the possible subcarrier start shift when index_Nsc_RU = 0, 1, 2 --> see ul_sc_start in channel estimation function
for (n=0; n<sequence_length[index_Nsc_RU]; n++) {
if (n>0 && n%32==0)
for (n=0; n<sequence_length[index_Nsc_RU]; n++)
{
s = lte_gold_generic_NB_IoT(&x1, &x2, 0);
}
ref_sigs_sc1[n<<1] = qpsk[(s>>(n%32))&1]*w_n[16*u+n%16];
// ref_sigs_sc1[1+(n<<1)] = qpsk[(s>>n)&1]*w_n[16*u+n%16];
ref_sigs_sc1[1+(n<<1)] = ref_sigs_sc1[n<<1];
if (n>0 && n%32==0)
{
s = lte_gold_generic_NB_IoT(&x1, &x2, 0);
}
ref_sigs_sc1[n<<1] = qpsk[(s>>(n%32))&1]*w_n[16*u+n%16];
// ref_sigs_sc1[1+(n<<1)] = qpsk[(s>>n)&1]*w_n[16*u+n%16];
ref_sigs_sc1[1+(n<<1)] = ref_sigs_sc1[n<<1];
}
for (n=0; n<sequence_length[index_Nsc_RU]; n++) {
ul_ref_sigs_rx_NB_IoT[u][index_Nsc_RU][12*(n<<1)+24] = ref_sigs_sc1[n<<1]; // ul_ref_sigs_rx_NB_IoT is filled every 12 RE, real part
ul_ref_sigs_rx_NB_IoT[u][index_Nsc_RU][1+12*(n<<1)+24]= ref_sigs_sc1[1+(n<<1)]; // ul_ref_sigs_rx_NB_IoT is filled every 12 RE, imaginary part
}
for (n=0; n<sequence_length[index_Nsc_RU]; n++)
{
ul_ref_sigs_rx_NB_IoT[u][index_Nsc_RU][12*(n<<1)+24] = ref_sigs_sc1[n<<1]; // ul_ref_sigs_rx_NB_IoT is filled every 12 RE, real part
ul_ref_sigs_rx_NB_IoT[u][index_Nsc_RU][1+12*(n<<1)+24]= ref_sigs_sc1[1+(n<<1)]; // ul_ref_sigs_rx_NB_IoT is filled every 12 RE, imaginary part
}
for (n=0; n<4; n++)
{
for (m=0; m<3; m++)
{
ul_ref_sigs_f2_rx_NB_IoT[u][12*((3*n+m)<<1)+24] = ref_sigs_sc1[n<<1]; // ul_ref_sigs_rx_NB_IoT is filled every 12 RE, real part
ul_ref_sigs_f2_rx_NB_IoT[u][1+12*((3*n+m)<<1)+24] = ref_sigs_sc1[1+(n<<1)]; // ul_ref_sigs_rx_NB_IoT is filled every 12 RE, imaginary part
{
for (m=0; m<3; m++)
{
ul_ref_sigs_f2_rx_NB_IoT[u][12*((3*n+m)<<1)+24] = ref_sigs_sc1[n<<1]; // ul_ref_sigs_rx_NB_IoT is filled every 12 RE, real part
ul_ref_sigs_f2_rx_NB_IoT[u][1+12*((3*n+m)<<1)+24] = ref_sigs_sc1[1+(n<<1)]; // ul_ref_sigs_rx_NB_IoT is filled every 12 RE, imaginary part
}
}
}
break;
}
......
......@@ -115,6 +115,14 @@ int generate_NDLSCH_NB_IoT(NB_IoT_eNB_NDLSCH_t *RAR,
uint32_t subframe,
int RB_IoT_ID);
int generate_NPDCCH_NB_IoT(NB_IoT_eNB_NPDCCH_t *DCI,
int32_t **txdataF,
int16_t amp,
LTE_DL_FRAME_PARMS *frame_parms,
uint32_t frame,
uint32_t subframe,
int RB_IoT_ID);
int generate_SIB23(NB_IoT_eNB_NDLSCH_t *SIB23,
int32_t **txdataF,
int16_t amp,
......@@ -560,6 +568,7 @@ void rotate_channel_sc_tmp_NB_IoT(int16_t *estimated_channel,
uint8_t Qm,
uint8_t counter_msg3,
uint16_t N_SF_per_word,
uint16_t ul_sc_start,
uint8_t flag);
int ul_chequal_tmp_NB_IoT(int32_t **rxdataF_ext,
......
This diff is collapsed.
......@@ -39,6 +39,9 @@
//#define DEBUG_ULSCH
//#include "PHY/sse_intrin.h"
#include "PHY/LTE_ESTIMATION/defs_NB_IoT.h"
#include "openair1/SCHED/defs_NB_IoT.h"
#include "T.h"
//extern char* namepointer_chMag ;
......
......@@ -527,7 +527,6 @@ int is_srs_occasion_common(LTE_DL_FRAME_PARMS *frame_parms,int frame_tx,int subf
void compute_srs_pos(lte_frame_type_t frameType,uint16_t isrs,uint16_t *psrsPeriodicity,uint16_t *psrsOffset);
void fill_crc_indication_NB_IoT(PHY_VARS_eNB *eNB,int UE_id,int frame,int subframe,uint8_t crc_flag);
/*@}*/
......
......@@ -55,6 +55,8 @@ void npusch_procedures(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc);
////////////////// NB-IoT testing ////////////////////
void fill_rx_indication_NB_IoT(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,uint8_t data_or_control, uint8_t msg3_flag);
void fill_crc_indication_NB_IoT(PHY_VARS_eNB *eNB,int UE_id,int frame,int subframe,uint8_t crc_flag);
#endif
......@@ -3192,6 +3192,7 @@ void phy_procedures_eNB_common_RX(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc){
///VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_ENB_RX_COMMON+offset, 0 );
}
/*
void fill_rx_indication_NB_IoT(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,uint8_t data_or_control, uint8_t msg3_flag)
{
nfapi_rx_indication_pdu_t *pdu;
......@@ -3232,7 +3233,7 @@ void fill_rx_indication_NB_IoT(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,uint8_t d
pthread_mutex_unlock(&eNB->UL_INFO_mutex);
}
*/
void phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,const relaying_type_t r_type)
{
......
......@@ -1573,6 +1573,48 @@ void fill_crc_indication_NB_IoT(PHY_VARS_eNB *eNB,int UE_id,int frame,int subfra
pthread_mutex_unlock(&eNB->UL_INFO_mutex);
}
void fill_rx_indication_NB_IoT(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,uint8_t data_or_control, uint8_t msg3_flag)
{
nfapi_rx_indication_pdu_t *pdu;
pthread_mutex_lock(&eNB->UL_INFO_mutex);
eNB->UL_INFO.RX_NPUSCH.number_of_pdus = 1;
//eNB->UL_INFO.RX_NPUSCH.rx_pdu_list.rx_ue_information.tl.tag = NFAPI_RX_INDICATION_BODY_TAG; // do we need this ??
//eNB->UL_INFO.RX_NPUSCH.rx_pdu_list.rx_ue_information.rnti = rnti; // rnti should be got from eNB structure
//pdu = &eNB->UL_INFO.RX_NPUSCH.rx_pdu_list[eNB->UL_INFO.rx_ind.rx_indication_body.number_of_pdus];
pdu = &eNB->UL_INFO.RX_NPUSCH.rx_pdu_list[0];
// pdu->rx_ue_information.handle = eNB->ulsch[UE_id]->handle;
// pdu->rx_ue_information.tl.tag = NFAPI_RX_UE_INFORMATION_TAG;
//pdu->rx_indication_rel8.tl.tag = NFAPI_RX_INDICATION_REL8_TAG;
pdu->rx_ue_information.rnti = eNB->ulsch_NB_IoT[0]->rnti;
if(msg3_flag == 1)
{
pdu->rx_indication_rel8.length = 6; //eNB->ulsch_NB_IoT[0]->harq_process->TBS>>3;
int m =0;
for(m=0; m<6;m++)
{
pdu->data[m] = eNB->ulsch_NB_IoT[0]->harq_process->b[2+m];
printf(" pdu content = %d \n", eNB->ulsch_NB_IoT[0]->harq_process->b[2+m]);
}
} else {
pdu->data = eNB->ulsch_NB_IoT[0]->harq_process->b;
}
//pdu->data = eNB->ulsch_NB_IoT[UE_id]->harq_processes[harq_pid]->b;
//eNB->UL_INFO.rx_ind.rx_indication_body.number_of_pdus++;
//eNB->UL_INFO.rx_ind.sfn_sf = frame<<4 | subframe;
// do we need to transmit timing ?? however, the nfapi structure does not include timing paramters !!!!!
pthread_mutex_unlock(&eNB->UL_INFO_mutex);
}
void npusch_procedures(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc)
{
......
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