[srsran-users] how can complete code cell_search that beside that earfcn and frequency, print plmn code for operator cell?
sp
stackprogramer at gmail.com
Tue Aug 29 04:22:36 UTC 2023
there is an example in path /lib/example/cell_search.c, it can search for
all earfcn and frequencies in a band..... my question is how can edit and
modify it
Furthermore, earfcn, it prints plmn code for the operator, can anyone
guide me? Thanks in advance
A part of code you see that, you can see complete code from this link
<https://github.com/srsran/srsRAN_4G/blob/master/lib/examples/cell_search.c>
.
for (freq = 0; freq < nof_freqs && !go_exit; freq++) {
/* set rf_freq */
srsran_rf_set_rx_freq(&rf, 0, (double)channels[freq].fd * MHZ);
INFO("Set rf_freq to %.3f MHz", (double)channels[freq].fd * MHZ /
1000000);
printf(
"[%3d/%d]: EARFCN %d Freq. %.2f MHz looking for PSS.\n", freq,
nof_freqs, channels[freq].id, channels[freq].fd);
fflush(stdout);
if (SRSRAN_VERBOSE_ISINFO()) {
printf("\n");
}
bzero(found_cells, 3 * sizeof(srsran_ue_cellsearch_result_t));
INFO("Setting sampling frequency %.2f MHz for PSS search",
SRSRAN_CS_SAMP_FREQ / 1000000);
srsran_rf_set_rx_srate(&rf, SRSRAN_CS_SAMP_FREQ);
INFO("Starting receiver...");
srsran_rf_start_rx_stream(&rf, false);
n = srsran_ue_cellsearch_scan(&cs, found_cells, NULL);
if (n < 0) {
ERROR("Error searching cell");
exit(-1);
} else if (n > 0) {
for (int i = 0; i < 3; i++) {
if (found_cells[i].psr > 2.0) {
srsran_cell_t cell;
cell.id = found_cells[i].cell_id;
cell.cp = found_cells[i].cp;
int ret = rf_mib_decoder(&rf, 1, &cell_detect_config, &cell,
NULL);
if (ret < 0) {
ERROR("Error decoding MIB");
exit(-1);
}
if (ret == SRSRAN_UE_MIB_FOUND) {
printf("Found CELL ID %d. %d PRB, %d ports\n", cell.id,
cell.nof_prb, cell.nof_ports);
if (cell.nof_ports > 0) {
results[n_found_cells].cell = cell;
results[n_found_cells].freq = channels[freq].fd;
results[n_found_cells].dl_earfcn = channels[freq].id;
results[n_found_cells].power = found_cells[i].peak;
n_found_cells++;
}
}
}
}
}
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.srsran.com/pipermail/srsran-users/attachments/20230829/43331818/attachment.htm>
More information about the srsran-users
mailing list