Merge remote-tracking branch 'origin/fix_cppcheck' into integration_2024_w15
This commit is contained in:
@@ -688,9 +688,8 @@ int main(int argc, char **argv) {
|
||||
else {
|
||||
while(fgets(buf, 63, proc_fd))
|
||||
printf("%s", buf);
|
||||
fclose(proc_fd);
|
||||
}
|
||||
|
||||
fclose(proc_fd);
|
||||
cpu_freq_GHz = ((double)atof(buf))/1e6;
|
||||
#else
|
||||
cpu_freq_GHz = get_cpu_freq_GHz();
|
||||
|
||||
@@ -312,7 +312,7 @@ int main(int argc, char **argv) {
|
||||
#ifdef IFFT_FPGA
|
||||
int **txdataF2;
|
||||
#endif
|
||||
int **txdata,**txdata1 = NULL,**txdata2 = NULL;
|
||||
int **txdata, **txdata1 = NULL, **txdata2 = NULL;
|
||||
double **s_re,**s_im,**s_re1,**s_im1,**s_re2,**s_im2,**r_re,**r_im,**r_re1,**r_im1,**r_re2,**r_im2;
|
||||
double iqim = 0.0;
|
||||
unsigned char pbch_pdu[6];
|
||||
@@ -1180,12 +1180,12 @@ int main(int argc, char **argv) {
|
||||
s_re[aa][i] = tmp_re;
|
||||
s_im[aa][i] = tmp_im;
|
||||
|
||||
if (interf1>-20) {
|
||||
if (interf1 >- 20 && txdata1) {
|
||||
s_re1[aa][i] = ((double)(((short *)txdata1[aa]))[(i<<1)]);
|
||||
s_im1[aa][i] = ((double)(((short *)txdata1[aa]))[(i<<1)+1]);
|
||||
}
|
||||
|
||||
if (interf2>-20) {
|
||||
if (interf2 >- 20 && txdata2) {
|
||||
s_re2[aa][i] = ((double)(((short *)txdata2[aa]))[(i<<1)]);
|
||||
s_im2[aa][i] = ((double)(((short *)txdata2[aa]))[(i<<1)+1]);
|
||||
}
|
||||
|
||||
@@ -917,6 +917,11 @@ int main(int argc, char **argv)
|
||||
csv_file = fopen(filename_csv, "a");
|
||||
if (csv_file == NULL) {
|
||||
printf("Can't open file \"%s\", errno %d\n", filename_csv, errno);
|
||||
free(s_re);
|
||||
free(s_im);
|
||||
free(r_re);
|
||||
free(r_im);
|
||||
free(txdata);
|
||||
return 1;
|
||||
}
|
||||
// adding name of parameters into file
|
||||
|
||||
@@ -902,6 +902,10 @@ int main(int argc, char *argv[])
|
||||
csv_file = fopen(filename_csv, "a");
|
||||
if (csv_file == NULL) {
|
||||
printf("Can't open file \"%s\", errno %d\n", filename_csv, errno);
|
||||
free(s_re);
|
||||
free(s_im);
|
||||
free(r_re);
|
||||
free(r_im);
|
||||
return 1;
|
||||
}
|
||||
// adding name of parameters into file
|
||||
|
||||
@@ -115,7 +115,7 @@ void display_data(int pss_sequence_number, int16_t *rxdata, int position) {
|
||||
int16_t *pss_sequence[pss_sequence] = {primary_synch0_time, primary_synch1_time, primary_synch2_time};
|
||||
int16_t *pss_sequence_sl[pss_sequence] = {primary_synch0_time, primary_synch1_time};
|
||||
int16_t *pss_sequence_time = pss_sequence[pss_sequence_number];;
|
||||
if (get_softmodem_params()->sl_mode != 0) {
|
||||
if (get_softmodem_params()->sl_mode != 0)
|
||||
pss_sequence_time = pss_sequence_sl[pss_sequence_number];
|
||||
printf(" pss %6d data \n", pss_sequence_number);
|
||||
for (int i = 0; i < 4; i++) {
|
||||
|
||||
@@ -107,6 +107,7 @@ double dac_fixed_gain(double *s_re[2],
|
||||
*amp1p=sqrt(*amp1p);
|
||||
}
|
||||
|
||||
AssertFatal(amp1p != NULL && *amp1p != 0.0, "Precondition to avoid UB\n");
|
||||
|
||||
#ifdef DEBUG_DAC
|
||||
LOG_I(OCM,"DAC: amp %f, amp1 %f dB (%d,%d), tx_power target %f (actual %f %f),length %d,pos %d\n",
|
||||
@@ -122,7 +123,6 @@ double dac_fixed_gain(double *s_re[2],
|
||||
|
||||
#endif
|
||||
|
||||
AssertFatal(amp1p != NULL && *amp1p != 0.0, "Precondition to avoid UB\n");
|
||||
for (i=0; i<length; i++) {
|
||||
for (aa=0; aa<nb_tx_antennas; aa++) {
|
||||
s_re[aa][i] = amp*((double)(((short *)input[aa]))[((i+input_offset)<<1)])/(*amp1p);
|
||||
|
||||
@@ -344,7 +344,7 @@ void do_UL_sig(sim_t *sim, uint16_t subframe, uint8_t abstraction_flag, LTE_DL_F
|
||||
for (UE_id=0; UE_id<NB_UE_INST; UE_id++) {
|
||||
|
||||
txdata = PHY_vars_UE_g[UE_id][CC_id]->common_vars.txdata;
|
||||
AssertFatal(txdata != NULL,"txdata is null\n");
|
||||
AssertFatal(txdata,"txdata is null\n");
|
||||
|
||||
sf_offset = subframe*frame_parms->samples_per_tti;
|
||||
if (subframe>0) sf_offset_tdd = sf_offset - PHY_vars_UE_g[UE_id][CC_id]->N_TA_offset;
|
||||
|
||||
@@ -25,28 +25,24 @@
|
||||
#include "defs.h"
|
||||
|
||||
|
||||
unsigned int *generate_gauss_LUT(unsigned char Nbits,
|
||||
unsigned char L
|
||||
) {
|
||||
unsigned int *LUT_ptr,i;
|
||||
LUT_ptr = (unsigned int *)malloc((1<<(Nbits-1))*sizeof(int));
|
||||
unsigned int *generate_gauss_LUT(unsigned char Nbits, unsigned char L)
|
||||
{
|
||||
unsigned int *LUT_ptr = calloc((1U << (Nbits - 1)), sizeof(int));
|
||||
assert(LUT_ptr);
|
||||
|
||||
for (i=0; i<(1<<(Nbits-1)); i++) {
|
||||
LUT_ptr[i] = (unsigned int)((double)((unsigned int)(1<<31))*erf(i*L/(double)(1<<(Nbits-1))));
|
||||
for (int i = 0; i < (1 << (Nbits - 1)); i++) {
|
||||
LUT_ptr[i] = (unsigned int)((double)((unsigned int)(1U << 31)) * erf(i * L / (double)(1 << (Nbits - 1))));
|
||||
#ifdef LUTDEBUG
|
||||
printf("pos %u : LUT_ptr[%u]=%x (%f)\n",i,i,LUT_ptr[i],(double)(erf(i*L/(double)(1<<(Nbits-1)))));
|
||||
printf("pos %d : LUT_ptr[%d]=%x (%f)\n", i, i, LUT_ptr[i], (double)(erf(i * L / (double)(1 << (Nbits -1 )))));
|
||||
#endif //LUTDEBUG
|
||||
}
|
||||
|
||||
return(LUT_ptr);
|
||||
}
|
||||
|
||||
|
||||
|
||||
int gauss(unsigned int *gauss_LUT,
|
||||
unsigned char Nbits
|
||||
) {
|
||||
int gauss(unsigned int *gauss_LUT, unsigned char Nbits)
|
||||
{
|
||||
unsigned int search_pos,step_size,u,tmp,tmpm1,tmpp1,s;
|
||||
// Get a 32-bit uniform random-variable
|
||||
u = taus();
|
||||
@@ -127,8 +123,10 @@ void main(int argc,char **argv) {
|
||||
// printf("%d\n",gauss(gauss_LUT_ptr,Nbits));
|
||||
}
|
||||
|
||||
printf("Tail probability = %e(%x)\n",2*erfc((double)L*gauss_LUT_ptr[(1<<(Nbits-1))-1]/(unsigned int)(1<<31)),gauss_LUT_ptr[(1<<(Nbits-1))-1]);
|
||||
printf("max %d, min %d, mean %f, stddev %f, Pr(maxnum)=%e(%d)\n",maxg,ming,meang,sqrt(varg),(double)maxnum/Ntrials,maxnum);
|
||||
printf("Tail probability = %e(%x)\n",
|
||||
2 * erfc((double)L * gauss_LUT_ptr[(1U << (Nbits - 1)) - 1] / (unsigned int)(1U << 31)),
|
||||
gauss_LUT_ptr[(1U << (Nbits - 1)) - 1]);
|
||||
printf("max %d, min %d, mean %f, stddev %f, Pr(maxnum)=%e(%d)\n", maxg, ming, meang, sqrt(varg), (double)maxnum / Ntrials, maxnum);
|
||||
// for (i=0;i<(1<<Nhistbits);i++)
|
||||
// printf("%d : %u\n",i,hist[i]);
|
||||
free(gauss_LUT_ptr);
|
||||
|
||||
@@ -2033,8 +2033,8 @@ int get_channel_params(char *buf, int debug, void *vdata, telnet_printfunc_t prn
|
||||
}
|
||||
tdata->numlines++;
|
||||
}
|
||||
return tdata->numlines;
|
||||
}
|
||||
return tdata->numlines;
|
||||
} /* show */ else if (strstr(buf, "set") == buf) {
|
||||
char cmdbuf[TELNET_MAX_MSGLENGTH];
|
||||
int sst = sscanf(tdata->tblname, "%*[^=]=%i", &chanidx);
|
||||
@@ -2229,11 +2229,12 @@ int get_modchannel_index(char *buf, int debug, void *vdata, telnet_printfunc_t p
|
||||
if (debug)
|
||||
LOG_I(UTIL, "%s received %s\n", __FUNCTION__, buf);
|
||||
webdatadef_t *tdata = (webdatadef_t *)vdata;
|
||||
tdata->numlines = 0;
|
||||
if (strncmp(buf, "set", 3) == 0) {
|
||||
return get_channel_params(buf, debug, vdata, prnt);
|
||||
}
|
||||
int numlines = 0;
|
||||
if (tdata != NULL) {
|
||||
tdata->numlines = 0;
|
||||
for (int i = 0; i < max_chan; i++) {
|
||||
if (defined_channels[i] != NULL) {
|
||||
tdata->numlines++;
|
||||
@@ -2245,8 +2246,9 @@ int get_modchannel_index(char *buf, int debug, void *vdata, telnet_printfunc_t p
|
||||
else {
|
||||
snprintf(tdata->tblname, sizeof(tdata->tblname) - 1, "No running model in the system");
|
||||
}
|
||||
numlines = tdata->numlines;
|
||||
}
|
||||
return tdata->numlines;
|
||||
return numlines;
|
||||
} /* get_currentchannel_type */
|
||||
/*------------------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
Reference in New Issue
Block a user