Commit 2045a493 authored by Cedric Roux's avatar Cedric Roux
Browse files

Merge branch 'develop_integration_w03' into 'develop'

Develop integration w03

See merge request !89
parents dec41a2a 101d28e9
...@@ -554,6 +554,8 @@ elseif (${RF_BOARD} STREQUAL "OAI_BLADERF") ...@@ -554,6 +554,8 @@ elseif (${RF_BOARD} STREQUAL "OAI_BLADERF")
elseif (${RF_BOARD} STREQUAL "OAI_LMSSDR") elseif (${RF_BOARD} STREQUAL "OAI_LMSSDR")
include_directories("${OPENAIR_TARGETS}/ARCH/LMSSDR/USERSPACE/LIB") include_directories("${OPENAIR_TARGETS}/ARCH/LMSSDR/USERSPACE/LIB")
include_directories("/usr/local/include/lime")
include_directories("/usr/include/lime")
LINK_DIRECTORIES("/usr/lib/x86_64-linux-gnu") LINK_DIRECTORIES("/usr/lib/x86_64-linux-gnu")
LINK_DIRECTORIES("${CMAKE_CURRENT_BINARY_DIR}/lmsSDR") LINK_DIRECTORIES("${CMAKE_CURRENT_BINARY_DIR}/lmsSDR")
LINK_DIRECTORIES("${CMAKE_CURRENT_BINARY_DIR}/lms7002m") LINK_DIRECTORIES("${CMAKE_CURRENT_BINARY_DIR}/lms7002m")
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
#include "LAYER2/MAC/extern.h" #include "LAYER2/MAC/extern.h"
#include "MBSFN-SubframeConfigList.h" #include "MBSFN-SubframeConfigList.h"
#include "UTIL/LOG/vcd_signal_dumper.h" #include "UTIL/LOG/vcd_signal_dumper.h"
//#define DEBUG_PHY #define DEBUG_PHY
#include "assertions.h" #include "assertions.h"
#include <math.h> #include <math.h>
...@@ -684,6 +684,7 @@ void phy_config_dedicated_eNB(uint8_t Mod_id, ...@@ -684,6 +684,7 @@ void phy_config_dedicated_eNB(uint8_t Mod_id,
break; break;
case AntennaInfoDedicated__transmissionMode_tm7: case AntennaInfoDedicated__transmissionMode_tm7:
lte_gold_ue_spec_port5(eNB->lte_gold_uespec_port5_table[0],eNB->frame_parms.Nid_cell,rnti); lte_gold_ue_spec_port5(eNB->lte_gold_uespec_port5_table[0],eNB->frame_parms.Nid_cell,rnti);
eNB->do_precoding = 1;
eNB->transmission_mode[UE_id] = 7; eNB->transmission_mode[UE_id] = 7;
break; break;
default: default:
...@@ -1304,49 +1305,54 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB, ...@@ -1304,49 +1305,54 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB,
common_vars->txdataF[eNB_id] = (int32_t **)malloc16(NB_ANTENNA_PORTS_ENB*sizeof(int32_t*)); common_vars->txdataF[eNB_id] = (int32_t **)malloc16(NB_ANTENNA_PORTS_ENB*sizeof(int32_t*));
common_vars->txdataF_BF[eNB_id] = (int32_t **)malloc16(fp->nb_antennas_tx*sizeof(int32_t*)); common_vars->txdataF_BF[eNB_id] = (int32_t **)malloc16(fp->nb_antennas_tx*sizeof(int32_t*));
for (i=0; i<14; i++) { if (eNB->node_function != NGFI_RRU_IF5) {
common_vars->txdataF[eNB_id][i] = (int32_t*)malloc16_clear(fp->ofdm_symbol_size*fp->symbols_per_tti*10*sizeof(int32_t) ); for (i=0; i<NB_ANTENNA_PORTS_ENB; i++) {
if (i<fp->nb_antenna_ports_eNB || i==5) {
common_vars->txdataF[eNB_id][i] = (int32_t*)malloc16_clear(fp->ofdm_symbol_size*fp->symbols_per_tti*10*sizeof(int32_t) );
#ifdef DEBUG_PHY #ifdef DEBUG_PHY
msg("[openair][LTE_PHY][INIT] lte_common_vars->txdataF[%d][%d] = %p (%d bytes)\n", printf("[openair][LTE_PHY][INIT] common_vars->txdataF[%d][%d] = %p (%lu bytes)\n",
eNB_id,i,common_vars->txdataF[eNB_id][i], eNB_id,i,common_vars->txdataF[eNB_id][i],
fp->ofdm_symbol_size*fp->symbols_per_tti*10*sizeof(int32_t)); fp->ofdm_symbol_size*fp->symbols_per_tti*10*sizeof(int32_t));
#endif #endif
}
}
} }
for (i=0; i<fp->nb_antennas_tx; i++) { for (i=0; i<fp->nb_antennas_tx; i++) {
common_vars->txdataF_BF[eNB_id][i] = (int32_t*)malloc16_clear(fp->ofdm_symbol_size*sizeof(int32_t) ); common_vars->txdataF_BF[eNB_id][i] = (int32_t*)malloc16_clear(fp->ofdm_symbol_size*sizeof(int32_t) );
if (eNB->node_function != NGFI_RCC_IF4p5) if (eNB->node_function != NGFI_RCC_IF4p5)
common_vars->txdata[eNB_id][i] = (int32_t*)malloc16_clear(fp->samples_per_tti*10*sizeof(int32_t) );
// Allocate 10 subframes of I/Q TX signal data (time) if not
common_vars->txdata[eNB_id][i] = (int32_t*)malloc16_clear( fp->samples_per_tti*10*sizeof(int32_t) );
#ifdef DEBUG_PHY #ifdef DEBUG_PHY
msg("[openair][LTE_PHY][INIT] lte_common_vars->txdataF_BF[%d][%d] = %p (%d bytes)\n", printf("[openair][LTE_PHY][INIT] common_vars->txdata[%d][%d] = %p (%lu bytes)\n",eNB_id,i,common_vars->txdata[eNB_id][i],
eNB_id,i,common_vars->txdataF_BF[eNB_id][i], fp->samples_per_tti*10*sizeof(int32_t));
fp->ofdm_symbol_size*sizeof(int32_t));
msg("[openair][LTE_PHY][INIT] lte_common_vars->txdata[%d][%d] = %p\n",eNB_id,i,common_vars->txdata[eNB_id][i]);
#endif #endif
} }
for (i=0; i<14; i++) { // 14 is the total number of antenna ports for (i=0; i<NB_ANTENNA_PORTS_ENB; i++) {
common_vars->beam_weights[eNB_id][i] = (int32_t **)malloc16_clear(fp->nb_antennas_tx*sizeof(int32_t*)); if (i<fp->nb_antenna_ports_eNB || i==5) {
for (j=0; j<fp->nb_antennas_tx; j++) { common_vars->beam_weights[eNB_id][i] = (int32_t **)malloc16_clear(fp->nb_antennas_tx*sizeof(int32_t*));
common_vars->beam_weights[eNB_id][i][j] = (int32_t *)malloc16_clear(fp->ofdm_symbol_size*sizeof(int32_t)); for (j=0; j<fp->nb_antennas_tx; j++) {
// antenna ports 0-3 are mapped on antennas 0-3 common_vars->beam_weights[eNB_id][i][j] = (int32_t *)malloc16_clear(fp->ofdm_symbol_size*sizeof(int32_t));
// antenna port 4 is mapped on antenna 0 // antenna ports 0-3 are mapped on antennas 0-3
// antenna ports 5-14 are mapped on all antennas // antenna port 4 is mapped on antenna 0
if (((i<4) && (i==j)) || ((i==4) && (j==0))) { // antenna ports 5-14 are mapped on all antennas
for (re=0; re<fp->ofdm_symbol_size; re++) if (((i<4) && (i==j)) || ((i==4) && (j==0))) {
common_vars->beam_weights[eNB_id][i][j][re] = 0x00007fff; for (re=0; re<fp->ofdm_symbol_size; re++)
} common_vars->beam_weights[eNB_id][i][j][re] = 0x00007fff;
else if (i>4) { }
for (re=0; re<fp->ofdm_symbol_size; re++) else if (i>4) {
common_vars->beam_weights[eNB_id][i][j][re] = 0x00007fff/fp->nb_antennas_tx; for (re=0; re<fp->ofdm_symbol_size; re++)
} common_vars->beam_weights[eNB_id][i][j][re] = 0x00007fff/fp->nb_antennas_tx;
}
#ifdef DEBUG_PHY #ifdef DEBUG_PHY
msg("[openair][LTE_PHY][INIT] lte_common_vars->beam_weights[%d][%d][%d] = %p (%d bytes)\n", msg("[openair][LTE_PHY][INIT] lte_common_vars->beam_weights[%d][%d][%d] = %p (%d bytes)\n",
eNB_id,i,j,common_vars->beam_weights[eNB_id][i][j], eNB_id,i,j,common_vars->beam_weights[eNB_id][i][j],
fp->ofdm_symbol_size*sizeof(int32_t)); fp->ofdm_symbol_size*sizeof(int32_t));
#endif #endif
} }
}
} }
// RX vars // RX vars
...@@ -1358,17 +1364,25 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB, ...@@ -1358,17 +1364,25 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB,
for (i=0; i<fp->nb_antennas_rx; i++) { for (i=0; i<fp->nb_antennas_rx; i++) {
if (eNB->node_function != NGFI_RCC_IF4p5) { if (eNB->node_function != NGFI_RCC_IF4p5) {
// allocate 2 subframes of I/Q signal data (time) if not an RCC (no time-domain signals)
common_vars->rxdata[eNB_id][i] = (int32_t*)malloc16_clear( fp->samples_per_tti*10*sizeof(int32_t) ); common_vars->rxdata[eNB_id][i] = (int32_t*)malloc16_clear( fp->samples_per_tti*10*sizeof(int32_t) );
common_vars->rxdata_7_5kHz[eNB_id][i] = (int32_t*)malloc16_clear( fp->samples_per_tti*sizeof(int32_t) );
if (eNB->node_function != NGFI_RRU_IF5)
// allocate 2 subframes of I/Q signal data (time, 7.5 kHz offset)
common_vars->rxdata_7_5kHz[eNB_id][i] = (int32_t*)malloc16_clear( 2*fp->samples_per_tti*2*sizeof(int32_t) );
}
if (eNB->node_function != NGFI_RRU_IF5)
// allocate 2 subframes of I/Q signal data (frequency)
common_vars->rxdataF[eNB_id][i] = (int32_t*)malloc16_clear(sizeof(int32_t)*(2*fp->ofdm_symbol_size*fp->symbols_per_tti) );
#ifdef DEBUG_PHY #ifdef DEBUG_PHY
printf("[openair][LTE_PHY][INIT] common_vars->rxdata[%d][%d] = %p\n",eNB_id,i,common_vars->rxdata[eNB_id][i]); printf("[openair][LTE_PHY][INIT] common_vars->rxdata[%d][%d] = %p (%lu bytes)\n",eNB_id,i,common_vars->rxdata[eNB_id][i],fp->samples_per_tti*10*sizeof(int32_t));
printf("[openair][LTE_PHY][INIT] common_vars->rxdata_7_5kHz[%d][%d] = %p\n",eNB_id,i,common_vars->rxdata_7_5kHz[eNB_id][i]); if (eNB->node_function != NGFI_RRU_IF5)
printf("[openair][LTE_PHY][INIT] common_vars->rxdata_7_5kHz[%d][%d] = %p (%lu bytes)\n",eNB_id,i,common_vars->rxdata_7_5kHz[eNB_id][i],fp->samples_per_tti*2*sizeof(int32_t));
#endif #endif
}
common_vars->rxdataF[eNB_id][i] = (int32_t*)malloc16_clear(sizeof(int32_t)*(fp->ofdm_symbol_size*fp->symbols_per_tti) ); common_vars->rxdataF[eNB_id][i] = (int32_t*)malloc16_clear(sizeof(int32_t)*(fp->ofdm_symbol_size*fp->symbols_per_tti) );
} }
if (eNB->node_function != NGFI_RRU_IF4p5) { if ((eNB->node_function != NGFI_RRU_IF4p5)&&(eNB->node_function != NGFI_RRU_IF5)) {
// Channel estimates for SRS // Channel estimates for SRS
for (UE_id=0; UE_id<NUMBER_OF_UE_MAX; UE_id++) { for (UE_id=0; UE_id<NUMBER_OF_UE_MAX; UE_id++) {
...@@ -1383,7 +1397,8 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB, ...@@ -1383,7 +1397,8 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB,
common_vars->sync_corr[eNB_id] = (uint32_t*)malloc16_clear( LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*sizeof(uint32_t)*fp->samples_per_tti ); common_vars->sync_corr[eNB_id] = (uint32_t*)malloc16_clear( LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*sizeof(uint32_t)*fp->samples_per_tti );
} }
} else { //UPLINK abstraction = 1 } // abstraction_flag = 0
else { //UPLINK abstraction = 1
eNB->sinr_dB = (double*) malloc16_clear( fp->N_RB_DL*12*sizeof(double) ); eNB->sinr_dB = (double*) malloc16_clear( fp->N_RB_DL*12*sizeof(double) );
} }
} //eNB_id } //eNB_id
...@@ -1391,7 +1406,7 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB, ...@@ -1391,7 +1406,7 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB,
if (abstraction_flag==0) { if (abstraction_flag==0) {
if (eNB->node_function != NGFI_RRU_IF4p5) { if ((eNB->node_function != NGFI_RRU_IF4p5)&&(eNB->node_function != NGFI_RRU_IF5)) {
generate_ul_ref_sigs_rx(); generate_ul_ref_sigs_rx();
// SRS // SRS
...@@ -1405,7 +1420,7 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB, ...@@ -1405,7 +1420,7 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB,
// ULSCH VARS, skip if NFGI_RRU_IF4 // ULSCH VARS, skip if NFGI_RRU_IF4
if (eNB->node_function!=NGFI_RRU_IF4p5) if ((eNB->node_function!=NGFI_RRU_IF4p5)&&(eNB->node_function != NGFI_RRU_IF5))
prach_vars->prachF = (int16_t*)malloc16_clear( 1024*2*sizeof(int16_t) ); prach_vars->prachF = (int16_t*)malloc16_clear( 1024*2*sizeof(int16_t) );
/* number of elements of an array X is computed as sizeof(X) / sizeof(X[0]) */ /* number of elements of an array X is computed as sizeof(X) / sizeof(X[0]) */
...@@ -1418,7 +1433,7 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB, ...@@ -1418,7 +1433,7 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB,
#endif #endif
} }
if (eNB->node_function != NGFI_RRU_IF4p5) { if ((eNB->node_function != NGFI_RRU_IF4p5)&&(eNB->node_function != NGFI_RRU_IF5)) {
AssertFatal(fp->nb_antennas_rx <= sizeof(prach_vars->prach_ifft) / sizeof(prach_vars->prach_ifft[0]), AssertFatal(fp->nb_antennas_rx <= sizeof(prach_vars->prach_ifft) / sizeof(prach_vars->prach_ifft[0]),
"nb_antennas_rx too large"); "nb_antennas_rx too large");
for (i=0; i<fp->nb_antennas_rx; i++) { for (i=0; i<fp->nb_antennas_rx; i++) {
......
...@@ -22,6 +22,23 @@ ...@@ -22,6 +22,23 @@
#include "defs.h" #include "defs.h"
#include "log.h" #include "log.h"
uint16_t dl_S_table_normal[10]={3,9,10,11,12,3,9,10,11,6};
uint16_t dl_S_table_extended[10]={3,8,9,10,3,8,9,5,0,0};
void set_S_config(LTE_DL_FRAME_PARMS *fp) {
int X = fp->srsX;
fp->ul_symbols_in_S_subframe=(1+X);
if ((fp->Ncp==EXTENDED) && (fp->tdd_config_S>7))
AssertFatal(1==0,"Illegal S subframe configuration for Extended Prefix mode\n");
fp->dl_symbols_in_S_subframe = (fp->Ncp==NORMAL)?dl_S_table_normal[fp->tdd_config_S] : dl_S_table_extended[fp->tdd_config_S];
}
int init_frame_parms(LTE_DL_FRAME_PARMS *frame_parms,uint8_t osf) int init_frame_parms(LTE_DL_FRAME_PARMS *frame_parms,uint8_t osf)
{ {
...@@ -29,7 +46,7 @@ int init_frame_parms(LTE_DL_FRAME_PARMS *frame_parms,uint8_t osf) ...@@ -29,7 +46,7 @@ int init_frame_parms(LTE_DL_FRAME_PARMS *frame_parms,uint8_t osf)
LOG_I(PHY,"Initializing frame parms for N_RB_DL %d, Ncp %d, osf %d\n",frame_parms->N_RB_DL,frame_parms->Ncp,osf); LOG_I(PHY,"Initializing frame parms for N_RB_DL %d, Ncp %d, osf %d\n",frame_parms->N_RB_DL,frame_parms->Ncp,osf);
if (frame_parms->Ncp==1) { if (frame_parms->Ncp==EXTENDED) {
frame_parms->nb_prefix_samples0=512; frame_parms->nb_prefix_samples0=512;
frame_parms->nb_prefix_samples = 512; frame_parms->nb_prefix_samples = 512;
frame_parms->symbols_per_tti = 12; frame_parms->symbols_per_tti = 12;
...@@ -37,8 +54,10 @@ int init_frame_parms(LTE_DL_FRAME_PARMS *frame_parms,uint8_t osf) ...@@ -37,8 +54,10 @@ int init_frame_parms(LTE_DL_FRAME_PARMS *frame_parms,uint8_t osf)
frame_parms->nb_prefix_samples0 = 160; frame_parms->nb_prefix_samples0 = 160;
frame_parms->nb_prefix_samples = 144; frame_parms->nb_prefix_samples = 144;
frame_parms->symbols_per_tti = 14; frame_parms->symbols_per_tti = 14;
} }
switch(osf) { switch(osf) {
case 1: case 1:
log2_osf = 0; log2_osf = 0;
...@@ -167,6 +186,8 @@ int init_frame_parms(LTE_DL_FRAME_PARMS *frame_parms,uint8_t osf) ...@@ -167,6 +186,8 @@ int init_frame_parms(LTE_DL_FRAME_PARMS *frame_parms,uint8_t osf)
printf("lte_parms.c: Setting N_RB_DL to %d, ofdm_symbol_size %d\n",frame_parms->N_RB_DL, frame_parms->ofdm_symbol_size); printf("lte_parms.c: Setting N_RB_DL to %d, ofdm_symbol_size %d\n",frame_parms->N_RB_DL, frame_parms->ofdm_symbol_size);
if (frame_parms->frame_type == TDD) set_S_config(frame_parms);
// frame_parms->tdd_config=3; // frame_parms->tdd_config=3;
return(0); return(0);
} }
......
...@@ -510,14 +510,15 @@ int lte_sync_time_eNB(int32_t **rxdata, ///rx data in time domain ...@@ -510,14 +510,15 @@ int lte_sync_time_eNB(int32_t **rxdata, ///rx data in time domain
// perform a time domain correlation using the oversampled sync sequence // perform a time domain correlation using the oversampled sync sequence
unsigned int n, ar, peak_val, peak_pos, mean_val; unsigned int n, ar, peak_val, peak_pos;
uint64_t mean_val;
int result; int result;
short *primary_synch_time; short *primary_synch_time;
int eNB_id = frame_parms->Nid_cell%3; int eNB_id = frame_parms->Nid_cell%3;
// msg("[SYNC TIME] Calling sync_time_eNB(%p,%p,%d,%d)\n",rxdata,frame_parms,eNB_id,length); // msg("[SYNC TIME] Calling sync_time_eNB(%p,%p,%d,%d)\n",rxdata,frame_parms,eNB_id,length);
if (sync_corr_eNB == NULL) { if (sync_corr_eNB == NULL) {
msg("[SYNC TIME] sync_corr_eNB not yet allocated! Exiting.\n"); LOG_E(PHY,"[SYNC TIME] sync_corr_eNB not yet allocated! Exiting.\n");
return(-1); return(-1);
} }
...@@ -535,7 +536,7 @@ int lte_sync_time_eNB(int32_t **rxdata, ///rx data in time domain ...@@ -535,7 +536,7 @@ int lte_sync_time_eNB(int32_t **rxdata, ///rx data in time domain
break; break;
default: default:
msg("[SYNC TIME] Illegal eNB_id!\n"); LOG_E(PHY,"[SYNC TIME] Illegal eNB_id!\n");
return (-1); return (-1);
} }
...@@ -567,7 +568,7 @@ int lte_sync_time_eNB(int32_t **rxdata, ///rx data in time domain ...@@ -567,7 +568,7 @@ int lte_sync_time_eNB(int32_t **rxdata, ///rx data in time domain
peak_val); peak_val);
} }
*/ */
mean_val += (sync_corr_eNB[n]>>10); mean_val += sync_corr_eNB[n];
if (sync_corr_eNB[n]>peak_val) { if (sync_corr_eNB[n]>peak_val) {
peak_val = sync_corr_eNB[n]; peak_val = sync_corr_eNB[n];
...@@ -575,17 +576,15 @@ int lte_sync_time_eNB(int32_t **rxdata, ///rx data in time domain ...@@ -575,17 +576,15 @@ int lte_sync_time_eNB(int32_t **rxdata, ///rx data in time domain
} }
} }
mean_val/=length;
*peak_val_out = peak_val; *peak_val_out = peak_val;
if (peak_val <= (40*mean_val)) { if (peak_val <= (40*(uint32_t)mean_val)) {
#ifdef DEBUG_PHY LOG_D(PHY,"[SYNC TIME] No peak found (%u,%u,%u,%u)\n",peak_pos,peak_val,mean_val,40*mean_val);
msg("[SYNC TIME] No peak found (%u,%u,%u,%u)\n",peak_pos,peak_val,mean_val,40*mean_val);
#endif
return(-1); return(-1);
} else { } else {
#ifdef DEBUG_PHY LOG_D(PHY,"[SYNC TIME] Peak found at pos %u, val = %u, mean_val = %u\n",peak_pos,peak_val,mean_val);
msg("[SYNC TIME] Peak found at pos %u, val = %u, mean_val = %u\n",peak_pos,peak_val,mean_val);
#endif
return(peak_pos); return(peak_pos);
} }
......
...@@ -720,10 +720,11 @@ int32_t lte_srs_channel_estimation(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -720,10 +720,11 @@ int32_t lte_srs_channel_estimation(LTE_DL_FRAME_PARMS *frame_parms,
//write_output("eNB_srs.m","srs_eNB",common_vars->srs,(frame_parms->ofdm_symbol_size),1,1); //write_output("eNB_srs.m","srs_eNB",common_vars->srs,(frame_parms->ofdm_symbol_size),1,1);
mult_cpx_conj_vector((int16_t*) &common_vars->rxdataF[eNB_id][aa][2*frame_parms->ofdm_symbol_size*symbol], mult_cpx_conj_vector((int16_t*) &common_vars->rxdataF[eNB_id][aa][2*frame_parms->ofdm_symbol_size*symbol],
(int16_t*) srs_vars->srs, (int16_t*) srs_vars->srs,
(int16_t*) srs_vars->srs_ch_estimates[eNB_id][aa], (int16_t*) srs_vars->srs_ch_estimates[eNB_id][aa],
frame_parms->ofdm_symbol_size, frame_parms->ofdm_symbol_size,
15); 15,
0);
//msg("SRS channel estimation cmult out\n"); //msg("SRS channel estimation cmult out\n");
#ifdef USER_MODE #ifdef USER_MODE
......
...@@ -32,16 +32,20 @@ ...@@ -32,16 +32,20 @@
#include "PHY/defs.h" #include "PHY/defs.h"
#include "PHY/TOOLS/alaw_lut.h" #include "PHY/TOOLS/alaw_lut.h"
#include "PHY/extern.h"
#include "SCHED/defs.h"
#include "targets/ARCH/ETHERNET/USERSPACE/LIB/if_defs.h" //#include "targets/ARCH/ETHERNET/USERSPACE/LIB/if_defs.h"
#include "targets/ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.h"
#include "UTIL/LOG/vcd_signal_dumper.h" #include "UTIL/LOG/vcd_signal_dumper.h"
void send_IF4p5(PHY_VARS_eNB *eNB, int frame, int subframe, uint16_t packet_type, int k) { void send_IF4p5(PHY_VARS_eNB *eNB, int frame, int subframe, uint16_t packet_type, int k) {
LTE_DL_FRAME_PARMS *fp = &eNB->frame_parms; LTE_DL_FRAME_PARMS *fp = &eNB->frame_parms;
int32_t **txdataF = eNB->common_vars.txdataF[0]; int32_t **txdataF = (eNB->CC_id==0) ? eNB->common_vars.txdataF[0] : PHY_vars_eNB_g[0][0]->common_vars.txdataF[0];
int32_t **rxdataF = eNB->common_vars.rxdataF[0]; int32_t **rxdataF = eNB->common_vars.rxdataF[0];
int16_t **rxsigF = eNB->prach_vars.rxsigF; int16_t **rxsigF = eNB->prach_vars.rxsigF;
void *tx_buffer = eNB->ifbuffer.tx; void *tx_buffer = eNB->ifbuffer.tx[subframe&1];
void *tx_buffer_prach = eNB->ifbuffer.tx_prach;
uint16_t symbol_id=0, element_id=0; uint16_t symbol_id=0, element_id=0;
uint16_t db_fulllength, db_halflength; uint16_t db_fulllength, db_halflength;
...@@ -49,31 +53,44 @@ void send_IF4p5(PHY_VARS_eNB *eNB, int frame, int subframe, uint16_t packet_type ...@@ -49,31 +53,44 @@ void send_IF4p5(PHY_VARS_eNB *eNB, int frame, int subframe, uint16_t packet_type
uint16_t *data_block=NULL, *i=NULL; uint16_t *data_block=NULL, *i=NULL;
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_SEND_IF4, 1 ); IF4p5_header_t *packet_header=NULL;
eth_state_t *eth = (eth_state_t*) (eNB->ifdevice.priv);
int nsym = fp->symbols_per_tti;
if (eNB->CC_id==0) VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_SEND_IF4, 1 );
if (packet_type == IF4p5_PDLFFT) { if (packet_type == IF4p5_PDLFFT) {
if (subframe_select(fp,subframe)==SF_S)
nsym=fp->dl_symbols_in_S_subframe;
db_fulllength = 12*fp->N_RB_DL; db_fulllength = 12*fp->N_RB_DL;
db_halflength = (db_fulllength)>>1; db_halflength = (db_fulllength)>>1;
slotoffsetF = (subframe)*(fp->ofdm_symbol_size)*((fp->Ncp==1) ? 12 : 14) + 1; slotoffsetF = (subframe)*(fp->ofdm_symbol_size)*((fp->Ncp==1) ? 12 : 14) + 1;
blockoffsetF = slotoffsetF + fp->ofdm_symbol_size - db_halflength - 1; blockoffsetF = slotoffsetF + fp->ofdm_symbol_size - db_halflength - 1;
IF4p5_header_t *dl_header = (IF4p5_header_t *)(tx_buffer + MAC_HEADER_SIZE_BYTES);
data_block = (uint16_t*)(tx_buffer + MAC_HEADER_SIZE_BYTES + sizeof_IF4p5_header_t);
gen_IF4p5_dl_header(dl_header, frame, subframe); if (eth->flags == ETH_RAW_IF4p5_MODE) {
packet_header = (IF4p5_header_t *)(tx_buffer + MAC_HEADER_SIZE_BYTES);
data_block = (uint16_t*)(tx_buffer + MAC_HEADER_SIZE_BYTES + sizeof_IF4p5_header_t);
} else {
packet_header = (IF4p5_header_t *)(tx_buffer);
data_block = (uint16_t*)(tx_buffer + sizeof_IF4p5_header_t);
}
gen_IF4p5_dl_header(packet_header, frame, subframe);
for (symbol_id=0; symbol_id<fp->symbols_per_tti; symbol_id++) { for (symbol_id=0; symbol_id<nsym; symbol_id++) {
if (eNB->CC_id==1) LOG_I(PHY,"DL_IF4p5: CC_id %d : frame %d, subframe %d, symbol %d\n",eNB->CC_id,frame,subframe,symbol_id);
for (element_id=0; element_id<db_halflength; element_id++) { for (element_id=0; element_id<db_halflength; element_id++) {
i = (uint16_t*) &txdataF[0][blockoffsetF+element_id]; i = (uint16_t*) &txdataF[eNB->CC_id][blockoffsetF+element_id];
data_block[element_id] = ((uint16_t) lin2alaw[*i]) | (lin2alaw[*(i+1)]<<8); data_block[element_id] = ((uint16_t) lin2alaw[*i]) | (lin2alaw[*(i+1)]<<8);
i = (uint16_t*) &txdataF[0][slotoffsetF+element_id]; i = (uint16_t*) &txdataF[eNB->CC_id][slotoffsetF+element_id];
data_block[element_id+db_halflength] = ((uint16_t) lin2alaw[*i]) | (lin2alaw[*(i+1)]<<8); data_block[element_id+db_halflength] = ((uint16_t) lin2alaw[*i]) | (lin2alaw[*(i+1)]<<8);
} }
dl_header->frame_status &= ~(0x000f<<26); packet_header->frame_status &= ~(0x000f<<26);
dl_header->frame_status |= (symbol_id&0x000f)<<26; packet_header->frame_status |= (symbol_id&0x000f)<<26;
if ((eNB->ifdevice.trx_write_func(&eNB->ifdevice, if ((eNB->ifdevice.trx_write_func(&eNB->ifdevice,
symbol_id, symbol_id,
...@@ -87,58 +104,92 @@ void send_IF4p5(PHY_VARS_eNB *eNB, int frame, int subframe, uint16_t packet_type ...@@ -87,58 +104,92 @@ void send_IF4p5(PHY_VARS_eNB *eNB, int frame, int subframe, uint16_t packet_type
slotoffsetF += fp->ofdm_symbol_size; slotoffsetF += fp->ofdm_symbol_size;
blockoffsetF += fp->ofdm_symbol_size; blockoffsetF += fp->ofdm_symbol_size;
} }
} else if (packet_type == IF4p5_PULFFT) { } else if ((packet_type == IF4p5_PULFFT)||
(packet_type == IF4p5_PULTICK)){
db_fulllength = 12*fp->N_RB_UL; db_fulllength = 12*fp->N_RB_UL;
db_halflength = (db_fulllength)>>1; db_halflength = (db_fulllength)>>1;
slotoffsetF = 1; slotoffsetF = 1;
blockoffsetF = slotoffsetF + fp->ofdm_symbol_size - db_halflength - 1; blockoffsetF = slotoffsetF + fp->ofdm_symbol_size - db_halflength - 1;
IF4p5_header_t *ul_header = (IF4p5_header_t *)(tx_buffer + MAC_HEADER_SIZE_BYTES); if (subframe_select(fp,subframe)==SF_S) {
data_block = (uint16_t*)(tx_buffer + MAC_HEADER_SIZE_BYTES + sizeof_IF4p5_header_t); nsym=fp->ul_symbols_in_S_subframe;
slotoffsetF += (fp->ofdm_symbol_size*(fp->symbols_per_tti-nsym));
gen_IF4p5_ul_header(ul_header, frame, subframe); blockoffsetF += (fp->ofdm_symbol_size*(fp->symbols_per_tti-nsym));
}
for (symbol_id=0; symbol_id<fp->symbols_per_tti; symbol_id++) {
for (element_id=0; element_id<db_halflength; element_id++) {
i = (uint16_t*) &rxdataF[0][blockoffsetF+element_id];
data_block[element_id] = ((uint16_t) lin2alaw[*i]) | (lin2alaw[*(i+1)]<<8);
i = (uint16_t*) &rxdataF[0][slotoffsetF+element_id]; if (eth->flags == ETH_RAW_IF4p5_MODE) {
data_block[element_id+db_halflength] = ((uint16_t) lin2alaw[*i]) | (lin2alaw[*(i+1)]<<8); packet_header = (IF4p5_header_t *)(tx_buffer + MAC_HEADER_SIZE_BYTES);
} data_block = (uint16_t*)(tx_buffer + MAC_HEADER_SIZE_BYTES + sizeof_IF4p5_header_t);
} else {
ul_header->frame_status &= ~(0x000f<<26); packet_header = (IF4p5_header_t *)(tx_buffer);
ul_header->frame_status |= (symbol_id&0x000f)<<26; data_block = (uint16_t*)(tx_buffer + sizeof_IF4p5_header_t);
}
gen_IF4p5_ul_header(packet_header, packet_type, frame, subframe);
if (packet_type == IF4p5_PULFFT) {
for (symbol_id=fp->symbols_per_tti-nsym; symbol_id<fp->symbols_per_tti; symbol_id++) {
LOG_D(PHY,"IF4p5_PULFFT: frame %d, subframe %d, symbol %d\n",frame,subframe,symbol_id);
for (element_id=0; element_id<db_halflength; element_id++) {
i = (uint16_t*) &rxdataF[0][blockoffsetF+element_id];
data_block[element_id] = ((uint16_t) lin2alaw[*i]) | (lin2alaw[*(i+1)]<<8);
i = (uint16_t*) &rxdataF[0][slotoffsetF+element_id];
data_block[element_id+db_halflength] = ((uint16_t) lin2alaw[*i]) | (lin2alaw[*(i+1)]<<8);
}
packet_header->frame_status &= ~(0x000f<<26);
packet_header->frame_status |= (symbol_id&0x000f)<<26;
if ((eNB->ifdevice.trx_write_func(&eNB->ifdevice,
symbol_id,
&tx_buffer,
db_fulllength,
1,
IF4p5_PULFFT)) < 0) {
perror("ETHERNET write for IF4p5_PULFFT\n");