mirror of https://github.com/pvnis/srsRAN_4G.git
Reordered RRC ASN directory. Fixed ASN headers installation.
parent
fc1989b295
commit
c8c7bf39b2
@ -1,122 +0,0 @@
|
|||||||
/**
|
|
||||||
*
|
|
||||||
* \section COPYRIGHT
|
|
||||||
*
|
|
||||||
* Copyright 2013-2014 The libLTE Developers. See the
|
|
||||||
* COPYRIGHT file at the top-level directory of this distribution.
|
|
||||||
*
|
|
||||||
* \section LICENSE
|
|
||||||
*
|
|
||||||
* This file is part of the libLTE library.
|
|
||||||
*
|
|
||||||
* libLTE is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Lesser General Public License as
|
|
||||||
* published by the Free Software Foundation, either version 3 of
|
|
||||||
* the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* libLTE is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* A copy of the GNU Lesser General Public License can be found in
|
|
||||||
* the LICENSE file in the top-level directory of this distribution
|
|
||||||
* and at http://www.gnu.org/licenses/.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <strings.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <stdbool.h>
|
|
||||||
|
|
||||||
#include "liblte/phy/phy.h"
|
|
||||||
|
|
||||||
#define N_TESTS 10
|
|
||||||
|
|
||||||
|
|
||||||
const lte_cp_t test_re_cp[N_TESTS] = {CPNORM, CPNORM, CPNORM, CPNORM, CPNORM, CPNORM, CPEXT, CPEXT, CPEXT, CPEXT};
|
|
||||||
const int test_re_ports[N_TESTS] = {1, 1, 1, 2, 4, 4, 1, 4, 1, 4};
|
|
||||||
const int test_re_csymb[N_TESTS] = {2, 1, 3, 3, 1, 3, 2, 2, 1, 2};
|
|
||||||
const int test_re_prb[N_TESTS] = {6, 15, 15, 15, 15, 15, 6, 6, 15, 15};
|
|
||||||
const int test_re_num[N_TESTS][3] = {
|
|
||||||
{408, 684, 828 }, // sf 0, 5 and the rest
|
|
||||||
{1830, 2106, 2250},
|
|
||||||
{1470, 1746, 1890},
|
|
||||||
{1392, 1656, 1800},
|
|
||||||
{1656, 1896, 2040},
|
|
||||||
{1356, 1596, 1740},
|
|
||||||
{276, 540, 684},
|
|
||||||
{264, 480, 624},
|
|
||||||
{1482, 1746, 1890},
|
|
||||||
{1200, 1416, 1560}
|
|
||||||
};
|
|
||||||
|
|
||||||
cf_t in[200000], out[200000];
|
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
|
||||||
int i, n, np, r;
|
|
||||||
ra_prb_t prb_alloc;
|
|
||||||
int ret = -1;
|
|
||||||
pdsch_t pdsch;
|
|
||||||
lte_cell_t cell;
|
|
||||||
|
|
||||||
while (getopt(argc, argv, "v") == 'v') {
|
|
||||||
verbose++;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i=0;i<110;i++) {
|
|
||||||
prb_alloc.slot[0].prb_idx[i] = i;
|
|
||||||
prb_alloc.slot[1].prb_idx[i] = i;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i=0;i<N_TESTS;i++) {
|
|
||||||
cell.id = 0;
|
|
||||||
cell.nof_prb = test_re_prb[i];
|
|
||||||
cell.nof_ports = test_re_ports[i];
|
|
||||||
cell.cp = test_re_cp[i];
|
|
||||||
|
|
||||||
pdsch_init(&pdsch, cell);
|
|
||||||
pdsch_set_rnti(&pdsch, 0);
|
|
||||||
|
|
||||||
memset(prb_alloc.re_sf, 0, sizeof(uint32_t) * 10);
|
|
||||||
prb_alloc.slot[0].nof_prb = test_re_prb[i];
|
|
||||||
prb_alloc.slot[1].nof_prb = test_re_prb[i];
|
|
||||||
ra_prb_get_re_dl(&prb_alloc, test_re_prb[i], test_re_ports[i], test_re_csymb[i], test_re_cp[i]);
|
|
||||||
for (n=0;n<10;n++) {
|
|
||||||
switch(n) {
|
|
||||||
case 0:
|
|
||||||
np = 0;
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
np = 1;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
np = 2;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
r = pdsch_get(&pdsch, in, out, &prb_alloc, n);
|
|
||||||
|
|
||||||
if (prb_alloc.re_sf[n] != test_re_num[i][np]) {
|
|
||||||
goto go_out;
|
|
||||||
}
|
|
||||||
if (r != prb_alloc.re_sf[n]) {
|
|
||||||
goto go_out;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
pdsch_free(&pdsch);
|
|
||||||
}
|
|
||||||
ret = 0;
|
|
||||||
go_out:
|
|
||||||
if (ret) {
|
|
||||||
printf("Error in SF %d test %d. %d PRB, %d ports, RE is %d, get %d and should be %d\n",
|
|
||||||
n, i, test_re_prb[i], test_re_ports[i], prb_alloc.re_sf[n], r, test_re_num[i][np]);
|
|
||||||
} else {
|
|
||||||
printf("Ok\n");
|
|
||||||
}
|
|
||||||
exit(ret);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,38 +0,0 @@
|
|||||||
#
|
|
||||||
# Copyright 2012-2013 The libLTE Developers. See the
|
|
||||||
# COPYRIGHT file at the top-level directory of this distribution.
|
|
||||||
#
|
|
||||||
# This file is part of the libLTE library.
|
|
||||||
#
|
|
||||||
# libLTE is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU Lesser General Public License as
|
|
||||||
# published by the Free Software Foundation, either version 3 of
|
|
||||||
# the License, or (at your option) any later version.
|
|
||||||
#
|
|
||||||
# libLTE is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU Lesser General Public License for more details.
|
|
||||||
#
|
|
||||||
# A copy of the GNU Lesser General Public License can be found in
|
|
||||||
# the LICENSE file in the top-level directory of this distribution
|
|
||||||
# and at http://www.gnu.org/licenses/.
|
|
||||||
#
|
|
||||||
|
|
||||||
########################################################################
|
|
||||||
# UE SYNC TEST (Only compiled if CUHD is available)
|
|
||||||
########################################################################
|
|
||||||
LIST(FIND OPTIONAL_LIBS cuhd CUHD_FIND)
|
|
||||||
LIST(FIND OPTIONAL_LIBS graphics GRAPHICS_FIND)
|
|
||||||
|
|
||||||
IF(${CUHD_FIND} GREATER -1)
|
|
||||||
ADD_EXECUTABLE(ue_sync_usrp ue_sync_usrp.c)
|
|
||||||
TARGET_LINK_LIBRARIES(ue_sync_usrp lte_phy cuhd)
|
|
||||||
ENDIF(${CUHD_FIND} GREATER -1)
|
|
||||||
|
|
||||||
IF(${GRAPHICS_FIND} EQUAL -1)
|
|
||||||
SET_TARGET_PROPERTIES(ue_sync_usrp PROPERTIES COMPILE_DEFINITIONS "DISABLE_GRAPHICS")
|
|
||||||
ELSE(${GRAPHICS_FIND} EQUAL -1)
|
|
||||||
target_link_libraries(ue_sync_usrp graphics)
|
|
||||||
ENDIF(${GRAPHICS_FIND} EQUAL -1)
|
|
||||||
|
|
@ -1,257 +0,0 @@
|
|||||||
/**
|
|
||||||
*
|
|
||||||
* \section COPYRIGHT
|
|
||||||
*
|
|
||||||
* Copyright 2013-2014 The libLTE Developers. See the
|
|
||||||
* COPYRIGHT file at the top-level directory of this distribution.
|
|
||||||
*
|
|
||||||
* \section LICENSE
|
|
||||||
*
|
|
||||||
* This file is part of the libLTE library.
|
|
||||||
*
|
|
||||||
* libLTE is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Lesser General Public License as
|
|
||||||
* published by the Free Software Foundation, either version 3 of
|
|
||||||
* the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* libLTE is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* A copy of the GNU Lesser General Public License can be found in
|
|
||||||
* the LICENSE file in the top-level directory of this distribution
|
|
||||||
* and at http://www.gnu.org/licenses/.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <strings.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <math.h>
|
|
||||||
#include <complex.h>
|
|
||||||
#include <sys/time.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <assert.h>
|
|
||||||
#include <signal.h>
|
|
||||||
|
|
||||||
#include "liblte/phy/phy.h"
|
|
||||||
|
|
||||||
#include "liblte/cuhd/cuhd.h"
|
|
||||||
void *uhd;
|
|
||||||
|
|
||||||
#ifndef DISABLE_GRAPHICS
|
|
||||||
#include "liblte/graphics/plot.h"
|
|
||||||
plot_real_t poutfft;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int nof_frames = -1;
|
|
||||||
float threshold = -1.0;
|
|
||||||
int N_id_2 = -1;
|
|
||||||
uint32_t nof_prb = 6;
|
|
||||||
|
|
||||||
float uhd_freq = 0.0, uhd_gain = 20.0;
|
|
||||||
char *uhd_args = "";
|
|
||||||
int disable_plots = 0;
|
|
||||||
|
|
||||||
void usage(char *prog) {
|
|
||||||
printf("Usage: %s [agntdpv] -f uhd_freq -i N_id_2\n", prog);
|
|
||||||
printf("\t-a UHD args [Default %s]\n", uhd_args);
|
|
||||||
printf("\t-g UHD RX gain [Default %.2f dB]\n", uhd_gain);
|
|
||||||
printf("\t-n nof_frames [Default infinite]\n");
|
|
||||||
printf("\t-p nof_prb [Default %d]\n", nof_prb);
|
|
||||||
printf("\t-t threshold [Default %.2f]\n",threshold);
|
|
||||||
|
|
||||||
#ifndef DISABLE_GRAPHICS
|
|
||||||
printf("\t-d disable plots [Default enabled]\n");
|
|
||||||
#endif
|
|
||||||
printf("\t-v [set verbose to debug, default none]\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
void parse_args(int argc, char **argv) {
|
|
||||||
int opt;
|
|
||||||
while ((opt = getopt(argc, argv, "agntdvfip")) != -1) {
|
|
||||||
switch (opt) {
|
|
||||||
case 'i':
|
|
||||||
N_id_2 = atoi(argv[optind]);
|
|
||||||
break;
|
|
||||||
case 'p':
|
|
||||||
nof_prb = atoi(argv[optind]);
|
|
||||||
break;
|
|
||||||
case 'n':
|
|
||||||
nof_frames = atoi(argv[optind]);
|
|
||||||
break;
|
|
||||||
case 'a':
|
|
||||||
uhd_args = argv[optind];
|
|
||||||
break;
|
|
||||||
case 'g':
|
|
||||||
uhd_gain = atof(argv[optind]);
|
|
||||||
break;
|
|
||||||
case 'f':
|
|
||||||
uhd_freq = atof(argv[optind]);
|
|
||||||
break;
|
|
||||||
case 't':
|
|
||||||
threshold = atof(argv[optind]);
|
|
||||||
break;
|
|
||||||
case 'd':
|
|
||||||
disable_plots = 1;
|
|
||||||
break;
|
|
||||||
case 'v':
|
|
||||||
verbose++;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
usage(argv[0]);
|
|
||||||
exit(-1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (uhd_freq == 0.0 || N_id_2 == -1) {
|
|
||||||
usage(argv[0]);
|
|
||||||
exit(-1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void input_init() {
|
|
||||||
|
|
||||||
printf("Opening UHD device...\n");
|
|
||||||
if (cuhd_open(uhd_args, &uhd)) {
|
|
||||||
fprintf(stderr, "Error opening uhd\n");
|
|
||||||
exit(-1);
|
|
||||||
}
|
|
||||||
cuhd_set_rx_gain(uhd, uhd_gain);
|
|
||||||
|
|
||||||
/* set uhd_freq */
|
|
||||||
cuhd_set_rx_freq(uhd, (double) uhd_freq);
|
|
||||||
cuhd_rx_wait_lo_locked(uhd);
|
|
||||||
DEBUG("Set uhd_freq to %.3f MHz\n", (double ) uhd_freq/1000000);
|
|
||||||
|
|
||||||
int srate = lte_sampling_freq_hz(nof_prb);
|
|
||||||
if (srate > 0) {
|
|
||||||
cuhd_set_rx_srate(uhd, (double) srate);
|
|
||||||
} else {
|
|
||||||
fprintf(stderr, "Error invalid nof_prb=%d\n",nof_prb);
|
|
||||||
}
|
|
||||||
DEBUG("Starting receiver...\n", 0);
|
|
||||||
cuhd_start_rx_stream(uhd);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
int cuhd_recv_wrapper(void *h, void *data, uint32_t nsamples) {
|
|
||||||
DEBUG(" ---- Receive %d samples ---- \n", nsamples);
|
|
||||||
return cuhd_recv(h, data, nsamples, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifndef DISABLE_GRAPHICS
|
|
||||||
|
|
||||||
void init_plots() {
|
|
||||||
plot_init();
|
|
||||||
|
|
||||||
plot_real_init(&poutfft);
|
|
||||||
plot_real_setTitle(&poutfft, "Output FFT - Magnitude");
|
|
||||||
plot_real_setLabels(&poutfft, "Index", "dB");
|
|
||||||
plot_real_setYAxisScale(&poutfft, -60, 0);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
float tmp_plot[100000];
|
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
|
||||||
cf_t *input_buffer, *sf_symbols = NULL;
|
|
||||||
int frame_cnt;
|
|
||||||
ue_sync_t s;
|
|
||||||
int pos;
|
|
||||||
pss_synch_t pss;
|
|
||||||
float peak;
|
|
||||||
struct timeval t[3];
|
|
||||||
float mean_ce_time=0;
|
|
||||||
lte_fft_t fft;
|
|
||||||
lte_cell_t cell;
|
|
||||||
|
|
||||||
bzero(&cell, sizeof(lte_cell_t));
|
|
||||||
|
|
||||||
parse_args(argc, argv);
|
|
||||||
|
|
||||||
#ifndef DISABLE_GRAPHICS
|
|
||||||
if (!disable_plots) {
|
|
||||||
init_plots();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
input_init();
|
|
||||||
|
|
||||||
cell.cp = CPNORM;
|
|
||||||
cell.id = N_id_2;
|
|
||||||
cell.nof_ports = 1;
|
|
||||||
cell.nof_prb = nof_prb;
|
|
||||||
|
|
||||||
if (ue_sync_init(&s, cell, cuhd_recv_wrapper, uhd)) {
|
|
||||||
fprintf(stderr, "Error initiating UE sync module\n");
|
|
||||||
exit(-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
pss_synch_init_fft(&pss,
|
|
||||||
SF_LEN(lte_symbol_sz(cell.nof_prb)),
|
|
||||||
lte_symbol_sz(cell.nof_prb));
|
|
||||||
pss_synch_set_N_id_2(&pss, cell.id%3);
|
|
||||||
sf_symbols = vec_malloc(SLOT_LEN_RE(cell.nof_prb, cell.cp) * sizeof(cf_t));
|
|
||||||
if (!sf_symbols) {
|
|
||||||
perror("malloc");
|
|
||||||
exit(-1);
|
|
||||||
}
|
|
||||||
lte_fft_init(&fft, cell.cp, cell.nof_prb);
|
|
||||||
|
|
||||||
frame_cnt = 0;
|
|
||||||
mean_ce_time=0;
|
|
||||||
uint32_t valid_frames=0;
|
|
||||||
//uint32_t unaligned = 0;
|
|
||||||
while (frame_cnt < nof_frames || nof_frames == -1) {
|
|
||||||
|
|
||||||
int n = ue_sync_get_buffer(&s, &input_buffer);
|
|
||||||
if (n < 0) {
|
|
||||||
fprintf(stderr, "Error calling sync work()\n");
|
|
||||||
exit(-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (n == 1 && ue_sync_get_sfidx(&s) == 0) {
|
|
||||||
|
|
||||||
mean_ce_time = (float) (mean_ce_time + (float) t[0].tv_usec * valid_frames) / (valid_frames+1);
|
|
||||||
valid_frames++;
|
|
||||||
|
|
||||||
#ifndef DISABLE_GRAPHICS
|
|
||||||
if (!disable_plots && !(valid_frames % 5) && sf_symbols) {
|
|
||||||
|
|
||||||
/* Run FFT for the second slot */
|
|
||||||
lte_fft_run_slot(&fft, input_buffer, sf_symbols);
|
|
||||||
|
|
||||||
int i;
|
|
||||||
int nof_re = SLOT_LEN_RE(cell.nof_prb, cell.cp);
|
|
||||||
for (i = 0; i < nof_re; i++) {
|
|
||||||
tmp_plot[i] = 10 * log10f(cabsf(sf_symbols[i]));
|
|
||||||
if (isinf(tmp_plot[i])) {
|
|
||||||
tmp_plot[i] = -80;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
plot_real_setNewData(&poutfft, tmp_plot, nof_re);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
pos = pss_synch_find_pss(&pss, input_buffer, &peak);
|
|
||||||
printf("CELL_ID: %3d CFO: %+.4f KHz, SFO: %+.4f Khz, TimeOffset: %4d\r",
|
|
||||||
sync_get_cell_id(&s.sfind), ue_sync_get_cfo(&s)/1000, ue_sync_get_sfo(&s)/1000, pos);
|
|
||||||
fflush(stdout);
|
|
||||||
if (VERBOSE_ISINFO()) {
|
|
||||||
printf("\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
frame_cnt++;
|
|
||||||
}
|
|
||||||
|
|
||||||
printf("\nBye\n");
|
|
||||||
exit(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,27 +0,0 @@
|
|||||||
#
|
|
||||||
# Copyright 2012-2013 The libLTE Developers. See the
|
|
||||||
# COPYRIGHT file at the top-level directory of this distribution.
|
|
||||||
#
|
|
||||||
# This file is part of the libLTE library.
|
|
||||||
#
|
|
||||||
# libLTE is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU Lesser General Public License as
|
|
||||||
# published by the Free Software Foundation, either version 3 of
|
|
||||||
# the License, or (at your option) any later version.
|
|
||||||
#
|
|
||||||
# libLTE is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU Lesser General Public License for more details.
|
|
||||||
#
|
|
||||||
# A copy of the GNU Lesser General Public License can be found in
|
|
||||||
# the LICENSE file in the top-level directory of this distribution
|
|
||||||
# and at http://www.gnu.org/licenses/.
|
|
||||||
#
|
|
||||||
|
|
||||||
FILE(GLOB RRC_ASN_SOURCES *.c)
|
|
||||||
INCLUDE_DIRECTORIES("${CMAKE_CURRENT_SOURCE_DIR}/../include/liblte/rrc/asn/")
|
|
||||||
ADD_LIBRARY(rrc_asn SHARED ${RRC_ASN_SOURCES})
|
|
||||||
SET(CMAKE_C_FLAGS "-std=c99 -D_GNU_SOURCE -w")
|
|
||||||
INSTALL(TARGETS rrc_asn DESTINATION ${LIBRARY_DIR})
|
|
||||||
LIBLTE_SET_PIC(rrc_asn)
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue