Merge remote-tracking branch 'origin/fix-bugs-detected-gcc' into integration_2025_w14_p2 (!3342)

Fix bugs detected gcc
This commit is contained in:
Robert Schmidt
2025-04-08 10:06:06 +02:00
4 changed files with 92 additions and 117 deletions
+11 -16
View File
@@ -621,26 +621,21 @@ int websrv_callback_get_softmodemcmd(const struct _u_request *request, struct _u
snprintf(confstr, sizeof(confstr), "Confirm %s ?", modulestruct->cmd[j].cmdname); snprintf(confstr, sizeof(confstr), "Confirm %s ?", modulestruct->cmd[j].cmdname);
acmd = json_pack("{s:s,s:s}", "name", modulestruct->cmd[j].cmdname, "confirm", confstr); acmd = json_pack("{s:s,s:s}", "name", modulestruct->cmd[j].cmdname, "confirm", confstr);
} else if (modulestruct->cmd[j].cmdflags & TELNETSRV_CMDFLAG_NEEDPARAM) { } else if (modulestruct->cmd[j].cmdflags & TELNETSRV_CMDFLAG_NEEDPARAM) {
char *question[] = {NULL,NULL}; char *question[] = {NULL, NULL};
char *helpcp = NULL;
json_t *jQ1=NULL, *jQ2=NULL; json_t *jQ1=NULL, *jQ2=NULL;
json_t *jQs = json_array(); json_t *jQs = json_array();
if (modulestruct->cmd[j].helpstr != NULL) { int ns = sscanf(modulestruct->cmd[j].helpstr, "<%m[^<>]> <%m[^<>]>", &question[0], &question[1]);
helpcp = strdup(modulestruct->cmd[j].helpstr); if (ns == 0) {
int ns=sscanf(helpcp,"<%m[^<>]> <%m[^<>]>",&question[0],&question[1]); LOG_W(UTIL, "[websrv] Cannot find parameters for command %s %s\n", modulestruct->module, modulestruct->cmd[j].cmdname);
if (ns == 0) { continue;
LOG_W(UTIL, "[websrv] Cannot find parameters for command %s %s\n", modulestruct->module, modulestruct->cmd[j].cmdname); }
continue; jQ1 = json_pack("{s:s,s:s,s:s}", "display", question[0], "pname", "P0", "type", "string");
} json_array_append_new(jQs, jQ1);
jQ1=json_pack("{s:s,s:s,s:s}", "display",question[0], "pname", "P0", "type", "string"); if (ns > 1) {
json_array_append_new(jQs, jQ1); jQ2 = json_pack("{s:s,s:s,s:s}", "display", (question[1] == NULL) ? "" : question[1], "pname", "P1", "type", "string");
if (ns >1) { json_array_append_new(jQs, jQ2);
jQ2=json_pack("{s:s,s:s,s:s}","display", (question[1] == NULL) ? "" : question[1], "pname", "P1" , "type", "string");
json_array_append_new(jQs, jQ2);
}
} }
acmd = json_pack("{s:s,s:o}", "name", modulestruct->cmd[j].cmdname, "question", jQs); acmd = json_pack("{s:s,s:o}", "name", modulestruct->cmd[j].cmdname, "question", jQs);
free(helpcp);
free(question[0]); free(question[0]);
free(question[1]); free(question[1]);
} else { } else {
@@ -292,42 +292,33 @@ static inline void nr_polar_deinterleaver(uint8_t *input, uint8_t *output, uint1
* De-interleaving of coded bits implementation * De-interleaving of coded bits implementation
* TS 138.212: Section 5.4.1.3 - Interleaving of coded bits * TS 138.212: Section 5.4.1.3 - Interleaving of coded bits
*/ */
static inline void nr_polar_rm_deinterleaving_lut(uint16_t *out, const int E) static inline void nr_polar_rm_deinterleaving_lut(uint16_t *out, const uint E)
{ {
int16_t in[E]; uint T = ceil((sqrt(8 * E + 1) - 1) / 2);
for (uint i = 0; i < E; i++)
in[i] = i; bool v_tab[T][T];
int T = ceil((sqrt(8 * E + 1) - 1) / 2); memset(v_tab, false, sizeof(v_tab));
int v_tab[T][T]; for (uint i = 0, k = 0; i < T; i++) {
memset(v_tab, 0, sizeof(v_tab)); for (uint j = 0; j < T - i; j++, k++) {
uint k = 0; v_tab[i][j] = k < E;
for (int i = 0; i < T; i++) {
for (int j = 0; j < T - i; j++) {
if (k < E) {
v_tab[i][j] = k + 1;
}
k++;
} }
} }
int v[T][T]; int v[T][T];
k = 0; memset(v, -1, sizeof(v));
for (int j = 0; j < T; j++) { for (uint j = 0, k = 0; j < T; j++) {
for (int i = 0; i < T - j; i++) { for (uint i = 0; i < T - j; i++) {
if (k < E && v_tab[i][j] != 0) { if (k < E && v_tab[i][j]) {
v[i][j] = in[k]; v[i][j] = k;
k++; k++;
} else {
v[i][j] = INT_MAX;
} }
} }
} }
k = 0;
memset(out, 0, E * sizeof(*out)); memset(out, 0, E * sizeof(*out));
for (int i = 0; i < T; i++) { for (uint i = 0, k = 0; i < T; i++) {
for (int j = 0; j < T - i; j++) { for (uint j = 0; j < T - i; j++) {
if (v[i][j] != INT_MAX) { if (v[i][j] != -1) {
out[k] = v[i][j]; out[k] = v[i][j];
k++; k++;
} }
-1
View File
@@ -474,7 +474,6 @@ static void timeResponse (OAIgraph_t *graph, scopeData_t *p, int nb_UEs) {
values[i] = SquaredNorm(samples[i]); values[i] = SquaredNorm(samples[i]);
} }
#ifdef WEBSRVSCOPE #ifdef WEBSRVSCOPE
int uestart = nb_UEs - 1; // web scope shows one UE signal, that can be selected from GUI
msg->header.msgtype = SCOPEMSG_TYPE_DATA; msg->header.msgtype = SCOPEMSG_TYPE_DATA;
msg->header.chartid = graph->chartid; msg->header.chartid = graph->chartid;
msg->header.datasetid = graph->datasetid; msg->header.datasetid = graph->datasetid;
+65 -75
View File
@@ -638,7 +638,20 @@ unsigned int get_delta_f_RA_long(const unsigned int format)
// the column 5, (SFN_nbr is a bitmap where we set bit to '1' in the position of the subframe where the RACH can be sent. // the column 5, (SFN_nbr is a bitmap where we set bit to '1' in the position of the subframe where the RACH can be sent.
// E.g. in row 4, and column 5 we have set value 512 ('1000000000') which means RACH can be sent at subframe 9. // E.g. in row 4, and column 5 we have set value 512 ('1000000000') which means RACH can be sent at subframe 9.
// E.g. in row 20 and column 5 we have set value 66 ('0001000010') which means RACH can be sent at subframe 1 or 6 // E.g. in row 20 and column 5 we have set value 66 ('0001000010') which means RACH can be sent at subframe 1 or 6
static const int64_t table_6_3_3_2_2_prachConfig_Index[256][9] = {
typedef struct {
uint8_t format;
uint8_t format2;
int x;
int y;
uint64_t s_map;
uint32_t start_symbol;
uint32_t N_RA_slot;
uint32_t N_t_slot;
uint32_t N_dur;
} nr_prach_info_3gpp_fr1_t;
static const nr_prach_info_3gpp_fr1_t table_6_3_3_2_2_prachConfig_Index[256] = {
// format, format, x, y, SFN_nbr, star_symb, slots_sfn, occ_slot, duration // format, format, x, y, SFN_nbr, star_symb, slots_sfn, occ_slot, duration
{0, -1, 16, 1, 2, 0, 1, 1, 0}, // (subframe number) 1 {0, -1, 16, 1, 2, 0, 1, 1, 0}, // (subframe number) 1
{0, -1, 16, 1, 16, 0, 1, 1, 0}, // (subframe number) 4 {0, -1, 16, 1, 16, 0, 1, 1, 0}, // (subframe number) 4
@@ -898,7 +911,7 @@ static const int64_t table_6_3_3_2_2_prachConfig_Index[256][9] = {
{0xc2, -1, 1, 0, 682, 0, 2, 2, 6} // (subframe number) 1,3,5,7,9 {0xc2, -1, 1, 0, 682, 0, 2, 2, 6} // (subframe number) 1,3,5,7,9
}; };
// Table 6.3.3.2-3: Random access configurations for FR1 and unpaired spectrum // Table 6.3.3.2-3: Random access configurations for FR1 and unpaired spectrum
static const int64_t table_6_3_3_2_3_prachConfig_Index[256][9] = { static const nr_prach_info_3gpp_fr1_t table_6_3_3_2_3_prachConfig_Index[256] = {
// format, format, x, y, SFN_nbr, star_symb, slots_sfn, occ_slot, duration // format, format, x, y, SFN_nbr, star_symb, slots_sfn, occ_slot, duration
{0, -1, 16, 1, 512, 0, 1, 1, 0}, // (subrame number 9) {0, -1, 16, 1, 512, 0, 1, 1, 0}, // (subrame number 9)
{0, -1, 8, 1, 512, 0, 1, 1, 0}, // (subrame number 9) {0, -1, 8, 1, 512, 0, 1, 1, 0}, // (subrame number 9)
@@ -1157,8 +1170,22 @@ static const int64_t table_6_3_3_2_3_prachConfig_Index[256][9] = {
{0xa3, 0xb3, 1, 0, 682, 0, 1, 2, 6}, // (subrame number 1,3,5,7,9) {0xa3, 0xb3, 1, 0, 682, 0, 1, 2, 6}, // (subrame number 1,3,5,7,9)
{0xa3, 0xb3, 1, 0, 1023, 2, 1, 2, 6} // (subrame number 0,1,2,3,4,5,6,7,8,9) {0xa3, 0xb3, 1, 0, 1023, 2, 1, 2, 6} // (subrame number 0,1,2,3,4,5,6,7,8,9)
}; };
typedef struct {
uint8_t format;
uint8_t format2;
int x;
int y;
int y2;
uint64_t s_map;
uint32_t start_symbol;
uint32_t N_RA_slot;
uint32_t N_t_slot;
uint32_t N_dur;
} nr_prach_info_3gpp_fr2_t;
// Table 6.3.3.2-4: Random access configurations for FR2 and unpaired spectrum // Table 6.3.3.2-4: Random access configurations for FR2 and unpaired spectrum
static const int64_t table_6_3_3_2_4_prachConfig_Index[256][10] = { static const nr_prach_info_3gpp_fr2_t table_6_3_3_2_4_prachConfig_Index[256] = {
// format, format, x, y, y, SFN_nbr, star_symb, slots_sfn, occ_slot, // format, format, x, y, y, SFN_nbr, star_symb, slots_sfn, occ_slot,
// duration // duration
{0xa1, -1, 16, 1, -1, 567489872400, 0, 2, 6, 2}, // (subframe number :4,9,14,19,24,29,34,39) {0xa1, -1, 16, 1, -1, 567489872400, 0, 2, 6, 2}, // (subframe number :4,9,14,19,24,29,34,39)
@@ -1424,13 +1451,13 @@ int get_format0(uint8_t index, uint8_t unpaired, frequency_range_t frequency_ran
int format = 0; int format = 0;
if (unpaired) { if (unpaired) {
if (frequency_range==FR1) if (frequency_range==FR1)
format = table_6_3_3_2_3_prachConfig_Index[index][0]; format = table_6_3_3_2_3_prachConfig_Index[index].format;
else else
format = table_6_3_3_2_4_prachConfig_Index[index][0]; format = table_6_3_3_2_4_prachConfig_Index[index].format;
} }
else { else {
if (frequency_range==FR1) if (frequency_range==FR1)
format = table_6_3_3_2_2_prachConfig_Index[index][0]; format = table_6_3_3_2_2_prachConfig_Index[index].format;
else else
AssertFatal(0==1,"no paired spectrum for FR2\n"); AssertFatal(0==1,"no paired spectrum for FR2\n");
} }
@@ -1551,22 +1578,20 @@ void set_monitoring_periodicity_offset(NR_SearchSpace_t *ss,
nr_prach_info_t get_nr_prach_occasion_info_from_index(uint8_t index, frequency_range_t freq_range, uint8_t unpaired) nr_prach_info_t get_nr_prach_occasion_info_from_index(uint8_t index, frequency_range_t freq_range, uint8_t unpaired)
{ {
uint8_t format2 = 0xff; nr_prach_info_t info = {};
nr_prach_info_t info;
if (freq_range == FR2) { if (freq_range == FR2) {
info.x = table_6_3_3_2_4_prachConfig_Index[index][2]; const nr_prach_info_3gpp_fr2_t *tmp = table_6_3_3_2_4_prachConfig_Index + index;
info.y = table_6_3_3_2_4_prachConfig_Index[index][3]; info.x = tmp->x;
info.y2 = table_6_3_3_2_4_prachConfig_Index[index][4]; info.y = tmp->y;
info.s_map = table_6_3_3_2_4_prachConfig_Index[index][5]; info.y2 = tmp->y2;
info.N_RA_sfn += count_bits64(info.s_map); info.s_map = tmp->s_map;
info.N_RA_slot = table_6_3_3_2_4_prachConfig_Index[index][7]; info.N_RA_sfn = count_bits64(info.s_map);
info.N_RA_slot = tmp->N_RA_slot;
info.max_association_period = 160 / (info.x * 10); info.max_association_period = 160 / (info.x * 10);
info.start_symbol = table_6_3_3_2_4_prachConfig_Index[index][6]; info.start_symbol = tmp->start_symbol;
info.N_t_slot = table_6_3_3_2_4_prachConfig_Index[index][8]; info.N_t_slot = tmp->N_t_slot;
info.N_dur = table_6_3_3_2_4_prachConfig_Index[index][9]; info.N_dur = tmp->N_dur;
if (table_6_3_3_2_4_prachConfig_Index[index][1] != -1) info.format = tmp->format | (tmp->format2 << 8);
format2 = (uint8_t)table_6_3_3_2_4_prachConfig_Index[index][1];
info.format = ((uint8_t)table_6_3_3_2_4_prachConfig_Index[index][0]) | (format2 << 8);
LOG_D(NR_MAC, LOG_D(NR_MAC,
"PRACH info from index %d frame_type %u start_symbol %u N_t_slot %u N_dur %u N_RA_sfn = %u\n", "PRACH info from index %d frame_type %u start_symbol %u N_t_slot %u N_dur %u N_RA_sfn = %u\n",
index, index,
@@ -1577,77 +1602,42 @@ nr_prach_info_t get_nr_prach_occasion_info_from_index(uint8_t index, frequency_r
info.N_RA_sfn); info.N_RA_sfn);
return info; return info;
} }
const nr_prach_info_3gpp_fr1_t *tmp =
unpaired ? /* FR1 TDD*/ table_6_3_3_2_3_prachConfig_Index + index : /* FR1 FDD */ table_6_3_3_2_2_prachConfig_Index + index;
if (unpaired) { // FR1 TDD info.x = tmp->x;
info.x = table_6_3_3_2_3_prachConfig_Index[index][2]; info.y = tmp->y;
info.y = table_6_3_3_2_3_prachConfig_Index[index][3];
info.y2 = -1;
info.s_map = table_6_3_3_2_3_prachConfig_Index[index][4];
info.N_RA_sfn += count_bits64(info.s_map);
info.N_RA_slot = table_6_3_3_2_3_prachConfig_Index[index][6];
info.max_association_period = 160 / (info.x * 10);
info.start_symbol = table_6_3_3_2_3_prachConfig_Index[index][5];
info.N_t_slot = table_6_3_3_2_3_prachConfig_Index[index][7];
info.N_dur = table_6_3_3_2_3_prachConfig_Index[index][8];
if (table_6_3_3_2_3_prachConfig_Index[index][1] != -1)
format2 = (uint8_t)table_6_3_3_2_3_prachConfig_Index[index][1];
info.format = ((uint8_t)table_6_3_3_2_3_prachConfig_Index[index][0]) | (format2 << 8);
LOG_D(NR_MAC,
"PRACH info from index %d (col %lu) frame_type %u start_symbol %u N_t_slot %u N_dur %u N_RA_sfn = %u\n",
index,
table_6_3_3_2_3_prachConfig_Index[index][6],
unpaired,
info.start_symbol,
info.N_t_slot,
info.N_dur,
info.N_RA_sfn);
return info;
}
// FR1 FDD
info.x = table_6_3_3_2_2_prachConfig_Index[index][2];
info.y = table_6_3_3_2_2_prachConfig_Index[index][3];
info.y2 = -1; info.y2 = -1;
info.s_map = table_6_3_3_2_2_prachConfig_Index[index][4]; info.s_map = tmp->s_map;
info.N_RA_sfn += count_bits64(info.s_map); info.N_RA_sfn = count_bits64(info.s_map);
info.N_RA_slot = table_6_3_3_2_2_prachConfig_Index[index][6]; info.N_RA_slot = tmp->N_RA_slot;
info.max_association_period = 160 / (info.x * 10); info.max_association_period = 160 / (info.x * 10);
info.start_symbol = table_6_3_3_2_2_prachConfig_Index[index][5]; info.start_symbol = tmp->start_symbol;
info.N_t_slot = table_6_3_3_2_2_prachConfig_Index[index][7]; info.N_t_slot = tmp->N_t_slot;
info.N_dur = table_6_3_3_2_2_prachConfig_Index[index][8]; info.N_dur = tmp->N_dur;
if (table_6_3_3_2_2_prachConfig_Index[index][1] != -1) info.format = tmp->format | (tmp->format2 << 8);
format2 = (uint8_t)table_6_3_3_2_2_prachConfig_Index[index][1];
info.format = ((uint8_t)table_6_3_3_2_2_prachConfig_Index[index][0]) | (format2 << 8);
LOG_D(NR_MAC, LOG_D(NR_MAC,
"PRACH info from index %d frame_type %u start_symbol %u N_t_slot %u N_dur %u \n", "PRACH info from index %d (col %u) frame_type %u start_symbol %u N_t_slot %u N_dur %u N_RA_sfn = %u\n",
index, index,
tmp->start_symbol,
unpaired, unpaired,
info.start_symbol, info.start_symbol,
info.N_t_slot, info.N_t_slot,
info.N_dur); info.N_dur,
info.N_RA_sfn);
return info; return info;
} }
uint16_t get_nr_prach_format_from_index(uint8_t index, uint32_t pointa, uint8_t unpaired) uint16_t get_nr_prach_format_from_index(uint8_t index, uint32_t pointa, uint8_t unpaired)
{ {
uint8_t format2 = 0xff;
uint16_t format;
if (get_freq_range_from_arfcn(pointa) == FR2) { if (get_freq_range_from_arfcn(pointa) == FR2) {
if (table_6_3_3_2_4_prachConfig_Index[index][1] != -1) const nr_prach_info_3gpp_fr2_t *tmp = table_6_3_3_2_4_prachConfig_Index + index;
format2 = (uint8_t)table_6_3_3_2_4_prachConfig_Index[index][1]; return tmp->format | (tmp->format2 << 8);
format = ((uint8_t)table_6_3_3_2_4_prachConfig_Index[index][0]) | (format2 << 8);
} else { } else {
if (unpaired) { const nr_prach_info_3gpp_fr1_t *tmp =
if (table_6_3_3_2_3_prachConfig_Index[index][1] != -1) unpaired ? /* FR1 TDD*/ table_6_3_3_2_3_prachConfig_Index + index : /* FR1 FDD */ table_6_3_3_2_2_prachConfig_Index + index;
format2 = (uint8_t)table_6_3_3_2_3_prachConfig_Index[index][1]; return tmp->format | (tmp->format2 << 8);
format = ((uint8_t)table_6_3_3_2_3_prachConfig_Index[index][0]) | (format2 << 8);
} else {
if (table_6_3_3_2_2_prachConfig_Index[index][1] != -1)
format2 = (uint8_t)table_6_3_3_2_2_prachConfig_Index[index][1];
format = ((uint8_t)table_6_3_3_2_2_prachConfig_Index[index][0]) | (format2 << 8);
}
} }
return format;
} }
bool get_nr_prach_sched_from_info(nr_prach_info_t info, bool get_nr_prach_sched_from_info(nr_prach_info_t info,