Commit 72c11e64 authored by heshanyun's avatar heshanyun

Merge remote-tracking branch 'remotes/origin/develop' into fujitsu_lte_contribution

parents 549d1748 e6e9ea28
......@@ -599,7 +599,7 @@ function main() {
echo "set ( PHY_RM $PHY_RM )" >> $cmake_file
echo "set ( UDP_1MS $UDP_1MS )" >> $cmake_file
echo "set ( PHYSIM $PHYSIM )" >> $cmake_file
echo "set ( PRE_SCD_THREAD $UE_EXPANSION )" >> $cmake_file
echo "set ( PRE_SCD_THREAD True)" >> $cmake_file
echo "set ( UESIM_EXPANSION $UESIM_EXPANSION )" >> $cmake_file
echo "set ( ENABLE_VCD_FIFO $VCD_TIMING )" >> $cmake_file
echo "set ( RF_BOARD \"${HW}\")" >> $cmake_file
......
......@@ -98,7 +98,11 @@ int write_file_matlab(const char *fname,
return -1;
//printf("Writing %d elements of type %d to %s\n",length,format,fname);
if(-1 == (access(fname,F_OK))){
creat(fname, 0644);
}else{
chmod(fname, 0644);
}
if (format == 10 || format ==11 || format == 12 || format == 13 || format == 14) {
fp = fopen(fname,"a+");
} else if (format != 10 && format !=11 && format != 12 && format != 13 && format != 14) {
......@@ -622,6 +626,11 @@ void set_glog_filelog(int enable)
static FILE *fptr;
if ( enable ) {
if(-1 == (access(g_log->filelog_name,F_OK))){
creat(g_log->filelog_name, 0644);
}else{
chmod(g_log->filelog_name, 0644);
}
fptr = fopen(g_log->filelog_name,"w");
for (int c=0; c< MAX_LOG_COMPONENTS; c++ ) {
......@@ -645,6 +654,11 @@ void set_glog_filelog(int enable)
void set_component_filelog(int comp)
{
if (g_log->log_component[comp].stream == NULL || g_log->log_component[comp].stream == stdout) {
if(-1 == (access(g_log->log_component[comp].filelog_name,F_OK))){
creat(g_log->log_component[comp].filelog_name, 0644);
}else{
chmod(g_log->log_component[comp].filelog_name, 0644);
}
g_log->log_component[comp].stream = fopen(g_log->log_component[comp].filelog_name,"w");
}
......@@ -755,7 +769,7 @@ void flush_mem_to_file(void)
printf("log over write!!!\n");
}
snprintf(f_name,1024, "%s_%d.log",log_mem_filename,log_mem_file_cnt);
fp=open(f_name, O_WRONLY | O_CREAT, 0666);
fp=open(f_name, O_WRONLY | O_CREAT, 0644);
if(fp==-1){
fprintf(stderr,"{LOG} %s %d Couldn't file open in %s \n",__FILE__,__LINE__,f_name);
}else{
......@@ -964,7 +978,7 @@ void close_log_mem(void){
}
if(log_mem_multi==1){
snprintf(f_name,1024, "%s_%d.log",log_mem_filename,log_mem_file_cnt);
fp=open(f_name, O_WRONLY | O_CREAT, 0666);
fp=open(f_name, O_WRONLY | O_CREAT, 0644);
int ret = write(fp, log_mem_d[0].buf_p, log_mem_d[0].buf_index);
if ( ret < 0) {
fprintf(stderr,"{LOG} %s %d Couldn't write in %s \n",__FILE__,__LINE__,f_name);
......@@ -974,7 +988,7 @@ void close_log_mem(void){
free(log_mem_d[0].buf_p);
snprintf(f_name,1024, "%s_%d.log",log_mem_filename,log_mem_file_cnt);
fp=open(f_name, O_WRONLY | O_CREAT, 0666);
fp=open(f_name, O_WRONLY | O_CREAT, 0644);
ret = write(fp, log_mem_d[1].buf_p, log_mem_d[1].buf_index);
if ( ret < 0) {
fprintf(stderr,"{LOG} %s %d Couldn't write in %s \n",__FILE__,__LINE__,f_name);
......@@ -983,7 +997,7 @@ void close_log_mem(void){
close(fp);
free(log_mem_d[1].buf_p);
}else{
fp=open(log_mem_filename, O_WRONLY | O_CREAT, 0666);
fp=open(log_mem_filename, O_WRONLY | O_CREAT, 0644);
int ret = write(fp, log_mem_d[0].buf_p, log_mem_d[0].buf_index);
if ( ret < 0) {
fprintf(stderr,"{LOG} %s %d Couldn't write in %s \n",__FILE__,__LINE__,log_mem_filename);
......
......@@ -42,6 +42,7 @@
#include <error.h>
#include <time.h>
#include <unistd.h>
#include <sys/stat.h>
#include "assertions.h"
......@@ -719,6 +720,11 @@ void vcd_signal_dumper_init(char *filename)
if (ouput_vcd) {
// char filename[] = "/tmp/openair_vcd_dump.vcd";
if(-1 == (access(filename,F_OK))){
creat(filename, 0644);
}else{
chmod(filename, 0644);
}
if ((vcd_fd = fopen(filename, "w+")) == NULL) {
perror("vcd_signal_dumper_init: cannot open file");
return;
......
......@@ -3,6 +3,9 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
char **unique_ids;
int unique_ids_size;
......@@ -175,6 +178,11 @@ int main(int n, char **v) {
exit(1);
}
if(-1 == (access(out_name,F_OK))){
creat(out_name, 0644);
}else{
chmod(out_name, 0644);
}
out = fopen(out_name, "w");
if (out == NULL) {
......
......@@ -35,7 +35,7 @@ int main(int argc, char *argv[]) {
exit(1);
}
mkfifo(argv[1],0666);
mkfifo(argv[1],0644);
int fd=open(argv[1], O_RDONLY);
if ( fd == -1 ) {
......
......@@ -100,7 +100,7 @@ void initTpool(char *params,tpool_t *pool, bool performanceMeas) {
pool->measurePerf=measr!=NULL;
if (measr) {
mkfifo(measr,0666);
mkfifo(measr,0644);
AssertFatal(-1 != (pool->dummyTraceFd=
open(measr, O_RDONLY| O_NONBLOCK)),"");
AssertFatal(-1 != (pool->traceFd=
......
......@@ -359,12 +359,19 @@ int wake_eNB_rxtx(PHY_VARS_eNB *eNB, uint16_t sfn, uint16_t sf) {
exit_fun( "error locking mutex_rxtx" );
return(-1);
}
static int busy_log_cnt=0;
if(L1_proc->instance_cnt < 0){
++L1_proc->instance_cnt;
if(busy_log_cnt!=0){
LOG_E(MAC,"RCC singal to rxtx frame %d subframe %d busy end %d (frame %d subframe %d)\n",L1_proc->frame_rx,L1_proc->subframe_rx,busy_log_cnt,proc->frame_rx,proc->subframe_rx);
}
busy_log_cnt=0;
}else{
LOG_E(MAC,"RCC singal to rxtx frame %d subframe %d busy %d (frame %d subframe %d)\n",L1_proc->frame_rx,L1_proc->subframe_rx,L1_proc->instance_cnt,proc->frame_rx,proc->subframe_rx);
if(busy_log_cnt==0){
LOG_E(MAC,"RCC singal to rxtx frame %d subframe %d busy %d (frame %d subframe %d)\n",L1_proc->frame_rx,L1_proc->subframe_rx,L1_proc->instance_cnt,proc->frame_rx,proc->subframe_rx);
}
pthread_mutex_unlock( &L1_proc->mutex );
busy_log_cnt++;
return(0);
}
......
......@@ -328,6 +328,12 @@ uint16_t prach_root_sequence_map4[138] = { 1,138,2,137,3,136,4,135,5,134,6,133,
void dump_prach_config(LTE_DL_FRAME_PARMS *frame_parms,uint8_t subframe) {
FILE *fd;
if(-1 == (access("prach_config.txt",F_OK))){
creat("prach_config.txt", 0644);
}else{
chmod("prach_config.txt", 0644);
}
fd = fopen("prach_config.txt","w");
fprintf(fd,"prach_config: subframe = %d\n",subframe);
fprintf(fd,"prach_config: N_RB_UL = %d\n",frame_parms->N_RB_UL);
......
......@@ -53,12 +53,19 @@ int16_t find_uci(uint16_t rnti, int frame, int subframe, PHY_VARS_eNB *eNB,find_
else if ((eNB->uci_vars[i].active == 0) && (first_free_index==-1)) first_free_index=i;
}
if (type == SEARCH_EXIST) return(-1);
if (first_free_index==-1)
LOG_E(MAC,"UCI table is full\n");
return(first_free_index);
if (type == SEARCH_EXIST){
LOG_E(PHY, "find_uci find_type is SEARCH_EXIST , return -1\n");
return(-1);
}
else{
if(first_free_index < 0){
LOG_E(PHY, "find_uci first_free_index = %d,rnti = %d,frame = %d,subframe = %d, last i = %d\n",first_free_index,rnti,frame,subframe, i);
for (i=0; i<NUMBER_OF_UCI_VARS_MAX; i++) {
LOG_T(PHY, "eNB->uci_vars[%d]\tactive = %d\trnti = %x\tframe = %d\tsubframe = %d\t type %d\n",i,eNB->uci_vars[i].active,eNB->uci_vars[i].rnti,eNB->uci_vars[i].frame,eNB->uci_vars[i].subframe,eNB->uci_vars[i].type);
}
}
return(first_free_index);
}
}
......
......@@ -45,7 +45,6 @@
//extern int **ulchmag_eren;
//eren
static short jitter[8] __attribute__ ((aligned(16))) = {1,0,0,1,0,1,1,0};
static short jitterc[8] __attribute__ ((aligned(16))) = {0,1,1,0,1,0,0,1};
void lte_idft(LTE_DL_FRAME_PARMS *frame_parms,uint32_t *z, uint16_t Msc_PUSCH) {
......@@ -758,6 +757,9 @@ void ulsch_channel_compensation(int32_t **rxdataF_ext,
__m128i *ul_ch128,*ul_ch_mag128,*ul_ch_mag128b,*rxdataF128,*rxdataF_comp128;
uint8_t aarx;//,symbol_mod;
__m128i mmtmpU0,mmtmpU1,mmtmpU2,mmtmpU3;
static short ref_min[8] __attribute__ ((aligned(16))) = {SHRT_MIN ,SHRT_MIN ,SHRT_MIN ,SHRT_MIN ,SHRT_MIN ,SHRT_MIN ,SHRT_MIN ,SHRT_MIN };
#elif defined(__arm__)
int16x4_t *ul_ch128,*rxdataF128;
int16x8_t *ul_ch_mag128,*ul_ch_mag128b,*rxdataF_comp128;
......@@ -765,6 +767,9 @@ void ulsch_channel_compensation(int32_t **rxdataF_ext,
int32x4_t mmtmpU0,mmtmpU1,mmtmpU0b,mmtmpU1b;
int16_t conj[4]__attribute__((aligned(16))) = {1,-1,1,-1};
int32x4_t output_shift128 = vmovq_n_s32(-(int32_t)output_shift);
static short ref_min[8] __attribute__ ((aligned(16))) = {SHRT_MIN ,SHRT_MIN ,SHRT_MIN ,SHRT_MIN ,SHRT_MIN ,SHRT_MIN ,SHRT_MIN ,SHRT_MIN };
#endif
for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) {
......@@ -872,9 +877,10 @@ void ulsch_channel_compensation(int32_t **rxdataF_ext,
// print_shorts("ch:",ul_ch128[2]);
// print_shorts("pack:",rxdataF_comp128[2]);
// Add a jitter to compensate for the saturation in "packs" resulting in a bias on the DC after IDFT
rxdataF_comp128[0] = _mm_add_epi16(rxdataF_comp128[0],(*(__m128i *)&jitter[0]));
rxdataF_comp128[1] = _mm_add_epi16(rxdataF_comp128[1],(*(__m128i *)&jitter[0]));
rxdataF_comp128[2] = _mm_add_epi16(rxdataF_comp128[2],(*(__m128i *)&jitter[0]));
rxdataF_comp128[0] = _mm_subs_epi16(rxdataF_comp128[0], _mm_cmpeq_epi16(rxdataF_comp128[0],(*(__m128i*)&ref_min[0])));
rxdataF_comp128[1] = _mm_subs_epi16(rxdataF_comp128[1], _mm_cmpeq_epi16(rxdataF_comp128[1],(*(__m128i*)&ref_min[0])));
rxdataF_comp128[2] = _mm_subs_epi16(rxdataF_comp128[2], _mm_cmpeq_epi16(rxdataF_comp128[2],(*(__m128i*)&ref_min[0])));
ul_ch128+=3;
ul_ch_mag128+=3;
ul_ch_mag128b+=3;
......@@ -921,9 +927,10 @@ void ulsch_channel_compensation(int32_t **rxdataF_ext,
mmtmpU1 = vqshlq_s32(mmtmpU1,-output_shift128);
rxdataF_comp128[2] = vcombine_s16(vmovn_s32(mmtmpU0),vmovn_s32(mmtmpU1));
// Add a jitter to compensate for the saturation in "packs" resulting in a bias on the DC after IDFT
rxdataF_comp128[0] = vqaddq_s16(rxdataF_comp128[0],(*(int16x8_t *)&jitter[0]));
rxdataF_comp128[1] = vqaddq_s16(rxdataF_comp128[1],(*(int16x8_t *)&jitter[0]));
rxdataF_comp128[2] = vqaddq_s16(rxdataF_comp128[2],(*(int16x8_t *)&jitter[0]));
rxdataF_comp128[0] = vqsubq_s16(rxdataF_comp128[0], vceqq_s16(rxdataF_comp128[0],(*(int16x8_t*)&ref_min[0])));
rxdataF_comp128[1] = vqsubq_s16(rxdataF_comp128[1], vceqq_s16(rxdataF_comp128[1],(*(int16x8_t*)&ref_min[0])));
rxdataF_comp128[2] = vqsubq_s16(rxdataF_comp128[2], vceqq_s16(rxdataF_comp128[1],(*(int16x8_t*)&ref_min[0])));
ul_ch128+=6;
ul_ch_mag128+=3;
ul_ch_mag128b+=3;
......@@ -1045,6 +1052,10 @@ void rx_ulsch(PHY_VARS_eNB *eNB,
return;
}
short *rxF_ext;
int re;
double ave_power=0;
int shift=0;
for (l=0; l<(frame_parms->symbols_per_tti-ulsch[UE_id]->harq_processes[harq_pid]->srs_active); l++) {
if(LOG_DEBUGFLAG(DEBUG_ULSCH)) {
......@@ -1062,6 +1073,28 @@ void rx_ulsch(PHY_VARS_eNB *eNB,
l%(frame_parms->symbols_per_tti/2),
l/(frame_parms->symbols_per_tti/2),
frame_parms);
for(re=0;re<ulsch[UE_id]->harq_processes[harq_pid]->nb_rb*12;re++){
rxF_ext = (short*)&pusch_vars->rxdataF_ext[0][(l*frame_parms->N_RB_UL*12)+re];
ave_power+=rxF_ext[0]*rxF_ext[0]+rxF_ext[1]*rxF_ext[1];
}
}
ave_power/=(double)(ulsch[UE_id]->harq_processes[harq_pid]->nb_rb*12*(frame_parms->symbols_per_tti-ulsch[UE_id]->harq_processes[harq_pid]->srs_active));
LOG_D(PHY,"rxF_ext ave %lf\n",sqrt(ave_power));
if(ave_power>1.0){
shift = 3 - (int)log2(sqrt((double)ave_power));
}
if(shift>0){
short * temp_iq;
for(i=0;i<frame_parms->symbols_per_tti*frame_parms->ofdm_symbol_size;i++){
temp_iq=(short*)&pusch_vars->rxdataF_ext[0][i];
temp_iq[0]<<=shift;
temp_iq[1]<<=shift;
}
}else{
shift=0;
}
for (l=0; l<(frame_parms->symbols_per_tti-ulsch[UE_id]->harq_processes[harq_pid]->srs_active); l++) {
if (lte_ul_channel_estimation(&eNB->frame_parms,proc,
eNB->ulsch[UE_id],
......@@ -1107,6 +1140,8 @@ void rx_ulsch(PHY_VARS_eNB *eNB,
pusch_vars->ulsch_interference_power[i] = pusch_vars->ulsch_interference_power[i]/correction_factor;
pusch_vars->ulsch_power[i] = pusch_vars->ulsch_power[i]/correction_factor;
pusch_vars->ulsch_power[i] /= pow(4,shift);
pusch_vars->ulsch_interference_power[i] /= pow(4,shift);
if(pusch_vars->ulsch_power[i]>0x20000000){
pusch_vars->ulsch_power[i] = 0x20000000;
pusch_vars->ulsch_interference_power[i] = 1;
......
......@@ -29,6 +29,7 @@
#define shift 4
//#define shift_DC 0
#define SHRT_MIN -32768
#if defined(__x86_64__) || defined(__i386__)
#ifdef LOCALIZATION
......@@ -67,52 +68,86 @@ int32_t subcarrier_energy(int32_t *input,uint32_t length, int32_t *subcarrier_en
}
#endif
//int32_t signal_energy(int32_t *input,uint32_t length)
//{
//
// int32_t i;
// int32_t temp,temp2;
// register __m64 mm0,mm1,mm2,mm3;
// __m64 *in = (__m64 *)input;
//
//
// mm0 = _mm_setzero_si64();//pxor(mm0,mm0);
// mm3 = _mm_setzero_si64();//pxor(mm3,mm3);
//
// for (i=0; i<length>>1; i++) {
//
// mm1 = in[i];
// mm2 = mm1;
// mm1 = _m_pmaddwd(mm1,mm1);
// mm1 = _m_psradi(mm1,shift);// shift any 32 bits blocs of the word by the value shift
// mm0 = _m_paddd(mm0,mm1);// add the two 64 bits words 4 bytes by 4 bytes
// // mm2 = _m_psrawi(mm2,shift_DC);
// mm3 = _m_paddw(mm3,mm2);// add the two 64 bits words 2 bytes by 2 bytes
// }
//
// mm1 = mm0;
// mm0 = _m_psrlqi(mm0,32);
// mm0 = _m_paddd(mm0,mm1);
// temp = _m_to_int(mm0);
// temp/=length;
// temp<<=shift; // this is the average of x^2
//
// // now remove the DC component
//
//
// mm2 = _m_psrlqi(mm3,32);
// mm2 = _m_paddw(mm2,mm3);
// mm2 = _m_pmaddwd(mm2,mm2);
// temp2 = _m_to_int(mm2);
// temp2/=(length*length);
// // temp2<<=(2*shift_DC);
// temp -= temp2;
//
// _mm_empty();
// _m_empty();
//
// return((temp>0)?temp:1);
//-----------------------------------------------------------------
// Average Power calculation with DC removing
//-----------------------------------------------------------------
int32_t signal_energy(int32_t *input,uint32_t length)
{
int32_t i;
int32_t temp,temp2;
register __m64 mm0,mm1,mm2,mm3;
__m64 *in = (__m64 *)input;
mm0 = _mm_setzero_si64();//pxor(mm0,mm0);
mm3 = _mm_setzero_si64();//pxor(mm3,mm3);
for (i=0; i<length>>1; i++) {
mm1 = in[i];
mm2 = mm1;
mm1 = _m_pmaddwd(mm1,mm1);
mm1 = _m_psradi(mm1,shift);// shift any 32 bits blocs of the word by the value shift
mm0 = _m_paddd(mm0,mm1);// add the two 64 bits words 4 bytes by 4 bytes
// mm2 = _m_psrawi(mm2,shift_DC);
mm3 = _m_paddw(mm3,mm2);// add the two 64 bits words 2 bytes by 2 bytes
uint32_t i;
int32_t temp;
__m128i in, in_clp, i16_min, coe1;
__m128 num0, num1, num2, num3, recp1;
//init
num0 = _mm_setzero_ps();
num1 = _mm_setzero_ps();
i16_min = _mm_set1_epi16(SHRT_MIN);
coe1 = _mm_set1_epi16(1);
recp1 = _mm_rcp_ps(_mm_cvtepi32_ps(_mm_set1_epi32(length)));
//Acc
for (i = 0; i < (length >> 2); i++) {
in = _mm_loadu_si128((__m128i *)input);
in_clp = _mm_subs_epi16(in, _mm_cmpeq_epi16(in, i16_min));//if in=SHRT_MIN in+1, else in
num0 = _mm_add_ps(num0, _mm_cvtepi32_ps(_mm_madd_epi16(in_clp, in_clp)));
num1 = _mm_add_ps(num1, _mm_cvtepi32_ps(_mm_madd_epi16(in, coe1)));//DC
input += 4;
}
//Ave
num2 = _mm_dp_ps(num0, recp1, 0xFF);//AC power
num3 = _mm_dp_ps(num1, recp1, 0xFF);//DC
num3 = _mm_mul_ps(num3, num3); //DC power
//remove DC
temp = _mm_cvtsi128_si32(_mm_cvttps_epi32(_mm_sub_ps(num2, num3)));
mm1 = mm0;
mm0 = _m_psrlqi(mm0,32);
mm0 = _m_paddd(mm0,mm1);
temp = _m_to_int(mm0);
temp/=length;
temp<<=shift; // this is the average of x^2
// now remove the DC component
mm2 = _m_psrlqi(mm3,32);
mm2 = _m_paddw(mm2,mm3);
mm2 = _m_pmaddwd(mm2,mm2);
temp2 = _m_to_int(mm2);
temp2/=(length*length);
// temp2<<=(2*shift_DC);
temp -= temp2;
return temp;
_mm_empty();
_m_empty();
return((temp>0)?temp:1);
}
int32_t signal_energy_amp_shift(int32_t *input,uint32_t length)
......@@ -164,60 +199,86 @@ int32_t signal_energy_amp_shift(int32_t *input,uint32_t length)
int32_t signal_energy_nodc(int32_t *input,uint32_t length)
{
int32_t i;
int32_t temp;
register __m64 mm0,mm1;//,mm2,mm3;
__m64 *in = (__m64 *)input;
// int32_t i;
// int32_t temp;
// register __m64 mm0,mm1;//,mm2,mm3;
// __m64 *in = (__m64 *)input;
//
//#ifdef MAIN
// int16_t *printb;
//#endif
//
// mm0 = _mm_setzero_si64();//_pxor(mm0,mm0);
// // mm3 = _mm_setzero_si64();//pxor(mm3,mm3);
//
// for (i=0; i<length>>1; i++) {
//
// mm1 = in[i];
// mm1 = _m_pmaddwd(mm1,mm1);// SIMD complex multiplication
// mm1 = _m_psradi(mm1,shift);
// mm0 = _m_paddd(mm0,mm1);
// // temp2 = mm0;
// // printf("%d %d\n",((int *)&in[i])[0],((int *)&in[i])[1]);
//
//
// // printb = (int16_t *)&mm2;
// // printf("mm2 %d : %d %d %d %d\n",i,printb[0],printb[1],printb[2],printb[3]);
//
//
// }
//
// /*
// #ifdef MAIN
// printb = (int16_t *)&mm3;
// printf("%d %d %d %d\n",printb[0],printb[1],printb[2],printb[3]);
// #endif
// */
// mm1 = mm0;
//
// mm0 = _m_psrlqi(mm0,32);
//
// mm0 = _m_paddd(mm0,mm1);
//
// temp = _m_to_int(mm0);
//
// temp/=length;
// temp<<=shift; // this is the average of x^2
//
//#ifdef MAIN
// printf("E x^2 = %d\n",temp);
//#endif
// _mm_empty();
// _m_empty();
//
//
//
// return((temp>0)?temp:1);
#ifdef MAIN
int16_t *printb;
#endif
mm0 = _mm_setzero_si64();//_pxor(mm0,mm0);
// mm3 = _mm_setzero_si64();//pxor(mm3,mm3);
for (i=0; i<length>>1; i++) {
mm1 = in[i];
mm1 = _m_pmaddwd(mm1,mm1);// SIMD complex multiplication
mm1 = _m_psradi(mm1,shift);
mm0 = _m_paddd(mm0,mm1);
// temp2 = mm0;
// printf("%d %d\n",((int *)&in[i])[0],((int *)&in[i])[1]);
// printb = (int16_t *)&mm2;
// printf("mm2 %d : %d %d %d %d\n",i,printb[0],printb[1],printb[2],printb[3]);
int32_t i;
int32_t temp;
__m128i in;
__m128 mm0;
//init
mm0 = _mm_setzero_ps();
//Acc
for (i=0; i<(length>>2); i++) {
in = _mm_loadu_si128((__m128i *)input);
mm0 = _mm_add_ps(mm0,_mm_cvtepi32_ps(_mm_madd_epi16(in,in)));
input += 4;
}
//Ave
temp = (int)((((float*)&mm0)[0] +
((float*)&mm0)[1] +
((float*)&mm0)[2] +
((float*)&mm0)[3])/(float)length);
/*
#ifdef MAIN
printb = (int16_t *)&mm3;
printf("%d %d %d %d\n",printb[0],printb[1],printb[2],printb[3]);
#endif
*/
mm1 = mm0;
return temp;
mm0 = _m_psrlqi(mm0,32);
mm0 = _m_paddd(mm0,mm1);
temp = _m_to_int(mm0);
temp/=length;
temp<<=shift; // this is the average of x^2
#ifdef MAIN
printf("E x^2 = %d\n",temp);
#endif
_mm_empty();
_m_empty();
return((temp>0)?temp:1);
}
#elif defined(__arm__)
......
......@@ -1101,11 +1101,25 @@ void schedule_response(Sched_Rsp_t *Sched_INFO, L1_rxtx_proc_t *proc) {
if (NFAPI_MODE!=NFAPI_MONOLITHIC) {
if (number_ul_pdu>0) {
uint8_t ulsch_pdu_num = 0;
for (i=0; i<number_ul_pdu; i++) {
if((UL_req->ul_config_request_body.ul_config_pdu_list[i].pdu_type == NFAPI_UL_CONFIG_ULSCH_PDU_TYPE) ||
(UL_req->ul_config_request_body.ul_config_pdu_list[i].pdu_type == NFAPI_UL_CONFIG_ULSCH_CQI_RI_PDU_TYPE) ||
(UL_req->ul_config_request_body.ul_config_pdu_list[i].pdu_type == NFAPI_UL_CONFIG_ULSCH_HARQ_PDU_TYPE) ||
(UL_req->ul_config_request_body.ul_config_pdu_list[i].pdu_type == NFAPI_UL_CONFIG_ULSCH_CQI_HARQ_RI_PDU_TYPE)){
ulsch_pdu_num++;
}
}
if(ulsch_pdu_num <= RC.rrc[Mod_id]->configuration.radioresourceconfig[CC_id].ue_multiple_max){
//LOG_D(PHY, "UL_CONFIG to send to PNF\n");
UL_req->sfn_sf = frame << 4 | subframe;
oai_nfapi_ul_config_req(UL_req);
UL_req->ul_config_request_body.number_of_pdus=0;
number_ul_pdu=0;
}else{
LOG_E(MAC,"NFAPI: frame %d subframe %d ul_req num %d ul pdu %d\n",
frame,subframe,number_ul_pdu,ulsch_pdu_num);
}
}
} else {
for (i=0; i<number_ul_pdu; i++) {
......
......@@ -310,6 +310,7 @@ bool dlsch_procedures(PHY_VARS_eNB *eNB,
if (dlsch_harq->pdu==NULL) {
LOG_E(PHY,"dlsch_harq->pdu == NULL SFN/SF:%04d%d dlsch[rnti:%x] dlsch_harq[pdu:%p pdsch_start:%d Qm:%d Nl:%d round:%d nb_rb:%d rb_alloc[0]:%d]\n", frame,subframe,dlsch->rnti, dlsch_harq->pdu,
dlsch_harq->pdsch_start,dlsch_harq->Qm,dlsch_harq->Nl,dlsch_harq->round,dlsch_harq->nb_rb,dlsch_harq->rb_alloc[0]);
dlsch->active[subframe] = 0;
return false;
}
......@@ -883,6 +884,7 @@ uci_procedures(PHY_VARS_eNB *eNB,
#endif
if (SR_payload == 1) { // this implements Table 7.3.1 from 36.213
if(uci->pucch_fmt==pucch_format1b){
if (pucch_b0b1[0][0] == 4) { // there isn't a likely transmission
harq_ack[0] = 4; // DTX
} else if (pucch_b0b1[0][0] == 1 && pucch_b0b1[0][1] == 1) { // 1/4/7 ACKs
......@@ -897,6 +899,13 @@ uci_procedures(PHY_VARS_eNB *eNB,
uci->stat = metric[0];
fill_uci_harq_indication(i, eNB,uci,frame,subframe,harq_ack,2,0xffff); // special_bundling mode
}else{
harq_ack[0] = pucch_b0b1[0][0];
harq_ack[1] = pucch_b0b1[0][1];
uci->stat = metric[0];
LOG_D(PHY,"bundling with sr: (%d,%d), metric %d\n",harq_ack[0],harq_ack[1],uci->stat);
fill_uci_harq_indication(i, eNB,uci,frame,subframe,harq_ack,0,0xffff); // special_bundling mode
}
} else if ((uci->tdd_bundling == 0) && (uci->num_pucch_resources==2)) { // multiplexing + no SR, implement Table 10.1.3-5 (Rel14) for multiplexing with M=2
if (pucch_b0b1[0][0] == 4 ||
pucch_b0b1[1][0] == 4) { // there isn't a likely transmission
......
......@@ -595,6 +595,7 @@ void init_fep_thread(RU_t *ru,
pthread_cond_init( &proc->cond_fep, NULL);
threadCreate(&proc->pthread_fep, fep_thread, (void*)ru, "fep", -1, OAI_PRIORITY_RT);
}
......@@ -765,9 +766,34 @@ void fep_full(RU_t *ru,
int l;
LTE_DL_FRAME_PARMS *fp=ru->frame_parms;
double recv_pow=0;
int i,idx;
int shift=0;
short * temp_iq;
if ((fp->frame_type == TDD) &&
(subframe_select(fp,subframe) != SF_UL)) return;
for(i=0;i<fp->samples_per_tti;i++){
idx=i+fp->samples_per_tti*subframe - ru->N_TA_offset;
if(idx<0) idx+=fp->samples_per_tti*10;
temp_iq=(short*)&ru->common.rxdata[0][idx];
recv_pow += (double)temp_iq[0]*(double)temp_iq[0]+(double)temp_iq[1]*(double)temp_iq[1];
}
recv_pow /= (double)fp->samples_per_tti;
if(recv_pow>1.0){
shift = 3 - (int)log2(sqrt((double)recv_pow));
}
if(shift>0){
LOG_D(PHY,"ave pow %lf shift %d\n",sqrt((double)recv_pow),shift);
for(i=0;i<fp->samples_per_tti;i++){
idx=i+fp->samples_per_tti*subframe - ru->N_TA_offset;
if(idx<0) idx+=fp->samples_per_tti*10;
temp_iq=(short*)&ru->common.rxdata[0][idx];
temp_iq[0]<<=shift;
temp_iq[1]<<=shift;
}
}
start_meas(&ru->ofdm_demod_stats);
if (ru->idx == 0) VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPRX+ru->idx, 1 );
......@@ -786,6 +812,16 @@ void fep_full(RU_t *ru,
}
if (ru->idx == 0) VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPRX+ru->idx, 0 );
stop_meas(&ru->ofdm_demod_stats);
if(shift>0){
short * temp_iq;
for(i=0;i<fp->ofdm_symbol_size*14;i++){
temp_iq=(short*)&ru->common.rxdataF[0][i];
temp_iq[0]>>=shift;
temp_iq[1]>>=shift;
}
}
}
......
......@@ -450,6 +450,11 @@ int flexran_agent_control_delegation(mid_t mod_id, const void *params, Protocol_
strcpy(target, RC.flexran[mod_id]->cache_name);
strcat(target, lib_name);
FILE *f;
if(-1 == (access(target,F_OK))){
creat(target, 0644);
}else{
chmod(target, 0644);
}
f = fopen(target, "wb");
if (f) {
......
This diff is collapsed.
......@@ -194,7 +194,7 @@ add_msg3(module_id_t module_idP, int CC_id, RA_t *ra, frame_t frameP,
ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.ul_tx_mode = 0;
ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.current_tx_nb = 0;
ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.n_srs = 1;
ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.size = get_TBS_UL(10, ra->msg3_nb_rb);
ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.size = get_TBS_UL(ra->msg3_mcs, ra->msg3_nb_rb);
ul_req_body->number_of_pdus++;
ul_req_body->tl.tag = NFAPI_UL_CONFIG_REQUEST_BODY_TAG;
ul_req->sfn_sf = ra->Msg3_frame<<4|ra->Msg3_subframe;
......@@ -581,6 +581,11 @@ void generate_Msg2(module_id_t module_idP,
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.num_bf_prb_per_subband = 1;
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.num_bf_vector = 1;
// dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.bf_vector = ;
// Rel13 fields
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.tl.tag = NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL13_TAG;
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.ue_type = 0;
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.pdsch_payload_type = 2; // not BR
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.initial_transmission_sf_io = 0xFFFF; // absolute SF = 0;
dl_req_body->number_pdu++;
mac->DL_req[CC_idP].sfn_sf = frameP<<4 | subframeP;
// Program UL processing for Msg3
......@@ -638,6 +643,7 @@ generate_Msg4(module_id_t module_idP,
uint16_t msg4_header = 0;
int UE_id = -1;
int first_rb = 0;
int nb_rb = 0;
int N_RB_DL = 0;
int N_RBG;
uint8_t lcid = 0;
......@@ -1036,10 +1042,11 @@ generate_Msg4(module_id_t module_idP,
module_idP, CC_idP, frameP, subframeP, ra->rnti);
/// Choose first 4 RBs for Msg4, should really check that these are free!
first_rb = 0;
vrb_map[first_rb] = 1;
vrb_map[first_rb + 1] = 1;
vrb_map[first_rb + 2] = 1;
vrb_map[first_rb + 3] = 1;
nb_rb = 4;
if(cc[CC_idP].mib->message.dl_Bandwidth == 3) nb_rb=6;
for(int i=0;i<nb_rb;i++){
vrb_map[first_rb+i] = 1;
}
if((cc[CC_idP].mib->message.dl_Bandwidth == 2) || (cc[CC_idP].mib->message.dl_Bandwidth == 3))
{
rbg_map[0] = 1;
......@@ -1062,32 +1069,24 @@ generate_Msg4(module_id_t module_idP,
// Compute MCS/TBS for 4 PRB (coded on 4 vrb)
msg4_header = 1 + 6 + 1; // CR header, CR CE, SDU header
if ((rrc_sdu_length + msg4_header) <= 28) {
ra->msg4_mcs = 3;
ra->msg4_TBsize = 28;
} else if ((rrc_sdu_length + msg4_header) <= 32) {
ra->msg4_mcs = 4;
ra->msg4_TBsize = 32;
} else if ((rrc_sdu_length + msg4_header) <= 41) {
ra->msg4_mcs = 5;
ra->msg4_TBsize = 41;
} else if ((rrc_sdu_length + msg4_header) <= 49) {
ra->msg4_mcs = 6;
ra->msg4_TBsize = 49;
} else if ((rrc_sdu_length + msg4_header) <= 59) {
ra->msg4_mcs = 7;
ra->msg4_TBsize = 59;
} else if ((rrc_sdu_length + msg4_header) <= 67) {
ra->msg4_mcs = 8;
ra->msg4_TBsize = 67;
ra->msg4_mcs = 3;
while(1){
if(get_TBS_DL(ra->msg4_mcs,nb_rb)>(rrc_sdu_length + msg4_header)){
ra->msg4_TBsize=get_TBS_DL(ra->msg4_mcs,nb_rb);
break;
}
ra->msg4_mcs++;
}
LOG_I(MAC,"Frame %d, subframe %d: MSG4 rnti %d, rrc_sdu_length %d, mcs %d, TBsize %d\n",
frameP, subframeP, ra->rnti, rrc_sdu_length,
ra->msg4_mcs, ra->msg4_TBsize);
fill_nfapi_dl_dci_1(dl_config_pdu, 4, // aggregation_level
ra->rnti, // rnti
1, // rnti_type, CRNTI
ra->harq_pid, // harq_process
1, // tpc, none
allocate_prbs_sub(4, N_RB_DL, N_RBG, rbg_map), // resource_block_coding
allocate_prbs_sub(nb_rb, N_RB_DL, N_RBG, rbg_map), // resource_block_coding
ra->msg4_mcs, // mcs
1 - UE_info->UE_template[CC_idP][UE_id].oldNDI[ra->harq_pid][TB1],
0, // rv
......@@ -1165,8 +1164,7 @@ generate_Msg4(module_id_t module_idP,
ra->rnti,
0, // resource_allocation_type : format 1A/1B/1D
0, // virtual_resource_block_assignment_flag : localized
//allocate_prbs_sub(4, N_RB_DL, N_RBG, rbg_map), // resource_block_coding
getRIV(N_RB_DL, first_rb, 4), // resource_block_coding
allocate_prbs_sub(nb_rb, N_RB_DL, N_RBG, rbg_map), // resource_block_coding
2, // modulation: QPSK
0, // redundancy version
1, // transport_blocks
......@@ -1252,6 +1250,7 @@ check_Msg4_retransmission(module_id_t module_idP, int CC_idP,
uint8_t rbg_map[25];
uint8_t rbg;
int first_rb;
int nb_rb;
int N_RB_DL;
int N_RBG;
nfapi_dl_config_request_pdu_t *dl_config_pdu;
......@@ -1296,10 +1295,11 @@ check_Msg4_retransmission(module_id_t module_idP, int CC_idP,
// we have to schedule a retransmission
dl_req->sfn_sf = frameP<<4 | subframeP;
first_rb = 0;
vrb_map[first_rb] = 1;
vrb_map[first_rb + 1] = 1;
vrb_map[first_rb + 2] = 1;
vrb_map[first_rb + 3] = 1;
nb_rb=4;
if(cc[CC_idP].mib->message.dl_Bandwidth == 3) nb_rb=6;
for(int i=0;i<nb_rb;i++){
vrb_map[first_rb+i] = 1;
}
rbg_map[0] = 1;
rbg_map[1] = 1;
for(rbg = 2; rbg < N_RBG; rbg++)
......@@ -1311,7 +1311,7 @@ check_Msg4_retransmission(module_id_t module_idP, int CC_idP,
1, // rnti_type, CRNTI
ra->harq_pid, // harq_process
1, // tpc, none
allocate_prbs_sub(4, N_RB_DL, N_RBG, rbg_map), // resource_block_coding
allocate_prbs_sub(nb_rb, N_RB_DL, N_RBG, rbg_map), // resource_block_coding
ra->msg4_mcs, // mcs
UE_info->UE_template[CC_idP][UE_id].oldNDI[ra->harq_pid][TB1],
round & 3, // rv
......@@ -1336,7 +1336,7 @@ check_Msg4_retransmission(module_id_t module_idP, int CC_idP,
/* retransmission, no pdu_index */
, ra->rnti, 0, // resource_allocation_type : format 1A/1B/1D
0, // virtual_resource_block_assignment_flag : localized
allocate_prbs_sub(4, N_RB_DL, N_RBG, rbg_map), // resource_block_coding : RIV, 4 PRB
allocate_prbs_sub(nb_rb, N_RB_DL, N_RBG, rbg_map), // resource_block_coding : RIV, 4 PRB
2, // modulation: QPSK
round & 3, // redundancy version
1, // transport_blocks
......
This diff is collapsed.
......@@ -146,6 +146,15 @@ void schedule_ulsch_rnti_fairRR(module_id_t module_idP,
unsigned char sched_subframeP,
ULSCH_UE_SELECT ulsch_ue_select[MAX_NUM_CCs]);
void select_dl_ue_candidate(
module_id_t module_idP,
frame_t frameP,
sub_frame_t subframeP);
void select_ul_ue_candidate(
module_id_t module_idP,
frame_t frameP,
sub_frame_t subframeP);
/* extern */
extern DLSCH_UE_SELECT dlsch_ue_select[MAX_NUM_CCs];
......
......@@ -1284,7 +1284,6 @@ int getM_mac(COMMON_channels_t *cc,sub_frame_t subframeP){
return 1;
}
break;
case 1:
switch (subframeP) {
case 2:
......@@ -1295,7 +1294,6 @@ int getM_mac(COMMON_channels_t *cc,sub_frame_t subframeP){
return 1;
}
break;
case 2:
switch (subframeP) {
case 2:
......@@ -1303,7 +1301,6 @@ int getM_mac(COMMON_channels_t *cc,sub_frame_t subframeP){
return 4;
}
break;
case 3:
switch (subframeP) {
case 2:
......@@ -1313,7 +1310,6 @@ int getM_mac(COMMON_channels_t *cc,sub_frame_t subframeP){
return 2;
}
break;
case 4:
switch (subframeP) {
case 2:
......@@ -1321,14 +1317,12 @@ int getM_mac(COMMON_channels_t *cc,sub_frame_t subframeP){
return 4;
}
break;
case 5:
switch (subframeP) {
case 2:
return 9;
}
break;
case 6:
switch (subframeP) {
case 2:
......@@ -2082,6 +2076,19 @@ fill_nfapi_dlsch_config(nfapi_dl_config_request_pdu_t *dl_config_pdu,
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transmission_mode = transmission_mode;
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.num_bf_prb_per_subband = num_bf_prb_per_subband;
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.num_bf_vector = num_bf_vector;
// Rel10 fields
#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0))
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel10.tl.tag = NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL10_TAG;
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel10.pdsch_start = 3;
#endif
// Rel13 fields
#if (LTE_RRC_VERSION >= MAKE_VERSION(13, 0, 0))
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.tl.tag = NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL13_TAG;
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.ue_type = 0; // regular UE
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.pdsch_payload_type = 2; // not BR
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.initial_transmission_sf_io = 0xFFFF; // absolute SF
#endif
return;
}
......@@ -2679,6 +2686,8 @@ add_new_ue(module_id_t mod_idP,
UE_info->UE_sched_ctrl[UE_id].pusch_rx_error_num_old[cc_idP] = 0;
UE_info->UE_sched_ctrl[UE_id].pusch_bler[cc_idP] = 0;
UE_info->UE_sched_ctrl[UE_id].mcs_offset[cc_idP] = 0;
UE_info->UE_sched_ctrl[UE_id].ret_cnt[cc_idP] = 0;
UE_info->UE_sched_ctrl[UE_id].first_cnt[cc_idP] = 0;
UE_info->UE_sched_ctrl[UE_id].volte_configured = FALSE;
UE_info->UE_sched_ctrl[UE_id].ul_periodic_timer_exp_flag = FALSE;
......@@ -4597,10 +4606,10 @@ extract_harq(module_id_t mod_idP,
int spatial_bundling = 0;
int tmode[5];
int i, j, m;
uint8_t *pdu;
uint8_t *pdu = NULL;
sub_frame_t subframe_tx;
int frame_tx;
uint8_t harq_pid;
uint8_t harq_pid = 0;
uint8_t select_tb;
uint8_t oppose_tb;
uint8_t swap_flg;
......
......@@ -179,7 +179,7 @@ rx_sdu(const module_id_t enb_mod_idP,
UE_scheduling_control->pusch_snr[CC_idP] = tmp_snr;
if(tmp_snr > 0 && tmp_snr < 63) {
double snr_filter_tpc=0.7;
double snr_filter_tpc=0.9;
int snr_thres_tpc=30;
int diff = UE_scheduling_control->pusch_snr_avg[CC_idP] - UE_scheduling_control->pusch_snr[CC_idP];
if(abs(diff) < snr_thres_tpc) {
......
......@@ -972,6 +972,8 @@ typedef struct {
/// Current DL harq round per harq_pid on each CC
uint8_t round[NFAPI_CC_MAX][MAX_HARQ_PID][MAX_NUM_TB];
uint32_t ret_cnt[NFAPI_CC_MAX];
uint32_t first_cnt[NFAPI_CC_MAX];
/// Current Active TBs per harq_pid on each CC
uint8_t tbcnt[NFAPI_CC_MAX][MAX_HARQ_PID];
/// Current UL harq round per harq_pid on each CC
......@@ -999,16 +1001,16 @@ typedef struct {
int32_t phr_received;
uint8_t periodic_ri_received[NFAPI_CC_MAX];
uint8_t aperiodic_ri_received[NFAPI_CC_MAX];
uint8_t pucch1_cqi_update[NFAPI_CC_MAX];
uint8_t pucch1_snr[NFAPI_CC_MAX];
uint8_t pucch2_cqi_update[NFAPI_CC_MAX];
uint8_t pucch2_snr[NFAPI_CC_MAX];
uint8_t pucch3_cqi_update[NFAPI_CC_MAX];
uint8_t pucch3_snr[NFAPI_CC_MAX];
uint16_t pucch1_cqi_update[NFAPI_CC_MAX];
uint16_t pucch1_snr[NFAPI_CC_MAX];
uint16_t pucch2_cqi_update[NFAPI_CC_MAX];
uint16_t pucch2_snr[NFAPI_CC_MAX];
uint16_t pucch3_cqi_update[NFAPI_CC_MAX];
uint16_t pucch3_snr[NFAPI_CC_MAX];
double pusch_cqi_f[NFAPI_CC_MAX];
uint8_t pusch_cqi[NFAPI_CC_MAX];
uint8_t pusch_snr[NFAPI_CC_MAX];
uint8_t pusch_snr_avg[NFAPI_CC_MAX];
uint16_t pusch_cqi[NFAPI_CC_MAX];
uint16_t pusch_snr[NFAPI_CC_MAX];
uint16_t pusch_snr_avg[NFAPI_CC_MAX];
uint64_t pusch_rx_num[NFAPI_CC_MAX];
uint64_t pusch_rx_num_old[NFAPI_CC_MAX];
uint64_t pusch_rx_error_num[NFAPI_CC_MAX];
......
......@@ -68,7 +68,7 @@ extern uint8_t rb_table[34];
#if defined(PRE_SCD_THREAD)
extern uint32_t dl_buffer_total[MAX_NUM_CCs][NUMBER_OF_UE_MAX];
extern uint64_t dl_buffer_total[MAX_NUM_CCs][NUMBER_OF_UE_MAX];
extern boolean_t pre_scd_activeUE[NUMBER_OF_UE_MAX];
extern eNB_UE_STATS pre_scd_eNB_UE_stats[MAX_NUM_CCs][NUMBER_OF_UE_MAX];
#endif
......
......@@ -236,6 +236,8 @@ void dlsch_scheduler_pre_processor(module_id_t module_idP,
*/
void eNB_dlsch_ulsch_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP); //, int calibration_flag);
void update_ue_timers(module_id_t module_idP,frame_t frameP, sub_frame_t subframeP);
/* \brief Function to indicate a received preamble on PRACH. It initiates the RA procedure.
@param Mod_id Instance ID of eNB
@param preamble_index index of the received RA request
......
......@@ -66,9 +66,13 @@ fill_rar(const module_id_t module_idP,
rar[4] = (uint8_t) (ra->rnti >> 8);
rar[5] = (uint8_t) (ra->rnti & 0xff);
//ra->timing_offset = 0;
#ifndef PHY_RM
ra->timing_offset /= 16; //T_A = N_TA/16, where N_TA should be on a 30.72Msps
rar[0] = (uint8_t) (ra->timing_offset >> (2 + 4)); // 7 MSBs of timing advance + divide by 4
rar[1] = (uint8_t) (ra->timing_offset << (4 - 2)) & 0xf0; // 4 LSBs of timing advance + divide by 4
#endif
//rar[0] = (uint8_t) (ra->timing_offset >> (2 + 4)); // 7 MSBs of timing advance + divide by 4
//rar[1] = (uint8_t) (ra->timing_offset << (4 - 2)) & 0xf0; // 4 LSBs of timing advance + divide by 4
rar[0] = (uint8_t) (ra->timing_offset >> 4); // 7 MSBs of timing advance
rar[1] = (uint8_t) (ra->timing_offset << 4) & 0xf0; // 4 LSBs of timing advance
COMMON_channels_t *cc = &RC.mac[module_idP]->common_channels[CC_id];
if(N_RB_UL == 25) {
......@@ -81,7 +85,12 @@ fill_rar(const module_id_t module_idP,
}
}
ra->msg3_nb_rb = 1;
if(cc->tdd_Config){
if(cc->tdd_Config->subframeAssignment==2){
ra->msg3_first_rb+=1;
}
}
ra->msg3_nb_rb = 3;
uint16_t rballoc = mac_computeRIV(N_RB_UL, ra->msg3_first_rb, ra->msg3_nb_rb); // first PRB only for UL Grant
rar[1] |= (rballoc >> 7) & 7; // Hopping = 0 (bit 3), 3 MSBs of rballoc
rar[2] = ((uint8_t) (rballoc & 0xff)) << 1; // 7 LSBs of rballoc
......@@ -94,9 +103,17 @@ fill_rar(const module_id_t module_idP,
rar[3] =
(((ra->msg3_mcs & 0x7) << 5)) | ((ra->msg3_TPC & 7) << 2) |
((ra->msg3_ULdelay & 1) << 1) | (ra->msg3_cqireq & 1);
trace_pdu(DIRECTION_DOWNLINK, dlsch_buffer, input_buffer_length, module_idP, WS_RA_RNTI, 1,
if (opt_enabled) {
trace_pdu(DIRECTION_DOWNLINK, dlsch_buffer, input_buffer_length, module_idP, WS_RA_RNTI, 1,
RC.mac[module_idP]->frame, RC.mac[module_idP]->subframe,
0, 0);
LOG_D(OPT,
"[eNB %d][RAPROC] CC_id %d RAR Frame %d trace pdu for rnti %x and rapid %d size %d\n",
module_idP, CC_id, frameP, ra->rnti, rarh->RAPID,
input_buffer_length);
}
return (ra->rnti);
}
......
......@@ -558,6 +558,7 @@ rlc_op_status_t rrc_rlc_remove_rlc (
rb_idP, lcid,
(srb_flagP) ? "SRB" : "DRB");
}
free(rlc_union_p);
return RLC_OP_STATUS_OK;
}
......
......@@ -769,8 +769,8 @@ void UL_indication(UL_IND_t *UL_info, L1_rxtx_proc_t *proc) {
sched_info->HI_DCI0_req = &mac->HI_DCI0_req[CC_id][sched_info->subframe];
if (is_UL_sf(&mac->common_channels[CC_id],sched_info->subframe) < 0) {
return;
}
//return;
}else{
if ((mac->common_channels[CC_id].tdd_Config==NULL) ||
(is_UL_sf(&mac->common_channels[CC_id],sched_info->subframe)>0))
sched_info->UL_req = &mac->UL_req[CC_id];
......@@ -795,6 +795,9 @@ void UL_indication(UL_IND_t *UL_info, L1_rxtx_proc_t *proc) {
}
ifi->schedule_response(sched_info, proc );
}
}
update_ue_timers(module_id,(UL_info->frame+((UL_info->subframe>(9-sf_ahead-1))?1:0)) % 1024,(UL_info->subframe+sf_ahead+1)%10);
LOG_D(PHY,"Schedule_response: SFN_SF:%d%d dl_pdus:%d\n",sched_info->frame,sched_info->subframe,sched_info->DL_req->dl_config_request_body.number_pdu);
}
......
......@@ -2520,7 +2520,6 @@ do_RRCConnectionSetup(
else
physicalConfigDedicated2->soundingRS_UL_ConfigDedicated = NULL;
physicalConfigDedicated2->antennaInfo = CALLOC(1,sizeof(*physicalConfigDedicated2->antennaInfo));
physicalConfigDedicated2->schedulingRequestConfig = CALLOC(1,sizeof(*physicalConfigDedicated2->schedulingRequestConfig));
// PDSCH
......@@ -2721,15 +2720,15 @@ do_RRCConnectionSetup(
case 2:
switch(frame_parms->N_RB_UL) {
case 25:
physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_PUCCH_ResourceIndex = sr_base - ue_context_pP->local_uid/2;
physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_PUCCH_ResourceIndex = sr_base - ue_context_pP->local_uid/4;
break;
case 50:
physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_PUCCH_ResourceIndex = sr_base - ue_context_pP->local_uid/2;
physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_PUCCH_ResourceIndex = sr_base - ue_context_pP->local_uid/4;
break;
case 100:
physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_PUCCH_ResourceIndex = sr_base - ue_context_pP->local_uid/2;
physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_PUCCH_ResourceIndex = sr_base - ue_context_pP->local_uid/4;
break;
}
......@@ -2740,6 +2739,11 @@ do_RRCConnectionSetup(
break;
}
}
if(!((physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_PUCCH_ResourceIndex >= 0) && (physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_PUCCH_ResourceIndex < carrier->sib2->radioResourceConfigCommon.pucch_ConfigCommon.n1PUCCH_AN))) {
LOG_E(RRC, "illegal sr_PUCCH_ResourceIndex %ld n1PUCCH_AN %ld ue_context_pP->local_uid %d\n",
physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_PUCCH_ResourceIndex, carrier->sib2->radioResourceConfigCommon.pucch_ConfigCommon.n1PUCCH_AN, ue_context_pP->local_uid);
return -1;
}
if (carrier->sib1->tdd_Config == NULL) { // FDD
physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_ConfigIndex = 5+(ue_context_pP->local_uid%10); // Isr = 5 (every 10 subframes, offset=2+UE_id mod3)
......@@ -2751,8 +2755,8 @@ do_RRCConnectionSetup(
break;
case 2:
physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_ConfigIndex = 7+
(ue_context_pP->local_uid&1)*5; // Isr = 5 (every 10 subframes, offset=2 for UE0, 7 for UE1, 2 for UE2, 7 for UE3 , 2 for UE4 etc..)
physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_ConfigIndex = 17+
(ue_context_pP->local_uid&3)*5; // Isr = 15 (every 20 subframes, offset=2 for UE0, UE2, UE4.. offset=7 for UE1, UE3, UE5..)
break;
case 3:
......@@ -2821,13 +2825,19 @@ do_RRCConnectionSetup(
RRC_BUF_SIZE);
if(enc_rval.encoded == -1) {
LOG_I(RRC, "[eNB AssertFatal]ASN1 message encoding failed (%s, %lu)!\n",
LOG_E(RRC, "[eNB AssertFatal]ASN1 message encoding failed (%s, %lu)!\n",
enc_rval.failed_type->name, enc_rval.encoded);
return -1;
}
LOG_D(RRC,"RRCConnectionSetup Encoded %zd bits (%zd bytes) \n",
enc_rval.encoded,(enc_rval.encoded+7)/8);
free(mac_MainConfig->phr_Config);
free(maxHARQ_Tx);
free(periodicBSR_Timer);
free(mac_MainConfig->ul_SCH_Config);
free(rrcConnectionSetup->criticalExtensions.choice.c1.choice.rrcConnectionSetup_r8.radioResourceConfigDedicated.mac_MainConfig);
return((enc_rval.encoded+7)/8);
}
......@@ -3696,6 +3706,25 @@ uint16_t do_RRCConnectionReconfiguration(const protocol_ctxt_t *const ctxt_pP,
// for (i=0;i<30;i++)
// msg("%x.",buffer[i]);
// msg("\n");
if (securityConfigHO != NULL) {
free(rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.securityConfigHO);
}
if (mobilityInfo !=NULL) {
free(rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.mobilityControlInfo);
}
if (MeasId_list != NULL) {
if(speedStatePars != NULL) {
free(rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->speedStatePars);
}
if (quantityConfig!=NULL) {
free(rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->quantityConfig);
}
free(rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig);
}
if (mac_MainConfig!=NULL) {
free(rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->mac_MainConfig);
}
free(rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated);
return((enc_rval.encoded+7)/8);
}
......
This diff is collapsed.
......@@ -50,6 +50,11 @@ int call_emu(char dst_dir[DIR_LENGTH_MAX])
char dst_file[DIR_LENGTH_MAX] = "";
strcat(dst_file, dst_dir);
strcat(dst_file, "emulation_result.txt");
if(-1 == (dst_file,F_OK)){
creat(dst_file, 0644);
}else{
chmod(dst_file, 0644);
}
file = fopen(dst_file,"w");
//system("../../../openair1/SIMULATION/LTE_PHY_L2/physim --help");
......
......@@ -54,6 +54,11 @@ int save_XML(int copy_or_move, char *src_file, char *output_dir, char *filename)
XML_saving_dir[sizeof(XML_saving_dir) - 1] = 0; // terminate string
strncat(dst_file, filename, sizeof(dst_file) - strlen(dst_file) - 1);
fs = fopen(src_file, "r");
if(-1 == (dst_file,F_OK)){
creat(dst_file, 0644);
}else{
chmod(dst_file, 0644);
}
ft = fopen(dst_file, "w");
if ((ft !=NULL)&&(fs!=NULL)) {
......
......@@ -498,6 +498,11 @@ int init_opt(void)
break;
case OPT_PCAP:
if(-1 == (access(in_path,F_OK))){
creat(in_path, 0644);
}else{
chmod(in_path, 0644);
}
file_fd = fopen(in_path, "w");
if (file_fd == NULL) {
......
......@@ -240,9 +240,19 @@ void kpi_gen() {
char traffic[30];
#ifdef STANDALONE
FILE *file;
if(-1 == ("log_OTG.txt",F_OK)){
creat("log_OTG.txt", 0644);
}else{
chmod("log_OTG.txt", 0644);
}
file = fopen("log_OTG.txt", "w");
#else // Maybe to do modifo log function in order to clear file before a new write !!!!
FILE *fc;
if(-1 == ("/tmp/otg.log",F_OK)){
creat("/tmp/otg.log", 0644);
}else{
chmod("/tmp/otg.log", 0644);
}
fc=fopen("/tmp/otg.log","w");;
if(fc!=0)
......
......@@ -839,8 +839,8 @@ int x2ap_eNB_generate_x2_handover_request_ack (x2ap_eNB_instance_t *instance_p,
ie = (X2AP_HandoverRequestAcknowledge_IEs_t *)calloc(1, sizeof(X2AP_HandoverRequestAcknowledge_IEs_t));
ie->id = X2AP_ProtocolIE_ID_id_New_eNB_UE_X2AP_ID;
ie->criticality = X2AP_Criticality_ignore;
ie->value.present = X2AP_HandoverRequestAcknowledge_IEs__value_PR_UE_X2AP_ID_1;
ie->value.choice.UE_X2AP_ID_1 = id_target;
ie->value.present = X2AP_HandoverRequestAcknowledge_IEs__value_PR_UE_X2AP_ID;
ie->value.choice.UE_X2AP_ID = id_target;
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
/* mandatory */
......@@ -962,8 +962,8 @@ int x2ap_eNB_generate_x2_ue_context_release (x2ap_eNB_instance_t *instance_p, x2
ie = (X2AP_UEContextRelease_IEs_t *)calloc(1, sizeof(X2AP_UEContextRelease_IEs_t));
ie->id = X2AP_ProtocolIE_ID_id_New_eNB_UE_X2AP_ID;
ie->criticality = X2AP_Criticality_reject;
ie->value.present = X2AP_UEContextRelease_IEs__value_PR_UE_X2AP_ID_1;
ie->value.choice.UE_X2AP_ID_1 = id_target;
ie->value.present = X2AP_UEContextRelease_IEs__value_PR_UE_X2AP_ID;
ie->value.choice.UE_X2AP_ID = id_target;
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
if (x2ap_eNB_encode_pdu(&pdu, &buffer, &len) < 0) {
......@@ -1029,8 +1029,8 @@ int x2ap_eNB_generate_x2_handover_cancel (x2ap_eNB_instance_t *instance_p, x2ap_
ie = (X2AP_HandoverCancel_IEs_t *)calloc(1, sizeof(X2AP_HandoverCancel_IEs_t));
ie->id = X2AP_ProtocolIE_ID_id_New_eNB_UE_X2AP_ID;
ie->criticality = X2AP_Criticality_ignore;
ie->value.present = X2AP_HandoverCancel_IEs__value_PR_UE_X2AP_ID_1;
ie->value.choice.UE_X2AP_ID_1 = id_target;
ie->value.present = X2AP_HandoverCancel_IEs__value_PR_UE_X2AP_ID;
ie->value.choice.UE_X2AP_ID = id_target;
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
}
......
......@@ -926,7 +926,7 @@ int x2ap_eNB_handle_handover_response (instance_t instance,
return -1;
}
id_target = ie->value.choice.UE_X2AP_ID_1;
id_target = ie->value.choice.UE_X2AP_ID;
ue_id = id_source;
......@@ -1081,7 +1081,7 @@ int x2ap_eNB_handle_ue_context_release (instance_t instance,
return -1;
}
id_target = ie->value.choice.UE_X2AP_ID_1;
id_target = ie->value.choice.UE_X2AP_ID;
ue_id = id_source;
if (ue_id != x2ap_find_id_from_id_source(&instance_p->id_manager, id_source)) {
......@@ -1169,7 +1169,7 @@ int x2ap_eNB_handle_handover_cancel (instance_t instance,
X2AP_INFO("%s %d: ie is a NULL pointer \n",__FILE__,__LINE__);
id_target = -1;
} else
id_target = ie->value.choice.UE_X2AP_ID_1;
id_target = ie->value.choice.UE_X2AP_ID;
X2AP_FIND_PROTOCOLIE_BY_ID(X2AP_HandoverCancel_IEs_t, ie, x2HandoverCancel,
X2AP_ProtocolIE_ID_id_Cause, true);
......
......@@ -189,6 +189,11 @@ int memory_write(const char* datafile, const void* data, size_t size)
int rc = RETURNerror;
/* Open the data file for writing operation */
if(-1 == (access(datafile,F_OK))){
creat(datafile, 0644);
}else{
chmod(datafile, 0644);
}
FILE* fp = fopen(datafile, "wb");
if (fp != NULL) {
......
......@@ -279,6 +279,7 @@ int s1ap_eNB_handle_s1_setup_failure(uint32_t assoc_id,
S1AP_ERROR("pdu == NULL\n");
return -1;
}
container = &pdu->choice.unsuccessfulOutcome.value.choice.S1SetupFailure;
/* S1 Setup Failure == Non UE-related procedure -> stream 0 */
......@@ -288,8 +289,6 @@ int s1ap_eNB_handle_s1_setup_failure(uint32_t assoc_id,
}
if ((mme_desc_p = s1ap_eNB_get_MME(NULL, assoc_id, 0)) == NULL) {
// S1AP_ERROR("[SCTP %d] Received S1 setup response for non existing "
// "MME context\n", assoc_id);
S1AP_ERROR("[SCTP %d] Received S1 setup failure for non existing "
"MME context\n", assoc_id);
return -1;
......
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