Commit 740e13bb authored by matzakos's avatar matzakos

Successful build of UE executable. Warnings need to be reduced.

parent 23c3ac8a
......@@ -1081,6 +1081,14 @@ set(PHY_SRC_COMMON
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dci_tools_common.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/lte_mcs.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/group_hopping.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/pbch.c #Source files that had to be added after merge with sidelink
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/ulsch_demodulation.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dlsch_modulation.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dci.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dlsch_coding.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/pcfich.c
${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/srs_modulation.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/initial_syncSL.c
${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/get_pmi.c
......@@ -1094,6 +1102,10 @@ set(PHY_SRC_COMMON
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/lte_gold_generic.c
${OPENAIR1_DIR}/PHY/MODULATION/ofdm_mod.c
${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_sync_time.c
${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_ul_channel_estimation.c #Source files that had to be added after merge with sidelink
${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/freq_equalization.c
${OPENAIR1_DIR}/PHY/LTE_REFSIG/lte_dl_cell_spec.c
${OPENAIR1_DIR}/PHY/LTE_REFSIG/lte_dl_uespec.c
${OPENAIR1_DIR}/PHY/LTE_REFSIG/lte_gold.c
......@@ -2074,7 +2086,7 @@ add_executable(lte-uesoftmodem
${OPENAIR3_DIR}/NAS/UE/nas_ue_task.c
${OPENAIR_DIR}/common/utils/utils.c
${OPENAIR_DIR}/common/utils/system.c
${OPENAIR_TARGETS}/SIMU/USER/channel_sim.c
#${OPENAIR_TARGETS}/SIMU/USER/channel_sim.c
${XFORMS_SOURCE}
${XFORMS_SOURCE_SOFTMODEM}
${T_SOURCE}
......@@ -2182,7 +2194,7 @@ foreach(myExe dlsim ulsim slschsim pucchsim prachsim)
add_executable(${myExe}
${OPENAIR1_DIR}/SIMULATION/LTE_PHY/${myExe}.c
${OPENAIR1_DIR}/SIMULATION/LTE_PHY/dummy_functions.c
${OPENAIR_TARGETS}/SIMU/USER/channel_sim.c
#${OPENAIR_TARGETS}/SIMU/USER/channel_sim.c
${XFORMS_SOURCE}
${T_SOURCE}
${CONFIG_SOURCES}
......
......@@ -1056,12 +1056,30 @@ void init_lte_ue_transport(PHY_VARS_UE *ue,int abstraction_flag) {
for (int i=0;i<MAX_SLDCH;i++) ue->dlsch_rx_sldch[i] = new_ue_dlsch(1,4,NSOFT,1,MAX_TURBO_ITERATIONS,ue->frame_parms.N_RB_DL, abstraction_flag);
ue->dlsch_sldch = new_eNB_dlsch(1,1,NSOFT,ue->frame_parms.N_RB_DL, abstraction_flag,&ue->frame_parms);
ue->ulsch_sldch = new_ue_ulsch(ue->frame_parms.N_RB_DL, abstraction_flag);
for (i=0;i<10;i++) ue->dlsch_sldch->harq_ids[i] = 0;
//Panos: Substituted the next line with the double for loop as harq_ids is a 2-dimension array now
//for (i=0;i<10;i++) ue->dlsch_sldch->harq_ids[j][i] = 0;
for (j=0; j<2; j++){
for (i=0;i<10;i++){
ue->dlsch_sldch->harq_ids[j][i] = 0;
}
}
ue->dlsch_rx_slsch = new_ue_dlsch(1,4,NSOFT,1,MAX_TURBO_ITERATIONS,ue->frame_parms.N_RB_DL, abstraction_flag);
ue->dlsch_slsch = new_eNB_dlsch(1,1,NSOFT,ue->frame_parms.N_RB_DL, abstraction_flag,&ue->frame_parms);
ue->ulsch_slsch = new_ue_ulsch(ue->frame_parms.N_RB_DL, abstraction_flag);
for (i=0;i<10;i++) ue->dlsch_slsch->harq_ids[i] = 0;
//Panos: Substituted the next line with the double for loop as harq_ids is a 2-dimension array now
//for (i=0;i<10;i++) ue->dlsch_slsch->harq_ids[j][i] = 0;
for (j=0; j<2; j++){
for (i=0;i<10;i++){
ue->dlsch_slsch->harq_ids[j][i] = 0;
}
}
ue->slsch_txcnt = 0;
ue->slsch_errors = 0;
for (int i=0;i<4;i++) ue->slsch_rxcnt[i] = 0;
......
......@@ -703,6 +703,196 @@ int dlsch_encoding_all(PHY_VARS_eNB *eNB,
//Used only for sidelink
int dlsch_encoding0(LTE_DL_FRAME_PARMS *frame_parms,
unsigned char *a,
uint8_t num_pdcch_symbols,
LTE_eNB_DLSCH_t *dlsch,
int frame,
uint8_t subframe,
time_stats_t *rm_stats,
time_stats_t *te_stats,
time_stats_t *i_stats)
{
unsigned int G;
unsigned int crc=1;
unsigned short iind;
unsigned char harq_pid = dlsch->harq_ids[frame%2][subframe];
if(harq_pid >= dlsch->Mdlharq) {
LOG_E(PHY,"dlsch_encoding illegal harq_pid %d\n", harq_pid);
return(-1);
}
unsigned short nb_rb = dlsch->harq_processes[harq_pid]->nb_rb;
unsigned int A;
unsigned char mod_order;
unsigned int Kr=0,Kr_bytes,r,r_offset=0;
// unsigned short m=dlsch->harq_processes[harq_pid]->mcs;
uint8_t beamforming_mode=0;
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ENCODING, VCD_FUNCTION_IN);
A = dlsch->harq_processes[harq_pid]->TBS; //6228
// printf("Encoder: A: %d\n",A);
mod_order = dlsch->harq_processes[harq_pid]->Qm;
if(dlsch->harq_processes[harq_pid]->mimo_mode == TM7)
beamforming_mode = 7;
else if(dlsch->harq_processes[harq_pid]->mimo_mode == TM8)
beamforming_mode = 8;
else if(dlsch->harq_processes[harq_pid]->mimo_mode == TM9_10)
beamforming_mode = 9;
if (num_pdcch_symbols > 0) G = get_G(frame_parms,nb_rb,dlsch->harq_processes[harq_pid]->rb_alloc,mod_order,dlsch->harq_processes[harq_pid]->Nl,num_pdcch_symbols,frame,subframe,beamforming_mode); // regular DLSCH coding
else G = nb_rb * ((frame_parms->Ncp == 0)?12:10) * 12 * mod_order; // SLSCH Coding
// if (dlsch->harq_processes[harq_pid]->Ndi == 1) { // this is a new packet
if (dlsch->harq_processes[harq_pid]->round == 0) { // this is a new packet
#ifdef DEBUG_DLSCH_CODING
printf("encoding thinks this is a new packet for harq_pid %d (%p) \n",harq_pid,dlsch->harq_processes[harq_pid]->b);
#endif
/*
int i;
printf("dlsch (tx): \n");
for (i=0;i<(A>>3);i++)
printf("%02x.",a[i]);
printf("\n");
*/
// Add 24-bit crc (polynomial A) to payload
crc = crc24a(a,
A)>>8;
a[A>>3] = ((uint8_t*)&crc)[2];
a[1+(A>>3)] = ((uint8_t*)&crc)[1];
a[2+(A>>3)] = ((uint8_t*)&crc)[0];
// printf("CRC %x (A %d)\n",crc,A);
dlsch->harq_processes[harq_pid]->B = A+24;
// dlsch->harq_processes[harq_pid]->b = a;
memcpy(dlsch->harq_processes[harq_pid]->b,a,(A/8)+4);
if (lte_segmentation(dlsch->harq_processes[harq_pid]->b,
dlsch->harq_processes[harq_pid]->c,
dlsch->harq_processes[harq_pid]->B,
&dlsch->harq_processes[harq_pid]->C,
&dlsch->harq_processes[harq_pid]->Cplus,
&dlsch->harq_processes[harq_pid]->Cminus,
&dlsch->harq_processes[harq_pid]->Kplus,
&dlsch->harq_processes[harq_pid]->Kminus,
&dlsch->harq_processes[harq_pid]->F)<0)
return(-1);
for (r=0; r<dlsch->harq_processes[harq_pid]->C; r++) {
if (r<dlsch->harq_processes[harq_pid]->Cminus)
Kr = dlsch->harq_processes[harq_pid]->Kminus;
else
Kr = dlsch->harq_processes[harq_pid]->Kplus;
Kr_bytes = Kr>>3;
// get interleaver index for Turbo code (lookup in Table 5.1.3-3 36-212, V8.6 2009-03, p. 13-14)
if (Kr_bytes<=64)
iind = (Kr_bytes-5);
else if (Kr_bytes <=128)
iind = 59 + ((Kr_bytes-64)>>1);
else if (Kr_bytes <= 256)
iind = 91 + ((Kr_bytes-128)>>2);
else if (Kr_bytes <= 768)
iind = 123 + ((Kr_bytes-256)>>3);
else {
printf("dlsch_coding: Illegal codeword size %d!!!\n",Kr_bytes);
return(-1);
}
#ifdef DEBUG_DLSCH_CODING
printf("Generating Code Segment %d (%d bits)\n",r,Kr);
// generate codewords
printf("bits_per_codeword (Kr)= %d, A %d\n",Kr,A);
printf("N_RB = %d\n",nb_rb);
printf("Ncp %d\n",frame_parms->Ncp);
printf("mod_order %d\n",mod_order);
#endif
#ifdef DEBUG_DLSCH_CODING
printf("Encoding ... iind %d f1 %d, f2 %d\n",iind,f1f2mat_old[iind*2],f1f2mat_old[(iind*2)+1]);
#endif
start_meas(te_stats);
encoder(dlsch->harq_processes[harq_pid]->c[r],
Kr>>3,
&dlsch->harq_processes[harq_pid]->d[r][96],
(r==0) ? dlsch->harq_processes[harq_pid]->F : 0
//f1f2mat_old[iind*2], // f1 (see 36121-820, page 14)
//f1f2mat_old[(iind*2)+1] // f2 (see 36121-820, page 14)
);
stop_meas(te_stats);
#ifdef DEBUG_DLSCH_CODING
if (r==0)
LOG_M("enc_output0.m","enc0",&dlsch->harq_processes[harq_pid]->d[r][96],(3*8*Kr_bytes)+12,1,4);
#endif
start_meas(i_stats);
dlsch->harq_processes[harq_pid]->RTC[r] =
sub_block_interleaving_turbo(4+(Kr_bytes*8),
&dlsch->harq_processes[harq_pid]->d[r][96],
dlsch->harq_processes[harq_pid]->w[r]);
stop_meas(i_stats);
}
}
// Fill in the "e"-sequence from 36-212, V8.6 2009-03, p. 16-17 (for each "e") and concatenate the
// outputs for each code segment, see Section 5.1.5 p.20
for (r=0; r<dlsch->harq_processes[harq_pid]->C; r++) {
#ifdef DEBUG_DLSCH_CODING
printf("Rate Matching, Code segment %d (coded bits (G) %d,unpunctured/repeated bits per code segment %d,mod_order %d, nb_rb %d)...\n",
r,
G,
Kr*3,
mod_order,nb_rb);
#endif
start_meas(rm_stats);
#ifdef DEBUG_DLSCH_CODING
printf("rvidx in encoding = %d\n", dlsch->harq_processes[harq_pid]->rvidx);
#endif
r_offset += lte_rate_matching_turbo(dlsch->harq_processes[harq_pid]->RTC[r],
G, //G
dlsch->harq_processes[harq_pid]->w[r],
dlsch->harq_processes[harq_pid]->e+r_offset,
dlsch->harq_processes[harq_pid]->C, // C
dlsch->Nsoft, // Nsoft,
dlsch->Mdlharq,
dlsch->Kmimo,
dlsch->harq_processes[harq_pid]->rvidx,
dlsch->harq_processes[harq_pid]->Qm,
dlsch->harq_processes[harq_pid]->Nl,
r,
nb_rb);
// m); // r
stop_meas(rm_stats);
#ifdef DEBUG_DLSCH_CODING
if (r==dlsch->harq_processes[harq_pid]->C-1)
LOG_M("enc_output.m","enc",dlsch->harq_processes[harq_pid]->e,r_offset,1,4);
#endif
}
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ENCODING, VCD_FUNCTION_OUT);
return(0);
}
int dlsch_encoding(PHY_VARS_eNB *eNB,
unsigned char *a,
uint8_t num_pdcch_symbols,
......
......@@ -5134,6 +5134,25 @@ double sinr_eff_cqi_calc(PHY_VARS_UE *ue, uint8_t eNB_id, uint8_t subframe)
}
//
//Added to be used from slsch.c (sidelink)
void RIV2_alloc(uint16_t N_RB_DL,uint16_t RIV, int *Lcrbs, int *RBstart) {
int A = RIV/N_RB_DL;
int B = RIV%N_RB_DL;
*Lcrbs = A+1;
// check condition RBstart <= N_RB_DL + 1 - Lcrbs
if (A <= N_RB_DL - B) {
*Lcrbs = A+1;
*RBstart = B;
}
else {
*Lcrbs = N_RB_DL+1-A;
*RBstart = N_RB_DL-1-B;
}
}
#ifdef DEBUG_DLSCH_TOOLS
......
#include "PHY/defs.h"
#include "PHY/defs_UE.h"
#include "PHY/defs_common.h"
const int trp8[TRP8_MAX+1][8] = {{1,0,0,0,0,0,0,0},
{0,1,0,0,0,0,0,0},
{0,0,1,0,0,0,0,0},
......
This diff is collapsed.
......@@ -31,8 +31,9 @@
*/
#ifndef __LTE_TRANSPORT_SLSS__C__
#define __LTE_TRANSPORT_SLSS__C__
#include "PHY/defs.h"
#include "PHY/LTE_TRANSPORT/proto.h"
#include "PHY/defs_UE.h"
//#include "PHY/LTE_TRANSPORT/proto.h"
#include "PHY/LTE_TRANSPORT/transport_proto.h"
extern uint8_t D2D_en;
//#define PSDCH_DEBUG 1
......
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file PHY/LTE_TRANSPORT/pss.c
* \brief Top-level routines for generating primary synchronization signal (PSS) V8.6 2009-03
* \author F. Kaltenberger, O. Tonelli, R. Knopp
* \date 2011
* \version 0.1
* \company Eurecom
* \email: florian.kaltenberger@eurecom.fr, oscar.tonelli@yahoo.it,knopp@eurecom.fr
* \note
* \warning
*/
/* file: pss.c
purpose: generate the primary synchronization signals of LTE
author: florian.kaltenberger@eurecom.fr, oscar.tonelli@yahoo.it
date: 21.10.2009
*/
//#include "defs.h"
#include "PHY/defs_UE.h"
#include "PHY/phy_extern.h"
int generate_slpss(int32_t **txdataF,
short amp,
LTE_DL_FRAME_PARMS *frame_parms,
unsigned short symbol,
int subframe
)
{
unsigned int Nsymb;
unsigned short k,m,a;
uint8_t Nid2;
short *primary_sync;
Nid2 = frame_parms->Nid_SL / 168;
AssertFatal(Nid2<2,"Nid2 %d >= 2\n",Nid2);
switch (Nid2) {
case 0:
primary_sync = primary_synch0SL;
break;
case 1:
primary_sync = primary_synch1SL;
break;
default:
LOG_E(PHY,"[PSS] eNb_id has to be 0,1,2\n");
return(-1);
}
// scale by sqrt(72/62)
// note : we have to scale for TX power requirements too, beta_PSBCH !
a = (amp*SQRT_18_OVER_32_Q15)>>(15-2);
//printf("[PSS] amp=%d, a=%d\n",amp,a);
LOG_D(PHY,"Generating PSS in subframe %d, symbol %d, amp %d (%d) => %p\n",
subframe,symbol,a,amp,
&((short*)txdataF[0])[subframe*frame_parms->samples_per_tti]);
// The PSS occupies the inner 6 RBs, which start at
k = frame_parms->ofdm_symbol_size-3*12+5;
//printf("[PSS] k = %d\n",k);
for (m=5; m<67; m++) {
for (int aa=0;aa<frame_parms->nb_antennas_tx;aa++) {
((short*)txdataF[aa])[subframe*frame_parms->samples_per_tti + (2*(symbol*frame_parms->ofdm_symbol_size + k))] =
(a * primary_sync[2*m]) >> 15;
((short*)txdataF[aa])[subframe*frame_parms->samples_per_tti + (2*(symbol*frame_parms->ofdm_symbol_size + k)) + 1] =
(a * primary_sync[2*m+1]) >> 15;
}
k+=1;
if (k >= frame_parms->ofdm_symbol_size) {
k-=frame_parms->ofdm_symbol_size;
}
}
return(0);
}
......@@ -29,7 +29,7 @@
* \note
* \warning
*/
#include "PHY/defs.h"
#include "PHY/defs_UE.h"
#include "pssch.h"
//#define PSSCH_DEBUG 1
......
......@@ -31,7 +31,7 @@
*/
#ifndef __LTE_TRANSPORT_SLSS__C__
#define __LTE_TRANSPORT_SLSS__C__
#include "PHY/defs.h"
#include "PHY/defs_UE.h"
void check_and_generate_slss(PHY_VARS_UE *ue,int frame_tx,int subframe_tx) {
......
This diff is collapsed.
......@@ -1203,7 +1203,7 @@ void qpsk_qpsk_TM3456(short *stream0_in,
@param decoded_output Output of Viterbi decoder
*/
void dci_decoding(uint8_t DCI_LENGTH,
uint16_t coded_bits,
uint8_t coded_bits,
int8_t *e,
uint8_t *decoded_output);
......
......@@ -66,6 +66,7 @@
#include "platform_types.h"
#include "PHY/LTE_UE_TRANSPORT/transport_ue.h"
#include "PHY/LTE_TRANSPORT/transport_eNB.h" // for SIC
#include "PHY/LTE_TRANSPORT/transport_common.h"
#include <pthread.h>
#include "assertions.h"
......
......@@ -105,6 +105,8 @@
#define NB_RX_ANTENNAS_MAX 64
#define TRP8_MAX 106
#ifdef OCP_FRAMEWORK
#include "enums.h"
#else
......
......@@ -48,9 +48,8 @@
#define PUCCH
#endif
#include "LAYER2/MAC/extern.h"
#include "LAYER2/MAC/defs.h"
#include "LAYER2/MAC/proto.h"
#include "LAYER2/MAC/mac_extern.h"
#include "LAYER2/MAC/mac_proto.h"
#include "UTIL/LOG/log.h"
#include "LAYER2/MAC/mac.h"
......@@ -1182,7 +1181,7 @@ void ulsch_common_procedures(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc, uint8_t empt
LOG_D(PHY,"[UE %d] Frame %d, subframe %d: ulsch_start = %d (rxoff %d, HW TA %d, timing advance %d, TA_offset %d, empty subframe %d\n",
ue->Mod_id,frame_tx,subframe_tx,
ue->Mod_id,proc->frame_tx,subframe_tx,
ulsch_start,
ue->rx_offset,
ue->hw_timing_advance,
......@@ -2213,7 +2212,7 @@ void phy_procedures_UE_SL_TX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc) {
// LOG_I(PHY,"ULSCH %d.%d (generate_ul_signal %d): signal F energy %d dB (txdataF %p)\n",frame_tx,subframe_tx,ue->generate_ul_signal[subframe_tx][0],dB_fixed(signal_energy(&ue->common_vars.txdataF[0][subframe_tx*14*ue->frame_parms.ofdm_symbol_size],14*ue->frame_parms.ofdm_symbol_size)),&ue->common_vars.txdataF[0][subframe_tx*14*ue->frame_parms.ofdm_symbol_size]);
ulsch_common_procedures(ue,frame_tx,subframe_tx, (ue->generate_ul_signal[subframe_tx][0] == 0));
ulsch_common_procedures(ue,proc, (ue->generate_ul_signal[subframe_tx][0] == 0));
}
......
......@@ -45,6 +45,8 @@
#define RF
double r_re_SL[NUMBER_OF_UE_MAX][2][30720];
double r_im_SL[NUMBER_OF_UE_MAX][2][30720];
......@@ -477,6 +479,172 @@ void do_UL_sig(sim_t *sim,
}
void do_SL_sig(int UE_id,channel_desc_t *UE2UE[NUMBER_OF_UE_MAX][NUMBER_OF_UE_MAX][MAX_NUM_CCs],
uint16_t subframe,uint16_t slot, int symbol_offset, LTE_DL_FRAME_PARMS *frame_parms,
uint32_t frame,uint8_t CC_id)
{
int32_t **txdata,**rxdata;
uint8_t nb_antennas_rx = UE2UE[0][0][CC_id]->nb_rx; // number of rx antennas at eNB
uint8_t nb_antennas_tx = UE2UE[0][0][CC_id]->nb_tx; // number of tx antennas at UE
double tx_pwr, rx_pwr;
int32_t rx_pwr2;
uint32_t i,aa;
uint32_t sf_offset;
uint8_t hold_channel=0;
double s_re0[30720];
double s_re1[30720];
double *s_re[2];
double s_im0[30720];
double s_im1[30720];
double *s_im[2];
double r_re00[30720];
double r_re01[30720];
double *r_re0[2];
double r_im00[30720];
double r_im01[30720];
double *r_im0[2];
s_re[0] = s_re0;
s_im[0] = s_im0;
s_re[1] = s_re1;
s_im[1] = s_im1;
r_re0[0] = r_re00;
r_im0[0] = r_im00;
r_re0[1] = r_re01;
r_im0[1] = r_im01;
// Clear RX signal for eNB = eNB_id
for (i=0; i<frame_parms->samples_per_tti; i++) {
for (aa=0; aa<nb_antennas_rx; aa++) {
r_re_SL[UE_id][aa][i]=0.0;
r_im_SL[UE_id][aa][i]=0.0;
}
}
txdata = PHY_vars_UE_g[UE_id][CC_id]->common_vars.txdata;
AssertFatal(txdata != NULL,"txdata is null\n");
sf_offset = subframe*frame_parms->samples_per_tti;
if (((double)PHY_vars_UE_g[UE_id][CC_id]->tx_power_dBm[subframe] +
UE2UE[UE_id][0][CC_id]->path_loss_dB) <= -125.0) {
// don't simulate a UE that is too weak
LOG_I(OCM,"[SIM][SL] UE %d tx_pwr %d dBm (num_RE %d) for subframe %d (sf_offset %d,slot_ind %d,symbol_offset %d)\n",
UE_id,
PHY_vars_UE_g[UE_id][CC_id]->tx_power_dBm[subframe],
PHY_vars_UE_g[UE_id][CC_id]->tx_total_RE[subframe],
subframe,sf_offset,slot,symbol_offset);
} else {
tx_pwr = dac_fixed_gain((double**)s_re,
(double**)s_im,
txdata,
sf_offset,
nb_antennas_tx,
frame_parms->samples_per_tti,
((slot == 2)? sf_offset+(frame_parms->samples_per_tti>>1) : sf_offset)+symbol_offset,
frame_parms->ofdm_symbol_size,
14,
(double)PHY_vars_UE_g[UE_id][CC_id]->tx_power_dBm[subframe]-10*log10((double)PHY_vars_UE_g[UE_id][CC_id]->tx_total_RE[subframe]),
1,
NULL,
PHY_vars_UE_g[UE_id][CC_id]->tx_total_RE[subframe]); // This make the previous argument the total power
LOG_I(OCM,"[SIM][SL] UE %d tx_pwr %f dBm (target %d dBm, num_RE %d) for subframe %d (sf_offset %d/%d/%d)\n",
UE_id,
10*log10(tx_pwr*PHY_vars_UE_g[UE_id][CC_id]->tx_total_RE[subframe]),
PHY_vars_UE_g[UE_id][CC_id]->tx_power_dBm[subframe],
PHY_vars_UE_g[UE_id][CC_id]->tx_total_RE[subframe],
subframe,sf_offset,
(slot == 2)? sf_offset+(frame_parms->samples_per_tti>>1) : sf_offset,
symbol_offset);
multipath_channel(UE2UE[UE_id][0][CC_id],s_re,s_im,r_re0,r_im0,
frame_parms->samples_per_tti,hold_channel);
rx_pwr = signal_energy_fp2(UE2UE[UE_id][0][CC_id]->ch[0],
UE2UE[UE_id][0][CC_id]->channel_length)*UE2UE[UE_id][0][CC_id]->channel_length;
LOG_I(OCM,"[SIM][SL] subframe %d Channel UE %d => UE %d : %f dB (hold %d,length %d, PL %f)\n",subframe,UE_id,0,10*log10(rx_pwr),
hold_channel,UE2UE[UE_id][0][CC_id]->channel_length,
UE2UE[UE_id][0][CC_id]->path_loss_dB);
rx_pwr = signal_energy_fp(r_re0,r_im0,nb_antennas_rx,frame_parms->samples_per_tti,0);
LOG_I(OCM,"[SIM][SL] UE %d (%d/%d rx antennas) : rx_pwr %f dBm (tx_pwr - PL %f) for subframe %d, sptti %d\n",
UE_id,nb_antennas_rx,UE2UE[UE_id][0][CC_id]->nb_rx,10*log10(rx_pwr),10*log10(tx_pwr*PHY_vars_UE_g[UE_id][CC_id]->tx_total_RE[subframe])+UE2UE[UE_id][0][CC_id]->path_loss_dB,subframe,frame_parms->samples_per_tti);
/*
if (abs(10*log10(rx_pwr)-10*log10(tx_pwr*PHY_vars_UE_g[UE_id][CC_id]->tx_total_RE[subframe])-UE2RU[UE_id][ru_id][CC_id]->path_loss_dB)>3) {
write_output("txsig_re.m","s_re",s_re[0],frame_parms->samples_per_tti,1,7);
write_output("txsig_im.m","s_im",s_im[0],frame_parms->samples_per_tti,1,7);
write_output("rxsig_re.m","r_re",r_re0[0],frame_parms->samples_per_tti,1,7);
write_output("rxsig_im.m","r_im",r_im0[0],frame_parms->samples_per_tti,1,7);
exit(-1);
}*/
if (UE2UE[UE_id][0][CC_id]->first_run == 1)
UE2UE[UE_id][0][CC_id]->first_run = 0;
for (aa=0; aa<nb_antennas_rx; aa++) {
for (i=0; i<frame_parms->samples_per_tti; i++) {
r_re_SL[0][aa][i]+=r_re0[aa][i];
r_im_SL[0][aa][i]+=r_im0[aa][i];
}
}
}
double *r_re_p[2] = {r_re_SL[0][0],r_re_SL[0][1]};
double *r_im_p[2] = {r_im_SL[0][0],r_im_SL[0][1]};
rx_pwr = signal_energy_fp(r_re_p,r_im_p,nb_antennas_rx,frame_parms->samples_per_tti,0);
LOG_D(OCM,"[SIM][SL] UE %d (%d/%d rx antennas) : rx_pwr %f dBm (before RF) for subframe %d, gain %f\n",
UE_id,nb_antennas_rx,nb_antennas_rx,10*log10(rx_pwr),subframe,
PHY_vars_UE_g[UE_id][CC_id]->rx_total_gain_dB - 66.227);
rf_rx_simple(r_re_p,
r_im_p,
nb_antennas_rx,
frame_parms->samples_per_tti,
1e3/UE2UE[0][UE_id][CC_id]->sampling_rate, // sampling time (ns)
PHY_vars_UE_g[UE_id][CC_id]->rx_total_gain_dB - 66.227); // rx_gain (dB) (66.227 = 20*log10(pow2(11)) = gain from the adc that will be applied later)
#ifdef DEBUG_SIM
rx_pwr = signal_energy_fp(r_re_p,r_im_p,nb_antennas_rx,frame_parms->samples_per_tti,0);//*(double)frame_parms->ofdm_symbol_size/(12.0*frame_parms->N_RB_DL;
LOG_D(OCM,"[SIM][SL] rx_pwr (ADC in) %f dB for subframe %d (rx_gain %d)\n",10*log10(rx_pwr),subframe,
PHY_vars_UE_g[UE_id][CC_id]->rx_total_gain_dB);
#endif
rxdata = PHY_vars_UE_g[0][CC_id]->common_vars.rxdata;
sf_offset = subframe*frame_parms->samples_per_tti;
adc(r_re_p,
r_im_p,
0,
sf_offset,
rxdata,
nb_antennas_rx,
frame_parms->samples_per_tti,
12);
#ifdef DEBUG_SIM
rx_pwr2 = signal_energy(rxdata[0]+sf_offset,frame_parms->samples_per_tti)*(double)frame_parms->ofdm_symbol_size/(12.0*frame_parms->N_RB_DL);
LOG_D(OCM,"[SIM][SL] UE %d rx_pwr (ADC out) %f dB (%d) for subframe %d (offset %d) = %p\n",UE_id,10*log10((double)rx_pwr2),rx_pwr2,subframe,sf_offset,rxdata[0]+sf_offset);
#else
UNUSED_VARIABLE(tx_pwr);
UNUSED_VARIABLE(rx_pwr);
UNUSED_VARIABLE(rx_pwr2);
#endif
}
......@@ -32,6 +32,7 @@
#include "COMMON/platform_types.h"
#include "COMMON/platform_constants.h"
#include "SCHED_UE/sched_UE.h"
#include "openair2/LAYER2/MAC/mac.h"
#include "LTE_SystemInformationBlockType2.h"
//#include "RadioResourceConfigCommonSIB.h"
#include "LTE_RadioResourceConfigDedicated.h"
......@@ -145,7 +146,7 @@ rrc_mac_config_req_ue(module_id_t Mod_idP,
,const uint32_t * const sourceL2Id
,const uint32_t * const destinationL2Id,
const uint32_t * const groupL2Id,
SL_Preconfiguration_r12_t *SL_Preconfiguration_r12,
LTE_SL_Preconfiguration_r12_t *SL_Preconfiguration_r12,
uint32_t directFrameNumber_r12,
long directSubframeNumber_r12,
long *sl_Bandwidth_r12
......@@ -596,7 +597,7 @@ rrc_mac_config_req_ue(module_id_t Mod_idP,
#endif
//for D2D
#if defined(Rel10) || defined(Rel14)
#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0))
int j = 0;
int k = 0;
switch (config_action) {
......@@ -742,7 +743,7 @@ rrc_mac_config_req_ue(module_id_t Mod_idP,
// Note: Other synch parameters are ignored for now
UE_mac_inst[Mod_idP].slss.slss_id = 170;//+(taus()%168);
// PSCCH
struct SL_PreconfigCommPool_r12 *preconfigpool = SL_Preconfiguration_r12->preconfigComm_r12.list.array[0];
struct LTE_SL_PreconfigCommPool_r12 *preconfigpool = SL_Preconfiguration_r12->preconfigComm_r12.list.array[0];
UE_mac_inst[Mod_idP].slsch.N_SL_RB_SC = preconfigpool->sc_TF_ResourceConfig_r12.prb_Num_r12;
UE_mac_inst[Mod_idP].slsch.prb_Start_SC = preconfigpool->sc_TF_ResourceConfig_r12.prb_Start_r12;
UE_mac_inst[Mod_idP].slsch.prb_End_SC = preconfigpool->sc_TF_ResourceConfig_r12.prb_End_r12;
......@@ -760,15 +761,15 @@ rrc_mac_config_req_ue(module_id_t Mod_idP,
UE_mac_inst[Mod_idP].slsch.prb_End_data);
AssertFatal(preconfigpool->sc_Period_r12<10,"Maximum supported sc_Period is 320ms (sc_Period_r12=%d)\n",
SL_PeriodComm_r12_sf320);
LTE_SL_PeriodComm_r12_sf320);
UE_mac_inst[Mod_idP].slsch.SL_SC_Period = SC_Period[preconfigpool->sc_Period_r12];
AssertFatal(preconfigpool->sc_TF_ResourceConfig_r12.offsetIndicator_r12.present == SL_OffsetIndicator_r12_PR_small_r12,
AssertFatal(preconfigpool->sc_TF_ResourceConfig_r12.offsetIndicator_r12.present == LTE_SL_OffsetIndicator_r12_PR_small_r12,
"offsetIndicator is limited to smaller format\n");
UE_mac_inst[Mod_idP].slsch.SL_OffsetIndicator = preconfigpool->sc_TF_ResourceConfig_r12.offsetIndicator_r12.choice.small_r12;
UE_mac_inst[Mod_idP].slsch.SL_OffsetIndicator_data = preconfigpool->data_TF_ResourceConfig_r12.offsetIndicator_r12.choice.small_r12;
AssertFatal(preconfigpool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.present <= SubframeBitmapSL_r12_PR_bs40_r12 ||
preconfigpool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.present > SubframeBitmapSL_r12_PR_NOTHING,
AssertFatal(preconfigpool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.present <= LTE_SubframeBitmapSL_r12_PR_bs40_r12 ||
preconfigpool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.present > LTE_SubframeBitmapSL_r12_PR_NOTHING,
"PSCCH bitmap limited to 42 bits\n");
UE_mac_inst[Mod_idP].slsch.SubframeBitmapSL_length = SubframeBitmapSL[preconfigpool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.present-1];
UE_mac_inst[Mod_idP].slsch.bitmap1 = *((uint64_t*)preconfigpool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs40_r12.buf);
......@@ -777,7 +778,7 @@ rrc_mac_config_req_ue(module_id_t Mod_idP,
AssertFatal(SL_Preconfiguration_r12->ext1->preconfigDisc_r13!=NULL,"there is no SL discovery configuration\n");
AssertFatal(SL_Preconfiguration_r12->ext1->preconfigDisc_r13->discRxPoolList_r13.list.count==1,"Discover RX pool list count %d != 1\n",
SL_Preconfiguration_r12->ext1->preconfigDisc_r13->discRxPoolList_r13.list.count);
SL_PreconfigDiscPool_r13_t *discrxpool=SL_Preconfiguration_r12->ext1->preconfigDisc_r13->discRxPoolList_r13.list.array[0];
LTE_SL_PreconfigDiscPool_r13_t *discrxpool=SL_Preconfiguration_r12->ext1->preconfigDisc_r13->discRxPoolList_r13.list.array[0];
/// Discovery Type
UE_mac_inst[Mod_idP].sldch.type = disc_type1;
......@@ -788,45 +789,45 @@ rrc_mac_config_req_ue(module_id_t Mod_idP,
/// prb-End (0-99)
UE_mac_inst[Mod_idP].sldch.prb_End = discrxpool->tf_ResourceConfig_r13.prb_End_r12;
/// SL-OffsetIndicator (0-10239)
AssertFatal(discrxpool->tf_ResourceConfig_r13.offsetIndicator_r12.present == SL_OffsetIndicator_r12_PR_small_r12,
AssertFatal(discrxpool->tf_ResourceConfig_r13.offsetIndicator_r12.present == LTE_SL_OffsetIndicator_r12_PR_small_r12,
"offsetIndicator_r12 is not PR_small_r12\n");
UE_mac_inst[Mod_idP].sldch.offsetIndicator = discrxpool->tf_ResourceConfig_r13.offsetIndicator_r12.choice.small_r12 ;
AssertFatal(discrxpool->tf_ResourceConfig_r13.subframeBitmap_r12.present > SubframeBitmapSL_r12_PR_NOTHING &&
discrxpool->tf_ResourceConfig_r13.subframeBitmap_r12.present <= SubframeBitmapSL_r12_PR_bs42_r12,
AssertFatal(discrxpool->tf_ResourceConfig_r13.subframeBitmap_r12.present > LTE_SubframeBitmapSL_r12_PR_NOTHING &&
discrxpool->tf_ResourceConfig_r13.subframeBitmap_r12.present <= LTE_SubframeBitmapSL_r12_PR_bs42_r12,
"illegal subframeBitmap %d\n",discrxpool->tf_ResourceConfig_r13.subframeBitmap_r12.present);
/// PSDCH subframe bitmap (up to 100 bits, first 64)
switch (discrxpool->tf_ResourceConfig_r13.subframeBitmap_r12.present) {
case SubframeBitmapSL_r12_PR_NOTHING:
case LTE_SubframeBitmapSL_r12_PR_NOTHING:
AssertFatal(1==0,"Should never get here\n");
break;
case SubframeBitmapSL_r12_PR_bs4_r12:
case LTE_SubframeBitmapSL_r12_PR_bs4_r12:
UE_mac_inst[Mod_idP].sldch.bitmap1 = *(uint64_t*)discrxpool->tf_ResourceConfig_r13.subframeBitmap_r12.choice.bs4_r12.buf;
UE_mac_inst[Mod_idP].sldch.bitmap_length = 4;
break;
case SubframeBitmapSL_r12_PR_bs8_r12:
case LTE_SubframeBitmapSL_r12_PR_bs8_r12:
UE_mac_inst[Mod_idP].sldch.bitmap1 = *(uint64_t*)discrxpool->tf_ResourceConfig_r13.subframeBitmap_r12.choice.bs8_r12.buf;
UE_mac_inst[Mod_idP].sldch.bitmap_length = 9;
break;
case SubframeBitmapSL_r12_PR_bs12_r12:
case LTE_SubframeBitmapSL_r12_PR_bs12_r12:
UE_mac_inst[Mod_idP].sldch.bitmap1 = *(uint64_t*)discrxpool->tf_ResourceConfig_r13.subframeBitmap_r12.choice.bs12_r12.buf;
UE_mac_inst[Mod_idP].sldch.bitmap_length = 12;
break;
case SubframeBitmapSL_r12_PR_bs16_r12:
case LTE_SubframeBitmapSL_r12_PR_bs16_r12:
UE_mac_inst[Mod_idP].sldch.bitmap1 = *(uint64_t*)discrxpool->tf_ResourceConfig_r13.subframeBitmap_r12.choice.bs16_r12.buf;
UE_mac_inst[Mod_idP].sldch.bitmap_length = 16;
break;
case SubframeBitmapSL_r12_PR_bs30_r12:
case LTE_SubframeBitmapSL_r12_PR_bs30_r12:
UE_mac_inst[Mod_idP].sldch.bitmap1 = *(uint64_t*)discrxpool->tf_ResourceConfig_r13.subframeBitmap_r12.choice.bs30_r12.buf;
UE_mac_inst[Mod_idP].sldch.bitmap_length = 30;
break;
case SubframeBitmapSL_r12_PR_bs40_r12:
case LTE_SubframeBitmapSL_r12_PR_bs40_r12:
UE_mac_inst[Mod_idP].sldch.bitmap1 = *(uint64_t*)discrxpool->tf_ResourceConfig_r13.subframeBitmap_r12.choice.bs40_r12.buf;
UE_mac_inst[Mod_idP].sldch.bitmap_length = 40;
break;
case SubframeBitmapSL_r12_PR_bs42_r12:
case LTE_SubframeBitmapSL_r12_PR_bs42_r12:
UE_mac_inst[Mod_idP].sldch.bitmap1 = *(uint64_t*)discrxpool->tf_ResourceConfig_r13.subframeBitmap_r12.choice.bs42_r12.buf;
UE_mac_inst[Mod_idP].sldch.bitmap_length = 42;
break;
......@@ -836,8 +837,8 @@ rrc_mac_config_req_ue(module_id_t Mod_idP,
UE_mac_inst[Mod_idP].sldch.bitmap2 = 0;
/// SL-Discovery Period
AssertFatal(SL_PreconfigDiscPool_r13__discPeriod_r13_spare == 15, "specifications have changed, update table\n");
int sldisc_period[SL_PreconfigDiscPool_r13__discPeriod_r13_spare] = {4,6,7,8,12,14,16,24,28,32,64,128,256,512,1024};
AssertFatal(LTE_SL_PreconfigDiscPool_r13__discPeriod_r13_spare == 15, "specifications have changed, update table\n");
int sldisc_period[LTE_SL_PreconfigDiscPool_r13__discPeriod_r13_spare] = {4,6,7,8,12,14,16,24,28,32,64,128,256,512,1024};
UE_mac_inst[Mod_idP].sldch.discPeriod = sldisc_period[discrxpool->discPeriod_r13];
/// Number of Repetitions (N_R)
......
......@@ -854,7 +854,11 @@ ue_send_mch_sdu(module_id_t module_idP, uint8_t CC_id, frame_t frameP,
(char *)payload_ptr,
rx_lengths[i],
1,
NULL);
NULL
#ifdef Rel14
,SL_RESET_RLC_FLAG_NO
#endif
);
}
} else {
......
......@@ -18,7 +18,7 @@
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#include "LAYER2/MAC/defs.h"
#include "LAYER2/MAC/mac_proto.h"
void initiate_ra_proc(module_id_t module_idP, int CC_id, frame_t frameP,
sub_frame_t subframeP, uint16_t preamble_index,
......
......@@ -2225,7 +2225,7 @@ rrc_ue_process_mobilityControlInfo(
}
*/
//Removing SRB1 and SRB2 and DRB0
LOG_N(RRC,"[UE %d] : Update needed for rrc_pdcp_config_req (deprecated) and rrc_rlc_config_req commands(deprecated)\n", ctxt_pP->module_id);
LOG_I(RRC,"[UE %d] : Update needed for rrc_pdcp_config_req (deprecated) and rrc_rlc_config_req commands(deprecated)\n", ctxt_pP->module_id);
rrc_pdcp_config_req (ctxt_pP, SRB_FLAG_YES, CONFIG_ACTION_REMOVE, DCCH,UNDEF_SECURITY_MODE
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
,0
......
......@@ -334,7 +334,7 @@ extern int setup_ue_buffers(PHY_VARS_UE **phy_vars_ue, openair0_config_t *openai
extern void fill_ue_band_info(void);
//extern void init_UE(int,int,int,int,int,int,int,int,int);
extern void init_UE(int nb_inst,int eMBMS_active, int uecap_xer_in, int timing_correction, int phy_test, int UE_scan, int UE_scan_carrier, runmode_t mode,int rxgain,int txpowermax, LTE_DL_FRAME_PARMS *fp);
extern void init_UE(int nb_inst,int eMBMS_active, int uecap_xer_in, int timing_correction,int phy_test, int UE_scan, int UE_scan_carrier, runmode_t mode,int rxgain,int txpowermax,LTE_DL_FRAME_PARMS *fp0, int sidelink_active,int SLonly,int isSynchRef,int slsynconly,int SLSCHtest);
extern void init_thread(int sched_runtime, int sched_deadline, int sched_fifo, cpu_set_t *cpuset, char * name);
extern void reset_opp_meas(void);
......@@ -365,7 +365,7 @@ extern int stop_L1L2(module_id_t enb_id);
extern int restart_L1L2(module_id_t enb_id);
extern void init_UE_stub_single_thread(int nb_inst,int eMBMS_active, int uecap_xer_in, char *emul_iface);
extern void init_UE_stub_single_thread(int nb_inst,int eMBMS_active, int uecap_xer_in, char *emul_iface, int simL1);
#endif
......@@ -81,7 +81,8 @@ void init_UE_threads_stub(int);
void init_UE_single_thread_stub(int);
void *UE_thread(void *arg);
void *UE_threadSL(void *arg);
void init_UE(int nb_inst,int eMBMS_active, int uecap_xer_in, int timing_correction, int phy_test, int UE_scan, int UE_scan_carrier, runmode_t mode,int rxgain,int txpowermax,LTE_DL_FRAME_PARMS *fp);
void init_UE(int nb_inst,int eMBMS_active, int uecap_xer_in, int timing_correction,int phy_test, int UE_scan, int UE_scan_carrier, runmode_t mode,int rxgain,int txpowermax,LTE_DL_FRAME_PARMS *fp0, int sidelink_active,int SLonly,int isSynchRef,int slsynconly,int SLSCHtest);
//void init_UE(int nb_inst,int eMBMS_active, int uecap_xer_in, int timing_correction,int phy_test, int UE_scan, int UE_scan_carrier, runmode_t mode,int rxgain,int txpowermax,LTE_DL_FRAME_PARMS *fp);
void init_UE_stub(int nb_inst,int,int,char*,int);
void init_UE_stub_single_thread(int nb_inst,int,int,char*, int);
int init_timer_thread(void);
......@@ -1032,7 +1033,7 @@ static void *UE_thread_rxn_txnp4(void *arg) {
(UE->frame_parms.frame_type == FDD) )
if (UE->mode != loop_through_memory)
//phy_procedures_UE_TX(UE,proc,0,0,UE->mode,no_relay);
phy_procedures_UE_TX(UE,proc,0,0,UE->mode,no_relay);
phy_procedures_UE_TX(UE,proc,0,0,UE->mode);
......@@ -1110,7 +1111,7 @@ static void *UE_thread_rxn_txnp4(void *arg) {
}
#include "openair1/SIMULATION/TOOLS/defs.h"
#include "openair1/SIMULATION/TOOLS/sim.h"
unsigned int emulator_absSF;
channel_desc_t *UE2UE[NUMBER_OF_UE_MAX][NUMBER_OF_UE_MAX][MAX_NUM_CCs];
......@@ -2717,7 +2718,7 @@ int init_timer_thread(void) {
/* HACK: this function is needed to compile the UE
* fix it somehow
*/
int8_t find_dlsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type)
int16_t find_dlsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type)
{
printf("you cannot read this\n");
abort();
......
......@@ -119,7 +119,7 @@ uint16_t inst_pdcp_list[NUMBER_OF_UE_MAX];
uint8_t D2D_en = 0; // Enabling D2D operations.
uint16_t sf_ahead=2;
int tddflag;
char *emul_iface;
//char *emul_iface;
//char *emul_iface;
......
This diff is collapsed.
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