npdsch_ue: fix compilation on Ubuntu 16.04

This commit is contained in:
Andre Puschmann 2020-04-19 15:36:24 +02:00
parent ca8be29219
commit 7587490c96
4 changed files with 63 additions and 21 deletions

View File

@ -53,7 +53,7 @@ else(RF_FOUND)
add_executable(npdsch_enodeb npdsch_enodeb.c)
target_link_libraries(npdsch_enodeb srslte_phy pthread)
add_executable(npdsch_ue npdsch_ue.c)
add_executable(npdsch_ue npdsch_ue.c npdsch_ue_helper.cc)
target_link_libraries(npdsch_ue srslte_common srslte_phy pthread rrc_asn1)
endif(RF_FOUND)

View File

@ -31,6 +31,7 @@
#include <sys/time.h>
#include <unistd.h>
#include "npdsch_ue_helper.h"
#include "srslte/phy/ch_estimation/chest_dl_nbiot.h"
#include "srslte/phy/channel/ch_awgn.h"
#include "srslte/phy/io/filesink.h"
@ -78,15 +79,6 @@ bool plot_track = true;
//#define CORRECT_SAMPLE_OFFSET
static srslte_nbiot_si_params_t sib2_params;
extern int get_sib2_params(const uint8_t* sib1_payload, const uint32_t len, srslte_nbiot_si_params_t* sib2_params);
extern int bcch_bch_to_pretty_string(const uint8_t* bcch_bch_payload,
const uint32_t input_len,
char* output,
const uint32_t max_output_len);
extern int bcch_dl_sch_to_pretty_string(const uint8_t* bcch_dl_sch_payload,
const uint32_t input_len,
char* output,
const uint32_t max_output_len);
/**********************************************************************
* Program arguments processing

View File

@ -19,13 +19,9 @@
*
*/
#include "npdsch_ue_helper.h"
#include "srslte/asn1/rrc_asn1_nbiot.h"
#include "srslte/phy/phch/ra_nbiot.h"
#include "srslte/phy/utils/vector.h"
#ifdef __cplusplus
extern "C" {
#endif
#include "srslte/phy/utils/vector.h" // for SRSLTE_MIN
int get_sib2_params(const uint8_t* sib1_payload, const uint32_t len, srslte_nbiot_si_params_t* sib2_params)
{
@ -35,6 +31,10 @@ int get_sib2_params(const uint8_t* sib1_payload, const uint32_t len, srslte_nbio
asn1::rrc::bcch_dl_sch_msg_nb_s dlsch_msg;
asn1::cbit_ref dlsch_bref(sib1_payload, len);
asn1::SRSASN_CODE err = dlsch_msg.unpack(dlsch_bref);
if (err != asn1::SRSASN_SUCCESS) {
fprintf(stderr, "Error unpacking DL-SCH message\n");
return SRSLTE_ERROR;
}
// set SIB2-NB parameters
sib2_params->n = 1;
@ -61,6 +61,10 @@ int bcch_bch_to_pretty_string(const uint8_t* bcch_bch_payload,
asn1::rrc::bcch_bch_msg_nb_s bch_msg;
asn1::cbit_ref bch_bref(bcch_bch_payload, input_len);
asn1::SRSASN_CODE err = bch_msg.unpack(bch_bref);
if (err != asn1::SRSASN_SUCCESS) {
fprintf(stderr, "Error unpacking BCCH message\n");
return SRSLTE_ERROR;
}
asn1::json_writer json_writer;
bch_msg.to_json(json_writer);
@ -82,6 +86,10 @@ int bcch_dl_sch_to_pretty_string(const uint8_t* bcch_dl_sch_payload,
asn1::rrc::bcch_dl_sch_msg_nb_s dlsch_msg;
asn1::cbit_ref dlsch_bref(bcch_dl_sch_payload, input_len);
asn1::SRSASN_CODE err = dlsch_msg.unpack(dlsch_bref);
if (err != asn1::SRSASN_SUCCESS) {
fprintf(stderr, "Error unpacking DL-SCH message\n");
return SRSLTE_ERROR;
}
asn1::json_writer json_writer;
dlsch_msg.to_json(json_writer);
@ -90,8 +98,4 @@ int bcch_dl_sch_to_pretty_string(const uint8_t* bcch_dl_sch_payload,
memcpy(output, json_writer.to_string().c_str(), output_len);
return SRSLTE_SUCCESS;
}
#ifdef __cplusplus
}
#endif
}

View File

@ -0,0 +1,46 @@
/*
* Copyright 2013-2020 Software Radio Systems Limited
*
* This file is part of srsLTE.
*
* srsLTE is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
*
* srsLTE 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 Affero General Public License for more details.
*
* A copy of the GNU Affero 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/.
*
*/
#ifndef SRSLTE_NPDSCH_UE_HELPER_H
#define SRSLTE_NPDSCH_UE_HELPER_H
#ifdef __cplusplus
extern "C" {
#endif
#include "srslte/phy/phch/ra_nbiot.h"
#include <stdint.h>
int get_sib2_params(const uint8_t* sib1_payload, const uint32_t len, srslte_nbiot_si_params_t* sib2_params);
int bcch_bch_to_pretty_string(const uint8_t* bcch_bch_payload,
const uint32_t input_len,
char* output,
const uint32_t max_output_len);
int bcch_dl_sch_to_pretty_string(const uint8_t* bcch_dl_sch_payload,
const uint32_t input_len,
char* output,
const uint32_t max_output_len);
#ifdef __cplusplus
}
#endif
#endif // SRSLTE_NPDSCH_UE_HELPER_H