Merge branch 'next' into agpl_next

# Conflicts:
#	cmake/modules/CheckFunctionExists.c
#	cmake/modules/SRSLTEVersion.cmake
#	lib/examples/cell_search.c
#	lib/examples/cell_search_nbiot.c
#	lib/examples/npdsch_enodeb.c
#	lib/examples/npdsch_ue.c
#	lib/examples/npdsch_ue_helper.cc
#	lib/examples/npdsch_ue_helper.h
#	lib/examples/pdsch_enodeb.c
#	lib/examples/pdsch_ue.c
#	lib/examples/pssch_ue.c
#	lib/examples/synch_file.c
#	lib/examples/usrp_capture.c
#	lib/examples/usrp_capture_sync.c
#	lib/examples/usrp_capture_sync_nbiot.c
#	lib/examples/usrp_txrx.c
#	lib/examples/zmq_remote_rx.c
#	lib/include/srslte/asn1/rrc_nr_utils.h
#	lib/include/srslte/config.h
#	lib/include/srslte/phy/ch_estimation/chest_dl.h
#	lib/include/srslte/phy/ch_estimation/chest_dl_nbiot.h
#	lib/include/srslte/phy/ch_estimation/chest_sl.h
#	lib/include/srslte/phy/ch_estimation/chest_ul.h
#	lib/include/srslte/phy/ch_estimation/csi_rs.h
#	lib/include/srslte/phy/ch_estimation/refsignal_dl.h
#	lib/include/srslte/phy/ch_estimation/refsignal_dl_nbiot.h
#	lib/include/srslte/phy/ch_estimation/refsignal_ul.h
#	lib/include/srslte/phy/common/phy_common.h
#	lib/include/srslte/phy/common/phy_common_sl.h
#	lib/include/srslte/phy/enb/enb_dl.h
#	lib/include/srslte/phy/enb/enb_dl_nr.h
#	lib/include/srslte/phy/enb/enb_ul.h
#	lib/include/srslte/phy/fec/turbo/turbodecoder.h
#	lib/include/srslte/phy/io/format.h
#	lib/include/srslte/phy/phch/dci.h
#	lib/include/srslte/phy/phch/dci_nbiot.h
#	lib/include/srslte/phy/phch/npbch.h
#	lib/include/srslte/phy/phch/npdcch.h
#	lib/include/srslte/phy/phch/npdsch.h
#	lib/include/srslte/phy/phch/pbch.h
#	lib/include/srslte/phy/phch/pcfich.h
#	lib/include/srslte/phy/phch/pdcch.h
#	lib/include/srslte/phy/phch/pdsch.h
#	lib/include/srslte/phy/phch/pdsch_nr.h
#	lib/include/srslte/phy/phch/phich.h
#	lib/include/srslte/phy/phch/pmch.h
#	lib/include/srslte/phy/phch/pscch.h
#	lib/include/srslte/phy/phch/pucch.h
#	lib/include/srslte/phy/phch/pusch.h
#	lib/include/srslte/phy/phch/ra.h
#	lib/include/srslte/phy/phch/ra_dl.h
#	lib/include/srslte/phy/phch/ra_ul.h
#	lib/include/srslte/phy/phch/sch.h
#	lib/include/srslte/phy/phch/uci_cfg.h
#	lib/include/srslte/phy/scrambling/scrambling.h
#	lib/include/srslte/phy/sync/cfo.h
#	lib/include/srslte/phy/sync/cp.h
#	lib/include/srslte/phy/sync/pss.h
#	lib/include/srslte/phy/sync/sss.h
#	lib/include/srslte/phy/sync/ssss.h
#	lib/include/srslte/phy/ue/ue_cell_search.h
#	lib/include/srslte/phy/ue/ue_cell_search_nbiot.h
#	lib/include/srslte/phy/ue/ue_dl.h
#	lib/include/srslte/phy/ue/ue_dl_nbiot.h
#	lib/include/srslte/phy/ue/ue_dl_nr.h
#	lib/include/srslte/phy/ue/ue_mib.h
#	lib/include/srslte/phy/ue/ue_sync.h
#	lib/include/srslte/phy/ue/ue_sync_nbiot.h
#	lib/include/srslte/phy/ue/ue_ul.h
#	lib/include/srslte/phy/ue/ue_ul_nr.h
#	lib/include/srslte/phy/utils/random.h
#	lib/include/srslte/phy/utils/vector_simd.h
#	lib/include/srslte/srslog/log_channel.h
#	lib/include/srslte/srslte.h
#	lib/include/srslte/version.h.in
#	lib/include/srsran/adt/accumulators.h
#	lib/include/srsran/adt/adt_utils.h
#	lib/include/srsran/adt/bounded_bitset.h
#	lib/include/srsran/adt/bounded_vector.h
#	lib/include/srsran/adt/choice_type.h
#	lib/include/srsran/adt/circular_array.h
#	lib/include/srsran/adt/circular_buffer.h
#	lib/include/srsran/adt/detail/index_sequence.h
#	lib/include/srsran/adt/detail/type_utils.h
#	lib/include/srsran/adt/expected.h
#	lib/include/srsran/adt/interval.h
#	lib/include/srsran/adt/mem_pool.h
#	lib/include/srsran/adt/move_callback.h
#	lib/include/srsran/adt/observer.h
#	lib/include/srsran/adt/scope_exit.h
#	lib/include/srsran/adt/span.h
#	lib/include/srsran/asn1/asn1_utils.h
#	lib/include/srsran/asn1/gtpc.h
#	lib/include/srsran/asn1/gtpc_ies.h
#	lib/include/srsran/asn1/gtpc_msg.h
#	lib/include/srsran/asn1/ngap.h
#	lib/include/srsran/asn1/rrc.h
#	lib/include/srsran/asn1/rrc/bcch_msg.h
#	lib/include/srsran/asn1/rrc/common.h
#	lib/include/srsran/asn1/rrc/common_ext.h
#	lib/include/srsran/asn1/rrc/dl_ccch_msg.h
#	lib/include/srsran/asn1/rrc/dl_dcch_msg.h
#	lib/include/srsran/asn1/rrc/ho_cmd.h
#	lib/include/srsran/asn1/rrc/meascfg.h
#	lib/include/srsran/asn1/rrc/paging.h
#	lib/include/srsran/asn1/rrc/phy_ded.h
#	lib/include/srsran/asn1/rrc/rr_common.h
#	lib/include/srsran/asn1/rrc/rr_ded.h
#	lib/include/srsran/asn1/rrc/rrc_asn1.h
#	lib/include/srsran/asn1/rrc/security.h
#	lib/include/srsran/asn1/rrc/si.h
#	lib/include/srsran/asn1/rrc/uecap.h
#	lib/include/srsran/asn1/rrc/ul_ccch_msg.h
#	lib/include/srsran/asn1/rrc/ul_dcch_msg.h
#	lib/include/srsran/asn1/rrc_nbiot.h
#	lib/include/srsran/asn1/rrc_nr.h
#	lib/include/srsran/asn1/rrc_utils.h
#	lib/include/srsran/asn1/s1ap.h
#	lib/include/srsran/asn1/s1ap_utils.h
#	lib/include/srsran/build_info.h.in
#	lib/include/srsran/common/backtrace.h
#	lib/include/srsran/common/band_helper.h
#	lib/include/srsran/common/basic_pnf.h
#	lib/include/srsran/common/basic_vnf.h
#	lib/include/srsran/common/basic_vnf_api.h
#	lib/include/srsran/common/bcd_helpers.h
#	lib/include/srsran/common/block_queue.h
#	lib/include/srsran/common/buffer_pool.h
#	lib/include/srsran/common/byte_buffer.h
#	lib/include/srsran/common/common.h
#	lib/include/srsran/common/common_helper.h
#	lib/include/srsran/common/config_file.h
#	lib/include/srsran/common/crash_handler.h
#	lib/include/srsran/common/enb_events.h
#	lib/include/srsran/common/epoll_helper.h
#	lib/include/srsran/common/fsm.h
#	lib/include/srsran/common/gen_mch_tables.h
#	lib/include/srsran/common/int_helpers.h
#	lib/include/srsran/common/interfaces_common.h
#	lib/include/srsran/common/log_helper.h
#	lib/include/srsran/common/mac_pcap.h
#	lib/include/srsran/common/mac_pcap_base.h
#	lib/include/srsran/common/mac_pcap_net.h
#	lib/include/srsran/common/metrics_hub.h
#	lib/include/srsran/common/multiqueue.h
#	lib/include/srsran/common/nas_pcap.h
#	lib/include/srsran/common/netsource_handler.h
#	lib/include/srsran/common/network_utils.h
#	lib/include/srsran/common/pcap.h
#	lib/include/srsran/common/rlc_pcap.h
#	lib/include/srsran/common/rwlock_guard.h
#	lib/include/srsran/common/s1ap_pcap.h
#	lib/include/srsran/common/s3g.h
#	lib/include/srsran/common/security.h
#	lib/include/srsran/common/signal_handler.h
#	lib/include/srsran/common/singleton.h
#	lib/include/srsran/common/ssl.h
#	lib/include/srsran/common/stack_procedure.h
#	lib/include/srsran/common/standard_streams.h
#	lib/include/srsran/common/string_helpers.h
#	lib/include/srsran/common/task_scheduler.h
#	lib/include/srsran/common/test_common.h
#	lib/include/srsran/common/thread_pool.h
#	lib/include/srsran/common/threads.h
#	lib/include/srsran/common/time_prof.h
#	lib/include/srsran/common/timeout.h
#	lib/include/srsran/common/timers.h
#	lib/include/srsran/common/trace.h
#	lib/include/srsran/common/tti_point.h
#	lib/include/srsran/common/tti_sempahore.h
#	lib/include/srsran/common/tti_sync.h
#	lib/include/srsran/common/tti_sync_cv.h
#	lib/include/srsran/common/zuc.h
#	lib/include/srsran/interfaces/enb_command_interface.h
#	lib/include/srsran/interfaces/enb_gtpu_interfaces.h
#	lib/include/srsran/interfaces/enb_interfaces.h
#	lib/include/srsran/interfaces/enb_mac_interfaces.h
#	lib/include/srsran/interfaces/enb_metrics_interface.h
#	lib/include/srsran/interfaces/enb_pdcp_interfaces.h
#	lib/include/srsran/interfaces/enb_phy_interfaces.h
#	lib/include/srsran/interfaces/enb_rlc_interfaces.h
#	lib/include/srsran/interfaces/enb_rrc_interface_types.h
#	lib/include/srsran/interfaces/enb_rrc_interfaces.h
#	lib/include/srsran/interfaces/enb_s1ap_interfaces.h
#	lib/include/srsran/interfaces/epc_interfaces.h
#	lib/include/srsran/interfaces/gnb_interfaces.h
#	lib/include/srsran/interfaces/mac_interface_types.h
#	lib/include/srsran/interfaces/nr_common_interface_types.h
#	lib/include/srsran/interfaces/pdcp_interface_types.h
#	lib/include/srsran/interfaces/phy_interface_types.h
#	lib/include/srsran/interfaces/radio_interfaces.h
#	lib/include/srsran/interfaces/rlc_interface_types.h
#	lib/include/srsran/interfaces/rrc_interface_types.h
#	lib/include/srsran/interfaces/rrc_nr_interface_types.h
#	lib/include/srsran/interfaces/sched_interface.h
#	lib/include/srsran/interfaces/ue_gw_interfaces.h
#	lib/include/srsran/interfaces/ue_interfaces.h
#	lib/include/srsran/interfaces/ue_mac_interfaces.h
#	lib/include/srsran/interfaces/ue_nas_interfaces.h
#	lib/include/srsran/interfaces/ue_nr_interfaces.h
#	lib/include/srsran/interfaces/ue_pdcp_interfaces.h
#	lib/include/srsran/interfaces/ue_phy_interfaces.h
#	lib/include/srsran/interfaces/ue_rlc_interfaces.h
#	lib/include/srsran/interfaces/ue_rrc_interfaces.h
#	lib/include/srsran/interfaces/ue_usim_interfaces.h
#	lib/include/srsran/mac/mac_rar_pdu_nr.h
#	lib/include/srsran/mac/mac_sch_pdu_nr.h
#	lib/include/srsran/mac/pdu.h
#	lib/include/srsran/mac/pdu_queue.h
#	lib/include/srsran/phy/agc/agc.h
#	lib/include/srsran/phy/ch_estimation/chest_common.h
#	lib/include/srsran/phy/ch_estimation/dmrs_pdcch.h
#	lib/include/srsran/phy/ch_estimation/dmrs_pucch.h
#	lib/include/srsran/phy/ch_estimation/dmrs_sch.h
#	lib/include/srsran/phy/ch_estimation/wiener_dl.h
#	lib/include/srsran/phy/channel/ch_awgn.h
#	lib/include/srsran/phy/channel/channel.h
#	lib/include/srsran/phy/channel/delay.h
#	lib/include/srsran/phy/channel/fading.h
#	lib/include/srsran/phy/channel/hst.h
#	lib/include/srsran/phy/channel/rlf.h
#	lib/include/srsran/phy/common/phy_common_nr.h
#	lib/include/srsran/phy/common/sequence.h
#	lib/include/srsran/phy/common/timestamp.h
#	lib/include/srsran/phy/common/zc_sequence.h
#	lib/include/srsran/phy/dft/dft.h
#	lib/include/srsran/phy/dft/dft_precoding.h
#	lib/include/srsran/phy/dft/ofdm.h
#	lib/include/srsran/phy/fec/block/block.h
#	lib/include/srsran/phy/fec/cbsegm.h
#	lib/include/srsran/phy/fec/convolutional/convcoder.h
#	lib/include/srsran/phy/fec/convolutional/rm_conv.h
#	lib/include/srsran/phy/fec/convolutional/viterbi.h
#	lib/include/srsran/phy/fec/crc.h
#	lib/include/srsran/phy/fec/ldpc/base_graph.h
#	lib/include/srsran/phy/fec/ldpc/ldpc_common.h
#	lib/include/srsran/phy/fec/ldpc/ldpc_decoder.h
#	lib/include/srsran/phy/fec/ldpc/ldpc_encoder.h
#	lib/include/srsran/phy/fec/ldpc/ldpc_rm.h
#	lib/include/srsran/phy/fec/polar/polar_chanalloc.h
#	lib/include/srsran/phy/fec/polar/polar_code.h
#	lib/include/srsran/phy/fec/polar/polar_decoder.h
#	lib/include/srsran/phy/fec/polar/polar_encoder.h
#	lib/include/srsran/phy/fec/polar/polar_interleaver.h
#	lib/include/srsran/phy/fec/polar/polar_rm.h
#	lib/include/srsran/phy/fec/polar/test/polar_sets.h
#	lib/include/srsran/phy/fec/polar/test/subchannel_allocation.h
#	lib/include/srsran/phy/fec/softbuffer.h
#	lib/include/srsran/phy/fec/turbo/rm_turbo.h
#	lib/include/srsran/phy/fec/turbo/tc_interl.h
#	lib/include/srsran/phy/fec/turbo/turbocoder.h
#	lib/include/srsran/phy/fec/turbo/turbodecoder_gen.h
#	lib/include/srsran/phy/fec/turbo/turbodecoder_impl.h
#	lib/include/srsran/phy/fec/turbo/turbodecoder_iter.h
#	lib/include/srsran/phy/fec/turbo/turbodecoder_sse.h
#	lib/include/srsran/phy/fec/turbo/turbodecoder_win.h
#	lib/include/srsran/phy/io/binsource.h
#	lib/include/srsran/phy/io/filesink.h
#	lib/include/srsran/phy/io/filesource.h
#	lib/include/srsran/phy/io/netsink.h
#	lib/include/srsran/phy/io/netsource.h
#	lib/include/srsran/phy/mimo/layermap.h
#	lib/include/srsran/phy/mimo/precoding.h
#	lib/include/srsran/phy/modem/demod_hard.h
#	lib/include/srsran/phy/modem/demod_soft.h
#	lib/include/srsran/phy/modem/evm.h
#	lib/include/srsran/phy/modem/mod.h
#	lib/include/srsran/phy/modem/modem_table.h
#	lib/include/srsran/phy/phch/cqi.h
#	lib/include/srsran/phy/phch/csi.h
#	lib/include/srsran/phy/phch/csi_cfg.h
#	lib/include/srsran/phy/phch/dci_nr.h
#	lib/include/srsran/phy/phch/mib_sl.h
#	lib/include/srsran/phy/phch/npdsch_cfg.h
#	lib/include/srsran/phy/phch/pdcch_nr.h
#	lib/include/srsran/phy/phch/pdsch_cfg.h
#	lib/include/srsran/phy/phch/phch_cfg_nr.h
#	lib/include/srsran/phy/phch/prach.h
#	lib/include/srsran/phy/phch/psbch.h
#	lib/include/srsran/phy/phch/pssch.h
#	lib/include/srsran/phy/phch/pucch_cfg.h
#	lib/include/srsran/phy/phch/pucch_cfg_nr.h
#	lib/include/srsran/phy/phch/pucch_nr.h
#	lib/include/srsran/phy/phch/pucch_proc.h
#	lib/include/srsran/phy/phch/pusch_cfg.h
#	lib/include/srsran/phy/phch/pusch_nr.h
#	lib/include/srsran/phy/phch/ra_dl_nr.h
#	lib/include/srsran/phy/phch/ra_nbiot.h
#	lib/include/srsran/phy/phch/ra_nr.h
#	lib/include/srsran/phy/phch/ra_sl.h
#	lib/include/srsran/phy/phch/ra_ul_nr.h
#	lib/include/srsran/phy/phch/regs.h
#	lib/include/srsran/phy/phch/sch_cfg_nr.h
#	lib/include/srsran/phy/phch/sch_nr.h
#	lib/include/srsran/phy/phch/sci.h
#	lib/include/srsran/phy/phch/uci.h
#	lib/include/srsran/phy/phch/uci_cfg_nr.h
#	lib/include/srsran/phy/phch/uci_nr.h
#	lib/include/srsran/phy/resampling/decim.h
#	lib/include/srsran/phy/resampling/interp.h
#	lib/include/srsran/phy/resampling/resample_arb.h
#	lib/include/srsran/phy/resampling/resampler.h
#	lib/include/srsran/phy/rf/rf.h
#	lib/include/srsran/phy/rf/rf_utils.h
#	lib/include/srsran/phy/sync/npss.h
#	lib/include/srsran/phy/sync/nsss.h
#	lib/include/srsran/phy/sync/psss.h
#	lib/include/srsran/phy/sync/refsignal_dl_sync.h
#	lib/include/srsran/phy/sync/sfo.h
#	lib/include/srsran/phy/sync/sync.h
#	lib/include/srsran/phy/sync/sync_nbiot.h
#	lib/include/srsran/phy/ue/ue_mib_nbiot.h
#	lib/include/srsran/phy/ue/ue_mib_sl.h
#	lib/include/srsran/phy/ue/ue_phy.h
#	lib/include/srsran/phy/utils/bit.h
#	lib/include/srsran/phy/utils/cexptab.h
#	lib/include/srsran/phy/utils/convolution.h
#	lib/include/srsran/phy/utils/debug.h
#	lib/include/srsran/phy/utils/filter.h
#	lib/include/srsran/phy/utils/mat.h
#	lib/include/srsran/phy/utils/phy_logger.h
#	lib/include/srsran/phy/utils/primes.h
#	lib/include/srsran/phy/utils/ringbuffer.h
#	lib/include/srsran/phy/utils/simd.h
#	lib/include/srsran/phy/utils/vector.h
#	lib/include/srsran/radio/channel_mapping.h
#	lib/include/srsran/radio/radio.h
#	lib/include/srsran/radio/radio_base.h
#	lib/include/srsran/radio/radio_metrics.h
#	lib/include/srsran/radio/radio_null.h
#	lib/include/srsran/radio/rf_buffer.h
#	lib/include/srsran/radio/rf_timestamp.h
#	lib/include/srsran/rrc/rrc_cfg_utils.h
#	lib/include/srsran/srslog/context.h
#	lib/include/srsran/srslog/detail/log_backend.h
#	lib/include/srsran/srslog/detail/log_entry.h
#	lib/include/srsran/srslog/detail/log_entry_metadata.h
#	lib/include/srsran/srslog/detail/support/any.h
#	lib/include/srsran/srslog/detail/support/error_string.h
#	lib/include/srsran/srslog/detail/support/memory_buffer.h
#	lib/include/srsran/srslog/detail/support/thread_utils.h
#	lib/include/srsran/srslog/detail/support/tmp_utils.h
#	lib/include/srsran/srslog/detail/support/work_queue.h
#	lib/include/srsran/srslog/event_trace.h
#	lib/include/srsran/srslog/formatter.h
#	lib/include/srsran/srslog/logger.h
#	lib/include/srsran/srslog/shared_types.h
#	lib/include/srsran/srslog/sink.h
#	lib/include/srsran/srslog/srslog.h
#	lib/include/srsran/srslog/srslog_c.h
#	lib/include/srsran/system/sys_metrics.h
#	lib/include/srsran/system/sys_metrics_processor.h
#	lib/include/srsran/test/ue_test_interfaces.h
#	lib/include/srsran/upper/byte_buffer_queue.h
#	lib/include/srsran/upper/gtpu.h
#	lib/include/srsran/upper/ipv6.h
#	lib/include/srsran/upper/pdcp.h
#	lib/include/srsran/upper/pdcp_entity_base.h
#	lib/include/srsran/upper/pdcp_entity_lte.h
#	lib/include/srsran/upper/pdcp_entity_nr.h
#	lib/include/srsran/upper/pdcp_metrics.h
#	lib/include/srsran/upper/rlc.h
#	lib/include/srsran/upper/rlc_am_base.h
#	lib/include/srsran/upper/rlc_am_lte.h
#	lib/include/srsran/upper/rlc_am_nr.h
#	lib/include/srsran/upper/rlc_common.h
#	lib/include/srsran/upper/rlc_metrics.h
#	lib/include/srsran/upper/rlc_tm.h
#	lib/include/srsran/upper/rlc_um_base.h
#	lib/include/srsran/upper/rlc_um_lte.h
#	lib/include/srsran/upper/rlc_um_nr.h
#	lib/src/asn1/asn1_utils.cc
#	lib/src/asn1/gtpc.cc
#	lib/src/asn1/ngap.cc
#	lib/src/asn1/rrc.cc
#	lib/src/asn1/rrc/bcch_msg.cc
#	lib/src/asn1/rrc/common.cc
#	lib/src/asn1/rrc/common_ext.cc
#	lib/src/asn1/rrc/dl_ccch_msg.cc
#	lib/src/asn1/rrc/dl_dcch_msg.cc
#	lib/src/asn1/rrc/ho_cmd.cc
#	lib/src/asn1/rrc/meascfg.cc
#	lib/src/asn1/rrc/paging.cc
#	lib/src/asn1/rrc/phy_ded.cc
#	lib/src/asn1/rrc/rr_common.cc
#	lib/src/asn1/rrc/rr_ded.cc
#	lib/src/asn1/rrc/security.cc
#	lib/src/asn1/rrc/si.cc
#	lib/src/asn1/rrc/uecap.cc
#	lib/src/asn1/rrc/ul_ccch_msg.cc
#	lib/src/asn1/rrc/ul_dcch_msg.cc
#	lib/src/asn1/rrc_nbiot.cc
#	lib/src/asn1/rrc_nr.cc
#	lib/src/asn1/rrc_nr_utils.cc
#	lib/src/asn1/rrc_utils.cc
#	lib/src/asn1/s1ap.cc
#	lib/src/common/arch_select.cc
#	lib/src/common/backtrace.c
#	lib/src/common/band_helper.cc
#	lib/src/common/basic_vnf.cc
#	lib/src/common/buffer_pool.cc
#	lib/src/common/byte_buffer.cc
#	lib/src/common/crash_handler.cc
#	lib/src/common/enb_events.cc
#	lib/src/common/gen_mch_tables.c
#	lib/src/common/mac_pcap.cc
#	lib/src/common/mac_pcap_base.cc
#	lib/src/common/mac_pcap_net.cc
#	lib/src/common/nas_pcap.cc
#	lib/src/common/network_utils.cc
#	lib/src/common/pcap.c
#	lib/src/common/rlc_pcap.cc
#	lib/src/common/s1ap_pcap.cc
#	lib/src/common/s3g.cc
#	lib/src/common/security.cc
#	lib/src/common/standard_streams.cc
#	lib/src/common/test/band_helper_test.cc
#	lib/src/common/test/thread_pool_test.cc
#	lib/src/common/test/thread_test.cc
#	lib/src/common/thread_pool.cc
#	lib/src/common/threads.c
#	lib/src/common/time_prof.cc
#	lib/src/common/tti_sync_cv.cc
#	lib/src/common/version.c
#	lib/src/common/zuc.cc
#	lib/src/mac/mac_rar_pdu_nr.cc
#	lib/src/mac/mac_sch_pdu_nr.cc
#	lib/src/mac/pdu.cc
#	lib/src/mac/pdu_queue.cc
#	lib/src/phy/agc/agc.c
#	lib/src/phy/ch_estimation/chest_common.c
#	lib/src/phy/ch_estimation/chest_dl.c
#	lib/src/phy/ch_estimation/chest_dl_nbiot.c
#	lib/src/phy/ch_estimation/chest_sl.c
#	lib/src/phy/ch_estimation/chest_ul.c
#	lib/src/phy/ch_estimation/csi_rs.c
#	lib/src/phy/ch_estimation/dmrs_pdcch.c
#	lib/src/phy/ch_estimation/dmrs_pucch.c
#	lib/src/phy/ch_estimation/dmrs_sch.c
#	lib/src/phy/ch_estimation/refsignal_dl.c
#	lib/src/phy/ch_estimation/refsignal_dl_nbiot.c
#	lib/src/phy/ch_estimation/refsignal_ul.c
#	lib/src/phy/ch_estimation/test/chest_nbiot_test_dl.c
#	lib/src/phy/ch_estimation/test/chest_test_dl.c
#	lib/src/phy/ch_estimation/test/chest_test_sl.c
#	lib/src/phy/ch_estimation/test/chest_test_srs.c
#	lib/src/phy/ch_estimation/test/chest_test_ul.c
#	lib/src/phy/ch_estimation/test/csi_rs_test.c
#	lib/src/phy/ch_estimation/test/dmrs_pdcch_test.c
#	lib/src/phy/ch_estimation/test/dmrs_pdsch_test.c
#	lib/src/phy/ch_estimation/test/refsignal_ul_test.c
#	lib/src/phy/ch_estimation/wiener_dl.c
#	lib/src/phy/channel/ch_awgn.c
#	lib/src/phy/channel/channel.cc
#	lib/src/phy/channel/delay.c
#	lib/src/phy/channel/fading.c
#	lib/src/phy/channel/gauss.c
#	lib/src/phy/channel/gauss.h
#	lib/src/phy/channel/hst.c
#	lib/src/phy/channel/rlf.c
#	lib/src/phy/channel/test/awgn_channel_test.c
#	lib/src/phy/channel/test/delay_channel_test.c
#	lib/src/phy/channel/test/fading_channel_test.c
#	lib/src/phy/channel/test/hst_channel_test.c
#	lib/src/phy/common/phy_common.c
#	lib/src/phy/common/phy_common_nr.c
#	lib/src/phy/common/phy_common_sl.c
#	lib/src/phy/common/sequence.c
#	lib/src/phy/common/test/sequence_test.c
#	lib/src/phy/common/timestamp.c
#	lib/src/phy/common/zc_sequence.c
#	lib/src/phy/dft/dft_fftw.c
#	lib/src/phy/dft/dft_precoding.c
#	lib/src/phy/dft/ofdm.c
#	lib/src/phy/dft/test/ofdm_test.c
#	lib/src/phy/enb/enb_dl.c
#	lib/src/phy/enb/enb_dl_nr.c
#	lib/src/phy/enb/enb_ul.c
#	lib/src/phy/fec/block/block.c
#	lib/src/phy/fec/block/test/block_test.c
#	lib/src/phy/fec/cbsegm.c
#	lib/src/phy/fec/convolutional/convcoder.c
#	lib/src/phy/fec/convolutional/parity.c
#	lib/src/phy/fec/convolutional/parity.h
#	lib/src/phy/fec/convolutional/test/viterbi_test.c
#	lib/src/phy/fec/convolutional/test/viterbi_test.h
#	lib/src/phy/fec/convolutional/viterbi.c
#	lib/src/phy/fec/convolutional/viterbi37.h
#	lib/src/phy/fec/crc.c
#	lib/src/phy/fec/ldpc/base_graph.c
#	lib/src/phy/fec/ldpc/ldpc_avx2_consts.h
#	lib/src/phy/fec/ldpc/ldpc_avx512_consts.h
#	lib/src/phy/fec/ldpc/ldpc_dec_all.h
#	lib/src/phy/fec/ldpc/ldpc_dec_c.c
#	lib/src/phy/fec/ldpc/ldpc_dec_c_avx2.c
#	lib/src/phy/fec/ldpc/ldpc_dec_c_avx2_flood.c
#	lib/src/phy/fec/ldpc/ldpc_dec_c_avx2long.c
#	lib/src/phy/fec/ldpc/ldpc_dec_c_avx2long_flood.c
#	lib/src/phy/fec/ldpc/ldpc_dec_c_avx512.c
#	lib/src/phy/fec/ldpc/ldpc_dec_c_avx512long.c
#	lib/src/phy/fec/ldpc/ldpc_dec_c_avx512long_flood.c
#	lib/src/phy/fec/ldpc/ldpc_dec_c_flood.c
#	lib/src/phy/fec/ldpc/ldpc_dec_f.c
#	lib/src/phy/fec/ldpc/ldpc_dec_s.c
#	lib/src/phy/fec/ldpc/ldpc_decoder.c
#	lib/src/phy/fec/ldpc/ldpc_enc_all.h
#	lib/src/phy/fec/ldpc/ldpc_enc_avx2.c
#	lib/src/phy/fec/ldpc/ldpc_enc_avx2long.c
#	lib/src/phy/fec/ldpc/ldpc_enc_avx512.c
#	lib/src/phy/fec/ldpc/ldpc_enc_avx512long.c
#	lib/src/phy/fec/ldpc/ldpc_enc_c.c
#	lib/src/phy/fec/ldpc/ldpc_encoder.c
#	lib/src/phy/fec/ldpc/ldpc_rm.c
#	lib/src/phy/fec/ldpc/test/ldpc_chain_test.c
#	lib/src/phy/fec/ldpc/test/ldpc_dec_avx2_test.c
#	lib/src/phy/fec/ldpc/test/ldpc_dec_avx512_test.c
#	lib/src/phy/fec/ldpc/test/ldpc_dec_c_test.c
#	lib/src/phy/fec/ldpc/test/ldpc_dec_s_test.c
#	lib/src/phy/fec/ldpc/test/ldpc_dec_test.c
#	lib/src/phy/fec/ldpc/test/ldpc_enc_avx2_test.c
#	lib/src/phy/fec/ldpc/test/ldpc_enc_avx512_test.c
#	lib/src/phy/fec/ldpc/test/ldpc_enc_test.c
#	lib/src/phy/fec/ldpc/test/ldpc_rm_chain_test.c
#	lib/src/phy/fec/ldpc/test/ldpc_rm_test.c
#	lib/src/phy/fec/polar/polar_chanalloc.c
#	lib/src/phy/fec/polar/polar_code.c
#	lib/src/phy/fec/polar/polar_decoder.c
#	lib/src/phy/fec/polar/polar_decoder_ssc_all.c
#	lib/src/phy/fec/polar/polar_decoder_ssc_all.h
#	lib/src/phy/fec/polar/polar_decoder_ssc_c.c
#	lib/src/phy/fec/polar/polar_decoder_ssc_c.h
#	lib/src/phy/fec/polar/polar_decoder_ssc_c_avx2.c
#	lib/src/phy/fec/polar/polar_decoder_ssc_c_avx2.h
#	lib/src/phy/fec/polar/polar_decoder_ssc_f.c
#	lib/src/phy/fec/polar/polar_decoder_ssc_f.h
#	lib/src/phy/fec/polar/polar_decoder_ssc_s.c
#	lib/src/phy/fec/polar/polar_decoder_ssc_s.h
#	lib/src/phy/fec/polar/polar_decoder_vector.c
#	lib/src/phy/fec/polar/polar_decoder_vector.h
#	lib/src/phy/fec/polar/polar_decoder_vector_avx2.c
#	lib/src/phy/fec/polar/polar_decoder_vector_avx2.h
#	lib/src/phy/fec/polar/polar_encoder.c
#	lib/src/phy/fec/polar/polar_encoder_avx2.c
#	lib/src/phy/fec/polar/polar_encoder_avx2.h
#	lib/src/phy/fec/polar/polar_encoder_pipelined.c
#	lib/src/phy/fec/polar/polar_encoder_pipelined.h
#	lib/src/phy/fec/polar/polar_interleaver.c
#	lib/src/phy/fec/polar/polar_rm.c
#	lib/src/phy/fec/polar/test/polar_chain_test.c
#	lib/src/phy/fec/polar/test/polar_interleaver_gold.h
#	lib/src/phy/fec/polar/test/polar_interleaver_test.c
#	lib/src/phy/fec/polar/test/polar_sets.c
#	lib/src/phy/fec/polar/test/polar_sets.h
#	lib/src/phy/fec/polar/test/subchannel_allocation.c
#	lib/src/phy/fec/polar/test/subchannel_allocation.h
#	lib/src/phy/fec/softbuffer.c
#	lib/src/phy/fec/test/crc_test.c
#	lib/src/phy/fec/test/crc_test.h
#	lib/src/phy/fec/turbo/rm_conv.c
#	lib/src/phy/fec/turbo/rm_turbo.c
#	lib/src/phy/fec/turbo/tc_interl_lte.c
#	lib/src/phy/fec/turbo/tc_interl_umts.c
#	lib/src/phy/fec/turbo/test/rm_conv_test.c
#	lib/src/phy/fec/turbo/test/rm_turbo_test.c
#	lib/src/phy/fec/turbo/test/turbocoder_test.c
#	lib/src/phy/fec/turbo/test/turbodecoder_test.c
#	lib/src/phy/fec/turbo/test/turbodecoder_test.h
#	lib/src/phy/fec/turbo/turbocoder.c
#	lib/src/phy/fec/turbo/turbodecoder.c
#	lib/src/phy/fec/turbo/turbodecoder_gen.c
#	lib/src/phy/fec/turbo/turbodecoder_sse.c
#	lib/src/phy/fec/utils_avx2.h
#	lib/src/phy/fec/utils_avx512.h
#	lib/src/phy/io/binsource.c
#	lib/src/phy/io/filesink.c
#	lib/src/phy/io/filesource.c
#	lib/src/phy/io/netsink.c
#	lib/src/phy/io/netsource.c
#	lib/src/phy/mimo/layermap.c
#	lib/src/phy/mimo/precoding.c
#	lib/src/phy/mimo/test/layermap_test.c
#	lib/src/phy/mimo/test/pmi_select_test.c
#	lib/src/phy/mimo/test/pmi_select_test.h
#	lib/src/phy/mimo/test/precoder_test.c
#	lib/src/phy/modem/demod_hard.c
#	lib/src/phy/modem/demod_soft.c
#	lib/src/phy/modem/hard_demod_lte.c
#	lib/src/phy/modem/hard_demod_lte.h
#	lib/src/phy/modem/lte_tables.c
#	lib/src/phy/modem/lte_tables.h
#	lib/src/phy/modem/mod.c
#	lib/src/phy/modem/modem_table.c
#	lib/src/phy/modem/test/modem_test.c
#	lib/src/phy/modem/test/soft_demod_test.c
#	lib/src/phy/phch/cqi.c
#	lib/src/phy/phch/csi.c
#	lib/src/phy/phch/dci.c
#	lib/src/phy/phch/dci_nbiot.c
#	lib/src/phy/phch/dci_nr.c
#	lib/src/phy/phch/mib_sl.c
#	lib/src/phy/phch/npbch.c
#	lib/src/phy/phch/npdcch.c
#	lib/src/phy/phch/npdsch.c
#	lib/src/phy/phch/pbch.c
#	lib/src/phy/phch/pcfich.c
#	lib/src/phy/phch/pdcch.c
#	lib/src/phy/phch/pdcch_nr.c
#	lib/src/phy/phch/pdsch.c
#	lib/src/phy/phch/pdsch_nr.c
#	lib/src/phy/phch/phich.c
#	lib/src/phy/phch/pmch.c
#	lib/src/phy/phch/prach.c
#	lib/src/phy/phch/prach_tables.h
#	lib/src/phy/phch/prb_dl.c
#	lib/src/phy/phch/prb_dl.h
#	lib/src/phy/phch/psbch.c
#	lib/src/phy/phch/pscch.c
#	lib/src/phy/phch/pssch.c
#	lib/src/phy/phch/pucch.c
#	lib/src/phy/phch/pucch_cfg_nr.c
#	lib/src/phy/phch/pucch_nr.c
#	lib/src/phy/phch/pucch_proc.c
#	lib/src/phy/phch/pusch.c
#	lib/src/phy/phch/pusch_nr.c
#	lib/src/phy/phch/ra.c
#	lib/src/phy/phch/ra_dl.c
#	lib/src/phy/phch/ra_dl_nr.c
#	lib/src/phy/phch/ra_helper.h
#	lib/src/phy/phch/ra_nbiot.c
#	lib/src/phy/phch/ra_nr.c
#	lib/src/phy/phch/ra_sl.c
#	lib/src/phy/phch/ra_ul.c
#	lib/src/phy/phch/ra_ul_nr.c
#	lib/src/phy/phch/regs.c
#	lib/src/phy/phch/sch.c
#	lib/src/phy/phch/sch_nr.c
#	lib/src/phy/phch/sci.c
#	lib/src/phy/phch/sequences.c
#	lib/src/phy/phch/tbs_tables.h
#	lib/src/phy/phch/tbs_tables_nbiot.h
#	lib/src/phy/phch/test/dci_nbiot_test.c
#	lib/src/phy/phch/test/npbch_file_test.c
#	lib/src/phy/phch/test/npbch_test.c
#	lib/src/phy/phch/test/npdcch_file_test.c
#	lib/src/phy/phch/test/npdcch_test.c
#	lib/src/phy/phch/test/npdsch_npdcch_file_test.c
#	lib/src/phy/phch/test/npdsch_test.c
#	lib/src/phy/phch/test/pbch_file_test.c
#	lib/src/phy/phch/test/pbch_test.c
#	lib/src/phy/phch/test/pcfich_file_test.c
#	lib/src/phy/phch/test/pcfich_test.c
#	lib/src/phy/phch/test/pdcch_file_test.c
#	lib/src/phy/phch/test/pdcch_nr_test.c
#	lib/src/phy/phch/test/pdcch_test.c
#	lib/src/phy/phch/test/pdsch_nr_test.c
#	lib/src/phy/phch/test/pdsch_pdcch_file_test.c
#	lib/src/phy/phch/test/pdsch_test.c
#	lib/src/phy/phch/test/phich_file_test.c
#	lib/src/phy/phch/test/phich_test.c
#	lib/src/phy/phch/test/pmch_file_test.c
#	lib/src/phy/phch/test/pmch_test.c
#	lib/src/phy/phch/test/prach_test.c
#	lib/src/phy/phch/test/prach_test_multi.c
#	lib/src/phy/phch/test/prach_test_usrp.c
#	lib/src/phy/phch/test/psbch_file_test.c
#	lib/src/phy/phch/test/psbch_test.c
#	lib/src/phy/phch/test/pscch_test.c
#	lib/src/phy/phch/test/pssch_pscch_file_test.c
#	lib/src/phy/phch/test/pssch_test.c
#	lib/src/phy/phch/test/pucch_nr_test.c
#	lib/src/phy/phch/test/pucch_test.c
#	lib/src/phy/phch/test/pusch_nr_test.c
#	lib/src/phy/phch/test/pusch_test.c
#	lib/src/phy/phch/test/ra_nr_test.c
#	lib/src/phy/phch/test/sch_nr_test.c
#	lib/src/phy/phch/uci.c
#	lib/src/phy/phch/uci_nr.c
#	lib/src/phy/resampling/decim.c
#	lib/src/phy/resampling/interp.c
#	lib/src/phy/resampling/resample_arb.c
#	lib/src/phy/resampling/resampler.c
#	lib/src/phy/resampling/test/resample_arb_bench.c
#	lib/src/phy/resampling/test/resample_arb_test.c
#	lib/src/phy/resampling/test/resampler_test.c
#	lib/src/phy/rf/rf_blade_imp.c
#	lib/src/phy/rf/rf_blade_imp.h
#	lib/src/phy/rf/rf_dev.h
#	lib/src/phy/rf/rf_helper.h
#	lib/src/phy/rf/rf_imp.c
#	lib/src/phy/rf/rf_soapy_imp.c
#	lib/src/phy/rf/rf_soapy_imp.h
#	lib/src/phy/rf/rf_uhd_generic.h
#	lib/src/phy/rf/rf_uhd_imp.cc
#	lib/src/phy/rf/rf_uhd_imp.h
#	lib/src/phy/rf/rf_uhd_rfnoc.h
#	lib/src/phy/rf/rf_uhd_safe.h
#	lib/src/phy/rf/rf_utils.c
#	lib/src/phy/rf/rf_zmq_imp.c
#	lib/src/phy/rf/rf_zmq_imp.h
#	lib/src/phy/rf/rf_zmq_imp_rx.c
#	lib/src/phy/rf/rf_zmq_imp_trx.h
#	lib/src/phy/rf/rf_zmq_imp_tx.c
#	lib/src/phy/rf/rf_zmq_test.c
#	lib/src/phy/scrambling/scrambling.c
#	lib/src/phy/scrambling/test/scrambling_test.c
#	lib/src/phy/sync/cfo.c
#	lib/src/phy/sync/cp.c
#	lib/src/phy/sync/find_sss.c
#	lib/src/phy/sync/gen_sss.c
#	lib/src/phy/sync/npss.c
#	lib/src/phy/sync/nsss.c
#	lib/src/phy/sync/pss.c
#	lib/src/phy/sync/psss.c
#	lib/src/phy/sync/refsignal_dl_sync.c
#	lib/src/phy/sync/sfo.c
#	lib/src/phy/sync/sss.c
#	lib/src/phy/sync/ssss.c
#	lib/src/phy/sync/sync.c
#	lib/src/phy/sync/sync_nbiot.c
#	lib/src/phy/sync/test/cfo_test.c
#	lib/src/phy/sync/test/npss_file.c
#	lib/src/phy/sync/test/npss_test.c
#	lib/src/phy/sync/test/npss_usrp.c
#	lib/src/phy/sync/test/nsss_test.c
#	lib/src/phy/sync/test/nsss_usrp.c
#	lib/src/phy/sync/test/pss_file.c
#	lib/src/phy/sync/test/pss_usrp.c
#	lib/src/phy/sync/test/psss_file_test.c
#	lib/src/phy/sync/test/sync_nbiot_test.c
#	lib/src/phy/sync/test/sync_sl_test.c
#	lib/src/phy/sync/test/sync_test.c
#	lib/src/phy/ue/test/gen_ack_test.c
#	lib/src/phy/ue/test/pucch_resource_test.c
#	lib/src/phy/ue/test/ue_dl_nbiot_test.c
#	lib/src/phy/ue/test/ue_mib_sync_test_nbiot_usrp.c
#	lib/src/phy/ue/test/ue_sync_test_nbiot_usrp.c
#	lib/src/phy/ue/ue_cell_search.c
#	lib/src/phy/ue/ue_cell_search_nbiot.c
#	lib/src/phy/ue/ue_dl.c
#	lib/src/phy/ue/ue_dl_nbiot.c
#	lib/src/phy/ue/ue_dl_nr.c
#	lib/src/phy/ue/ue_mib.c
#	lib/src/phy/ue/ue_mib_nbiot.c
#	lib/src/phy/ue/ue_mib_sl.c
#	lib/src/phy/ue/ue_sync.c
#	lib/src/phy/ue/ue_sync_nbiot.c
#	lib/src/phy/ue/ue_ul.c
#	lib/src/phy/ue/ue_ul_nr.c
#	lib/src/phy/utils/bit.c
#	lib/src/phy/utils/cexptab.c
#	lib/src/phy/utils/convolution.c
#	lib/src/phy/utils/debug.c
#	lib/src/phy/utils/filter.c
#	lib/src/phy/utils/mat.c
#	lib/src/phy/utils/phy_logger.c
#	lib/src/phy/utils/primes.c
#	lib/src/phy/utils/random.cpp
#	lib/src/phy/utils/ringbuffer.c
#	lib/src/phy/utils/test/dft_test.c
#	lib/src/phy/utils/test/mat_test.c
#	lib/src/phy/utils/test/ring_buffer_test.c
#	lib/src/phy/utils/test/vector_test.c
#	lib/src/phy/utils/vector.c
#	lib/src/phy/utils/vector_simd.c
#	lib/src/radio/channel_mapping.cc
#	lib/src/radio/radio.cc
#	lib/src/radio/test/benchmark_radio.cc
#	lib/src/srslog/backend_worker.cpp
#	lib/src/srslog/backend_worker.h
#	lib/src/srslog/bundled/fmt/CMakeLists.txt
#	lib/src/srslog/event_trace.cpp
#	lib/src/srslog/formatters/CMakeLists.txt
#	lib/src/srslog/formatters/json_formatter.cpp
#	lib/src/srslog/formatters/json_formatter.h
#	lib/src/srslog/formatters/text_formatter.cpp
#	lib/src/srslog/formatters/text_formatter.h
#	lib/src/srslog/log_backend_impl.h
#	lib/src/srslog/object_repository.h
#	lib/src/srslog/sinks/buffered_file_sink.h
#	lib/src/srslog/sinks/file_sink.h
#	lib/src/srslog/sinks/file_utils.h
#	lib/src/srslog/sinks/stream_sink.h
#	lib/src/srslog/srslog.cpp
#	lib/src/srslog/srslog_c.cpp
#	lib/src/srslog/srslog_instance.h
#	lib/src/system/sys_metrics_processor.cc
#	lib/src/upper/gtpu.cc
#	lib/src/upper/pdcp.cc
#	lib/src/upper/pdcp_entity_base.cc
#	lib/src/upper/pdcp_entity_lte.cc
#	lib/src/upper/pdcp_entity_nr.cc
#	lib/src/upper/rlc.cc
#	lib/src/upper/rlc_am_base.cc
#	lib/src/upper/rlc_am_lte.cc
#	lib/src/upper/rlc_am_nr.cc
#	lib/src/upper/rlc_tm.cc
#	lib/src/upper/rlc_um_base.cc
#	lib/src/upper/rlc_um_lte.cc
#	lib/src/upper/rlc_um_nr.cc
#	lib/test/adt/bounded_bitset_test.cc
#	lib/test/adt/bounded_vector_test.cc
#	lib/test/adt/circular_buffer_test.cc
#	lib/test/adt/expected_test.cc
#	lib/test/adt/interval_test.cc
#	lib/test/adt/mem_pool_test.cc
#	lib/test/adt/observer_test.cc
#	lib/test/adt/scope_exit_test.cc
#	lib/test/adt/span_test.cc
#	lib/test/asn1/asn1_utils_test.cc
#	lib/test/asn1/nas_decoder.cc
#	lib/test/asn1/ngap_test.cc
#	lib/test/asn1/rrc_asn1_decoder.cc
#	lib/test/asn1/rrc_test.cc
#	lib/test/asn1/s1ap_test.cc
#	lib/test/asn1/srsran_asn1_nas_test.cc
#	lib/test/asn1/srsran_asn1_rrc_dl_ccch_test.cc
#	lib/test/asn1/srsran_asn1_rrc_dl_dcch_test.cc
#	lib/test/asn1/srsran_asn1_rrc_mcch_test.cc
#	lib/test/asn1/srsran_asn1_rrc_meas_test.cc
#	lib/test/asn1/srsran_asn1_rrc_nr_test.cc
#	lib/test/asn1/srsran_asn1_rrc_ul_dcch_test.cc
#	lib/test/common/bcd_helpers_test.cc
#	lib/test/common/byte_buffer_queue_test.cc
#	lib/test/common/choice_type_test.cc
#	lib/test/common/fsm_test.cc
#	lib/test/common/mac_pcap_net_test.cc
#	lib/test/common/multiqueue_test.cc
#	lib/test/common/network_utils_test.cc
#	lib/test/common/pnf_bridge.cc
#	lib/test/common/pnf_dummy.cc
#	lib/test/common/stack_procedure_test.cc
#	lib/test/common/task_scheduler_test.cc
#	lib/test/common/test_eea1.cc
#	lib/test/common/test_eea2.cc
#	lib/test/common/test_eea3.cc
#	lib/test/common/test_eia1.cc
#	lib/test/common/test_eia3.cc
#	lib/test/common/test_f12345.cc
#	lib/test/common/timeout_test.cc
#	lib/test/common/timer_test.cc
#	lib/test/common/tti_point_test.cc
#	lib/test/mac/mac_pcap_test.cc
#	lib/test/mac/mac_pdu_nr_test.cc
#	lib/test/mac/pdu_test.cc
#	lib/test/phy/phy_dl_nr_test.c
#	lib/test/phy/phy_dl_test.c
#	lib/test/phy/pucch_ca_test.c
#	lib/test/srslog/any_test.cpp
#	lib/test/srslog/context_test.cpp
#	lib/test/srslog/event_trace_test.cpp
#	lib/test/srslog/file_sink_test.cpp
#	lib/test/srslog/file_test_utils.h
#	lib/test/srslog/file_utils_test.cpp
#	lib/test/srslog/json_formatter_test.cpp
#	lib/test/srslog/log_backend_test.cpp
#	lib/test/srslog/log_channel_test.cpp
#	lib/test/srslog/logger_test.cpp
#	lib/test/srslog/srslog_test.cpp
#	lib/test/srslog/test_dummies.h
#	lib/test/srslog/testing_helpers.h
#	lib/test/srslog/text_formatter_test.cpp
#	lib/test/upper/pdcp_base_test.h
#	lib/test/upper/pdcp_lte_test.h
#	lib/test/upper/pdcp_lte_test_rx.cc
#	lib/test/upper/pdcp_nr_test.h
#	lib/test/upper/pdcp_nr_test_discard_sdu.cc
#	lib/test/upper/pdcp_nr_test_rx.cc
#	lib/test/upper/pdcp_nr_test_tx.cc
#	lib/test/upper/rlc_am_control_test.cc
#	lib/test/upper/rlc_am_data_test.cc
#	lib/test/upper/rlc_am_nr_pdu_test.cc
#	lib/test/upper/rlc_am_test.cc
#	lib/test/upper/rlc_common_test.cc
#	lib/test/upper/rlc_stress_test.cc
#	lib/test/upper/rlc_test_common.h
#	lib/test/upper/rlc_um_data_test.cc
#	lib/test/upper/rlc_um_nr_pdu_test.cc
#	lib/test/upper/rlc_um_nr_test.cc
#	lib/test/upper/rlc_um_test.cc
#	srsenb/hdr/cfg_parser.h
#	srsenb/hdr/enb.h
#	srsenb/hdr/metrics_csv.h
#	srsenb/hdr/metrics_json.h
#	srsenb/hdr/metrics_stdout.h
#	srsenb/hdr/parser.h
#	srsenb/hdr/phy/enb_phy_base.h
#	srsenb/hdr/phy/lte/cc_worker.h
#	srsenb/hdr/phy/lte/sf_worker.h
#	srsenb/hdr/phy/lte/worker_pool.h
#	srsenb/hdr/phy/nr/cc_worker.h
#	srsenb/hdr/phy/nr/sf_worker.h
#	srsenb/hdr/phy/nr/worker_pool.h
#	srsenb/hdr/phy/phy.h
#	srsenb/hdr/phy/phy_common.h
#	srsenb/hdr/phy/phy_interfaces.h
#	srsenb/hdr/phy/phy_metrics.h
#	srsenb/hdr/phy/prach_worker.h
#	srsenb/hdr/phy/txrx.h
#	srsenb/hdr/phy/vnf_phy_nr.h
#	srsenb/hdr/stack/enb_stack_base.h
#	srsenb/hdr/stack/enb_stack_lte.h
#	srsenb/hdr/stack/gnb_stack_nr.h
#	srsenb/hdr/stack/mac/mac.h
#	srsenb/hdr/stack/mac/mac_metrics.h
#	srsenb/hdr/stack/mac/mac_nr.h
#	srsenb/hdr/stack/mac/sched.h
#	srsenb/hdr/stack/mac/sched_carrier.h
#	srsenb/hdr/stack/mac/sched_common.h
#	srsenb/hdr/stack/mac/sched_grid.h
#	srsenb/hdr/stack/mac/sched_helpers.h
#	srsenb/hdr/stack/mac/sched_phy_ch/sched_dci.h
#	srsenb/hdr/stack/mac/sched_phy_ch/sched_result.h
#	srsenb/hdr/stack/mac/sched_phy_ch/sf_cch_allocator.h
#	srsenb/hdr/stack/mac/sched_ue.h
#	srsenb/hdr/stack/mac/sched_ue_ctrl/sched_harq.h
#	srsenb/hdr/stack/mac/sched_ue_ctrl/sched_lch.h
#	srsenb/hdr/stack/mac/sched_ue_ctrl/sched_ue_cell.h
#	srsenb/hdr/stack/mac/sched_ue_ctrl/tpc.h
#	srsenb/hdr/stack/mac/schedulers/sched_base.h
#	srsenb/hdr/stack/mac/schedulers/sched_time_pf.h
#	srsenb/hdr/stack/mac/schedulers/sched_time_rr.h
#	srsenb/hdr/stack/mac/ta.h
#	srsenb/hdr/stack/mac/ue.h
#	srsenb/hdr/stack/rrc/mac_controller.h
#	srsenb/hdr/stack/rrc/rrc.h
#	srsenb/hdr/stack/rrc/rrc_bearer_cfg.h
#	srsenb/hdr/stack/rrc/rrc_cell_cfg.h
#	srsenb/hdr/stack/rrc/rrc_config.h
#	srsenb/hdr/stack/rrc/rrc_config_common.h
#	srsenb/hdr/stack/rrc/rrc_metrics.h
#	srsenb/hdr/stack/rrc/rrc_mobility.h
#	srsenb/hdr/stack/rrc/rrc_nr.h
#	srsenb/hdr/stack/rrc/rrc_ue.h
#	srsenb/hdr/stack/rrc/ue_meas_cfg.h
#	srsenb/hdr/stack/rrc/ue_rr_cfg.h
#	srsenb/hdr/stack/upper/common_enb.h
#	srsenb/hdr/stack/upper/gtpu.h
#	srsenb/hdr/stack/upper/pdcp.h
#	srsenb/hdr/stack/upper/pdcp_nr.h
#	srsenb/hdr/stack/upper/rlc.h
#	srsenb/hdr/stack/upper/rlc_nr.h
#	srsenb/hdr/stack/upper/s1ap.h
#	srsenb/hdr/stack/upper/s1ap_metrics.h
#	srsenb/hdr/stack/upper/sdap.h
#	srsenb/src/enb.cc
#	srsenb/src/enb_cfg_parser.cc
#	srsenb/src/enb_cfg_parser.h
#	srsenb/src/main.cc
#	srsenb/src/metrics_csv.cc
#	srsenb/src/metrics_json.cc
#	srsenb/src/metrics_stdout.cc
#	srsenb/src/parser.cc
#	srsenb/src/phy/lte/sf_worker.cc
#	srsenb/src/phy/lte/worker_pool.cc
#	srsenb/src/phy/nr/cc_worker.cc
#	srsenb/src/phy/nr/sf_worker.cc
#	srsenb/src/phy/nr/worker_pool.cc
#	srsenb/src/phy/phy.cc
#	srsenb/src/phy/phy_common.cc
#	srsenb/src/phy/prach_worker.cc
#	srsenb/src/phy/txrx.cc
#	srsenb/src/phy/vnf_phy_nr.cc
#	srsenb/src/stack/enb_stack_lte.cc
#	srsenb/src/stack/gnb_stack_nr.cc
#	srsenb/src/stack/mac/mac.cc
#	srsenb/src/stack/mac/mac_nr.cc
#	srsenb/src/stack/mac/sched.cc
#	srsenb/src/stack/mac/sched_carrier.cc
#	srsenb/src/stack/mac/sched_grid.cc
#	srsenb/src/stack/mac/sched_helpers.cc
#	srsenb/src/stack/mac/sched_phy_ch/sched_dci.cc
#	srsenb/src/stack/mac/sched_phy_ch/sf_cch_allocator.cc
#	srsenb/src/stack/mac/sched_ue.cc
#	srsenb/src/stack/mac/sched_ue_ctrl/sched_harq.cc
#	srsenb/src/stack/mac/sched_ue_ctrl/sched_lch.cc
#	srsenb/src/stack/mac/sched_ue_ctrl/sched_ue_cell.cc
#	srsenb/src/stack/mac/schedulers/sched_base.cc
#	srsenb/src/stack/mac/schedulers/sched_time_pf.cc
#	srsenb/src/stack/mac/schedulers/sched_time_rr.cc
#	srsenb/src/stack/mac/ue.cc
#	srsenb/src/stack/rrc/mac_controller.cc
#	srsenb/src/stack/rrc/rrc.cc
#	srsenb/src/stack/rrc/rrc_bearer_cfg.cc
#	srsenb/src/stack/rrc/rrc_cell_cfg.cc
#	srsenb/src/stack/rrc/rrc_mobility.cc
#	srsenb/src/stack/rrc/rrc_nr.cc
#	srsenb/src/stack/rrc/rrc_ue.cc
#	srsenb/src/stack/rrc/ue_meas_cfg.cc
#	srsenb/src/stack/rrc/ue_rr_cfg.cc
#	srsenb/src/stack/upper/gtpu.cc
#	srsenb/src/stack/upper/pdcp.cc
#	srsenb/src/stack/upper/pdcp_nr.cc
#	srsenb/src/stack/upper/rlc.cc
#	srsenb/src/stack/upper/rlc_nr.cc
#	srsenb/src/stack/upper/s1ap.cc
#	srsenb/src/stack/upper/sdap.cc
#	srsenb/test/common/dummy_classes.h
#	srsenb/test/common/dummy_nr_classes.h
#	srsenb/test/enb_metrics_test.cc
#	srsenb/test/mac/sched_benchmark.cc
#	srsenb/test/mac/sched_ca_test.cc
#	srsenb/test/mac/sched_common_test_suite.cc
#	srsenb/test/mac/sched_common_test_suite.h
#	srsenb/test/mac/sched_dci_test.cc
#	srsenb/test/mac/sched_grid_test.cc
#	srsenb/test/mac/sched_lc_ch_test.cc
#	srsenb/test/mac/sched_sim_ue.cc
#	srsenb/test/mac/sched_sim_ue.h
#	srsenb/test/mac/sched_test_common.cc
#	srsenb/test/mac/sched_test_common.h
#	srsenb/test/mac/sched_test_rand.cc
#	srsenb/test/mac/sched_test_utils.h
#	srsenb/test/mac/sched_tpc_test.cc
#	srsenb/test/mac/sched_ue_ded_test_suite.cc
#	srsenb/test/mac/sched_ue_ded_test_suite.h
#	srsenb/test/phy/enb_phy_test.cc
#	srsenb/test/rrc/rrc_nr_test.cc
#	srsenb/test/upper/erab_setup_test.cc
#	srsenb/test/upper/gtpu_test.cc
#	srsenb/test/upper/plmn_test.cc
#	srsenb/test/upper/rrc_meascfg_test.cc
#	srsenb/test/upper/rrc_mobility_test.cc
#	srsenb/test/upper/test_helpers.cc
#	srsenb/test/upper/test_helpers.h
#	srsepc/hdr/hss/hss.h
#	srsepc/hdr/mbms-gw/mbms-gw.h
#	srsepc/hdr/mme/mme.h
#	srsepc/hdr/mme/mme_gtpc.h
#	srsepc/hdr/mme/nas.h
#	srsepc/hdr/mme/s1ap.h
#	srsepc/hdr/mme/s1ap_common.h
#	srsepc/hdr/mme/s1ap_ctx_mngmt_proc.h
#	srsepc/hdr/mme/s1ap_erab_mngmt_proc.h
#	srsepc/hdr/mme/s1ap_mngmt_proc.h
#	srsepc/hdr/mme/s1ap_nas_transport.h
#	srsepc/hdr/mme/s1ap_paging.h
#	srsepc/hdr/spgw/gtpc.h
#	srsepc/hdr/spgw/gtpu.h
#	srsepc/hdr/spgw/spgw.h
#	srsepc/src/hss/hss.cc
#	srsepc/src/main.cc
#	srsepc/src/mbms-gw/main.cc
#	srsepc/src/mbms-gw/mbms-gw.cc
#	srsepc/src/mme/mme.cc
#	srsepc/src/mme/mme_gtpc.cc
#	srsepc/src/mme/nas.cc
#	srsepc/src/mme/s1ap.cc
#	srsepc/src/mme/s1ap_ctx_mngmt_proc.cc
#	srsepc/src/mme/s1ap_erab_mngmt_proc.cc
#	srsepc/src/mme/s1ap_mngmt_proc.cc
#	srsepc/src/mme/s1ap_nas_transport.cc
#	srsepc/src/mme/s1ap_paging.cc
#	srsepc/src/spgw/gtpc.cc
#	srsepc/src/spgw/gtpu.cc
#	srsepc/src/spgw/spgw.cc
#	srsue/hdr/metrics_csv.h
#	srsue/hdr/metrics_stdout.h
#	srsue/hdr/phy/lte/cc_worker.h
#	srsue/hdr/phy/lte/sf_worker.h
#	srsue/hdr/phy/lte/worker_pool.h
#	srsue/hdr/phy/nr/cc_worker.h
#	srsue/hdr/phy/nr/sf_worker.h
#	srsue/hdr/phy/nr/state.h
#	srsue/hdr/phy/nr/worker_pool.h
#	srsue/hdr/phy/phy.h
#	srsue/hdr/phy/phy_common.h
#	srsue/hdr/phy/phy_metrics.h
#	srsue/hdr/phy/prach.h
#	srsue/hdr/phy/scell/intra_measure.h
#	srsue/hdr/phy/scell/scell_recv.h
#	srsue/hdr/phy/scell/scell_state.h
#	srsue/hdr/phy/scell/scell_sync.h
#	srsue/hdr/phy/search.h
#	srsue/hdr/phy/sfn_sync.h
#	srsue/hdr/phy/sync.h
#	srsue/hdr/phy/sync_state.h
#	srsue/hdr/phy/ta_control.h
#	srsue/hdr/phy/ue_lte_phy_base.h
#	srsue/hdr/phy/ue_nr_phy_base.h
#	srsue/hdr/phy/ue_phy_base.h
#	srsue/hdr/phy/vnf_phy_nr.h
#	srsue/hdr/stack/mac/demux.h
#	srsue/hdr/stack/mac/dl_harq.h
#	srsue/hdr/stack/mac/dl_sps.h
#	srsue/hdr/stack/mac/mac.h
#	srsue/hdr/stack/mac/mac_metrics.h
#	srsue/hdr/stack/mac/mux.h
#	srsue/hdr/stack/mac/proc.h
#	srsue/hdr/stack/mac/proc_bsr.h
#	srsue/hdr/stack/mac/proc_phr.h
#	srsue/hdr/stack/mac/proc_ra.h
#	srsue/hdr/stack/mac/proc_sr.h
#	srsue/hdr/stack/mac/ul_harq.h
#	srsue/hdr/stack/mac/ul_sps.h
#	srsue/hdr/stack/mac_nr/mac_nr.h
#	srsue/hdr/stack/mac_nr/mux_nr.h
#	srsue/hdr/stack/rrc/phy_controller.h
#	srsue/hdr/stack/rrc/rrc.h
#	srsue/hdr/stack/rrc/rrc_cell.h
#	srsue/hdr/stack/rrc/rrc_common.h
#	srsue/hdr/stack/rrc/rrc_meas.h
#	srsue/hdr/stack/rrc/rrc_metrics.h
#	srsue/hdr/stack/rrc/rrc_nr.h
#	srsue/hdr/stack/rrc/rrc_procedures.h
#	srsue/hdr/stack/ue_stack_base.h
#	srsue/hdr/stack/ue_stack_lte.h
#	srsue/hdr/stack/ue_stack_nr.h
#	srsue/hdr/stack/upper/gw.h
#	srsue/hdr/stack/upper/gw_metrics.h
#	srsue/hdr/stack/upper/nas.h
#	srsue/hdr/stack/upper/nas_config.h
#	srsue/hdr/stack/upper/nas_emm_state.h
#	srsue/hdr/stack/upper/nas_idle_procedures.h
#	srsue/hdr/stack/upper/nas_metrics.h
#	srsue/hdr/stack/upper/pcsc_usim.h
#	srsue/hdr/stack/upper/tft_packet_filter.h
#	srsue/hdr/stack/upper/usim.h
#	srsue/hdr/stack/upper/usim_base.h
#	srsue/hdr/ue.h
#	srsue/hdr/ue_metrics_interface.h
#	srsue/src/main.cc
#	srsue/src/metrics_csv.cc
#	srsue/src/metrics_stdout.cc
#	srsue/src/phy/lte/cc_worker.cc
#	srsue/src/phy/lte/sf_worker.cc
#	srsue/src/phy/lte/worker_pool.cc
#	srsue/src/phy/nr/cc_worker.cc
#	srsue/src/phy/nr/sf_worker.cc
#	srsue/src/phy/nr/worker_pool.cc
#	srsue/src/phy/phy.cc
#	srsue/src/phy/phy_common.cc
#	srsue/src/phy/prach.cc
#	srsue/src/phy/scell/intra_measure.cc
#	srsue/src/phy/scell/scell_recv.cc
#	srsue/src/phy/search.cc
#	srsue/src/phy/sfn_sync.cc
#	srsue/src/phy/sync.cc
#	srsue/src/phy/vnf_phy_nr.cc
#	srsue/src/set_net_admin_caps.cc
#	srsue/src/stack/mac/demux.cc
#	srsue/src/stack/mac/dl_harq.cc
#	srsue/src/stack/mac/mac.cc
#	srsue/src/stack/mac/mux.cc
#	srsue/src/stack/mac/proc_bsr.cc
#	srsue/src/stack/mac/proc_phr.cc
#	srsue/src/stack/mac/proc_ra.cc
#	srsue/src/stack/mac/proc_sr.cc
#	srsue/src/stack/mac/ul_harq.cc
#	srsue/src/stack/mac_nr/mac_nr.cc
#	srsue/src/stack/mac_nr/mux_nr.cc
#	srsue/src/stack/rrc/phy_controller.cc
#	srsue/src/stack/rrc/rrc.cc
#	srsue/src/stack/rrc/rrc_cell.cc
#	srsue/src/stack/rrc/rrc_meas.cc
#	srsue/src/stack/rrc/rrc_nr.cc
#	srsue/src/stack/rrc/rrc_procedures.cc
#	srsue/src/stack/ue_stack_lte.cc
#	srsue/src/stack/ue_stack_nr.cc
#	srsue/src/stack/upper/gw.cc
#	srsue/src/stack/upper/nas.cc
#	srsue/src/stack/upper/nas_emm_state.cc
#	srsue/src/stack/upper/nas_idle_procedures.cc
#	srsue/src/stack/upper/pcsc_usim.cc
#	srsue/src/stack/upper/tft_packet_filter.cc
#	srsue/src/stack/upper/usim.cc
#	srsue/src/stack/upper/usim_base.cc
#	srsue/src/ue.cc
#	srsue/test/mac_nr/proc_ra_nr_test.cc
#	srsue/test/mac_test.cc
#	srsue/test/metrics_test.cc
#	srsue/test/phy/scell_search_test.cc
#	srsue/test/phy/ue_phy_test.cc
#	srsue/test/ttcn3/hdr/dut_utils.h
#	srsue/test/ttcn3/hdr/lte_ttcn3_phy.h
#	srsue/test/ttcn3/hdr/swappable_sink.h
#	srsue/test/ttcn3/hdr/ttcn3_common.h
#	srsue/test/ttcn3/hdr/ttcn3_drb_interface.h
#	srsue/test/ttcn3/hdr/ttcn3_helpers.h
#	srsue/test/ttcn3/hdr/ttcn3_interfaces.h
#	srsue/test/ttcn3/hdr/ttcn3_ip_ctrl_interface.h
#	srsue/test/ttcn3/hdr/ttcn3_ip_sock_interface.h
#	srsue/test/ttcn3/hdr/ttcn3_port_handler.h
#	srsue/test/ttcn3/hdr/ttcn3_srb_interface.h
#	srsue/test/ttcn3/hdr/ttcn3_sys_interface.h
#	srsue/test/ttcn3/hdr/ttcn3_syssim.h
#	srsue/test/ttcn3/hdr/ttcn3_ue.h
#	srsue/test/ttcn3/hdr/ttcn3_ut_interface.h
#	srsue/test/ttcn3/src/lte_ttcn3_phy.cc
#	srsue/test/ttcn3/src/ttcn3_dut.cc
#	srsue/test/ttcn3/src/ttcn3_syssim.cc
#	srsue/test/ttcn3/src/ttcn3_ue.cc
#	srsue/test/ttcn3/test/rapidjson_test.cc
#	srsue/test/ttcn3/test/ttcn3_if_handler_test.cc
#	srsue/test/upper/nas_test.cc
#	srsue/test/upper/pcsc_usim_test.cc
#	srsue/test/upper/rrc_cell_test.cc
#	srsue/test/upper/rrc_meas_test.cc
#	srsue/test/upper/rrc_phy_ctrl_test.cc
#	srsue/test/upper/rrc_reconfig_test.cc
#	srsue/test/upper/tft_test.cc
#	srsue/test/upper/ue_rrc_nr_test.cc
#	srsue/test/upper/usim_test.cc
master
Codebot 4 years ago committed by Your Name
commit 3fdcd5fe03

@ -12,7 +12,7 @@
python python
###### srslte::bounded_vector<T, N> ######## ###### srsran::bounded_vector<T, N> ########
class BoundedVectorPrinter(object): class BoundedVectorPrinter(object):
def __init__(self, val): def __init__(self, val):
@ -35,7 +35,7 @@ class BoundedVectorPrinter(object):
@staticmethod @staticmethod
def make(val): def make(val):
if str(val.type).startswith('srslte::bounded_vector<'): if str(val.type).startswith('srsran::bounded_vector<'):
return BoundedVectorPrinter(val) return BoundedVectorPrinter(val)
gdb.pretty_printers.append(BoundedVectorPrinter.make) gdb.pretty_printers.append(BoundedVectorPrinter.make)

@ -1,6 +1,6 @@
<!-- <!--
Before filing an issue, search for solutions here: Before filing an issue, search for solutions here:
- srsLTE users mailing list (http://www.softwareradiosystems.com/mailman/listinfo/srslte-users) - srsRAN users mailing list (http://www.softwareradiosystems.com/mailman/listinfo/srsran-users)
--> -->
## Issue Description ## ## Issue Description ##

@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-18.04 runs-on: ubuntu-18.04
steps: steps:
- uses: actions/checkout@v1 - uses: actions/checkout@v1
- name: Build srsLTE on x86 Ubuntu 18.04 - name: Build srsRAN on x86 Ubuntu 18.04
run: | run: |
sudo apt update sudo apt update
sudo apt install -y build-essential cmake libfftw3-dev libmbedtls-dev libpcsclite-dev libboost-program-options-dev libconfig++-dev libsctp-dev colordiff ninja-build valgrind sudo apt install -y build-essential cmake libfftw3-dev libmbedtls-dev libpcsclite-dev libboost-program-options-dev libconfig++-dev libsctp-dev colordiff ninja-build valgrind
@ -22,7 +22,7 @@ jobs:
runs-on: ubuntu-16.04 runs-on: ubuntu-16.04
steps: steps:
- uses: actions/checkout@v1 - uses: actions/checkout@v1
- name: Build srsLTE on x86 Ubuntu 16.04 - name: Build srsRAN on x86 Ubuntu 16.04
run: | run: |
sudo apt update sudo apt update
sudo apt install -y build-essential cmake libfftw3-dev libmbedtls-dev libpcsclite-dev libboost-program-options-dev libconfig++-dev libsctp-dev colordiff ninja-build valgrind sudo apt install -y build-essential cmake libfftw3-dev libmbedtls-dev libpcsclite-dev libboost-program-options-dev libconfig++-dev libsctp-dev colordiff ninja-build valgrind
@ -36,7 +36,7 @@ jobs:
compiler: [gcc, clang] compiler: [gcc, clang]
steps: steps:
- uses: actions/checkout@v1 - uses: actions/checkout@v1
- name: Build srsLTE on aarch64 - name: Build srsRAN on aarch64
uses: uraimo/run-on-arch-action@master uses: uraimo/run-on-arch-action@master
with: with:
architecture: aarch64 architecture: aarch64

@ -31,14 +31,14 @@ endif(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
# Project setup # Project setup
######################################################################## ########################################################################
cmake_minimum_required(VERSION 2.6) cmake_minimum_required(VERSION 2.6)
project( SRSLTE ) project( SRSRAN )
message( STATUS "CMAKE_SYSTEM: " ${CMAKE_SYSTEM} ) message( STATUS "CMAKE_SYSTEM: " ${CMAKE_SYSTEM} )
message( STATUS "CMAKE_SYSTEM_PROCESSOR: " ${CMAKE_SYSTEM_PROCESSOR} ) message( STATUS "CMAKE_SYSTEM_PROCESSOR: " ${CMAKE_SYSTEM_PROCESSOR} )
message( STATUS "CMAKE_CXX_COMPILER: " ${CMAKE_CXX_COMPILER} ) message( STATUS "CMAKE_CXX_COMPILER: " ${CMAKE_CXX_COMPILER} )
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/modules") list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/modules")
include(SRSLTEVersion) #sets version information include(SRSRANVersion) #sets version information
include(SRSLTEPackage) #setup cpack include(SRSRANPackage) #setup cpack
include(CTest) include(CTest)
@ -55,8 +55,8 @@ set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "")
# Generate CMake to include build information # Generate CMake to include build information
configure_file( configure_file(
${PROJECT_SOURCE_DIR}/cmake/modules/SRSLTEbuildinfo.cmake.in ${PROJECT_SOURCE_DIR}/cmake/modules/SRSRANbuildinfo.cmake.in
${CMAKE_BINARY_DIR}/SRSLTEbuildinfo.cmake ${CMAKE_BINARY_DIR}/SRSRANbuildinfo.cmake
) )
######################################################################## ########################################################################
@ -93,6 +93,8 @@ option(ENABLE_TIMEPROF "Enable time profiling" ON)
option(FORCE_32BIT "Add flags to force 32 bit compilation" OFF) option(FORCE_32BIT "Add flags to force 32 bit compilation" OFF)
option(ENABLE_SRSLOG_TRACING "Enable event tracing using srslog" OFF) option(ENABLE_SRSLOG_TRACING "Enable event tracing using srslog" OFF)
option(ASSERTS_ENABLED "Enable srsRAN asserts" ON)
option(STOP_ON_WARNING "Interrupt application on warning" OFF)
# Users that want to try this feature need to make sure the lto plugin is # Users that want to try this feature need to make sure the lto plugin is
# loaded by bintools (ar, nm, ...). Older versions of bintools will not do # loaded by bintools (ar, nm, ...). Older versions of bintools will not do
@ -119,6 +121,14 @@ if (ENABLE_SRSLOG_TRACING)
add_definitions(-DENABLE_SRSLOG_EVENT_TRACE) add_definitions(-DENABLE_SRSLOG_EVENT_TRACE)
endif (ENABLE_SRSLOG_TRACING) endif (ENABLE_SRSLOG_TRACING)
if (ASSERTS_ENABLED)
add_definitions(-DASSERTS_ENABLED)
endif()
if (STOP_ON_WARNING)
add_definitions(-DSTOP_ON_WARNING)
endif()
######################################################################## ########################################################################
# Find dependencies # Find dependencies
######################################################################## ########################################################################
@ -179,7 +189,7 @@ else(POLARSSL_FOUND)
endif(BUILD_STATIC) endif(BUILD_STATIC)
add_definitions(-DHAVE_MBEDTLS) add_definitions(-DHAVE_MBEDTLS)
else(MBEDTLS_FOUND) else(MBEDTLS_FOUND)
message(FATAL_ERROR "Either PolarSSL or mbedTLS are required to build srsLTE") message(FATAL_ERROR "Either PolarSSL or mbedTLS are required to build srsRAN")
endif (MBEDTLS_FOUND) endif (MBEDTLS_FOUND)
endif(POLARSSL_FOUND) endif(POLARSSL_FOUND)
@ -269,7 +279,7 @@ if(Boost_FOUND)
include_directories(${Boost_INCLUDE_DIRS}) include_directories(${Boost_INCLUDE_DIRS})
link_directories(${Boost_LIBRARY_DIRS}) link_directories(${Boost_LIBRARY_DIRS})
else(Boost_FOUND) else(Boost_FOUND)
message(FATAL_ERROR "Boost required to build srsLTE") message(FATAL_ERROR "Boost required to build srsRAN")
endif (Boost_FOUND) endif (Boost_FOUND)
# srsGUI # srsGUI
@ -322,10 +332,10 @@ set(DATA_DIR share/${CPACK_PACKAGE_NAME})
# Auto-generate config install helper and mark for installation # Auto-generate config install helper and mark for installation
configure_file( configure_file(
${PROJECT_SOURCE_DIR}/cmake/modules/SRSLTE_install_configs.sh.in ${PROJECT_SOURCE_DIR}/cmake/modules/SRSRAN_install_configs.sh.in
${CMAKE_BINARY_DIR}/srslte_install_configs.sh ${CMAKE_BINARY_DIR}/srsran_install_configs.sh
) )
install(PROGRAMS ${CMAKE_BINARY_DIR}/srslte_install_configs.sh DESTINATION ${RUNTIME_DIR}) install(PROGRAMS ${CMAKE_BINARY_DIR}/srsran_install_configs.sh DESTINATION ${RUNTIME_DIR})
# Disables the project to build when calling "make install" # Disables the project to build when calling "make install"
set(CMAKE_SKIP_INSTALL_ALL_DEPENDENCY TRUE) set(CMAKE_SKIP_INSTALL_ALL_DEPENDENCY TRUE)
@ -600,7 +610,7 @@ foreach(_header ${headers})
list(APPEND HEADERS_ALL ${tmp}) list(APPEND HEADERS_ALL ${tmp})
endif(IS_DIRECTORY ${_header}) endif(IS_DIRECTORY ${_header})
endforeach() endforeach()
add_custom_target(add_srslte_headers SOURCES ${HEADERS_ALL}) add_custom_target(add_srsran_headers SOURCES ${HEADERS_ALL})
######################################################################## ########################################################################
# Add the subdirectories # Add the subdirectories

@ -1,9 +1,9 @@
Files: * Files: *
Copyright: 2013-2020, Software Radio Systems Limited. Copyright: 2013-2021, Software Radio Systems Limited.
License: License:
The following files are used within srsLTE: The following files are used within srsRAN:
Files: lib/src/phy/fec/viterbi37_port.c Files: lib/src/phy/fec/viterbi37_port.c
lib/src/phy/fec/viterbi37_sse.c lib/src/phy/fec/viterbi37_sse.c
@ -19,34 +19,34 @@ Files: srsue/src/upper/pcsc_usim.cc
Copyright: 2002-2014, Jouni Malinen <j@w1.fi> Copyright: 2002-2014, Jouni Malinen <j@w1.fi>
License: BSD-3-clause License: BSD-3-clause
Files: lib/include/srslte/asn1/liblte_common.h Files: lib/include/srsran/asn1/liblte_common.h
lib/include/srslte/asn1/liblte_mme.h lib/include/srsran/asn1/liblte_mme.h
lib/include/srslte/common/liblte_security.h lib/include/srsran/common/liblte_security.h
lib/src/asn1/liblte_common.cc lib/src/asn1/liblte_common.cc
lib/src/asn1/liblte_mme.cc lib/src/asn1/liblte_mme.cc
lib/src/common/liblte_security.cc lib/src/common/liblte_security.cc
Copyright: 2012-2014 Ben Wojtowicz Copyright: 2012-2014 Ben Wojtowicz
License: AGPL-3+ License: AGPL-3+
Files: lib/include/srslte/srslog/bundled/fmt/chrono.h Files: lib/include/srsran/srslog/bundled/fmt/chrono.h
lib/include/srslte/srslog/bundled/fmt/color.h lib/include/srsran/srslog/bundled/fmt/color.h
lib/include/srslte/srslog/bundled/fmt/compile.h lib/include/srsran/srslog/bundled/fmt/compile.h
lib/include/srslte/srslog/bundled/fmt/core.h lib/include/srsran/srslog/bundled/fmt/core.h
lib/include/srslte/srslog/bundled/fmt/format.h lib/include/srsran/srslog/bundled/fmt/format.h
lib/include/srslte/srslog/bundled/fmt/format-inl.h lib/include/srsran/srslog/bundled/fmt/format-inl.h
lib/include/srslte/srslog/bundled/fmt/LICENSE.rst lib/include/srsran/srslog/bundled/fmt/LICENSE.rst
lib/include/srslte/srslog/bundled/fmt/locale.h lib/include/srsran/srslog/bundled/fmt/locale.h
lib/include/srslte/srslog/bundled/fmt/os.h lib/include/srsran/srslog/bundled/fmt/os.h
lib/include/srslte/srslog/bundled/fmt/ostream.h lib/include/srsran/srslog/bundled/fmt/ostream.h
lib/include/srslte/srslog/bundled/fmt/posix.h lib/include/srsran/srslog/bundled/fmt/posix.h
lib/include/srslte/srslog/bundled/fmt/printf.h lib/include/srsran/srslog/bundled/fmt/printf.h
lib/include/srslte/srslog/bundled/fmt/ranges.h lib/include/srsran/srslog/bundled/fmt/ranges.h
lib/src/srslog/bundled/fmt/format.cc lib/src/srslog/bundled/fmt/format.cc
lib/src/srslog/bundled/fmt/os.cc lib/src/srslog/bundled/fmt/os.cc
Copyright: 2012-2020, Victor Zverovich Copyright: 2012-2020, Victor Zverovich
License: MIT License: MIT
Files: lib/include/srslte/common/backward.hpp Files: lib/include/srsran/common/backward.hpp
cmake/modules/FindBackward.cmake cmake/modules/FindBackward.cmake
Copyright: 2013, Google Inc. Copyright: 2013, Google Inc.
License: MIT License: MIT
@ -63,7 +63,7 @@ License: AGPL-3+
GNU Affero General Public License for more details. GNU Affero General Public License for more details.
. .
On Debian systems, the complete text of the AGPL 3 can be found in On Debian systems, the complete text of the AGPL 3 can be found in
/usr/share/doc/srslte/LICENSE /usr/share/doc/srsran/LICENSE
License: LGPL-2.1 License: LGPL-2.1

@ -18,10 +18,10 @@
# and at http://www.gnu.org/licenses/. # and at http://www.gnu.org/licenses/.
# #
set(CTEST_PROJECT_NAME "srsLTE") set(CTEST_PROJECT_NAME "srsRAN")
set(CTEST_NIGHTLY_START_TIME "00:00:00 GMT") set(CTEST_NIGHTLY_START_TIME "00:00:00 GMT")
set(CTEST_DROP_METHOD "http") set(CTEST_DROP_METHOD "http")
set(CTEST_DROP_SITE "my.cdash.org") set(CTEST_DROP_SITE "my.cdash.org")
set(CTEST_DROP_LOCATION "/submit.php?project=srsLTE") set(CTEST_DROP_LOCATION "/submit.php?project=srsRAN")
set(CTEST_DROP_SITE_CDASH TRUE) set(CTEST_DROP_SITE_CDASH TRUE)
set(VALGRIND_COMMAND_OPTIONS "--error-exitcode=1 --trace-children=yes --leak-check=full --show-reachable=yes --vex-guest-max-insns=25") set(VALGRIND_COMMAND_OPTIONS "--error-exitcode=1 --trace-children=yes --leak-check=full --show-reachable=yes --vex-guest-max-insns=25")

@ -1,12 +1,12 @@
srsLTE srsRAN
======== ========
[![Build Status](https://travis-ci.org/srsLTE/srsLTE.svg?branch=master)](https://travis-ci.org/srsLTE/srsLTE) [![Build Status](https://travis-ci.org/srsRAN/srsRAN.svg?branch=master)](https://travis-ci.org/srsRAN/srsRAN)
[![Language grade: C/C++](https://img.shields.io/lgtm/grade/cpp/g/srsLTE/srsLTE.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/srsLTE/srsLTE/context:cpp) [![Language grade: C/C++](https://img.shields.io/lgtm/grade/cpp/g/srsRAN/srsRAN.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/srsRAN/srsRAN/context:cpp)
[![Coverity](https://scan.coverity.com/projects/10045/badge.svg)](https://scan.coverity.com/projects/srslte) [![Coverity](https://scan.coverity.com/projects/10045/badge.svg)](https://scan.coverity.com/projects/srsran)
srsLTE is a 4G/5G software radio suite developed by SRS (www.softwareradiosystems.com) srsRAN is a 4G/5G software radio suite developed by SRS (www.softwareradiosystems.com)
See the srsLTE project pages (www.srslte.com) for documentation, guides and project news. See the srsRAN project pages (www.srsran.com) for documentation, guides and project news.
It includes: It includes:
* srsUE - a complete SDR LTE UE application featuring all layers from PHY to IP * srsUE - a complete SDR LTE UE application featuring all layers from PHY to IP
@ -85,7 +85,7 @@ srsEPC Features
Hardware Hardware
-------- --------
srsLTE has native support for the Ettus Universal Hardware Driver (UHD) and the bladeRF driver. We also support SoapySDR. srsRAN has native support for the Ettus Universal Hardware Driver (UHD) and the bladeRF driver. We also support SoapySDR.
Thus, any hardware supported by SoapySDR can be used. There is no sampling rate conversion, therefore the hardware should Thus, any hardware supported by SoapySDR can be used. There is no sampling rate conversion, therefore the hardware should
support 30.72 MHz clock in order to work correctly with LTE sampling frequencies and decode signals from live LTE base stations. support 30.72 MHz clock in order to work correctly with LTE sampling frequencies and decode signals from live LTE base stations.
@ -130,7 +130,7 @@ For CentOS, use the Fedora packages but replace `libconfig-devel` with just `lib
Note that depending on your flavor and version of Linux, the actual package names may be different. Note that depending on your flavor and version of Linux, the actual package names may be different.
* Optional requirements: * Optional requirements:
* srsgui: https://github.com/srslte/srsgui - for real-time plotting. * srsgui: https://github.com/srsran/srsgui - for real-time plotting.
* libpcsclite-dev: https://pcsclite.apdu.fr/ - for accessing smart card readers * libpcsclite-dev: https://pcsclite.apdu.fr/ - for accessing smart card readers
* libdw-dev libdw - for truly informative backtraces using backward-cpp * libdw-dev libdw - for truly informative backtraces using backward-cpp
@ -140,10 +140,10 @@ Note that depending on your flavor and version of Linux, the actual package name
* BladeRF: https://github.com/Nuand/bladeRF * BladeRF: https://github.com/Nuand/bladeRF
* ZeroMQ: https://github.com/zeromq * ZeroMQ: https://github.com/zeromq
Download and build srsLTE: Download and build srsRAN:
``` ```
git clone https://github.com/srsLTE/srsLTE.git git clone https://github.com/srsRAN/srsRAN.git
cd srsLTE cd srsRAN
mkdir build mkdir build
cd build cd build
cmake ../ cmake ../
@ -151,15 +151,15 @@ make
make test make test
``` ```
Install srsLTE: Install srsRAN:
``` ```
sudo make install sudo make install
srslte_install_configs.sh user srsran_install_configs.sh user
``` ```
This installs srsLTE and also copies the default srsLTE config files to This installs srsRAN and also copies the default srsRAN config files to
the user's home directory (~/.config/srslte). the user's home directory (~/.config/srsran).
Execution Instructions Execution Instructions
@ -171,7 +171,7 @@ if needed, to meet the system configuration.
On many systems they should work out of the box. On many systems they should work out of the box.
By default, all applications will search for config files in the user's home By default, all applications will search for config files in the user's home
directory (~/.config/srslte) upon startup. directory (~/.config/srsran) upon startup.
Note that you have to execute the applications with root privileges to enable Note that you have to execute the applications with root privileges to enable
real-time thread priorities and to permit creation of virtual network interfaces. real-time thread priorities and to permit creation of virtual network interfaces.
@ -180,7 +180,7 @@ srsENB and srsEPC can run on the same machine as a network-in-the-box configurat
srsUE needs to run on a separate machine. srsUE needs to run on a separate machine.
If you have installed the software suite using ```sudo make install``` and If you have installed the software suite using ```sudo make install``` and
have installed the example config files using ```srslte_install_configs.sh user```, have installed the example config files using ```srsran_install_configs.sh user```,
you may just start all applications with their default parameters. you may just start all applications with their default parameters.
### srsEPC ### srsEPC
@ -224,4 +224,4 @@ ping 172.16.0.1
Support Support
======== ========
Mailing list: http://www.softwareradiosystems.com/mailman/listinfo/srslte-users Mailing list: http://www.softwareradiosystems.com/mailman/listinfo/srsran-users

@ -4,8 +4,8 @@ rm -rf sysroot && mkdir sysroot
cmake -DCMAKE_INSTALL_PREFIX="sysroot/" ../ cmake -DCMAKE_INSTALL_PREFIX="sysroot/" ../
make install make install
this="$(date +%Y-%m-%d_%H_%M_%S)" this="$(date +%Y-%m-%d_%H_%M_%S)"
trialdir="srslte_trial_${this}" trialdir="srsran_trial_${this}"
tar="srslte.build-${this}.tgz" tar="srsran.build-${this}.tgz"
mkdir ${trialdir} mkdir ${trialdir}
tar czf "${trialdir}/$tar" -C "sysroot" . tar czf "${trialdir}/$tar" -C "sysroot" .
md5sum "${trialdir}/$tar" >>${trialdir}/checksums.md5 md5sum "${trialdir}/$tar" >>${trialdir}/checksums.md5

@ -1,21 +1,12 @@
/** /**
* Copyright 2013-2021 Software Radio Systems Limited
*
* This file is part of srsLTE.
* *
* srsLTE is free software: you can redistribute it and/or modify * \section COPYRIGHT
* 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, * Copyright 2013-2021 Software Radio Systems Limited
* 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 * By using this file, you agree to the terms and conditions set
* the LICENSE file in the top-level directory of this distribution * forth in the LICENSE file which can be found at the top level of
* and at http://www.gnu.org/licenses/. * the distribution.
* *
*/ */

@ -64,7 +64,7 @@ IF(UHD_FOUND)
set(CMAKE_REQUIRED_FLAGS "${CMAKE_CXX_FLAGS} -L${UHD_LIBRARY_DIR}") set(CMAKE_REQUIRED_FLAGS "${CMAKE_CXX_FLAGS} -L${UHD_LIBRARY_DIR}")
set(CMAKE_REQUIRED_LIBRARIES uhd boost_program_options boost_system) set(CMAKE_REQUIRED_LIBRARIES uhd boost_program_options boost_system)
# Checks whether the UHD driver supports X300 reset from srsLTE. This functionality requires changing the function # Checks whether the UHD driver supports X300 reset from srsRAN. This functionality requires changing the function
# `x300_make_ctrl_iface_enet` visibility in the file `uhd/host/lib/usrp/x300_fw_ctrl.cpp`. This can be accomplished # `x300_make_ctrl_iface_enet` visibility in the file `uhd/host/lib/usrp/x300_fw_ctrl.cpp`. This can be accomplished
# adding the following line: # adding the following line:
# `UHD_API wb_iface::sptr x300_make_ctrl_iface_enet(uhd::transport::udp_simple::sptr udp, bool enable_errors);` # `UHD_API wb_iface::sptr x300_make_ctrl_iface_enet(uhd::transport::udp_simple::sptr udp, bool enable_errors);`

@ -1,25 +0,0 @@
#
# Copyright 2013-2021 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/.
#
SET(SRSLTE_VERSION_MAJOR 20)
SET(SRSLTE_VERSION_MINOR 10)
SET(SRSLTE_VERSION_PATCH 1)
SET(SRSLTE_VERSION_STRING "${SRSLTE_VERSION_MAJOR}.${SRSLTE_VERSION_MINOR}.${SRSLTE_VERSION_PATCH}")
SET(SRSLTE_SOVERSION 0)

@ -18,16 +18,16 @@
# and at http://www.gnu.org/licenses/. # and at http://www.gnu.org/licenses/.
# #
SET(CPACK_PACKAGE_DESCRIPTION "srsLTE") SET(CPACK_PACKAGE_DESCRIPTION "srsRAN")
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "LTE library for SDR.") SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "LTE library for SDR.")
SET(CPACK_PACKAGE_NAME "srslte") SET(CPACK_PACKAGE_NAME "srsran")
SET(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6 (>= 2.3.6), libgcc1 (>= 1:4.1), libboost-dev (>= 1.35)") SET(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6 (>= 2.3.6), libgcc1 (>= 1:4.1), libboost-dev (>= 1.35)")
SET(CPACK_PACKAGE_CONTACT "Ismael Gomez ") SET(CPACK_PACKAGE_CONTACT "Ismael Gomez ")
SET(CPACK_PACKAGE_VENDOR "Software Radio Systems Limited") SET(CPACK_PACKAGE_VENDOR "Software Radio Systems Limited")
SET(CPACK_PACKAGE_VERSION_MAJOR ${SRSLTE_VERSION_MAJOR}) SET(CPACK_PACKAGE_VERSION_MAJOR ${SRSRAN_VERSION_MAJOR})
SET(CPACK_PACKAGE_VERSION_MINOR ${SRSLTE_VERSION_MINOR}) SET(CPACK_PACKAGE_VERSION_MINOR ${SRSRAN_VERSION_MINOR})
SET(CPACK_PACKAGE_VERSION_PATCH ${SRSLTE_VERSION_PATCH}) SET(CPACK_PACKAGE_VERSION_PATCH ${SRSRAN_VERSION_PATCH})
SET(VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}") SET(VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
######################################################################## ########################################################################

@ -0,0 +1,13 @@
#
# Copyright 2013-2021 Software Radio Systems Limited
#
# By using this file, you agree to the terms and conditions set
# forth in the LICENSE file which can be found at the top level of
# the distribution.
#
SET(SRSRAN_VERSION_MAJOR 20)
SET(SRSRAN_VERSION_MINOR 10)
SET(SRSRAN_VERSION_PATCH 1)
SET(SRSRAN_VERSION_STRING "${SRSRAN_VERSION_MAJOR}.${SRSRAN_VERSION_MINOR}.${SRSRAN_VERSION_PATCH}")
SET(SRSRAN_SOVERSION 0)

@ -8,27 +8,27 @@
# #
# Auto-updated by CMake with actual install path # Auto-updated by CMake with actual install path
SRSLTE_INSTALL_DIR="${CMAKE_INSTALL_PREFIX}/${DATA_DIR}" SRSRAN_INSTALL_DIR="${CMAKE_INSTALL_PREFIX}/${DATA_DIR}"
# check if install mode has been provided # check if install mode has been provided
if ([ ! $1 ]) if ([ ! $1 ])
then then
echo "Please call script with either user or service as first parameter." echo "Please call script with either user or service as first parameter."
echo "" echo ""
echo "E.g. ./srslte_install_configs.sh user" echo "E.g. ./srsran_install_configs.sh user"
echo " .. to install all config files to $HOME/.config/srslte" echo " .. to install all config files to $HOME/.config/srsran"
echo "" echo ""
echo "E.g. ./srslte_install_configs.sh service" echo "E.g. ./srsran_install_configs.sh service"
echo " .. to install all config files to /etc/srslte" echo " .. to install all config files to /etc/srsran"
exit exit
fi fi
if [ "$1" == "user" ] if [ "$1" == "user" ]
then then
dest_folder="$HOME/.config/srslte" dest_folder="$HOME/.config/srsran"
elif [ "$1" == "service" ] elif [ "$1" == "service" ]
then then
dest_folder="/etc/srslte" dest_folder="/etc/srsran"
else else
echo "Please call script with either user or service as first parameter." echo "Please call script with either user or service as first parameter."
exit exit
@ -54,7 +54,7 @@ fi
install_file(){ install_file(){
source_path="$SRSLTE_INSTALL_DIR/$1" source_path="$SRSRAN_INSTALL_DIR/$1"
dest_path=$(echo "$dest_folder/$1" | sed 's/\.[^.]*$//') # Strip .example from filename dest_path=$(echo "$dest_folder/$1" | sed 's/\.[^.]*$//') # Strip .example from filename
# Check if config file already exists in location # Check if config file already exists in location
@ -88,12 +88,12 @@ install_file(){
return return
} }
# Install all srsLTE config files # Install all srsRAN config files
echo "Installing srsLTE configuration files:" echo "Installing srsRAN configuration files:"
# Make sure the target directory exists # Make sure the target directory exists
if [ ! -d "$dest_folder" ]; then if [ ! -d "$dest_folder" ]; then
echo " - Creating srsLTE config folder $dest_folder" echo " - Creating srsRAN config folder $dest_folder"
mkdir -p $dest_folder mkdir -p $dest_folder
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
exit exit

@ -16,6 +16,6 @@ OUTPUT_STRIP_TRAILING_WHITESPACE
message(STATUS "Generating build_info.h") message(STATUS "Generating build_info.h")
configure_file( configure_file(
@PROJECT_SOURCE_DIR@/lib/include/srslte/build_info.h.in @PROJECT_SOURCE_DIR@/lib/include/srsran/build_info.h.in
@CMAKE_BINARY_DIR@/lib/include/srslte/build_info.h @CMAKE_BINARY_DIR@/lib/include/srsran/build_info.h
) )

44
debian/control vendored

@ -1,7 +1,7 @@
Source: srslte Source: srsran
Section: universe/misc Section: universe/misc
Priority: optional Priority: optional
Maintainer: srsLTE Packagers <packagers@softwareradiosystems.com> Maintainer: srsRAN Packagers <packagers@softwareradiosystems.com>
Build-Depends: Build-Depends:
debhelper (>= 9), debhelper (>= 9),
dh-exec, dh-exec,
@ -17,25 +17,25 @@ Build-Depends:
txt2man txt2man
Standards-Version: 4.2.1 Standards-Version: 4.2.1
Homepage: http://www.softwareradiosystems.com Homepage: http://www.softwareradiosystems.com
Vcs-Git: https://github.com/srsLTE/srsLTE.git Vcs-Git: https://github.com/srsRAN/srsRAN.git
Vcs-Browser: https://github.com/srsLTE/srsLTE/ Vcs-Browser: https://github.com/srsRAN/srsRAN/
Package: srslte-dev Package: srsran-dev
Architecture: any Architecture: any
Multi-Arch: same Multi-Arch: same
Section: libdevel Section: libdevel
Depends: ${shlibs:Depends}, Depends: ${shlibs:Depends},
${misc:Depends}, ${misc:Depends},
srslte-core:any (= ${binary:Version}) srsran-core:any (= ${binary:Version})
Breaks: srslte (<= 19.03-0ubuntu1) Breaks: srslte (<= 19.03-0ubuntu1)
Replaces: srslte (<= 19.03-0ubuntu1) Replaces: srslte (<= 19.03-0ubuntu1)
Description: Static libraries and headers for srslte Description: Static libraries and headers for srsran
This software allows you to run a full end-to-end, open-source LTE system. This software allows you to run a full end-to-end, open-source 4G/5G system.
It contains a UE, eNB and EPC implementation. It contains a UE, eNB and EPC implementation.
. .
This package contains the development files - static libraries and headers This package contains the development files - static libraries and headers
Package: srslte Package: srsran
Architecture: all Architecture: all
Depends: ${shlibs:Depends}, Depends: ${shlibs:Depends},
${misc:Depends}, ${misc:Depends},
@ -46,13 +46,13 @@ Description: LTE software suite for software defined radios (metapackage)
This software allows you to run a full end-to-end, open-source LTE system. This software allows you to run a full end-to-end, open-source LTE system.
It contains a UE, eNB and EPC implementation. It contains a UE, eNB and EPC implementation.
. .
This package installs all srsLTE components. This package installs all srsRAN components.
Package: srsenb Package: srsenb
Architecture: any Architecture: any
Depends: ${shlibs:Depends}, Depends: ${shlibs:Depends},
${misc:Depends}, ${misc:Depends},
srslte-core (= ${binary:Version}) srsran-core (= ${binary:Version})
Breaks: srslte (<= 19.03-0ubuntu1) Breaks: srslte (<= 19.03-0ubuntu1)
Replaces: srslte (<= 19.03-0ubuntu1) Replaces: srslte (<= 19.03-0ubuntu1)
Description: Complete SDR LTE eNodeB application Description: Complete SDR LTE eNodeB application
@ -66,25 +66,25 @@ Package: srsepc
Architecture: any Architecture: any
Depends: ${shlibs:Depends}, Depends: ${shlibs:Depends},
${misc:Depends}, ${misc:Depends},
srslte-core (= ${binary:Version}) srsran-core (= ${binary:Version})
Recommends: srsenb Recommends: srsenb
Breaks: srslte (<= 19.03-0ubuntu1) Breaks: srsepc (<= 19.03-0ubuntu1)
Replaces: srslte (<= 19.03-0ubuntu1) Replaces: srsepc (<= 19.03-0ubuntu1)
Description: Light-weight LTE core network implementation Description: Light-weight LTE core network implementation
This software allows you to run a full end-to-end, open-source LTE system. This software allows you to run a full end-to-end, open-source LTE system.
It contains a UE, eNB and EPC implementation. It contains a UE, eNB and EPC implementation.
. .
This package contains a light-weight LTE core network implementation with MME, HSS and S/P-GW. This package contains a light-weight LTE core network implementation with MME, HSS and S/P-GW.
Package: srslte-core Package: srsran-core
Architecture: any Architecture: any
Multi-Arch: allowed Multi-Arch: allowed
Depends: ${shlibs:Depends}, Depends: ${shlibs:Depends},
${misc:Depends} ${misc:Depends}
Breaks: srslte (<= 19.03-0ubuntu1) Breaks: srslte-core (<= 19.03-0ubuntu1)
Replaces: srslte (<= 19.03-0ubuntu1) Replaces: srslte-core (<= 19.03-0ubuntu1)
Description: Common files for srsLTE Description: Common files for srsRAN
This software allows you to run a full end-to-end, open-source LTE system. This software allows you to run a full end-to-end, open-source 4G/5G system.
It contains a UE, eNB and EPC implementation. It contains a UE, eNB and EPC implementation.
. .
This package contains the common files for srsenb, srsue and srsepc. This package contains the common files for srsenb, srsue and srsepc.
@ -93,9 +93,9 @@ Package: srsue
Architecture: any Architecture: any
Depends: ${shlibs:Depends}, Depends: ${shlibs:Depends},
${misc:Depends}, ${misc:Depends},
srslte-core (= ${binary:Version}) srsran-core (= ${binary:Version})
Breaks: srslte (<= 19.03-0ubuntu1) Breaks: srsue (<= 19.03-0ubuntu1)
Replaces: srslte (<= 19.03-0ubuntu1) Replaces: srsue (<= 19.03-0ubuntu1)
Description: User Equipment implementation for LTE Description: User Equipment implementation for LTE
This software enables using a software defined radio as the user equipment This software enables using a software defined radio as the user equipment
connecting to an LTE network. connecting to an LTE network.

52
debian/copyright vendored

@ -1,16 +1,16 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: srsLTE Upstream-Name: srsRAN
Upstream-Contact: srsLTE packaging team <support@softwareradiosystems.com> Upstream-Contact: srsRAN packaging team <support@softwareradiosystems.com>
License: AGPL-3+ License: AGPL-3+
Copyright: 2013-2020, Software Radio Systems Limited. Copyright: 2013-2021, Software Radio Systems Limited.
Source: https://www.github.com/srsLTE Source: https://www.github.com/srsRAN
Files: * Files: *
Copyright: 2013-2020, Software Radio Systems Limited. Copyright: 2013-2021, Software Radio Systems Limited.
License: AGPL-3+ License: AGPL-3+
The following files are used within srsLTE: The following files are used within srsRAN:
Files: lib/src/phy/fec/viterbi37_port.c Files: lib/src/phy/fec/viterbi37_port.c
lib/src/phy/fec/viterbi37_sse.c lib/src/phy/fec/viterbi37_sse.c
@ -26,34 +26,34 @@ Files: srsue/src/upper/pcsc_usim.cc
Copyright: 2002-2014, Jouni Malinen <j@w1.fi> Copyright: 2002-2014, Jouni Malinen <j@w1.fi>
License: BSD-3-clause License: BSD-3-clause
Files: lib/include/srslte/asn1/liblte_common.h Files: lib/include/srsran/asn1/liblte_common.h
lib/include/srslte/asn1/liblte_mme.h lib/include/srsran/asn1/liblte_mme.h
lib/include/srslte/common/liblte_security.h lib/include/srsran/common/liblte_security.h
lib/src/asn1/liblte_common.cc lib/src/asn1/liblte_common.cc
lib/src/asn1/liblte_mme.cc lib/src/asn1/liblte_mme.cc
lib/src/common/liblte_security.cc lib/src/common/liblte_security.cc
Copyright: 2012-2014 Ben Wojtowicz Copyright: 2012-2014 Ben Wojtowicz
License: AGPL-3+ License: AGPL-3+
Files: lib/include/srslte/srslog/bundled/fmt/chrono.h Files: lib/include/srsran/srslog/bundled/fmt/chrono.h
lib/include/srslte/srslog/bundled/fmt/color.h lib/include/srsran/srslog/bundled/fmt/color.h
lib/include/srslte/srslog/bundled/fmt/compile.h lib/include/srsran/srslog/bundled/fmt/compile.h
lib/include/srslte/srslog/bundled/fmt/core.h lib/include/srsran/srslog/bundled/fmt/core.h
lib/include/srslte/srslog/bundled/fmt/format.h lib/include/srsran/srslog/bundled/fmt/format.h
lib/include/srslte/srslog/bundled/fmt/format-inl.h lib/include/srsran/srslog/bundled/fmt/format-inl.h
lib/include/srslte/srslog/bundled/fmt/LICENSE.rst lib/include/srsran/srslog/bundled/fmt/LICENSE.rst
lib/include/srslte/srslog/bundled/fmt/locale.h lib/include/srsran/srslog/bundled/fmt/locale.h
lib/include/srslte/srslog/bundled/fmt/os.h lib/include/srsran/srslog/bundled/fmt/os.h
lib/include/srslte/srslog/bundled/fmt/ostream.h lib/include/srsran/srslog/bundled/fmt/ostream.h
lib/include/srslte/srslog/bundled/fmt/posix.h lib/include/srsran/srslog/bundled/fmt/posix.h
lib/include/srslte/srslog/bundled/fmt/printf.h lib/include/srsran/srslog/bundled/fmt/printf.h
lib/include/srslte/srslog/bundled/fmt/ranges.h lib/include/srsran/srslog/bundled/fmt/ranges.h
lib/src/srslog/bundled/fmt/format.cc lib/src/srsran/bundled/fmt/format.cc
lib/src/srslog/bundled/fmt/os.cc lib/src/srsran/bundled/fmt/os.cc
Copyright: 2012-2020, Victor Zverovich Copyright: 2012-2020, Victor Zverovich
License: MIT License: MIT
Files: lib/include/srslte/common/backward.hpp Files: lib/include/srsran/common/backward.hpp
cmake/modules/FindBackward.cmake cmake/modules/FindBackward.cmake
Copyright: 2013, Google Inc. Copyright: 2013, Google Inc.
License: MIT License: MIT
@ -71,7 +71,7 @@ License: AGPL-3+
GNU Affero General Public License for more details. GNU Affero General Public License for more details.
. .
On Debian systems, the complete text of the AGPL 3 can be found in On Debian systems, the complete text of the AGPL 3 can be found in
/usr/share/doc/srslte/LICENSE /usr/share/doc/srsran/LICENSE
License: LGPL-2.1 License: LGPL-2.1

@ -18,7 +18,7 @@ DESCRIPTION
- 75 Mbps DL in SISO configuration with commercial UEs - 75 Mbps DL in SISO configuration with commercial UEs
- 50 Mbps UL in 20 MHz with commercial UEs - 50 Mbps UL in 20 MHz with commercial UEs
An example configuration file is available in /usr/share/srslte/enb.conf.example An example configuration file is available in /usr/share/srsran/enb.conf.example
OPTIONS OPTIONS

@ -13,7 +13,7 @@ DESCRIPTION
- S/P-GW with standard SGi exposed as virtual network interface (TUN device) - S/P-GW with standard SGi exposed as virtual network interface (TUN device)
- HSS (Home Subscriber Server) with configurable user database in CSV format - HSS (Home Subscriber Server) with configurable user database in CSV format
An example configuration file is available in /usr/share/srslte/epc.conf.example An example configuration file is available in /usr/share/srsran/epc.conf.example
OPTIONS OPTIONS

@ -18,7 +18,7 @@ DESCRIPTION
- 75 Mbps DL in 20 MHz SISO configuration in i7 Quad-Core CPU. - 75 Mbps DL in 20 MHz SISO configuration in i7 Quad-Core CPU.
- 36 Mbps DL in 10 MHz SISO configuration in i5 Dual-Core CPU. - 36 Mbps DL in 10 MHz SISO configuration in i5 Dual-Core CPU.
An example configuration file is available in /usr/share/srslte/ue.conf.example An example configuration file is available in /usr/share/srsran/ue.conf.example
OPTIONS OPTIONS

16
debian/packager.sh vendored

@ -24,21 +24,21 @@ DISTRO=disco
COMMIT=eda7ca69a09933526e9318bcf553af0dc0b81598 COMMIT=eda7ca69a09933526e9318bcf553af0dc0b81598
REL_FLAG=releases REL_FLAG=releases
echo 'Packaging srsLTE release' $RELEASE 'for Ubuntu' $DISTRO echo 'Packaging srsRAN release' $RELEASE 'for Ubuntu' $DISTRO
# Make build dir for the package # Make build dir for the package
BUILD_DIR=~/build-area/srslte_$RELEASE/$REL_FLAG/$DISTRO BUILD_DIR=~/build-area/srsran_$RELEASE/$REL_FLAG/$DISTRO
mkdir -p $BUILD_DIR mkdir -p $BUILD_DIR
# Make tarball of the package source # Make tarball of the package source
pushd ~/srsLTE pushd ~/srsRAN
git archive $COMMIT -o $BUILD_DIR/srslte_$DISTRO.tar.gz git archive $COMMIT -o $BUILD_DIR/srsran_$DISTRO.tar.gz
popd popd
# Copy original tarball # Copy original tarball
cp ~/build-area/srslte_$RELEASE/$REL_FLAG/srslte_$RELEASE.orig.tar.gz $BUILD_DIR cp ~/build-area/srsran_$RELEASE/$REL_FLAG/srsran_$RELEASE.orig.tar.gz $BUILD_DIR
mkdir $BUILD_DIR/srsLTE mkdir $BUILD_DIR/srsRAN
pushd $BUILD_DIR/srsLTE pushd $BUILD_DIR/srsRAN
tar -vxzf ../srslte_$DISTRO.tar.gz tar -vxzf ../srsran_$DISTRO.tar.gz
popd popd

@ -4,7 +4,7 @@ Description=Software Radio System's LTE eNB implementation
[Service] [Service]
Type=simple Type=simple
Restart=always Restart=always
ExecStart=/usr/bin/srsenb /etc/srslte/enb.conf ExecStart=/usr/bin/srsenb /etc/srsran/enb.conf
RestartSec=2 RestartSec=2
[Install] [Install]

@ -4,7 +4,7 @@ Description=Software Radio System's light-weight EPC implementation
[Service] [Service]
Type=simple Type=simple
Restart=always Restart=always
ExecStart=/usr/bin/srsepc /etc/srslte/epc.conf ExecStart=/usr/bin/srsepc /etc/srsran/epc.conf
RestartSec=2 RestartSec=2
[Install] [Install]

@ -7,7 +7,7 @@ set -e
. /usr/share/debconf/confmodule . /usr/share/debconf/confmodule
# Ask questions # Ask questions
db_input low srslte/install_configs_question || true db_input low srsran/install_configs_question || true
# Show interface # Show interface
db_go || true db_go || true

@ -1,3 +1,3 @@
usr/lib/*/libsrslte_rf.so* usr/lib/*/libsrsran_rf.so*
usr/share/srslte usr/share/srsran
usr/bin/srslte_install_configs.sh usr/bin/srsran_install_configs.sh

@ -4,11 +4,11 @@
. /usr/share/debconf/confmodule . /usr/share/debconf/confmodule
# Fetching configuration from debconf # Fetching configuration from debconf
db_get srslte/install_configs_question db_get srsran/install_configs_question
ANSWER1=$RET ANSWER1=$RET
if [ $ANSWER1 == "true" ]; then if [ $ANSWER1 == "true" ]; then
srslte_install_configs.sh user srsran_install_configs.sh user
fi fi
#DEBHELPER# #DEBHELPER#

@ -1,6 +1,6 @@
Template: srslte/install_configs_question Template: srsran/install_configs_question
Type: boolean Type: boolean
Default: true Default: true
Description: Install configs? Description: Install configs?
This installs the default srsLTE configuration files to the user's This installs the default srsRAN configuration files to the user's
home directory (~/.config/srslte) but keeps any existing config files. home directory (~/.config/srsran) but keeps any existing config files.

@ -1,2 +1,2 @@
usr/lib/*/*.a usr/lib/*/*.a
usr/include/srslte usr/include/srsran

@ -4,7 +4,7 @@ Description=Software Radio Systems's LTE UE implementation
[Service] [Service]
Type=simple Type=simple
Restart=always Restart=always
ExecStart=/usr/bin/srsue /etc/srslte/ue.conf ExecStart=/usr/bin/srsue /etc/srsran/ue.conf
RestartSec=2 RestartSec=2
[Install] [Install]

@ -23,7 +23,7 @@
################################################################# #################################################################
add_executable(synch_file synch_file.c) add_executable(synch_file synch_file.c)
target_link_libraries(synch_file srslte_phy) target_link_libraries(synch_file srsran_phy)
################################################################# #################################################################
# These can be compiled without UHD or graphics support # These can be compiled without UHD or graphics support
@ -31,30 +31,30 @@ target_link_libraries(synch_file srslte_phy)
if(RF_FOUND) if(RF_FOUND)
add_executable(pdsch_ue pdsch_ue.c) add_executable(pdsch_ue pdsch_ue.c)
target_link_libraries(pdsch_ue srslte_phy srslte_common srslte_rf pthread) target_link_libraries(pdsch_ue srsran_phy srsran_common srsran_rf pthread)
add_executable(pdsch_enodeb pdsch_enodeb.c) add_executable(pdsch_enodeb pdsch_enodeb.c)
target_link_libraries(pdsch_enodeb srslte_phy srslte_common srslte_rf pthread) target_link_libraries(pdsch_enodeb srsran_phy srsran_common srsran_rf pthread)
add_executable(npdsch_enodeb npdsch_enodeb.c) add_executable(npdsch_enodeb npdsch_enodeb.c)
target_link_libraries(npdsch_enodeb srslte_phy srslte_rf pthread) target_link_libraries(npdsch_enodeb srsran_phy srsran_rf pthread)
add_executable(npdsch_ue npdsch_ue.c npdsch_ue_helper.cc) add_executable(npdsch_ue npdsch_ue.c npdsch_ue_helper.cc)
target_link_libraries(npdsch_ue srslte_common srslte_phy srslte_rf pthread rrc_asn1) target_link_libraries(npdsch_ue srsran_common srsran_phy srsran_rf pthread rrc_asn1)
else(RF_FOUND) else(RF_FOUND)
add_definitions(-DDISABLE_RF) add_definitions(-DDISABLE_RF)
add_executable(pdsch_ue pdsch_ue.c) add_executable(pdsch_ue pdsch_ue.c)
target_link_libraries(pdsch_ue srslte_common srslte_phy pthread) target_link_libraries(pdsch_ue srsran_common srsran_phy pthread)
add_executable(pdsch_enodeb pdsch_enodeb.c) add_executable(pdsch_enodeb pdsch_enodeb.c)
target_link_libraries(pdsch_enodeb srslte_common srslte_phy pthread) target_link_libraries(pdsch_enodeb srsran_common srsran_phy pthread)
add_executable(npdsch_enodeb npdsch_enodeb.c) add_executable(npdsch_enodeb npdsch_enodeb.c)
target_link_libraries(npdsch_enodeb srslte_phy pthread) target_link_libraries(npdsch_enodeb srsran_phy pthread)
add_executable(npdsch_ue npdsch_ue.c npdsch_ue_helper.cc) add_executable(npdsch_ue npdsch_ue.c npdsch_ue_helper.cc)
target_link_libraries(npdsch_ue srslte_common srslte_phy pthread rrc_asn1) target_link_libraries(npdsch_ue srsran_common srsran_phy pthread rrc_asn1)
endif(RF_FOUND) endif(RF_FOUND)
if(SRSGUI_FOUND) if(SRSGUI_FOUND)
@ -66,7 +66,7 @@ endif(SRSGUI_FOUND)
if (ZEROMQ_FOUND) if (ZEROMQ_FOUND)
add_executable(zmq_remote_rx zmq_remote_rx.c) add_executable(zmq_remote_rx zmq_remote_rx.c)
target_link_libraries(zmq_remote_rx srslte_phy srslte_rf) target_link_libraries(zmq_remote_rx srsran_phy srsran_rf)
endif (ZEROMQ_FOUND) endif (ZEROMQ_FOUND)
################################################################# #################################################################
@ -76,25 +76,25 @@ endif (ZEROMQ_FOUND)
if(RF_FOUND) if(RF_FOUND)
add_executable(cell_search cell_search.c) add_executable(cell_search cell_search.c)
target_link_libraries(cell_search srslte_phy srslte_common srslte_rf) target_link_libraries(cell_search srsran_phy srsran_common srsran_rf)
add_executable(usrp_capture usrp_capture.c) add_executable(usrp_capture usrp_capture.c)
target_link_libraries(usrp_capture srslte_phy srslte_rf) target_link_libraries(usrp_capture srsran_phy srsran_rf)
add_executable(usrp_capture_sync usrp_capture_sync.c) add_executable(usrp_capture_sync usrp_capture_sync.c)
target_link_libraries(usrp_capture_sync srslte_phy srslte_rf) target_link_libraries(usrp_capture_sync srsran_phy srsran_rf)
add_executable(usrp_capture_sync_nbiot usrp_capture_sync_nbiot.c) add_executable(usrp_capture_sync_nbiot usrp_capture_sync_nbiot.c)
target_link_libraries(usrp_capture_sync_nbiot srslte_rf srslte_phy) target_link_libraries(usrp_capture_sync_nbiot srsran_rf srsran_phy)
add_executable(cell_search_nbiot cell_search_nbiot.c) add_executable(cell_search_nbiot cell_search_nbiot.c)
target_link_libraries(cell_search_nbiot srslte_rf srslte_phy) target_link_libraries(cell_search_nbiot srsran_rf srsran_phy)
add_executable(usrp_txrx usrp_txrx.c) add_executable(usrp_txrx usrp_txrx.c)
target_link_libraries(usrp_txrx srslte_phy srslte_rf) target_link_libraries(usrp_txrx srsran_phy srsran_rf)
add_executable(pssch_ue pssch_ue.c) add_executable(pssch_ue pssch_ue.c)
target_link_libraries(pssch_ue srslte_phy srslte_common srslte_rf pthread) target_link_libraries(pssch_ue srsran_phy srsran_common srsran_rf pthread)
if(SRSGUI_FOUND) if(SRSGUI_FOUND)
target_link_libraries(pssch_ue ${SRSGUI_LIBRARIES}) target_link_libraries(pssch_ue ${SRSGUI_LIBRARIES})

@ -1,21 +1,12 @@
/** /**
* Copyright 2013-2021 Software Radio Systems Limited
*
* This file is part of srsLTE.
* *
* srsLTE is free software: you can redistribute it and/or modify * \section COPYRIGHT
* 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, * Copyright 2013-2021 Software Radio Systems Limited
* 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 * By using this file, you agree to the terms and conditions set
* the LICENSE file in the top-level directory of this distribution * forth in the LICENSE file which can be found at the top level of
* and at http://www.gnu.org/licenses/. * the distribution.
* *
*/ */
@ -30,13 +21,13 @@
#include <unistd.h> #include <unistd.h>
#include "srslte/srslte.h" #include "srsran/srsran.h"
#include "srslte/common/crash_handler.h" #include "srsran/common/crash_handler.h"
#include "srslte/phy/rf/rf_utils.h" #include "srsran/phy/rf/rf_utils.h"
#ifndef DISABLE_RF #ifndef DISABLE_RF
#include "srslte/phy/rf/rf.h" #include "srsran/phy/rf/rf.h"
#endif #endif
#define MHZ 1000000 #define MHZ 1000000
@ -49,14 +40,14 @@
int band = -1; int band = -1;
int earfcn_start = -1, earfcn_end = -1; int earfcn_start = -1, earfcn_end = -1;
cell_search_cfg_t cell_detect_config = {.max_frames_pbch = SRSLTE_DEFAULT_MAX_FRAMES_PBCH, cell_search_cfg_t cell_detect_config = {.max_frames_pbch = SRSRAN_DEFAULT_MAX_FRAMES_PBCH,
.max_frames_pss = SRSLTE_DEFAULT_MAX_FRAMES_PSS, .max_frames_pss = SRSRAN_DEFAULT_MAX_FRAMES_PSS,
.nof_valid_pss_frames = SRSLTE_DEFAULT_NOF_VALID_PSS_FRAMES, .nof_valid_pss_frames = SRSRAN_DEFAULT_NOF_VALID_PSS_FRAMES,
.init_agc = 0, .init_agc = 0,
.force_tdd = false}; .force_tdd = false};
struct cells { struct cells {
srslte_cell_t cell; srsran_cell_t cell;
float freq; float freq;
int dl_earfcn; int dl_earfcn;
float power; float power;
@ -74,7 +65,7 @@ void usage(char* prog)
printf("\t-s earfcn_start [Default All]\n"); printf("\t-s earfcn_start [Default All]\n");
printf("\t-e earfcn_end [Default All]\n"); printf("\t-e earfcn_end [Default All]\n");
printf("\t-n nof_frames_total [Default 100]\n"); printf("\t-n nof_frames_total [Default 100]\n");
printf("\t-v [set srslte_verbose to debug, default none]\n"); printf("\t-v [set srsran_verbose to debug, default none]\n");
} }
void parse_args(int argc, char** argv) void parse_args(int argc, char** argv)
@ -101,7 +92,7 @@ void parse_args(int argc, char** argv)
rf_gain = strtof(argv[optind], NULL); rf_gain = strtof(argv[optind], NULL);
break; break;
case 'v': case 'v':
srslte_verbose++; srsran_verbose++;
break; break;
default: default:
usage(argv[0]); usage(argv[0]);
@ -114,10 +105,10 @@ void parse_args(int argc, char** argv)
} }
} }
int srslte_rf_recv_wrapper(void* h, void* data, uint32_t nsamples, srslte_timestamp_t* t) int srsran_rf_recv_wrapper(void* h, void* data, uint32_t nsamples, srsran_timestamp_t* t)
{ {
DEBUG(" ---- Receive %d samples ---- ", nsamples); DEBUG(" ---- Receive %d samples ---- ", nsamples);
return srslte_rf_recv_with_time((srslte_rf_t*)h, data, nsamples, 1, NULL, NULL); return srsran_rf_recv_with_time((srsran_rf_t*)h, data, nsamples, 1, NULL, NULL);
} }
bool go_exit = false; bool go_exit = false;
@ -130,46 +121,46 @@ void sig_int_handler(int signo)
} }
} }
static SRSLTE_AGC_CALLBACK(srslte_rf_set_rx_gain_wrapper) static SRSRAN_AGC_CALLBACK(srsran_rf_set_rx_gain_wrapper)
{ {
srslte_rf_set_rx_gain((srslte_rf_t*)h, gain_db); srsran_rf_set_rx_gain((srsran_rf_t*)h, gain_db);
} }
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
int n; int n;
srslte_rf_t rf; srsran_rf_t rf;
srslte_ue_cellsearch_t cs; srsran_ue_cellsearch_t cs;
srslte_ue_cellsearch_result_t found_cells[3]; srsran_ue_cellsearch_result_t found_cells[3];
int nof_freqs; int nof_freqs;
srslte_earfcn_t channels[MAX_EARFCN]; srsran_earfcn_t channels[MAX_EARFCN];
uint32_t freq; uint32_t freq;
uint32_t n_found_cells = 0; uint32_t n_found_cells = 0;
srslte_debug_handle_crash(argc, argv); srsran_debug_handle_crash(argc, argv);
parse_args(argc, argv); parse_args(argc, argv);
printf("Opening RF device...\n"); printf("Opening RF device...\n");
if (srslte_rf_open(&rf, rf_args)) { if (srsran_rf_open(&rf, rf_args)) {
ERROR("Error opening rf"); ERROR("Error opening rf");
exit(-1); exit(-1);
} }
if (!cell_detect_config.init_agc) { if (!cell_detect_config.init_agc) {
srslte_rf_set_rx_gain(&rf, rf_gain); srsran_rf_set_rx_gain(&rf, rf_gain);
} else { } else {
printf("Starting AGC thread...\n"); printf("Starting AGC thread...\n");
if (srslte_rf_start_gain_thread(&rf, false)) { if (srsran_rf_start_gain_thread(&rf, false)) {
ERROR("Error opening rf"); ERROR("Error opening rf");
exit(-1); exit(-1);
} }
srslte_rf_set_rx_gain(&rf, 50); srsran_rf_set_rx_gain(&rf, 50);
} }
// Supress RF messages // Supress RF messages
srslte_rf_suppress_stdout(&rf); srsran_rf_suppress_stdout(&rf);
nof_freqs = srslte_band_get_fd_band(band, channels, earfcn_start, earfcn_end, MAX_EARFCN); nof_freqs = srsran_band_get_fd_band(band, channels, earfcn_start, earfcn_end, MAX_EARFCN);
if (nof_freqs < 0) { if (nof_freqs < 0) {
ERROR("Error getting EARFCN list"); ERROR("Error getting EARFCN list");
exit(-1); exit(-1);
@ -181,18 +172,18 @@ int main(int argc, char** argv)
sigprocmask(SIG_UNBLOCK, &sigset, NULL); sigprocmask(SIG_UNBLOCK, &sigset, NULL);
signal(SIGINT, sig_int_handler); signal(SIGINT, sig_int_handler);
if (srslte_ue_cellsearch_init(&cs, cell_detect_config.max_frames_pss, srslte_rf_recv_wrapper, (void*)&rf)) { if (srsran_ue_cellsearch_init(&cs, cell_detect_config.max_frames_pss, srsran_rf_recv_wrapper, (void*)&rf)) {
ERROR("Error initiating UE cell detect"); ERROR("Error initiating UE cell detect");
exit(-1); exit(-1);
} }
if (cell_detect_config.max_frames_pss) { if (cell_detect_config.max_frames_pss) {
srslte_ue_cellsearch_set_nof_valid_frames(&cs, cell_detect_config.nof_valid_pss_frames); srsran_ue_cellsearch_set_nof_valid_frames(&cs, cell_detect_config.nof_valid_pss_frames);
} }
if (cell_detect_config.init_agc) { if (cell_detect_config.init_agc) {
srslte_rf_info_t* rf_info = srslte_rf_get_info(&rf); srsran_rf_info_t* rf_info = srsran_rf_get_info(&rf);
srslte_ue_sync_start_agc(&cs.ue_sync, srsran_ue_sync_start_agc(&cs.ue_sync,
srslte_rf_set_rx_gain_wrapper, srsran_rf_set_rx_gain_wrapper,
rf_info->min_rx_gain, rf_info->min_rx_gain,
rf_info->max_rx_gain, rf_info->max_rx_gain,
cell_detect_config.init_agc); cell_detect_config.init_agc);
@ -200,32 +191,32 @@ int main(int argc, char** argv)
for (freq = 0; freq < nof_freqs && !go_exit; freq++) { for (freq = 0; freq < nof_freqs && !go_exit; freq++) {
/* set rf_freq */ /* set rf_freq */
srslte_rf_set_rx_freq(&rf, 0, (double)channels[freq].fd * MHZ); 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); INFO("Set rf_freq to %.3f MHz", (double)channels[freq].fd * MHZ / 1000000);
printf( printf(
"[%3d/%d]: EARFCN %d Freq. %.2f MHz looking for PSS.\n", freq, nof_freqs, channels[freq].id, channels[freq].fd); "[%3d/%d]: EARFCN %d Freq. %.2f MHz looking for PSS.\n", freq, nof_freqs, channels[freq].id, channels[freq].fd);
fflush(stdout); fflush(stdout);
if (SRSLTE_VERBOSE_ISINFO()) { if (SRSRAN_VERBOSE_ISINFO()) {
printf("\n"); printf("\n");
} }
bzero(found_cells, 3 * sizeof(srslte_ue_cellsearch_result_t)); bzero(found_cells, 3 * sizeof(srsran_ue_cellsearch_result_t));
INFO("Setting sampling frequency %.2f MHz for PSS search", SRSLTE_CS_SAMP_FREQ / 1000000); INFO("Setting sampling frequency %.2f MHz for PSS search", SRSRAN_CS_SAMP_FREQ / 1000000);
srslte_rf_set_rx_srate(&rf, SRSLTE_CS_SAMP_FREQ); srsran_rf_set_rx_srate(&rf, SRSRAN_CS_SAMP_FREQ);
INFO("Starting receiver..."); INFO("Starting receiver...");
srslte_rf_start_rx_stream(&rf, false); srsran_rf_start_rx_stream(&rf, false);
n = srslte_ue_cellsearch_scan(&cs, found_cells, NULL); n = srsran_ue_cellsearch_scan(&cs, found_cells, NULL);
if (n < 0) { if (n < 0) {
ERROR("Error searching cell"); ERROR("Error searching cell");
exit(-1); exit(-1);
} else if (n > 0) { } else if (n > 0) {
for (int i = 0; i < 3; i++) { for (int i = 0; i < 3; i++) {
if (found_cells[i].psr > 2.0) { if (found_cells[i].psr > 2.0) {
srslte_cell_t cell; srsran_cell_t cell;
cell.id = found_cells[i].cell_id; cell.id = found_cells[i].cell_id;
cell.cp = found_cells[i].cp; cell.cp = found_cells[i].cp;
int ret = rf_mib_decoder(&rf, 1, &cell_detect_config, &cell, NULL); int ret = rf_mib_decoder(&rf, 1, &cell_detect_config, &cell, NULL);
@ -233,7 +224,7 @@ int main(int argc, char** argv)
ERROR("Error decoding MIB"); ERROR("Error decoding MIB");
exit(-1); exit(-1);
} }
if (ret == SRSLTE_UE_MIB_FOUND) { if (ret == SRSRAN_UE_MIB_FOUND) {
printf("Found CELL ID %d. %d PRB, %d ports\n", cell.id, cell.nof_prb, cell.nof_ports); printf("Found CELL ID %d. %d PRB, %d ports\n", cell.id, cell.nof_prb, cell.nof_ports);
if (cell.nof_ports > 0) { if (cell.nof_ports > 0) {
results[n_found_cells].cell = cell; results[n_found_cells].cell = cell;
@ -256,12 +247,12 @@ int main(int argc, char** argv)
results[i].cell.id, results[i].cell.id,
results[i].cell.nof_prb, results[i].cell.nof_prb,
results[i].cell.nof_ports, results[i].cell.nof_ports,
srslte_convert_power_to_dB(results[i].power)); srsran_convert_power_to_dB(results[i].power));
} }
printf("\nBye\n"); printf("\nBye\n");
srslte_ue_cellsearch_free(&cs); srsran_ue_cellsearch_free(&cs);
srslte_rf_close(&rf); srsran_rf_close(&rf);
exit(0); exit(0);
} }

@ -1,21 +1,12 @@
/** /**
* Copyright 2013-2021 Software Radio Systems Limited
*
* This file is part of srsLTE.
* *
* srsLTE is free software: you can redistribute it and/or modify * \section COPYRIGHT
* 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, * Copyright 2013-2021 Software Radio Systems Limited
* 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 * By using this file, you agree to the terms and conditions set
* the LICENSE file in the top-level directory of this distribution * forth in the LICENSE file which can be found at the top level of
* and at http://www.gnu.org/licenses/. * the distribution.
* *
*/ */
@ -28,11 +19,11 @@
#include <sys/time.h> #include <sys/time.h>
#include <unistd.h> #include <unistd.h>
#include "srslte/phy/rf/rf_utils.h" #include "srsran/phy/rf/rf_utils.h"
#include "srslte/phy/ue/ue_cell_search_nbiot.h" #include "srsran/phy/ue/ue_cell_search_nbiot.h"
#ifndef DISABLE_RF #ifndef DISABLE_RF
#include "srslte/phy/rf/rf.h" #include "srsran/phy/rf/rf.h"
#endif #endif
#define MHZ 1000000 #define MHZ 1000000
@ -49,14 +40,14 @@ double raster_offset[NUM_RASTER_OFFSET] = {0.0, 2500.0, -2500.0, 7500.0, -7500.0
int band = -1; int band = -1;
int earfcn_start = -1, earfcn_end = -1; int earfcn_start = -1, earfcn_end = -1;
cell_search_cfg_t cell_detect_config = {.max_frames_pbch = SRSLTE_DEFAULT_MAX_FRAMES_NPBCH, cell_search_cfg_t cell_detect_config = {.max_frames_pbch = SRSRAN_DEFAULT_MAX_FRAMES_NPBCH,
.max_frames_pss = SRSLTE_DEFAULT_MAX_FRAMES_NPSS, .max_frames_pss = SRSRAN_DEFAULT_MAX_FRAMES_NPSS,
.nof_valid_pss_frames = SRSLTE_DEFAULT_NOF_VALID_NPSS_FRAMES, .nof_valid_pss_frames = SRSRAN_DEFAULT_NOF_VALID_NPSS_FRAMES,
.init_agc = 0.0, .init_agc = 0.0,
.force_tdd = false}; .force_tdd = false};
struct cells { struct cells {
srslte_nbiot_cell_t cell; srsran_nbiot_cell_t cell;
float freq; float freq;
int dl_earfcn; int dl_earfcn;
float power; float power;
@ -76,7 +67,7 @@ void usage(char* prog)
printf("\t-e earfcn_end [Default All]\n"); printf("\t-e earfcn_end [Default All]\n");
printf("\t-r Also scan frequencies with raster offset [Default %s]\n", scan_raster_offset ? "Yes" : "No"); printf("\t-r Also scan frequencies with raster offset [Default %s]\n", scan_raster_offset ? "Yes" : "No");
printf("\t-n nof_frames_total [Default 100]\n"); printf("\t-n nof_frames_total [Default 100]\n");
printf("\t-v [set srslte_verbose to debug, default none]\n"); printf("\t-v [set srsran_verbose to debug, default none]\n");
} }
void parse_args(int argc, char** argv) void parse_args(int argc, char** argv)
@ -106,7 +97,7 @@ void parse_args(int argc, char** argv)
scan_raster_offset = true; scan_raster_offset = true;
break; break;
case 'v': case 'v':
srslte_verbose++; srsran_verbose++;
break; break;
default: default:
usage(argv[0]); usage(argv[0]);
@ -119,14 +110,14 @@ void parse_args(int argc, char** argv)
} }
} }
int srslte_rf_recv_wrapper(void* h, cf_t* data[SRSLTE_MAX_PORTS], uint32_t nsamples, srslte_timestamp_t* t) int srsran_rf_recv_wrapper(void* h, cf_t* data[SRSRAN_MAX_PORTS], uint32_t nsamples, srsran_timestamp_t* t)
{ {
DEBUG(" ---- Receive %d samples ----", nsamples); DEBUG(" ---- Receive %d samples ----", nsamples);
void* ptr[SRSLTE_MAX_PORTS]; void* ptr[SRSRAN_MAX_PORTS];
for (int i = 0; i < SRSLTE_MAX_PORTS; i++) { for (int i = 0; i < SRSRAN_MAX_PORTS; i++) {
ptr[i] = data[i]; ptr[i] = data[i];
} }
return srslte_rf_recv_with_time_multi(h, ptr, nsamples, true, NULL, NULL); return srsran_rf_recv_with_time_multi(h, ptr, nsamples, true, NULL, NULL);
} }
bool go_exit = false; bool go_exit = false;
@ -139,44 +130,44 @@ void sig_int_handler(int signo)
} }
} }
static SRSLTE_AGC_CALLBACK(srslte_rf_set_rx_gain_wrapper) static SRSRAN_AGC_CALLBACK(srsran_rf_set_rx_gain_wrapper)
{ {
srslte_rf_set_rx_gain((srslte_rf_t*)h, gain_db); srsran_rf_set_rx_gain((srsran_rf_t*)h, gain_db);
} }
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
int n; int n;
srslte_rf_t rf; srsran_rf_t rf;
srslte_ue_cellsearch_nbiot_t cs; srsran_ue_cellsearch_nbiot_t cs;
srslte_nbiot_ue_cellsearch_result_t found_cells[3]; srsran_nbiot_ue_cellsearch_result_t found_cells[3];
int nof_freqs; int nof_freqs;
srslte_earfcn_t channels[MAX_EARFCN]; srsran_earfcn_t channels[MAX_EARFCN];
uint32_t freq; uint32_t freq;
uint32_t n_found_cells = 0; uint32_t n_found_cells = 0;
parse_args(argc, argv); parse_args(argc, argv);
printf("Opening RF device...\n"); printf("Opening RF device...\n");
if (srslte_rf_open(&rf, rf_args)) { if (srsran_rf_open(&rf, rf_args)) {
fprintf(stderr, "Error opening rf\n"); fprintf(stderr, "Error opening rf\n");
exit(-1); exit(-1);
} }
if (!cell_detect_config.init_agc) { if (!cell_detect_config.init_agc) {
srslte_rf_set_rx_gain(&rf, rf_gain); srsran_rf_set_rx_gain(&rf, rf_gain);
} else { } else {
printf("Starting AGC thread...\n"); printf("Starting AGC thread...\n");
if (srslte_rf_start_gain_thread(&rf, false)) { if (srsran_rf_start_gain_thread(&rf, false)) {
fprintf(stderr, "Error opening rf\n"); fprintf(stderr, "Error opening rf\n");
exit(-1); exit(-1);
} }
srslte_rf_set_rx_gain(&rf, 50); srsran_rf_set_rx_gain(&rf, 50);
} }
// Supress RF messages // Supress RF messages
srslte_rf_suppress_stdout(&rf); srsran_rf_suppress_stdout(&rf);
nof_freqs = srslte_band_get_fd_band(band, channels, earfcn_start, earfcn_end, MAX_EARFCN); nof_freqs = srsran_band_get_fd_band(band, channels, earfcn_start, earfcn_end, MAX_EARFCN);
if (nof_freqs < 0) { if (nof_freqs < 0) {
fprintf(stderr, "Error getting EARFCN list\n"); fprintf(stderr, "Error getting EARFCN list\n");
exit(-1); exit(-1);
@ -192,47 +183,47 @@ int main(int argc, char** argv)
for (int i = 0; i < (scan_raster_offset ? NUM_RASTER_OFFSET : 1); i++) { for (int i = 0; i < (scan_raster_offset ? NUM_RASTER_OFFSET : 1); i++) {
// set rf_freq // set rf_freq
double rf_freq = channels[freq].fd * MHZ + raster_offset[i]; double rf_freq = channels[freq].fd * MHZ + raster_offset[i];
srslte_rf_set_rx_freq(&rf, 0, rf_freq); srsran_rf_set_rx_freq(&rf, 0, rf_freq);
INFO("Set rf_freq to %.3f Hz", rf_freq); INFO("Set rf_freq to %.3f Hz", rf_freq);
printf("[%3d/%d]: EARFCN %d, %.2f MHz looking for NPSS.\n", freq, nof_freqs, channels[freq].id, rf_freq / 1e6); printf("[%3d/%d]: EARFCN %d, %.2f MHz looking for NPSS.\n", freq, nof_freqs, channels[freq].id, rf_freq / 1e6);
fflush(stdout); fflush(stdout);
if (SRSLTE_VERBOSE_ISINFO()) { if (SRSRAN_VERBOSE_ISINFO()) {
printf("\n"); printf("\n");
} }
bzero(found_cells, 3 * sizeof(srslte_nbiot_ue_cellsearch_result_t)); bzero(found_cells, 3 * sizeof(srsran_nbiot_ue_cellsearch_result_t));
if (srslte_ue_cellsearch_nbiot_init(&cs, cell_detect_config.max_frames_pss, srslte_rf_recv_wrapper, (void*)&rf)) { if (srsran_ue_cellsearch_nbiot_init(&cs, cell_detect_config.max_frames_pss, srsran_rf_recv_wrapper, (void*)&rf)) {
fprintf(stderr, "Error initiating UE cell detect\n"); fprintf(stderr, "Error initiating UE cell detect\n");
exit(-1); exit(-1);
} }
if (cell_detect_config.max_frames_pss) { if (cell_detect_config.max_frames_pss) {
srslte_ue_cellsearch_nbiot_set_nof_valid_frames(&cs, cell_detect_config.nof_valid_pss_frames); srsran_ue_cellsearch_nbiot_set_nof_valid_frames(&cs, cell_detect_config.nof_valid_pss_frames);
} }
if (cell_detect_config.init_agc) { if (cell_detect_config.init_agc) {
srslte_ue_sync_nbiot_start_agc(&cs.ue_sync, srslte_rf_set_rx_gain_wrapper, cell_detect_config.init_agc); srsran_ue_sync_nbiot_start_agc(&cs.ue_sync, srsran_rf_set_rx_gain_wrapper, cell_detect_config.init_agc);
} }
INFO("Setting sampling frequency %.2f MHz for NPSS search", SRSLTE_CS_SAMP_FREQ / 1000000); INFO("Setting sampling frequency %.2f MHz for NPSS search", SRSRAN_CS_SAMP_FREQ / 1000000);
srslte_rf_set_rx_srate(&rf, SRSLTE_CS_SAMP_FREQ); srsran_rf_set_rx_srate(&rf, SRSRAN_CS_SAMP_FREQ);
INFO("Starting receiver..."); INFO("Starting receiver...");
srslte_rf_start_rx_stream(&rf, false); srsran_rf_start_rx_stream(&rf, false);
n = srslte_ue_cellsearch_nbiot_scan(&cs); n = srsran_ue_cellsearch_nbiot_scan(&cs);
if (n == SRSLTE_SUCCESS) { if (n == SRSRAN_SUCCESS) {
srslte_rf_stop_rx_stream(&rf); srsran_rf_stop_rx_stream(&rf);
n = srslte_ue_cellsearch_nbiot_detect(&cs, found_cells); n = srsran_ue_cellsearch_nbiot_detect(&cs, found_cells);
if (n == SRSLTE_SUCCESS) { if (n == SRSRAN_SUCCESS) {
srslte_nbiot_cell_t cell; srsran_nbiot_cell_t cell;
cell.n_id_ncell = found_cells[0].n_id_ncell; cell.n_id_ncell = found_cells[0].n_id_ncell;
cell.base.cp = SRSLTE_CP_NORM; cell.base.cp = SRSRAN_CP_NORM;
// TODO: add MIB decoding // TODO: add MIB decoding
printf("Found CELL ID %d.\n", cell.n_id_ncell); printf("Found CELL ID %d.\n", cell.n_id_ncell);
memcpy(&results[n_found_cells].cell, &cell, sizeof(srslte_nbiot_cell_t)); memcpy(&results[n_found_cells].cell, &cell, sizeof(srsran_nbiot_cell_t));
results[n_found_cells].freq = channels[freq].fd; results[n_found_cells].freq = channels[freq].fd;
results[n_found_cells].dl_earfcn = channels[freq].id; results[n_found_cells].dl_earfcn = channels[freq].id;
results[n_found_cells].power = found_cells[0].peak; results[n_found_cells].power = found_cells[0].peak;
@ -241,7 +232,7 @@ int main(int argc, char** argv)
printf("Cell found but couldn't detect ID.\n"); printf("Cell found but couldn't detect ID.\n");
} }
} }
srslte_ue_cellsearch_nbiot_free(&cs); srsran_ue_cellsearch_nbiot_free(&cs);
} }
} }
@ -256,6 +247,6 @@ int main(int argc, char** argv)
printf("\nBye\n"); printf("\nBye\n");
srslte_rf_close(&rf); srsran_rf_close(&rf);
exit(0); exit(0);
} }

@ -1,21 +1,12 @@
/** /**
* Copyright 2013-2021 Software Radio Systems Limited
*
* This file is part of srsLTE.
* *
* srsLTE is free software: you can redistribute it and/or modify * \section COPYRIGHT
* 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, * Copyright 2013-2021 Software Radio Systems Limited
* 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 * By using this file, you agree to the terms and conditions set
* the LICENSE file in the top-level directory of this distribution * forth in the LICENSE file which can be found at the top level of
* and at http://www.gnu.org/licenses/. * the distribution.
* *
*/ */
@ -30,15 +21,15 @@
#include <sys/select.h> #include <sys/select.h>
#include <unistd.h> #include <unistd.h>
#include "srslte/phy/ch_estimation/chest_dl_nbiot.h" #include "srsran/phy/ch_estimation/chest_dl_nbiot.h"
#include "srslte/phy/channel/ch_awgn.h" #include "srsran/phy/channel/ch_awgn.h"
#include "srslte/phy/io/filesink.h" #include "srsran/phy/io/filesink.h"
#include "srslte/phy/io/filesource.h" #include "srsran/phy/io/filesource.h"
#include "srslte/phy/sync/npss.h" #include "srsran/phy/sync/npss.h"
#include "srslte/phy/sync/nsss.h" #include "srsran/phy/sync/nsss.h"
#include "srslte/phy/ue/ue_dl_nbiot.h" #include "srsran/phy/ue/ue_dl_nbiot.h"
#include "srslte/phy/utils/bit.h" #include "srsran/phy/utils/bit.h"
#include "srslte/phy/utils/random.h" #include "srsran/phy/utils/random.h"
#define UE_CRNTI 0x1234 #define UE_CRNTI 0x1234
@ -50,20 +41,20 @@ static const uint8_t dummy_sib1_payload[] = {0x43, 0x4d, 0xd0, 0x92, 0x22, 0x06,
0x02, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; 0x02, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
#ifndef DISABLE_RF #ifndef DISABLE_RF
#include "srslte/phy/rf/rf.h" #include "srsran/phy/rf/rf.h"
static srslte_rf_t radio; static srsran_rf_t radio;
#else #else
#pragma message "Compiling npdsch_ue with no RF support" #pragma message "Compiling npdsch_ue with no RF support"
#endif #endif
static char* output_file_name = NULL; static char* output_file_name = NULL;
static srslte_nbiot_cell_t cell = { static srsran_nbiot_cell_t cell = {
.base = {.nof_ports = 1, .nof_prb = SRSLTE_NBIOT_DEFAULT_NUM_PRB_BASECELL, .cp = SRSLTE_CP_NORM, .id = 0}, .base = {.nof_ports = 1, .nof_prb = SRSRAN_NBIOT_DEFAULT_NUM_PRB_BASECELL, .cp = SRSRAN_CP_NORM, .id = 0},
.nbiot_prb = SRSLTE_NBIOT_DEFAULT_PRB_OFFSET, .nbiot_prb = SRSRAN_NBIOT_DEFAULT_PRB_OFFSET,
.n_id_ncell = 0, .n_id_ncell = 0,
.nof_ports = 1, .nof_ports = 1,
.mode = SRSLTE_NBIOT_MODE_STANDALONE, .mode = SRSRAN_NBIOT_MODE_STANDALONE,
.is_r14 = true}; .is_r14 = true};
static uint32_t i_tbs_val = 1, last_i_tbs_val = 1; static uint32_t i_tbs_val = 1, last_i_tbs_val = 1;
@ -76,22 +67,22 @@ static float rf_amp = 0.8, rf_gain = 70.0, rf_freq = 0;
static float file_snr = -100.0; static float file_snr = -100.0;
static bool null_file_sink = false; static bool null_file_sink = false;
static srslte_random_t* random_gen; static srsran_random_t* random_gen;
static srslte_filesink_t fsink; static srsran_filesink_t fsink;
static srslte_ofdm_t ifft; static srsran_ofdm_t ifft;
static srslte_npss_synch_t npss_sync; static srsran_npss_synch_t npss_sync;
static srslte_nsss_synch_t nsss_sync; static srsran_nsss_synch_t nsss_sync;
static srslte_npbch_t npbch; static srsran_npbch_t npbch;
static srslte_npdcch_t npdcch; static srsran_npdcch_t npdcch;
static srslte_npdsch_t npdsch; static srsran_npdsch_t npdsch;
static srslte_npdsch_cfg_t sib1_npdsch_cfg; static srsran_npdsch_cfg_t sib1_npdsch_cfg;
static srslte_npdsch_cfg_t npdsch_cfg; static srsran_npdsch_cfg_t npdsch_cfg;
static srslte_nbiot_ue_dl_t ue_dl; static srsran_nbiot_ue_dl_t ue_dl;
static srslte_softbuffer_tx_t softbuffer; static srsran_softbuffer_tx_t softbuffer;
static srslte_ra_nbiot_dl_dci_t ra_dl; static srsran_ra_nbiot_dl_dci_t ra_dl;
static srslte_ra_nbiot_dl_dci_t ra_dl_sib1; static srsran_ra_nbiot_dl_dci_t ra_dl_sib1;
static srslte_chest_dl_nbiot_t ch_est; static srsran_chest_dl_nbiot_t ch_est;
static srslte_mib_nb_t mib_nb; static srsran_mib_nb_t mib_nb;
static uint32_t sched_info_tag = static uint32_t sched_info_tag =
0; // according to Table 16.4.1.3-3 in 36.213, 0 means 4 NPDSCH repetitions with TBS 208 0; // according to Table 16.4.1.3-3 in 36.213, 0 means 4 NPDSCH repetitions with TBS 208
@ -119,7 +110,7 @@ void usage(char* prog)
printf("\t-l n_id_ncell [Default %d]\n", cell.n_id_ncell); printf("\t-l n_id_ncell [Default %d]\n", cell.n_id_ncell);
printf("\t-R Is R14 cell [Default %s]\n", cell.is_r14 ? "Yes" : "No"); printf("\t-R Is R14 cell [Default %s]\n", cell.is_r14 ? "Yes" : "No");
printf("\t-p NB-IoT PRB id [Default %d]\n", cell.nbiot_prb); printf("\t-p NB-IoT PRB id [Default %d]\n", cell.nbiot_prb);
printf("\t-v [set srslte_verbose to debug, default none]\n"); printf("\t-v [set srsran_verbose to debug, default none]\n");
} }
void parse_args(int argc, char** argv) void parse_args(int argc, char** argv)
@ -170,7 +161,7 @@ void parse_args(int argc, char** argv)
cell.nbiot_prb = (uint32_t)strtol(argv[optind], NULL, 10); cell.nbiot_prb = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'v': case 'v':
srslte_verbose++; srsran_verbose++;
break; break;
default: default:
usage(argv[0]); usage(argv[0]);
@ -195,12 +186,12 @@ void parse_args(int argc, char** argv)
void base_init() void base_init()
{ {
// init memory // init memory
sf_buffer = srslte_vec_cf_malloc(sf_n_re); sf_buffer = srsran_vec_cf_malloc(sf_n_re);
if (!sf_buffer) { if (!sf_buffer) {
perror("malloc"); perror("malloc");
exit(-1); exit(-1);
} }
output_buffer = srslte_vec_cf_malloc(sf_n_samples); output_buffer = srsran_vec_cf_malloc(sf_n_samples);
if (!output_buffer) { if (!output_buffer) {
perror("malloc"); perror("malloc");
exit(-1); exit(-1);
@ -208,7 +199,7 @@ void base_init()
// open file or USRP // open file or USRP
if (output_file_name) { if (output_file_name) {
if (strcmp(output_file_name, "NULL")) { if (strcmp(output_file_name, "NULL")) {
if (srslte_filesink_init(&fsink, output_file_name, SRSLTE_COMPLEX_FLOAT_BIN)) { if (srsran_filesink_init(&fsink, output_file_name, SRSRAN_COMPLEX_FLOAT_BIN)) {
fprintf(stderr, "Error opening file %s\n", output_file_name); fprintf(stderr, "Error opening file %s\n", output_file_name);
exit(-1); exit(-1);
} }
@ -219,7 +210,7 @@ void base_init()
} else { } else {
#ifndef DISABLE_RF #ifndef DISABLE_RF
printf("Opening RF device...\n"); printf("Opening RF device...\n");
if (srslte_rf_open(&radio, rf_args)) { if (srsran_rf_open(&radio, rf_args)) {
fprintf(stderr, "Error opening rf\n"); fprintf(stderr, "Error opening rf\n");
exit(-1); exit(-1);
} }
@ -229,72 +220,72 @@ void base_init()
#endif #endif
} }
if (srslte_ofdm_tx_init(&ifft, SRSLTE_CP_NORM, sf_buffer, output_buffer, cell.base.nof_prb)) { if (srsran_ofdm_tx_init(&ifft, SRSRAN_CP_NORM, sf_buffer, output_buffer, cell.base.nof_prb)) {
fprintf(stderr, "Error creating iFFT object\n"); fprintf(stderr, "Error creating iFFT object\n");
exit(-1); exit(-1);
} }
srslte_ofdm_set_normalize(&ifft, true); srsran_ofdm_set_normalize(&ifft, true);
srslte_ofdm_set_freq_shift(&ifft, -SRSLTE_NBIOT_FREQ_SHIFT_FACTOR); srsran_ofdm_set_freq_shift(&ifft, -SRSRAN_NBIOT_FREQ_SHIFT_FACTOR);
if (srslte_npss_synch_init(&npss_sync, sf_n_samples, srslte_symbol_sz(cell.base.nof_prb))) { if (srsran_npss_synch_init(&npss_sync, sf_n_samples, srsran_symbol_sz(cell.base.nof_prb))) {
fprintf(stderr, "Error initializing NPSS object\n"); fprintf(stderr, "Error initializing NPSS object\n");
exit(-1); exit(-1);
} }
if (srslte_nsss_synch_init(&nsss_sync, sf_n_samples, srslte_symbol_sz(cell.base.nof_prb))) { if (srsran_nsss_synch_init(&nsss_sync, sf_n_samples, srsran_symbol_sz(cell.base.nof_prb))) {
fprintf(stderr, "Error initializing NSSS object\n"); fprintf(stderr, "Error initializing NSSS object\n");
exit(-1); exit(-1);
} }
if (srslte_npbch_init(&npbch)) { if (srsran_npbch_init(&npbch)) {
fprintf(stderr, "Error creating NPBCH object\n"); fprintf(stderr, "Error creating NPBCH object\n");
exit(-1); exit(-1);
} }
if (srslte_npbch_set_cell(&npbch, cell)) { if (srsran_npbch_set_cell(&npbch, cell)) {
fprintf(stderr, "Error setting cell in NPBCH object\n"); fprintf(stderr, "Error setting cell in NPBCH object\n");
exit(-1); exit(-1);
} }
if (srslte_npdcch_init(&npdcch)) { if (srsran_npdcch_init(&npdcch)) {
fprintf(stderr, "Error creating NPDCCH object\n"); fprintf(stderr, "Error creating NPDCCH object\n");
exit(-1); exit(-1);
} }
if (srslte_npdcch_set_cell(&npdcch, cell)) { if (srsran_npdcch_set_cell(&npdcch, cell)) {
fprintf(stderr, "Configuring cell in NPDCCH\n"); fprintf(stderr, "Configuring cell in NPDCCH\n");
exit(-1); exit(-1);
} }
if (srslte_npdsch_init(&npdsch)) { if (srsran_npdsch_init(&npdsch)) {
fprintf(stderr, "Error creating NPDSCH object\n"); fprintf(stderr, "Error creating NPDSCH object\n");
exit(-1); exit(-1);
} }
if (srslte_npdsch_set_cell(&npdsch, cell)) { if (srsran_npdsch_set_cell(&npdsch, cell)) {
fprintf(stderr, "Configuring cell in NPDSCH\n"); fprintf(stderr, "Configuring cell in NPDSCH\n");
exit(-1); exit(-1);
} }
srslte_npdsch_set_rnti(&npdsch, UE_CRNTI); srsran_npdsch_set_rnti(&npdsch, UE_CRNTI);
if (srslte_softbuffer_tx_init(&softbuffer, cell.base.nof_prb)) { if (srsran_softbuffer_tx_init(&softbuffer, cell.base.nof_prb)) {
fprintf(stderr, "Error initiating soft buffer\n"); fprintf(stderr, "Error initiating soft buffer\n");
exit(-1); exit(-1);
} }
random_gen = srslte_random_init(time(NULL)); random_gen = srsran_random_init(time(NULL));
} }
void base_free() void base_free()
{ {
srslte_random_free(random_gen); srsran_random_free(random_gen);
srslte_softbuffer_tx_free(&softbuffer); srsran_softbuffer_tx_free(&softbuffer);
srslte_npdsch_free(&npdsch); srsran_npdsch_free(&npdsch);
srslte_npdcch_free(&npdcch); srsran_npdcch_free(&npdcch);
srslte_npbch_free(&npbch); srsran_npbch_free(&npbch);
srslte_chest_dl_nbiot_free(&ch_est); srsran_chest_dl_nbiot_free(&ch_est);
srslte_npss_synch_free(&npss_sync); srsran_npss_synch_free(&npss_sync);
srslte_nsss_synch_free(&nsss_sync); srsran_nsss_synch_free(&nsss_sync);
srslte_ofdm_tx_free(&ifft); srsran_ofdm_tx_free(&ifft);
if (sf_buffer) { if (sf_buffer) {
free(sf_buffer); free(sf_buffer);
@ -304,11 +295,11 @@ void base_free()
} }
if (output_file_name) { if (output_file_name) {
if (!null_file_sink) { if (!null_file_sink) {
srslte_filesink_free(&fsink); srsran_filesink_free(&fsink);
} }
} else { } else {
#ifndef DISABLE_RF #ifndef DISABLE_RF
srslte_rf_close(&radio); srsran_rf_close(&radio);
#endif #endif
} }
} }
@ -326,14 +317,14 @@ void sig_int_handler(int signo)
static int update_radl(void) static int update_radl(void)
{ {
bzero(&ra_dl_sib1, sizeof(srslte_ra_nbiot_dl_dci_t)); bzero(&ra_dl_sib1, sizeof(srsran_ra_nbiot_dl_dci_t));
// NB-IoT specific fields // NB-IoT specific fields
ra_dl_sib1.alloc.has_sib1 = true; ra_dl_sib1.alloc.has_sib1 = true;
ra_dl_sib1.alloc.sched_info_sib1 = mib_nb.sched_info_sib1; ra_dl_sib1.alloc.sched_info_sib1 = mib_nb.sched_info_sib1;
ra_dl_sib1.mcs_idx = 1; ra_dl_sib1.mcs_idx = 1;
bzero(&ra_dl, sizeof(srslte_ra_nbiot_dl_dci_t)); bzero(&ra_dl, sizeof(srsran_ra_nbiot_dl_dci_t));
ra_dl.mcs_idx = i_tbs_val; ra_dl.mcs_idx = i_tbs_val;
// NB-IoT specific fields // NB-IoT specific fields
@ -346,19 +337,19 @@ static int update_radl(void)
ra_dl.alloc.harq_ack = 1; ra_dl.alloc.harq_ack = 1;
ra_dl.alloc.i_n_start = 0; ra_dl.alloc.i_n_start = 0;
srslte_nbiot_dl_dci_fprint(stdout, &ra_dl); srsran_nbiot_dl_dci_fprint(stdout, &ra_dl);
srslte_ra_nbiot_dl_grant_t dummy_grant; srsran_ra_nbiot_dl_grant_t dummy_grant;
srslte_ra_nbits_t dummy_nbits; srsran_ra_nbits_t dummy_nbits;
#define DUMMY_SFIDX 1 #define DUMMY_SFIDX 1
#define DUMMY_SFN 0 #define DUMMY_SFN 0
srslte_ra_nbiot_dl_dci_to_grant(&ra_dl, &dummy_grant, DUMMY_SFN, DUMMY_SFIDX, DUMMY_R_MAX, false, cell.mode); srsran_ra_nbiot_dl_dci_to_grant(&ra_dl, &dummy_grant, DUMMY_SFN, DUMMY_SFIDX, DUMMY_R_MAX, false, cell.mode);
srslte_ra_nbiot_dl_grant_to_nbits(&dummy_grant, cell, 0, &dummy_nbits); srsran_ra_nbiot_dl_grant_to_nbits(&dummy_grant, cell, 0, &dummy_nbits);
srslte_ra_nbiot_dl_grant_fprint(stdout, &dummy_grant); srsran_ra_nbiot_dl_grant_fprint(stdout, &dummy_grant);
printf("Type new MCS index and press Enter: "); printf("Type new MCS index and press Enter: ");
fflush(stdout); fflush(stdout);
return SRSLTE_SUCCESS; return SRSRAN_SUCCESS;
} }
/* Read new MCS from stdin */ /* Read new MCS from stdin */
@ -405,14 +396,14 @@ uint8_t data_tmp[DATA_BUFF_SZ] = {};
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
int nf = 0, sf_idx = 0; int nf = 0, sf_idx = 0;
cf_t npss_signal[SRSLTE_NPSS_TOT_LEN]; cf_t npss_signal[SRSRAN_NPSS_TOT_LEN];
cf_t nsss_signal[SRSLTE_NSSS_LEN * SRSLTE_NSSS_NUM_SEQ]; // for subframe 9 cf_t nsss_signal[SRSRAN_NSSS_LEN * SRSRAN_NSSS_NUM_SEQ]; // for subframe 9
uint8_t bch_payload[SRSLTE_MIB_NB_LEN]; uint8_t bch_payload[SRSRAN_MIB_NB_LEN];
uint8_t sib1_nb_payload[SRSLTE_NPDSCH_MAX_TBS]; uint8_t sib1_nb_payload[SRSRAN_NPDSCH_MAX_TBS];
srslte_dci_msg_t dci_msg; srsran_dci_msg_t dci_msg;
srslte_dci_location_t locations[SRSLTE_NOF_SF_X_FRAME][30]; srsran_dci_location_t locations[SRSRAN_NOF_SF_X_FRAME][30];
uint32_t sfn = 0; uint32_t sfn = 0;
uint32_t hfn = 0; // Hyper frame number is incremented when sfn wraps and is also 10bit wide uint32_t hfn = 0; // Hyper frame number is incremented when sfn wraps and is also 10bit wide
@ -432,60 +423,60 @@ int main(int argc, char** argv)
printf("Target SNR: %.2fdB\n", file_snr); printf("Target SNR: %.2fdB\n", file_snr);
} }
sf_n_re = 2 * SRSLTE_CP_NORM_NSYMB * cell.base.nof_prb * SRSLTE_NRE; sf_n_re = 2 * SRSRAN_CP_NORM_NSYMB * cell.base.nof_prb * SRSRAN_NRE;
sf_n_samples = 2 * SRSLTE_SLOT_LEN(srslte_symbol_sz(cell.base.nof_prb)); sf_n_samples = 2 * SRSRAN_SLOT_LEN(srsran_symbol_sz(cell.base.nof_prb));
/* this *must* be called after setting slot_len_* */ /* this *must* be called after setting slot_len_* */
base_init(); base_init();
// buffer for outputting signal in RE representation (using sf_n_re) // buffer for outputting signal in RE representation (using sf_n_re)
cf_t* sf_re_symbols[SRSLTE_MAX_PORTS] = {NULL, NULL, NULL, NULL}; cf_t* sf_re_symbols[SRSRAN_MAX_PORTS] = {NULL, NULL, NULL, NULL};
sf_re_symbols[0] = sf_buffer; sf_re_symbols[0] = sf_buffer;
// buffer for outputting actual IQ samples (using sf_n_samples) // buffer for outputting actual IQ samples (using sf_n_samples)
cf_t* sf_symbols[SRSLTE_MAX_PORTS] = {NULL, NULL, NULL, NULL}; cf_t* sf_symbols[SRSRAN_MAX_PORTS] = {NULL, NULL, NULL, NULL};
sf_symbols[0] = output_buffer; sf_symbols[0] = output_buffer;
// construct MIB-NB // construct MIB-NB
mib_nb.sched_info_sib1 = sched_info_tag; mib_nb.sched_info_sib1 = sched_info_tag;
mib_nb.sys_info_tag = 0; mib_nb.sys_info_tag = 0;
mib_nb.ac_barring = false; mib_nb.ac_barring = false;
mib_nb.mode = SRSLTE_NBIOT_MODE_STANDALONE; mib_nb.mode = SRSRAN_NBIOT_MODE_STANDALONE;
// Initialize UE DL // Initialize UE DL
if (srslte_nbiot_ue_dl_init(&ue_dl, sf_symbols, SRSLTE_NBIOT_MAX_PRB, SRSLTE_NBIOT_NUM_RX_ANTENNAS)) { if (srsran_nbiot_ue_dl_init(&ue_dl, sf_symbols, SRSRAN_NBIOT_MAX_PRB, SRSRAN_NBIOT_NUM_RX_ANTENNAS)) {
fprintf(stderr, "Error initiating UE downlink processing module\n"); fprintf(stderr, "Error initiating UE downlink processing module\n");
exit(-1); exit(-1);
} }
if (srslte_nbiot_ue_dl_set_cell(&ue_dl, cell)) { if (srsran_nbiot_ue_dl_set_cell(&ue_dl, cell)) {
fprintf(stderr, "Setting cell in UE DL\n"); fprintf(stderr, "Setting cell in UE DL\n");
return -1; return -1;
} }
srslte_nbiot_ue_dl_set_mib(&ue_dl, mib_nb); srsran_nbiot_ue_dl_set_mib(&ue_dl, mib_nb);
/* Generate NPSS/NSSS signals */ /* Generate NPSS/NSSS signals */
srslte_npss_generate(npss_signal); srsran_npss_generate(npss_signal);
srslte_nsss_generate(nsss_signal, cell.n_id_ncell); srsran_nsss_generate(nsss_signal, cell.n_id_ncell);
#ifdef NPSS_DUMP #ifdef NPSS_DUMP
srslte_filesink_t debug_fsink; srsran_filesink_t debug_fsink;
char fname[] = "npss.bin"; char fname[] = "npss.bin";
if (srslte_filesink_init(&debug_fsink, fname, SRSLTE_COMPLEX_FLOAT_BIN)) { if (srsran_filesink_init(&debug_fsink, fname, SRSRAN_COMPLEX_FLOAT_BIN)) {
fprintf(stderr, "Error opening file %s\n", fname); fprintf(stderr, "Error opening file %s\n", fname);
exit(-1); exit(-1);
} }
srslte_filesink_write(&debug_fsink, npss_signal, SRSLTE_NPSS_LEN * 11); srsran_filesink_write(&debug_fsink, npss_signal, SRSRAN_NPSS_LEN * 11);
srslte_filesink_free(&debug_fsink); srsran_filesink_free(&debug_fsink);
#endif #endif
/* Generate CRS+NRS signals */ /* Generate CRS+NRS signals */
if (srslte_chest_dl_nbiot_init(&ch_est, SRSLTE_NBIOT_MAX_PRB)) { if (srsran_chest_dl_nbiot_init(&ch_est, SRSRAN_NBIOT_MAX_PRB)) {
fprintf(stderr, "Error initializing equalizer\n"); fprintf(stderr, "Error initializing equalizer\n");
exit(-1); exit(-1);
} }
if (srslte_chest_dl_nbiot_set_cell(&ch_est, cell) != SRSLTE_SUCCESS) { if (srsran_chest_dl_nbiot_set_cell(&ch_est, cell) != SRSRAN_SUCCESS) {
fprintf(stderr, "Error setting channel estimator's cell configuration\n"); fprintf(stderr, "Error setting channel estimator's cell configuration\n");
return -1; return -1;
} }
@ -498,10 +489,10 @@ int main(int argc, char** argv)
signal(SIGINT, sig_int_handler); signal(SIGINT, sig_int_handler);
if (!output_file_name) { if (!output_file_name) {
int srate = srslte_sampling_freq_hz(cell.base.nof_prb); int srate = srsran_sampling_freq_hz(cell.base.nof_prb);
if (srate != -1) { if (srate != -1) {
printf("Setting sampling rate %.2f MHz\n", (float)srate / 1000000); printf("Setting sampling rate %.2f MHz\n", (float)srate / 1000000);
float srate_rf = srslte_rf_set_tx_srate(&radio, (double)srate); float srate_rf = srsran_rf_set_tx_srate(&radio, (double)srate);
if (srate_rf != srate) { if (srate_rf != srate) {
fprintf(stderr, "Could not set sampling rate\n"); fprintf(stderr, "Could not set sampling rate\n");
exit(-1); exit(-1);
@ -510,9 +501,9 @@ int main(int argc, char** argv)
fprintf(stderr, "Invalid number of PRB %d\n", cell.base.nof_prb); fprintf(stderr, "Invalid number of PRB %d\n", cell.base.nof_prb);
exit(-1); exit(-1);
} }
srslte_rf_set_tx_gain(&radio, rf_gain); srsran_rf_set_tx_gain(&radio, rf_gain);
printf("Set TX gain: %.1f dB\n", srslte_rf_get_tx_gain(&radio)); printf("Set TX gain: %.1f dB\n", srsran_rf_get_tx_gain(&radio));
printf("Set TX freq: %.2f MHz\n", srslte_rf_set_tx_freq(&radio, 0, rf_freq) / 1000000); printf("Set TX freq: %.2f MHz\n", srsran_rf_set_tx_freq(&radio, 0, rf_freq) / 1000000);
} }
#endif #endif
@ -521,7 +512,7 @@ int main(int argc, char** argv)
} }
/* Initiate valid DCI locations */ /* Initiate valid DCI locations */
for (int i = 0; i < SRSLTE_NOF_SF_X_FRAME; i++) { for (int i = 0; i < SRSRAN_NOF_SF_X_FRAME; i++) {
locations[i][0].L = 1; // Agg-level 2, i.e. both NCEEs used locations[i][0].L = 1; // Agg-level 2, i.e. both NCEEs used
locations[i][0].ncce = 0; locations[i][0].ncce = 0;
} }
@ -530,48 +521,48 @@ int main(int argc, char** argv)
bool send_data = false; bool send_data = false;
bool npdsch_active = false; bool npdsch_active = false;
srslte_softbuffer_tx_reset(&softbuffer); srsran_softbuffer_tx_reset(&softbuffer);
bzero(&sib1_npdsch_cfg, sizeof(srslte_npdsch_cfg_t)); bzero(&sib1_npdsch_cfg, sizeof(srsran_npdsch_cfg_t));
bzero(&npdsch_cfg, sizeof(srslte_npdsch_cfg_t)); bzero(&npdsch_cfg, sizeof(srsran_npdsch_cfg_t));
#ifndef DISABLE_RF #ifndef DISABLE_RF
bool start_of_burst = true; bool start_of_burst = true;
#endif #endif
while ((nf < nof_frames || nof_frames == -1) && !go_exit) { while ((nf < nof_frames || nof_frames == -1) && !go_exit) {
for (sf_idx = 0; sf_idx < SRSLTE_NOF_SF_X_FRAME && (nf < nof_frames || nof_frames == -1); sf_idx++) { for (sf_idx = 0; sf_idx < SRSRAN_NOF_SF_X_FRAME && (nf < nof_frames || nof_frames == -1); sf_idx++) {
srslte_vec_cf_zero(sf_buffer, sf_n_re); srsran_vec_cf_zero(sf_buffer, sf_n_re);
// Transmit NPBCH in subframe 0 // Transmit NPBCH in subframe 0
if (sf_idx == 0) { if (sf_idx == 0) {
if ((sfn % SRSLTE_NPBCH_NUM_FRAMES) == 0) { if ((sfn % SRSRAN_NPBCH_NUM_FRAMES) == 0) {
srslte_npbch_mib_pack(hfn, sfn, mib_nb, bch_payload); srsran_npbch_mib_pack(hfn, sfn, mib_nb, bch_payload);
} }
srslte_npbch_put_subframe(&npbch, bch_payload, sf_re_symbols, sfn); srsran_npbch_put_subframe(&npbch, bch_payload, sf_re_symbols, sfn);
if (SRSLTE_VERBOSE_ISDEBUG()) { if (SRSRAN_VERBOSE_ISDEBUG()) {
printf("MIB payload: "); printf("MIB payload: ");
srslte_vec_fprint_hex(stdout, bch_payload, SRSLTE_MIB_NB_LEN); srsran_vec_fprint_hex(stdout, bch_payload, SRSRAN_MIB_NB_LEN);
} }
} }
// Transmit NPSS, NSSS and NRS // Transmit NPSS, NSSS and NRS
if (sf_idx == 5) { if (sf_idx == 5) {
// NPSS at subframe 5 // NPSS at subframe 5
srslte_npss_put_subframe(&npss_sync, npss_signal, sf_buffer, cell.base.nof_prb, cell.nbiot_prb); srsran_npss_put_subframe(&npss_sync, npss_signal, sf_buffer, cell.base.nof_prb, cell.nbiot_prb);
} else if ((sfn % 2 == 0) && sf_idx == 9) { } else if ((sfn % 2 == 0) && sf_idx == 9) {
// NSSS in every even numbered frame at subframe 9 // NSSS in every even numbered frame at subframe 9
srslte_nsss_put_subframe(&nsss_sync, nsss_signal, sf_buffer, sfn, cell.base.nof_prb, cell.nbiot_prb); srsran_nsss_put_subframe(&nsss_sync, nsss_signal, sf_buffer, sfn, cell.base.nof_prb, cell.nbiot_prb);
} else { } else {
// NRS in all other subframes (using CSR signal intentionally) // NRS in all other subframes (using CSR signal intentionally)
// DEBUG("%d.%d: Putting %d NRS pilots", sfn, sf_idx, SRSLTE_REFSIGNAL_NUM_SF(1, cell.nof_ports)); // DEBUG("%d.%d: Putting %d NRS pilots", sfn, sf_idx, SRSRAN_REFSIGNAL_NUM_SF(1, cell.nof_ports));
srslte_refsignal_nrs_put_sf(cell, 0, ch_est.nrs_signal.pilots[0][sf_idx], sf_buffer); srsran_refsignal_nrs_put_sf(cell, 0, ch_est.nrs_signal.pilots[0][sf_idx], sf_buffer);
} }
#if HAVE_NPDSCH #if HAVE_NPDSCH
// only transmit in subframes not used for NPBCH, NPSS or NSSS and only use subframe 4 when there is no SIB1 // only transmit in subframes not used for NPBCH, NPSS or NSSS and only use subframe 4 when there is no SIB1
// transmission // transmission
if (sf_idx != 0 && sf_idx != 5 && (!(sf_idx == 9 && sfn % 2 == 0)) && if (sf_idx != 0 && sf_idx != 5 && (!(sf_idx == 9 && sfn % 2 == 0)) &&
!srslte_nbiot_ue_dl_is_sib1_sf(&ue_dl, sfn, sf_idx)) { !srsran_nbiot_ue_dl_is_sib1_sf(&ue_dl, sfn, sf_idx)) {
send_data = true; send_data = true;
} else { } else {
send_data = false; send_data = false;
@ -584,43 +575,43 @@ int main(int argc, char** argv)
// overwrite Hyper Frame Number (HFN), 8 MSB // overwrite Hyper Frame Number (HFN), 8 MSB
uint8_t unpacked_hfn[4 * 8]; uint8_t unpacked_hfn[4 * 8];
srslte_bit_unpack_vector(sib1_nb_payload, unpacked_hfn, 4 * 8); srsran_bit_unpack_vector(sib1_nb_payload, unpacked_hfn, 4 * 8);
uint8_t* tmp = unpacked_hfn; uint8_t* tmp = unpacked_hfn;
tmp += 12; tmp += 12;
srslte_bit_unpack(hfn >> 2, &tmp, 8); srsran_bit_unpack(hfn >> 2, &tmp, 8);
uint8_t packed_hfn[4]; uint8_t packed_hfn[4];
srslte_bit_pack_vector(unpacked_hfn, packed_hfn, 32); srsran_bit_pack_vector(unpacked_hfn, packed_hfn, 32);
memcpy(sib1_nb_payload, packed_hfn, sizeof(packed_hfn)); memcpy(sib1_nb_payload, packed_hfn, sizeof(packed_hfn));
if (SRSLTE_VERBOSE_ISDEBUG()) { if (SRSRAN_VERBOSE_ISDEBUG()) {
printf("SIB1-NB payload: "); printf("SIB1-NB payload: ");
srslte_vec_fprint_byte(stdout, sib1_nb_payload, sizeof(dummy_sib1_payload)); srsran_vec_fprint_byte(stdout, sib1_nb_payload, sizeof(dummy_sib1_payload));
} }
} }
if (srslte_nbiot_ue_dl_is_sib1_sf(&ue_dl, sfn, sf_idx)) { if (srsran_nbiot_ue_dl_is_sib1_sf(&ue_dl, sfn, sf_idx)) {
INFO("%d.%d: Transmitting SIB1-NB.", sfn, sf_idx); INFO("%d.%d: Transmitting SIB1-NB.", sfn, sf_idx);
assert(send_data == false); assert(send_data == false);
// configure DL grant for SIB1-NB transmission // configure DL grant for SIB1-NB transmission
if (sib1_npdsch_cfg.sf_idx == 0) { if (sib1_npdsch_cfg.sf_idx == 0) {
srslte_ra_nbiot_dl_grant_t grant; srsran_ra_nbiot_dl_grant_t grant;
srslte_ra_nbiot_dl_dci_to_grant(&ra_dl_sib1, &grant, sfn, sf_idx, DUMMY_R_MAX, true, cell.mode); srsran_ra_nbiot_dl_dci_to_grant(&ra_dl_sib1, &grant, sfn, sf_idx, DUMMY_R_MAX, true, cell.mode);
if (srslte_npdsch_cfg(&sib1_npdsch_cfg, cell, &grant, sf_idx)) { if (srsran_npdsch_cfg(&sib1_npdsch_cfg, cell, &grant, sf_idx)) {
fprintf(stderr, "Error configuring NPDSCH\n"); fprintf(stderr, "Error configuring NPDSCH\n");
exit(-1); exit(-1);
} }
} }
// Encode SIB1 content // Encode SIB1 content
if (srslte_npdsch_encode_rnti( if (srsran_npdsch_encode_rnti(
&npdsch, &sib1_npdsch_cfg, &softbuffer, sib1_nb_payload, SRSLTE_SIRNTI, sf_re_symbols)) { &npdsch, &sib1_npdsch_cfg, &softbuffer, sib1_nb_payload, SRSRAN_SIRNTI, sf_re_symbols)) {
fprintf(stderr, "Error encoding NPDSCH\n"); fprintf(stderr, "Error encoding NPDSCH\n");
exit(-1); exit(-1);
} }
if (sib1_npdsch_cfg.sf_idx == sib1_npdsch_cfg.grant.nof_sf) { if (sib1_npdsch_cfg.sf_idx == sib1_npdsch_cfg.grant.nof_sf) {
bzero(&sib1_npdsch_cfg, sizeof(srslte_npdsch_cfg_t)); bzero(&sib1_npdsch_cfg, sizeof(srsran_npdsch_cfg_t));
} }
} }
@ -634,16 +625,16 @@ int main(int argc, char** argv)
if (sf_idx == NPDCCH_SF_IDX && !npdsch_active) { if (sf_idx == NPDCCH_SF_IDX && !npdsch_active) {
// Encode NPDCCH // Encode NPDCCH
INFO("Putting DCI to location: n=%d, L=%d", locations[sf_idx][0].ncce, locations[sf_idx][0].L); INFO("Putting DCI to location: n=%d, L=%d", locations[sf_idx][0].ncce, locations[sf_idx][0].L);
srslte_dci_msg_pack_npdsch(&ra_dl, SRSLTE_DCI_FORMATN1, &dci_msg, false); srsran_dci_msg_pack_npdsch(&ra_dl, SRSRAN_DCI_FORMATN1, &dci_msg, false);
if (srslte_npdcch_encode(&npdcch, &dci_msg, locations[sf_idx][0], UE_CRNTI, sf_re_symbols, sf_idx)) { if (srsran_npdcch_encode(&npdcch, &dci_msg, locations[sf_idx][0], UE_CRNTI, sf_re_symbols, sf_idx)) {
fprintf(stderr, "Error encoding DCI message\n"); fprintf(stderr, "Error encoding DCI message\n");
exit(-1); exit(-1);
} }
// Configure NPDSCH accordingly // Configure NPDSCH accordingly
srslte_ra_nbiot_dl_grant_t grant; srsran_ra_nbiot_dl_grant_t grant;
srslte_ra_nbiot_dl_dci_to_grant(&ra_dl, &grant, sfn, sf_idx, DUMMY_R_MAX, false, cell.mode); srsran_ra_nbiot_dl_dci_to_grant(&ra_dl, &grant, sfn, sf_idx, DUMMY_R_MAX, false, cell.mode);
if (srslte_npdsch_cfg(&npdsch_cfg, cell, &grant, sf_idx)) { if (srsran_npdsch_cfg(&npdsch_cfg, cell, &grant, sf_idx)) {
fprintf(stderr, "Error configuring NPDSCH\n"); fprintf(stderr, "Error configuring NPDSCH\n");
exit(-1); exit(-1);
} }
@ -654,11 +645,11 @@ int main(int argc, char** argv)
// generate data only in first sf // generate data only in first sf
INFO("%d.%d: Generating %d random bits", sfn, sf_idx, npdsch_cfg.grant.mcs[0].tbs); INFO("%d.%d: Generating %d random bits", sfn, sf_idx, npdsch_cfg.grant.mcs[0].tbs);
for (int i = 0; i < npdsch_cfg.grant.mcs[0].tbs / 8; i++) { for (int i = 0; i < npdsch_cfg.grant.mcs[0].tbs / 8; i++) {
data[i] = srslte_random_uniform_int_dist(random_gen, 0, 255); data[i] = srsran_random_uniform_int_dist(random_gen, 0, 255);
} }
if (SRSLTE_VERBOSE_ISDEBUG()) { if (SRSRAN_VERBOSE_ISDEBUG()) {
printf("Tx payload: "); printf("Tx payload: ");
srslte_vec_fprint_b(stdout, data, npdsch_cfg.grant.mcs[0].tbs / 8); srsran_vec_fprint_b(stdout, data, npdsch_cfg.grant.mcs[0].tbs / 8);
} }
npdsch_active = true; npdsch_active = true;
} }
@ -670,7 +661,7 @@ int main(int argc, char** argv)
npdsch_cfg.grant.start_sfidx, npdsch_cfg.grant.start_sfidx,
npdsch_cfg.grant.nof_sf); npdsch_cfg.grant.nof_sf);
// Encode NPDSCH // Encode NPDSCH
if (srslte_npdsch_encode(&npdsch, &npdsch_cfg, &softbuffer, data, sf_re_symbols)) { if (srsran_npdsch_encode(&npdsch, &npdsch_cfg, &softbuffer, data, sf_re_symbols)) {
fprintf(stderr, "Error encoding NPDSCH\n"); fprintf(stderr, "Error encoding NPDSCH\n");
exit(-1); exit(-1);
} }
@ -683,32 +674,32 @@ int main(int argc, char** argv)
#endif #endif
/* Transform to OFDM symbols */ /* Transform to OFDM symbols */
srslte_ofdm_tx_sf(&ifft); srsran_ofdm_tx_sf(&ifft);
if (output_file_name && file_snr != -100.0) { if (output_file_name && file_snr != -100.0) {
// compute average energy per symbol // compute average energy per symbol
float abs_avg = srslte_vec_avg_power_cf(output_buffer, sf_n_samples); float abs_avg = srsran_vec_avg_power_cf(output_buffer, sf_n_samples);
// find the noise spectral density // find the noise spectral density
float snr_lin = srslte_convert_dB_to_power(file_snr); float snr_lin = srsran_convert_dB_to_power(file_snr);
float n0 = abs_avg / snr_lin; float n0 = abs_avg / snr_lin;
float nstd = sqrtf(n0 / 2); float nstd = sqrtf(n0 / 2);
// add some noise to the signal // add some noise to the signal
srslte_ch_awgn_c(output_buffer, output_buffer, nstd, sf_n_samples); srsran_ch_awgn_c(output_buffer, output_buffer, nstd, sf_n_samples);
} }
/* send to file or usrp */ /* send to file or usrp */
if (output_file_name) { if (output_file_name) {
// write to file // write to file
if (!null_file_sink) { if (!null_file_sink) {
srslte_filesink_write(&fsink, output_buffer, sf_n_samples); srsran_filesink_write(&fsink, output_buffer, sf_n_samples);
} }
usleep(1000); usleep(1000);
} else { } else {
#ifndef DISABLE_RF #ifndef DISABLE_RF
// TODO: output scaling needed? // TODO: output scaling needed?
srslte_rf_send2(&radio, output_buffer, sf_n_samples, true, start_of_burst, false); srsran_rf_send2(&radio, output_buffer, sf_n_samples, true, start_of_burst, false);
start_of_burst = false; start_of_burst = false;
#endif #endif
} }
@ -726,5 +717,5 @@ int main(int argc, char** argv)
printf("Done\n"); printf("Done\n");
return SRSLTE_SUCCESS; return SRSRAN_SUCCESS;
} }

@ -1,21 +1,12 @@
/** /**
* Copyright 2013-2021 Software Radio Systems Limited
*
* This file is part of srsLTE.
* *
* srsLTE is free software: you can redistribute it and/or modify * \section COPYRIGHT
* 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, * Copyright 2013-2021 Software Radio Systems Limited
* 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 * By using this file, you agree to the terms and conditions set
* the LICENSE file in the top-level directory of this distribution * forth in the LICENSE file which can be found at the top level of
* and at http://www.gnu.org/licenses/. * the distribution.
* *
*/ */
@ -32,31 +23,31 @@
#include <unistd.h> #include <unistd.h>
#include "npdsch_ue_helper.h" #include "npdsch_ue_helper.h"
#include "srslte/phy/ch_estimation/chest_dl_nbiot.h" #include "srsran/phy/ch_estimation/chest_dl_nbiot.h"
#include "srslte/phy/channel/ch_awgn.h" #include "srsran/phy/channel/ch_awgn.h"
#include "srslte/phy/io/filesink.h" #include "srsran/phy/io/filesink.h"
#include "srslte/phy/io/filesource.h" #include "srsran/phy/io/filesource.h"
#include "srslte/phy/ue/ue_dl_nbiot.h" #include "srsran/phy/ue/ue_dl_nbiot.h"
#include "srslte/phy/ue/ue_mib_nbiot.h" #include "srsran/phy/ue/ue_mib_nbiot.h"
#include "srslte/phy/ue/ue_sync_nbiot.h" #include "srsran/phy/ue/ue_sync_nbiot.h"
#include "srslte/phy/utils/bit.h" #include "srsran/phy/utils/bit.h"
#undef ENABLE_AGC_DEFAULT #undef ENABLE_AGC_DEFAULT
#ifndef DISABLE_RF #ifndef DISABLE_RF
#include "srslte/phy/rf/rf.h" #include "srsran/phy/rf/rf.h"
#include "srslte/phy/rf/rf_utils.h" #include "srsran/phy/rf/rf_utils.h"
#define ENABLE_MANUAL_NSSS_SEARCH 0 #define ENABLE_MANUAL_NSSS_SEARCH 0
#define HAVE_PCAP 1 #define HAVE_PCAP 1
#if HAVE_PCAP #if HAVE_PCAP
#include "srslte/common/pcap.h" #include "srsran/common/pcap.h"
#endif #endif
cell_search_cfg_t cell_detect_config = {.max_frames_pbch = SRSLTE_DEFAULT_MAX_FRAMES_NPBCH, cell_search_cfg_t cell_detect_config = {.max_frames_pbch = SRSRAN_DEFAULT_MAX_FRAMES_NPBCH,
.max_frames_pss = SRSLTE_DEFAULT_MAX_FRAMES_NPSS, .max_frames_pss = SRSRAN_DEFAULT_MAX_FRAMES_NPSS,
.nof_valid_pss_frames = SRSLTE_DEFAULT_NOF_VALID_NPSS_FRAMES, .nof_valid_pss_frames = SRSRAN_DEFAULT_NOF_VALID_NPSS_FRAMES,
.init_agc = 0, .init_agc = 0,
.force_tdd = false}; .force_tdd = false};
@ -78,7 +69,7 @@ bool plot_track = true;
#define NPSS_FIND_PLOT_WIDTH 80 #define NPSS_FIND_PLOT_WIDTH 80
//#define CORRECT_SAMPLE_OFFSET //#define CORRECT_SAMPLE_OFFSET
static srslte_nbiot_si_params_t sib2_params; static srsran_nbiot_si_params_t sib2_params;
/********************************************************************** /**********************************************************************
* Program arguments processing * Program arguments processing
@ -110,8 +101,8 @@ void args_default(prog_args_t* args)
args->disable_plots = false; args->disable_plots = false;
args->disable_plots_except_constellation = false; args->disable_plots_except_constellation = false;
args->nof_subframes = -1; args->nof_subframes = -1;
args->rnti = SRSLTE_SIRNTI; args->rnti = SRSRAN_SIRNTI;
args->n_id_ncell = SRSLTE_CELL_ID_UNKNOWN; args->n_id_ncell = SRSRAN_CELL_ID_UNKNOWN;
args->is_r14 = true; args->is_r14 = true;
args->input_file_name = NULL; args->input_file_name = NULL;
args->disable_cfo = false; args->disable_cfo = false;
@ -164,7 +155,7 @@ void usage(prog_args_t* args, char* prog)
printf("\t plots are disabled. Graphics library not available\n"); printf("\t plots are disabled. Graphics library not available\n");
#endif // ENABLE_GUI #endif // ENABLE_GUI
printf("\t-n nof_subframes [Default %d]\n", args->nof_subframes); printf("\t-n nof_subframes [Default %d]\n", args->nof_subframes);
printf("\t-v [set srslte_verbose to debug, default none]\n"); printf("\t-v [set srsran_verbose to debug, default none]\n");
} }
void parse_args(prog_args_t* args, int argc, char** argv) void parse_args(prog_args_t* args, int argc, char** argv)
@ -228,7 +219,7 @@ void parse_args(prog_args_t* args, int argc, char** argv)
args->disable_plots_except_constellation = true; args->disable_plots_except_constellation = true;
break; break;
case 'v': case 'v':
srslte_verbose++; srsran_verbose++;
break; break;
default: default:
usage(args, argv[0]); usage(args, argv[0]);
@ -242,7 +233,7 @@ void parse_args(prog_args_t* args, int argc, char** argv)
} }
/**********************************************************************/ /**********************************************************************/
static uint8_t rx_tb[SRSLTE_MAX_DL_BITS_CAT_NB1]; // Byte buffer for rx'ed transport blocks static uint8_t rx_tb[SRSRAN_MAX_DL_BITS_CAT_NB1]; // Byte buffer for rx'ed transport blocks
bool go_exit = false; bool go_exit = false;
void sig_int_handler(int signo) void sig_int_handler(int signo)
@ -271,8 +262,8 @@ void pcap_pack_and_write(FILE* pcap_file,
.ueid = 1, .ueid = 1,
.isRetx = reTX, .isRetx = reTX,
.crcStatusOK = crc_ok, .crcStatusOK = crc_ok,
.sysFrameNumber = (uint16_t)(tti / SRSLTE_NOF_SF_X_FRAME), .sysFrameNumber = (uint16_t)(tti / SRSRAN_NOF_SF_X_FRAME),
.subFrameNumber = (uint16_t)(tti % SRSLTE_NOF_SF_X_FRAME), .subFrameNumber = (uint16_t)(tti % SRSRAN_NOF_SF_X_FRAME),
.nbiotMode = 1}; .nbiotMode = 1};
if (pdu) { if (pdu) {
LTE_PCAP_MAC_WritePDU(pcap_file, &context, pdu, pdu_len_bytes); LTE_PCAP_MAC_WritePDU(pcap_file, &context, pdu, pdu_len_bytes);
@ -281,25 +272,25 @@ void pcap_pack_and_write(FILE* pcap_file,
#endif #endif
#ifndef DISABLE_RF #ifndef DISABLE_RF
int srslte_rf_recv_wrapper(void* h, void* data, uint32_t nsamples, srslte_timestamp_t* t) int srsran_rf_recv_wrapper(void* h, void* data, uint32_t nsamples, srsran_timestamp_t* t)
{ {
DEBUG(" ---- Receive %d samples ----", nsamples); DEBUG(" ---- Receive %d samples ----", nsamples);
return srslte_rf_recv_with_time(h, data, nsamples, true, &t->full_secs, &t->frac_secs); return srsran_rf_recv_with_time(h, data, nsamples, true, &t->full_secs, &t->frac_secs);
} }
void srslte_rf_set_rx_gain_th_wrapper_(void* h, float f) void srsran_rf_set_rx_gain_th_wrapper_(void* h, float f)
{ {
srslte_rf_set_rx_gain_th((srslte_rf_t*)h, f); srsran_rf_set_rx_gain_th((srsran_rf_t*)h, f);
} }
#endif #endif
enum receiver_state { DECODE_MIB, DECODE_SIB, DECODE_NPDSCH } state; enum receiver_state { DECODE_MIB, DECODE_SIB, DECODE_NPDSCH } state;
static srslte_nbiot_cell_t cell = {}; static srsran_nbiot_cell_t cell = {};
srslte_nbiot_ue_dl_t ue_dl; srsran_nbiot_ue_dl_t ue_dl;
srslte_nbiot_ue_sync_t ue_sync; srsran_nbiot_ue_sync_t ue_sync;
prog_args_t prog_args; prog_args_t prog_args;
bool have_sib1 = false; bool have_sib1 = false;
@ -326,13 +317,13 @@ int main(int argc, char** argv)
{ {
int ret; int ret;
int64_t sf_cnt; int64_t sf_cnt;
srslte_ue_mib_nbiot_t ue_mib; srsran_ue_mib_nbiot_t ue_mib;
#ifndef DISABLE_RF #ifndef DISABLE_RF
srslte_rf_t rf; srsran_rf_t rf;
#endif #endif
uint32_t nof_trials = 0; uint32_t nof_trials = 0;
int n; int n;
uint8_t bch_payload[SRSLTE_MIB_NB_LEN] = {}; uint8_t bch_payload[SRSRAN_MIB_NB_LEN] = {};
int sfn_offset; int sfn_offset;
float cfo = 0; float cfo = 0;
@ -348,40 +339,40 @@ int main(int argc, char** argv)
sigprocmask(SIG_UNBLOCK, &sigset, NULL); sigprocmask(SIG_UNBLOCK, &sigset, NULL);
signal(SIGINT, sig_int_handler); signal(SIGINT, sig_int_handler);
cell.base.nof_prb = SRSLTE_NBIOT_DEFAULT_NUM_PRB_BASECELL; cell.base.nof_prb = SRSRAN_NBIOT_DEFAULT_NUM_PRB_BASECELL;
cell.nbiot_prb = SRSLTE_NBIOT_DEFAULT_PRB_OFFSET; cell.nbiot_prb = SRSRAN_NBIOT_DEFAULT_PRB_OFFSET;
cell.n_id_ncell = prog_args.n_id_ncell; cell.n_id_ncell = prog_args.n_id_ncell;
cell.is_r14 = prog_args.is_r14; cell.is_r14 = prog_args.is_r14;
#ifndef DISABLE_RF #ifndef DISABLE_RF
if (!prog_args.input_file_name) { if (!prog_args.input_file_name) {
printf("Opening RF device...\n"); printf("Opening RF device...\n");
if (srslte_rf_open_devname(&rf, prog_args.rf_dev, prog_args.rf_args, 1)) { if (srsran_rf_open_devname(&rf, prog_args.rf_dev, prog_args.rf_args, 1)) {
fprintf(stderr, "Error opening rf\n"); fprintf(stderr, "Error opening rf\n");
exit(-1); exit(-1);
} }
/* Set receiver gain */ /* Set receiver gain */
if (prog_args.rf_gain > 0) { if (prog_args.rf_gain > 0) {
srslte_rf_set_rx_gain(&rf, prog_args.rf_gain); srsran_rf_set_rx_gain(&rf, prog_args.rf_gain);
printf("Set RX gain: %.1f dB\n", prog_args.rf_gain); printf("Set RX gain: %.1f dB\n", prog_args.rf_gain);
} else { } else {
printf("Starting AGC thread...\n"); printf("Starting AGC thread...\n");
if (srslte_rf_start_gain_thread(&rf, false)) { if (srsran_rf_start_gain_thread(&rf, false)) {
fprintf(stderr, "Error opening rf\n"); fprintf(stderr, "Error opening rf\n");
exit(-1); exit(-1);
} }
srslte_rf_set_rx_gain(&rf, 50); srsran_rf_set_rx_gain(&rf, 50);
cell_detect_config.init_agc = 50; cell_detect_config.init_agc = 50;
} }
// set transceiver frequency // set transceiver frequency
printf("Set RX freq: %.6f MHz\n", srslte_rf_set_rx_freq(&rf, 0, prog_args.rf_freq) / 1000000); printf("Set RX freq: %.6f MHz\n", srsran_rf_set_rx_freq(&rf, 0, prog_args.rf_freq) / 1000000);
// set sampling frequency // set sampling frequency
int srate = srslte_sampling_freq_hz(cell.base.nof_prb); int srate = srsran_sampling_freq_hz(cell.base.nof_prb);
if (srate != -1) { if (srate != -1) {
printf("Setting sampling rate %.2f MHz\n", (float)srate / 1e6); printf("Setting sampling rate %.2f MHz\n", (float)srate / 1e6);
double srate_rf = srslte_rf_set_rx_srate(&rf, srate); double srate_rf = srsran_rf_set_rx_srate(&rf, srate);
printf("Actual sampling rate %.2f MHz\n", srate_rf / 1e6); printf("Actual sampling rate %.2f MHz\n", srate_rf / 1e6);
// We don't check the result rate with requested rate // We don't check the result rate with requested rate
} else { } else {
@ -390,55 +381,55 @@ int main(int argc, char** argv)
} }
INFO("Stopping RF and flushing buffer...\r"); INFO("Stopping RF and flushing buffer...\r");
srslte_rf_stop_rx_stream(&rf); srsran_rf_stop_rx_stream(&rf);
#if ENABLE_MANUAL_NSSS_SEARCH #if ENABLE_MANUAL_NSSS_SEARCH
// determine n_id_ncell // determine n_id_ncell
if (prog_args.n_id_ncell == SRSLTE_CELL_ID_UNKNOWN) { if (prog_args.n_id_ncell == SRSRAN_CELL_ID_UNKNOWN) {
srslte_nsss_synch_t nsss; srsran_nsss_synch_t nsss;
float nsss_peak_value; float nsss_peak_value;
int input_len = srate * 10 / 1000 * 2; // capture two full frames to make sure we have one NSSS int input_len = srate * 10 / 1000 * 2; // capture two full frames to make sure we have one NSSS
cf_t* buffer = srslte_vec_cf_malloc(input_len * 2); cf_t* buffer = srsran_vec_cf_malloc(input_len * 2);
if (!buffer) { if (!buffer) {
perror("malloc"); perror("malloc");
exit(-1); exit(-1);
} }
if (srslte_nsss_synch_init(&nsss, input_len, srate / 15000)) { if (srsran_nsss_synch_init(&nsss, input_len, srate / 15000)) {
fprintf(stderr, "Error initializing NSSS object\n"); fprintf(stderr, "Error initializing NSSS object\n");
exit(-1); exit(-1);
} }
srslte_rf_start_rx_stream(&rf, false); srsran_rf_start_rx_stream(&rf, false);
n = srslte_rf_recv(&rf, buffer, input_len, 1); n = srsran_rf_recv(&rf, buffer, input_len, 1);
if (n != input_len) { if (n != input_len) {
fprintf(stderr, "Error receiving samples\n"); fprintf(stderr, "Error receiving samples\n");
exit(-1); exit(-1);
} }
srslte_rf_stop_rx_stream(&rf); srsran_rf_stop_rx_stream(&rf);
// trying to find NSSS // trying to find NSSS
printf("Detecting NSSS signal .. "); printf("Detecting NSSS signal .. ");
fflush(stdout); fflush(stdout);
uint32_t sfn_partial; uint32_t sfn_partial;
srslte_nsss_sync_find(&nsss, buffer, &nsss_peak_value, (uint32_t*)&cell.n_id_ncell, &sfn_partial); srsran_nsss_sync_find(&nsss, buffer, &nsss_peak_value, (uint32_t*)&cell.n_id_ncell, &sfn_partial);
printf("done!"); printf("done!");
srslte_nsss_synch_free(&nsss); srsran_nsss_synch_free(&nsss);
free(buffer); free(buffer);
} else { } else {
cell.n_id_ncell = prog_args.n_id_ncell; cell.n_id_ncell = prog_args.n_id_ncell;
} }
printf("\nSetting n_id_ncell to %d.\n", cell.n_id_ncell); printf("\nSetting n_id_ncell to %d.\n", cell.n_id_ncell);
#else #else
if (cell.n_id_ncell == SRSLTE_CELL_ID_UNKNOWN) { if (cell.n_id_ncell == SRSRAN_CELL_ID_UNKNOWN) {
uint32_t ntrial = 0; uint32_t ntrial = 0;
do { do {
ret = rf_cell_search_nbiot(&rf, &cell_detect_config, &cell, &cfo); ret = rf_cell_search_nbiot(&rf, &cell_detect_config, &cell, &cfo);
if (ret != SRSLTE_SUCCESS) { if (ret != SRSRAN_SUCCESS) {
printf("Cell not found after %d trials. Trying again (Press Ctrl+C to exit)\n", ntrial++); printf("Cell not found after %d trials. Trying again (Press Ctrl+C to exit)\n", ntrial++);
} }
} while (ret != SRSLTE_SUCCESS && !go_exit); } while (ret != SRSRAN_SUCCESS && !go_exit);
} }
#endif #endif
@ -454,31 +445,31 @@ int main(int argc, char** argv)
cell.base.nof_ports = prog_args.file_nof_ports; cell.base.nof_ports = prog_args.file_nof_ports;
cell.nof_ports = prog_args.file_nof_ports; cell.nof_ports = prog_args.file_nof_ports;
if (srslte_ue_sync_nbiot_init_file( if (srsran_ue_sync_nbiot_init_file(
&ue_sync, cell, prog_args.input_file_name, prog_args.file_offset_time, prog_args.file_offset_freq)) { &ue_sync, cell, prog_args.input_file_name, prog_args.file_offset_time, prog_args.file_offset_freq)) {
fprintf(stderr, "Error initiating ue_sync\n"); fprintf(stderr, "Error initiating ue_sync\n");
exit(-1); exit(-1);
} }
} else { } else {
#ifndef DISABLE_RF #ifndef DISABLE_RF
if (srslte_ue_sync_nbiot_init(&ue_sync, cell, srslte_rf_recv_wrapper, (void*)&rf)) { if (srsran_ue_sync_nbiot_init(&ue_sync, cell, srsran_rf_recv_wrapper, (void*)&rf)) {
fprintf(stderr, "Error initiating ue_sync\n"); fprintf(stderr, "Error initiating ue_sync\n");
exit(-1); exit(-1);
} }
// reduce AGC period to every 10th frame // reduce AGC period to every 10th frame
srslte_ue_sync_nbiot_set_agc_period(&ue_sync, 10); srsran_ue_sync_nbiot_set_agc_period(&ue_sync, 10);
#endif #endif
} }
// Allocate memory to fit a full frame (needed for time re-alignment) // Allocate memory to fit a full frame (needed for time re-alignment)
cf_t* buff_ptrs[SRSLTE_MAX_PORTS] = {NULL}; cf_t* buff_ptrs[SRSRAN_MAX_PORTS] = {NULL};
buff_ptrs[0] = srslte_vec_cf_malloc(SRSLTE_SF_LEN_PRB_NBIOT * 10); buff_ptrs[0] = srsran_vec_cf_malloc(SRSRAN_SF_LEN_PRB_NBIOT * 10);
if (srslte_ue_mib_nbiot_init(&ue_mib, buff_ptrs, SRSLTE_NBIOT_MAX_PRB)) { if (srsran_ue_mib_nbiot_init(&ue_mib, buff_ptrs, SRSRAN_NBIOT_MAX_PRB)) {
fprintf(stderr, "Error initaiting UE MIB decoder\n"); fprintf(stderr, "Error initaiting UE MIB decoder\n");
exit(-1); exit(-1);
} }
if (srslte_ue_mib_nbiot_set_cell(&ue_mib, cell) != SRSLTE_SUCCESS) { if (srsran_ue_mib_nbiot_set_cell(&ue_mib, cell) != SRSRAN_SUCCESS) {
fprintf(stderr, "Error setting cell configuration in UE MIB decoder\n"); fprintf(stderr, "Error setting cell configuration in UE MIB decoder\n");
exit(-1); exit(-1);
} }
@ -494,7 +485,7 @@ int main(int argc, char** argv)
#ifndef DISABLE_RF #ifndef DISABLE_RF
if (!prog_args.input_file_name) { if (!prog_args.input_file_name) {
srslte_rf_start_rx_stream(&rf, false); srsran_rf_start_rx_stream(&rf, false);
} }
#endif #endif
@ -504,48 +495,48 @@ int main(int argc, char** argv)
#ifndef DISABLE_RF #ifndef DISABLE_RF
if (prog_args.rf_gain < 0) { if (prog_args.rf_gain < 0) {
srslte_ue_sync_nbiot_start_agc(&ue_sync, srslte_rf_set_rx_gain_th_wrapper_, cell_detect_config.init_agc); srsran_ue_sync_nbiot_start_agc(&ue_sync, srsran_rf_set_rx_gain_th_wrapper_, cell_detect_config.init_agc);
} }
#endif #endif
#ifdef PRINT_CHANGE_SCHEDULIGN #ifdef PRINT_CHANGE_SCHEDULIGN
srslte_ra_nbiot_dl_dci_t old_dl_dci; srsran_ra_nbiot_dl_dci_t old_dl_dci;
bzero(&old_dl_dci, sizeof(srslte_ra_nbiot_dl_dci_t)); bzero(&old_dl_dci, sizeof(srsran_ra_nbiot_dl_dci_t));
#endif #endif
ue_sync.correct_cfo = !prog_args.disable_cfo; ue_sync.correct_cfo = !prog_args.disable_cfo;
// Set initial CFO for ue_sync // Set initial CFO for ue_sync
srslte_ue_sync_nbiot_set_cfo(&ue_sync, cfo); srsran_ue_sync_nbiot_set_cfo(&ue_sync, cfo);
srslte_npbch_decode_reset(&ue_mib.npbch); srsran_npbch_decode_reset(&ue_mib.npbch);
INFO("\nEntering main loop..."); INFO("\nEntering main loop...");
while (!go_exit && (sf_cnt < prog_args.nof_subframes || prog_args.nof_subframes == -1)) { while (!go_exit && (sf_cnt < prog_args.nof_subframes || prog_args.nof_subframes == -1)) {
ret = srslte_ue_sync_nbiot_zerocopy_multi(&ue_sync, buff_ptrs); ret = srsran_ue_sync_nbiot_zerocopy_multi(&ue_sync, buff_ptrs);
if (ret < 0) { if (ret < 0) {
fprintf(stderr, "Error calling srslte_nbiot_ue_sync_zerocopy_multi()\n"); fprintf(stderr, "Error calling srsran_nbiot_ue_sync_zerocopy_multi()\n");
break; break;
} }
#ifdef CORRECT_SAMPLE_OFFSET #ifdef CORRECT_SAMPLE_OFFSET
float sample_offset = float sample_offset =
(float)srslte_ue_sync_get_last_sample_offset(&ue_sync) + srslte_ue_sync_get_sfo(&ue_sync) / 1000; (float)srsran_ue_sync_get_last_sample_offset(&ue_sync) + srsran_ue_sync_get_sfo(&ue_sync) / 1000;
srslte_ue_dl_set_sample_offset(&ue_dl, sample_offset); srsran_ue_dl_set_sample_offset(&ue_dl, sample_offset);
#endif #endif
// srslte_ue_sync_nbiot_zerocopy_multi() returns 1 if successfully read 1 aligned subframe // srsran_ue_sync_nbiot_zerocopy_multi() returns 1 if successfully read 1 aligned subframe
if (ret == 1) { if (ret == 1) {
switch (state) { switch (state) {
case DECODE_MIB: case DECODE_MIB:
if (srslte_ue_sync_nbiot_get_sfidx(&ue_sync) == 0) { if (srsran_ue_sync_nbiot_get_sfidx(&ue_sync) == 0) {
n = srslte_ue_mib_nbiot_decode(&ue_mib, buff_ptrs[0], bch_payload, &cell.nof_ports, &sfn_offset); n = srsran_ue_mib_nbiot_decode(&ue_mib, buff_ptrs[0], bch_payload, &cell.nof_ports, &sfn_offset);
if (n < 0) { if (n < 0) {
fprintf(stderr, "Error decoding UE MIB\n"); fprintf(stderr, "Error decoding UE MIB\n");
exit(-1); exit(-1);
} else if (n == SRSLTE_UE_MIB_NBIOT_FOUND) { } else if (n == SRSRAN_UE_MIB_NBIOT_FOUND) {
printf("MIB received (CFO: %+6.2f kHz)\n", srslte_ue_sync_nbiot_get_cfo(&ue_sync) / 1000); printf("MIB received (CFO: %+6.2f kHz)\n", srsran_ue_sync_nbiot_get_cfo(&ue_sync) / 1000);
srslte_mib_nb_t mib; srsran_mib_nb_t mib;
srslte_npbch_mib_unpack(bch_payload, &mib); srsran_npbch_mib_unpack(bch_payload, &mib);
// update SFN and set deployment mode // update SFN and set deployment mode
system_frame_number = (mib.sfn + sfn_offset) % 1024; system_frame_number = (mib.sfn + sfn_offset) % 1024;
@ -554,34 +545,34 @@ int main(int argc, char** argv)
// set number of ports of base cell to that of NB-IoT cell (FIXME: read eutra-NumCRS-Ports-r13) // set number of ports of base cell to that of NB-IoT cell (FIXME: read eutra-NumCRS-Ports-r13)
cell.base.nof_ports = cell.nof_ports; cell.base.nof_ports = cell.nof_ports;
if (cell.mode == SRSLTE_NBIOT_MODE_INBAND_SAME_PCI) { if (cell.mode == SRSRAN_NBIOT_MODE_INBAND_SAME_PCI) {
cell.base.id = cell.n_id_ncell; cell.base.id = cell.n_id_ncell;
} }
if (SRSLTE_VERBOSE_ISINFO()) { if (SRSRAN_VERBOSE_ISINFO()) {
srslte_mib_nb_printf(stdout, cell, &mib); srsran_mib_nb_printf(stdout, cell, &mib);
} }
// Initialize DL // Initialize DL
if (srslte_nbiot_ue_dl_init(&ue_dl, buff_ptrs, SRSLTE_NBIOT_MAX_PRB, SRSLTE_NBIOT_NUM_RX_ANTENNAS)) { if (srsran_nbiot_ue_dl_init(&ue_dl, buff_ptrs, SRSRAN_NBIOT_MAX_PRB, SRSRAN_NBIOT_NUM_RX_ANTENNAS)) {
fprintf(stderr, "Error initiating UE downlink processing module\n"); fprintf(stderr, "Error initiating UE downlink processing module\n");
exit(-1); exit(-1);
} }
if (srslte_nbiot_ue_dl_set_cell(&ue_dl, cell)) { if (srsran_nbiot_ue_dl_set_cell(&ue_dl, cell)) {
fprintf(stderr, "Configuring cell in UE DL\n"); fprintf(stderr, "Configuring cell in UE DL\n");
exit(-1); exit(-1);
} }
// Configure downlink receiver with the MIB params and the RNTI we use // Configure downlink receiver with the MIB params and the RNTI we use
srslte_nbiot_ue_dl_set_mib(&ue_dl, mib); srsran_nbiot_ue_dl_set_mib(&ue_dl, mib);
srslte_nbiot_ue_dl_set_rnti(&ue_dl, prog_args.rnti); srsran_nbiot_ue_dl_set_rnti(&ue_dl, prog_args.rnti);
// Pretty-print MIB // Pretty-print MIB
srslte_bit_pack_vector(bch_payload, rx_tb, SRSLTE_MIB_NB_CRC_LEN); srsran_bit_pack_vector(bch_payload, rx_tb, SRSRAN_MIB_NB_CRC_LEN);
#ifdef ENABLE_GUI #ifdef ENABLE_GUI
if (bcch_bch_to_pretty_string( if (bcch_bch_to_pretty_string(
rx_tb, SRSLTE_MIB_NB_CRC_LEN, mib_buffer_decode, sizeof(mib_buffer_decode))) { rx_tb, SRSRAN_MIB_NB_CRC_LEN, mib_buffer_decode, sizeof(mib_buffer_decode))) {
fprintf(stderr, "Error decoding MIB\n"); fprintf(stderr, "Error decoding MIB\n");
} }
#endif #endif
@ -590,16 +581,16 @@ int main(int argc, char** argv)
// write to PCAP // write to PCAP
pcap_pack_and_write(pcap_file, pcap_pack_and_write(pcap_file,
rx_tb, rx_tb,
SRSLTE_MIB_NB_CRC_LEN, SRSRAN_MIB_NB_CRC_LEN,
0, 0,
true, true,
system_frame_number * SRSLTE_NOF_SF_X_FRAME, system_frame_number * SRSRAN_NOF_SF_X_FRAME,
0, 0,
DIRECTION_DOWNLINK, DIRECTION_DOWNLINK,
NO_RNTI); NO_RNTI);
#endif #endif
// activate SIB1 decoding // activate SIB1 decoding
srslte_nbiot_ue_dl_decode_sib1(&ue_dl, system_frame_number); srsran_nbiot_ue_dl_decode_sib1(&ue_dl, system_frame_number);
state = DECODE_SIB; state = DECODE_SIB;
} }
} }
@ -607,16 +598,16 @@ int main(int argc, char** argv)
case DECODE_SIB: case DECODE_SIB:
if (!have_sib1) { if (!have_sib1) {
int dec_ret = srslte_nbiot_ue_dl_decode_npdsch(&ue_dl, int dec_ret = srsran_nbiot_ue_dl_decode_npdsch(&ue_dl,
&buff_ptrs[0][prog_args.time_offset], &buff_ptrs[0][prog_args.time_offset],
rx_tb, rx_tb,
system_frame_number, system_frame_number,
srslte_ue_sync_nbiot_get_sfidx(&ue_sync), srsran_ue_sync_nbiot_get_sfidx(&ue_sync),
SRSLTE_SIRNTI); SRSRAN_SIRNTI);
if (dec_ret == SRSLTE_SUCCESS) { if (dec_ret == SRSRAN_SUCCESS) {
printf("SIB1 received\n"); printf("SIB1 received\n");
srslte_sys_info_block_type_1_nb_t sib = {}; srsran_sys_info_block_type_1_nb_t sib = {};
srslte_npdsch_sib1_unpack(rx_tb, &sib); srsran_npdsch_sib1_unpack(rx_tb, &sib);
hyper_frame_number = sib.hyper_sfn; hyper_frame_number = sib.hyper_sfn;
have_sib1 = true; have_sib1 = true;
@ -632,37 +623,37 @@ int main(int argc, char** argv)
get_sib2_params(rx_tb, ue_dl.npdsch_cfg.grant.mcs[0].tbs / 8, &sib2_params); get_sib2_params(rx_tb, ue_dl.npdsch_cfg.grant.mcs[0].tbs / 8, &sib2_params);
// Activate SIB2 decoding // Activate SIB2 decoding
srslte_nbiot_ue_dl_decode_sib( srsran_nbiot_ue_dl_decode_sib(
&ue_dl, hyper_frame_number, system_frame_number, SRSLTE_NBIOT_SI_TYPE_SIB2, sib2_params); &ue_dl, hyper_frame_number, system_frame_number, SRSRAN_NBIOT_SI_TYPE_SIB2, sib2_params);
#if HAVE_PCAP #if HAVE_PCAP
pcap_pack_and_write(pcap_file, pcap_pack_and_write(pcap_file,
rx_tb, rx_tb,
ue_dl.npdsch_cfg.grant.mcs[0].tbs / 8, ue_dl.npdsch_cfg.grant.mcs[0].tbs / 8,
0, 0,
true, true,
system_frame_number * 10 + srslte_ue_sync_nbiot_get_sfidx(&ue_sync), system_frame_number * 10 + srsran_ue_sync_nbiot_get_sfidx(&ue_sync),
SRSLTE_SIRNTI, SRSRAN_SIRNTI,
DIRECTION_DOWNLINK, DIRECTION_DOWNLINK,
SI_RNTI); SI_RNTI);
#endif #endif
// if SIB1 was decoded in this subframe, skip processing it further // if SIB1 was decoded in this subframe, skip processing it further
break; break;
} else if (dec_ret == SRSLTE_ERROR) { } else if (dec_ret == SRSRAN_ERROR) {
// reactivate SIB1 grant // reactivate SIB1 grant
if (srslte_nbiot_ue_dl_has_grant(&ue_dl) == false) { if (srsran_nbiot_ue_dl_has_grant(&ue_dl) == false) {
srslte_nbiot_ue_dl_decode_sib1(&ue_dl, system_frame_number); srsran_nbiot_ue_dl_decode_sib1(&ue_dl, system_frame_number);
} }
} }
} else if (!have_sib2 && !srslte_nbiot_ue_dl_is_sib1_sf( } else if (!have_sib2 && !srsran_nbiot_ue_dl_is_sib1_sf(
&ue_dl, system_frame_number, srslte_ue_sync_nbiot_get_sfidx(&ue_sync))) { &ue_dl, system_frame_number, srsran_ue_sync_nbiot_get_sfidx(&ue_sync))) {
// SIB2 is transmitted over multiple subframes, so this needs to be called more than once .. // SIB2 is transmitted over multiple subframes, so this needs to be called more than once ..
int dec_ret = srslte_nbiot_ue_dl_decode_npdsch(&ue_dl, int dec_ret = srsran_nbiot_ue_dl_decode_npdsch(&ue_dl,
&buff_ptrs[0][prog_args.time_offset], &buff_ptrs[0][prog_args.time_offset],
rx_tb, rx_tb,
system_frame_number, system_frame_number,
srslte_ue_sync_nbiot_get_sfidx(&ue_sync), srsran_ue_sync_nbiot_get_sfidx(&ue_sync),
SRSLTE_SIRNTI); SRSRAN_SIRNTI);
if (dec_ret == SRSLTE_SUCCESS) { if (dec_ret == SRSRAN_SUCCESS) {
printf("SIB2 received\n"); printf("SIB2 received\n");
have_sib2 = true; have_sib2 = true;
@ -679,80 +670,80 @@ int main(int argc, char** argv)
ue_dl.npdsch_cfg.grant.mcs[0].tbs / 8, ue_dl.npdsch_cfg.grant.mcs[0].tbs / 8,
0, 0,
true, true,
system_frame_number * 10 + srslte_ue_sync_nbiot_get_sfidx(&ue_sync), system_frame_number * 10 + srsran_ue_sync_nbiot_get_sfidx(&ue_sync),
SRSLTE_SIRNTI, SRSRAN_SIRNTI,
DIRECTION_DOWNLINK, DIRECTION_DOWNLINK,
SI_RNTI); SI_RNTI);
#endif #endif
} else { } else {
// reactivate SIB2 grant // reactivate SIB2 grant
if (srslte_nbiot_ue_dl_has_grant(&ue_dl) == false) { if (srsran_nbiot_ue_dl_has_grant(&ue_dl) == false) {
srslte_nbiot_ue_dl_decode_sib( srsran_nbiot_ue_dl_decode_sib(
&ue_dl, hyper_frame_number, system_frame_number, SRSLTE_NBIOT_SI_TYPE_SIB2, sib2_params); &ue_dl, hyper_frame_number, system_frame_number, SRSRAN_NBIOT_SI_TYPE_SIB2, sib2_params);
} }
} }
} }
if (have_sib1 && (have_sib2 || prog_args.skip_sib2)) { if (have_sib1 && (have_sib2 || prog_args.skip_sib2)) {
if (prog_args.rnti == SRSLTE_SIRNTI) { if (prog_args.rnti == SRSRAN_SIRNTI) {
srslte_nbiot_ue_dl_decode_sib1(&ue_dl, system_frame_number); srsran_nbiot_ue_dl_decode_sib1(&ue_dl, system_frame_number);
} }
state = DECODE_NPDSCH; state = DECODE_NPDSCH;
} }
break; break;
case DECODE_NPDSCH: case DECODE_NPDSCH:
if (prog_args.rnti != SRSLTE_SIRNTI) { if (prog_args.rnti != SRSRAN_SIRNTI) {
if (srslte_nbiot_ue_dl_has_grant(&ue_dl)) { if (srsran_nbiot_ue_dl_has_grant(&ue_dl)) {
// attempt to decode NPDSCH // attempt to decode NPDSCH
n = srslte_nbiot_ue_dl_decode_npdsch(&ue_dl, n = srsran_nbiot_ue_dl_decode_npdsch(&ue_dl,
&buff_ptrs[0][prog_args.time_offset], &buff_ptrs[0][prog_args.time_offset],
rx_tb, rx_tb,
system_frame_number, system_frame_number,
srslte_ue_sync_nbiot_get_sfidx(&ue_sync), srsran_ue_sync_nbiot_get_sfidx(&ue_sync),
prog_args.rnti); prog_args.rnti);
if (n == SRSLTE_SUCCESS) { if (n == SRSRAN_SUCCESS) {
INFO("NPDSCH decoded ok."); INFO("NPDSCH decoded ok.");
} }
} else { } else {
// decode NPDCCH // decode NPDCCH
srslte_dci_msg_t dci_msg; srsran_dci_msg_t dci_msg;
n = srslte_nbiot_ue_dl_decode_npdcch(&ue_dl, n = srsran_nbiot_ue_dl_decode_npdcch(&ue_dl,
&buff_ptrs[0][prog_args.time_offset], &buff_ptrs[0][prog_args.time_offset],
system_frame_number, system_frame_number,
srslte_ue_sync_nbiot_get_sfidx(&ue_sync), srsran_ue_sync_nbiot_get_sfidx(&ue_sync),
prog_args.rnti, prog_args.rnti,
&dci_msg); &dci_msg);
if (n == SRSLTE_NBIOT_UE_DL_FOUND_DCI) { if (n == SRSRAN_NBIOT_UE_DL_FOUND_DCI) {
INFO("DCI found for rnti=%d", prog_args.rnti); INFO("DCI found for rnti=%d", prog_args.rnti);
// convert DCI to grant // convert DCI to grant
srslte_ra_nbiot_dl_dci_t dci_unpacked; srsran_ra_nbiot_dl_dci_t dci_unpacked;
srslte_ra_nbiot_dl_grant_t grant; srsran_ra_nbiot_dl_grant_t grant;
if (srslte_nbiot_dci_msg_to_dl_grant(&dci_msg, if (srsran_nbiot_dci_msg_to_dl_grant(&dci_msg,
prog_args.rnti, prog_args.rnti,
&dci_unpacked, &dci_unpacked,
&grant, &grant,
system_frame_number, system_frame_number,
srslte_ue_sync_nbiot_get_sfidx(&ue_sync), srsran_ue_sync_nbiot_get_sfidx(&ue_sync),
64 /* TODO: remove */, 64 /* TODO: remove */,
cell.mode)) { cell.mode)) {
fprintf(stderr, "Error unpacking DCI\n"); fprintf(stderr, "Error unpacking DCI\n");
return SRSLTE_ERROR; return SRSRAN_ERROR;
} }
// activate grant // activate grant
srslte_nbiot_ue_dl_set_grant(&ue_dl, &grant); srsran_nbiot_ue_dl_set_grant(&ue_dl, &grant);
} }
} }
} else { } else {
// decode SIB1 over and over again // decode SIB1 over and over again
n = srslte_nbiot_ue_dl_decode_npdsch(&ue_dl, n = srsran_nbiot_ue_dl_decode_npdsch(&ue_dl,
&buff_ptrs[0][prog_args.time_offset], &buff_ptrs[0][prog_args.time_offset],
rx_tb, rx_tb,
system_frame_number, system_frame_number,
srslte_ue_sync_nbiot_get_sfidx(&ue_sync), srsran_ue_sync_nbiot_get_sfidx(&ue_sync),
prog_args.rnti); prog_args.rnti);
#ifdef ENABLE_GUI #ifdef ENABLE_GUI
if (n == SRSLTE_SUCCESS) { if (n == SRSRAN_SUCCESS) {
if (bcch_dl_sch_to_pretty_string( if (bcch_dl_sch_to_pretty_string(
rx_tb, ue_dl.npdsch_cfg.grant.mcs[0].tbs / 8, sib1_buffer_decode, sizeof(sib1_buffer_decode))) { rx_tb, ue_dl.npdsch_cfg.grant.mcs[0].tbs / 8, sib1_buffer_decode, sizeof(sib1_buffer_decode))) {
fprintf(stderr, "Error decoding SIB1\n"); fprintf(stderr, "Error decoding SIB1\n");
@ -761,16 +752,16 @@ int main(int argc, char** argv)
#endif // ENABLE_GUI #endif // ENABLE_GUI
// reactivate SIB1 grant // reactivate SIB1 grant
if (srslte_nbiot_ue_dl_has_grant(&ue_dl) == false) { if (srsran_nbiot_ue_dl_has_grant(&ue_dl) == false) {
srslte_nbiot_ue_dl_decode_sib1(&ue_dl, system_frame_number); srsran_nbiot_ue_dl_decode_sib1(&ue_dl, system_frame_number);
} }
} }
nof_trials++; nof_trials++;
rsrq = SRSLTE_VEC_EMA(srslte_chest_dl_nbiot_get_rsrq(&ue_dl.chest), rsrq, 0.1); rsrq = SRSRAN_VEC_EMA(srsran_chest_dl_nbiot_get_rsrq(&ue_dl.chest), rsrq, 0.1);
rsrp = SRSLTE_VEC_EMA(srslte_chest_dl_nbiot_get_rsrp(&ue_dl.chest), rsrp, 0.05); rsrp = SRSRAN_VEC_EMA(srsran_chest_dl_nbiot_get_rsrp(&ue_dl.chest), rsrp, 0.05);
noise = SRSLTE_VEC_EMA(srslte_chest_dl_nbiot_get_noise_estimate(&ue_dl.chest), noise, 0.05); noise = SRSRAN_VEC_EMA(srsran_chest_dl_nbiot_get_noise_estimate(&ue_dl.chest), noise, 0.05);
nframes++; nframes++;
if (isnan(rsrq)) { if (isnan(rsrq)) {
rsrq = 0; rsrq = 0;
@ -783,16 +774,16 @@ int main(int argc, char** argv)
} }
// Plot and Printf // Plot and Printf
if (srslte_ue_sync_nbiot_get_sfidx(&ue_sync) == 5) { if (srsran_ue_sync_nbiot_get_sfidx(&ue_sync) == 5) {
float gain = prog_args.rf_gain; float gain = prog_args.rf_gain;
if (gain < 0) { if (gain < 0) {
gain = 10 * log10(srslte_agc_get_gain(&ue_sync.agc)); gain = 10 * log10(srsran_agc_get_gain(&ue_sync.agc));
} }
printf( printf(
"CFO: %+6.2f kHz, RSRP: %4.1f dBm " "CFO: %+6.2f kHz, RSRP: %4.1f dBm "
"SNR: %4.1f dB, RSRQ: %4.1f dB, " "SNR: %4.1f dB, RSRQ: %4.1f dB, "
"NPDCCH detected: %d, NPDSCH-BLER: %5.2f%% (%d of total %d), NPDSCH-Rate: %5.2f kbit/s\r", "NPDCCH detected: %d, NPDSCH-BLER: %5.2f%% (%d of total %d), NPDSCH-Rate: %5.2f kbit/s\r",
srslte_ue_sync_nbiot_get_cfo(&ue_sync) / 1000, srsran_ue_sync_nbiot_get_cfo(&ue_sync) / 1000,
10 * log10(rsrp), 10 * log10(rsrp),
10 * log10(rsrp / noise), 10 * log10(rsrp / noise),
10 * log10(rsrq), 10 * log10(rsrq),
@ -800,12 +791,12 @@ int main(int argc, char** argv)
(float)100 * ue_dl.pkt_errors / ue_dl.pkts_total, (float)100 * ue_dl.pkt_errors / ue_dl.pkts_total,
ue_dl.pkt_errors, ue_dl.pkt_errors,
ue_dl.pkts_total, ue_dl.pkts_total,
(ue_dl.bits_total / ((system_frame_number * 10 + srslte_ue_sync_nbiot_get_sfidx(&ue_sync)) / 1000.0)) / (ue_dl.bits_total / ((system_frame_number * 10 + srsran_ue_sync_nbiot_get_sfidx(&ue_sync)) / 1000.0)) /
1000.0); 1000.0);
} }
break; break;
} }
if (srslte_ue_sync_nbiot_get_sfidx(&ue_sync) == 9) { if (srsran_ue_sync_nbiot_get_sfidx(&ue_sync) == 9) {
system_frame_number++; system_frame_number++;
if (system_frame_number == 1024) { if (system_frame_number == 1024) {
system_frame_number = 0; system_frame_number = 0;
@ -826,7 +817,7 @@ int main(int argc, char** argv)
#ifdef ENABLE_GUI #ifdef ENABLE_GUI
if (!prog_args.disable_plots) { if (!prog_args.disable_plots) {
if ((system_frame_number % 4) == 0) { if ((system_frame_number % 4) == 0) {
plot_sf_idx = srslte_ue_sync_nbiot_get_sfidx(&ue_sync); plot_sf_idx = srsran_ue_sync_nbiot_get_sfidx(&ue_sync);
plot_track = true; plot_track = true;
sem_post(&plot_sem); sem_post(&plot_sem);
} }
@ -835,12 +826,12 @@ int main(int argc, char** argv)
} else if (ret == 0) { } else if (ret == 0) {
state = DECODE_MIB; state = DECODE_MIB;
printf("Finding PSS... Peak: %8.1f, FrameCnt: %d, State: %d\r", printf("Finding PSS... Peak: %8.1f, FrameCnt: %d, State: %d\r",
srslte_sync_nbiot_get_peak_value(&ue_sync.sfind), srsran_sync_nbiot_get_peak_value(&ue_sync.sfind),
ue_sync.frame_total_cnt, ue_sync.frame_total_cnt,
ue_sync.state); ue_sync.state);
#ifdef ENABLE_GUI #ifdef ENABLE_GUI
if (!prog_args.disable_plots) { if (!prog_args.disable_plots) {
plot_sf_idx = srslte_ue_sync_nbiot_get_sfidx(&ue_sync); plot_sf_idx = srsran_ue_sync_nbiot_get_sfidx(&ue_sync);
plot_track = false; plot_track = false;
sem_post(&plot_sem); sem_post(&plot_sem);
} }
@ -860,8 +851,8 @@ int main(int argc, char** argv)
printf("dci_detected=%d\n", ue_dl.nof_detected); printf("dci_detected=%d\n", ue_dl.nof_detected);
} }
srslte_nbiot_ue_dl_free(&ue_dl); srsran_nbiot_ue_dl_free(&ue_dl);
srslte_ue_sync_nbiot_free(&ue_sync); srsran_ue_sync_nbiot_free(&ue_sync);
#if HAVE_PCAP #if HAVE_PCAP
printf("Saving PCAP file\n"); printf("Saving PCAP file\n");
@ -870,9 +861,9 @@ int main(int argc, char** argv)
#ifndef DISABLE_RF #ifndef DISABLE_RF
if (!prog_args.input_file_name) { if (!prog_args.input_file_name) {
srslte_ue_mib_nbiot_free(&ue_mib); srsran_ue_mib_nbiot_free(&ue_mib);
srslte_rf_close(&rf); srsran_rf_close(&rf);
for (int i = 0; i < SRSLTE_MAX_PORTS; i++) { for (int i = 0; i < SRSRAN_MAX_PORTS; i++) {
if (buff_ptrs[i] != NULL) if (buff_ptrs[i] != NULL)
free(buff_ptrs[i]); free(buff_ptrs[i]);
} }
@ -890,7 +881,7 @@ int main(int argc, char** argv)
#endif // ENABLE_GUI #endif // ENABLE_GUI
printf("\nBye\n"); printf("\nBye\n");
return SRSLTE_SUCCESS; return SRSRAN_SUCCESS;
} }
/********************************************************************** /**********************************************************************
@ -914,7 +905,7 @@ float tmp_plot2[110 * 15 * 2048];
void* plot_thread_run(void* arg) void* plot_thread_run(void* arg)
{ {
uint32_t nof_re = SRSLTE_SF_LEN_RE(ue_dl.cell.base.nof_prb, ue_dl.cell.base.cp); uint32_t nof_re = SRSRAN_SF_LEN_RE(ue_dl.cell.base.nof_prb, ue_dl.cell.base.cp);
#if HAVE_RSRP_PLOT #if HAVE_RSRP_PLOT
float rsrp_lin = 0; float rsrp_lin = 0;
#endif #endif
@ -988,9 +979,9 @@ void* plot_thread_run(void* arg)
tmp_plot[i] = -80; tmp_plot[i] = -80;
} }
} }
int numpoints = SRSLTE_NRE * 2; int numpoints = SRSRAN_NRE * 2;
bzero(tmp_plot2, sizeof(float) * numpoints); bzero(tmp_plot2, sizeof(float) * numpoints);
int g = (numpoints - SRSLTE_NRE) / 2; int g = (numpoints - SRSRAN_NRE) / 2;
for (int i = 0; i < 12 * ue_dl.cell.base.nof_prb; i++) { for (int i = 0; i < 12 * ue_dl.cell.base.nof_prb; i++) {
tmp_plot2[g + i] = 20 * log10(cabsf(ue_dl.ce[0][i])); tmp_plot2[g + i] = 20 * log10(cabsf(ue_dl.ce[0][i]));
if (isinf(tmp_plot2[g + i])) { if (isinf(tmp_plot2[g + i])) {
@ -1001,17 +992,17 @@ void* plot_thread_run(void* arg)
if (!prog_args.input_file_name) { if (!prog_args.input_file_name) {
if (plot_track) { if (plot_track) {
srslte_npss_synch_t* pss_obj = &ue_sync.strack.npss; srsran_npss_synch_t* pss_obj = &ue_sync.strack.npss;
int max = srslte_vec_max_fi(pss_obj->conv_output_avg, pss_obj->frame_size + pss_obj->fft_size - 1); int max = srsran_vec_max_fi(pss_obj->conv_output_avg, pss_obj->frame_size + pss_obj->fft_size - 1);
srslte_vec_sc_prod_fff(pss_obj->conv_output_avg, srsran_vec_sc_prod_fff(pss_obj->conv_output_avg,
1 / pss_obj->conv_output_avg[max], 1 / pss_obj->conv_output_avg[max],
tmp_plot2, tmp_plot2,
pss_obj->frame_size + pss_obj->fft_size - 1); pss_obj->frame_size + pss_obj->fft_size - 1);
plot_real_setNewData(&p_sync, &tmp_plot2[max - NPSS_FIND_PLOT_WIDTH / 2], NPSS_FIND_PLOT_WIDTH); plot_real_setNewData(&p_sync, &tmp_plot2[max - NPSS_FIND_PLOT_WIDTH / 2], NPSS_FIND_PLOT_WIDTH);
} else { } else {
int len = SRSLTE_NPSS_CORR_FILTER_LEN + ue_sync.sfind.npss.frame_size - 1; int len = SRSRAN_NPSS_CORR_FILTER_LEN + ue_sync.sfind.npss.frame_size - 1;
int max = srslte_vec_max_fi(ue_sync.sfind.npss.conv_output_avg, len); int max = srsran_vec_max_fi(ue_sync.sfind.npss.conv_output_avg, len);
srslte_vec_sc_prod_fff( srsran_vec_sc_prod_fff(
ue_sync.sfind.npss.conv_output_avg, 1 / ue_sync.sfind.npss.conv_output_avg[max], tmp_plot2, len); ue_sync.sfind.npss.conv_output_avg, 1 / ue_sync.sfind.npss.conv_output_avg[max], tmp_plot2, len);
plot_real_setNewData(&p_sync, tmp_plot2, len); plot_real_setNewData(&p_sync, tmp_plot2, len);
} }
@ -1019,7 +1010,7 @@ void* plot_thread_run(void* arg)
#if HAVE_RSRP_PLOT #if HAVE_RSRP_PLOT
// get current RSRP estimate // get current RSRP estimate
rsrp_lin = SRSLTE_VEC_EMA(srslte_chest_dl_nbiot_get_rsrp(&ue_dl.chest), rsrp_lin, 0.05); rsrp_lin = SRSRAN_VEC_EMA(srsran_chest_dl_nbiot_get_rsrp(&ue_dl.chest), rsrp_lin, 0.05);
rsrp_table[rsrp_table_index++] = 10 * log10(rsrp_lin); rsrp_table[rsrp_table_index++] = 10 * log10(rsrp_lin);
if (rsrp_table_index == rsrp_num_plot) { if (rsrp_table_index == rsrp_num_plot) {
rsrp_table_index = 0; rsrp_table_index = 0;
@ -1044,7 +1035,7 @@ void* plot_thread_run(void* arg)
snprintf(lable_buf, LABLE_MAX_LEN, "%d", cell.n_id_ncell); snprintf(lable_buf, LABLE_MAX_LEN, "%d", cell.n_id_ncell);
key_value_setValueText(&id_label, lable_buf); key_value_setValueText(&id_label, lable_buf);
key_value_setValueText(&mode_label, srslte_nbiot_mode_string(cell.mode)); key_value_setValueText(&mode_label, srsran_nbiot_mode_string(cell.mode));
snprintf(lable_buf, LABLE_MAX_LEN, "%d / %d", hyper_frame_number, system_frame_number); snprintf(lable_buf, LABLE_MAX_LEN, "%d / %d", hyper_frame_number, system_frame_number);
key_value_setValueText(&hfn_label, lable_buf); key_value_setValueText(&hfn_label, lable_buf);

@ -1,31 +1,22 @@
/** /**
* Copyright 2013-2021 Software Radio Systems Limited
*
* This file is part of srsLTE.
* *
* srsLTE is free software: you can redistribute it and/or modify * \section COPYRIGHT
* 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, * Copyright 2013-2021 Software Radio Systems Limited
* 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 * By using this file, you agree to the terms and conditions set
* the LICENSE file in the top-level directory of this distribution * forth in the LICENSE file which can be found at the top level of
* and at http://www.gnu.org/licenses/. * the distribution.
* *
*/ */
#include "npdsch_ue_helper.h" #include "npdsch_ue_helper.h"
#include "srslte/asn1/rrc_nbiot.h" #include "srsran/asn1/rrc_nbiot.h"
#include "srslte/phy/utils/vector.h" // for SRSLTE_MIN #include "srsran/phy/utils/vector.h" // for SRSRAN_MIN
int get_sib2_params(const uint8_t* sib1_payload, const uint32_t len, srslte_nbiot_si_params_t* sib2_params) int get_sib2_params(const uint8_t* sib1_payload, const uint32_t len, srsran_nbiot_si_params_t* sib2_params)
{ {
memset(sib2_params, 0, sizeof(srslte_nbiot_si_params_t)); memset(sib2_params, 0, sizeof(srsran_nbiot_si_params_t));
// unpack SIB // unpack SIB
asn1::rrc::bcch_dl_sch_msg_nb_s dlsch_msg; asn1::rrc::bcch_dl_sch_msg_nb_s dlsch_msg;
@ -33,7 +24,7 @@ int get_sib2_params(const uint8_t* sib1_payload, const uint32_t len, srslte_nbio
asn1::SRSASN_CODE err = dlsch_msg.unpack(dlsch_bref); asn1::SRSASN_CODE err = dlsch_msg.unpack(dlsch_bref);
if (err != asn1::SRSASN_SUCCESS) { if (err != asn1::SRSASN_SUCCESS) {
fprintf(stderr, "Error unpacking DL-SCH message\n"); fprintf(stderr, "Error unpacking DL-SCH message\n");
return SRSLTE_ERROR; return SRSRAN_ERROR;
} }
// set SIB2-NB parameters // set SIB2-NB parameters
@ -47,7 +38,7 @@ int get_sib2_params(const uint8_t* sib1_payload, const uint32_t len, srslte_nbio
sib2_params->si_tb = sched_info->si_tb_r13.to_number(); sib2_params->si_tb = sched_info->si_tb_r13.to_number();
sib2_params->si_window_length = dlsch_msg.msg.c1().sib_type1_r13().si_win_len_r13.to_number(); sib2_params->si_window_length = dlsch_msg.msg.c1().sib_type1_r13().si_win_len_r13.to_number();
return SRSLTE_SUCCESS; return SRSRAN_SUCCESS;
} }
/* /*
@ -63,16 +54,16 @@ int bcch_bch_to_pretty_string(const uint8_t* bcch_bch_payload,
asn1::SRSASN_CODE err = bch_msg.unpack(bch_bref); asn1::SRSASN_CODE err = bch_msg.unpack(bch_bref);
if (err != asn1::SRSASN_SUCCESS) { if (err != asn1::SRSASN_SUCCESS) {
fprintf(stderr, "Error unpacking BCCH message\n"); fprintf(stderr, "Error unpacking BCCH message\n");
return SRSLTE_ERROR; return SRSRAN_ERROR;
} }
asn1::json_writer json_writer; asn1::json_writer json_writer;
bch_msg.to_json(json_writer); bch_msg.to_json(json_writer);
uint32_t output_len = SRSLTE_MIN(max_output_len, json_writer.to_string().length()); uint32_t output_len = SRSRAN_MIN(max_output_len, json_writer.to_string().length());
memcpy(output, json_writer.to_string().c_str(), output_len); memcpy(output, json_writer.to_string().c_str(), output_len);
return SRSLTE_SUCCESS; return SRSRAN_SUCCESS;
} }
/* /*
@ -88,14 +79,14 @@ int bcch_dl_sch_to_pretty_string(const uint8_t* bcch_dl_sch_payload,
asn1::SRSASN_CODE err = dlsch_msg.unpack(dlsch_bref); asn1::SRSASN_CODE err = dlsch_msg.unpack(dlsch_bref);
if (err != asn1::SRSASN_SUCCESS) { if (err != asn1::SRSASN_SUCCESS) {
fprintf(stderr, "Error unpacking DL-SCH message\n"); fprintf(stderr, "Error unpacking DL-SCH message\n");
return SRSLTE_ERROR; return SRSRAN_ERROR;
} }
asn1::json_writer json_writer; asn1::json_writer json_writer;
dlsch_msg.to_json(json_writer); dlsch_msg.to_json(json_writer);
uint32_t output_len = SRSLTE_MIN(max_output_len, json_writer.to_string().length()); uint32_t output_len = SRSRAN_MIN(max_output_len, json_writer.to_string().length());
memcpy(output, json_writer.to_string().c_str(), output_len); memcpy(output, json_writer.to_string().c_str(), output_len);
return SRSLTE_SUCCESS; return SRSRAN_SUCCESS;
} }

@ -1,35 +1,26 @@
/** /**
* Copyright 2013-2021 Software Radio Systems Limited
*
* This file is part of srsLTE.
* *
* srsLTE is free software: you can redistribute it and/or modify * \section COPYRIGHT
* 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, * Copyright 2013-2021 Software Radio Systems Limited
* 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 * By using this file, you agree to the terms and conditions set
* the LICENSE file in the top-level directory of this distribution * forth in the LICENSE file which can be found at the top level of
* and at http://www.gnu.org/licenses/. * the distribution.
* *
*/ */
#ifndef SRSLTE_NPDSCH_UE_HELPER_H #ifndef SRSRAN_NPDSCH_UE_HELPER_H
#define SRSLTE_NPDSCH_UE_HELPER_H #define SRSRAN_NPDSCH_UE_HELPER_H
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
#include "srslte/phy/phch/ra_nbiot.h" #include "srsran/phy/phch/ra_nbiot.h"
#include <stdint.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 get_sib2_params(const uint8_t* sib1_payload, const uint32_t len, srsran_nbiot_si_params_t* sib2_params);
int bcch_bch_to_pretty_string(const uint8_t* bcch_bch_payload, int bcch_bch_to_pretty_string(const uint8_t* bcch_bch_payload,
const uint32_t input_len, const uint32_t input_len,
char* output, char* output,
@ -43,4 +34,4 @@ int bcch_dl_sch_to_pretty_string(const uint8_t* bcch_dl_sch_payload,
} }
#endif #endif
#endif // SRSLTE_NPDSCH_UE_HELPER_H #endif // SRSRAN_NPDSCH_UE_HELPER_H

@ -1,27 +1,18 @@
/** /**
* Copyright 2013-2021 Software Radio Systems Limited
*
* This file is part of srsLTE.
* *
* srsLTE is free software: you can redistribute it and/or modify * \section COPYRIGHT
* 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, * Copyright 2013-2021 Software Radio Systems Limited
* 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 * By using this file, you agree to the terms and conditions set
* the LICENSE file in the top-level directory of this distribution * forth in the LICENSE file which can be found at the top level of
* and at http://www.gnu.org/licenses/. * the distribution.
* *
*/ */
#include "srslte/common/crash_handler.h" #include "srsran/common/crash_handler.h"
#include "srslte/common/gen_mch_tables.h" #include "srsran/common/gen_mch_tables.h"
#include "srslte/srslte.h" #include "srsran/srsran.h"
#include <pthread.h> #include <pthread.h>
#include <semaphore.h> #include <semaphore.h>
#include <signal.h> #include <signal.h>
@ -36,9 +27,9 @@
#define M_CRNTI 0xFFFD #define M_CRNTI 0xFFFD
#ifndef DISABLE_RF #ifndef DISABLE_RF
#include "srslte/phy/common/phy_common.h" #include "srsran/phy/common/phy_common.h"
#include "srslte/phy/rf/rf.h" #include "srsran/phy/rf/rf.h"
srslte_rf_t radio; srsran_rf_t radio;
#else #else
#pragma message "Compiling pdsch_ue with no RF support" #pragma message "Compiling pdsch_ue with no RF support"
#endif #endif
@ -52,21 +43,21 @@ static char* output_file_name = NULL;
#define PAGE_UP 53 #define PAGE_UP 53
#define PAGE_DOWN 54 #define PAGE_DOWN 54
static srslte_cell_t cell = { static srsran_cell_t cell = {
25, // nof_prb 25, // nof_prb
1, // nof_ports 1, // nof_ports
0, // cell_id 0, // cell_id
SRSLTE_CP_NORM, // cyclic prefix SRSRAN_CP_NORM, // cyclic prefix
SRSLTE_PHICH_NORM, // PHICH length SRSRAN_PHICH_NORM, // PHICH length
SRSLTE_PHICH_R_1, // PHICH resources SRSRAN_PHICH_R_1, // PHICH resources
SRSLTE_FDD, SRSRAN_FDD,
}; };
static int net_port = -1; // -1 generates random dataThat means there is some problem sending samples to the device static int net_port = -1; // -1 generates random dataThat means there is some problem sending samples to the device
static uint32_t cfi = 2; static uint32_t cfi = 2;
static uint32_t mcs_idx = 1, last_mcs_idx = 1; static uint32_t mcs_idx = 1, last_mcs_idx = 1;
static int nof_frames = -1; static int nof_frames = -1;
static srslte_tm_t transmission_mode = SRSLTE_TM1; static srsran_tm_t transmission_mode = SRSRAN_TM1;
static uint32_t nof_tb = 1; static uint32_t nof_tb = 1;
static uint32_t multiplex_pmi = 0; static uint32_t multiplex_pmi = 0;
static uint32_t multiplex_nof_layers = 1; static uint32_t multiplex_nof_layers = 1;
@ -80,30 +71,30 @@ static float output_file_snr = +INFINITY;
static bool use_standard_lte_rate = false; static bool use_standard_lte_rate = false;
static bool null_file_sink = false; static bool null_file_sink = false;
static srslte_filesink_t fsink; static srsran_filesink_t fsink;
static srslte_ofdm_t ifft[SRSLTE_MAX_PORTS]; static srsran_ofdm_t ifft[SRSRAN_MAX_PORTS];
static srslte_ofdm_t ifft_mbsfn; static srsran_ofdm_t ifft_mbsfn;
static srslte_pbch_t pbch; static srsran_pbch_t pbch;
static srslte_pcfich_t pcfich; static srsran_pcfich_t pcfich;
static srslte_pdcch_t pdcch; static srsran_pdcch_t pdcch;
static srslte_pdsch_t pdsch; static srsran_pdsch_t pdsch;
static srslte_pdsch_cfg_t pdsch_cfg; static srsran_pdsch_cfg_t pdsch_cfg;
static srslte_pmch_t pmch; static srsran_pmch_t pmch;
static srslte_pmch_cfg_t pmch_cfg; static srsran_pmch_cfg_t pmch_cfg;
static srslte_softbuffer_tx_t* softbuffers[SRSLTE_MAX_CODEWORDS]; static srsran_softbuffer_tx_t* softbuffers[SRSRAN_MAX_CODEWORDS];
static srslte_regs_t regs; static srsran_regs_t regs;
static srslte_dci_dl_t dci_dl; static srsran_dci_dl_t dci_dl;
static int rvidx[SRSLTE_MAX_CODEWORDS] = {0, 0}; static int rvidx[SRSRAN_MAX_CODEWORDS] = {0, 0};
static cf_t * sf_buffer[SRSLTE_MAX_PORTS] = {NULL}, *output_buffer[SRSLTE_MAX_PORTS] = {NULL}; static cf_t * sf_buffer[SRSRAN_MAX_PORTS] = {NULL}, *output_buffer[SRSRAN_MAX_PORTS] = {NULL};
static uint32_t sf_n_re, sf_n_samples; static uint32_t sf_n_re, sf_n_samples;
static pthread_t net_thread; static pthread_t net_thread;
static void* net_thread_fnc(void* arg); static void* net_thread_fnc(void* arg);
static sem_t net_sem; static sem_t net_sem;
static bool net_packet_ready = false; static bool net_packet_ready = false;
static srslte_netsource_t net_source; static srsran_netsource_t net_source;
static srslte_netsink_t net_sink; static srsran_netsink_t net_sink;
static int prbset_num = 1, last_prbset_num = 1; static int prbset_num = 1, last_prbset_num = 1;
static int prbset_orig = 0; static int prbset_orig = 0;
@ -139,7 +130,7 @@ static void usage(char* prog)
printf("\t-u listen TCP/UDP port for input data (if mbsfn is active then the stream is over mbsfn only) (-1 is " printf("\t-u listen TCP/UDP port for input data (if mbsfn is active then the stream is over mbsfn only) (-1 is "
"random) [Default %d]\n", "random) [Default %d]\n",
net_port); net_port);
printf("\t-v [set srslte_verbose to debug, default none]\n"); printf("\t-v [set srsran_verbose to debug, default none]\n");
printf("\t-s output file SNR [Default %f]\n", output_file_snr); printf("\t-s output file SNR [Default %f]\n", output_file_snr);
printf("\t-q Enable/Disable 256QAM modulation (default %s)\n", enable_256qam ? "enabled" : "disabled"); printf("\t-q Enable/Disable 256QAM modulation (default %s)\n", enable_256qam ? "enabled" : "disabled");
printf("\t-Q Use standard LTE sample rates (default %s)\n", use_standard_lte_rate ? "enabled" : "disabled"); printf("\t-Q Use standard LTE sample rates (default %s)\n", use_standard_lte_rate ? "enabled" : "disabled");
@ -186,7 +177,7 @@ static void parse_args(int argc, char** argv)
cell.id = (uint32_t)strtol(argv[optind], NULL, 10); cell.id = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'x': case 'x':
transmission_mode = (srslte_tm_t)(strtol(argv[optind], NULL, 10) - 1); transmission_mode = (srsran_tm_t)(strtol(argv[optind], NULL, 10) - 1);
break; break;
case 'b': case 'b':
multiplex_pmi = (uint32_t)strtol(argv[optind], NULL, 10); multiplex_pmi = (uint32_t)strtol(argv[optind], NULL, 10);
@ -198,7 +189,7 @@ static void parse_args(int argc, char** argv)
mbsfn_area_id = (int)strtol(argv[optind], NULL, 10); mbsfn_area_id = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'v': case 'v':
srslte_verbose++; srsran_verbose++;
break; break;
case 's': case 's':
output_file_snr = strtof(argv[optind], NULL); output_file_snr = strtof(argv[optind], NULL);
@ -231,12 +222,12 @@ static void base_init()
/* Configure cell and PDSCH in function of the transmission mode */ /* Configure cell and PDSCH in function of the transmission mode */
switch (transmission_mode) { switch (transmission_mode) {
case SRSLTE_TM1: case SRSRAN_TM1:
cell.nof_ports = 1; cell.nof_ports = 1;
break; break;
case SRSLTE_TM2: case SRSRAN_TM2:
case SRSLTE_TM3: case SRSRAN_TM3:
case SRSLTE_TM4: case SRSRAN_TM4:
cell.nof_ports = 2; cell.nof_ports = 2;
break; break;
default: default:
@ -245,38 +236,38 @@ static void base_init()
} }
/* Allocate memory */ /* Allocate memory */
for (i = 0; i < SRSLTE_MAX_CODEWORDS; i++) { for (i = 0; i < SRSRAN_MAX_CODEWORDS; i++) {
data[i] = srslte_vec_u8_malloc(SOFTBUFFER_SIZE); data[i] = srsran_vec_u8_malloc(SOFTBUFFER_SIZE);
if (!data[i]) { if (!data[i]) {
perror("malloc"); perror("malloc");
exit(-1); exit(-1);
} }
bzero(data[i], sizeof(uint8_t) * SOFTBUFFER_SIZE); bzero(data[i], sizeof(uint8_t) * SOFTBUFFER_SIZE);
} }
data_mbms = srslte_vec_u8_malloc(SOFTBUFFER_SIZE); data_mbms = srsran_vec_u8_malloc(SOFTBUFFER_SIZE);
/* init memory */ /* init memory */
for (i = 0; i < SRSLTE_MAX_PORTS; i++) { for (i = 0; i < SRSRAN_MAX_PORTS; i++) {
sf_buffer[i] = srslte_vec_cf_malloc(sf_n_re); sf_buffer[i] = srsran_vec_cf_malloc(sf_n_re);
if (!sf_buffer[i]) { if (!sf_buffer[i]) {
perror("malloc"); perror("malloc");
exit(-1); exit(-1);
} }
} }
for (i = 0; i < SRSLTE_MAX_PORTS; i++) { for (i = 0; i < SRSRAN_MAX_PORTS; i++) {
output_buffer[i] = srslte_vec_cf_malloc(sf_n_samples); output_buffer[i] = srsran_vec_cf_malloc(sf_n_samples);
if (!output_buffer[i]) { if (!output_buffer[i]) {
perror("malloc"); perror("malloc");
exit(-1); exit(-1);
} }
srslte_vec_cf_zero(output_buffer[i], sf_n_samples); srsran_vec_cf_zero(output_buffer[i], sf_n_samples);
} }
/* open file or USRP */ /* open file or USRP */
if (output_file_name) { if (output_file_name) {
if (strcmp(output_file_name, "NULL")) { if (strcmp(output_file_name, "NULL")) {
if (srslte_filesink_init(&fsink, output_file_name, SRSLTE_COMPLEX_FLOAT_BIN)) { if (srsran_filesink_init(&fsink, output_file_name, SRSRAN_COMPLEX_FLOAT_BIN)) {
ERROR("Error opening file %s", output_file_name); ERROR("Error opening file %s", output_file_name);
exit(-1); exit(-1);
} }
@ -287,7 +278,7 @@ static void base_init()
} else { } else {
#ifndef DISABLE_RF #ifndef DISABLE_RF
printf("Opening RF device...\n"); printf("Opening RF device...\n");
if (srslte_rf_open_devname(&radio, rf_dev, rf_args, cell.nof_ports)) { if (srsran_rf_open_devname(&radio, rf_dev, rf_args, cell.nof_ports)) {
fprintf(stderr, "Error opening rf\n"); fprintf(stderr, "Error opening rf\n");
exit(-1); exit(-1);
} }
@ -298,12 +289,12 @@ static void base_init()
} }
if (net_port > 0) { if (net_port > 0) {
if (srslte_netsource_init(&net_source, "127.0.0.1", net_port, SRSLTE_NETSOURCE_UDP)) { if (srsran_netsource_init(&net_source, "127.0.0.1", net_port, SRSRAN_NETSOURCE_UDP)) {
ERROR("Error creating input UDP socket at port %d", net_port); ERROR("Error creating input UDP socket at port %d", net_port);
exit(-1); exit(-1);
} }
if (null_file_sink) { if (null_file_sink) {
if (srslte_netsink_init(&net_sink, "127.0.0.1", net_port + 1, SRSLTE_NETSINK_TCP)) { if (srsran_netsink_init(&net_sink, "127.0.0.1", net_port + 1, SRSRAN_NETSINK_TCP)) {
ERROR("Error sink"); ERROR("Error sink");
exit(-1); exit(-1);
} }
@ -316,76 +307,76 @@ static void base_init()
/* create ifft object */ /* create ifft object */
for (i = 0; i < cell.nof_ports; i++) { for (i = 0; i < cell.nof_ports; i++) {
if (srslte_ofdm_tx_init(&ifft[i], SRSLTE_CP_NORM, sf_buffer[i], output_buffer[i], cell.nof_prb)) { if (srsran_ofdm_tx_init(&ifft[i], SRSRAN_CP_NORM, sf_buffer[i], output_buffer[i], cell.nof_prb)) {
ERROR("Error creating iFFT object"); ERROR("Error creating iFFT object");
exit(-1); exit(-1);
} }
srslte_ofdm_set_normalize(&ifft[i], true); srsran_ofdm_set_normalize(&ifft[i], true);
} }
if (srslte_ofdm_tx_init_mbsfn(&ifft_mbsfn, SRSLTE_CP_EXT, sf_buffer[0], output_buffer[0], cell.nof_prb)) { if (srsran_ofdm_tx_init_mbsfn(&ifft_mbsfn, SRSRAN_CP_EXT, sf_buffer[0], output_buffer[0], cell.nof_prb)) {
ERROR("Error creating iFFT object"); ERROR("Error creating iFFT object");
exit(-1); exit(-1);
} }
srslte_ofdm_set_non_mbsfn_region(&ifft_mbsfn, 2); srsran_ofdm_set_non_mbsfn_region(&ifft_mbsfn, 2);
srslte_ofdm_set_normalize(&ifft_mbsfn, true); srsran_ofdm_set_normalize(&ifft_mbsfn, true);
if (srslte_pbch_init(&pbch)) { if (srsran_pbch_init(&pbch)) {
ERROR("Error creating PBCH object"); ERROR("Error creating PBCH object");
exit(-1); exit(-1);
} }
if (srslte_pbch_set_cell(&pbch, cell)) { if (srsran_pbch_set_cell(&pbch, cell)) {
ERROR("Error creating PBCH object"); ERROR("Error creating PBCH object");
exit(-1); exit(-1);
} }
if (srslte_regs_init(&regs, cell)) { if (srsran_regs_init(&regs, cell)) {
ERROR("Error initiating regs"); ERROR("Error initiating regs");
exit(-1); exit(-1);
} }
if (srslte_pcfich_init(&pcfich, 1)) { if (srsran_pcfich_init(&pcfich, 1)) {
ERROR("Error creating PBCH object"); ERROR("Error creating PBCH object");
exit(-1); exit(-1);
} }
if (srslte_pcfich_set_cell(&pcfich, &regs, cell)) { if (srsran_pcfich_set_cell(&pcfich, &regs, cell)) {
ERROR("Error creating PBCH object"); ERROR("Error creating PBCH object");
exit(-1); exit(-1);
} }
if (srslte_pdcch_init_enb(&pdcch, cell.nof_prb)) { if (srsran_pdcch_init_enb(&pdcch, cell.nof_prb)) {
ERROR("Error creating PDCCH object"); ERROR("Error creating PDCCH object");
exit(-1); exit(-1);
} }
if (srslte_pdcch_set_cell(&pdcch, &regs, cell)) { if (srsran_pdcch_set_cell(&pdcch, &regs, cell)) {
ERROR("Error creating PDCCH object"); ERROR("Error creating PDCCH object");
exit(-1); exit(-1);
} }
if (srslte_pdsch_init_enb(&pdsch, cell.nof_prb)) { if (srsran_pdsch_init_enb(&pdsch, cell.nof_prb)) {
ERROR("Error creating PDSCH object"); ERROR("Error creating PDSCH object");
exit(-1); exit(-1);
} }
if (srslte_pdsch_set_cell(&pdsch, cell)) { if (srsran_pdsch_set_cell(&pdsch, cell)) {
ERROR("Error creating PDSCH object"); ERROR("Error creating PDSCH object");
exit(-1); exit(-1);
} }
if (mbsfn_area_id > -1) { if (mbsfn_area_id > -1) {
if (srslte_pmch_init(&pmch, cell.nof_prb, 1)) { if (srsran_pmch_init(&pmch, cell.nof_prb, 1)) {
ERROR("Error creating PMCH object"); ERROR("Error creating PMCH object");
} }
srslte_pmch_set_area_id(&pmch, mbsfn_area_id); srsran_pmch_set_area_id(&pmch, mbsfn_area_id);
} }
for (i = 0; i < SRSLTE_MAX_CODEWORDS; i++) { for (i = 0; i < SRSRAN_MAX_CODEWORDS; i++) {
softbuffers[i] = calloc(sizeof(srslte_softbuffer_tx_t), 1); softbuffers[i] = calloc(sizeof(srsran_softbuffer_tx_t), 1);
if (!softbuffers[i]) { if (!softbuffers[i]) {
ERROR("Error allocating soft buffer"); ERROR("Error allocating soft buffer");
exit(-1); exit(-1);
} }
if (srslte_softbuffer_tx_init(softbuffers[i], cell.nof_prb)) { if (srsran_softbuffer_tx_init(softbuffers[i], cell.nof_prb)) {
ERROR("Error initiating soft buffer"); ERROR("Error initiating soft buffer");
exit(-1); exit(-1);
} }
@ -395,31 +386,31 @@ static void base_init()
static void base_free() static void base_free()
{ {
int i; int i;
for (i = 0; i < SRSLTE_MAX_CODEWORDS; i++) { for (i = 0; i < SRSRAN_MAX_CODEWORDS; i++) {
srslte_softbuffer_tx_free(softbuffers[i]); srsran_softbuffer_tx_free(softbuffers[i]);
if (softbuffers[i]) { if (softbuffers[i]) {
free(softbuffers[i]); free(softbuffers[i]);
} }
} }
srslte_pdsch_free(&pdsch); srsran_pdsch_free(&pdsch);
srslte_pdcch_free(&pdcch); srsran_pdcch_free(&pdcch);
srslte_regs_free(&regs); srsran_regs_free(&regs);
srslte_pbch_free(&pbch); srsran_pbch_free(&pbch);
if (mbsfn_area_id > -1) { if (mbsfn_area_id > -1) {
srslte_pmch_free(&pmch); srsran_pmch_free(&pmch);
} }
srslte_ofdm_tx_free(&ifft_mbsfn); srsran_ofdm_tx_free(&ifft_mbsfn);
for (i = 0; i < cell.nof_ports; i++) { for (i = 0; i < cell.nof_ports; i++) {
srslte_ofdm_tx_free(&ifft[i]); srsran_ofdm_tx_free(&ifft[i]);
} }
for (i = 0; i < SRSLTE_MAX_CODEWORDS; i++) { for (i = 0; i < SRSRAN_MAX_CODEWORDS; i++) {
if (data[i]) { if (data[i]) {
free(data[i]); free(data[i]);
} }
} }
for (i = 0; i < SRSLTE_MAX_PORTS; i++) { for (i = 0; i < SRSRAN_MAX_PORTS; i++) {
if (sf_buffer[i]) { if (sf_buffer[i]) {
free(sf_buffer[i]); free(sf_buffer[i]);
} }
@ -430,16 +421,16 @@ static void base_free()
} }
if (output_file_name) { if (output_file_name) {
if (!null_file_sink) { if (!null_file_sink) {
srslte_filesink_free(&fsink); srsran_filesink_free(&fsink);
} }
} else { } else {
#ifndef DISABLE_RF #ifndef DISABLE_RF
srslte_rf_close(&radio); srsran_rf_close(&radio);
#endif #endif
} }
if (net_port > 0) { if (net_port > 0) {
srslte_netsource_free(&net_source); srsran_netsource_free(&net_source);
sem_close(&net_sem); sem_close(&net_sem);
} }
} }
@ -467,7 +458,7 @@ static unsigned int reverse(register unsigned int x)
static uint32_t prbset_to_bitmask() static uint32_t prbset_to_bitmask()
{ {
uint32_t mask = 0; uint32_t mask = 0;
int nb = (int)ceilf((float)cell.nof_prb / srslte_ra_type0_P(cell.nof_prb)); int nb = (int)ceilf((float)cell.nof_prb / srsran_ra_type0_P(cell.nof_prb));
for (int i = 0; i < nb; i++) { for (int i = 0; i < nb; i++) {
if (i >= prbset_orig && i < prbset_orig + prbset_num) { if (i >= prbset_orig && i < prbset_orig + prbset_num) {
mask = mask | (0x1 << i); mask = mask | (0x1 << i);
@ -482,17 +473,17 @@ static int update_radl()
/* Configure cell and PDSCH in function of the transmission mode */ /* Configure cell and PDSCH in function of the transmission mode */
switch (transmission_mode) { switch (transmission_mode) {
case SRSLTE_TM1: case SRSRAN_TM1:
case SRSLTE_TM2: case SRSRAN_TM2:
nof_tb = 1; nof_tb = 1;
dci_dl.format = SRSLTE_DCI_FORMAT1; dci_dl.format = SRSRAN_DCI_FORMAT1;
break; break;
case SRSLTE_TM3: case SRSRAN_TM3:
dci_dl.format = SRSLTE_DCI_FORMAT2A; dci_dl.format = SRSRAN_DCI_FORMAT2A;
nof_tb = 2; nof_tb = 2;
break; break;
case SRSLTE_TM4: case SRSRAN_TM4:
dci_dl.format = SRSLTE_DCI_FORMAT2; dci_dl.format = SRSRAN_DCI_FORMAT2;
nof_tb = multiplex_nof_layers; nof_tb = multiplex_nof_layers;
if (multiplex_nof_layers == 1) { if (multiplex_nof_layers == 1) {
dci_dl.pinfo = (uint8_t)(multiplex_pmi + 1); dci_dl.pinfo = (uint8_t)(multiplex_pmi + 1);
@ -511,7 +502,7 @@ static int update_radl()
dci_dl.tb[0].ndi = 0; dci_dl.tb[0].ndi = 0;
dci_dl.tb[0].rv = rvidx[0]; dci_dl.tb[0].rv = rvidx[0];
dci_dl.tb[0].cw_idx = 0; dci_dl.tb[0].cw_idx = 0;
dci_dl.alloc_type = SRSLTE_RA_ALLOC_TYPE0; dci_dl.alloc_type = SRSRAN_RA_ALLOC_TYPE0;
dci_dl.type0_alloc.rbg_bitmask = prbset_to_bitmask(); dci_dl.type0_alloc.rbg_bitmask = prbset_to_bitmask();
if (nof_tb > 1) { if (nof_tb > 1) {
@ -520,11 +511,11 @@ static int update_radl()
dci_dl.tb[1].rv = rvidx[1]; dci_dl.tb[1].rv = rvidx[1];
dci_dl.tb[1].cw_idx = 1; dci_dl.tb[1].cw_idx = 1;
} else { } else {
SRSLTE_DCI_TB_DISABLE(dci_dl.tb[1]); SRSRAN_DCI_TB_DISABLE(dci_dl.tb[1]);
} }
srslte_dci_dl_fprint(stdout, &dci_dl, cell.nof_prb); srsran_dci_dl_fprint(stdout, &dci_dl, cell.nof_prb);
if (transmission_mode != SRSLTE_TM1) { if (transmission_mode != SRSRAN_TM1) {
printf("\nTransmission mode key table:\n"); printf("\nTransmission mode key table:\n");
printf(" Mode | 1TB | 2TB |\n"); printf(" Mode | 1TB | 2TB |\n");
printf("----------+---------+-----+\n"); printf("----------+---------+-----+\n");
@ -561,7 +552,7 @@ static int update_control()
if (input[0] == 27) { if (input[0] == 27) {
switch (input[2]) { switch (input[2]) {
case RIGHT_KEY: case RIGHT_KEY:
if (prbset_orig + prbset_num < (int)ceilf((float)cell.nof_prb / srslte_ra_type0_P(cell.nof_prb))) if (prbset_orig + prbset_num < (int)ceilf((float)cell.nof_prb / srsran_ra_type0_P(cell.nof_prb)))
prbset_orig++; prbset_orig++;
break; break;
case LEFT_KEY: case LEFT_KEY:
@ -569,7 +560,7 @@ static int update_control()
prbset_orig--; prbset_orig--;
break; break;
case UP_KEY: case UP_KEY:
if (prbset_num < (int)ceilf((float)cell.nof_prb / srslte_ra_type0_P(cell.nof_prb))) if (prbset_num < (int)ceilf((float)cell.nof_prb / srsran_ra_type0_P(cell.nof_prb)))
prbset_num++; prbset_num++;
break; break;
case DOWN_KEY: case DOWN_KEY:
@ -581,15 +572,15 @@ static int update_control()
case PAGE_UP: case PAGE_UP:
if (!output_file_name) { if (!output_file_name) {
rf_gain++; rf_gain++;
srslte_rf_set_tx_gain(&radio, rf_gain); srsran_rf_set_tx_gain(&radio, rf_gain);
printf("Set TX gain: %.1f dB\n", srslte_rf_get_tx_gain(&radio)); printf("Set TX gain: %.1f dB\n", srsran_rf_get_tx_gain(&radio));
} }
break; break;
case PAGE_DOWN: case PAGE_DOWN:
if (!output_file_name) { if (!output_file_name) {
rf_gain--; rf_gain--;
srslte_rf_set_tx_gain(&radio, rf_gain); srsran_rf_set_tx_gain(&radio, rf_gain);
printf("Set TX gain: %.1f dB\n", srslte_rf_get_tx_gain(&radio)); printf("Set TX gain: %.1f dB\n", srsran_rf_get_tx_gain(&radio));
} }
break; break;
#endif #endif
@ -597,40 +588,40 @@ static int update_control()
} else { } else {
switch (input[0]) { switch (input[0]) {
case 'q': case 'q':
transmission_mode = SRSLTE_TM4; transmission_mode = SRSRAN_TM4;
multiplex_pmi = 0; multiplex_pmi = 0;
multiplex_nof_layers = 1; multiplex_nof_layers = 1;
break; break;
case 'w': case 'w':
transmission_mode = SRSLTE_TM4; transmission_mode = SRSRAN_TM4;
multiplex_pmi = 1; multiplex_pmi = 1;
multiplex_nof_layers = 1; multiplex_nof_layers = 1;
break; break;
case 'e': case 'e':
transmission_mode = SRSLTE_TM4; transmission_mode = SRSRAN_TM4;
multiplex_pmi = 2; multiplex_pmi = 2;
multiplex_nof_layers = 1; multiplex_nof_layers = 1;
break; break;
case 'r': case 'r':
transmission_mode = SRSLTE_TM4; transmission_mode = SRSRAN_TM4;
multiplex_pmi = 3; multiplex_pmi = 3;
multiplex_nof_layers = 1; multiplex_nof_layers = 1;
break; break;
case 'a': case 'a':
transmission_mode = SRSLTE_TM4; transmission_mode = SRSRAN_TM4;
multiplex_pmi = 0; multiplex_pmi = 0;
multiplex_nof_layers = 2; multiplex_nof_layers = 2;
break; break;
case 's': case 's':
transmission_mode = SRSLTE_TM4; transmission_mode = SRSRAN_TM4;
multiplex_pmi = 1; multiplex_pmi = 1;
multiplex_nof_layers = 2; multiplex_nof_layers = 2;
break; break;
case 'z': case 'z':
transmission_mode = SRSLTE_TM3; transmission_mode = SRSRAN_TM3;
break; break;
case 'x': case 'x':
transmission_mode = SRSLTE_TM2; transmission_mode = SRSRAN_TM2;
break; break;
default: default:
last_mcs_idx = mcs_idx; last_mcs_idx = mcs_idx;
@ -662,7 +653,7 @@ static void* net_thread_fnc(void* arg)
int rpm = 0, wpm = 0; int rpm = 0, wpm = 0;
do { do {
n = srslte_netsource_read(&net_source, &data2[rpm], DATA_BUFF_SZ - rpm); n = srsran_netsource_read(&net_source, &data2[rpm], DATA_BUFF_SZ - rpm);
if (n > 0) { if (n > 0) {
// TODO: I assume that both transport blocks have same size in case of 2 tb are active // TODO: I assume that both transport blocks have same size in case of 2 tb are active
@ -703,19 +694,19 @@ static void* net_thread_fnc(void* arg)
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
int nf = 0, sf_idx = 0, N_id_2 = 0; int nf = 0, sf_idx = 0, N_id_2 = 0;
cf_t pss_signal[SRSLTE_PSS_LEN]; cf_t pss_signal[SRSRAN_PSS_LEN];
float sss_signal0[SRSLTE_SSS_LEN]; // for subframe 0 float sss_signal0[SRSRAN_SSS_LEN]; // for subframe 0
float sss_signal5[SRSLTE_SSS_LEN]; // for subframe 5 float sss_signal5[SRSRAN_SSS_LEN]; // for subframe 5
uint8_t bch_payload[SRSLTE_BCH_PAYLOAD_LEN]; uint8_t bch_payload[SRSRAN_BCH_PAYLOAD_LEN];
int i; int i;
cf_t* sf_symbols[SRSLTE_MAX_PORTS]; cf_t* sf_symbols[SRSRAN_MAX_PORTS];
srslte_dci_msg_t dci_msg; srsran_dci_msg_t dci_msg;
srslte_dci_location_t locations[SRSLTE_NOF_SF_X_FRAME][30]; srsran_dci_location_t locations[SRSRAN_NOF_SF_X_FRAME][30];
uint32_t sfn; uint32_t sfn;
srslte_refsignal_t csr_refs; srsran_refsignal_t csr_refs;
srslte_refsignal_t mbsfn_refs; srsran_refsignal_t mbsfn_refs;
srslte_debug_handle_crash(argc, argv); srsran_debug_handle_crash(argc, argv);
#ifdef DISABLE_RF #ifdef DISABLE_RF
if (argc < 3) { if (argc < 3) {
@ -726,7 +717,7 @@ int main(int argc, char** argv)
parse_args(argc, argv); parse_args(argc, argv);
srslte_use_standard_symbol_size(use_standard_lte_rate); srsran_use_standard_symbol_size(use_standard_lte_rate);
uint8_t mch_table[10]; uint8_t mch_table[10];
bzero(&mch_table[0], sizeof(uint8_t) * 10); bzero(&mch_table[0], sizeof(uint8_t) * 10);
@ -734,45 +725,45 @@ int main(int argc, char** argv)
generate_mcch_table(mch_table, mbsfn_sf_mask); generate_mcch_table(mch_table, mbsfn_sf_mask);
} }
N_id_2 = cell.id % 3; N_id_2 = cell.id % 3;
sf_n_re = 2 * SRSLTE_CP_NORM_NSYMB * cell.nof_prb * SRSLTE_NRE; sf_n_re = 2 * SRSRAN_CP_NORM_NSYMB * cell.nof_prb * SRSRAN_NRE;
sf_n_samples = 2 * SRSLTE_SLOT_LEN(srslte_symbol_sz(cell.nof_prb)); sf_n_samples = 2 * SRSRAN_SLOT_LEN(srsran_symbol_sz(cell.nof_prb));
cell.phich_length = SRSLTE_PHICH_NORM; cell.phich_length = SRSRAN_PHICH_NORM;
cell.phich_resources = SRSLTE_PHICH_R_1; cell.phich_resources = SRSRAN_PHICH_R_1;
sfn = 0; sfn = 0;
prbset_num = (int)ceilf((float)cell.nof_prb / srslte_ra_type0_P(cell.nof_prb)); prbset_num = (int)ceilf((float)cell.nof_prb / srsran_ra_type0_P(cell.nof_prb));
last_prbset_num = prbset_num; last_prbset_num = prbset_num;
/* this *must* be called after setting slot_len_* */ /* this *must* be called after setting slot_len_* */
base_init(); base_init();
/* Generate PSS/SSS signals */ /* Generate PSS/SSS signals */
srslte_pss_generate(pss_signal, N_id_2); srsran_pss_generate(pss_signal, N_id_2);
srslte_sss_generate(sss_signal0, sss_signal5, cell.id); srsran_sss_generate(sss_signal0, sss_signal5, cell.id);
/* Generate reference signals */ /* Generate reference signals */
if (srslte_refsignal_cs_init(&csr_refs, cell.nof_prb)) { if (srsran_refsignal_cs_init(&csr_refs, cell.nof_prb)) {
ERROR("Error initializing equalizer"); ERROR("Error initializing equalizer");
exit(-1); exit(-1);
} }
if (mbsfn_area_id > -1) { if (mbsfn_area_id > -1) {
if (srslte_refsignal_mbsfn_init(&mbsfn_refs, cell.nof_prb)) { if (srsran_refsignal_mbsfn_init(&mbsfn_refs, cell.nof_prb)) {
ERROR("Error initializing equalizer"); ERROR("Error initializing equalizer");
exit(-1); exit(-1);
} }
if (srslte_refsignal_mbsfn_set_cell(&mbsfn_refs, cell, mbsfn_area_id)) { if (srsran_refsignal_mbsfn_set_cell(&mbsfn_refs, cell, mbsfn_area_id)) {
ERROR("Error initializing MBSFNR signal"); ERROR("Error initializing MBSFNR signal");
exit(-1); exit(-1);
} }
} }
if (srslte_refsignal_cs_set_cell(&csr_refs, cell)) { if (srsran_refsignal_cs_set_cell(&csr_refs, cell)) {
ERROR("Error setting cell"); ERROR("Error setting cell");
exit(-1); exit(-1);
} }
for (i = 0; i < SRSLTE_MAX_PORTS; i++) { for (i = 0; i < SRSRAN_MAX_PORTS; i++) {
sf_symbols[i] = sf_buffer[i % cell.nof_ports]; sf_symbols[i] = sf_buffer[i % cell.nof_ports];
} }
@ -785,10 +776,10 @@ int main(int argc, char** argv)
signal(SIGINT, sig_int_handler); signal(SIGINT, sig_int_handler);
if (!output_file_name) { if (!output_file_name) {
int srate = srslte_sampling_freq_hz(cell.nof_prb); int srate = srsran_sampling_freq_hz(cell.nof_prb);
if (srate != -1) { if (srate != -1) {
printf("Setting sampling rate %.2f MHz\n", (float)srate / 1000000); printf("Setting sampling rate %.2f MHz\n", (float)srate / 1000000);
float srate_rf = srslte_rf_set_tx_srate(&radio, (double)srate); float srate_rf = srsran_rf_set_tx_srate(&radio, (double)srate);
if (srate_rf != srate) { if (srate_rf != srate) {
ERROR("Could not set sampling rate"); ERROR("Could not set sampling rate");
exit(-1); exit(-1);
@ -797,9 +788,9 @@ int main(int argc, char** argv)
ERROR("Invalid number of PRB %d", cell.nof_prb); ERROR("Invalid number of PRB %d", cell.nof_prb);
exit(-1); exit(-1);
} }
srslte_rf_set_tx_gain(&radio, rf_gain); srsran_rf_set_tx_gain(&radio, rf_gain);
printf("Set TX gain: %.1f dB\n", srslte_rf_get_tx_gain(&radio)); printf("Set TX gain: %.1f dB\n", srsran_rf_get_tx_gain(&radio));
printf("Set TX freq: %.2f MHz\n", srslte_rf_set_tx_freq(&radio, cell.nof_ports, rf_freq) / 1000000); printf("Set TX freq: %.2f MHz\n", srsran_rf_set_tx_freq(&radio, cell.nof_ports, rf_freq) / 1000000);
} }
#endif #endif
@ -815,21 +806,21 @@ int main(int argc, char** argv)
} }
pmch_cfg.pdsch_cfg.grant.tb[0].tbs = 1096; pmch_cfg.pdsch_cfg.grant.tb[0].tbs = 1096;
srslte_dl_sf_cfg_t dl_sf; srsran_dl_sf_cfg_t dl_sf;
ZERO_OBJECT(dl_sf); ZERO_OBJECT(dl_sf);
/* Initiate valid DCI locations */ /* Initiate valid DCI locations */
for (i = 0; i < SRSLTE_NOF_SF_X_FRAME; i++) { for (i = 0; i < SRSRAN_NOF_SF_X_FRAME; i++) {
dl_sf.cfi = cfi; dl_sf.cfi = cfi;
dl_sf.tti = i; dl_sf.tti = i;
srslte_pdcch_ue_locations(&pdcch, &dl_sf, locations[i], 30, UE_CRNTI); srsran_pdcch_ue_locations(&pdcch, &dl_sf, locations[i], 30, UE_CRNTI);
} }
nf = 0; nf = 0;
bool send_data = false; bool send_data = false;
for (i = 0; i < SRSLTE_MAX_CODEWORDS; i++) { for (i = 0; i < SRSRAN_MAX_CODEWORDS; i++) {
srslte_softbuffer_tx_reset(softbuffers[i]); srsran_softbuffer_tx_reset(softbuffers[i]);
} }
#ifndef DISABLE_RF #ifndef DISABLE_RF
@ -837,7 +828,7 @@ int main(int argc, char** argv)
#endif #endif
ZERO_OBJECT(pdsch_cfg); ZERO_OBJECT(pdsch_cfg);
for (uint32_t j = 0; j < SRSLTE_MAX_CODEWORDS; j++) { for (uint32_t j = 0; j < SRSRAN_MAX_CODEWORDS; j++) {
pdsch_cfg.softbuffers.tx[j] = softbuffers[j]; pdsch_cfg.softbuffers.tx[j] = softbuffers[j];
} }
pdsch_cfg.rnti = UE_CRNTI; pdsch_cfg.rnti = UE_CRNTI;
@ -845,13 +836,13 @@ int main(int argc, char** argv)
pmch_cfg.pdsch_cfg = pdsch_cfg; pmch_cfg.pdsch_cfg = pdsch_cfg;
while ((nf < nof_frames || nof_frames == -1) && !go_exit) { while ((nf < nof_frames || nof_frames == -1) && !go_exit) {
for (sf_idx = 0; sf_idx < SRSLTE_NOF_SF_X_FRAME && (nf < nof_frames || nof_frames == -1) && !go_exit; sf_idx++) { for (sf_idx = 0; sf_idx < SRSRAN_NOF_SF_X_FRAME && (nf < nof_frames || nof_frames == -1) && !go_exit; sf_idx++) {
/* Set Antenna port resource elements to zero */ /* Set Antenna port resource elements to zero */
srslte_vec_cf_zero(sf_symbols[0], sf_n_re); srsran_vec_cf_zero(sf_symbols[0], sf_n_re);
if (sf_idx == 0 || sf_idx == 5) { if (sf_idx == 0 || sf_idx == 5) {
srslte_pss_put_slot(pss_signal, sf_symbols[0], cell.nof_prb, SRSLTE_CP_NORM); srsran_pss_put_slot(pss_signal, sf_symbols[0], cell.nof_prb, SRSRAN_CP_NORM);
srslte_sss_put_slot(sf_idx ? sss_signal5 : sss_signal0, sf_symbols[0], cell.nof_prb, SRSLTE_CP_NORM); srsran_sss_put_slot(sf_idx ? sss_signal5 : sss_signal0, sf_symbols[0], cell.nof_prb, SRSRAN_CP_NORM);
} }
/* Copy zeros, SSS, PSS into the rest of antenna ports */ /* Copy zeros, SSS, PSS into the rest of antenna ports */
@ -860,23 +851,23 @@ int main(int argc, char** argv)
} }
if (mch_table[sf_idx] == 1 && mbsfn_area_id > -1) { if (mch_table[sf_idx] == 1 && mbsfn_area_id > -1) {
srslte_refsignal_mbsfn_put_sf(cell, 0, csr_refs.pilots[0][sf_idx], mbsfn_refs.pilots[0][sf_idx], sf_symbols[0]); srsran_refsignal_mbsfn_put_sf(cell, 0, csr_refs.pilots[0][sf_idx], mbsfn_refs.pilots[0][sf_idx], sf_symbols[0]);
} else { } else {
dl_sf.tti = nf * 10 + sf_idx; dl_sf.tti = nf * 10 + sf_idx;
for (i = 0; i < cell.nof_ports; i++) { for (i = 0; i < cell.nof_ports; i++) {
srslte_refsignal_cs_put_sf(&csr_refs, &dl_sf, (uint32_t)i, sf_symbols[i]); srsran_refsignal_cs_put_sf(&csr_refs, &dl_sf, (uint32_t)i, sf_symbols[i]);
} }
} }
srslte_pbch_mib_pack(&cell, sfn, bch_payload); srsran_pbch_mib_pack(&cell, sfn, bch_payload);
if (sf_idx == 0) { if (sf_idx == 0) {
srslte_pbch_encode(&pbch, bch_payload, sf_symbols, nf % 4); srsran_pbch_encode(&pbch, bch_payload, sf_symbols, nf % 4);
} }
dl_sf.tti = nf * 10 + sf_idx; dl_sf.tti = nf * 10 + sf_idx;
dl_sf.cfi = cfi; dl_sf.cfi = cfi;
srslte_pcfich_encode(&pcfich, &dl_sf, sf_symbols); srsran_pcfich_encode(&pcfich, &dl_sf, sf_symbols);
/* Update DL resource allocation from control port */ /* Update DL resource allocation from control port */
if (update_control()) { if (update_control()) {
@ -891,7 +882,7 @@ int main(int argc, char** argv)
} }
} else { } else {
INFO("SF: %d, Generating %d random bits", sf_idx, pdsch_cfg.grant.tb[0].tbs + pdsch_cfg.grant.tb[1].tbs); INFO("SF: %d, Generating %d random bits", sf_idx, pdsch_cfg.grant.tb[0].tbs + pdsch_cfg.grant.tb[1].tbs);
for (uint32_t tb = 0; tb < SRSLTE_MAX_CODEWORDS; tb++) { for (uint32_t tb = 0; tb < SRSRAN_MAX_CODEWORDS; tb++) {
if (pdsch_cfg.grant.tb[tb].enabled) { if (pdsch_cfg.grant.tb[tb].enabled) {
for (i = 0; i < pdsch_cfg.grant.tb[tb].tbs / 8; i++) { for (i = 0; i < pdsch_cfg.grant.tb[tb].tbs / 8; i++) {
data[tb][i] = (uint8_t)rand(); data[tb][i] = (uint8_t)rand();
@ -907,34 +898,34 @@ int main(int argc, char** argv)
} }
if (send_data) { if (send_data) {
if (mch_table[sf_idx] == 0 || mbsfn_area_id < 0) { // PDCCH + PDSCH if (mch_table[sf_idx] == 0 || mbsfn_area_id < 0) { // PDCCH + PDSCH
dl_sf.sf_type = SRSLTE_SF_NORM; dl_sf.sf_type = SRSRAN_SF_NORM;
/* Encode PDCCH */ /* Encode PDCCH */
INFO("Putting DCI to location: n=%d, L=%d", locations[sf_idx][0].ncce, locations[sf_idx][0].L); INFO("Putting DCI to location: n=%d, L=%d", locations[sf_idx][0].ncce, locations[sf_idx][0].L);
srslte_dci_msg_pack_pdsch(&cell, &dl_sf, NULL, &dci_dl, &dci_msg); srsran_dci_msg_pack_pdsch(&cell, &dl_sf, NULL, &dci_dl, &dci_msg);
dci_msg.location = locations[sf_idx][0]; dci_msg.location = locations[sf_idx][0];
if (srslte_pdcch_encode(&pdcch, &dl_sf, &dci_msg, sf_symbols)) { if (srsran_pdcch_encode(&pdcch, &dl_sf, &dci_msg, sf_symbols)) {
ERROR("Error encoding DCI message"); ERROR("Error encoding DCI message");
exit(-1); exit(-1);
} }
/* Configure pdsch_cfg parameters */ /* Configure pdsch_cfg parameters */
if (srslte_ra_dl_dci_to_grant(&cell, &dl_sf, transmission_mode, enable_256qam, &dci_dl, &pdsch_cfg.grant)) { if (srsran_ra_dl_dci_to_grant(&cell, &dl_sf, transmission_mode, enable_256qam, &dci_dl, &pdsch_cfg.grant)) {
ERROR("Error configuring PDSCH"); ERROR("Error configuring PDSCH");
exit(-1); exit(-1);
} }
/* Encode PDSCH */ /* Encode PDSCH */
if (srslte_pdsch_encode(&pdsch, &dl_sf, &pdsch_cfg, data, sf_symbols)) { if (srsran_pdsch_encode(&pdsch, &dl_sf, &pdsch_cfg, data, sf_symbols)) {
ERROR("Error encoding PDSCH"); ERROR("Error encoding PDSCH");
exit(-1); exit(-1);
} }
if (net_port > 0 && net_packet_ready) { if (net_port > 0 && net_packet_ready) {
if (null_file_sink) { if (null_file_sink) {
for (uint32_t tb = 0; tb < SRSLTE_MAX_CODEWORDS; tb++) { for (uint32_t tb = 0; tb < SRSRAN_MAX_CODEWORDS; tb++) {
srslte_bit_pack_vector(data[tb], data_tmp, pdsch_cfg.grant.tb[tb].tbs); srsran_bit_pack_vector(data[tb], data_tmp, pdsch_cfg.grant.tb[tb].tbs);
if (srslte_netsink_write(&net_sink, data_tmp, 1 + (pdsch_cfg.grant.tb[tb].tbs - 1) / 8) < 0) { if (srsran_netsink_write(&net_sink, data_tmp, 1 + (pdsch_cfg.grant.tb[tb].tbs - 1) / 8) < 0) {
ERROR("Error sending data through UDP socket"); ERROR("Error sending data through UDP socket");
} }
} }
@ -945,17 +936,17 @@ int main(int argc, char** argv)
} }
} }
} else { // We're sending MCH on subframe 1 - PDCCH + PMCH } else { // We're sending MCH on subframe 1 - PDCCH + PMCH
dl_sf.sf_type = SRSLTE_SF_MBSFN; dl_sf.sf_type = SRSRAN_SF_MBSFN;
/* Force 1 word and MCS 2 */ /* Force 1 word and MCS 2 */
dci_dl.rnti = SRSLTE_MRNTI; dci_dl.rnti = SRSRAN_MRNTI;
dci_dl.alloc_type = SRSLTE_RA_ALLOC_TYPE0; dci_dl.alloc_type = SRSRAN_RA_ALLOC_TYPE0;
dci_dl.type0_alloc.rbg_bitmask = 0xffffffff; dci_dl.type0_alloc.rbg_bitmask = 0xffffffff;
dci_dl.tb[0].mcs_idx = 2; dci_dl.tb[0].mcs_idx = 2;
dci_dl.format = SRSLTE_DCI_FORMAT1; dci_dl.format = SRSRAN_DCI_FORMAT1;
/* Configure pdsch_cfg parameters */ /* Configure pdsch_cfg parameters */
if (srslte_ra_dl_dci_to_grant(&cell, &dl_sf, SRSLTE_TM1, enable_256qam, &dci_dl, &pmch_cfg.pdsch_cfg.grant)) { if (srsran_ra_dl_dci_to_grant(&cell, &dl_sf, SRSRAN_TM1, enable_256qam, &dci_dl, &pmch_cfg.pdsch_cfg.grant)) {
ERROR("Error configuring PDSCH"); ERROR("Error configuring PDSCH");
exit(-1); exit(-1);
} }
@ -967,14 +958,14 @@ int main(int argc, char** argv)
pmch_cfg.area_id = mbsfn_area_id; pmch_cfg.area_id = mbsfn_area_id;
/* Encode PMCH */ /* Encode PMCH */
if (srslte_pmch_encode(&pmch, &dl_sf, &pmch_cfg, data_mbms, sf_symbols)) { if (srsran_pmch_encode(&pmch, &dl_sf, &pmch_cfg, data_mbms, sf_symbols)) {
ERROR("Error encoding PDSCH"); ERROR("Error encoding PDSCH");
exit(-1); exit(-1);
} }
if (net_port > 0 && net_packet_ready) { if (net_port > 0 && net_packet_ready) {
if (null_file_sink) { if (null_file_sink) {
srslte_bit_pack_vector(data[0], data_tmp, pmch_cfg.pdsch_cfg.grant.tb[0].tbs); srsran_bit_pack_vector(data[0], data_tmp, pmch_cfg.pdsch_cfg.grant.tb[0].tbs);
if (srslte_netsink_write(&net_sink, data_tmp, 1 + (pmch_cfg.pdsch_cfg.grant.tb[0].tbs - 1) / 8) < 0) { if (srsran_netsink_write(&net_sink, data_tmp, 1 + (pmch_cfg.pdsch_cfg.grant.tb[0].tbs - 1) / 8) < 0) {
ERROR("Error sending data through UDP socket"); ERROR("Error sending data through UDP socket");
} }
} }
@ -987,10 +978,10 @@ int main(int argc, char** argv)
/* Transform to OFDM symbols */ /* Transform to OFDM symbols */
if (mch_table[sf_idx] == 0 || mbsfn_area_id < 0) { if (mch_table[sf_idx] == 0 || mbsfn_area_id < 0) {
for (i = 0; i < cell.nof_ports; i++) { for (i = 0; i < cell.nof_ports; i++) {
srslte_ofdm_tx_sf(&ifft[i]); srsran_ofdm_tx_sf(&ifft[i]);
} }
} else { } else {
srslte_ofdm_tx_sf(&ifft_mbsfn); srsran_ofdm_tx_sf(&ifft_mbsfn);
} }
/* send to file or usrp */ /* send to file or usrp */
@ -998,22 +989,22 @@ int main(int argc, char** argv)
if (!null_file_sink) { if (!null_file_sink) {
/* Apply AWGN */ /* Apply AWGN */
if (output_file_snr != +INFINITY) { if (output_file_snr != +INFINITY) {
float var = srslte_convert_dB_to_amplitude(-(output_file_snr + 3.0f)); float var = srsran_convert_dB_to_amplitude(-(output_file_snr + 3.0f));
for (int k = 0; k < cell.nof_ports; k++) { for (int k = 0; k < cell.nof_ports; k++) {
srslte_ch_awgn_c(output_buffer[k], output_buffer[k], var, sf_n_samples); srsran_ch_awgn_c(output_buffer[k], output_buffer[k], var, sf_n_samples);
} }
} }
srslte_filesink_write_multi(&fsink, (void**)output_buffer, sf_n_samples, cell.nof_ports); srsran_filesink_write_multi(&fsink, (void**)output_buffer, sf_n_samples, cell.nof_ports);
} }
usleep(1000); usleep(1000);
} else { } else {
#ifndef DISABLE_RF #ifndef DISABLE_RF
float norm_factor = (float)cell.nof_prb / 15 / sqrtf(pdsch_cfg.grant.nof_prb); float norm_factor = (float)cell.nof_prb / 15 / sqrtf(pdsch_cfg.grant.nof_prb);
for (i = 0; i < cell.nof_ports; i++) { for (i = 0; i < cell.nof_ports; i++) {
srslte_vec_sc_prod_cfc( srsran_vec_sc_prod_cfc(
output_buffer[i], rf_amp * norm_factor, output_buffer[i], SRSLTE_SF_LEN_PRB(cell.nof_prb)); output_buffer[i], rf_amp * norm_factor, output_buffer[i], SRSRAN_SF_LEN_PRB(cell.nof_prb));
} }
srslte_rf_send_multi(&radio, (void**)output_buffer, sf_n_samples, true, start_of_burst, false); srsran_rf_send_multi(&radio, (void**)output_buffer, sf_n_samples, true, start_of_burst, false);
start_of_burst = false; start_of_burst = false;
#endif #endif
} }

@ -1,21 +1,12 @@
/** /**
* Copyright 2013-2021 Software Radio Systems Limited
*
* This file is part of srsLTE.
* *
* srsLTE is free software: you can redistribute it and/or modify * \section COPYRIGHT
* 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, * Copyright 2013-2021 Software Radio Systems Limited
* 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 * By using this file, you agree to the terms and conditions set
* the LICENSE file in the top-level directory of this distribution * forth in the LICENSE file which can be found at the top level of
* and at http://www.gnu.org/licenses/. * the distribution.
* *
*/ */
@ -31,21 +22,21 @@
#include <sys/time.h> #include <sys/time.h>
#include <unistd.h> #include <unistd.h>
#include "srslte/common/crash_handler.h" #include "srsran/common/crash_handler.h"
#include "srslte/common/gen_mch_tables.h" #include "srsran/common/gen_mch_tables.h"
#include "srslte/phy/io/filesink.h" #include "srsran/phy/io/filesink.h"
#include "srslte/srslte.h" #include "srsran/srsran.h"
#define ENABLE_AGC_DEFAULT #define ENABLE_AGC_DEFAULT
#ifndef DISABLE_RF #ifndef DISABLE_RF
#include "srslte/phy/rf/rf.h" #include "srsran/phy/rf/rf.h"
#include "srslte/phy/rf/rf_utils.h" #include "srsran/phy/rf/rf_utils.h"
cell_search_cfg_t cell_detect_config = {.max_frames_pbch = SRSLTE_DEFAULT_MAX_FRAMES_PBCH, cell_search_cfg_t cell_detect_config = {.max_frames_pbch = SRSRAN_DEFAULT_MAX_FRAMES_PBCH,
.max_frames_pss = SRSLTE_DEFAULT_MAX_FRAMES_PSS, .max_frames_pss = SRSRAN_DEFAULT_MAX_FRAMES_PSS,
.nof_valid_pss_frames = SRSLTE_DEFAULT_NOF_VALID_PSS_FRAMES, .nof_valid_pss_frames = SRSRAN_DEFAULT_NOF_VALID_PSS_FRAMES,
.init_agc = 0, .init_agc = 0,
.force_tdd = false}; .force_tdd = false};
@ -117,7 +108,7 @@ void args_default(prog_args_t* args)
args->disable_plots = false; args->disable_plots = false;
args->disable_plots_except_constellation = false; args->disable_plots_except_constellation = false;
args->nof_subframes = -1; args->nof_subframes = -1;
args->rnti = SRSLTE_SIRNTI; args->rnti = SRSRAN_SIRNTI;
args->force_N_id_2 = -1; // Pick the best args->force_N_id_2 = -1; // Pick the best
args->tdd_special_sf = -1; args->tdd_special_sf = -1;
args->sf_config = -1; args->sf_config = -1;
@ -197,7 +188,7 @@ void usage(prog_args_t* args, char* prog)
printf("\t-N Non-MBSFN region [Default %d]\n", args->non_mbsfn_region); printf("\t-N Non-MBSFN region [Default %d]\n", args->non_mbsfn_region);
printf("\t-q Enable/Disable 256QAM modulation (default %s)\n", args->enable_256qam ? "enabled" : "disabled"); printf("\t-q Enable/Disable 256QAM modulation (default %s)\n", args->enable_256qam ? "enabled" : "disabled");
printf("\t-Q Use standard LTE sample rates (default %s)\n", args->use_standard_lte_rate ? "enabled" : "disabled"); printf("\t-Q Use standard LTE sample rates (default %s)\n", args->use_standard_lte_rate ? "enabled" : "disabled");
printf("\t-v [set srslte_verbose to debug, default none]\n"); printf("\t-v [set srsran_verbose to debug, default none]\n");
} }
void parse_args(prog_args_t* args, int argc, char** argv) void parse_args(prog_args_t* args, int argc, char** argv)
@ -286,8 +277,8 @@ void parse_args(prog_args_t* args, int argc, char** argv)
args->disable_plots_except_constellation = true; args->disable_plots_except_constellation = true;
break; break;
case 'v': case 'v':
srslte_verbose++; srsran_verbose++;
args->verbose = srslte_verbose; args->verbose = srsran_verbose;
break; break;
case 'Z': case 'Z':
args->decimate = (int)strtol(argv[optind], NULL, 10); args->decimate = (int)strtol(argv[optind], NULL, 10);
@ -326,7 +317,7 @@ void parse_args(prog_args_t* args, int argc, char** argv)
/**********************************************************************/ /**********************************************************************/
uint8_t* data[SRSLTE_MAX_CODEWORDS]; uint8_t* data[SRSRAN_MAX_CODEWORDS];
bool go_exit = false; bool go_exit = false;
@ -340,23 +331,23 @@ void sig_int_handler(int signo)
} }
} }
cf_t* sf_buffer[SRSLTE_MAX_PORTS] = {NULL}; cf_t* sf_buffer[SRSRAN_MAX_PORTS] = {NULL};
#ifndef DISABLE_RF #ifndef DISABLE_RF
int srslte_rf_recv_wrapper(void* h, cf_t* data_[SRSLTE_MAX_PORTS], uint32_t nsamples, srslte_timestamp_t* t) int srsran_rf_recv_wrapper(void* h, cf_t* data_[SRSRAN_MAX_PORTS], uint32_t nsamples, srsran_timestamp_t* t)
{ {
DEBUG(" ---- Receive %d samples ----", nsamples); DEBUG(" ---- Receive %d samples ----", nsamples);
void* ptr[SRSLTE_MAX_PORTS]; void* ptr[SRSRAN_MAX_PORTS];
for (int i = 0; i < SRSLTE_MAX_PORTS; i++) { for (int i = 0; i < SRSRAN_MAX_PORTS; i++) {
ptr[i] = data_[i]; ptr[i] = data_[i];
} }
return srslte_rf_recv_with_time_multi(h, ptr, nsamples, true, NULL, NULL); return srsran_rf_recv_with_time_multi(h, ptr, nsamples, true, NULL, NULL);
} }
static SRSLTE_AGC_CALLBACK(srslte_rf_set_rx_gain_th_wrapper_) static SRSRAN_AGC_CALLBACK(srsran_rf_set_rx_gain_th_wrapper_)
{ {
srslte_rf_set_rx_gain_th((srslte_rf_t*)h, gain_db); srsran_rf_set_rx_gain_th((srsran_rf_t*)h, gain_db);
} }
#endif #endif
@ -365,18 +356,18 @@ extern float mean_exec_time;
enum receiver_state { DECODE_MIB, DECODE_PDSCH } state; enum receiver_state { DECODE_MIB, DECODE_PDSCH } state;
srslte_cell_t cell; srsran_cell_t cell;
srslte_ue_dl_t ue_dl; srsran_ue_dl_t ue_dl;
srslte_ue_dl_cfg_t ue_dl_cfg; srsran_ue_dl_cfg_t ue_dl_cfg;
srslte_dl_sf_cfg_t dl_sf; srsran_dl_sf_cfg_t dl_sf;
srslte_pdsch_cfg_t pdsch_cfg; srsran_pdsch_cfg_t pdsch_cfg;
srslte_ue_sync_t ue_sync; srsran_ue_sync_t ue_sync;
prog_args_t prog_args; prog_args_t prog_args;
uint32_t pkt_errors = 0, pkt_total = 0, nof_detected = 0, pmch_pkt_errors = 0, pmch_pkt_total = 0, nof_trials = 0; uint32_t pkt_errors = 0, pkt_total = 0, nof_detected = 0, pmch_pkt_errors = 0, pmch_pkt_total = 0, nof_trials = 0;
double evm = 0.0; double evm = 0.0;
srslte_netsink_t net_sink, net_sink_signal; srsran_netsink_t net_sink, net_sink_signal;
/* Useful macros for printing lines which will disappear */ /* Useful macros for printing lines which will disappear */
#define PRINT_LINE_INIT() \ #define PRINT_LINE_INIT() \
@ -395,14 +386,14 @@ int main(int argc, char** argv)
int ret; int ret;
#ifndef DISABLE_RF #ifndef DISABLE_RF
srslte_rf_t rf; srsran_rf_t rf;
#endif #endif
srslte_debug_handle_crash(argc, argv); srsran_debug_handle_crash(argc, argv);
parse_args(&prog_args, argc, argv); parse_args(&prog_args, argc, argv);
srslte_use_standard_symbol_size(prog_args.use_standard_lte_rate); srsran_use_standard_symbol_size(prog_args.use_standard_lte_rate);
#ifdef ENABLE_GUI #ifdef ENABLE_GUI
if (prog_args.mbsfn_area_id > -1) { if (prog_args.mbsfn_area_id > -1) {
@ -410,8 +401,8 @@ int main(int argc, char** argv)
} }
#endif /* ENABLE_GUI */ #endif /* ENABLE_GUI */
for (int i = 0; i < SRSLTE_MAX_CODEWORDS; i++) { for (int i = 0; i < SRSRAN_MAX_CODEWORDS; i++) {
data[i] = srslte_vec_u8_malloc(2000 * 8); data[i] = srsran_vec_u8_malloc(2000 * 8);
if (!data[i]) { if (!data[i]) {
ERROR("Allocating data"); ERROR("Allocating data");
go_exit = true; go_exit = true;
@ -441,19 +432,19 @@ int main(int argc, char** argv)
} }
if (prog_args.net_port > 0) { if (prog_args.net_port > 0) {
if (srslte_netsink_init(&net_sink, prog_args.net_address, prog_args.net_port, SRSLTE_NETSINK_UDP)) { if (srsran_netsink_init(&net_sink, prog_args.net_address, prog_args.net_port, SRSRAN_NETSINK_UDP)) {
ERROR("Error initiating UDP socket to %s:%d", prog_args.net_address, prog_args.net_port); ERROR("Error initiating UDP socket to %s:%d", prog_args.net_address, prog_args.net_port);
exit(-1); exit(-1);
} }
srslte_netsink_set_nonblocking(&net_sink); srsran_netsink_set_nonblocking(&net_sink);
} }
if (prog_args.net_port_signal > 0) { if (prog_args.net_port_signal > 0) {
if (srslte_netsink_init( if (srsran_netsink_init(
&net_sink_signal, prog_args.net_address_signal, prog_args.net_port_signal, SRSLTE_NETSINK_UDP)) { &net_sink_signal, prog_args.net_address_signal, prog_args.net_port_signal, SRSRAN_NETSINK_UDP)) {
ERROR("Error initiating UDP socket to %s:%d", prog_args.net_address_signal, prog_args.net_port_signal); ERROR("Error initiating UDP socket to %s:%d", prog_args.net_address_signal, prog_args.net_port_signal);
exit(-1); exit(-1);
} }
srslte_netsink_set_nonblocking(&net_sink_signal); srsran_netsink_set_nonblocking(&net_sink_signal);
} }
float search_cell_cfo = 0; float search_cell_cfo = 0;
@ -461,21 +452,21 @@ int main(int argc, char** argv)
#ifndef DISABLE_RF #ifndef DISABLE_RF
if (!prog_args.input_file_name) { if (!prog_args.input_file_name) {
printf("Opening RF device with %d RX antennas...\n", prog_args.rf_nof_rx_ant); printf("Opening RF device with %d RX antennas...\n", prog_args.rf_nof_rx_ant);
if (srslte_rf_open_devname(&rf, prog_args.rf_dev, prog_args.rf_args, prog_args.rf_nof_rx_ant)) { if (srsran_rf_open_devname(&rf, prog_args.rf_dev, prog_args.rf_args, prog_args.rf_nof_rx_ant)) {
fprintf(stderr, "Error opening rf\n"); fprintf(stderr, "Error opening rf\n");
exit(-1); exit(-1);
} }
/* Set receiver gain */ /* Set receiver gain */
if (prog_args.rf_gain > 0) { if (prog_args.rf_gain > 0) {
srslte_rf_set_rx_gain(&rf, prog_args.rf_gain); srsran_rf_set_rx_gain(&rf, prog_args.rf_gain);
} else { } else {
printf("Starting AGC thread...\n"); printf("Starting AGC thread...\n");
if (srslte_rf_start_gain_thread(&rf, false)) { if (srsran_rf_start_gain_thread(&rf, false)) {
ERROR("Error opening rf"); ERROR("Error opening rf");
exit(-1); exit(-1);
} }
srslte_rf_set_rx_gain(&rf, srslte_rf_get_rx_gain(&rf)); srsran_rf_set_rx_gain(&rf, srsran_rf_get_rx_gain(&rf));
cell_detect_config.init_agc = srslte_rf_get_rx_gain(&rf); cell_detect_config.init_agc = srsran_rf_get_rx_gain(&rf);
} }
sigset_t sigset; sigset_t sigset;
@ -486,7 +477,7 @@ int main(int argc, char** argv)
/* set receiver frequency */ /* set receiver frequency */
printf("Tunning receiver to %.3f MHz\n", (prog_args.rf_freq + prog_args.file_offset_freq) / 1000000); printf("Tunning receiver to %.3f MHz\n", (prog_args.rf_freq + prog_args.file_offset_freq) / 1000000);
srslte_rf_set_rx_freq(&rf, prog_args.rf_nof_rx_ant, prog_args.rf_freq + prog_args.file_offset_freq); srsran_rf_set_rx_freq(&rf, prog_args.rf_nof_rx_ant, prog_args.rf_freq + prog_args.file_offset_freq);
uint32_t ntrial = 0; uint32_t ntrial = 0;
do { do {
@ -501,15 +492,15 @@ int main(int argc, char** argv)
} while (ret == 0 && !go_exit); } while (ret == 0 && !go_exit);
if (go_exit) { if (go_exit) {
srslte_rf_close(&rf); srsran_rf_close(&rf);
exit(0); exit(0);
} }
/* set sampling frequency */ /* set sampling frequency */
int srate = srslte_sampling_freq_hz(cell.nof_prb); int srate = srsran_sampling_freq_hz(cell.nof_prb);
if (srate != -1) { if (srate != -1) {
printf("Setting sampling rate %.2f MHz\n", (float)srate / 1000000); printf("Setting sampling rate %.2f MHz\n", (float)srate / 1000000);
float srate_rf = srslte_rf_set_rx_srate(&rf, (double)srate); float srate_rf = srsran_rf_set_rx_srate(&rf, (double)srate);
if (srate_rf != srate) { if (srate_rf != srate) {
ERROR("Could not set sampling rate"); ERROR("Could not set sampling rate");
exit(-1); exit(-1);
@ -527,13 +518,13 @@ int main(int argc, char** argv)
if (prog_args.input_file_name) { if (prog_args.input_file_name) {
/* preset cell configuration */ /* preset cell configuration */
cell.id = prog_args.file_cell_id; cell.id = prog_args.file_cell_id;
cell.cp = SRSLTE_CP_NORM; cell.cp = SRSRAN_CP_NORM;
cell.phich_length = SRSLTE_PHICH_NORM; cell.phich_length = SRSRAN_PHICH_NORM;
cell.phich_resources = SRSLTE_PHICH_R_1; cell.phich_resources = SRSRAN_PHICH_R_1;
cell.nof_ports = prog_args.file_nof_ports; cell.nof_ports = prog_args.file_nof_ports;
cell.nof_prb = prog_args.file_nof_prb; cell.nof_prb = prog_args.file_nof_prb;
if (srslte_ue_sync_init_file_multi(&ue_sync, if (srsran_ue_sync_init_file_multi(&ue_sync,
prog_args.file_nof_prb, prog_args.file_nof_prb,
prog_args.input_file_name, prog_args.input_file_name,
prog_args.file_offset_time, prog_args.file_offset_time,
@ -553,42 +544,42 @@ int main(int argc, char** argv)
decimate = prog_args.decimate; decimate = prog_args.decimate;
} }
} }
if (srslte_ue_sync_init_multi_decim(&ue_sync, if (srsran_ue_sync_init_multi_decim(&ue_sync,
cell.nof_prb, cell.nof_prb,
cell.id == 1000, cell.id == 1000,
srslte_rf_recv_wrapper, srsran_rf_recv_wrapper,
prog_args.rf_nof_rx_ant, prog_args.rf_nof_rx_ant,
(void*)&rf, (void*)&rf,
decimate)) { decimate)) {
ERROR("Error initiating ue_sync"); ERROR("Error initiating ue_sync");
exit(-1); exit(-1);
} }
if (srslte_ue_sync_set_cell(&ue_sync, cell)) { if (srsran_ue_sync_set_cell(&ue_sync, cell)) {
ERROR("Error initiating ue_sync"); ERROR("Error initiating ue_sync");
exit(-1); exit(-1);
} }
#endif #endif
} }
uint32_t max_num_samples = 3 * SRSLTE_SF_LEN_PRB(cell.nof_prb); /// Length in complex samples uint32_t max_num_samples = 3 * SRSRAN_SF_LEN_PRB(cell.nof_prb); /// Length in complex samples
for (int i = 0; i < prog_args.rf_nof_rx_ant; i++) { for (int i = 0; i < prog_args.rf_nof_rx_ant; i++) {
sf_buffer[i] = srslte_vec_cf_malloc(max_num_samples); sf_buffer[i] = srsran_vec_cf_malloc(max_num_samples);
} }
srslte_ue_mib_t ue_mib; srsran_ue_mib_t ue_mib;
if (srslte_ue_mib_init(&ue_mib, sf_buffer[0], cell.nof_prb)) { if (srsran_ue_mib_init(&ue_mib, sf_buffer[0], cell.nof_prb)) {
ERROR("Error initaiting UE MIB decoder"); ERROR("Error initaiting UE MIB decoder");
exit(-1); exit(-1);
} }
if (srslte_ue_mib_set_cell(&ue_mib, cell)) { if (srsran_ue_mib_set_cell(&ue_mib, cell)) {
ERROR("Error initaiting UE MIB decoder"); ERROR("Error initaiting UE MIB decoder");
exit(-1); exit(-1);
} }
if (srslte_ue_dl_init(&ue_dl, sf_buffer, cell.nof_prb, prog_args.rf_nof_rx_ant)) { if (srsran_ue_dl_init(&ue_dl, sf_buffer, cell.nof_prb, prog_args.rf_nof_rx_ant)) {
ERROR("Error initiating UE downlink processing module"); ERROR("Error initiating UE downlink processing module");
exit(-1); exit(-1);
} }
if (srslte_ue_dl_set_cell(&ue_dl, cell)) { if (srsran_ue_dl_set_cell(&ue_dl, cell)) {
ERROR("Error initiating UE downlink processing module"); ERROR("Error initiating UE downlink processing module");
exit(-1); exit(-1);
} }
@ -597,7 +588,7 @@ int main(int argc, char** argv)
ue_sync.cfo_current_value = search_cell_cfo / 15000; ue_sync.cfo_current_value = search_cell_cfo / 15000;
ue_sync.cfo_is_copied = true; ue_sync.cfo_is_copied = true;
ue_sync.cfo_correct_enable_find = true; ue_sync.cfo_correct_enable_find = true;
srslte_sync_set_cfo_cp_enable(&ue_sync.sfind, false, 0); srsran_sync_set_cfo_cp_enable(&ue_sync.sfind, false, 0);
ZERO_OBJECT(ue_dl_cfg); ZERO_OBJECT(ue_dl_cfg);
ZERO_OBJECT(dl_sf); ZERO_OBJECT(dl_sf);
@ -605,38 +596,38 @@ int main(int argc, char** argv)
pdsch_cfg.meas_evm_en = true; pdsch_cfg.meas_evm_en = true;
if (cell.frame_type == SRSLTE_TDD && prog_args.tdd_special_sf >= 0 && prog_args.sf_config >= 0) { if (cell.frame_type == SRSRAN_TDD && prog_args.tdd_special_sf >= 0 && prog_args.sf_config >= 0) {
dl_sf.tdd_config.ss_config = prog_args.tdd_special_sf; dl_sf.tdd_config.ss_config = prog_args.tdd_special_sf;
dl_sf.tdd_config.sf_config = prog_args.sf_config; dl_sf.tdd_config.sf_config = prog_args.sf_config;
dl_sf.tdd_config.configured = true; dl_sf.tdd_config.configured = true;
} }
srslte_chest_dl_cfg_t chest_pdsch_cfg = {}; srsran_chest_dl_cfg_t chest_pdsch_cfg = {};
chest_pdsch_cfg.cfo_estimate_enable = prog_args.enable_cfo_ref; chest_pdsch_cfg.cfo_estimate_enable = prog_args.enable_cfo_ref;
chest_pdsch_cfg.cfo_estimate_sf_mask = 1023; chest_pdsch_cfg.cfo_estimate_sf_mask = 1023;
chest_pdsch_cfg.estimator_alg = srslte_chest_dl_str2estimator_alg(prog_args.estimator_alg); chest_pdsch_cfg.estimator_alg = srsran_chest_dl_str2estimator_alg(prog_args.estimator_alg);
chest_pdsch_cfg.sync_error_enable = true; chest_pdsch_cfg.sync_error_enable = true;
// Special configuration for MBSFN channel estimation // Special configuration for MBSFN channel estimation
srslte_chest_dl_cfg_t chest_mbsfn_cfg = {}; srsran_chest_dl_cfg_t chest_mbsfn_cfg = {};
chest_mbsfn_cfg.filter_type = SRSLTE_CHEST_FILTER_TRIANGLE; chest_mbsfn_cfg.filter_type = SRSRAN_CHEST_FILTER_TRIANGLE;
chest_mbsfn_cfg.filter_coef[0] = 0.1; chest_mbsfn_cfg.filter_coef[0] = 0.1;
chest_mbsfn_cfg.estimator_alg = SRSLTE_ESTIMATOR_ALG_INTERPOLATE; chest_mbsfn_cfg.estimator_alg = SRSRAN_ESTIMATOR_ALG_INTERPOLATE;
chest_mbsfn_cfg.noise_alg = SRSLTE_NOISE_ALG_PSS; chest_mbsfn_cfg.noise_alg = SRSRAN_NOISE_ALG_PSS;
// Allocate softbuffer buffers // Allocate softbuffer buffers
srslte_softbuffer_rx_t rx_softbuffers[SRSLTE_MAX_CODEWORDS]; srsran_softbuffer_rx_t rx_softbuffers[SRSRAN_MAX_CODEWORDS];
for (uint32_t i = 0; i < SRSLTE_MAX_CODEWORDS; i++) { for (uint32_t i = 0; i < SRSRAN_MAX_CODEWORDS; i++) {
pdsch_cfg.softbuffers.rx[i] = &rx_softbuffers[i]; pdsch_cfg.softbuffers.rx[i] = &rx_softbuffers[i];
srslte_softbuffer_rx_init(pdsch_cfg.softbuffers.rx[i], cell.nof_prb); srsran_softbuffer_rx_init(pdsch_cfg.softbuffers.rx[i], cell.nof_prb);
} }
pdsch_cfg.rnti = prog_args.rnti; pdsch_cfg.rnti = prog_args.rnti;
/* Configure MBSFN area id and non-MBSFN Region */ /* Configure MBSFN area id and non-MBSFN Region */
if (prog_args.mbsfn_area_id > -1) { if (prog_args.mbsfn_area_id > -1) {
srslte_ue_dl_set_mbsfn_area_id(&ue_dl, prog_args.mbsfn_area_id); srsran_ue_dl_set_mbsfn_area_id(&ue_dl, prog_args.mbsfn_area_id);
srslte_ue_dl_set_non_mbsfn_region(&ue_dl, prog_args.non_mbsfn_region); srsran_ue_dl_set_non_mbsfn_region(&ue_dl, prog_args.non_mbsfn_region);
} }
#ifdef ENABLE_GUI #ifdef ENABLE_GUI
@ -648,39 +639,39 @@ int main(int argc, char** argv)
#ifndef DISABLE_RF #ifndef DISABLE_RF
if (!prog_args.input_file_name) { if (!prog_args.input_file_name) {
srslte_rf_start_rx_stream(&rf, false); srsran_rf_start_rx_stream(&rf, false);
} }
#endif #endif
#ifndef DISABLE_RF #ifndef DISABLE_RF
if (prog_args.rf_gain < 0 && !prog_args.input_file_name) { if (prog_args.rf_gain < 0 && !prog_args.input_file_name) {
srslte_rf_info_t* rf_info = srslte_rf_get_info(&rf); srsran_rf_info_t* rf_info = srsran_rf_get_info(&rf);
srslte_ue_sync_start_agc(&ue_sync, srsran_ue_sync_start_agc(&ue_sync,
srslte_rf_set_rx_gain_th_wrapper_, srsran_rf_set_rx_gain_th_wrapper_,
rf_info->min_rx_gain, rf_info->min_rx_gain,
rf_info->max_rx_gain, rf_info->max_rx_gain,
cell_detect_config.init_agc); cell_detect_config.init_agc);
} }
#endif #endif
#ifdef PRINT_CHANGE_SCHEDULING #ifdef PRINT_CHANGE_SCHEDULING
srslte_ra_dl_grant_t old_dl_dci; srsran_ra_dl_grant_t old_dl_dci;
bzero(&old_dl_dci, sizeof(srslte_ra_dl_grant_t)); bzero(&old_dl_dci, sizeof(srsran_ra_dl_grant_t));
#endif #endif
ue_sync.cfo_correct_enable_track = !prog_args.disable_cfo; ue_sync.cfo_correct_enable_track = !prog_args.disable_cfo;
srslte_pbch_decode_reset(&ue_mib.pbch); srsran_pbch_decode_reset(&ue_mib.pbch);
INFO("\nEntering main loop..."); INFO("\nEntering main loop...");
// Variables for measurements // Variables for measurements
uint32_t nframes = 0; uint32_t nframes = 0;
float rsrp0 = 0.0, rsrp1 = 0.0, rsrq = 0.0, snr = 0.0, enodebrate = 0.0, uerate = 0.0, procrate = 0.0, float rsrp0 = 0.0, rsrp1 = 0.0, rsrq = 0.0, snr = 0.0, enodebrate = 0.0, uerate = 0.0, procrate = 0.0,
sinr[SRSLTE_MAX_LAYERS][SRSLTE_MAX_CODEBOOKS] = {}, sync_err[SRSLTE_MAX_PORTS][SRSLTE_MAX_PORTS] = {}; sinr[SRSRAN_MAX_LAYERS][SRSRAN_MAX_CODEBOOKS] = {}, sync_err[SRSRAN_MAX_PORTS][SRSRAN_MAX_PORTS] = {};
bool decode_pdsch = false; bool decode_pdsch = false;
for (int i = 0; i < SRSLTE_MAX_LAYERS; i++) { for (int i = 0; i < SRSRAN_MAX_LAYERS; i++) {
srslte_vec_f_zero(sinr[i], SRSLTE_MAX_CODEBOOKS); srsran_vec_f_zero(sinr[i], SRSRAN_MAX_CODEBOOKS);
} }
/* Main loop */ /* Main loop */
@ -700,12 +691,12 @@ int main(int argc, char** argv)
to.tv_usec = 0; to.tv_usec = 0;
/* Set default verbose level */ /* Set default verbose level */
srslte_verbose = prog_args.verbose; srsran_verbose = prog_args.verbose;
int n = select(1, &set, NULL, NULL, &to); int n = select(1, &set, NULL, NULL, &to);
if (n == 1) { if (n == 1) {
/* If a new line is detected set verbose level to Debug */ /* If a new line is detected set verbose level to Debug */
if (fgets(input, sizeof(input), stdin)) { if (fgets(input, sizeof(input), stdin)) {
srslte_verbose = SRSLTE_VERBOSE_DEBUG; srsran_verbose = SRSRAN_VERBOSE_DEBUG;
pkt_errors = 0; pkt_errors = 0;
pkt_total = 0; pkt_total = 0;
nof_detected = 0; nof_detected = 0;
@ -713,40 +704,40 @@ int main(int argc, char** argv)
} }
} }
cf_t* buffers[SRSLTE_MAX_CHANNELS] = {}; cf_t* buffers[SRSRAN_MAX_CHANNELS] = {};
for (int p = 0; p < SRSLTE_MAX_PORTS; p++) { for (int p = 0; p < SRSRAN_MAX_PORTS; p++) {
buffers[p] = sf_buffer[p]; buffers[p] = sf_buffer[p];
} }
ret = srslte_ue_sync_zerocopy(&ue_sync, buffers, max_num_samples); ret = srsran_ue_sync_zerocopy(&ue_sync, buffers, max_num_samples);
if (ret < 0) { if (ret < 0) {
ERROR("Error calling srslte_ue_sync_work()"); ERROR("Error calling srsran_ue_sync_work()");
} }
#ifdef CORRECT_SAMPLE_OFFSET #ifdef CORRECT_SAMPLE_OFFSET
float sample_offset = float sample_offset =
(float)srslte_ue_sync_get_last_sample_offset(&ue_sync) + srslte_ue_sync_get_sfo(&ue_sync) / 1000; (float)srsran_ue_sync_get_last_sample_offset(&ue_sync) + srsran_ue_sync_get_sfo(&ue_sync) / 1000;
srslte_ue_dl_set_sample_offset(&ue_dl, sample_offset); srsran_ue_dl_set_sample_offset(&ue_dl, sample_offset);
#endif #endif
/* srslte_ue_sync_get_buffer returns 1 if successfully read 1 aligned subframe */ /* srsran_ue_sync_get_buffer returns 1 if successfully read 1 aligned subframe */
if (ret == 1) { if (ret == 1) {
bool acks[SRSLTE_MAX_CODEWORDS] = {false}; bool acks[SRSRAN_MAX_CODEWORDS] = {false};
struct timeval t[3]; struct timeval t[3];
uint32_t sf_idx = srslte_ue_sync_get_sfidx(&ue_sync); uint32_t sf_idx = srsran_ue_sync_get_sfidx(&ue_sync);
switch (state) { switch (state) {
case DECODE_MIB: case DECODE_MIB:
if (sf_idx == 0) { if (sf_idx == 0) {
uint8_t bch_payload[SRSLTE_BCH_PAYLOAD_LEN]; uint8_t bch_payload[SRSRAN_BCH_PAYLOAD_LEN];
int sfn_offset; int sfn_offset;
n = srslte_ue_mib_decode(&ue_mib, bch_payload, NULL, &sfn_offset); n = srsran_ue_mib_decode(&ue_mib, bch_payload, NULL, &sfn_offset);
if (n < 0) { if (n < 0) {
ERROR("Error decoding UE MIB"); ERROR("Error decoding UE MIB");
exit(-1); exit(-1);
} else if (n == SRSLTE_UE_MIB_FOUND) { } else if (n == SRSRAN_UE_MIB_FOUND) {
srslte_pbch_mib_unpack(bch_payload, &cell, &sfn); srsran_pbch_mib_unpack(bch_payload, &cell, &sfn);
srslte_cell_fprint(stdout, &cell, sfn); srsran_cell_fprint(stdout, &cell, sfn);
printf("Decoded MIB. SFN: %d, offset: %d\n", sfn, sfn_offset); printf("Decoded MIB. SFN: %d, offset: %d\n", sfn, sfn_offset);
sfn = (sfn + sfn_offset) % 1024; sfn = (sfn + sfn_offset) % 1024;
state = DECODE_PDSCH; state = DECODE_PDSCH;
@ -755,9 +746,9 @@ int main(int argc, char** argv)
break; break;
case DECODE_PDSCH: case DECODE_PDSCH:
if (prog_args.rnti != SRSLTE_SIRNTI) { if (prog_args.rnti != SRSRAN_SIRNTI) {
decode_pdsch = true; decode_pdsch = true;
if (srslte_sfidx_tdd_type(dl_sf.tdd_config, sf_idx) == SRSLTE_TDD_SF_U) { if (srsran_sfidx_tdd_type(dl_sf.tdd_config, sf_idx) == SRSRAN_TDD_SF_U) {
decode_pdsch = false; decode_pdsch = false;
} }
} else { } else {
@ -773,14 +764,14 @@ int main(int argc, char** argv)
gettimeofday(&t[1], NULL); gettimeofday(&t[1], NULL);
if (decode_pdsch) { if (decode_pdsch) {
srslte_sf_t sf_type; srsran_sf_t sf_type;
if (mch_table[sf_idx] == 0 || prog_args.mbsfn_area_id < 0) { // Not an MBSFN subframe if (mch_table[sf_idx] == 0 || prog_args.mbsfn_area_id < 0) { // Not an MBSFN subframe
sf_type = SRSLTE_SF_NORM; sf_type = SRSRAN_SF_NORM;
// Set PDSCH channel estimation // Set PDSCH channel estimation
ue_dl_cfg.chest_cfg = chest_pdsch_cfg; ue_dl_cfg.chest_cfg = chest_pdsch_cfg;
} else { } else {
sf_type = SRSLTE_SF_MBSFN; sf_type = SRSRAN_SF_MBSFN;
// Set MBSFN channel estimation // Set MBSFN channel estimation
ue_dl_cfg.chest_cfg = chest_mbsfn_cfg; ue_dl_cfg.chest_cfg = chest_mbsfn_cfg;
@ -790,25 +781,25 @@ int main(int argc, char** argv)
for (uint32_t tm = 0; tm < 4 && !n; tm++) { for (uint32_t tm = 0; tm < 4 && !n; tm++) {
dl_sf.tti = tti; dl_sf.tti = tti;
dl_sf.sf_type = sf_type; dl_sf.sf_type = sf_type;
ue_dl_cfg.cfg.tm = (srslte_tm_t)tm; ue_dl_cfg.cfg.tm = (srsran_tm_t)tm;
ue_dl_cfg.cfg.pdsch.use_tbs_index_alt = prog_args.enable_256qam; ue_dl_cfg.cfg.pdsch.use_tbs_index_alt = prog_args.enable_256qam;
if ((ue_dl_cfg.cfg.tm == SRSLTE_TM1 && cell.nof_ports == 1) || if ((ue_dl_cfg.cfg.tm == SRSRAN_TM1 && cell.nof_ports == 1) ||
(ue_dl_cfg.cfg.tm > SRSLTE_TM1 && cell.nof_ports > 1)) { (ue_dl_cfg.cfg.tm > SRSRAN_TM1 && cell.nof_ports > 1)) {
n = srslte_ue_dl_find_and_decode(&ue_dl, &dl_sf, &ue_dl_cfg, &pdsch_cfg, data, acks); n = srsran_ue_dl_find_and_decode(&ue_dl, &dl_sf, &ue_dl_cfg, &pdsch_cfg, data, acks);
if (n > 0) { if (n > 0) {
nof_detected++; nof_detected++;
last_decoded_tm = tm; last_decoded_tm = tm;
for (uint32_t tb = 0; tb < SRSLTE_MAX_CODEWORDS; tb++) { for (uint32_t tb = 0; tb < SRSRAN_MAX_CODEWORDS; tb++) {
if (pdsch_cfg.grant.tb[tb].enabled) { if (pdsch_cfg.grant.tb[tb].enabled) {
if (!acks[tb]) { if (!acks[tb]) {
if (sf_type == SRSLTE_SF_NORM) { if (sf_type == SRSRAN_SF_NORM) {
pkt_errors++; pkt_errors++;
} else { } else {
pmch_pkt_errors++; pmch_pkt_errors++;
} }
} }
if (sf_type == SRSLTE_SF_NORM) { if (sf_type == SRSRAN_SF_NORM) {
pkt_total++; pkt_total++;
} else { } else {
pmch_pkt_total++; pmch_pkt_total++;
@ -820,7 +811,7 @@ int main(int argc, char** argv)
} }
// Feed-back ue_sync with chest_dl CFO estimation // Feed-back ue_sync with chest_dl CFO estimation
if (sf_idx == 5 && prog_args.enable_cfo_ref) { if (sf_idx == 5 && prog_args.enable_cfo_ref) {
srslte_ue_sync_set_cfo_ref(&ue_sync, ue_dl.chest_res.cfo); srsran_ue_sync_set_cfo_ref(&ue_sync, ue_dl.chest_res.cfo);
} }
gettimeofday(&t[2], NULL); gettimeofday(&t[2], NULL);
@ -830,25 +821,25 @@ int main(int argc, char** argv)
/* Send data if socket active */ /* Send data if socket active */
if (prog_args.net_port > 0) { if (prog_args.net_port > 0) {
if (sf_idx == 1) { if (sf_idx == 1) {
srslte_netsink_write(&net_sink, data[0], 1 + (n - 1) / 8); srsran_netsink_write(&net_sink, data[0], 1 + (n - 1) / 8);
} else { } else {
// TODO: UDP Data transmission does not work // TODO: UDP Data transmission does not work
for (uint32_t tb = 0; tb < SRSLTE_MAX_CODEWORDS; tb++) { for (uint32_t tb = 0; tb < SRSRAN_MAX_CODEWORDS; tb++) {
if (pdsch_cfg.grant.tb[tb].enabled) { if (pdsch_cfg.grant.tb[tb].enabled) {
srslte_netsink_write(&net_sink, data[tb], 1 + (pdsch_cfg.grant.tb[tb].tbs - 1) / 8); srsran_netsink_write(&net_sink, data[tb], 1 + (pdsch_cfg.grant.tb[tb].tbs - 1) / 8);
} }
} }
} }
} }
#ifdef PRINT_CHANGE_SCHEDULING #ifdef PRINT_CHANGE_SCHEDULING
if (pdsch_cfg.dci.cw[0].mcs_idx != old_dl_dci.cw[0].mcs_idx || if (pdsch_cfg.dci.cw[0].mcs_idx != old_dl_dci.cw[0].mcs_idx ||
memcmp(&pdsch_cfg.dci.type0_alloc, &old_dl_dci.type0_alloc, sizeof(srslte_ra_type0_t)) || memcmp(&pdsch_cfg.dci.type0_alloc, &old_dl_dci.type0_alloc, sizeof(srsran_ra_type0_t)) ||
memcmp(&pdsch_cfg.dci.type1_alloc, &old_dl_dci.type1_alloc, sizeof(srslte_ra_type1_t)) || memcmp(&pdsch_cfg.dci.type1_alloc, &old_dl_dci.type1_alloc, sizeof(srsran_ra_type1_t)) ||
memcmp(&pdsch_cfg.dci.type2_alloc, &old_dl_dci.type2_alloc, sizeof(srslte_ra_type2_t))) { memcmp(&pdsch_cfg.dci.type2_alloc, &old_dl_dci.type2_alloc, sizeof(srsran_ra_type2_t))) {
old_dl_dci = pdsch_cfg.dci; old_dl_dci = pdsch_cfg.dci;
fflush(stdout); fflush(stdout);
printf("DCI %s\n", srslte_dci_format_string(pdsch_cfg.dci.dci_format)); printf("DCI %s\n", srsran_dci_format_string(pdsch_cfg.dci.dci_format));
srslte_ra_pdsch_fprint(stdout, &old_dl_dci, cell.nof_prb); srsran_ra_pdsch_fprint(stdout, &old_dl_dci, cell.nof_prb);
} }
#endif #endif
} }
@ -858,16 +849,16 @@ int main(int argc, char** argv)
uint32_t enb_bits = ((pdsch_cfg.grant.tb[0].enabled ? pdsch_cfg.grant.tb[0].tbs : 0) + uint32_t enb_bits = ((pdsch_cfg.grant.tb[0].enabled ? pdsch_cfg.grant.tb[0].tbs : 0) +
(pdsch_cfg.grant.tb[1].enabled ? pdsch_cfg.grant.tb[1].tbs : 0)); (pdsch_cfg.grant.tb[1].enabled ? pdsch_cfg.grant.tb[1].tbs : 0));
uint32_t ue_bits = ((acks[0] ? pdsch_cfg.grant.tb[0].tbs : 0) + (acks[1] ? pdsch_cfg.grant.tb[1].tbs : 0)); uint32_t ue_bits = ((acks[0] ? pdsch_cfg.grant.tb[0].tbs : 0) + (acks[1] ? pdsch_cfg.grant.tb[1].tbs : 0));
rsrq = SRSLTE_VEC_EMA(ue_dl.chest_res.rsrp_dbm, rsrq, 0.1f); rsrq = SRSRAN_VEC_EMA(ue_dl.chest_res.rsrp_dbm, rsrq, 0.1f);
rsrp0 = SRSLTE_VEC_EMA(ue_dl.chest_res.rsrp_port_dbm[0], rsrp0, 0.05f); rsrp0 = SRSRAN_VEC_EMA(ue_dl.chest_res.rsrp_port_dbm[0], rsrp0, 0.05f);
rsrp1 = SRSLTE_VEC_EMA(ue_dl.chest_res.rsrp_port_dbm[1], rsrp1, 0.05f); rsrp1 = SRSRAN_VEC_EMA(ue_dl.chest_res.rsrp_port_dbm[1], rsrp1, 0.05f);
snr = SRSLTE_VEC_EMA(ue_dl.chest_res.snr_db, snr, 0.05f); snr = SRSRAN_VEC_EMA(ue_dl.chest_res.snr_db, snr, 0.05f);
enodebrate = SRSLTE_VEC_EMA(enb_bits / 1000.0f, enodebrate, 0.05f); enodebrate = SRSRAN_VEC_EMA(enb_bits / 1000.0f, enodebrate, 0.05f);
uerate = SRSLTE_VEC_EMA(ue_bits / 1000.0f, uerate, 0.001f); uerate = SRSRAN_VEC_EMA(ue_bits / 1000.0f, uerate, 0.001f);
if (chest_pdsch_cfg.sync_error_enable) { if (chest_pdsch_cfg.sync_error_enable) {
for (uint32_t i = 0; i < cell.nof_ports; i++) { for (uint32_t i = 0; i < cell.nof_ports; i++) {
for (uint32_t j = 0; j < prog_args.rf_nof_rx_ant; j++) { for (uint32_t j = 0; j < prog_args.rf_nof_rx_ant; j++) {
sync_err[i][j] = SRSLTE_VEC_EMA(ue_dl.chest.sync_err[i][j], sync_err[i][j], 0.001f); sync_err[i][j] = SRSRAN_VEC_EMA(ue_dl.chest.sync_err[i][j], sync_err[i][j], 0.001f);
if (!isnormal(sync_err[i][j])) { if (!isnormal(sync_err[i][j])) {
sync_err[i][j] = 0.0f; sync_err[i][j] = 0.0f;
} }
@ -876,7 +867,7 @@ int main(int argc, char** argv)
} }
float elapsed = (float)t[0].tv_usec + t[0].tv_sec * 1.0e+6f; float elapsed = (float)t[0].tv_usec + t[0].tv_sec * 1.0e+6f;
if (elapsed != 0.0f) { if (elapsed != 0.0f) {
procrate = SRSLTE_VEC_EMA(ue_bits / elapsed, procrate, 0.01f); procrate = SRSRAN_VEC_EMA(ue_bits / elapsed, procrate, 0.01f);
} }
nframes++; nframes++;
@ -898,13 +889,13 @@ int main(int argc, char** argv)
if (sf_idx == 5) { if (sf_idx == 5) {
float gain = prog_args.rf_gain; float gain = prog_args.rf_gain;
if (gain < 0) { if (gain < 0) {
gain = srslte_convert_power_to_dB(srslte_agc_get_gain(&ue_sync.agc)); gain = srsran_convert_power_to_dB(srsran_agc_get_gain(&ue_sync.agc));
} }
/* Print transmission scheme */ /* Print transmission scheme */
/* Print basic Parameters */ /* Print basic Parameters */
PRINT_LINE(" CFO: %+7.2f Hz", srslte_ue_sync_get_cfo(&ue_sync)); PRINT_LINE(" CFO: %+7.2f Hz", srsran_ue_sync_get_cfo(&ue_sync));
PRINT_LINE(" RSRP: %+5.1f dBm | %+5.1f dBm", rsrp0, rsrp1); PRINT_LINE(" RSRP: %+5.1f dBm | %+5.1f dBm", rsrp0, rsrp1);
PRINT_LINE(" SNR: %+5.1f dB", snr); PRINT_LINE(" SNR: %+5.1f dB", snr);
PRINT_LINE(" TM: %d", last_decoded_tm + 1); PRINT_LINE(" TM: %d", last_decoded_tm + 1);
@ -926,7 +917,7 @@ int main(int argc, char** argv)
uint32_t ri = 0; uint32_t ri = 0;
float cn = 0; float cn = 0;
/* Compute condition number */ /* Compute condition number */
if (srslte_ue_dl_select_ri(&ue_dl, &ri, &cn)) { if (srsran_ue_dl_select_ri(&ue_dl, &ri, &cn)) {
/* Condition number calculation is not supported for the number of tx & rx antennas*/ /* Condition number calculation is not supported for the number of tx & rx antennas*/
PRINT_LINE(" κ: NA"); PRINT_LINE(" κ: NA");
} else { } else {
@ -971,12 +962,12 @@ int main(int argc, char** argv)
#endif /* ENABLE_GUI */ #endif /* ENABLE_GUI */
} else if (ret == 0) { } else if (ret == 0) {
printf("Finding PSS... Peak: %8.1f, FrameCnt: %d, State: %d\r", printf("Finding PSS... Peak: %8.1f, FrameCnt: %d, State: %d\r",
srslte_sync_get_peak_value(&ue_sync.sfind), srsran_sync_get_peak_value(&ue_sync.sfind),
ue_sync.frame_total_cnt, ue_sync.frame_total_cnt,
ue_sync.state); ue_sync.state);
#ifdef ENABLE_GUI #ifdef ENABLE_GUI
if (!prog_args.disable_plots) { if (!prog_args.disable_plots) {
plot_sf_idx = srslte_ue_sync_get_sfidx(&ue_sync); plot_sf_idx = srsran_ue_sync_get_sfidx(&ue_sync);
plot_track = false; plot_track = false;
sem_post(&plot_sem); sem_post(&plot_sem);
} }
@ -994,9 +985,9 @@ int main(int argc, char** argv)
} }
} }
#endif #endif
srslte_ue_dl_free(&ue_dl); srsran_ue_dl_free(&ue_dl);
srslte_ue_sync_free(&ue_sync); srsran_ue_sync_free(&ue_sync);
for (int i = 0; i < SRSLTE_MAX_CODEWORDS; i++) { for (int i = 0; i < SRSRAN_MAX_CODEWORDS; i++) {
if (data[i]) { if (data[i]) {
free(data[i]); free(data[i]);
} }
@ -1009,8 +1000,8 @@ int main(int argc, char** argv)
#ifndef DISABLE_RF #ifndef DISABLE_RF
if (!prog_args.input_file_name) { if (!prog_args.input_file_name) {
srslte_ue_mib_free(&ue_mib); srsran_ue_mib_free(&ue_mib);
srslte_rf_close(&rf); srsran_rf_close(&rf);
} }
#endif #endif
@ -1032,7 +1023,7 @@ static float tmp_plot2[110 * 15 * 2048];
void* plot_thread_run(void* arg) void* plot_thread_run(void* arg)
{ {
int i; int i;
uint32_t nof_re = SRSLTE_SF_LEN_RE(ue_dl.cell.nof_prb, ue_dl.cell.cp); uint32_t nof_re = SRSRAN_SF_LEN_RE(ue_dl.cell.nof_prb, ue_dl.cell.cp);
sdrgui_init(); sdrgui_init();
@ -1077,18 +1068,18 @@ void* plot_thread_run(void* arg)
uint32_t nof_symbols = pdsch_cfg.grant.nof_re; uint32_t nof_symbols = pdsch_cfg.grant.nof_re;
if (!prog_args.disable_plots_except_constellation) { if (!prog_args.disable_plots_except_constellation) {
for (i = 0; i < nof_re; i++) { for (i = 0; i < nof_re; i++) {
tmp_plot[i] = srslte_convert_amplitude_to_dB(cabsf(ue_dl.sf_symbols[0][i])); tmp_plot[i] = srsran_convert_amplitude_to_dB(cabsf(ue_dl.sf_symbols[0][i]));
if (isinf(tmp_plot[i])) { if (isinf(tmp_plot[i])) {
tmp_plot[i] = -80; tmp_plot[i] = -80;
} }
} }
int sz = srslte_symbol_sz(ue_dl.cell.nof_prb); int sz = srsran_symbol_sz(ue_dl.cell.nof_prb);
if (sz > 0) { if (sz > 0) {
srslte_vec_f_zero(tmp_plot2, sz); srsran_vec_f_zero(tmp_plot2, sz);
} }
int g = (sz - 12 * ue_dl.cell.nof_prb) / 2; int g = (sz - 12 * ue_dl.cell.nof_prb) / 2;
for (i = 0; i < 12 * ue_dl.cell.nof_prb; i++) { for (i = 0; i < 12 * ue_dl.cell.nof_prb; i++) {
tmp_plot2[g + i] = srslte_convert_amplitude_to_dB(cabsf(ue_dl.chest_res.ce[0][0][i])); tmp_plot2[g + i] = srsran_convert_amplitude_to_dB(cabsf(ue_dl.chest_res.ce[0][0][i]));
if (isinf(tmp_plot2[g + i])) { if (isinf(tmp_plot2[g + i])) {
tmp_plot2[g + i] = -80; tmp_plot2[g + i] = -80;
} }
@ -1097,17 +1088,17 @@ void* plot_thread_run(void* arg)
if (!prog_args.input_file_name) { if (!prog_args.input_file_name) {
if (plot_track) { if (plot_track) {
srslte_pss_t* pss_obj = srslte_sync_get_cur_pss_obj(&ue_sync.strack); srsran_pss_t* pss_obj = srsran_sync_get_cur_pss_obj(&ue_sync.strack);
int max = srslte_vec_max_fi(pss_obj->conv_output_avg, pss_obj->frame_size + pss_obj->fft_size - 1); int max = srsran_vec_max_fi(pss_obj->conv_output_avg, pss_obj->frame_size + pss_obj->fft_size - 1);
srslte_vec_sc_prod_fff(pss_obj->conv_output_avg, srsran_vec_sc_prod_fff(pss_obj->conv_output_avg,
1 / pss_obj->conv_output_avg[max], 1 / pss_obj->conv_output_avg[max],
tmp_plot2, tmp_plot2,
pss_obj->frame_size + pss_obj->fft_size - 1); pss_obj->frame_size + pss_obj->fft_size - 1);
plot_real_setNewData(&p_sync, tmp_plot2, pss_obj->frame_size); plot_real_setNewData(&p_sync, tmp_plot2, pss_obj->frame_size);
} else { } else {
int max = srslte_vec_max_fi(ue_sync.sfind.pss.conv_output_avg, int max = srsran_vec_max_fi(ue_sync.sfind.pss.conv_output_avg,
ue_sync.sfind.pss.frame_size + ue_sync.sfind.pss.fft_size - 1); ue_sync.sfind.pss.frame_size + ue_sync.sfind.pss.fft_size - 1);
srslte_vec_sc_prod_fff(ue_sync.sfind.pss.conv_output_avg, srsran_vec_sc_prod_fff(ue_sync.sfind.pss.conv_output_avg,
1 / ue_sync.sfind.pss.conv_output_avg[max], 1 / ue_sync.sfind.pss.conv_output_avg[max],
tmp_plot2, tmp_plot2,
ue_sync.sfind.pss.frame_size + ue_sync.sfind.pss.fft_size - 1); ue_sync.sfind.pss.frame_size + ue_sync.sfind.pss.fft_size - 1);
@ -1126,8 +1117,8 @@ void* plot_thread_run(void* arg)
if (plot_sf_idx == 1) { if (plot_sf_idx == 1) {
if (prog_args.net_port_signal > 0) { if (prog_args.net_port_signal > 0) {
srslte_netsink_write( srsran_netsink_write(
&net_sink_signal, &sf_buffer[srslte_ue_sync_sf_len(&ue_sync) / 7], srslte_ue_sync_sf_len(&ue_sync)); &net_sink_signal, &sf_buffer[srsran_ue_sync_sf_len(&ue_sync) / 7], srsran_ue_sync_sf_len(&ue_sync));
} }
} }
} }

@ -1,21 +1,12 @@
/** /**
* Copyright 2013-2021 Software Radio Systems Limited
*
* This file is part of srsLTE.
* *
* srsLTE is free software: you can redistribute it and/or modify * \section COPYRIGHT
* 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, * Copyright 2013-2021 Software Radio Systems Limited
* 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 * By using this file, you agree to the terms and conditions set
* the LICENSE file in the top-level directory of this distribution * forth in the LICENSE file which can be found at the top level of
* and at http://www.gnu.org/licenses/. * the distribution.
* *
*/ */
@ -27,25 +18,25 @@
#include <strings.h> #include <strings.h>
#include <unistd.h> #include <unistd.h>
#include "srslte/common/pcap.h" #include "srsran/common/pcap.h"
#include "srslte/phy/ch_estimation/chest_sl.h" #include "srsran/phy/ch_estimation/chest_sl.h"
#include "srslte/phy/common/phy_common_sl.h" #include "srsran/phy/common/phy_common_sl.h"
#include "srslte/phy/dft/ofdm.h" #include "srsran/phy/dft/ofdm.h"
#include "srslte/phy/phch/pscch.h" #include "srsran/phy/phch/pscch.h"
#include "srslte/phy/phch/pssch.h" #include "srsran/phy/phch/pssch.h"
#include "srslte/phy/phch/ra_sl.h" #include "srsran/phy/phch/ra_sl.h"
#include "srslte/phy/phch/sci.h" #include "srsran/phy/phch/sci.h"
#include "srslte/phy/rf/rf.h" #include "srsran/phy/rf/rf.h"
#include "srslte/phy/ue/ue_sync.h" #include "srsran/phy/ue/ue_sync.h"
#include "srslte/phy/utils/bit.h" #include "srsran/phy/utils/bit.h"
#include "srslte/phy/utils/debug.h" #include "srsran/phy/utils/debug.h"
#include "srslte/phy/utils/vector.h" #include "srsran/phy/utils/vector.h"
#define PCAP_FILENAME "/tmp/pssch.pcap" #define PCAP_FILENAME "/tmp/pssch.pcap"
static bool keep_running = true; static bool keep_running = true;
static srslte_cell_sl_t cell_sl = {.nof_prb = 50, .tm = SRSLTE_SIDELINK_TM4, .cp = SRSLTE_CP_NORM, .N_sl_id = 0}; static srsran_cell_sl_t cell_sl = {.nof_prb = 50, .tm = SRSRAN_SIDELINK_TM4, .cp = SRSRAN_CP_NORM, .N_sl_id = 0};
typedef struct { typedef struct {
bool use_standard_lte_rates; bool use_standard_lte_rates;
@ -79,16 +70,16 @@ void args_default(prog_args_t* args)
args->num_sub_channel = 5; args->num_sub_channel = 5;
} }
static srslte_pscch_t pscch = {}; // Defined global for plotting thread static srsran_pscch_t pscch = {}; // Defined global for plotting thread
static srslte_pssch_t pssch = {}; static srsran_pssch_t pssch = {};
#ifndef DISABLE_RF #ifndef DISABLE_RF
static srslte_rf_t radio; static srsran_rf_t radio;
#endif // DISABLE_RF #endif // DISABLE_RF
static prog_args_t prog_args; static prog_args_t prog_args;
static srslte_filesource_t fsrc = {}; static srsran_filesource_t fsrc = {};
#ifdef ENABLE_GUI #ifdef ENABLE_GUI
#include "srsgui/srsgui.h" #include "srsgui/srsgui.h"
@ -124,8 +115,8 @@ void pcap_pack_and_write(FILE* pcap_file,
.ueid = 1, .ueid = 1,
.isRetx = reTX, .isRetx = reTX,
.crcStatusOK = crc_ok, .crcStatusOK = crc_ok,
.sysFrameNumber = (uint16_t)(tti / SRSLTE_NOF_SF_X_FRAME), .sysFrameNumber = (uint16_t)(tti / SRSRAN_NOF_SF_X_FRAME),
.subFrameNumber = (uint16_t)(tti % SRSLTE_NOF_SF_X_FRAME), .subFrameNumber = (uint16_t)(tti % SRSRAN_NOF_SF_X_FRAME),
.nbiotMode = 0}; .nbiotMode = 0};
if (pdu) { if (pdu) {
LTE_PCAP_MAC_WritePDU(pcap_file, &context, pdu, pdu_len_bytes); LTE_PCAP_MAC_WritePDU(pcap_file, &context, pdu, pdu_len_bytes);
@ -150,7 +141,7 @@ void usage(prog_args_t* args, char* prog)
#ifdef ENABLE_GUI #ifdef ENABLE_GUI
printf("\t-w disable plots [Default enabled]\n"); printf("\t-w disable plots [Default enabled]\n");
#endif #endif
printf("\t-v srslte_verbose\n"); printf("\t-v srsran_verbose\n");
} }
void parse_args(prog_args_t* args, int argc, char** argv) void parse_args(prog_args_t* args, int argc, char** argv)
@ -188,7 +179,7 @@ void parse_args(prog_args_t* args, int argc, char** argv)
args->nof_rx_antennas = (int32_t)strtol(argv[optind], NULL, 10); args->nof_rx_antennas = (int32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'v': case 'v':
srslte_verbose++; srsran_verbose++;
break; break;
case 'w': case 'w':
args->disable_plots = true; args->disable_plots = true;
@ -208,14 +199,14 @@ void parse_args(prog_args_t* args, int argc, char** argv)
} }
#ifndef DISABLE_RF #ifndef DISABLE_RF
int srslte_rf_recv_wrapper(void* h, cf_t* data[SRSLTE_MAX_PORTS], uint32_t nsamples, srslte_timestamp_t* t) int srsran_rf_recv_wrapper(void* h, cf_t* data[SRSRAN_MAX_PORTS], uint32_t nsamples, srsran_timestamp_t* t)
{ {
DEBUG(" ---- Receive %d samples ----", nsamples); DEBUG(" ---- Receive %d samples ----", nsamples);
void* ptr[SRSLTE_MAX_PORTS]; void* ptr[SRSRAN_MAX_PORTS];
for (int i = 0; i < SRSLTE_MAX_PORTS; i++) { for (int i = 0; i < SRSRAN_MAX_PORTS; i++) {
ptr[i] = data[i]; ptr[i] = data[i];
} }
return srslte_rf_recv_with_time_multi(h, ptr, nsamples, true, &t->full_secs, &t->frac_secs); return srsran_rf_recv_with_time_multi(h, ptr, nsamples, true, &t->full_secs, &t->frac_secs);
} }
#endif // DISABLE_RF #endif // DISABLE_RF
@ -234,18 +225,18 @@ int main(int argc, char** argv)
FILE* pcap_file = LTE_PCAP_Open(MAC_LTE_DLT, PCAP_FILENAME); FILE* pcap_file = LTE_PCAP_Open(MAC_LTE_DLT, PCAP_FILENAME);
srslte_use_standard_symbol_size(prog_args.use_standard_lte_rates); srsran_use_standard_symbol_size(prog_args.use_standard_lte_rates);
srslte_sl_comm_resource_pool_t sl_comm_resource_pool; srsran_sl_comm_resource_pool_t sl_comm_resource_pool;
if (srslte_sl_comm_resource_pool_get_default_config(&sl_comm_resource_pool, cell_sl) != SRSLTE_SUCCESS) { if (srsran_sl_comm_resource_pool_get_default_config(&sl_comm_resource_pool, cell_sl) != SRSRAN_SUCCESS) {
ERROR("Error initializing sl_comm_resource_pool"); ERROR("Error initializing sl_comm_resource_pool");
return SRSLTE_ERROR; return SRSRAN_ERROR;
} }
if (prog_args.input_file_name) { if (prog_args.input_file_name) {
if (srslte_filesource_init(&fsrc, prog_args.input_file_name, SRSLTE_COMPLEX_FLOAT_BIN)) { if (srsran_filesource_init(&fsrc, prog_args.input_file_name, SRSRAN_COMPLEX_FLOAT_BIN)) {
printf("Error opening file %s\n", prog_args.input_file_name); printf("Error opening file %s\n", prog_args.input_file_name);
return SRSLTE_ERROR; return SRSRAN_ERROR;
} }
} }
@ -253,21 +244,21 @@ int main(int argc, char** argv)
if (!prog_args.input_file_name) { if (!prog_args.input_file_name) {
printf("Opening RF device...\n"); printf("Opening RF device...\n");
if (srslte_rf_open_multi(&radio, prog_args.rf_args, prog_args.nof_rx_antennas)) { if (srsran_rf_open_multi(&radio, prog_args.rf_args, prog_args.nof_rx_antennas)) {
ERROR("Error opening rf"); ERROR("Error opening rf");
exit(-1); exit(-1);
} }
srslte_rf_set_rx_gain(&radio, prog_args.rf_gain); srsran_rf_set_rx_gain(&radio, prog_args.rf_gain);
printf("Set RX freq: %.6f MHz\n", printf("Set RX freq: %.6f MHz\n",
srslte_rf_set_rx_freq(&radio, prog_args.nof_rx_antennas, prog_args.rf_freq) / 1e6); srsran_rf_set_rx_freq(&radio, prog_args.nof_rx_antennas, prog_args.rf_freq) / 1e6);
printf("Set RX gain: %.1f dB\n", prog_args.rf_gain); printf("Set RX gain: %.1f dB\n", prog_args.rf_gain);
int srate = srslte_sampling_freq_hz(cell_sl.nof_prb); int srate = srsran_sampling_freq_hz(cell_sl.nof_prb);
if (srate != -1) { if (srate != -1) {
printf("Setting sampling rate %.2f MHz\n", (float)srate / 1000000); printf("Setting sampling rate %.2f MHz\n", (float)srate / 1000000);
float srate_rf = srslte_rf_set_rx_srate(&radio, (double)srate); float srate_rf = srsran_rf_set_rx_srate(&radio, (double)srate);
if (srate_rf != srate) { if (srate_rf != srate) {
ERROR("Could not set sampling rate"); ERROR("Could not set sampling rate");
exit(-1); exit(-1);
@ -280,99 +271,99 @@ int main(int argc, char** argv)
#endif // DISABLE_RF #endif // DISABLE_RF
// allocate Rx buffers for 1ms worth of samples // allocate Rx buffers for 1ms worth of samples
uint32_t sf_len = SRSLTE_SF_LEN_PRB(cell_sl.nof_prb); uint32_t sf_len = SRSRAN_SF_LEN_PRB(cell_sl.nof_prb);
printf("Using a SF len of %d samples\n", sf_len); printf("Using a SF len of %d samples\n", sf_len);
cf_t* rx_buffer[SRSLTE_MAX_CHANNELS] = {}; //< For radio to receive samples cf_t* rx_buffer[SRSRAN_MAX_CHANNELS] = {}; //< For radio to receive samples
cf_t* sf_buffer[SRSLTE_MAX_PORTS] = {NULL}; ///< For OFDM object to store subframe after FFT cf_t* sf_buffer[SRSRAN_MAX_PORTS] = {NULL}; ///< For OFDM object to store subframe after FFT
for (int i = 0; i < prog_args.nof_rx_antennas; i++) { for (int i = 0; i < prog_args.nof_rx_antennas; i++) {
rx_buffer[i] = srslte_vec_cf_malloc(sf_len); rx_buffer[i] = srsran_vec_cf_malloc(sf_len);
if (!rx_buffer[i]) { if (!rx_buffer[i]) {
perror("malloc"); perror("malloc");
exit(-1); exit(-1);
} }
sf_buffer[i] = srslte_vec_cf_malloc(sf_len); sf_buffer[i] = srsran_vec_cf_malloc(sf_len);
if (!sf_buffer[i]) { if (!sf_buffer[i]) {
perror("malloc"); perror("malloc");
exit(-1); exit(-1);
} }
} }
uint32_t sf_n_re = SRSLTE_CP_NSYMB(SRSLTE_CP_NORM) * SRSLTE_NRE * 2 * cell_sl.nof_prb; uint32_t sf_n_re = SRSRAN_CP_NSYMB(SRSRAN_CP_NORM) * SRSRAN_NRE * 2 * cell_sl.nof_prb;
cf_t* equalized_sf_buffer = srslte_vec_malloc(sizeof(cf_t) * sf_n_re); cf_t* equalized_sf_buffer = srsran_vec_malloc(sizeof(cf_t) * sf_n_re);
// RX // RX
srslte_ofdm_t fft[SRSLTE_MAX_PORTS]; srsran_ofdm_t fft[SRSRAN_MAX_PORTS];
srslte_ofdm_cfg_t ofdm_cfg = {}; srsran_ofdm_cfg_t ofdm_cfg = {};
ofdm_cfg.nof_prb = cell_sl.nof_prb; ofdm_cfg.nof_prb = cell_sl.nof_prb;
ofdm_cfg.cp = SRSLTE_CP_NORM; ofdm_cfg.cp = SRSRAN_CP_NORM;
ofdm_cfg.rx_window_offset = 0.0f; ofdm_cfg.rx_window_offset = 0.0f;
ofdm_cfg.normalize = true; ofdm_cfg.normalize = true;
ofdm_cfg.sf_type = SRSLTE_SF_NORM; ofdm_cfg.sf_type = SRSRAN_SF_NORM;
ofdm_cfg.freq_shift_f = -0.5; ofdm_cfg.freq_shift_f = -0.5;
for (int i = 0; i < prog_args.nof_rx_antennas; i++) { for (int i = 0; i < prog_args.nof_rx_antennas; i++) {
ofdm_cfg.in_buffer = rx_buffer[0]; ofdm_cfg.in_buffer = rx_buffer[0];
ofdm_cfg.out_buffer = sf_buffer[0]; ofdm_cfg.out_buffer = sf_buffer[0];
if (srslte_ofdm_rx_init_cfg(&fft[i], &ofdm_cfg)) { if (srsran_ofdm_rx_init_cfg(&fft[i], &ofdm_cfg)) {
ERROR("Error initiating FFT"); ERROR("Error initiating FFT");
goto clean_exit; goto clean_exit;
} }
} }
// SCI // SCI
srslte_sci_t sci; srsran_sci_t sci;
srslte_sci_init(&sci, cell_sl, sl_comm_resource_pool); srsran_sci_init(&sci, cell_sl, sl_comm_resource_pool);
uint8_t sci_rx[SRSLTE_SCI_MAX_LEN] = {}; uint8_t sci_rx[SRSRAN_SCI_MAX_LEN] = {};
char sci_msg[SRSLTE_SCI_MSG_MAX_LEN] = {}; char sci_msg[SRSRAN_SCI_MSG_MAX_LEN] = {};
// init PSCCH object // init PSCCH object
if (srslte_pscch_init(&pscch, SRSLTE_MAX_PRB) != SRSLTE_SUCCESS) { if (srsran_pscch_init(&pscch, SRSRAN_MAX_PRB) != SRSRAN_SUCCESS) {
ERROR("Error in PSCCH init"); ERROR("Error in PSCCH init");
return SRSLTE_ERROR; return SRSRAN_ERROR;
} }
if (srslte_pscch_set_cell(&pscch, cell_sl) != SRSLTE_SUCCESS) { if (srsran_pscch_set_cell(&pscch, cell_sl) != SRSRAN_SUCCESS) {
ERROR("Error in PSCCH set cell"); ERROR("Error in PSCCH set cell");
return SRSLTE_ERROR; return SRSRAN_ERROR;
} }
// PSCCH Channel estimation // PSCCH Channel estimation
srslte_chest_sl_cfg_t pscch_chest_sl_cfg = {}; srsran_chest_sl_cfg_t pscch_chest_sl_cfg = {};
srslte_chest_sl_t pscch_chest = {}; srsran_chest_sl_t pscch_chest = {};
if (srslte_chest_sl_init(&pscch_chest, SRSLTE_SIDELINK_PSCCH, cell_sl, sl_comm_resource_pool) != SRSLTE_SUCCESS) { if (srsran_chest_sl_init(&pscch_chest, SRSRAN_SIDELINK_PSCCH, cell_sl, sl_comm_resource_pool) != SRSRAN_SUCCESS) {
ERROR("Error in chest PSCCH init"); ERROR("Error in chest PSCCH init");
return SRSLTE_ERROR; return SRSRAN_ERROR;
} }
if (srslte_pssch_init(&pssch, cell_sl, sl_comm_resource_pool) != SRSLTE_SUCCESS) { if (srsran_pssch_init(&pssch, cell_sl, sl_comm_resource_pool) != SRSRAN_SUCCESS) {
ERROR("Error initializing PSSCH"); ERROR("Error initializing PSSCH");
return SRSLTE_ERROR; return SRSRAN_ERROR;
} }
srslte_chest_sl_cfg_t pssch_chest_sl_cfg = {}; srsran_chest_sl_cfg_t pssch_chest_sl_cfg = {};
srslte_chest_sl_t pssch_chest = {}; srsran_chest_sl_t pssch_chest = {};
if (srslte_chest_sl_init(&pssch_chest, SRSLTE_SIDELINK_PSSCH, cell_sl, sl_comm_resource_pool) != SRSLTE_SUCCESS) { if (srsran_chest_sl_init(&pssch_chest, SRSRAN_SIDELINK_PSSCH, cell_sl, sl_comm_resource_pool) != SRSRAN_SUCCESS) {
ERROR("Error in chest PSSCH init"); ERROR("Error in chest PSSCH init");
return SRSLTE_ERROR; return SRSRAN_ERROR;
} }
uint8_t tb[SRSLTE_SL_SCH_MAX_TB_LEN] = {}; uint8_t tb[SRSRAN_SL_SCH_MAX_TB_LEN] = {};
uint8_t packed_tb[SRSLTE_SL_SCH_MAX_TB_LEN / 8] = {}; uint8_t packed_tb[SRSRAN_SL_SCH_MAX_TB_LEN / 8] = {};
#ifndef DISABLE_RF #ifndef DISABLE_RF
srslte_ue_sync_t ue_sync = {}; srsran_ue_sync_t ue_sync = {};
if (!prog_args.input_file_name) { if (!prog_args.input_file_name) {
srslte_cell_t cell = {}; srsran_cell_t cell = {};
cell.nof_prb = cell_sl.nof_prb; cell.nof_prb = cell_sl.nof_prb;
cell.cp = SRSLTE_CP_NORM; cell.cp = SRSRAN_CP_NORM;
cell.nof_ports = 1; cell.nof_ports = 1;
if (srslte_ue_sync_init_multi_decim_mode(&ue_sync, if (srsran_ue_sync_init_multi_decim_mode(&ue_sync,
cell.nof_prb, cell.nof_prb,
false, false,
srslte_rf_recv_wrapper, srsran_rf_recv_wrapper,
prog_args.nof_rx_antennas, prog_args.nof_rx_antennas,
(void*)&radio, (void*)&radio,
1, 1,
@ -381,12 +372,12 @@ int main(int argc, char** argv)
exit(-1); exit(-1);
} }
if (srslte_ue_sync_set_cell(&ue_sync, cell)) { if (srsran_ue_sync_set_cell(&ue_sync, cell)) {
ERROR("Error initiating ue_sync"); ERROR("Error initiating ue_sync");
exit(-1); exit(-1);
} }
srslte_rf_start_rx_stream(&radio, false); srsran_rf_start_rx_stream(&radio, false);
} }
#endif #endif
@ -408,7 +399,7 @@ int main(int argc, char** argv)
while (keep_running) { while (keep_running) {
if (prog_args.input_file_name) { if (prog_args.input_file_name) {
// read subframe from file // read subframe from file
int nread = srslte_filesource_read(&fsrc, rx_buffer[0], sf_len); int nread = srsran_filesource_read(&fsrc, rx_buffer[0], sf_len);
if (nread < 0) { if (nread < 0) {
fprintf(stderr, "Error reading from file\n"); fprintf(stderr, "Error reading from file\n");
goto clean_exit; goto clean_exit;
@ -421,18 +412,18 @@ int main(int argc, char** argv)
} else { } else {
#ifndef DISABLE_RF #ifndef DISABLE_RF
// receive subframe from radio // receive subframe from radio
int ret = srslte_ue_sync_zerocopy(&ue_sync, rx_buffer, sf_len); int ret = srsran_ue_sync_zerocopy(&ue_sync, rx_buffer, sf_len);
if (ret < 0) { if (ret < 0) {
ERROR("Error calling srslte_ue_sync_work()"); ERROR("Error calling srsran_ue_sync_work()");
} }
// update SF index // update SF index
current_sf_idx = srslte_ue_sync_get_sfidx(&ue_sync); current_sf_idx = srsran_ue_sync_get_sfidx(&ue_sync);
#endif // DISABLE_RF #endif // DISABLE_RF
} }
// do FFT (on first port) // do FFT (on first port)
srslte_ofdm_rx_sf(&fft[0]); srsran_ofdm_rx_sf(&fft[0]);
for (int sub_channel_idx = 0; sub_channel_idx < sl_comm_resource_pool.num_sub_channel; sub_channel_idx++) { for (int sub_channel_idx = 0; sub_channel_idx < sl_comm_resource_pool.num_sub_channel; sub_channel_idx++) {
pscch_prb_start_idx = sub_channel_idx * sl_comm_resource_pool.size_sub_channel; pscch_prb_start_idx = sub_channel_idx * sl_comm_resource_pool.size_sub_channel;
@ -441,12 +432,12 @@ int main(int argc, char** argv)
// PSCCH Channel estimation // PSCCH Channel estimation
pscch_chest_sl_cfg.cyclic_shift = cyclic_shift; pscch_chest_sl_cfg.cyclic_shift = cyclic_shift;
pscch_chest_sl_cfg.prb_start_idx = pscch_prb_start_idx; pscch_chest_sl_cfg.prb_start_idx = pscch_prb_start_idx;
srslte_chest_sl_set_cfg(&pscch_chest, pscch_chest_sl_cfg); srsran_chest_sl_set_cfg(&pscch_chest, pscch_chest_sl_cfg);
srslte_chest_sl_ls_estimate_equalize(&pscch_chest, sf_buffer[0], equalized_sf_buffer); srsran_chest_sl_ls_estimate_equalize(&pscch_chest, sf_buffer[0], equalized_sf_buffer);
if (srslte_pscch_decode(&pscch, equalized_sf_buffer, sci_rx, pscch_prb_start_idx) == SRSLTE_SUCCESS) { if (srsran_pscch_decode(&pscch, equalized_sf_buffer, sci_rx, pscch_prb_start_idx) == SRSRAN_SUCCESS) {
if (srslte_sci_format1_unpack(&sci, sci_rx) == SRSLTE_SUCCESS) { if (srsran_sci_format1_unpack(&sci, sci_rx) == SRSRAN_SUCCESS) {
srslte_sci_info(&sci, sci_msg, sizeof(sci_msg)); srsran_sci_info(&sci, sci_msg, sizeof(sci_msg));
fprintf(stdout, "%s", sci_msg); fprintf(stdout, "%s", sci_msg);
num_decoded_sci++; num_decoded_sci++;
@ -461,7 +452,7 @@ int main(int argc, char** argv)
// Decode PSSCH // Decode PSSCH
uint32_t sub_channel_start_idx = 0; uint32_t sub_channel_start_idx = 0;
uint32_t L_subCH = 0; uint32_t L_subCH = 0;
srslte_ra_sl_type0_from_riv( srsran_ra_sl_type0_from_riv(
sci.riv, sl_comm_resource_pool.num_sub_channel, &L_subCH, &sub_channel_start_idx); sci.riv, sl_comm_resource_pool.num_sub_channel, &L_subCH, &sub_channel_start_idx);
// 3GPP TS 36.213 Section 14.1.1.4C // 3GPP TS 36.213 Section 14.1.1.4C
@ -471,11 +462,11 @@ int main(int argc, char** argv)
pssch_prb_start_idx + sl_comm_resource_pool.start_prb_sub_channel; pssch_prb_start_idx + sl_comm_resource_pool.start_prb_sub_channel;
// make sure PRBs are valid for DFT precoding // make sure PRBs are valid for DFT precoding
nof_prb_pssch = srslte_dft_precoding_get_valid_prb(nof_prb_pssch); nof_prb_pssch = srsran_dft_precoding_get_valid_prb(nof_prb_pssch);
uint32_t N_x_id = 0; uint32_t N_x_id = 0;
for (int j = 0; j < SRSLTE_SCI_CRC_LEN; j++) { for (int j = 0; j < SRSRAN_SCI_CRC_LEN; j++) {
N_x_id += pscch.sci_crc[j] * exp2(SRSLTE_SCI_CRC_LEN - 1 - j); N_x_id += pscch.sci_crc[j] * exp2(SRSRAN_SCI_CRC_LEN - 1 - j);
} }
uint32_t rv_idx = 0; uint32_t rv_idx = 0;
@ -488,17 +479,17 @@ int main(int argc, char** argv)
pssch_chest_sl_cfg.sf_idx = current_sf_idx; pssch_chest_sl_cfg.sf_idx = current_sf_idx;
pssch_chest_sl_cfg.prb_start_idx = pssch_prb_start_idx; pssch_chest_sl_cfg.prb_start_idx = pssch_prb_start_idx;
pssch_chest_sl_cfg.nof_prb = nof_prb_pssch; pssch_chest_sl_cfg.nof_prb = nof_prb_pssch;
srslte_chest_sl_set_cfg(&pssch_chest, pssch_chest_sl_cfg); srsran_chest_sl_set_cfg(&pssch_chest, pssch_chest_sl_cfg);
srslte_chest_sl_ls_estimate_equalize(&pssch_chest, sf_buffer[0], equalized_sf_buffer); srsran_chest_sl_ls_estimate_equalize(&pssch_chest, sf_buffer[0], equalized_sf_buffer);
srslte_pssch_cfg_t pssch_cfg = { srsran_pssch_cfg_t pssch_cfg = {
pssch_prb_start_idx, nof_prb_pssch, N_x_id, sci.mcs_idx, rv_idx, current_sf_idx}; pssch_prb_start_idx, nof_prb_pssch, N_x_id, sci.mcs_idx, rv_idx, current_sf_idx};
if (srslte_pssch_set_cfg(&pssch, pssch_cfg) == SRSLTE_SUCCESS) { if (srsran_pssch_set_cfg(&pssch, pssch_cfg) == SRSRAN_SUCCESS) {
if (srslte_pssch_decode(&pssch, equalized_sf_buffer, tb, SRSLTE_SL_SCH_MAX_TB_LEN) == SRSLTE_SUCCESS) { if (srsran_pssch_decode(&pssch, equalized_sf_buffer, tb, SRSRAN_SL_SCH_MAX_TB_LEN) == SRSRAN_SUCCESS) {
num_decoded_tb++; num_decoded_tb++;
// pack bit sand write to PCAP // pack bit sand write to PCAP
srslte_bit_pack_vector(tb, packed_tb, pssch.sl_sch_tb_len); srsran_bit_pack_vector(tb, packed_tb, pssch.sl_sch_tb_len);
pcap_pack_and_write(pcap_file, pcap_pack_and_write(pcap_file,
packed_tb, packed_tb,
pssch.sl_sch_tb_len / 8, pssch.sl_sch_tb_len / 8,
@ -523,7 +514,7 @@ int main(int argc, char** argv)
} }
} }
} }
if (SRSLTE_VERBOSE_ISDEBUG()) { if (SRSRAN_VERBOSE_ISDEBUG()) {
char filename[64]; char filename[64];
snprintf(filename, snprintf(filename,
64, 64,
@ -531,8 +522,8 @@ int main(int argc, char** argv)
subframe_count, subframe_count,
cyclic_shift, cyclic_shift,
pscch_prb_start_idx); pscch_prb_start_idx);
printf("Saving PSCCH symbols (%d) to %s\n", pscch.E / SRSLTE_PSCCH_QM, filename); printf("Saving PSCCH symbols (%d) to %s\n", pscch.E / SRSRAN_PSCCH_QM, filename);
srslte_vec_save_file(filename, pscch.mod_symbols, pscch.E / SRSLTE_PSCCH_QM * sizeof(cf_t)); srsran_vec_save_file(filename, pscch.mod_symbols, pscch.E / SRSRAN_PSCCH_QM * sizeof(cf_t));
} }
} }
} }
@ -562,15 +553,15 @@ clean_exit:
#endif #endif
#ifndef DISABLE_RF #ifndef DISABLE_RF
srslte_rf_stop_rx_stream(&radio); srsran_rf_stop_rx_stream(&radio);
srslte_rf_close(&radio); srsran_rf_close(&radio);
srslte_ue_sync_free(&ue_sync); srsran_ue_sync_free(&ue_sync);
#endif // DISABLE_RF #endif // DISABLE_RF
srslte_sci_free(&sci); srsran_sci_free(&sci);
srslte_pscch_free(&pscch); srsran_pscch_free(&pscch);
srslte_chest_sl_free(&pscch_chest); srsran_chest_sl_free(&pscch_chest);
srslte_chest_sl_free(&pssch_chest); srsran_chest_sl_free(&pssch_chest);
for (int i = 0; i < prog_args.nof_rx_antennas; i++) { for (int i = 0; i < prog_args.nof_rx_antennas; i++) {
if (rx_buffer[i]) { if (rx_buffer[i]) {
@ -579,14 +570,14 @@ clean_exit:
if (sf_buffer[i]) { if (sf_buffer[i]) {
free(sf_buffer[i]); free(sf_buffer[i]);
} }
srslte_ofdm_rx_free(&fft[i]); srsran_ofdm_rx_free(&fft[i]);
} }
if (equalized_sf_buffer) { if (equalized_sf_buffer) {
free(equalized_sf_buffer); free(equalized_sf_buffer);
} }
return SRSLTE_SUCCESS; return SRSRAN_SUCCESS;
} }
///< Plotting Functions ///< Plotting Functions
@ -614,7 +605,7 @@ void* plot_thread_run(void* arg)
while (keep_running) { while (keep_running) {
sem_wait(&plot_sem); sem_wait(&plot_sem);
plot_scatter_setNewData(&pscatequal_pscch, pscch.mod_symbols, pscch.E / SRSLTE_PSCCH_QM); plot_scatter_setNewData(&pscatequal_pscch, pscch.mod_symbols, pscch.E / SRSRAN_PSCCH_QM);
if (pssch.G > 0 && pssch.Qm > 0) { if (pssch.G > 0 && pssch.Qm > 0) {
plot_scatter_setNewData(&pscatequal_pssch, pssch.symbols, pssch.G / pssch.Qm); plot_scatter_setNewData(&pscatequal_pssch, pssch.symbols, pssch.G / pssch.Qm);
} }

@ -1,21 +1,12 @@
/** /**
* Copyright 2013-2021 Software Radio Systems Limited
*
* This file is part of srsLTE.
* *
* srsLTE is free software: you can redistribute it and/or modify * \section COPYRIGHT
* 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, * Copyright 2013-2021 Software Radio Systems Limited
* 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 * By using this file, you agree to the terms and conditions set
* the LICENSE file in the top-level directory of this distribution * forth in the LICENSE file which can be found at the top level of
* and at http://www.gnu.org/licenses/. * the distribution.
* *
*/ */
@ -25,7 +16,7 @@
#include <sys/time.h> #include <sys/time.h>
#include <unistd.h> #include <unistd.h>
#include "srslte/srslte.h" #include "srsran/srsran.h"
char* input_file_name; char* input_file_name;
char* output_file_name = "abs_corr.txt"; char* output_file_name = "abs_corr.txt";
@ -47,7 +38,7 @@ void usage(char* prog)
printf("\t-N out_N_id_2 [Default %d]\n", out_N_id_2); printf("\t-N out_N_id_2 [Default %d]\n", out_N_id_2);
printf("\t-f force_N_id_2 [Default %d]\n", force_N_id_2); printf("\t-f force_N_id_2 [Default %d]\n", force_N_id_2);
printf("\t-c force_cfo [Default disabled]\n"); printf("\t-c force_cfo [Default disabled]\n");
printf("\t-v srslte_verbose\n"); printf("\t-v srsran_verbose\n");
} }
void parse_args(int argc, char** argv) void parse_args(int argc, char** argv)
@ -83,7 +74,7 @@ void parse_args(int argc, char** argv)
force_cfo = strtof(argv[optind], NULL); force_cfo = strtof(argv[optind], NULL);
break; break;
case 'v': case 'v':
srslte_verbose++; srsran_verbose++;
break; break;
default: default:
usage(argv[0]); usage(argv[0]);
@ -98,11 +89,11 @@ void parse_args(int argc, char** argv)
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
srslte_filesource_t fsrc; srsran_filesource_t fsrc;
srslte_filesink_t fsink; srsran_filesink_t fsink;
srslte_pss_t pss[3]; // One for each N_id_2 srsran_pss_t pss[3]; // One for each N_id_2
srslte_sss_t sss[3]; // One for each N_id_2 srsran_sss_t sss[3]; // One for each N_id_2
srslte_cfo_t cfocorr; srsran_cfo_t cfocorr;
int peak_pos[3]; int peak_pos[3];
float* cfo; float* cfo;
float peak_value[3]; float peak_value[3];
@ -126,32 +117,32 @@ int main(int argc, char** argv)
printf("Initializing..."); printf("Initializing...");
fflush(stdout); fflush(stdout);
if (srslte_filesource_init(&fsrc, input_file_name, SRSLTE_COMPLEX_FLOAT_BIN)) { if (srsran_filesource_init(&fsrc, input_file_name, SRSRAN_COMPLEX_FLOAT_BIN)) {
ERROR("Error opening file %s", input_file_name); ERROR("Error opening file %s", input_file_name);
exit(-1); exit(-1);
} }
if (srslte_filesink_init(&fsink, output_file_name, SRSLTE_COMPLEX_FLOAT_BIN)) { if (srsran_filesink_init(&fsink, output_file_name, SRSRAN_COMPLEX_FLOAT_BIN)) {
ERROR("Error opening file %s", output_file_name); ERROR("Error opening file %s", output_file_name);
exit(-1); exit(-1);
} }
input = srslte_vec_cf_malloc(frame_length); input = srsran_vec_cf_malloc(frame_length);
if (!input) { if (!input) {
perror("malloc"); perror("malloc");
exit(-1); exit(-1);
} }
cfo = srslte_vec_f_malloc(nof_frames); cfo = srsran_vec_f_malloc(nof_frames);
if (!cfo) { if (!cfo) {
perror("malloc"); perror("malloc");
exit(-1); exit(-1);
} }
exec_time = srslte_vec_i32_malloc(nof_frames); exec_time = srsran_vec_i32_malloc(nof_frames);
if (!exec_time) { if (!exec_time) {
perror("malloc"); perror("malloc");
exit(-1); exit(-1);
} }
if (srslte_cfo_init(&cfocorr, frame_length)) { if (srsran_cfo_init(&cfocorr, frame_length)) {
ERROR("Error initiating CFO"); ERROR("Error initiating CFO");
return -1; return -1;
} }
@ -162,19 +153,19 @@ int main(int argc, char** argv)
* a) requries more memory but has less latency and is paralellizable. * a) requries more memory but has less latency and is paralellizable.
*/ */
for (N_id_2 = 0; N_id_2 < 3; N_id_2++) { for (N_id_2 = 0; N_id_2 < 3; N_id_2++) {
if (srslte_pss_init_fft(&pss[N_id_2], frame_length, symbol_sz)) { if (srsran_pss_init_fft(&pss[N_id_2], frame_length, symbol_sz)) {
ERROR("Error initializing PSS object"); ERROR("Error initializing PSS object");
exit(-1); exit(-1);
} }
if (srslte_pss_set_N_id_2(&pss[N_id_2], N_id_2)) { if (srsran_pss_set_N_id_2(&pss[N_id_2], N_id_2)) {
ERROR("Error initializing N_id_2"); ERROR("Error initializing N_id_2");
exit(-1); exit(-1);
} }
if (srslte_sss_init(&sss[N_id_2], symbol_sz)) { if (srsran_sss_init(&sss[N_id_2], symbol_sz)) {
ERROR("Error initializing SSS object"); ERROR("Error initializing SSS object");
exit(-1); exit(-1);
} }
if (srslte_sss_set_N_id_2(&sss[N_id_2], N_id_2)) { if (srsran_sss_set_N_id_2(&sss[N_id_2], N_id_2)) {
ERROR("Error initializing N_id_2"); ERROR("Error initializing N_id_2");
exit(-1); exit(-1);
} }
@ -188,18 +179,18 @@ int main(int argc, char** argv)
/* read all file or nof_frames */ /* read all file or nof_frames */
frame_cnt = 0; frame_cnt = 0;
while (frame_length == srslte_filesource_read(&fsrc, input, frame_length) && frame_cnt < nof_frames) { while (frame_length == srsran_filesource_read(&fsrc, input, frame_length) && frame_cnt < nof_frames) {
gettimeofday(&tdata[1], NULL); gettimeofday(&tdata[1], NULL);
if (force_cfo != CFO_AUTO) { if (force_cfo != CFO_AUTO) {
srslte_cfo_correct(&cfocorr, input, input, force_cfo / 128); srsran_cfo_correct(&cfocorr, input, input, force_cfo / 128);
} }
if (force_N_id_2 != -1) { if (force_N_id_2 != -1) {
N_id_2 = force_N_id_2; N_id_2 = force_N_id_2;
peak_pos[N_id_2] = srslte_pss_find_pss(&pss[N_id_2], input, &peak_value[N_id_2]); peak_pos[N_id_2] = srsran_pss_find_pss(&pss[N_id_2], input, &peak_value[N_id_2]);
} else { } else {
for (N_id_2 = 0; N_id_2 < 3; N_id_2++) { for (N_id_2 = 0; N_id_2 < 3; N_id_2++) {
peak_pos[N_id_2] = srslte_pss_find_pss(&pss[N_id_2], input, &peak_value[N_id_2]); peak_pos[N_id_2] = srsran_pss_find_pss(&pss[N_id_2], input, &peak_value[N_id_2]);
} }
float max_value = -99999; float max_value = -99999;
N_id_2 = -1; N_id_2 = -1;
@ -214,16 +205,16 @@ int main(int argc, char** argv)
/* If peak detected */ /* If peak detected */
if (peak_value[N_id_2] > corr_peak_threshold) { if (peak_value[N_id_2] > corr_peak_threshold) {
sss_idx = peak_pos[N_id_2] - 2 * (symbol_sz + SRSLTE_CP_LEN(symbol_sz, SRSLTE_CP_NORM_LEN)); sss_idx = peak_pos[N_id_2] - 2 * (symbol_sz + SRSRAN_CP_LEN(symbol_sz, SRSRAN_CP_NORM_LEN));
if (sss_idx >= 0) { if (sss_idx >= 0) {
srslte_sss_m0m1_diff(&sss[N_id_2], &input[sss_idx], &m0, &m0_value, &m1, &m1_value); srsran_sss_m0m1_diff(&sss[N_id_2], &input[sss_idx], &m0, &m0_value, &m1, &m1_value);
cfo[frame_cnt] = srslte_pss_cfo_compute(&pss[N_id_2], &input[peak_pos[N_id_2] - 128]); cfo[frame_cnt] = srsran_pss_cfo_compute(&pss[N_id_2], &input[peak_pos[N_id_2] - 128]);
printf("\t%d\t%d\t%d\t%d\t%.3f\t\t%3d\t%d\t%d\t%.3f\n", printf("\t%d\t%d\t%d\t%d\t%.3f\t\t%3d\t%d\t%d\t%.3f\n",
frame_cnt, frame_cnt,
N_id_2, N_id_2,
srslte_sss_N_id_1(&sss[N_id_2], m0, m1, m1_value + m0_value), srsran_sss_N_id_1(&sss[N_id_2], m0, m1, m1_value + m0_value),
srslte_sss_subframe(m0, m1), srsran_sss_subframe(m0, m1),
peak_value[N_id_2], peak_value[N_id_2],
peak_pos[N_id_2], peak_pos[N_id_2],
m0, m0,
@ -256,12 +247,12 @@ int main(int argc, char** argv)
printf("Average CFO: %.3f\n", cfo_mean); printf("Average CFO: %.3f\n", cfo_mean);
for (N_id_2 = 0; N_id_2 < 3; N_id_2++) { for (N_id_2 = 0; N_id_2 < 3; N_id_2++) {
srslte_pss_free(&pss[N_id_2]); srsran_pss_free(&pss[N_id_2]);
srslte_sss_free(&sss[N_id_2]); srsran_sss_free(&sss[N_id_2]);
} }
srslte_filesource_free(&fsrc); srsran_filesource_free(&fsrc);
srslte_filesink_free(&fsink); srsran_filesink_free(&fsink);
free(input); free(input);
free(cfo); free(cfo);

@ -1,21 +1,12 @@
/** /**
* Copyright 2013-2021 Software Radio Systems Limited
*
* This file is part of srsLTE.
* *
* srsLTE is free software: you can redistribute it and/or modify * \section COPYRIGHT
* 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, * Copyright 2013-2021 Software Radio Systems Limited
* 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 * By using this file, you agree to the terms and conditions set
* the LICENSE file in the top-level directory of this distribution * forth in the LICENSE file which can be found at the top level of
* and at http://www.gnu.org/licenses/. * the distribution.
* *
*/ */
@ -30,9 +21,9 @@
#include <stdbool.h> #include <stdbool.h>
#include "srslte/phy/io/filesink.h" #include "srsran/phy/io/filesink.h"
#include "srslte/phy/rf/rf.h" #include "srsran/phy/rf/rf.h"
#include "srslte/srslte.h" #include "srsran/srsran.h"
static bool keep_running = true; static bool keep_running = true;
char* output_file_name; char* output_file_name;
@ -54,7 +45,7 @@ void usage(char* prog)
printf("\t-r RF Rate [Default %.6f Hz]\n", rf_rate); printf("\t-r RF Rate [Default %.6f Hz]\n", rf_rate);
printf("\t-n nof_samples [Default %d]\n", nof_samples); printf("\t-n nof_samples [Default %d]\n", nof_samples);
printf("\t-A nof_rx_antennas [Default %d]\n", nof_rx_antennas); printf("\t-A nof_rx_antennas [Default %d]\n", nof_rx_antennas);
printf("\t-v srslte_verbose\n"); printf("\t-v srsran_verbose\n");
} }
void parse_args(int argc, char** argv) void parse_args(int argc, char** argv)
@ -84,7 +75,7 @@ void parse_args(int argc, char** argv)
nof_rx_antennas = (int)strtol(argv[optind], NULL, 10); nof_rx_antennas = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'v': case 'v':
srslte_verbose++; srsran_verbose++;
break; break;
default: default:
usage(argv[0]); usage(argv[0]);
@ -99,10 +90,10 @@ void parse_args(int argc, char** argv)
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
cf_t* buffer[SRSLTE_MAX_PORTS]; cf_t* buffer[SRSRAN_MAX_PORTS];
int sample_count, n; int sample_count, n;
srslte_rf_t rf; srsran_rf_t rf;
srslte_filesink_t sink; srsran_filesink_t sink;
uint32_t buflen; uint32_t buflen;
signal(SIGINT, int_handler); signal(SIGINT, int_handler);
@ -113,17 +104,17 @@ int main(int argc, char** argv)
sample_count = 0; sample_count = 0;
for (int i = 0; i < nof_rx_antennas; i++) { for (int i = 0; i < nof_rx_antennas; i++) {
buffer[i] = srslte_vec_cf_malloc(buflen); buffer[i] = srsran_vec_cf_malloc(buflen);
if (!buffer[i]) { if (!buffer[i]) {
perror("malloc"); perror("malloc");
exit(-1); exit(-1);
} }
} }
srslte_filesink_init(&sink, output_file_name, SRSLTE_COMPLEX_FLOAT_BIN); srsran_filesink_init(&sink, output_file_name, SRSRAN_COMPLEX_FLOAT_BIN);
printf("Opening RF device..."); printf("Opening RF device...");
if (srslte_rf_open_multi(&rf, rf_args, nof_rx_antennas)) { if (srsran_rf_open_multi(&rf, rf_args, nof_rx_antennas)) {
ERROR("Error opening rf"); ERROR("Error opening rf");
exit(-1); exit(-1);
} }
@ -133,13 +124,13 @@ int main(int argc, char** argv)
sigaddset(&sigset, SIGINT); sigaddset(&sigset, SIGINT);
sigprocmask(SIG_UNBLOCK, &sigset, NULL); sigprocmask(SIG_UNBLOCK, &sigset, NULL);
srslte_rf_set_rx_gain(&rf, rf_gain); srsran_rf_set_rx_gain(&rf, rf_gain);
srslte_rf_set_rx_freq(&rf, nof_rx_antennas, rf_freq); srsran_rf_set_rx_freq(&rf, nof_rx_antennas, rf_freq);
printf("Set RX freq: %.2f MHz\n", rf_freq / 1000000); printf("Set RX freq: %.2f MHz\n", rf_freq / 1000000);
printf("Set RX gain: %.2f dB\n", rf_gain); printf("Set RX gain: %.2f dB\n", rf_gain);
float srate = srslte_rf_set_rx_srate(&rf, rf_rate); float srate = srsran_rf_set_rx_srate(&rf, rf_rate);
if (srate != rf_rate) { if (srate != rf_rate) {
srate = srslte_rf_set_rx_srate(&rf, rf_rate); srate = srsran_rf_set_rx_srate(&rf, rf_rate);
if (srate != rf_rate) { if (srate != rf_rate) {
ERROR("Error setting samplign frequency %.2f MHz", rf_rate * 1e-6); ERROR("Error setting samplign frequency %.2f MHz", rf_rate * 1e-6);
exit(-1); exit(-1);
@ -147,16 +138,16 @@ int main(int argc, char** argv)
} }
printf("Correctly RX rate: %.2f MHz\n", srate * 1e-6); printf("Correctly RX rate: %.2f MHz\n", srate * 1e-6);
srslte_rf_start_rx_stream(&rf, false); srsran_rf_start_rx_stream(&rf, false);
while ((sample_count < nof_samples || nof_samples == -1) && keep_running) { while ((sample_count < nof_samples || nof_samples == -1) && keep_running) {
n = srslte_rf_recv_with_time_multi(&rf, (void**)buffer, buflen, true, NULL, NULL); n = srsran_rf_recv_with_time_multi(&rf, (void**)buffer, buflen, true, NULL, NULL);
if (n < 0) { if (n < 0) {
ERROR("Error receiving samples"); ERROR("Error receiving samples");
exit(-1); exit(-1);
} }
srslte_filesink_write_multi(&sink, (void**)buffer, buflen, nof_rx_antennas); srsran_filesink_write_multi(&sink, (void**)buffer, buflen, nof_rx_antennas);
sample_count += buflen; sample_count += buflen;
} }
@ -166,8 +157,8 @@ int main(int argc, char** argv)
} }
} }
srslte_filesink_free(&sink); srsran_filesink_free(&sink);
srslte_rf_close(&rf); srsran_rf_close(&rf);
printf("Ok - wrote %d samples\n", sample_count); printf("Ok - wrote %d samples\n", sample_count);
exit(0); exit(0);

@ -1,21 +1,12 @@
/** /**
* Copyright 2013-2021 Software Radio Systems Limited
*
* This file is part of srsLTE.
* *
* srsLTE is free software: you can redistribute it and/or modify * \section COPYRIGHT
* 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, * Copyright 2013-2021 Software Radio Systems Limited
* 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 * By using this file, you agree to the terms and conditions set
* the LICENSE file in the top-level directory of this distribution * forth in the LICENSE file which can be found at the top level of
* and at http://www.gnu.org/licenses/. * the distribution.
* *
*/ */
@ -30,8 +21,8 @@
#include <stdbool.h> #include <stdbool.h>
#include "srslte/phy/rf/rf.h" #include "srsran/phy/rf/rf.h"
#include "srslte/srslte.h" #include "srsran/srsran.h"
static bool keep_running = true; static bool keep_running = true;
char* output_file_name = NULL; char* output_file_name = NULL;
@ -43,7 +34,7 @@ int nof_subframes = -1;
int N_id_2 = -1; int N_id_2 = -1;
uint32_t nof_rx_antennas = 1; uint32_t nof_rx_antennas = 1;
bool use_standard_lte_rates = false; bool use_standard_lte_rates = false;
srslte_ue_sync_mode_t sync_mode = SYNC_MODE_PSS; srsran_ue_sync_mode_t sync_mode = SYNC_MODE_PSS;
void int_handler(int dummy) void int_handler(int dummy)
{ {
@ -105,7 +96,7 @@ void parse_args(int argc, char** argv)
nof_rx_antennas = (uint32_t)strtol(argv[optind], NULL, 10); nof_rx_antennas = (uint32_t)strtol(argv[optind], NULL, 10);
break; break;
case 'v': case 'v':
srslte_verbose++; srsran_verbose++;
break; break;
default: default:
usage(argv[0]); usage(argv[0]);
@ -118,42 +109,42 @@ void parse_args(int argc, char** argv)
} }
} }
int srslte_rf_recv_wrapper(void* h, cf_t* data[SRSLTE_MAX_PORTS], uint32_t nsamples, srslte_timestamp_t* t) int srsran_rf_recv_wrapper(void* h, cf_t* data[SRSRAN_MAX_PORTS], uint32_t nsamples, srsran_timestamp_t* t)
{ {
DEBUG(" ---- Receive %d samples ----", nsamples); DEBUG(" ---- Receive %d samples ----", nsamples);
void* ptr[SRSLTE_MAX_PORTS]; void* ptr[SRSRAN_MAX_PORTS];
for (int i = 0; i < SRSLTE_MAX_PORTS; i++) { for (int i = 0; i < SRSRAN_MAX_PORTS; i++) {
ptr[i] = data[i]; ptr[i] = data[i];
} }
return srslte_rf_recv_with_time_multi(h, ptr, nsamples, true, &t->full_secs, &t->frac_secs); return srsran_rf_recv_with_time_multi(h, ptr, nsamples, true, &t->full_secs, &t->frac_secs);
} }
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
cf_t* buffer[SRSLTE_MAX_CHANNELS] = {NULL}; cf_t* buffer[SRSRAN_MAX_CHANNELS] = {NULL};
int n = 0; int n = 0;
srslte_rf_t rf = {}; srsran_rf_t rf = {};
srslte_filesink_t sink = {}; srsran_filesink_t sink = {};
srslte_ue_sync_t ue_sync = {}; srsran_ue_sync_t ue_sync = {};
srslte_cell_t cell = {}; srsran_cell_t cell = {};
signal(SIGINT, int_handler); signal(SIGINT, int_handler);
parse_args(argc, argv); parse_args(argc, argv);
srslte_use_standard_symbol_size(use_standard_lte_rates); srsran_use_standard_symbol_size(use_standard_lte_rates);
srslte_filesink_init(&sink, output_file_name, SRSLTE_COMPLEX_FLOAT_BIN); srsran_filesink_init(&sink, output_file_name, SRSRAN_COMPLEX_FLOAT_BIN);
printf("Opening RF device...\n"); printf("Opening RF device...\n");
if (srslte_rf_open_multi(&rf, rf_args, nof_rx_antennas)) { if (srsran_rf_open_multi(&rf, rf_args, nof_rx_antennas)) {
ERROR("Error opening rf"); ERROR("Error opening rf");
exit(-1); exit(-1);
} }
uint32_t max_num_samples = 3 * SRSLTE_SF_LEN_MAX; uint32_t max_num_samples = 3 * SRSRAN_SF_LEN_MAX;
for (int i = 0; i < nof_rx_antennas; i++) { for (int i = 0; i < nof_rx_antennas; i++) {
buffer[i] = srslte_vec_cf_malloc(max_num_samples); buffer[i] = srsran_vec_cf_malloc(max_num_samples);
} }
sigset_t sigset; sigset_t sigset;
@ -161,13 +152,13 @@ int main(int argc, char** argv)
sigaddset(&sigset, SIGINT); sigaddset(&sigset, SIGINT);
sigprocmask(SIG_UNBLOCK, &sigset, NULL); sigprocmask(SIG_UNBLOCK, &sigset, NULL);
srslte_rf_set_rx_gain(&rf, rf_gain); srsran_rf_set_rx_gain(&rf, rf_gain);
printf("Set RX freq: %.6f MHz\n", srslte_rf_set_rx_freq(&rf, nof_rx_antennas, rf_freq) / 1000000); printf("Set RX freq: %.6f MHz\n", srsran_rf_set_rx_freq(&rf, nof_rx_antennas, rf_freq) / 1000000);
printf("Set RX gain: %.1f dB\n", srslte_rf_get_rx_gain(&rf)); printf("Set RX gain: %.1f dB\n", srsran_rf_get_rx_gain(&rf));
int srate = srslte_sampling_freq_hz(nof_prb); int srate = srsran_sampling_freq_hz(nof_prb);
if (srate != -1) { if (srate != -1) {
printf("Setting sampling rate %.2f MHz\n", (float)srate / 1000000); printf("Setting sampling rate %.2f MHz\n", (float)srate / 1000000);
float srate_rf = srslte_rf_set_rx_srate(&rf, (double)srate); float srate_rf = srsran_rf_set_rx_srate(&rf, (double)srate);
if (srate_rf != srate) { if (srate_rf != srate) {
ERROR("Could not set sampling rate"); ERROR("Could not set sampling rate");
exit(-1); exit(-1);
@ -176,19 +167,19 @@ int main(int argc, char** argv)
ERROR("Invalid number of PRB %d", nof_prb); ERROR("Invalid number of PRB %d", nof_prb);
exit(-1); exit(-1);
} }
srslte_rf_start_rx_stream(&rf, false); srsran_rf_start_rx_stream(&rf, false);
cell.cp = SRSLTE_CP_NORM; cell.cp = SRSRAN_CP_NORM;
cell.id = N_id_2; cell.id = N_id_2;
cell.nof_prb = nof_prb; cell.nof_prb = nof_prb;
cell.nof_ports = 1; cell.nof_ports = 1;
if (srslte_ue_sync_init_multi_decim_mode( if (srsran_ue_sync_init_multi_decim_mode(
&ue_sync, cell.nof_prb, cell.id == 1000, srslte_rf_recv_wrapper, nof_rx_antennas, (void*)&rf, 1, sync_mode)) { &ue_sync, cell.nof_prb, cell.id == 1000, srsran_rf_recv_wrapper, nof_rx_antennas, (void*)&rf, 1, sync_mode)) {
fprintf(stderr, "Error initiating ue_sync\n"); fprintf(stderr, "Error initiating ue_sync\n");
exit(-1); exit(-1);
} }
if (srslte_ue_sync_set_cell(&ue_sync, cell)) { if (srsran_ue_sync_set_cell(&ue_sync, cell)) {
ERROR("Error initiating ue_sync"); ERROR("Error initiating ue_sync");
exit(-1); exit(-1);
} }
@ -196,39 +187,39 @@ int main(int argc, char** argv)
uint32_t subframe_count = 0; uint32_t subframe_count = 0;
bool start_capture = false; bool start_capture = false;
bool stop_capture = false; bool stop_capture = false;
srslte_timestamp_t ts_rx_start = {}; srsran_timestamp_t ts_rx_start = {};
while ((subframe_count < nof_subframes || nof_subframes == -1) && !stop_capture) { while ((subframe_count < nof_subframes || nof_subframes == -1) && !stop_capture) {
n = srslte_ue_sync_zerocopy(&ue_sync, buffer, max_num_samples); n = srsran_ue_sync_zerocopy(&ue_sync, buffer, max_num_samples);
if (n < 0) { if (n < 0) {
ERROR("Error receiving samples"); ERROR("Error receiving samples");
exit(-1); exit(-1);
} }
if (n == 1) { if (n == 1) {
if (!start_capture) { if (!start_capture) {
if (srslte_ue_sync_get_sfidx(&ue_sync) == 9) { if (srsran_ue_sync_get_sfidx(&ue_sync) == 9) {
start_capture = true; start_capture = true;
} }
} else { } else {
printf("Writing to file %6d subframes...\r", subframe_count); printf("Writing to file %6d subframes...\r", subframe_count);
srslte_filesink_write_multi(&sink, (void**)buffer, SRSLTE_SF_LEN_PRB(nof_prb), nof_rx_antennas); srsran_filesink_write_multi(&sink, (void**)buffer, SRSRAN_SF_LEN_PRB(nof_prb), nof_rx_antennas);
// store time stamp of first subframe // store time stamp of first subframe
if (subframe_count == 0) { if (subframe_count == 0) {
srslte_ue_sync_get_last_timestamp(&ue_sync, &ts_rx_start); srsran_ue_sync_get_last_timestamp(&ue_sync, &ts_rx_start);
} }
subframe_count++; subframe_count++;
} }
} }
if (!keep_running) { if (!keep_running) {
if (!start_capture || (start_capture && srslte_ue_sync_get_sfidx(&ue_sync) == 9)) { if (!start_capture || (start_capture && srsran_ue_sync_get_sfidx(&ue_sync) == 9)) {
stop_capture = true; stop_capture = true;
} }
} }
} }
srslte_filesink_free(&sink); srsran_filesink_free(&sink);
srslte_rf_close(&rf); srsran_rf_close(&rf);
srslte_ue_sync_free(&ue_sync); srsran_ue_sync_free(&ue_sync);
for (int i = 0; i < nof_rx_antennas; i++) { for (int i = 0; i < nof_rx_antennas; i++) {
if (buffer[i]) { if (buffer[i]) {
@ -238,12 +229,12 @@ int main(int argc, char** argv)
printf("\nOk - wrote %d subframes\n", subframe_count); printf("\nOk - wrote %d subframes\n", subframe_count);
srslte_ue_sync_set_tti_from_timestamp(&ue_sync, &ts_rx_start); srsran_ue_sync_set_tti_from_timestamp(&ue_sync, &ts_rx_start);
printf("Start of capture at %ld+%.3f. TTI=%d.%d\n", printf("Start of capture at %ld+%.3f. TTI=%d.%d\n",
ts_rx_start.full_secs, ts_rx_start.full_secs,
ts_rx_start.frac_secs, ts_rx_start.frac_secs,
srslte_ue_sync_get_sfn(&ue_sync), srsran_ue_sync_get_sfn(&ue_sync),
srslte_ue_sync_get_sfidx(&ue_sync)); srsran_ue_sync_get_sfidx(&ue_sync));
return SRSLTE_SUCCESS; return SRSRAN_SUCCESS;
} }

@ -1,21 +1,12 @@
/** /**
* Copyright 2013-2021 Software Radio Systems Limited
*
* This file is part of srsLTE.
* *
* srsLTE is free software: you can redistribute it and/or modify * \section COPYRIGHT
* 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, * Copyright 2013-2021 Software Radio Systems Limited
* 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 * By using this file, you agree to the terms and conditions set
* the LICENSE file in the top-level directory of this distribution * forth in the LICENSE file which can be found at the top level of
* and at http://www.gnu.org/licenses/. * the distribution.
* *
*/ */
@ -29,11 +20,11 @@
#include <time.h> #include <time.h>
#include <unistd.h> #include <unistd.h>
#include "srslte/phy/io/filesink.h" #include "srsran/phy/io/filesink.h"
#include "srslte/phy/rf/rf.h" #include "srsran/phy/rf/rf.h"
#include "srslte/phy/ue/ue_mib_nbiot.h" #include "srsran/phy/ue/ue_mib_nbiot.h"
#include "srslte/phy/ue/ue_sync_nbiot.h" #include "srsran/phy/ue/ue_sync_nbiot.h"
#include "srslte/phy/utils/debug.h" #include "srsran/phy/utils/debug.h"
static bool keep_running = true; static bool keep_running = true;
char* output_file_name = NULL; char* output_file_name = NULL;
@ -77,7 +68,7 @@ void parse_args(int argc, char** argv)
nof_subframes = (int)strtol(argv[optind], NULL, 10); nof_subframes = (int)strtol(argv[optind], NULL, 10);
break; break;
case 'v': case 'v':
srslte_verbose++; srsran_verbose++;
break; break;
default: default:
usage(argv[0]); usage(argv[0]);
@ -90,10 +81,10 @@ void parse_args(int argc, char** argv)
} }
} }
int srslte_rf_recv_wrapper(void* h, void* data, uint32_t nsamples, srslte_timestamp_t* t) int srsran_rf_recv_wrapper(void* h, void* data, uint32_t nsamples, srsran_timestamp_t* t)
{ {
DEBUG(" ---- Receive %d samples ----", nsamples); DEBUG(" ---- Receive %d samples ----", nsamples);
return srslte_rf_recv(h, data, nsamples, 1); return srsran_rf_recv(h, data, nsamples, 1);
} }
int main(int argc, char** argv) int main(int argc, char** argv)
@ -102,12 +93,12 @@ int main(int argc, char** argv)
parse_args(argc, argv); parse_args(argc, argv);
srslte_filesink_t sink; srsran_filesink_t sink;
srslte_filesink_init(&sink, output_file_name, SRSLTE_COMPLEX_FLOAT_BIN); srsran_filesink_init(&sink, output_file_name, SRSRAN_COMPLEX_FLOAT_BIN);
printf("Opening RF device...\n"); printf("Opening RF device...\n");
srslte_rf_t rf; srsran_rf_t rf;
if (srslte_rf_open(&rf, rf_args)) { if (srsran_rf_open(&rf, rf_args)) {
fprintf(stderr, "Error opening rf\n"); fprintf(stderr, "Error opening rf\n");
exit(-1); exit(-1);
} }
@ -117,30 +108,30 @@ int main(int argc, char** argv)
sigaddset(&sigset, SIGINT); sigaddset(&sigset, SIGINT);
sigprocmask(SIG_UNBLOCK, &sigset, NULL); sigprocmask(SIG_UNBLOCK, &sigset, NULL);
srslte_rf_set_rx_gain(&rf, rf_gain); srsran_rf_set_rx_gain(&rf, rf_gain);
printf("Set RX freq: %.6f MHz\n", srslte_rf_set_rx_freq(&rf, 0, rf_freq) / 1000000); printf("Set RX freq: %.6f MHz\n", srsran_rf_set_rx_freq(&rf, 0, rf_freq) / 1000000);
printf("Set RX gain: %.1f dB\n", srslte_rf_get_rx_gain(&rf)); printf("Set RX gain: %.1f dB\n", srsran_rf_get_rx_gain(&rf));
int srate = srslte_sampling_freq_hz(nof_prb); int srate = srsran_sampling_freq_hz(nof_prb);
if (srate != -1) { if (srate != -1) {
printf("Setting sampling rate %.2f MHz\n", (float)srate / 1e6); printf("Setting sampling rate %.2f MHz\n", (float)srate / 1e6);
double srate_rf = srslte_rf_set_rx_srate(&rf, srate); double srate_rf = srsran_rf_set_rx_srate(&rf, srate);
printf("Actual sampling rate %.2f MHz\n", srate_rf / 1e6); printf("Actual sampling rate %.2f MHz\n", srate_rf / 1e6);
// We don't check the result rate with requested rate // We don't check the result rate with requested rate
} else { } else {
fprintf(stderr, "Invalid number of PRB %d\n", nof_prb); fprintf(stderr, "Invalid number of PRB %d\n", nof_prb);
exit(-1); exit(-1);
} }
srslte_rf_start_rx_stream(&rf, false); srsran_rf_start_rx_stream(&rf, false);
srslte_nbiot_cell_t cell = {}; srsran_nbiot_cell_t cell = {};
cell.base.nof_prb = nof_prb; cell.base.nof_prb = nof_prb;
cell.base.nof_ports = 1; cell.base.nof_ports = 1;
cf_t* buff_ptrs[SRSLTE_MAX_PORTS] = {NULL, NULL, NULL, NULL}; cf_t* buff_ptrs[SRSRAN_MAX_PORTS] = {NULL, NULL, NULL, NULL};
buff_ptrs[0] = srslte_vec_cf_malloc(SRSLTE_SF_LEN_PRB_NBIOT * 10); buff_ptrs[0] = srsran_vec_cf_malloc(SRSRAN_SF_LEN_PRB_NBIOT * 10);
srslte_nbiot_ue_sync_t ue_sync; srsran_nbiot_ue_sync_t ue_sync;
if (srslte_ue_sync_nbiot_init(&ue_sync, cell, srslte_rf_recv_wrapper, (void*)&rf)) { if (srsran_ue_sync_nbiot_init(&ue_sync, cell, srsran_rf_recv_wrapper, (void*)&rf)) {
fprintf(stderr, "Error initiating ue_sync\n"); fprintf(stderr, "Error initiating ue_sync\n");
exit(-1); exit(-1);
} }
@ -150,7 +141,7 @@ int main(int argc, char** argv)
bool start_capture = false; bool start_capture = false;
bool stop_capture = false; bool stop_capture = false;
while ((subframe_count < nof_subframes || nof_subframes == -1) && !stop_capture) { while ((subframe_count < nof_subframes || nof_subframes == -1) && !stop_capture) {
int n = srslte_ue_sync_nbiot_zerocopy_multi(&ue_sync, buff_ptrs); int n = srsran_ue_sync_nbiot_zerocopy_multi(&ue_sync, buff_ptrs);
if (n < 0) { if (n < 0) {
fprintf(stderr, "Error receiving samples\n"); fprintf(stderr, "Error receiving samples\n");
exit(-1); exit(-1);
@ -159,7 +150,7 @@ int main(int argc, char** argv)
if (n == 1) { if (n == 1) {
if (!start_capture) { if (!start_capture) {
if (nof_warmup_subframes <= 0) { if (nof_warmup_subframes <= 0) {
if (srslte_ue_sync_nbiot_get_sfidx(&ue_sync) == 9) { if (srsran_ue_sync_nbiot_get_sfidx(&ue_sync) == 9) {
printf("Starting capture ..\n"); printf("Starting capture ..\n");
start_capture = true; start_capture = true;
} }
@ -167,25 +158,25 @@ int main(int argc, char** argv)
nof_warmup_subframes--; nof_warmup_subframes--;
} else { } else {
printf("Writing subframe %d (%d/%d) to file (cfo=%6.2f kHz)\n", printf("Writing subframe %d (%d/%d) to file (cfo=%6.2f kHz)\n",
srslte_ue_sync_nbiot_get_sfidx(&ue_sync), srsran_ue_sync_nbiot_get_sfidx(&ue_sync),
subframe_count, subframe_count,
nof_subframes, nof_subframes,
srslte_ue_sync_nbiot_get_cfo(&ue_sync) / 1000); srsran_ue_sync_nbiot_get_cfo(&ue_sync) / 1000);
srslte_filesink_write(&sink, buff_ptrs[0], SRSLTE_SF_LEN_PRB(nof_prb)); srsran_filesink_write(&sink, buff_ptrs[0], SRSRAN_SF_LEN_PRB(nof_prb));
subframe_count++; subframe_count++;
} }
} }
if (!keep_running) { if (!keep_running) {
if (!start_capture || (start_capture && srslte_ue_sync_nbiot_get_sfidx(&ue_sync) == 9)) { if (!start_capture || (start_capture && srsran_ue_sync_nbiot_get_sfidx(&ue_sync) == 9)) {
printf("Stopping capture ..\n"); printf("Stopping capture ..\n");
stop_capture = true; stop_capture = true;
} }
} }
} }
srslte_filesink_free(&sink); srsran_filesink_free(&sink);
srslte_rf_close(&rf); srsran_rf_close(&rf);
srslte_ue_sync_nbiot_free(&ue_sync); srsran_ue_sync_nbiot_free(&ue_sync);
printf("Ok - wrote %d subframes\n", subframe_count); printf("Ok - wrote %d subframes\n", subframe_count);
exit(0); exit(0);

@ -1,21 +1,12 @@
/** /**
* Copyright 2013-2021 Software Radio Systems Limited
*
* This file is part of srsLTE.
* *
* srsLTE is free software: you can redistribute it and/or modify * \section COPYRIGHT
* 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, * Copyright 2013-2021 Software Radio Systems Limited
* 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 * By using this file, you agree to the terms and conditions set
* the LICENSE file in the top-level directory of this distribution * forth in the LICENSE file which can be found at the top level of
* and at http://www.gnu.org/licenses/. * the distribution.
* *
*/ */
@ -27,15 +18,15 @@
#include <time.h> #include <time.h>
#include <unistd.h> #include <unistd.h>
#include "srslte/phy/rf/rf.h" #include "srsran/phy/rf/rf.h"
#include "srslte/srslte.h" #include "srsran/srsran.h"
uint32_t nof_prb = 25; uint32_t nof_prb = 25;
uint32_t nof_frames = 20; uint32_t nof_frames = 20;
int time_adv_samples = 0; int time_adv_samples = 0;
float tone_offset_hz = 1e6; float tone_offset_hz = 1e6;
float rf_rx_gain = 40, srslte_rf_tx_gain = 40, rf_freq = 2.4e9; float rf_rx_gain = 40, srsran_rf_tx_gain = 40, rf_freq = 2.4e9;
char* rf_args = ""; char* rf_args = "";
char* output_filename = NULL; char* output_filename = NULL;
char* input_filename = NULL; char* input_filename = NULL;
@ -46,7 +37,7 @@ void usage(char* prog)
printf("\t-a RF args [Default %s]\n", rf_args); printf("\t-a RF args [Default %s]\n", rf_args);
printf("\t-f RF TX/RX frequency [Default %.2f MHz]\n", rf_freq / 1e6); printf("\t-f RF TX/RX frequency [Default %.2f MHz]\n", rf_freq / 1e6);
printf("\t-g RF RX gain [Default %.1f dB]\n", rf_rx_gain); printf("\t-g RF RX gain [Default %.1f dB]\n", rf_rx_gain);
printf("\t-G RF TX gain [Default %.1f dB]\n", srslte_rf_tx_gain); printf("\t-G RF TX gain [Default %.1f dB]\n", srsran_rf_tx_gain);
printf("\t-t Single tone offset (Hz) [Default %f]\n", tone_offset_hz); printf("\t-t Single tone offset (Hz) [Default %f]\n", tone_offset_hz);
printf("\t-T Time advance samples [Default %d]\n", time_adv_samples); printf("\t-T Time advance samples [Default %d]\n", time_adv_samples);
printf("\t-i File name to read signal from [Default single tone]\n"); printf("\t-i File name to read signal from [Default single tone]\n");
@ -80,11 +71,11 @@ void parse_args(int argc, char** argv)
rf_rx_gain = strtof(argv[optind], NULL); rf_rx_gain = strtof(argv[optind], NULL);
break; break;
case 'G': case 'G':
srslte_rf_tx_gain = strtof(argv[optind], NULL); srsran_rf_tx_gain = strtof(argv[optind], NULL);
break; break;
case 'p': case 'p':
nof_prb = (uint32_t)strtol(argv[optind], NULL, 10); nof_prb = (uint32_t)strtol(argv[optind], NULL, 10);
if (!srslte_nofprb_isvalid(nof_prb)) { if (!srsran_nofprb_isvalid(nof_prb)) {
ERROR("Invalid number of UL RB %d", nof_prb); ERROR("Invalid number of UL RB %d", nof_prb);
exit(-1); exit(-1);
} }
@ -109,82 +100,82 @@ int main(int argc, char** argv)
{ {
parse_args(argc, argv); parse_args(argc, argv);
uint32_t flen = srslte_sampling_freq_hz(nof_prb) / 1000; uint32_t flen = srsran_sampling_freq_hz(nof_prb) / 1000;
cf_t* rx_buffer = srslte_vec_cf_malloc(flen * nof_frames); cf_t* rx_buffer = srsran_vec_cf_malloc(flen * nof_frames);
if (!rx_buffer) { if (!rx_buffer) {
perror("malloc"); perror("malloc");
exit(-1); exit(-1);
} }
cf_t* tx_buffer = srslte_vec_cf_malloc((flen + time_adv_samples)); cf_t* tx_buffer = srsran_vec_cf_malloc((flen + time_adv_samples));
if (!tx_buffer) { if (!tx_buffer) {
perror("malloc"); perror("malloc");
exit(-1); exit(-1);
} }
srslte_vec_cf_zero(tx_buffer, flen + time_adv_samples); srsran_vec_cf_zero(tx_buffer, flen + time_adv_samples);
cf_t* zeros = srslte_vec_cf_malloc(flen); cf_t* zeros = srsran_vec_cf_malloc(flen);
if (!zeros) { if (!zeros) {
perror("calloc"); perror("calloc");
exit(-1); exit(-1);
} }
srslte_vec_cf_zero(zeros, flen); srsran_vec_cf_zero(zeros, flen);
float time_adv_sec = (float)time_adv_samples / srslte_sampling_freq_hz(nof_prb); float time_adv_sec = (float)time_adv_samples / srsran_sampling_freq_hz(nof_prb);
// Send through RF // Send through RF
srslte_rf_t rf; srsran_rf_t rf;
printf("Opening RF device...\n"); printf("Opening RF device...\n");
if (srslte_rf_open(&rf, rf_args)) { if (srsran_rf_open(&rf, rf_args)) {
ERROR("Error opening rf"); ERROR("Error opening rf");
exit(-1); exit(-1);
} }
int srate = srslte_sampling_freq_hz(nof_prb); int srate = srsran_sampling_freq_hz(nof_prb);
srslte_rf_set_rx_srate(&rf, (double)srate); srsran_rf_set_rx_srate(&rf, (double)srate);
srslte_rf_set_tx_srate(&rf, (double)srate); srsran_rf_set_tx_srate(&rf, (double)srate);
srslte_rf_set_rx_gain(&rf, rf_rx_gain); srsran_rf_set_rx_gain(&rf, rf_rx_gain);
srslte_rf_set_tx_gain(&rf, srslte_rf_tx_gain); srsran_rf_set_tx_gain(&rf, srsran_rf_tx_gain);
srslte_rf_set_rx_freq(&rf, 0, rf_freq); srsran_rf_set_rx_freq(&rf, 0, rf_freq);
printf("Subframe len: %d samples\n", flen); printf("Subframe len: %d samples\n", flen);
printf("Time advance: %f us\n", time_adv_sec * 1e6); printf("Time advance: %f us\n", time_adv_sec * 1e6);
printf("Set TX/RX rate: %.2f MHz\n", (float)srate / 1000000); printf("Set TX/RX rate: %.2f MHz\n", (float)srate / 1000000);
printf("Set RX gain: %.1f dB\n", rf_rx_gain); printf("Set RX gain: %.1f dB\n", rf_rx_gain);
printf("Set TX gain: %.1f dB\n", srslte_rf_tx_gain); printf("Set TX gain: %.1f dB\n", srsran_rf_tx_gain);
printf("Set TX/RX freq: %.2f MHz\n", rf_freq / 1000000); printf("Set TX/RX freq: %.2f MHz\n", rf_freq / 1000000);
srslte_rf_set_tx_freq(&rf, 0, rf_freq); srsran_rf_set_tx_freq(&rf, 0, rf_freq);
sleep(1); sleep(1);
if (input_filename) { if (input_filename) {
srslte_vec_load_file(input_filename, &tx_buffer[time_adv_samples], flen * sizeof(cf_t)); srsran_vec_load_file(input_filename, &tx_buffer[time_adv_samples], flen * sizeof(cf_t));
} else { } else {
for (int i = 0; i < flen - time_adv_samples; i++) { for (int i = 0; i < flen - time_adv_samples; i++) {
tx_buffer[i + time_adv_samples] = 0.3 * cexpf(_Complex_I * 2 * M_PI * tone_offset_hz * ((float)i / (float)srate)); tx_buffer[i + time_adv_samples] = 0.3 * cexpf(_Complex_I * 2 * M_PI * tone_offset_hz * ((float)i / (float)srate));
} }
srslte_vec_save_file("srslte_rf_txrx_tone", tx_buffer, flen * sizeof(cf_t)); srsran_vec_save_file("srsran_rf_txrx_tone", tx_buffer, flen * sizeof(cf_t));
} }
srslte_timestamp_t tstamp; srsran_timestamp_t tstamp;
srslte_rf_start_rx_stream(&rf, false); srsran_rf_start_rx_stream(&rf, false);
uint32_t nframe = 0; uint32_t nframe = 0;
while (nframe < nof_frames) { while (nframe < nof_frames) {
printf("Rx subframe %d\n", nframe); printf("Rx subframe %d\n", nframe);
srslte_rf_recv_with_time(&rf, &rx_buffer[flen * nframe], flen, true, &tstamp.full_secs, &tstamp.frac_secs); srsran_rf_recv_with_time(&rf, &rx_buffer[flen * nframe], flen, true, &tstamp.full_secs, &tstamp.frac_secs);
nframe++; nframe++;
if (nframe == 9) { if (nframe == 9) {
srslte_timestamp_add(&tstamp, 0, 2e-3 - time_adv_sec); srsran_timestamp_add(&tstamp, 0, 2e-3 - time_adv_sec);
srslte_rf_send_timed2(&rf, tx_buffer, flen + time_adv_samples, tstamp.full_secs, tstamp.frac_secs, true, true); srsran_rf_send_timed2(&rf, tx_buffer, flen + time_adv_samples, tstamp.full_secs, tstamp.frac_secs, true, true);
printf("Transmitting Signal\n"); printf("Transmitting Signal\n");
} }
} }
srslte_vec_save_file(output_filename, &rx_buffer[10 * flen], flen * sizeof(cf_t)); srsran_vec_save_file(output_filename, &rx_buffer[10 * flen], flen * sizeof(cf_t));
free(tx_buffer); free(tx_buffer);
free(rx_buffer); free(rx_buffer);

@ -1,21 +1,12 @@
/** /**
* Copyright 2013-2021 Software Radio Systems Limited
*
* This file is part of srsLTE.
* *
* srsLTE is free software: you can redistribute it and/or modify * \section COPYRIGHT
* 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, * Copyright 2013-2021 Software Radio Systems Limited
* 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 * By using this file, you agree to the terms and conditions set
* the LICENSE file in the top-level directory of this distribution * forth in the LICENSE file which can be found at the top level of
* and at http://www.gnu.org/licenses/. * the distribution.
* *
*/ */
@ -31,8 +22,8 @@
#include <stdbool.h> #include <stdbool.h>
#include "srslte/phy/rf/rf.h" #include "srsran/phy/rf/rf.h"
#include "srslte/srslte.h" #include "srsran/srsran.h"
static bool keep_running = true; static bool keep_running = true;
static uint32_t nof_rx_antennas = 1; static uint32_t nof_rx_antennas = 1;
@ -108,7 +99,7 @@ int main(int argc, char** argv)
// Initializes memory for input buffer // Initializes memory for input buffer
bzero(buffer, sizeof(void*) * max_rx_antennas); bzero(buffer, sizeof(void*) * max_rx_antennas);
for (int i = 0; i < nof_rx_antennas; i++) { for (int i = 0; i < nof_rx_antennas; i++) {
buffer[i] = srslte_vec_cf_malloc(buflen); buffer[i] = srsran_vec_cf_malloc(buflen);
if (!buffer[i]) { if (!buffer[i]) {
perror("malloc"); perror("malloc");
exit(-1); exit(-1);
@ -123,7 +114,7 @@ int main(int argc, char** argv)
ERROR("Error receiving samples"); ERROR("Error receiving samples");
exit(-1); exit(-1);
} }
if (srslte_verbose == SRSLTE_VERBOSE_INFO) { if (srsran_verbose == SRSRAN_VERBOSE_INFO) {
printf("Received %d samples from radio\n", n); printf("Received %d samples from radio\n", n);
} }
@ -136,7 +127,7 @@ int main(int argc, char** argv)
print_cnt = 0; print_cnt = 0;
} }
} else { } else {
if (srslte_verbose == SRSLTE_VERBOSE_INFO) { if (srsran_verbose == SRSRAN_VERBOSE_INFO) {
printf("Transmitted %d bytes to ZMQ\n", n); printf("Transmitted %d bytes to ZMQ\n", n);
} }
} }
@ -154,27 +145,27 @@ int main(int argc, char** argv)
exit(0); exit(0);
} }
/* Example function to initialize the Radio frontend. In this case, we use srsLTE RF API to open a device, /* Example function to initialize the Radio frontend. In this case, we use srsRAN RF API to open a device,
* which automatically picks UHD, bladeRF, limeSDR, etc. * which automatically picks UHD, bladeRF, limeSDR, etc.
*/ */
static srslte_rf_t radio = {}; static srsran_rf_t radio = {};
static char* rf_args = "fastpath"; static char* rf_args = "fastpath";
static float rf_gain = 40.0, rf_freq = -1.0, rf_rate = 11.52e6; static float rf_gain = 40.0, rf_freq = -1.0, rf_rate = 11.52e6;
static uint32_t rf_recv_frame_size_ms = 1; static uint32_t rf_recv_frame_size_ms = 1;
static int init_radio(uint32_t* buffer_len) static int init_radio(uint32_t* buffer_len)
{ {
// Uses srsLTE RF API to open a device, could use other code here // Uses srsRAN RF API to open a device, could use other code here
printf("Opening RF device...\n"); printf("Opening RF device...\n");
if (srslte_rf_open_multi(&radio, rf_args, nof_rx_antennas)) { if (srsran_rf_open_multi(&radio, rf_args, nof_rx_antennas)) {
ERROR("Error opening rf"); ERROR("Error opening rf");
return -1; return -1;
} }
srslte_rf_set_rx_gain(&radio, rf_gain); srsran_rf_set_rx_gain(&radio, rf_gain);
srslte_rf_set_rx_freq(&radio, nof_rx_antennas, rf_freq); srsran_rf_set_rx_freq(&radio, nof_rx_antennas, rf_freq);
printf("Set RX freq: %.2f MHz\n", rf_freq / 1000000); printf("Set RX freq: %.2f MHz\n", rf_freq / 1000000);
printf("Set RX gain: %.2f dB\n", rf_gain); printf("Set RX gain: %.2f dB\n", rf_gain);
float srate = srslte_rf_set_rx_srate(&radio, rf_rate); float srate = srsran_rf_set_rx_srate(&radio, rf_rate);
if (srate != rf_rate) { if (srate != rf_rate) {
ERROR("Error setting samplign frequency %.2f MHz", rf_rate * 1e-6); ERROR("Error setting samplign frequency %.2f MHz", rf_rate * 1e-6);
return -1; return -1;
@ -185,20 +176,20 @@ static int init_radio(uint32_t* buffer_len)
} }
printf("Set RX rate: %.2f MHz\n", srate * 1e-6); printf("Set RX rate: %.2f MHz\n", srate * 1e-6);
srslte_rf_start_rx_stream(&radio, false); srsran_rf_start_rx_stream(&radio, false);
return 0; return 0;
} }
/* Example implementation to receive from Radio frontend. In this case we use srsLTE /* Example implementation to receive from Radio frontend. In this case we use srsRAN
*/ */
static int rx_radio(void** buffer, uint32_t buf_len) static int rx_radio(void** buffer, uint32_t buf_len)
{ {
return srslte_rf_recv_with_time_multi(&radio, buffer, buf_len, true, NULL, NULL); return srsran_rf_recv_with_time_multi(&radio, buffer, buf_len, true, NULL, NULL);
} }
static void close_radio() static void close_radio()
{ {
srslte_rf_close(&radio); srsran_rf_close(&radio);
} }
static void int_handler(int dummy) static void int_handler(int dummy)
@ -215,7 +206,7 @@ static void usage(char* prog)
printf("\t-m RF receive frame size in ms [Default %d ms]\n", rf_recv_frame_size_ms); printf("\t-m RF receive frame size in ms [Default %d ms]\n", rf_recv_frame_size_ms);
printf("\t-A Number of antennas [Max %d, Default %d]\n", max_rx_antennas, nof_rx_antennas); printf("\t-A Number of antennas [Max %d, Default %d]\n", max_rx_antennas, nof_rx_antennas);
printf("\t-z ZMQ args [Default %s]\n", zmq_args); printf("\t-z ZMQ args [Default %s]\n", zmq_args);
printf("\t-v srslte_verbose\n"); printf("\t-v srsran_verbose\n");
} }
static void parse_args(int argc, char** argv) static void parse_args(int argc, char** argv)
@ -239,7 +230,7 @@ static void parse_args(int argc, char** argv)
rf_freq = strtof(argv[optind], NULL); rf_freq = strtof(argv[optind], NULL);
break; break;
case 'v': case 'v':
srslte_verbose++; srsran_verbose++;
break; break;
case 'z': case 'z':
zmq_args = argv[optind]; zmq_args = argv[optind];

@ -21,5 +21,5 @@
######################################################################## ########################################################################
# Add subdirectories # Add subdirectories
######################################################################## ########################################################################
add_subdirectory(srslte) add_subdirectory(srsran)

@ -1,61 +0,0 @@
/**
* Copyright 2013-2021 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_ADT_UTILS_H
#define SRSLTE_ADT_UTILS_H
#ifdef __EXCEPTIONS
#include <stdexcept>
#define EXCEPTIONS_ENABLED 1
namespace srslte {
class bad_type_access : public std::runtime_error
{
public:
explicit bad_type_access(const std::string& what_arg) : runtime_error(what_arg) {}
explicit bad_type_access(const char* what_arg) : runtime_error(what_arg) {}
};
#define THROW_BAD_ACCESS(msg) throw bad_type_access(msg)
} // namespace srslte
#else
#define EXCEPTIONS_ENABLED 0
#include <cstdio>
#include <cstdlib>
namespace srslte {
#define THROW_BAD_ACCESS(msg) \
std::fprintf(stderr, "ERROR: exception thrown with %s", msg); \
std::abort()
} // namespace srslte
#endif
#endif // SRSLTE_ADT_UTILS_H

@ -1,43 +0,0 @@
/**
* Copyright 2013-2021 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 CPP_TESTS_INDEX_SEQUENCE_H
#define CPP_TESTS_INDEX_SEQUENCE_H
namespace srslte {
template <std::size_t...>
struct index_sequence {};
template <std::size_t N, std::size_t... Next>
struct index_sequence_helper : public index_sequence_helper<N - 1U, N - 1U, Next...> {};
template <std::size_t... Next>
struct index_sequence_helper<0U, Next...> {
using type = index_sequence<Next...>;
};
template <std::size_t N>
using make_index_sequence = typename index_sequence_helper<N>::type;
} // namespace srslte
#endif // CPP_TESTS_INDEX_SEQUENCE_H

@ -1,77 +0,0 @@
/**
* Copyright 2013-2021 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_RRC_NR_UTILS_H
#define SRSLTE_RRC_NR_UTILS_H
#include "srslte/interfaces/mac_interface_types.h"
#include "srslte/interfaces/pdcp_interface_types.h"
#include "srslte/interfaces/rlc_interface_types.h"
#include "srslte/interfaces/rrc_interface_types.h"
#include "srslte/interfaces/sched_interface.h"
/************************
* Forward declarations
***********************/
namespace asn1 {
namespace rrc_nr {
struct plmn_id_s;
struct sib1_s;
struct rlc_cfg_c;
struct pdcp_cfg_s;
struct lc_ch_cfg_s;
struct rach_cfg_common_s;
} // namespace rrc_nr
} // namespace asn1
/************************
* Conversion Helpers
***********************/
namespace srslte {
plmn_id_t make_plmn_id_t(const asn1::rrc_nr::plmn_id_s& asn1_type);
void to_asn1(asn1::rrc_nr::plmn_id_s* asn1_type, const plmn_id_t& cfg);
/***************************
* MAC Config
**************************/
logical_channel_config_t make_mac_logical_channel_cfg_t(uint8_t lcid, const asn1::rrc_nr::lc_ch_cfg_s& asn1_type);
rach_nr_cfg_t make_mac_rach_cfg(const asn1::rrc_nr::rach_cfg_common_s& asn1_type);
/***************************
* RLC Config
**************************/
rlc_config_t make_rlc_config_t(const asn1::rrc_nr::rlc_cfg_c& asn1_type);
/***************************
* PDCP Config
**************************/
pdcp_config_t make_drb_pdcp_config_t(const uint8_t bearer_id, bool is_ue, const asn1::rrc_nr::pdcp_cfg_s& pdcp_cfg);
} // namespace srslte
namespace srsenb {
int set_sched_cell_cfg_sib1(srsenb::sched_interface::cell_cfg_t* sched_cfg, const asn1::rrc_nr::sib1_s& sib1);
}
#endif // SRSLTE_RRC_NR_UTILS_H

@ -1,60 +0,0 @@
/**
* Copyright 2013-2021 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_BUILD_INFO_H_IN
#define SRSLTE_BUILD_INFO_H_IN
#include "srslte/config.h"
# ifdef __cplusplus
extern "C" {
# endif
#ifdef BUILD_TYPE_RELEASE
static char build_mode[] = "Release";
#else
#ifdef BUILD_TYPE_DEBUG
static char build_mode[] = "Debug";
#else
#ifdef BUILD_TYPE_RELWITHDEBINFO
static char build_mode[] = "RelWithDebInfo";
#else
static char build_mode[] = "unknown";
#endif
#endif
#endif
// the configured build options for srsLTE
static char build_info[] = "commit @GIT_COMMIT_HASH@ on branch @GIT_BRANCH@";
SRSLTE_API char* srslte_get_build_info() {
return build_info;
};
SRSLTE_API char* srslte_get_build_mode() {
return build_mode;
}
# ifdef __cplusplus
}
# endif
#endif // BUILD_INFO_

@ -1,45 +0,0 @@
/**
* Copyright 2013-2021 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/.
*
*/
/******************************************************************************
* File: backtrace.h
*
* Description: print backtrace in runtime.
*
* Reference:
*****************************************************************************/
#ifndef SRSLTE_BACKTRACE_H
#define SRSLTE_BACKTRACE_H
#include "srslte/config.h"
#include <stdio.h>
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
SRSLTE_API void srslte_backtrace_print(FILE* f);
#ifdef __cplusplus
}
#endif // __cplusplus
#endif // SRSLTE_BACKTRACE_H

@ -1,67 +0,0 @@
/**
* Copyright 2013-2021 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_CONFIG_FILE_H
#define SRSLTE_CONFIG_FILE_H
#include "common.h"
#include "srslte/phy/common/phy_common.h"
#include <fstream>
#include <pwd.h>
#include <sys/types.h>
#include <unistd.h>
bool config_exists(std::string& filename, std::string default_name)
{
std::ifstream conf(filename.c_str(), std::ios::in);
if (conf.fail()) {
// try config folder instead
const char* homedir = NULL;
char full_path[256];
ZERO_OBJECT(full_path);
if ((homedir = getenv("HOME")) == NULL) {
homedir = getpwuid(getuid())->pw_dir;
}
if (!homedir) {
homedir = ".";
}
snprintf(full_path, sizeof(full_path), "%s/.config/srslte/%s", homedir, default_name.c_str());
filename = std::string(full_path);
// try to open again
conf.open(filename.c_str());
if (conf.fail()) {
// Last chance, try to find file in /etc/srslte
ZERO_OBJECT(full_path);
snprintf(full_path, sizeof(full_path), "/etc/srslte/%s", default_name.c_str());
filename = std::string(full_path);
// try to open again
conf.open(filename.c_str());
if (conf.fail()) {
return false;
}
}
}
return true;
}
#endif // SRSLTE_CONFIG_FILE_H

@ -1,42 +0,0 @@
/**
* Copyright 2013-2021 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/.
*
*/
/**
* @file crash_handler.h
* @brief Common handler to catch segfaults and write backtrace to file.
*/
#ifndef SRSLTE_CRASH_HANDLER_H
#define SRSLTE_CRASH_HANDLER_H
#include "srslte/config.h"
#include <stdio.h>
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
void srslte_debug_handle_crash(int argc, char** argv);
#ifdef __cplusplus
}
#endif // __cplusplus
#endif // SRSLTE_CRASH_HANDLER_H

@ -1,97 +0,0 @@
/**
* Copyright 2013-2021 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_INTERFACES_COMMON_H
#define SRSLTE_INTERFACES_COMMON_H
#include "srslte/common/byte_buffer.h"
#include "srslte/common/security.h"
#include "srslte/phy/common/phy_common.h"
#include <string>
namespace srslte {
typedef struct {
std::string phy_level = "none";
std::string phy_lib_level = "none";
int phy_hex_limit = -1;
} phy_log_args_t;
typedef struct {
float min;
float max;
} rf_args_band_t;
// RF/radio args
typedef struct {
std::string type;
std::string log_level;
double srate_hz;
float dl_freq;
float ul_freq;
float freq_offset;
float rx_gain;
float rx_gain_ch[SRSLTE_MAX_CARRIERS];
float tx_gain;
float tx_gain_ch[SRSLTE_MAX_CARRIERS];
float tx_max_power;
float tx_gain_offset;
float rx_gain_offset;
uint32_t nof_carriers; // Number of RF channels
uint32_t nof_antennas; // Number of antennas per RF channel
std::string device_name;
std::string device_args;
std::string time_adv_nsamples;
std::string continuous_tx;
std::array<rf_args_band_t, SRSLTE_MAX_CARRIERS> ch_rx_bands;
std::array<rf_args_band_t, SRSLTE_MAX_CARRIERS> ch_tx_bands;
} rf_args_t;
struct vnf_args_t {
std::string type;
std::string bind_addr;
uint16_t bind_port;
std::string log_level;
int log_hex_limit;
};
class srslte_gw_config_t
{
public:
explicit srslte_gw_config_t(uint32_t lcid_ = 0) : lcid(lcid_) {}
uint32_t lcid;
};
class read_pdu_interface
{
public:
virtual int read_pdu(uint32_t lcid, uint8_t* payload, uint32_t requested_bytes) = 0;
};
class stack_interface_phy_nr
{};
} // namespace srslte
#endif // SRSLTE_INTERFACES_COMMON_H

@ -1,41 +0,0 @@
/**
* Copyright 2013-2021 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_LOG_HELPER_H
#define SRSLTE_LOG_HELPER_H
/**
* @file log_helper.h
*
* Convenience macro to log formatted messages. It is checked if the log pointer is still valid before accessing it.
*/
namespace srslte {
#define Error(fmt, ...) logger.error(fmt, ##__VA_ARGS__)
#define Warning(fmt, ...) logger.warning(fmt, ##__VA_ARGS__)
#define Info(fmt, ...) logger.info(fmt, ##__VA_ARGS__)
#define Debug(fmt, ...) logger.debug(fmt, ##__VA_ARGS__)
#define Console(fmt, ...) srslte::console(fmt, ##__VA_ARGS__)
} // namespace srslte
#endif // SRSLTE_LOG_HELPER_H

@ -1,47 +0,0 @@
/**
* Copyright 2013-2021 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_MAC_PCAP_H
#define SRSLTE_MAC_PCAP_H
#include "srslte/common/common.h"
#include "srslte/common/mac_pcap_base.h"
#include "srslte/srslte.h"
namespace srslte {
class mac_pcap : public mac_pcap_base
{
public:
mac_pcap();
~mac_pcap();
uint32_t open(std::string filename, uint32_t ue_id = 0);
uint32_t close();
private:
void write_pdu(srslte::mac_pcap_base::pcap_pdu_t& pdu);
FILE* pcap_file = nullptr;
uint32_t dlt = 0; // The DLT used for the PCAP file
std::string filename;
};
} // namespace srslte
#endif // SRSLTE_MAC_PCAP_H

@ -1,53 +0,0 @@
/**
* Copyright 2013-2021 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_MAC_PCAP_NET_H
#define SRSLTE_MAC_PCAP_NET_H
#include "srslte/common/common.h"
#include "srslte/common/mac_pcap_base.h"
#include "srslte/common/network_utils.h"
#include "srslte/srslte.h"
namespace srslte {
class mac_pcap_net : public mac_pcap_base
{
public:
mac_pcap_net();
~mac_pcap_net();
uint32_t open(std::string client_ip_addr_,
std::string bind_addr_str = "0.0.0.0",
uint16_t client_udp_port_ = 5847,
uint16_t bind_udp_port_ = 5687,
uint32_t ue_id_ = 0);
uint32_t close();
private:
void write_pdu(srslte::mac_pcap_base::pcap_pdu_t& pdu);
void write_mac_lte_pdu_to_net(srslte::mac_pcap_base::pcap_pdu_t& pdu);
void write_mac_nr_pdu_to_net(srslte::mac_pcap_base::pcap_pdu_t& pdu);
srslte::socket_handler_t socket;
struct sockaddr_in client_addr;
};
} // namespace srslte
#endif // SRSLTE_MAC_PCAP_NET_H

@ -1,54 +0,0 @@
/**
* Copyright 2013-2021 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_NAS_PCAP_H
#define SRSLTE_NAS_PCAP_H
#include "srslte/common/pcap.h"
#include <string>
namespace srslte {
class nas_pcap
{
public:
nas_pcap()
{
enable_write = false;
ue_id = 0;
pcap_file = NULL;
}
void enable();
uint32_t open(std::string filename_, uint32_t ue_id = 0);
void close();
void write_nas(uint8_t* pdu, uint32_t pdu_len_bytes);
private:
bool enable_write;
std::string filename;
FILE* pcap_file;
uint32_t ue_id;
void pack_and_write(uint8_t* pdu, uint32_t pdu_len_bytes);
};
} // namespace srslte
#endif // SRSLTE_NAS_PCAP_H

@ -1,49 +0,0 @@
/**
* Copyright 2013-2021 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_S1AP_PCAP_H
#define SRSLTE_S1AP_PCAP_H
#include "srslte/common/pcap.h"
namespace srslte {
class s1ap_pcap
{
public:
s1ap_pcap()
{
enable_write = false;
pcap_file = NULL;
}
void enable();
void open(const char* filename);
void close();
void write_s1ap(uint8_t* pdu, uint32_t pdu_len_bytes);
private:
bool enable_write;
FILE* pcap_file;
};
} // namespace srslte
#endif // SRSLTE_NAS_PCAP_H

@ -1,80 +0,0 @@
/**
* Copyright 2013-2021 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/.
*
*/
/**
* @file signal_handler.h
* @brief Common signal handling methods for all srsLTE applications.
*/
#ifndef SRSLTE_SIGNAL_HANDLER_H
#define SRSLTE_SIGNAL_HANDLER_H
#include "srslte/srslog/sink.h"
#include "srslte/srslog/srslog.h"
#include <signal.h>
#include <stdio.h>
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
#define SRSLTE_TERM_TIMEOUT_S (5)
// static vars required by signal handling
static srslog::sink* log_sink = nullptr;
static bool running = true;
static void srslte_signal_handler(int signal)
{
switch (signal) {
case SIGALRM:
fprintf(stderr, "Couldn't stop after %ds. Forcing exit.\n", SRSLTE_TERM_TIMEOUT_S);
srslog::flush();
//:TODO: refactor the sighandler, should not depend on log utilities
if (log_sink) {
log_sink->flush();
}
raise(SIGKILL);
default:
// all other registered signals try to stop the app gracefully
if (running) {
running = false;
fprintf(stdout, "Stopping ..\n");
alarm(SRSLTE_TERM_TIMEOUT_S);
} else {
// already waiting for alarm to go off ..
}
break;
}
}
void srslte_register_signal_handler()
{
signal(SIGINT, srslte_signal_handler);
signal(SIGTERM, srslte_signal_handler);
signal(SIGHUP, srslte_signal_handler);
signal(SIGALRM, srslte_signal_handler);
}
#ifdef __cplusplus
}
#endif // __cplusplus
#endif // SRSLTE_SIGNAL_HANDLER_H

@ -1,35 +0,0 @@
/**
* Copyright 2013-2021 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_STANDARD_STREAMS_H
#define SRSLTE_STANDARD_STREAMS_H
namespace srslte {
/// Writes the formatted string to the standard output stream.
void console(const char* str, ...);
/// Writes the formatted string to the standard error stream.
void console_stderr(const char* str, ...);
} // namespace srslte
#endif // SRSLTE_STANDARD_STREAMS_H

@ -1,54 +0,0 @@
/**
* Copyright 2013-2021 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/.
*
*/
/******************************************************************************
* File: tti_synch_cv.h
* Description: Implements tti_sync interface with condition variables.
* Reference:
*****************************************************************************/
#ifndef SRSLTE_TTI_SYNC_CV_H
#define SRSLTE_TTI_SYNC_CV_H
#include "srslte/common/tti_sync.h"
#include <pthread.h>
namespace srslte {
class tti_sync_cv : public tti_sync
{
public:
tti_sync_cv(uint32_t modulus = 10240);
~tti_sync_cv();
void increase();
void increase(uint32_t cnt);
uint32_t wait();
void resync();
void set_producer_cntr(uint32_t producer_cntr);
private:
pthread_cond_t cond;
pthread_mutex_t mutex;
};
} // namespace srslte
#endif // SRSLTE_TTI_SYNC_CV_H

@ -1,59 +0,0 @@
/**
* Copyright 2013-2021 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_ZUC_H
#define SRSLTE_ZUC_H
typedef unsigned char u8;
typedef unsigned int u32;
/* the state registers of LFSR */
typedef struct {
u32 LFSR_S0;
u32 LFSR_S1;
u32 LFSR_S2;
u32 LFSR_S3;
u32 LFSR_S4;
u32 LFSR_S5;
u32 LFSR_S6;
u32 LFSR_S7;
u32 LFSR_S8;
u32 LFSR_S9;
u32 LFSR_S10;
u32 LFSR_S11;
u32 LFSR_S12;
u32 LFSR_S13;
u32 LFSR_S14;
u32 LFSR_S15;
/* the registers of F */
u32 F_R1;
u32 F_R2;
/* the outputs of BitReorganization */
u32 BRC_X0;
u32 BRC_X1;
u32 BRC_X2;
u32 BRC_X3;
} zuc_state_t;
void zuc_initialize(zuc_state_t* state, const u8* k, u8* iv);
void zuc_generate_keystream(zuc_state_t* state, int key_stream_len, u32* p_keystream);
#endif // SRSLTE_ZUC_H

@ -1,73 +0,0 @@
/**
* Copyright 2013-2021 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_CONFIG_H
#define SRSLTE_CONFIG_H
// Generic helper definitions for shared library support
#if defined _WIN32 || defined __CYGWIN__
#define SRSLTE_IMPORT __declspec(dllimport)
#define SRSLTE_EXPORT __declspec(dllexport)
#define SRSLTE_LOCAL
#else
#if __GNUC__ >= 4
#define SRSLTE_IMPORT __attribute__((visibility("default")))
#define SRSLTE_EXPORT __attribute__((visibility("default")))
#else
#define SRSLTE_IMPORT
#define SRSLTE_EXPORT
#define SRSLTE_LOCAL
#endif
#endif
// Define SRSLTE_API
// SRSLTE_API is used for the public API symbols.
#ifdef SRSLTE_DLL_EXPORTS // defined if we are building the SRSLTE DLL (instead of using it)
#define SRSLTE_API SRSLTE_EXPORT
#else
#define SRSLTE_API SRSLTE_IMPORT
#endif
// Useful macros for templates
#define CONCAT(a, b) a##b
#define CONCAT2(a, b) CONCAT(a, b)
#define STRING2(x) #x
#define STRING(x) STRING2(x)
// Common error codes
#define SRSLTE_SUCCESS 0
#define SRSLTE_ERROR -1
#define SRSLTE_ERROR_INVALID_INPUTS -2
#define SRSLTE_ERROR_TIMEOUT -3
#define SRSLTE_ERROR_INVALID_COMMAND -4
#define SRSLTE_ERROR_OUT_OF_BOUNDS -5
#define SRSLTE_ERROR_CANT_START -6
#define SRSLTE_ERROR_ALREADY_STARTED -7
// cf_t definition
typedef _Complex float cf_t;
#ifdef ENABLE_C16
typedef _Complex short int c16_t;
#endif /* ENABLE_C16 */
#endif // SRSLTE_CONFIG_H

@ -1,40 +0,0 @@
/**
* Copyright 2013-2021 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_ENB_COMMAND_INTERFACE_H
#define SRSLTE_ENB_COMMAND_INTERFACE_H
#include <cstdint>
namespace srsenb {
class enb_command_interface
{
public:
/**
* Sets the relative gain of a cell from it's index (following rr.conf) order.
* @param cell_id Provides a cell identifier
* @param gain Relative gain
*/
virtual void cmd_cell_gain(uint32_t cell_id, float gain) = 0;
};
} // namespace srsenb
#endif // SRSLTE_ENB_COMMAND_INTERFACE_H

@ -1,48 +0,0 @@
/**
* Copyright 2013-2021 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/.
*
*/
#include "srslte/common/common.h"
#include "srslte/common/interfaces_common.h"
#include "srslte/srslte.h"
#ifndef SRSLTE_ENB_INTERFACES_H
#define SRSLTE_ENB_INTERFACES_H
namespace srsenb {
class stack_interface_phy_lte;
class stack_interface_s1ap_lte
{
public:
virtual void add_mme_socket(int fd) = 0;
virtual void remove_mme_socket(int fd) = 0;
};
class stack_interface_gtpu_lte
{
public:
virtual void add_gtpu_s1u_socket_handler(int fd) = 0;
virtual void add_gtpu_m1u_socket_handler(int fd) = 0;
};
} // namespace srsenb
#endif // SRSLTE_ENB_INTERFACES_H

@ -1,74 +0,0 @@
/**
* Copyright 2013-2021 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_ENB_METRICS_INTERFACE_H
#define SRSLTE_ENB_METRICS_INTERFACE_H
#include <stdint.h>
#include "srsenb/hdr/phy/phy_metrics.h"
#include "srsenb/hdr/stack/mac/mac_metrics.h"
#include "srsenb/hdr/stack/rrc/rrc_metrics.h"
#include "srsenb/hdr/stack/upper/common_enb.h"
#include "srsenb/hdr/stack/upper/s1ap_metrics.h"
#include "srslte/system/sys_metrics.h"
#include "srslte/common/metrics_hub.h"
#include "srslte/radio/radio_metrics.h"
#include "srslte/upper/pdcp_metrics.h"
#include "srslte/upper/rlc_metrics.h"
#include "srsue/hdr/stack/upper/gw_metrics.h"
namespace srsenb {
struct rlc_metrics_t {
std::vector<srslte::rlc_metrics_t> ues;
};
struct pdcp_metrics_t {
std::vector<srslte::pdcp_metrics_t> ues;
};
struct stack_metrics_t {
mac_metrics_t mac;
rrc_metrics_t rrc;
rlc_metrics_t rlc;
pdcp_metrics_t pdcp;
s1ap_metrics_t s1ap;
};
struct enb_metrics_t {
srslte::rf_metrics_t rf;
std::vector<phy_metrics_t> phy;
stack_metrics_t stack;
srslte::sys_metrics_t sys;
bool running;
};
// ENB interface
class enb_metrics_interface : public srslte::metrics_interface<enb_metrics_t>
{
public:
virtual bool get_metrics(enb_metrics_t* m) = 0;
};
} // namespace srsenb
#endif // SRSLTE_ENB_METRICS_INTERFACE_H

@ -1,50 +0,0 @@
/**
* Copyright 2013-2021 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_COMMON_NR_H
#define SRSLTE_COMMON_NR_H
namespace srslte {
// NR Radio Bearer Id
enum rb_id_nr_t { NR_SRB0, NR_SRB1, NR_SRB2, NR_SRB3, NR_DRB1, RB_ID_NR_N_ITEMS };
inline const char* to_string(rb_id_nr_t rb_id)
{
const static char* names[] = {"SRB0", "SRB1", "SRB2", "SRB3", "DRB1"};
return (rb_id < rb_id_nr_t::RB_ID_NR_N_ITEMS) ? names[rb_id] : "invalid bearer id";
}
inline bool is_srb(rb_id_nr_t lcid)
{
return lcid <= rb_id_nr_t::NR_SRB3;
}
inline bool is_drb(rb_id_nr_t lcid)
{
return not is_srb(lcid) and lcid <= rb_id_nr_t::RB_ID_NR_N_ITEMS;
}
inline int get_drb_id(rb_id_nr_t rb_id)
{
return is_drb(rb_id) ? (rb_id - 3) : -1;
}
} // namespace srslte
#endif // SRSLTE_NR_COMMON_INTERFACE_TYPES_H

@ -1,79 +0,0 @@
/**
* Copyright 2013-2021 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_PHY_INTERFACE_TYPES_H
#define SRSLTE_PHY_INTERFACE_TYPES_H
#include "srslte/srslte.h"
/// Common types defined by the PHY layer.
inline bool operator==(const srslte_tdd_config_t& a, const srslte_tdd_config_t& b)
{
return (a.sf_config == b.sf_config && a.ss_config == b.ss_config && a.configured == b.configured);
}
inline bool operator!=(const srslte_tdd_config_t& a, const srslte_tdd_config_t& b)
{
return !(a == b);
}
inline bool operator==(const srslte_prach_cfg_t& a, const srslte_prach_cfg_t& b)
{
return (a.config_idx == b.config_idx && a.root_seq_idx == b.root_seq_idx && a.zero_corr_zone == b.zero_corr_zone &&
a.freq_offset == b.freq_offset && a.num_ra_preambles == b.num_ra_preambles && a.hs_flag == b.hs_flag &&
a.tdd_config == b.tdd_config && a.enable_successive_cancellation == b.enable_successive_cancellation &&
a.enable_freq_domain_offset_calc == b.enable_freq_domain_offset_calc);
}
inline bool operator!=(const srslte_prach_cfg_t& a, const srslte_prach_cfg_t& b)
{
return !(a == b);
}
namespace srsue {
struct phy_meas_nr_t {
float rsrp;
float rsrq;
float sinr;
float cfo_hz;
uint32_t arfcn_nr;
uint32_t pci_nr;
};
struct phy_meas_t {
float rsrp;
float rsrq;
float cfo_hz;
uint32_t earfcn;
uint32_t pci;
};
struct phy_cell_t {
uint32_t pci;
uint32_t earfcn;
float cfo_hz;
};
} // namespace srsue
#endif // SRSLTE_PHY_INTERFACE_TYPES_H

@ -1,53 +0,0 @@
/**
* Copyright 2013-2021 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/.
*
*/
/******************************************************************************
* File: interfaces.h
* Description: Abstract base class interfaces provided by layers
* to other layers.
*****************************************************************************/
#ifndef SRSLTE_UE_INTERFACES_H
#define SRSLTE_UE_INTERFACES_H
#include "ue_mac_interfaces.h"
#include "ue_rrc_interfaces.h"
namespace srsue {
// STACK interface for RRC
class stack_interface_rrc
{
public:
virtual srslte::tti_point get_current_tti() = 0;
};
// Combined interface for PHY to access stack (MAC and RRC)
class stack_interface_phy_lte : public mac_interface_phy_lte, public rrc_interface_phy_lte
{
public:
/* Indicate new TTI */
virtual void run_tti(const uint32_t tti, const uint32_t tti_jump) = 0;
};
} // namespace srsue
#endif // SRSLTE_UE_INTERFACES_H

@ -1,108 +0,0 @@
/**
* Copyright 2013-2021 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/.
*
*/
/**********************************************************************************************
* File: agc.h
*
* Description: Automatic gain control
* This module is not currently used
*
* Reference:
*********************************************************************************************/
#ifndef SRSLTE_AGC_H
#define SRSLTE_AGC_H
#include <complex.h>
#include <stdbool.h>
#include <stdint.h>
#include "srslte/config.h"
#define SRSLTE_AGC_CALLBACK(NAME) void(NAME)(void* h, float gain_db)
#define SRSLTE_AGC_DEFAULT_TARGET (0.3f) /* Average RMS target or maximum peak target*/
#define SRSLTE_AGC_DEFAULT_BW (0.3f) /* Moving average coefficient */
#define SRSLTE_AGC_HOLD_COUNT (20) /* Number of frames to wait after setting the gain before start measuring */
#define SRSLTE_AGC_MIN_MEASUREMENTS (10) /* Minimum number of measurements */
#define SRSLTE_AGC_MIN_GAIN_OFFSET (2.0f) /* Mimum of gain offset to set the radio gain */
typedef enum SRSLTE_API { SRSLTE_AGC_MODE_ENERGY = 0, SRSLTE_AGC_MODE_PEAK_AMPLITUDE } srslte_agc_mode_t;
/*
* The AGC has been implemented using 3 states:
* - init: it simply starts the process of measuring
* - measure: performs a minimum of SRSLTE_AGC_MIN_MEASUREMENTS and does not set the gain until it needs
* SRSLTE_AGC_MIN_GAIN_OFFSET dB more of gain. The gain is set in the enter hold transition.
* - hold: waits for SRSLTE_AGC_HOLD_COUNT frames as a Rx gain transition period. After this period, it enters measure
* state.
*
* FSM abstraction:
*
* +------+ Enter measure +---------+ Enter hold +------+
* | init | ---------------->| Measure |--------------->| Hold |
* +------+ +---------+ +------+
* ^ Enter measure |
* +-------------------------+
*/
typedef enum { SRSLTE_AGC_STATE_INIT = 0, SRSLTE_AGC_STATE_MEASURE, SRSLTE_AGC_STATE_HOLD } srslte_agc_state_t;
typedef struct SRSLTE_API {
float bandwidth;
float gain_db;
float gain_offset_db;
float min_gain_db;
float max_gain_db;
float default_gain_db;
float y_out;
bool isfirst;
void* uhd_handler;
SRSLTE_AGC_CALLBACK(*set_gain_callback);
srslte_agc_mode_t mode;
float target;
uint32_t nof_frames;
uint32_t frame_cnt;
uint32_t hold_cnt;
float* y_tmp;
srslte_agc_state_t state;
} srslte_agc_t;
SRSLTE_API int srslte_agc_init_acc(srslte_agc_t* q, srslte_agc_mode_t mode, uint32_t nof_frames);
SRSLTE_API int srslte_agc_init_uhd(srslte_agc_t* q,
srslte_agc_mode_t mode,
uint32_t nof_frames,
SRSLTE_AGC_CALLBACK(set_gain_callback),
void* uhd_handler);
SRSLTE_API void srslte_agc_free(srslte_agc_t* q);
SRSLTE_API void srslte_agc_reset(srslte_agc_t* q);
SRSLTE_API void srslte_agc_set_gain_range(srslte_agc_t* q, float min_gain_db, float max_gain_db);
SRSLTE_API float srslte_agc_get_gain(srslte_agc_t* q);
SRSLTE_API void srslte_agc_set_gain(srslte_agc_t* q, float init_gain_value_db);
SRSLTE_API void srslte_agc_process(srslte_agc_t* q, cf_t* signal, uint32_t len);
#endif // SRSLTE_AGC_H

@ -1,51 +0,0 @@
/**
* Copyright 2013-2021 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_CHEST_COMMON_H
#define SRSLTE_CHEST_COMMON_H
#include "srslte/config.h"
#include <stdint.h>
#define SRSLTE_CHEST_MAX_SMOOTH_FIL_LEN 64
typedef enum SRSLTE_API {
SRSLTE_CHEST_FILTER_GAUSS = 0,
SRSLTE_CHEST_FILTER_TRIANGLE,
SRSLTE_CHEST_FILTER_NONE
} srslte_chest_filter_t;
SRSLTE_API void srslte_chest_average_pilots(cf_t* input,
cf_t* output,
float* filter,
uint32_t nof_ref,
uint32_t nof_symbols,
uint32_t filter_len);
SRSLTE_API uint32_t srslte_chest_set_smooth_filter3_coeff(float* smooth_filter, float w);
SRSLTE_API float srslte_chest_estimate_noise_pilots(cf_t* noisy, cf_t* noiseless, cf_t* noise_vec, uint32_t nof_pilots);
SRSLTE_API uint32_t srslte_chest_set_triangle_filter(float* fil, int filter_len);
SRSLTE_API uint32_t srslte_chest_set_smooth_filter_gauss(float* filter, uint32_t order, float std_dev);
#endif // SRSLTE_CHEST_COMMON_H

@ -1,173 +0,0 @@
/**
* Copyright 2013-2021 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/.
*
*/
/**********************************************************************************************
* File: chest_dl.h
*
* Description: 3GPP LTE Downlink channel estimator and equalizer.
* Estimates the channel in the resource elements transmitting references and
* interpolates for the rest of the resource grid.
* The equalizer uses the channel estimates to produce an estimation of the
* transmitted symbol.
* This object depends on the srslte_refsignal_t object for creating the LTE
* CSR signal.
*
* Reference:
*********************************************************************************************/
#ifndef SRSLTE_CHEST_DL_H
#define SRSLTE_CHEST_DL_H
#include <stdio.h>
#include "srslte/config.h"
#include "srslte/phy/ch_estimation/chest_common.h"
#include "srslte/phy/ch_estimation/refsignal_dl.h"
#include "srslte/phy/common/phy_common.h"
#include "srslte/phy/resampling/interp.h"
#include "srslte/phy/sync/pss.h"
#include "wiener_dl.h"
typedef struct SRSLTE_API {
cf_t* ce[SRSLTE_MAX_PORTS][SRSLTE_MAX_PORTS];
uint32_t nof_re;
float noise_estimate;
float noise_estimate_dbm;
float snr_db;
float snr_ant_port_db[SRSLTE_MAX_PORTS][SRSLTE_MAX_PORTS];
float rsrp;
float rsrp_dbm;
float rsrp_neigh;
float rsrp_port_dbm[SRSLTE_MAX_PORTS];
float rsrp_ant_port_dbm[SRSLTE_MAX_PORTS][SRSLTE_MAX_PORTS];
float rsrq;
float rsrq_db;
float rsrq_ant_port_db[SRSLTE_MAX_PORTS][SRSLTE_MAX_PORTS];
float rssi_dbm;
float cfo;
float sync_error;
} srslte_chest_dl_res_t;
// Noise estimation algorithm
typedef enum SRSLTE_API {
SRSLTE_NOISE_ALG_REFS = 0,
SRSLTE_NOISE_ALG_PSS,
SRSLTE_NOISE_ALG_EMPTY,
} srslte_chest_dl_noise_alg_t;
// Channel estimator algorithm
typedef enum SRSLTE_API {
SRSLTE_ESTIMATOR_ALG_AVERAGE = 0,
SRSLTE_ESTIMATOR_ALG_INTERPOLATE,
SRSLTE_ESTIMATOR_ALG_WIENER,
} srslte_chest_dl_estimator_alg_t;
typedef struct SRSLTE_API {
srslte_cell_t cell;
uint32_t nof_rx_antennas;
srslte_refsignal_t csr_refs;
srslte_refsignal_t** mbsfn_refs;
srslte_wiener_dl_t* wiener_dl;
cf_t* pilot_estimates;
cf_t* pilot_estimates_average;
cf_t* pilot_recv_signal;
cf_t* tmp_noise;
cf_t* tmp_cfo_estimate;
#ifdef FREQ_SEL_SNR
float snr_vector[12000];
float pilot_power[12000];
#endif
srslte_interp_linsrslte_vec_t srslte_interp_linvec;
srslte_interp_lin_t srslte_interp_lin;
srslte_interp_lin_t srslte_interp_lin_3;
srslte_interp_lin_t srslte_interp_lin_mbsfn;
float rssi[SRSLTE_MAX_PORTS][SRSLTE_MAX_PORTS];
float rsrp[SRSLTE_MAX_PORTS][SRSLTE_MAX_PORTS];
float rsrp_corr[SRSLTE_MAX_PORTS][SRSLTE_MAX_PORTS];
float noise_estimate[SRSLTE_MAX_PORTS][SRSLTE_MAX_PORTS];
float sync_err[SRSLTE_MAX_PORTS][SRSLTE_MAX_PORTS];
float cfo;
/* Use PSS for noise estimation in LS linear interpolation mode */
cf_t pss_signal[SRSLTE_PSS_LEN];
cf_t tmp_pss[SRSLTE_PSS_LEN];
cf_t tmp_pss_noisy[SRSLTE_PSS_LEN];
} srslte_chest_dl_t;
typedef struct SRSLTE_API {
srslte_chest_dl_estimator_alg_t estimator_alg;
srslte_chest_dl_noise_alg_t noise_alg;
srslte_chest_filter_t filter_type;
float filter_coef[2];
uint16_t mbsfn_area_id;
bool rsrp_neighbour;
bool cfo_estimate_enable;
uint32_t cfo_estimate_sf_mask;
bool sync_error_enable;
} srslte_chest_dl_cfg_t;
SRSLTE_API int srslte_chest_dl_init(srslte_chest_dl_t* q, uint32_t max_prb, uint32_t nof_rx_antennas);
SRSLTE_API void srslte_chest_dl_free(srslte_chest_dl_t* q);
SRSLTE_API int srslte_chest_dl_res_init(srslte_chest_dl_res_t* q, uint32_t max_prb);
SRSLTE_API int srslte_chest_dl_res_init_re(srslte_chest_dl_res_t* q, uint32_t nof_re);
SRSLTE_API void srslte_chest_dl_res_set_identity(srslte_chest_dl_res_t* q);
SRSLTE_API void srslte_chest_dl_res_set_ones(srslte_chest_dl_res_t* q);
SRSLTE_API void srslte_chest_dl_res_free(srslte_chest_dl_res_t* q);
/* These functions change the internal object state */
SRSLTE_API int srslte_chest_dl_set_mbsfn_area_id(srslte_chest_dl_t* q, uint16_t mbsfn_area_id);
SRSLTE_API int srslte_chest_dl_set_cell(srslte_chest_dl_t* q, srslte_cell_t cell);
/* These functions do not change the internal state */
SRSLTE_API int srslte_chest_dl_estimate(srslte_chest_dl_t* q,
srslte_dl_sf_cfg_t* sf,
cf_t* input[SRSLTE_MAX_PORTS],
srslte_chest_dl_res_t* res);
SRSLTE_API int srslte_chest_dl_estimate_cfg(srslte_chest_dl_t* q,
srslte_dl_sf_cfg_t* sf,
srslte_chest_dl_cfg_t* cfg,
cf_t* input[SRSLTE_MAX_PORTS],
srslte_chest_dl_res_t* res);
SRSLTE_API srslte_chest_dl_estimator_alg_t srslte_chest_dl_str2estimator_alg(const char* str);
#endif // SRSLTE_CHEST_DL_H

@ -1,97 +0,0 @@
/**
* Copyright 2013-2021 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_CHEST_DL_NBIOT_H
#define SRSLTE_CHEST_DL_NBIOT_H
#include <stdio.h>
#include "srslte/config.h"
#include "srslte/phy/ch_estimation/chest_common.h"
#include "srslte/phy/ch_estimation/chest_dl.h"
#include "srslte/phy/ch_estimation/refsignal_dl_nbiot.h"
#include "srslte/phy/common/phy_common.h"
#include "srslte/phy/resampling/interp.h"
/*! \brief Downlink channel estimation for NB-IoT
*
* Estimates the channel in the resource elements transmitting references and
* interpolates for the rest of the resource grid.
* The equalizer uses the channel estimates to produce an estimation of the
* transmitted symbol.
* This object depends on the srslte_refsignal_t object for creating the LTE CSR signal.
*/
typedef struct {
srslte_nbiot_cell_t cell;
srslte_refsignal_dl_nbiot_t nrs_signal;
cf_t* pilot_estimates;
cf_t* pilot_estimates_average;
cf_t* pilot_recv_signal;
cf_t* tmp_noise;
uint32_t smooth_filter_len;
float smooth_filter[SRSLTE_CHEST_MAX_SMOOTH_FIL_LEN];
srslte_interp_linsrslte_vec_t srslte_interp_linvec;
srslte_interp_lin_t srslte_interp_lin;
float rssi[SRSLTE_MAX_PORTS];
float rsrp[SRSLTE_MAX_PORTS];
float noise_estimate[SRSLTE_MAX_PORTS];
srslte_chest_dl_noise_alg_t noise_alg;
} srslte_chest_dl_nbiot_t;
SRSLTE_API int srslte_chest_dl_nbiot_init(srslte_chest_dl_nbiot_t* q, uint32_t max_prb);
SRSLTE_API void srslte_chest_dl_nbiot_free(srslte_chest_dl_nbiot_t* q);
SRSLTE_API int srslte_chest_dl_nbiot_set_cell(srslte_chest_dl_nbiot_t* q, srslte_nbiot_cell_t cell);
SRSLTE_API void srslte_chest_dl_nbiot_set_smooth_filter(srslte_chest_dl_nbiot_t* q, float* filter, uint32_t filter_len);
SRSLTE_API void srslte_chest_dl_nbiot_set_smooth_filter3_coeff(srslte_chest_dl_nbiot_t* q, float w);
SRSLTE_API void srslte_chest_dl_nbiot_set_noise_alg(srslte_chest_dl_nbiot_t* q,
srslte_chest_dl_noise_alg_t noise_estimation_alg);
SRSLTE_API int srslte_chest_dl_nbiot_estimate(srslte_chest_dl_nbiot_t* q, cf_t* input, cf_t** ce, uint32_t sf_idx);
SRSLTE_API int srslte_chest_dl_nbiot_estimate_port(srslte_chest_dl_nbiot_t* q,
cf_t* input,
cf_t* ce,
uint32_t sf_idx,
uint32_t port_id);
SRSLTE_API float srslte_chest_dl_nbiot_get_noise_estimate(srslte_chest_dl_nbiot_t* q);
SRSLTE_API float srslte_chest_dl_nbiot_get_snr(srslte_chest_dl_nbiot_t* q);
SRSLTE_API float srslte_chest_dl_nbiot_get_rssi(srslte_chest_dl_nbiot_t* q);
SRSLTE_API float srslte_chest_dl_nbiot_get_rsrq(srslte_chest_dl_nbiot_t* q);
SRSLTE_API float srslte_chest_dl_nbiot_get_rsrp(srslte_chest_dl_nbiot_t* q);
#endif // SRSLTE_CHEST_DL_NBIOT_H

@ -1,116 +0,0 @@
/**
* Copyright 2013-2021 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_CHEST_SL_H
#define SRSLTE_CHEST_SL_H
#include <stdio.h>
#include "srslte/phy/common/phy_common_sl.h"
#include "srslte/phy/resampling/interp.h"
#define SRSLTE_SL_N_RU_SEQ (30)
#define SRSLTE_SL_MAX_DMRS_SYMB (4)
#define SRSLTE_SL_DEFAULT_NOF_DMRS_CYCLIC_SHIFTS (1)
#define SRSLTE_SL_MAX_PSCCH_NOF_DMRS_CYCLIC_SHIFTS (4)
// Base Sequence Number - always 0 for sidelink: 3GPP TS 36.211 version 15.6.0 Release 15 Sec. 5.5.1.4
#define SRSLTE_SL_BASE_SEQUENCE_NUMBER 0
#define SRSLTE_SL_MAX_DMRS_PERIOD_LENGTH 320
typedef struct SRSLTE_API {
uint32_t prb_start_idx; // PRB start idx to map RE from RIV
uint32_t nof_prb; // PSSCH nof_prb, Length of continuous PRB to map RE (in the pool) from RIV
uint32_t N_x_id;
uint32_t sf_idx; // PSSCH sf_idx
uint32_t cyclic_shift;
} srslte_chest_sl_cfg_t;
typedef struct SRSLTE_API {
srslte_sl_channels_t channel;
srslte_cell_sl_t cell;
srslte_sl_comm_resource_pool_t sl_comm_resource_pool;
srslte_chest_sl_cfg_t chest_sl_cfg;
uint32_t sf_n_re;
uint32_t M_sc_rs;
int8_t nof_dmrs_symbols;
// Orthogonal Sequence (W) Transmission Mode 1, 2 and PSBCH
int8_t w[SRSLTE_SL_MAX_DMRS_SYMB];
// Cyclic Shift Values
int8_t n_CS[SRSLTE_SL_MAX_DMRS_SYMB];
// Reference Signal Cyclic Shift
float alpha[SRSLTE_SL_MAX_DMRS_SYMB];
// Group Hopping Flag
uint32_t* f_gh_pattern;
cf_t* r_sequence[SRSLTE_SL_MAX_DMRS_SYMB][SRSLTE_SL_MAX_PSCCH_NOF_DMRS_CYCLIC_SHIFTS];
cf_t* r_sequence_rx[SRSLTE_SL_MAX_DMRS_SYMB];
cf_t* ce;
cf_t* ce_average;
cf_t* noise_tmp;
float noise_estimated;
srslte_interp_linsrslte_vec_t lin_vec_sl;
bool sync_error_enable;
bool rsrp_enable;
float sync_err;
float rsrp_corr;
} srslte_chest_sl_t;
SRSLTE_API int srslte_chest_sl_init(srslte_chest_sl_t* q,
srslte_sl_channels_t channel,
srslte_cell_sl_t cell,
srslte_sl_comm_resource_pool_t sl_comm_resource_pool);
SRSLTE_API int srslte_chest_sl_set_cell(srslte_chest_sl_t* q, srslte_cell_sl_t cell);
SRSLTE_API int srslte_chest_sl_set_cfg(srslte_chest_sl_t* q, srslte_chest_sl_cfg_t chest_sl_cfg);
SRSLTE_API float srslte_chest_sl_get_sync_error(srslte_chest_sl_t* q);
SRSLTE_API float srslte_chest_sl_estimate_noise(srslte_chest_sl_t* q);
SRSLTE_API float srslte_chest_sl_get_rsrp(srslte_chest_sl_t* q);
SRSLTE_API int srslte_chest_sl_put_dmrs(srslte_chest_sl_t* q, cf_t* sf_buffer);
SRSLTE_API int srslte_chest_sl_get_dmrs(srslte_chest_sl_t* q, cf_t* sf_buffer, cf_t** dmrs_received);
SRSLTE_API void srslte_chest_sl_ls_estimate(srslte_chest_sl_t* q, cf_t* sf_buffer);
SRSLTE_API void srslte_chest_sl_ls_equalize(srslte_chest_sl_t* q, cf_t* sf_buffer, cf_t* equalized_sf_buffer);
SRSLTE_API void srslte_chest_sl_ls_estimate_equalize(srslte_chest_sl_t* q, cf_t* sf_buffer, cf_t* equalized_sf_buffer);
SRSLTE_API void srslte_chest_sl_free(srslte_chest_sl_t* q);
#endif

@ -1,125 +0,0 @@
/**
* Copyright 2013-2021 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/.
*
*/
/**********************************************************************************************
* File: chest_ul.h
*
* Description: 3GPP LTE Uplink channel estimator and equalizer.
* Estimates the channel in the resource elements transmitting references and
* interpolates for the rest of the resource grid.
* The equalizer uses the channel estimates to produce an estimation of the
* transmitted symbol.
*
* Reference:
*********************************************************************************************/
#ifndef SRSLTE_CHEST_UL_H
#define SRSLTE_CHEST_UL_H
#include <stdio.h>
#include "srslte/config.h"
#include "srslte/phy/ch_estimation/chest_common.h"
#include "srslte/phy/ch_estimation/refsignal_ul.h"
#include "srslte/phy/common/phy_common.h"
#include "srslte/phy/phch/pucch_cfg.h"
#include "srslte/phy/phch/pusch_cfg.h"
#include "srslte/phy/resampling/interp.h"
typedef struct SRSLTE_API {
cf_t* ce;
uint32_t nof_re;
float noise_estimate;
float noise_estimate_dbm;
float rsrp;
float rsrp_dBfs;
float epre;
float epre_dBfs;
float snr;
float snr_db;
float cfo_hz;
float ta_us;
} srslte_chest_ul_res_t;
typedef struct {
srslte_cell_t cell;
srslte_refsignal_ul_t dmrs_signal;
srslte_refsignal_ul_dmrs_pregen_t dmrs_pregen;
bool dmrs_signal_configured;
srslte_refsignal_srs_pregen_t srs_pregen;
bool srs_signal_configured;
cf_t* pilot_estimates;
cf_t* pilot_estimates_tmp[4];
cf_t* pilot_recv_signal;
cf_t* pilot_known_signal;
cf_t* tmp_noise;
#ifdef FREQ_SEL_SNR
float snr_vector[12000];
float pilot_power[12000];
#endif
uint32_t smooth_filter_len;
float smooth_filter[SRSLTE_CHEST_MAX_SMOOTH_FIL_LEN];
srslte_interp_linsrslte_vec_t srslte_interp_linvec;
} srslte_chest_ul_t;
SRSLTE_API int srslte_chest_ul_init(srslte_chest_ul_t* q, uint32_t max_prb);
SRSLTE_API void srslte_chest_ul_free(srslte_chest_ul_t* q);
SRSLTE_API int srslte_chest_ul_res_init(srslte_chest_ul_res_t* q, uint32_t max_prb);
SRSLTE_API void srslte_chest_ul_res_set_identity(srslte_chest_ul_res_t* q);
SRSLTE_API void srslte_chest_ul_res_free(srslte_chest_ul_res_t* q);
SRSLTE_API int srslte_chest_ul_set_cell(srslte_chest_ul_t* q, srslte_cell_t cell);
SRSLTE_API void srslte_chest_ul_pregen(srslte_chest_ul_t* q,
srslte_refsignal_dmrs_pusch_cfg_t* cfg,
srslte_refsignal_srs_cfg_t* srs_cfg);
SRSLTE_API int srslte_chest_ul_estimate_pusch(srslte_chest_ul_t* q,
srslte_ul_sf_cfg_t* sf,
srslte_pusch_cfg_t* cfg,
cf_t* input,
srslte_chest_ul_res_t* res);
SRSLTE_API int srslte_chest_ul_estimate_pucch(srslte_chest_ul_t* q,
srslte_ul_sf_cfg_t* sf,
srslte_pucch_cfg_t* cfg,
cf_t* input,
srslte_chest_ul_res_t* res);
SRSLTE_API int srslte_chest_ul_estimate_srs(srslte_chest_ul_t* q,
srslte_ul_sf_cfg_t* sf,
srslte_refsignal_srs_cfg_t* cfg,
srslte_refsignal_dmrs_pusch_cfg_t* pusch_cfg,
cf_t* input,
srslte_chest_ul_res_t* res);
#endif // SRSLTE_CHEST_UL_H

@ -1,133 +0,0 @@
/**
* Copyright 2013-2021 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_CSI_RS_H_
#define SRSLTE_CSI_RS_H_
#include "srslte/config.h"
#include "srslte/phy/common/phy_common_nr.h"
#include <complex.h>
#include <stdbool.h>
#include <stdint.h>
#define SRSLTE_CSI_RS_NOF_FREQ_DOMAIN_ALLOC_ROW1 4
#define SRSLTE_CSI_RS_NOF_FREQ_DOMAIN_ALLOC_ROW2 12
#define SRSLTE_CSI_RS_NOF_FREQ_DOMAIN_ALLOC_ROW4 3
#define SRSLTE_CSI_RS_NOF_FREQ_DOMAIN_ALLOC_OTHER 6
#define SRSLTE_CSI_RS_NOF_FREQ_DOMAIN_ALLOC_MAX 12
typedef enum SRSLTE_API {
srslte_csi_rs_resource_mapping_row_1 = 0,
srslte_csi_rs_resource_mapping_row_2,
srslte_csi_rs_resource_mapping_row_4,
srslte_csi_rs_resource_mapping_row_other,
} srslte_csi_rs_resource_mapping_row_t;
typedef enum SRSLTE_API {
srslte_csi_rs_resource_mapping_density_three = 0,
srslte_csi_rs_resource_mapping_density_dot5_even,
srslte_csi_rs_resource_mapping_density_dot5_odd,
srslte_csi_rs_resource_mapping_density_one,
srslte_csi_rs_resource_mapping_density_spare
} srslte_csi_rs_density_t;
typedef enum SRSLTE_API {
srslte_csi_rs_cdm_nocdm = 0,
srslte_csi_rs_cdm_fd_cdm2,
srslte_csi_rs_cdm_cdm4_fd2_td2,
srslte_csi_rs_cdm_cdm8_fd2_td4
} srslte_csi_rs_cdm_t;
/**
* @brief Contains CSI-FrequencyOccupation flattened configuration
*/
typedef struct SRSLTE_API {
uint32_t start_rb; ///< PRB where this CSI resource starts in relation to common resource block #0 (CRB#0) on the
///< common resource block grid. Only multiples of 4 are allowed (0, 4, ..., 274)
uint32_t nof_rb; ///< Number of PRBs across which this CSI resource spans. Only multiples of 4 are allowed. The
///< smallest configurable number is the minimum of 24 and the width of the associated BWP. If the
///< configured value is larger than the width of the corresponding BWP, the UE shall assume that the
///< actual CSI-RS bandwidth is equal to the width of the BWP.
} srslte_csi_rs_freq_occupation_t;
/**
* @brief Contains CSI-ResourcePeriodicityAndOffset flattened configuration
*/
typedef struct SRSLTE_API {
uint32_t period; // 4,5,8,10,16,20,32,40,64,80,160,320,640
uint32_t offset; // 0..period-1
} srslte_csi_rs_period_and_offset_t;
/**
* @brief Contains CSI-RS-ResourceMapping flattened configuration
*/
typedef struct SRSLTE_API {
srslte_csi_rs_resource_mapping_row_t row;
bool frequency_domain_alloc[SRSLTE_CSI_RS_NOF_FREQ_DOMAIN_ALLOC_MAX];
uint32_t ports; // 1, 2, 4, 8, 12, 16, 24, 32
uint32_t first_symbol_idx; // 0..13
uint32_t first_symbol_idx2; // 2..12 (set to 0 for disabled)
srslte_csi_rs_cdm_t cdm;
srslte_csi_rs_density_t density;
srslte_csi_rs_freq_occupation_t freq_band;
} srslte_csi_rs_resource_mapping_t;
/**
* @brief Contains NZP-CSI-RS-Resource flattened configuration
*/
typedef struct SRSLTE_API {
srslte_csi_rs_resource_mapping_t resource_mapping;
float power_control_offset; // -8..15 dB
float power_control_offset_ss; // -3, 0, 3, 6 dB
uint32_t scrambling_id; // 0..1023
srslte_csi_rs_period_and_offset_t periodicity;
} srslte_csi_rs_nzp_resource_t;
SRSLTE_API int srslte_csi_rs_nzp_put(const srslte_carrier_nr_t* carrier,
const srslte_slot_cfg_t* slot_cfg,
const srslte_csi_rs_nzp_resource_t* resource,
cf_t* grid);
typedef struct SRSLTE_API {
float rsrp;
float rsrp_dB;
float epre;
float epre_dB;
float n0;
float n0_dB;
float snr_dB;
uint32_t nof_re;
} srslte_csi_rs_measure_t;
SRSLTE_API int srslte_csi_rs_nzp_measure(const srslte_carrier_nr_t* carrier,
const srslte_slot_cfg_t* slot_cfg,
const srslte_csi_rs_nzp_resource_t* resource,
const cf_t* grid,
srslte_csi_rs_measure_t* measure);
SRSLTE_API uint32_t srslte_csi_rs_measure_info(const srslte_csi_rs_measure_t* measure, char* str, uint32_t str_len);
#endif // SRSLTE_CSI_RS_H_

@ -1,170 +0,0 @@
/**
* Copyright 2013-2021 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_DMRS_SCH_H
#define SRSLTE_DMRS_SCH_H
#include "srslte/phy/ch_estimation/chest_dl.h"
#include "srslte/phy/common/phy_common_nr.h"
#include "srslte/phy/phch/phch_cfg_nr.h"
#include <stdint.h>
#define SRSLTE_DMRS_SCH_MAX_SYMBOLS 4
/**
* @brief Helper macro for counting the number of subcarriers taken by DMRS in a PRB.
*/
#define SRSLTE_DMRS_SCH_SC(CDM_GROUPS, DMRS_TYPE) \
(SRSLTE_MIN(SRSLTE_NRE, (CDM_GROUPS) * ((DMRS_TYPE) == srslte_dmrs_sch_type_1 ? 6 : 4)))
/**
* @brief PDSCH DMRS estimator object
*
* @note The DMRS PDSCH object has to be initialised and the carrier parameters needs to be set.
*
* @see srslte_dmrs_sch_init
* @see srslte_dmrs_sch_set_carrier
* @see srslte_dmrs_sch_free
* @see srslte_dmrs_sch_put_sf
* @see srslte_dmrs_sch_estimate
*/
typedef struct {
bool is_rx;
srslte_carrier_nr_t carrier;
srslte_interp_lin_t interpolator_type1; /// Type 1 DMRS: 1 pilot every 2 RE
srslte_interp_lin_t interpolator_type2; /// Type 2 DMRS: 2 consecutive pilots every 6 RE
uint32_t max_nof_prb;
cf_t* pilot_estimates; /// Pilots least squares estimates
cf_t* temp; /// Temporal data vector of size SRSLTE_NRE * carrier.nof_prb
} srslte_dmrs_sch_t;
/**
* @brief Computes the symbol indexes carrying DMRS and stores them in symbols_idx
* @param dmrs_cfg DMRS configuration
* @param grant PDSCH information provided by a DCI
* @param symbols_idx is the destination pointer where the symbols indexes are stored
* @return It returns the number of symbols if inputs are valid, otherwise, it returns SRSLTE_ERROR code.
*/
SRSLTE_API int srslte_dmrs_sch_get_symbols_idx(const srslte_dmrs_sch_cfg_t* dmrs_cfg,
const srslte_sch_grant_nr_t* grant,
uint32_t symbols_idx[SRSLTE_DMRS_SCH_MAX_SYMBOLS]);
/**
* @brief Computes the sub-carrier indexes carrying DMRS
*
* @param cfg PDSCH DMRS configuration provided by upper layers
* @param max_count is the number of sub-carriers to generate
* @param sc_idx is the destination pointer where the sub-carrier indexes are stored
*
* @return It returns the number of sub-carriers if inputs are valid, otherwise, it returns SRSLTE_ERROR code.
*/
SRSLTE_API int srslte_dmrs_sch_get_sc_idx(const srslte_dmrs_sch_cfg_t* cfg, uint32_t max_count, uint32_t* sc_idx);
/**
* @brief Calculates the number of resource elements taken by a PDSCH-DMRS for a given PDSCH transmission
* @param dmrs_cfg PDSCH-DMRS configuration
* @param grant PDSCH information provided by a DCI
* @return it returns the number of resource elements if the configuration is valid, otherwise it returns SRSLTE_ERROR
*/
SRSLTE_API int srslte_dmrs_sch_get_N_prb(const srslte_dmrs_sch_cfg_t* dmrs_cfg, const srslte_sch_grant_nr_t* grant);
/**
* @brief Stringifies the PDSCH DMRS configuration
*
* @param cfg PDSCH DMRS configuration
* @param msg Pointer to the destination array
* @param max_len Maximum number of characters to write
*
* @return It returns the number of characters written in the vector if no error occurs, otherwise it returns
* SRSLTE_ERROR code
*/
SRSLTE_API int srslte_dmrs_sch_cfg_to_str(const srslte_dmrs_sch_cfg_t* cfg, char* msg, uint32_t max_len);
/**
* @brief Initialises DMRS PDSCH object
*
* @param q DMRS PDSCH object
* @param is_rx indicates whether the object is used as receiver (in this case, it shall initialise as an estimator)
* @return it returns SRSLTE_ERROR code if an error occurs, otherwise it returns SRSLTE_SUCCESS
*/
SRSLTE_API int srslte_dmrs_sch_init(srslte_dmrs_sch_t* q, bool is_rx);
/**
* @brief Frees DMRS PDSCH object
*
* @param q DMRS PDSCH object
*/
SRSLTE_API void srslte_dmrs_sch_free(srslte_dmrs_sch_t* q);
/**
* @brief Sets the carrier configuration. if the PDSCH DMRS object is configured as UE, it will resize internal buffers
* and objects.
*
* @param q DMRS PDSCH object
* @param carrier Carrier configuration
*
* @return it returns SRSLTE_ERROR code if an error occurs, otherwise it returns SRSLTE_SUCCESS
*/
SRSLTE_API int srslte_dmrs_sch_set_carrier(srslte_dmrs_sch_t* q, const srslte_carrier_nr_t* carrier);
/**
* @brief Puts PDSCH DMRS into a given resource grid
*
* @param q DMRS PDSCH object
* @param slot_cfg Slot configuration
* @param pdsch_cfg PDSCH configuration provided by upper layers
* @param grant PDSCH information provided by a DCI
* @param sf_symbols Resource grid
*
* @return it returns SRSLTE_ERROR code if an error occurs, otherwise it returns SRSLTE_SUCCESS
*/
SRSLTE_API int srslte_dmrs_sch_put_sf(srslte_dmrs_sch_t* q,
const srslte_slot_cfg_t* slot_cfg,
const srslte_sch_cfg_nr_t* pdsch_cfg,
const srslte_sch_grant_nr_t* grant,
cf_t* sf_symbols);
/**
* @brief Estimates the channel for PDSCH from the DMRS
*
* @attention Current implementation supports only type1 PDSCH DMRS (1 pilot every 2 RE)
*
* @param q DMRS-PDSCH object
* @param slot_cfg Slot configuration
* @param pdsch_cfg PDSCH configuration provided by upper layers
* @param grant PDSCH information provided by a DCI
* @param sf_symbols Received resource grid
* @param[out] ce Channel estimates
*
* @return it returns SRSLTE_ERROR code if an error occurs, otherwise it returns SRSLTE_SUCCESS
*/
SRSLTE_API int srslte_dmrs_sch_estimate(srslte_dmrs_sch_t* q,
const srslte_slot_cfg_t* slot_cfg,
const srslte_sch_cfg_nr_t* pdsch_cfg,
const srslte_sch_grant_nr_t* grant,
const cf_t* sf_symbols,
srslte_chest_dl_res_t* chest_res);
#endif // SRSLTE_DMRS_SCH_H

@ -1,101 +0,0 @@
/**
* Copyright 2013-2021 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/.
*
*/
/**********************************************************************************************
* File: refsignal_dl.h
*
* Description: Object to manage downlink reference signals for channel estimation.
*
* Reference: 3GPP TS 36.211 version 10.0.0 Release 10 Sec. 6.10
*********************************************************************************************/
#ifndef SRSLTE_REFSIGNAL_DL_H
#define SRSLTE_REFSIGNAL_DL_H
#include "srslte/config.h"
#include "srslte/phy/common/phy_common.h"
// Number of references in a subframe: there are 2 symbols for port_id=0,1 x 2 slots x 2 refs per prb
#define SRSLTE_REFSIGNAL_NUM_SF_MBSFN(nof_prb, port_id) ((2 + 18) * (nof_prb))
#define SRSLTE_REFSIGNAL_MAX_NUM_SF(nof_prb) (8 * nof_prb)
#define SRSLTE_REFSIGNAL_MAX_NUM_SF_MBSFN(nof_prb) SRSLTE_REFSIGNAL_NUM_SF_MBSFN(nof_prb, 0)
#define SRSLTE_REFSIGNAL_PILOT_IDX(i, l, cell) (2 * cell.nof_prb * (l) + (i))
#define SRSLTE_REFSIGNAL_PILOT_IDX_MBSFN(i, l, cell) ((6 * cell.nof_prb * (l) + (i)))
/** Cell-Specific Reference Signal */
typedef struct SRSLTE_API {
srslte_cell_t cell;
cf_t* pilots[2][SRSLTE_NOF_SF_X_FRAME]; // Saves the reference signal per subframe for ports 0,1 and ports 2,3
srslte_sf_t type;
uint16_t mbsfn_area_id;
} srslte_refsignal_t;
SRSLTE_API int srslte_refsignal_cs_init(srslte_refsignal_t* q, uint32_t max_prb);
SRSLTE_API int srslte_refsignal_cs_set_cell(srslte_refsignal_t* q, srslte_cell_t cell);
SRSLTE_API void srslte_refsignal_free(srslte_refsignal_t* q);
SRSLTE_API int
srslte_refsignal_cs_put_sf(srslte_refsignal_t* q, srslte_dl_sf_cfg_t* sf, uint32_t port_id, cf_t* sf_symbols);
SRSLTE_API int srslte_refsignal_cs_get_sf(srslte_refsignal_t* q,
srslte_dl_sf_cfg_t* sf,
uint32_t port_id,
cf_t* sf_symbols,
cf_t* pilots);
SRSLTE_API uint32_t srslte_refsignal_cs_fidx(srslte_cell_t cell, uint32_t l, uint32_t port_id, uint32_t m);
SRSLTE_API uint32_t srslte_refsignal_cs_nsymbol(uint32_t l, srslte_cp_t cp, uint32_t port_id);
SRSLTE_API uint32_t srslte_refsignal_cs_v(uint32_t port_id, uint32_t ref_symbol_idx);
SRSLTE_API uint32_t srslte_refsignal_cs_nof_symbols(srslte_refsignal_t* q, srslte_dl_sf_cfg_t* sf, uint32_t port_id);
SRSLTE_API uint32_t srslte_refsignal_cs_nof_pilots_x_slot(uint32_t nof_ports);
SRSLTE_API uint32_t srslte_refsignal_cs_nof_re(srslte_refsignal_t* q, srslte_dl_sf_cfg_t* sf, uint32_t port_id);
SRSLTE_API int srslte_refsignal_mbsfn_init(srslte_refsignal_t* q, uint32_t max_prb);
SRSLTE_API int srslte_refsignal_mbsfn_set_cell(srslte_refsignal_t* q, srslte_cell_t cell, uint16_t mbsfn_area_id);
SRSLTE_API int srslte_refsignal_mbsfn_get_sf(srslte_cell_t cell, uint32_t port_id, cf_t* sf_symbols, cf_t* pilots);
SRSLTE_API uint32_t srslte_refsignal_mbsfn_nsymbol(uint32_t l);
SRSLTE_API uint32_t srslte_refsignal_mbsfn_fidx(uint32_t l);
SRSLTE_API uint32_t srslte_refsignal_mbsfn_nof_symbols();
SRSLTE_API int srslte_refsignal_mbsfn_put_sf(srslte_cell_t cell,
uint32_t port_id,
cf_t* cs_pilots,
cf_t* mbsfn_pilots,
cf_t* sf_symbols);
SRSLTE_API int srslte_refsignal_mbsfn_gen_seq(srslte_refsignal_t* q, srslte_cell_t cell, uint32_t N_mbsfn_id);
#endif // SRSLTE_REFSIGNAL_DL_H

@ -1,64 +0,0 @@
/**
* Copyright 2013-2021 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_REFSIGNAL_DL_NBIOT_H
#define SRSLTE_REFSIGNAL_DL_NBIOT_H
#include "srslte/config.h"
#include "srslte/phy/common/phy_common.h"
// Number of references in a subframe: there are 2 symbols for port_id=0,1 x 2 slots x 2 refs per prb
#define SRSLTE_NBIOT_NUM_NRS_X_SYM_X_PORT 2
// Max number of symbols with RE in one PRB (4 ports LTE plus 2 port NB-IoT)
#define SRSLTE_NBIOT_MAX_NUM_RE_WITH_REFS 40
#define SRSLTE_NBIOT_REFSIGNAL_NUM_SF(nof_prb, port_id) (((port_id) < 2 ? 8 : 4) * (nof_prb))
#define SRSLTE_NBIOT_REFSIGNAL_PILOT_IDX(i, l, nof_prb) (2 * nof_prb * (l) + (i))
/** Brief: Narrowband Reference Signal (NRS)
*
* Object to manage downlink reference signals for channel estimation. (3GPP TS 36.211 version 13.3 Sec. 10.2.6)
*/
typedef struct SRSLTE_API {
srslte_nbiot_cell_t cell;
cf_t* pilots[2][SRSLTE_NOF_SF_X_FRAME]; // Saves the reference signal per subframe for ports 0 and 1
} srslte_refsignal_dl_nbiot_t;
SRSLTE_API int srslte_refsignal_dl_nbiot_init(srslte_refsignal_dl_nbiot_t* q);
SRSLTE_API void srslte_refsignal_dl_nbiot_free(srslte_refsignal_dl_nbiot_t* q);
SRSLTE_API uint32_t srslte_refsignal_dl_nbiot_nof_symbols(uint32_t port_id);
SRSLTE_API int srslte_refsignal_dl_nbiot_set_cell(srslte_refsignal_dl_nbiot_t* q, srslte_nbiot_cell_t cell);
SRSLTE_API uint32_t srslte_refsignal_dl_nbiot_fidx(srslte_nbiot_cell_t cell, uint32_t l, uint32_t port_id, uint32_t m);
SRSLTE_API uint32_t srslte_refsignal_nrs_nsymbol(uint32_t l);
SRSLTE_API uint32_t srslte_refsignal_nbiot_cs_nof_re(srslte_nbiot_cell_t* cell, uint32_t port_id);
SRSLTE_API int srslte_refsignal_nrs_put_sf(srslte_nbiot_cell_t cell, uint32_t port_id, cf_t* pilots, cf_t* sf_symbols);
SRSLTE_API int srslte_refsignal_nrs_get_sf(srslte_nbiot_cell_t cell, uint32_t port_id, cf_t* sf_symbols, cf_t* pilots);
#endif // SRSLTE_REFSIGNAL_DL_NBIOT_H

@ -1,193 +0,0 @@
/**
* Copyright 2013-2021 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/.
*
*/
/**********************************************************************************************
* File: refsignal_ul.h
*
* Description: Object to manage uplink reference signals for channel estimation.
*
* Reference: 3GPP TS 36.211 version 10.0.0 Release 10 Sec. 5.5
*********************************************************************************************/
#ifndef SRSLTE_REFSIGNAL_UL_H
#define SRSLTE_REFSIGNAL_UL_H
#include "srslte/config.h"
#include "srslte/phy/common/phy_common.h"
#include "srslte/phy/phch/pucch_cfg.h"
#include "srslte/phy/phch/pusch_cfg.h"
#define SRSLTE_NOF_GROUPS_U 30
#define SRSLTE_NOF_SEQUENCES_U 2
#define SRSLTE_NOF_DELTA_SS 30
#define SRSLTE_NOF_CSHIFT 8
#define SRSLTE_REFSIGNAL_UL_L(ns_idx, cp) ((ns_idx + 1) * SRSLTE_CP_NSYMB(cp) - 4)
/* PUSCH DMRS common configuration (received in SIB2) */
typedef struct SRSLTE_API {
uint32_t cyclic_shift;
uint32_t delta_ss;
bool group_hopping_en;
bool sequence_hopping_en;
} srslte_refsignal_dmrs_pusch_cfg_t;
typedef struct SRSLTE_API {
// Common Configuration
uint32_t subframe_config;
uint32_t bw_cfg;
bool simul_ack;
// Dedicated configuration
uint32_t B;
uint32_t b_hop;
uint32_t n_srs;
uint32_t I_srs;
uint32_t k_tc;
uint32_t n_rrc;
bool dedicated_enabled;
bool common_enabled;
bool configured;
} srslte_refsignal_srs_cfg_t;
/** Uplink DeModulation Reference Signal (DMRS) */
typedef struct SRSLTE_API {
srslte_cell_t cell;
uint32_t n_cs_cell[SRSLTE_NSLOTS_X_FRAME][SRSLTE_CP_NORM_NSYMB];
uint32_t n_prs_pusch[SRSLTE_NOF_DELTA_SS][SRSLTE_NSLOTS_X_FRAME]; // We precompute n_prs needed for cyclic shift alpha
// at srslte_refsignal_dl_init()
uint32_t f_gh[SRSLTE_NSLOTS_X_FRAME];
uint32_t u_pucch[SRSLTE_NSLOTS_X_FRAME];
uint32_t v_pusch[SRSLTE_NSLOTS_X_FRAME][SRSLTE_NOF_DELTA_SS];
} srslte_refsignal_ul_t;
typedef struct {
uint32_t max_prb;
cf_t** r[SRSLTE_NOF_CSHIFT][SRSLTE_NOF_SF_X_FRAME];
} srslte_refsignal_ul_dmrs_pregen_t;
typedef struct {
cf_t* r[SRSLTE_NOF_SF_X_FRAME];
} srslte_refsignal_srs_pregen_t;
SRSLTE_API int srslte_refsignal_ul_set_cell(srslte_refsignal_ul_t* q, srslte_cell_t cell);
SRSLTE_API uint32_t srslte_refsignal_dmrs_N_rs(srslte_pucch_format_t format, srslte_cp_t cp);
SRSLTE_API uint32_t srslte_refsignal_dmrs_pucch_symbol(uint32_t m, srslte_pucch_format_t format, srslte_cp_t cp);
SRSLTE_API int srslte_refsignal_dmrs_pusch_pregen_init(srslte_refsignal_ul_dmrs_pregen_t* pregen, uint32_t max_prb);
SRSLTE_API int srslte_refsignal_dmrs_pusch_pregen(srslte_refsignal_ul_t* q,
srslte_refsignal_ul_dmrs_pregen_t* pregen,
srslte_refsignal_dmrs_pusch_cfg_t* cfg);
SRSLTE_API void srslte_refsignal_dmrs_pusch_pregen_free(srslte_refsignal_ul_t* q,
srslte_refsignal_ul_dmrs_pregen_t* pregen);
SRSLTE_API int srslte_refsignal_dmrs_pusch_pregen_put(srslte_refsignal_ul_t* q,
srslte_ul_sf_cfg_t* sf_cfg,
srslte_refsignal_ul_dmrs_pregen_t* pregen,
srslte_pusch_cfg_t* pusch_cfg,
cf_t* sf_symbols);
SRSLTE_API int srslte_refsignal_dmrs_pusch_gen(srslte_refsignal_ul_t* q,
srslte_refsignal_dmrs_pusch_cfg_t* cfg,
uint32_t nof_prb,
uint32_t sf_idx,
uint32_t cyclic_shift_for_dmrs,
cf_t* r_pusch);
SRSLTE_API void srslte_refsignal_dmrs_pusch_put(srslte_refsignal_ul_t* q,
srslte_pusch_cfg_t* pusch_cfg,
cf_t* r_pusch,
cf_t* sf_symbols);
SRSLTE_API void srslte_refsignal_dmrs_pusch_get(srslte_refsignal_ul_t* q,
srslte_pusch_cfg_t* pusch_cfg,
cf_t* sf_symbols,
cf_t* r_pusch);
SRSLTE_API int srslte_refsignal_dmrs_pucch_gen(srslte_refsignal_ul_t* q,
srslte_ul_sf_cfg_t* sf,
srslte_pucch_cfg_t* cfg,
cf_t* r_pucch);
SRSLTE_API int
srslte_refsignal_dmrs_pucch_put(srslte_refsignal_ul_t* q, srslte_pucch_cfg_t* cfg, cf_t* r_pucch, cf_t* output);
SRSLTE_API int
srslte_refsignal_dmrs_pucch_get(srslte_refsignal_ul_t* q, srslte_pucch_cfg_t* cfg, cf_t* input, cf_t* r_pucch);
SRSLTE_API int srslte_refsignal_srs_pregen(srslte_refsignal_ul_t* q,
srslte_refsignal_srs_pregen_t* pregen,
srslte_refsignal_srs_cfg_t* cfg,
srslte_refsignal_dmrs_pusch_cfg_t* dmrs);
SRSLTE_API int srslte_refsignal_srs_pregen_put(srslte_refsignal_ul_t* q,
srslte_refsignal_srs_pregen_t* pregen,
srslte_refsignal_srs_cfg_t* cfg,
uint32_t tti,
cf_t* sf_symbols);
SRSLTE_API void srslte_refsignal_srs_pregen_free(srslte_refsignal_ul_t* q, srslte_refsignal_srs_pregen_t* pregen);
SRSLTE_API int srslte_refsignal_srs_gen(srslte_refsignal_ul_t* q,
srslte_refsignal_srs_cfg_t* cfg,
srslte_refsignal_dmrs_pusch_cfg_t* pusch_cfg,
uint32_t sf_idx,
cf_t* r_srs);
SRSLTE_API int srslte_refsignal_srs_put(srslte_refsignal_ul_t* q,
srslte_refsignal_srs_cfg_t* cfg,
uint32_t tti,
cf_t* r_srs,
cf_t* sf_symbols);
SRSLTE_API int srslte_refsignal_srs_get(srslte_refsignal_ul_t* q,
srslte_refsignal_srs_cfg_t* cfg,
uint32_t tti,
cf_t* r_srs,
cf_t* sf_symbols);
SRSLTE_API void srslte_refsignal_srs_pusch_shortened(srslte_refsignal_ul_t* q,
srslte_ul_sf_cfg_t* sf,
srslte_refsignal_srs_cfg_t* srs_cfg,
srslte_pusch_cfg_t* pusch_cfg);
SRSLTE_API void srslte_refsignal_srs_pucch_shortened(srslte_refsignal_ul_t* q,
srslte_ul_sf_cfg_t* sf,
srslte_refsignal_srs_cfg_t* srs_cfg,
srslte_pucch_cfg_t* pucch_cfg);
SRSLTE_API int srslte_refsignal_srs_send_cs(uint32_t subframe_config, uint32_t sf_idx);
SRSLTE_API int srslte_refsignal_srs_send_ue(uint32_t I_srs, uint32_t tti);
SRSLTE_API uint32_t srslte_refsignal_srs_rb_start_cs(uint32_t bw_cfg, uint32_t nof_prb);
SRSLTE_API uint32_t srslte_refsignal_srs_rb_L_cs(uint32_t bw_cfg, uint32_t nof_prb);
SRSLTE_API uint32_t srslte_refsignal_srs_M_sc(srslte_refsignal_ul_t* q, srslte_refsignal_srs_cfg_t* cfg);
#endif // SRSLTE_REFSIGNAL_UL_H

@ -1,129 +0,0 @@
/**
* Copyright 2013-2021 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_WIENER_DL_H_
#define SRSLTE_WIENER_DL_H_
#include <srslte/config.h>
#include <srslte/phy/common/phy_common.h>
#include <srslte/phy/dft/dft.h>
#include <srslte/phy/utils/random.h>
// Constant static parameters
#define SRSLTE_WIENER_DL_HLS_FIFO_SIZE (8U)
#define SRSLTE_WIENER_DL_MIN_PRB (4U)
#define SRSLTE_WIENER_DL_MIN_RE (SRSLTE_WIENER_DL_MIN_PRB * SRSLTE_NRE)
#define SRSLTE_WIENER_DL_MIN_REF (SRSLTE_WIENER_DL_MIN_PRB * 2U)
#define SRSLTE_WIENER_DL_TFIFO_SIZE (2U)
#define SRSLTE_WIENER_DL_XFIFO_SIZE (400U)
#define SRSLTE_WIENER_DL_TIMEFIFO_SIZE (32U)
#define SRSLTE_WIENER_DL_CXFIFO_SIZE (400U)
typedef struct {
cf_t* hls_fifo_1[SRSLTE_WIENER_DL_HLS_FIFO_SIZE]; // Least square channel estimates on odd pilots
cf_t* hls_fifo_2[SRSLTE_WIENER_DL_HLS_FIFO_SIZE]; // Least square channel estimates on even pilots
cf_t* tfifo[SRSLTE_WIENER_DL_TFIFO_SIZE]; // memory for time domain channel linear interpolation
cf_t* xfifo[SRSLTE_WIENER_DL_XFIFO_SIZE]; // fifo for averaging the frequency correlation vectors
cf_t cV[SRSLTE_WIENER_DL_MIN_RE]; // frequency correlation vector among all subcarriers
float deltan; // step within time domain linear interpolation
uint32_t nfifosamps; // number of samples inside the fifo for averaging the correlation vectors
float invtpilotoff; // step for time domain linear interpolation
cf_t* timefifo; // fifo for storing single frequency channel time domain evolution
cf_t* cxfifo[SRSLTE_WIENER_DL_CXFIFO_SIZE]; // fifo for averaging time domain channel correlation vector
uint32_t sumlen; // length of dynamic average window for time domain channel correlation vector
uint32_t skip; // pilot OFDM symbols to skip when training Wiener matrices (skip = 1,..,4)
uint32_t cnt; // counter for skipping pilot OFDM symbols
} srslte_wiener_dl_state_t;
typedef struct {
// Maximum allocated number of...
uint32_t max_prb; // Resource Blocks
uint32_t max_ref; // Reference signals
uint32_t max_re; // Resource Elements (equivalent to sub-carriers)
uint32_t max_tx_ports; // Tx Ports
uint32_t max_rx_ant; // Rx Antennas
// Configured number of...
uint32_t nof_prb; // Resource Blocks
uint32_t nof_ref; // Reference signals
uint32_t nof_re; // Resource Elements (equivalent to sub-carriers)
uint32_t nof_tx_ports; // Tx Ports
uint32_t nof_rx_ant; // Rx Antennas
// One state per possible channel (allocated in init)
srslte_wiener_dl_state_t* state[SRSLTE_MAX_PORTS][SRSLTE_MAX_PORTS];
// Wiener matrices
cf_t wm1[SRSLTE_WIENER_DL_MIN_RE][SRSLTE_WIENER_DL_MIN_REF];
cf_t wm2[SRSLTE_WIENER_DL_MIN_RE][SRSLTE_WIENER_DL_MIN_REF];
bool wm_computed;
bool ready;
// Calculation support
cf_t hlsv[SRSLTE_WIENER_DL_MIN_RE];
cf_t hlsv_sum[SRSLTE_WIENER_DL_MIN_RE];
cf_t acV[SRSLTE_WIENER_DL_MIN_RE];
union {
cf_t m[SRSLTE_WIENER_DL_MIN_REF][SRSLTE_WIENER_DL_MIN_REF];
cf_t v[SRSLTE_WIENER_DL_MIN_REF * SRSLTE_WIENER_DL_MIN_REF];
} RH;
union {
cf_t m[SRSLTE_WIENER_DL_MIN_REF][SRSLTE_WIENER_DL_MIN_REF];
cf_t v[SRSLTE_WIENER_DL_MIN_REF * SRSLTE_WIENER_DL_MIN_REF];
} invRH;
cf_t hH1[SRSLTE_WIENER_DL_MIN_RE][SRSLTE_WIENER_DL_MIN_REF];
cf_t hH2[SRSLTE_WIENER_DL_MIN_RE][SRSLTE_WIENER_DL_MIN_REF];
// Temporal vector
cf_t* tmp;
// Random generator
srslte_random_t random;
// FFT/iFFT
srslte_dft_plan_t fft;
srslte_dft_plan_t ifft;
cf_t filter[SRSLTE_WIENER_DL_MIN_RE];
// Matrix inverter
void* matrix_inverter;
} srslte_wiener_dl_t;
SRSLTE_API int
srslte_wiener_dl_init(srslte_wiener_dl_t* q, uint32_t max_prb, uint32_t max_tx_ports, uint32_t max_rx_ant);
SRSLTE_API int srslte_wiener_dl_set_cell(srslte_wiener_dl_t* q, srslte_cell_t cell);
SRSLTE_API void srslte_wiener_dl_reset(srslte_wiener_dl_t* q);
SRSLTE_API int srslte_wiener_dl_run(srslte_wiener_dl_t* q,
uint32_t tx,
uint32_t rx,
uint32_t m,
uint32_t shift,
cf_t* pilots,
cf_t* estimated,
float snr_lin);
SRSLTE_API void srslte_wiener_dl_free(srslte_wiener_dl_t* q);
#endif // SRSLTE_WIENER_DL_H_

@ -1,69 +0,0 @@
/**
* Copyright 2013-2021 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_DELAY_H
#define SRSLTE_DELAY_H
#include "srslte/config.h"
#include "srslte/phy/common/timestamp.h"
#include "srslte/phy/utils/ringbuffer.h"
#include <stdint.h>
typedef struct {
float delay_min_us;
float delay_max_us;
float period_s;
float init_time_s;
uint32_t srate_max_hz;
uint32_t srate_hz;
float delay_us;
uint32_t delay_nsamples;
srslte_ringbuffer_t rb;
cf_t* zero_buffer;
} srslte_channel_delay_t;
#ifdef __cplusplus
extern "C" {
#endif
SRSLTE_API int srslte_channel_delay_init(srslte_channel_delay_t* q,
float delay_min_us,
float delay_max_us,
float period_s,
float init_time_s,
uint32_t srate_max_hz);
SRSLTE_API void srslte_channel_delay_update_srate(srslte_channel_delay_t* q, uint32_t srate_hz);
SRSLTE_API void srslte_channel_delay_free(srslte_channel_delay_t* q);
SRSLTE_API void srslte_channel_delay_execute(srslte_channel_delay_t* q,
const cf_t* in,
cf_t* out,
uint32_t len,
const srslte_timestamp_t* ts);
#ifdef __cplusplus
}
#endif
#endif // SRSLTE_DELAY_H

@ -1,87 +0,0 @@
/**
* Copyright 2013-2021 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_FADING_H
#define SRSLTE_FADING_H
#include "srslte/config.h"
#include "srslte/phy/common/timestamp.h"
#include "srslte/phy/dft/dft.h"
#include <inttypes.h>
#include <stdint.h>
#define SRSLTE_CHANNEL_FADING_MAXTAPS 9
#define SRSLTE_CHANNEL_FADING_NTERMS 16
typedef enum {
srslte_channel_fading_model_none = 0,
srslte_channel_fading_model_epa,
srslte_channel_fading_model_eva,
srslte_channel_fading_model_etu,
} srslte_channel_fading_model_t;
typedef struct {
// Configuration parameters
float srate; // Sampling rate: 1.92e6, 3.84e6, ..., 23.04e6, 30.72e6
srslte_channel_fading_model_t model; // None, EPA, EVA, ETU
float doppler; // Maximum doppler: 5, 70, 300
// Internal tap parametrisation
uint32_t N; // FFT size
uint32_t path_delay; // Path delay
uint32_t state_len; // Length of the impulse response saved in the state
float coeff_alpha[SRSLTE_CHANNEL_FADING_MAXTAPS][SRSLTE_CHANNEL_FADING_NTERMS]; // Angle of arrival
float coeff_a[SRSLTE_CHANNEL_FADING_MAXTAPS][SRSLTE_CHANNEL_FADING_NTERMS]; // Random phase
float coeff_b[SRSLTE_CHANNEL_FADING_MAXTAPS][SRSLTE_CHANNEL_FADING_NTERMS]; // Random phase
cf_t* h_tap[SRSLTE_CHANNEL_FADING_MAXTAPS]; // Static tap signal in frequency domain
// Utils
srslte_dft_plan_t fft; // DFT to frequency domain
srslte_dft_plan_t ifft; // DFT to time domain
cf_t* temp; // Temporal buffer, length fft_size
cf_t* h_freq; // Channel frequency response, length fft_size
cf_t* y_freq; // Intermediate frequency domain buffer
float sin_table[1024]; // Table of sinus values
// State variables
cf_t* state; // To save impulse response of the filter
} srslte_channel_fading_t;
#ifdef __cplusplus
extern "C" {
#endif
SRSLTE_API int srslte_channel_fading_init(srslte_channel_fading_t* q, double srate, const char* model, uint32_t seed);
SRSLTE_API void srslte_channel_fading_free(srslte_channel_fading_t* q);
SRSLTE_API double srslte_channel_fading_execute(srslte_channel_fading_t* q,
const cf_t* in,
cf_t* out,
uint32_t nof_samples,
double init_time);
#ifdef __cplusplus
}
#endif
#endif // SRSLTE_FADING_H

@ -1,61 +0,0 @@
/**
* Copyright 2013-2021 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_HST_H_
#define SRSLTE_HST_H_
#include "srslte/config.h"
#include "srslte/phy/common/timestamp.h"
#include <stdint.h>
typedef struct {
// System parameters
uint32_t srate_hz; // Sampling rate
// Model Parameters
float fd_hz; // Maximum Doppler Frequency
float ds_m; // eNb distance [m]
float dmin_m; // eNb Rail-track distance [m]
float period_s; // 2 * Ds / speed [s]
float init_time_s; // Time offset [s]
// State
float fs_hz; // Last doppler dispersion [Hz]
} srslte_channel_hst_t;
#ifdef __cplusplus
extern "C" {
#endif
SRSLTE_API int srslte_channel_hst_init(srslte_channel_hst_t* q, float fd_hz, float period_d, float init_time_s);
SRSLTE_API void srslte_channel_hst_update_srate(srslte_channel_hst_t* q, uint32_t srate);
SRSLTE_API void
srslte_channel_hst_execute(srslte_channel_hst_t* q, cf_t* in, cf_t* out, uint32_t len, const srslte_timestamp_t* ts);
SRSLTE_API void srslte_channel_hst_free(srslte_channel_hst_t* q);
#ifdef __cplusplus
}
#endif
#endif // SRSLTE_HST_H_

@ -1,52 +0,0 @@
/**
* Copyright 2013-2021 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_RLF_H
#define SRSLTE_RLF_H
#include "srslte/config.h"
#include "srslte/phy/common/timestamp.h"
#include <stdint.h>
typedef struct {
uint32_t t_on_ms;
uint32_t t_off_ms;
} srslte_channel_rlf_t;
#ifdef __cplusplus
extern "C" {
#endif
SRSLTE_API void srslte_channel_rlf_init(srslte_channel_rlf_t* q, uint32_t t_on_ms, uint32_t t_off_ms);
SRSLTE_API void srslte_channel_rlf_execute(srslte_channel_rlf_t* q,
const cf_t* in,
cf_t* out,
uint32_t nsamples,
const srslte_timestamp_t* ts);
SRSLTE_API void srslte_channel_rlf_free(srslte_channel_rlf_t* q);
#ifdef __cplusplus
}
#endif
#endif // SRSLTE_RLF_H

@ -1,533 +0,0 @@
/**
* Copyright 2013-2021 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/.
*
*/
/**********************************************************************************************
* File: phy_common.h
*
* Description: Common parameters and lookup functions for PHY
*
* Reference: 3GPP TS 36.211 version 10.0.0 Release 10
*********************************************************************************************/
#ifndef SRSLTE_PHY_COMMON_H
#define SRSLTE_PHY_COMMON_H
#include <math.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#ifdef __cplusplus
extern "C" {
#endif
#include "srslte/config.h"
#define SRSLTE_NOF_SF_X_FRAME 10
#define SRSLTE_NOF_SLOTS_PER_SF 2
#define SRSLTE_NSLOTS_X_FRAME (SRSLTE_NOF_SLOTS_PER_SF * SRSLTE_NOF_SF_X_FRAME)
#define SRSLTE_NSOFT_BITS 250368 // Soft buffer size for Category 1 UE
#define SRSLTE_PC_MAX 23 // Maximum TX power for Category 1 UE (in dBm)
#define SRSLTE_NOF_NID_1 (168)
#define SRSLTE_NOF_NID_2 (3)
#define SRSLTE_NUM_PCI (SRSLTE_NOF_NID_1 * SRSLTE_NOF_NID_2)
#define SRSLTE_MAX_CARRIERS 5 // Maximum number of supported simultaneous carriers
#define SRSLTE_MAX_PORTS 4
#define SRSLTE_MAX_CHANNELS (SRSLTE_MAX_CARRIERS * SRSLTE_MAX_PORTS)
#define SRSLTE_MAX_LAYERS 4
#define SRSLTE_MAX_CODEWORDS 2
#define SRSLTE_MAX_TB SRSLTE_MAX_CODEWORDS
#define SRSLTE_MAX_QM 8
#define SRSLTE_MAX_CODEBLOCKS 32
#define SRSLTE_MAX_CODEBOOKS 4
#define SRSLTE_NOF_CFI 3
#define SRSLTE_CFI_ISVALID(x) ((x >= 1 && x <= 3))
#define SRSLTE_CFI_IDX(x) ((x - 1) % SRSLTE_NOF_CFI)
#define SRSLTE_LTE_CRC24A 0x1864CFB
#define SRSLTE_LTE_CRC24B 0X1800063
#define SRSLTE_LTE_CRC24C 0X1B2B117
#define SRSLTE_LTE_CRC16 0x11021
#define SRSLTE_LTE_CRC11 0xE21
#define SRSLTE_LTE_CRC8 0x19B
#define SRSLTE_LTE_CRC6 0x61
#define SRSLTE_MAX_MBSFN_AREA_IDS 256
#define SRSLTE_PMCH_RV 0
typedef enum { SRSLTE_CP_NORM = 0, SRSLTE_CP_EXT } srslte_cp_t;
typedef enum { SRSLTE_SF_NORM = 0, SRSLTE_SF_MBSFN } srslte_sf_t;
#define SRSLTE_INVALID_RNTI 0x0 // TS 36.321 - Table 7.1-1 RNTI 0x0 isn't a valid DL RNTI
#define SRSLTE_CRNTI_START 0x000B
#define SRSLTE_CRNTI_END 0xFFF3
#define SRSLTE_RARNTI_START 0x0001
#define SRSLTE_RARNTI_END 0x000A
#define SRSLTE_SIRNTI 0xFFFF
#define SRSLTE_PRNTI 0xFFFE
#define SRSLTE_MRNTI 0xFFFD
#define SRSLTE_RNTI_ISRAR(rnti) (rnti >= SRSLTE_RARNTI_START && rnti <= SRSLTE_RARNTI_END)
#define SRSLTE_RNTI_ISUSER(rnti) (rnti >= SRSLTE_CRNTI_START && rnti <= SRSLTE_CRNTI_END)
#define SRSLTE_RNTI_ISSI(rnti) (rnti == SRSLTE_SIRNTI)
#define SRSLTE_RNTI_ISPA(rnti) (rnti == SRSLTE_PRNTI)
#define SRSLTE_RNTI_ISMBSFN(rnti) (rnti == SRSLTE_MRNTI)
#define SRSLTE_RNTI_ISSIRAPA(rnti) (SRSLTE_RNTI_ISSI(rnti) || SRSLTE_RNTI_ISRAR(rnti) || SRSLTE_RNTI_ISPA(rnti))
#define SRSLTE_CELL_ID_UNKNOWN 1000
#define SRSLTE_MAX_NSYMB 7
#define SRSLTE_MAX_PRB 110
#define SRSLTE_NRE 12
#define SRSLTE_SYMBOL_SZ_MAX 2048
#define SRSLTE_CP_NORM_NSYMB 7
#define SRSLTE_CP_NORM_SF_NSYMB (2 * SRSLTE_CP_NORM_NSYMB)
#define SRSLTE_CP_NORM_0_LEN 160
#define SRSLTE_CP_NORM_LEN 144
#define SRSLTE_CP_EXT_NSYMB 6
#define SRSLTE_CP_EXT_SF_NSYMB (2 * SRSLTE_CP_EXT_NSYMB)
#define SRSLTE_CP_EXT_LEN 512
#define SRSLTE_CP_EXT_7_5_LEN 1024
#define SRSLTE_CP_ISNORM(cp) (cp == SRSLTE_CP_NORM)
#define SRSLTE_CP_ISEXT(cp) (cp == SRSLTE_CP_EXT)
#define SRSLTE_CP_NSYMB(cp) (SRSLTE_CP_ISNORM(cp) ? SRSLTE_CP_NORM_NSYMB : SRSLTE_CP_EXT_NSYMB)
#define SRSLTE_CP_LEN(symbol_sz, c) ((int)ceilf((((float)(c) * (symbol_sz)) / 2048.0f)))
#define SRSLTE_CP_LEN_NORM(symbol, symbol_sz) \
(((symbol) == 0) ? SRSLTE_CP_LEN((symbol_sz), SRSLTE_CP_NORM_0_LEN) : SRSLTE_CP_LEN((symbol_sz), SRSLTE_CP_NORM_LEN))
#define SRSLTE_CP_LEN_EXT(symbol_sz) (SRSLTE_CP_LEN((symbol_sz), SRSLTE_CP_EXT_LEN))
#define SRSLTE_CP_SZ(symbol_sz, cp) \
(SRSLTE_CP_LEN(symbol_sz, (SRSLTE_CP_ISNORM(cp) ? SRSLTE_CP_NORM_LEN : SRSLTE_CP_EXT_LEN)))
#define SRSLTE_SYMBOL_SZ(symbol_sz, cp) (symbol_sz + SRSLTE_CP_SZ(symbol_sz, cp))
#define SRSLTE_SLOT_LEN(symbol_sz) (symbol_sz * 15 / 2)
#define SRSLTE_SF_LEN(symbol_sz) (symbol_sz * 15)
#define SRSLTE_SF_LEN_MAX (SRSLTE_SF_LEN(SRSLTE_SYMBOL_SZ_MAX))
#define SRSLTE_SLOT_LEN_PRB(nof_prb) (SRSLTE_SLOT_LEN(srslte_symbol_sz(nof_prb)))
#define SRSLTE_SF_LEN_PRB(nof_prb) ((uint32_t)SRSLTE_SF_LEN(srslte_symbol_sz(nof_prb)))
#define SRSLTE_SLOT_LEN_RE(nof_prb, cp) (nof_prb * SRSLTE_NRE * SRSLTE_CP_NSYMB(cp))
#define SRSLTE_SF_LEN_RE(nof_prb, cp) (2 * SRSLTE_SLOT_LEN_RE(nof_prb, cp))
#define SRSLTE_NOF_RE(cell) (2 * SRSLTE_SLOT_LEN_RE(cell.nof_prb, cell.cp))
#define SRSLTE_TA_OFFSET (10e-6)
#define SRSLTE_LTE_TS (1.0f / (15000.0f * 2048.0f))
#define SRSLTE_SLOT_IDX_CPNORM(symbol_idx, symbol_sz) \
(symbol_idx == 0 ? 0 \
: (symbol_sz + SRSLTE_CP_LEN(symbol_sz, SRSLTE_CP_NORM_0_LEN) + \
(symbol_idx - 1) * (symbol_sz + SRSLTE_CP_LEN(symbol_sz, SRSLTE_CP_NORM_LEN))))
#define SRSLTE_SLOT_IDX_CPEXT(idx, symbol_sz) (idx * (symbol_sz + SRSLTE_CP(symbol_sz, SRSLTE_CP_EXT_LEN)))
#define SRSLTE_RE_IDX(nof_prb, symbol_idx, sample_idx) ((symbol_idx) * (nof_prb) * (SRSLTE_NRE) + sample_idx)
#define SRSLTE_RS_VSHIFT(cell_id) (cell_id % 6)
#define SRSLTE_GUARD_RE(nof_prb) ((srslte_symbol_sz(nof_prb) - nof_prb * SRSLTE_NRE) / 2)
#define SRSLTE_SYMBOL_HAS_REF(l, cp, nof_ports) ((l == 1 && nof_ports == 4) || l == 0 || l == SRSLTE_CP_NSYMB(cp) - 3)
#define SRSLTE_NOF_CTRL_SYMBOLS(cell, cfi) (cfi + (cell.nof_prb < 10 ? 1 : 0))
#define SRSLTE_SYMBOL_HAS_REF_MBSFN(l, s) ((l == 2 && s == 0) || (l == 0 && s == 1) || (l == 4 && s == 1))
#define SRSLTE_NON_MBSFN_REGION_GUARD_LENGTH(non_mbsfn_region, symbol_sz) \
((non_mbsfn_region == 1) \
? (SRSLTE_CP_LEN_EXT(symbol_sz) - SRSLTE_CP_LEN_NORM(0, symbol_sz)) \
: (2 * SRSLTE_CP_LEN_EXT(symbol_sz) - SRSLTE_CP_LEN_NORM(0, symbol_sz) - SRSLTE_CP_LEN_NORM(1, symbol_sz)))
#define SRSLTE_FDD_NOF_HARQ (FDD_HARQ_DELAY_DL_MS + FDD_HARQ_DELAY_UL_MS)
#define SRSLTE_MAX_HARQ_PROC 15
#define SRSLTE_NOF_LTE_BANDS 58
#define SRSLTE_DEFAULT_MAX_FRAMES_PBCH 500
#define SRSLTE_DEFAULT_MAX_FRAMES_PSS 10
#define SRSLTE_DEFAULT_NOF_VALID_PSS_FRAMES 10
#define ZERO_OBJECT(x) memset(&(x), 0x0, sizeof((x)))
typedef enum SRSLTE_API { SRSLTE_PHICH_NORM = 0, SRSLTE_PHICH_EXT } srslte_phich_length_t;
typedef enum SRSLTE_API {
SRSLTE_PHICH_R_1_6 = 0,
SRSLTE_PHICH_R_1_2,
SRSLTE_PHICH_R_1,
SRSLTE_PHICH_R_2
} srslte_phich_r_t;
/// LTE duplex modes.
typedef enum SRSLTE_API {
/// FDD uses frame structure type 1.
SRSLTE_FDD = 0,
/// TDD uses frame structure type 2.
SRSLTE_TDD = 1
} srslte_frame_type_t;
/// Maximum number of TDD special subframe configurations.
#define SRSLTE_MAX_TDD_SS_CONFIGS (10u)
/// Maximum number of TDD uplink-downlink subframe configurations.
#define SRSLTE_MAX_TDD_SF_CONFIGS (7u)
/// Configuration fields for operating in TDD mode.
typedef struct SRSLTE_API {
/// Uplink-downlink configuration, valid range is [0,SRSLTE_MAX_TDD_SF_CONFIGS[.
/// TS 36.211 v8.9.0 Table 4.2-2.
uint32_t sf_config;
/// Special subframe symbol length configuration, valid range is [0,SRSLTE_MAX_TDD_SS_CONFIGS[.
/// TS 36.211 v13.13.0 Table 4.2-1.
uint32_t ss_config;
/// Set to true when the fields have been configured, otherwise false.
bool configured;
} srslte_tdd_config_t;
/// TDD uplink-downlink subframe types.
typedef enum SRSLTE_API {
/// Subframe is reserved for downlink transmissions.
SRSLTE_TDD_SF_D = 0,
/// Subframe is reserved for uplink transmissions.
SRSLTE_TDD_SF_U = 1,
/// Special subframe.
SRSLTE_TDD_SF_S = 2,
} srslte_tdd_sf_t;
typedef struct {
uint8_t mbsfn_area_id;
uint8_t non_mbsfn_region_length;
uint8_t mbsfn_mcs;
bool enable;
bool is_mcch;
} srslte_mbsfn_cfg_t;
// Common cell constant properties that require object reconfiguration
typedef struct SRSLTE_API {
uint32_t nof_prb;
uint32_t nof_ports;
uint32_t id;
srslte_cp_t cp;
srslte_phich_length_t phich_length;
srslte_phich_r_t phich_resources;
srslte_frame_type_t frame_type;
} srslte_cell_t;
// Common downlink properties that may change every subframe
typedef struct SRSLTE_API {
srslte_tdd_config_t tdd_config;
uint32_t tti;
uint32_t cfi;
srslte_sf_t sf_type;
uint32_t non_mbsfn_region;
} srslte_dl_sf_cfg_t;
typedef struct SRSLTE_API {
srslte_tdd_config_t tdd_config;
uint32_t tti;
bool shortened;
} srslte_ul_sf_cfg_t;
typedef enum SRSLTE_API {
SRSLTE_TM1 = 0,
SRSLTE_TM2,
SRSLTE_TM3,
SRSLTE_TM4,
SRSLTE_TM5,
SRSLTE_TM6,
SRSLTE_TM7,
SRSLTE_TM8,
SRSLTE_TMINV // Invalid Transmission Mode
} srslte_tm_t;
typedef enum SRSLTE_API {
SRSLTE_TXSCHEME_PORT0,
SRSLTE_TXSCHEME_DIVERSITY,
SRSLTE_TXSCHEME_SPATIALMUX,
SRSLTE_TXSCHEME_CDD
} srslte_tx_scheme_t;
typedef enum SRSLTE_API { SRSLTE_MIMO_DECODER_ZF, SRSLTE_MIMO_DECODER_MMSE } srslte_mimo_decoder_t;
/*!
* \brief Types of modulations and associated modulation order.
*/
typedef enum SRSLTE_API {
SRSLTE_MOD_BPSK = 0, /*!< \brief BPSK. */
SRSLTE_MOD_QPSK, /*!< \brief QPSK. */
SRSLTE_MOD_16QAM, /*!< \brief QAM16. */
SRSLTE_MOD_64QAM, /*!< \brief QAM64. */
SRSLTE_MOD_256QAM, /*!< \brief QAM256. */
SRSLTE_MOD_NITEMS
} srslte_mod_t;
typedef enum {
SRSLTE_DCI_FORMAT0 = 0,
SRSLTE_DCI_FORMAT1,
SRSLTE_DCI_FORMAT1A,
SRSLTE_DCI_FORMAT1B,
SRSLTE_DCI_FORMAT1C,
SRSLTE_DCI_FORMAT1D,
SRSLTE_DCI_FORMAT2,
SRSLTE_DCI_FORMAT2A,
SRSLTE_DCI_FORMAT2B,
// SRSLTE_DCI_FORMAT3,
// SRSLTE_DCI_FORMAT3A,
SRSLTE_DCI_FORMATN0,
SRSLTE_DCI_FORMATN1,
SRSLTE_DCI_FORMATN2,
SRSLTE_DCI_FORMAT_RAR, // Not a real LTE format. Used internally to indicate RAR grant
SRSLTE_DCI_NOF_FORMATS
} srslte_dci_format_t;
typedef enum {
SRSLTE_PUCCH_ACK_NACK_FEEDBACK_MODE_NORMAL = 0, /* No cell selection no pucch3 */
SRSLTE_PUCCH_ACK_NACK_FEEDBACK_MODE_CS,
SRSLTE_PUCCH_ACK_NACK_FEEDBACK_MODE_PUCCH3,
SRSLTE_PUCCH_ACK_NACK_FEEDBACK_MODE_ERROR,
} srslte_ack_nack_feedback_mode_t;
typedef struct SRSLTE_API {
int id;
float fd;
} srslte_earfcn_t;
enum band_geographical_area {
SRSLTE_BAND_GEO_AREA_ALL,
SRSLTE_BAND_GEO_AREA_NAR,
SRSLTE_BAND_GEO_AREA_APAC,
SRSLTE_BAND_GEO_AREA_EMEA,
SRSLTE_BAND_GEO_AREA_JAPAN,
SRSLTE_BAND_GEO_AREA_CALA,
SRSLTE_BAND_GEO_AREA_NA
};
///< NB-IoT specific structs
typedef enum {
SRSLTE_NBIOT_MODE_INBAND_SAME_PCI = 0,
SRSLTE_NBIOT_MODE_INBAND_DIFFERENT_PCI,
SRSLTE_NBIOT_MODE_GUARDBAND,
SRSLTE_NBIOT_MODE_STANDALONE,
SRSLTE_NBIOT_MODE_N_ITEMS,
} srslte_nbiot_mode_t;
typedef struct SRSLTE_API {
srslte_cell_t base; // the umbrella or super cell
uint32_t nbiot_prb; // the index of the NB-IoT PRB within the cell
uint32_t n_id_ncell;
uint32_t nof_ports; // The number of antenna ports for NB-IoT
bool is_r14; // Whether the cell is a R14 cell
srslte_nbiot_mode_t mode;
} srslte_nbiot_cell_t;
#define SRSLTE_NBIOT_MAX_PORTS 2
#define SRSLTE_NBIOT_MAX_CODEWORDS SRSLTE_MAX_CODEWORDS
#define SRSLTE_SF_LEN_PRB_NBIOT (SRSLTE_SF_LEN_PRB(1))
#define SRSLTE_SF_LEN_RE_NBIOT (SRSLTE_SF_LEN_RE(1, SRSLTE_CP_NORM))
#define SRSLTE_NBIOT_FFT_SIZE 128
#define SRSLTE_NBIOT_FREQ_SHIFT_FACTOR ((float)-0.5)
#define SRSLTE_NBIOT_NUM_RX_ANTENNAS 1
#define SRSLTE_NBIOT_MAX_PRB 1
#define SRSLTE_NBIOT_DEFAULT_NUM_PRB_BASECELL 1
#define SRSLTE_NBIOT_DEFAULT_PRB_OFFSET 0
#define SRSLTE_DEFAULT_MAX_FRAMES_NPBCH 500
#define SRSLTE_DEFAULT_MAX_FRAMES_NPSS 20
#define SRSLTE_DEFAULT_NOF_VALID_NPSS_FRAMES 20
#define SRSLTE_NBIOT_NPBCH_NOF_TOTAL_BITS (1600) ///< Number of bits for the entire NPBCH (See 36.211 Sec 10.2.4.1)
#define SRSLTE_NBIOT_NPBCH_NOF_BITS_SF \
(SRSLTE_NBIOT_NPBCH_NOF_TOTAL_BITS / 8) ///< The NPBCH is transmitted in 8 blocks (See 36.211 Sec 10.2.4.4)
#define SRSLTE_MAX_DL_BITS_CAT_NB1 (680) ///< TS 36.306 v15.4.0 Table 4.1C-1
///< PHY common function declarations
SRSLTE_API bool srslte_cell_isvalid(srslte_cell_t* cell);
SRSLTE_API void srslte_cell_fprint(FILE* stream, srslte_cell_t* cell, uint32_t sfn);
SRSLTE_API bool srslte_cellid_isvalid(uint32_t cell_id);
SRSLTE_API bool srslte_nofprb_isvalid(uint32_t nof_prb);
/**
* Returns the subframe type for a given subframe number and a TDD configuration.
* Check TS 36.211 v8.9.0 Table 4.2-2.
*
* @param tdd_config TDD configuration.
* @param sf_idx Subframe number, must be in range [0,SRSLTE_NOF_SF_X_FRAME[.
* @return Returns the subframe type.
*/
SRSLTE_API srslte_tdd_sf_t srslte_sfidx_tdd_type(srslte_tdd_config_t tdd_config, uint32_t sf_idx);
/**
* Returns the number of UpPTS symbols in a subframe.
* Check TS 36.211 v13.13.0 Table 4.2-1.
*
* @param tdd_config TDD configuration.
* @return Returns the number of UpPTS symbols.
*/
SRSLTE_API uint32_t srslte_sfidx_tdd_nof_up(srslte_tdd_config_t tdd_config);
/**
* Returns the number of GP symbols in a subframe.
* Check TS 36.211 v13.13.0 Table 4.2-1.
*
* @param tdd_config TDD configuration.
* @return Returns the number of GP symbols.
*/
SRSLTE_API uint32_t srslte_sfidx_tdd_nof_gp(srslte_tdd_config_t tdd_config);
/**
* Returns the number of DwPTS symbols in a subframe.
* Check TS 36.211 v13.13.0 Table 4.2-1.
*
* @param tdd_config TDD configuration.
* @return Returns the number of DwPTS symbols.
*/
SRSLTE_API uint32_t srslte_sfidx_tdd_nof_dw(srslte_tdd_config_t tdd_config);
SRSLTE_API uint32_t srslte_tdd_nof_harq(srslte_tdd_config_t tdd_config);
SRSLTE_API uint32_t srslte_sfidx_tdd_nof_dw_slot(srslte_tdd_config_t tdd_config, uint32_t slot, srslte_cp_t cp);
SRSLTE_API bool srslte_sfidx_isvalid(uint32_t sf_idx);
SRSLTE_API bool srslte_portid_isvalid(uint32_t port_id);
SRSLTE_API bool srslte_N_id_2_isvalid(uint32_t N_id_2);
SRSLTE_API bool srslte_N_id_1_isvalid(uint32_t N_id_1);
SRSLTE_API bool srslte_symbol_sz_isvalid(uint32_t symbol_sz);
SRSLTE_API int srslte_symbol_sz(uint32_t nof_prb);
SRSLTE_API int srslte_symbol_sz_power2(uint32_t nof_prb);
SRSLTE_API int srslte_nof_prb(uint32_t symbol_sz);
SRSLTE_API uint32_t srslte_max_cce(uint32_t nof_prb);
SRSLTE_API int srslte_sampling_freq_hz(uint32_t nof_prb);
SRSLTE_API void srslte_use_standard_symbol_size(bool enabled);
SRSLTE_API bool srslte_symbol_size_is_standard();
SRSLTE_API uint32_t srslte_re_x_prb(uint32_t ns, uint32_t symbol, uint32_t nof_ports, uint32_t nof_symbols);
SRSLTE_API uint32_t srslte_voffset(uint32_t symbol_id, uint32_t cell_id, uint32_t nof_ports);
SRSLTE_API int srslte_group_hopping_f_gh(uint32_t f_gh[SRSLTE_NSLOTS_X_FRAME], uint32_t cell_id);
SRSLTE_API uint32_t srslte_N_ta_new_rar(uint32_t ta);
SRSLTE_API uint32_t srslte_N_ta_new(uint32_t N_ta_old, uint32_t ta);
SRSLTE_API float srslte_coderate(uint32_t tbs, uint32_t nof_re);
SRSLTE_API char* srslte_cp_string(srslte_cp_t cp);
SRSLTE_API srslte_mod_t srslte_str2mod(const char* mod_str);
SRSLTE_API char* srslte_mod_string(srslte_mod_t mod);
SRSLTE_API uint32_t srslte_mod_bits_x_symbol(srslte_mod_t mod);
SRSLTE_API uint8_t srslte_band_get_band(uint32_t dl_earfcn);
SRSLTE_API bool srslte_band_is_tdd(uint32_t band);
SRSLTE_API double srslte_band_fd(uint32_t dl_earfcn);
SRSLTE_API double srslte_band_fu(uint32_t ul_earfcn);
SRSLTE_API uint32_t srslte_band_ul_earfcn(uint32_t dl_earfcn);
SRSLTE_API int
srslte_band_get_fd_band(uint32_t band, srslte_earfcn_t* earfcn, int earfcn_start, int earfcn_end, uint32_t max_elems);
SRSLTE_API int srslte_band_get_fd_band_all(uint32_t band, srslte_earfcn_t* earfcn, uint32_t max_nelems);
SRSLTE_API int
srslte_band_get_fd_region(enum band_geographical_area region, srslte_earfcn_t* earfcn, uint32_t max_elems);
SRSLTE_API int srslte_str2mimotype(char* mimo_type_str, srslte_tx_scheme_t* type);
SRSLTE_API char* srslte_mimotype2str(srslte_tx_scheme_t mimo_type);
/* Returns the interval tti1-tti2 mod 10240 */
SRSLTE_API uint32_t srslte_tti_interval(uint32_t tti1, uint32_t tti2);
SRSLTE_API uint32_t srslte_print_check(char* s, size_t max_len, uint32_t cur_len, const char* format, ...);
SRSLTE_API bool srslte_nbiot_cell_isvalid(srslte_nbiot_cell_t* cell);
SRSLTE_API bool srslte_nbiot_portid_isvalid(uint32_t port_id);
SRSLTE_API float srslte_band_fu_nbiot(uint32_t ul_earfcn, const float m_ul);
SRSLTE_API char* srslte_nbiot_mode_string(srslte_nbiot_mode_t mode);
/**
* Returns a constant string pointer with the ACK/NACK feedback mode
*
* @param ack_nack_feedback_mode Mode
* @return Returns constant pointer with the text of the mode if succesful, `error` otherwise
*/
SRSLTE_API const char* srslte_ack_nack_feedback_mode_string(srslte_ack_nack_feedback_mode_t ack_nack_feedback_mode);
/**
* Returns a constant string pointer with the ACK/NACK feedback mode
*
* @param ack_nack_feedback_mode Mode
* @return Returns constant pointer with the text of the mode if succesful, `error` otherwise
*/
SRSLTE_API srslte_ack_nack_feedback_mode_t srslte_string_ack_nack_feedback_mode(const char* str);
/**
* Returns the number of bits for Rank Indicador reporting depending on the cell
*
* @param cell
*/
SRSLTE_API uint32_t srslte_ri_nof_bits(const srslte_cell_t* cell);
#ifdef __cplusplus
}
#endif
#endif // SRSLTE_PHY_COMMON_H

@ -1,176 +0,0 @@
/**
* Copyright 2013-2021 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/.
*
*/
/**********************************************************************************************
* File: phy_common_sl.h
*
* Description: Common parameters and lookup functions for Sidelink PHY
*
* Reference: 3GPP TS 36.211 version 15.3.0 Release 15
*********************************************************************************************/
#ifndef SRSLTE_PHY_COMMON_SL_H
#define SRSLTE_PHY_COMMON_SL_H
/**
* \brief Common parameters and lookup functions for Sidelink PHY
*/
#include "srslte/phy/common/phy_common.h"
typedef enum SRSLTE_API {
SRSLTE_SIDELINK_TM1 = 0,
SRSLTE_SIDELINK_TM2,
SRSLTE_SIDELINK_TM3,
SRSLTE_SIDELINK_TM4
} srslte_sl_tm_t;
typedef enum SRSLTE_API {
SRSLTE_SIDELINK_PSBCH = 0, // Physical Sidelink Broadcast Channel
SRSLTE_SIDELINK_PSCCH, // Physical Sidelink Control Channel
SRSLTE_SIDELINK_PSSCH, // Physical Sidelink Shared Channel
SRSLTE_SIDELINK_PSDCH // Physical Sidelink Discovery Channel
} srslte_sl_channels_t;
typedef struct SRSLTE_API {
srslte_sl_tm_t tm;
uint32_t N_sl_id;
uint32_t nof_prb;
srslte_cp_t cp;
} srslte_cell_sl_t;
#define SRSLTE_SL_MAX_PERIOD_LENGTH 320 // SL-PeriodComm-r12 3GPP TS 36.331 Section 6.3.8
// SL-CommResourcePool: 3GPP TS 36.331 version 15.6.0 Release 15 Section 6.3.8
typedef struct SRSLTE_API {
uint32_t period_length;
uint32_t prb_num;
uint32_t prb_start;
uint32_t prb_end;
uint8_t pscch_sf_bitmap[SRSLTE_SL_MAX_PERIOD_LENGTH];
uint8_t pssch_sf_bitmap[SRSLTE_SL_MAX_PERIOD_LENGTH];
uint32_t size_sub_channel; // sizeSubchannel-r14
uint32_t num_sub_channel; // numSubchannel-r14
uint32_t start_prb_sub_channel; // startRB-Subchannel-r14 offset
bool adjacency_pscch_pssch; // adjacencyPSCCH-PSSCH-r14
uint32_t sf_bitmap_tm34_len;
uint8_t sf_bitmap_tm34[SRSLTE_SL_MAX_PERIOD_LENGTH]; // sl_Subframe_r14: 3GPP 36.331 Section 6.3.8
} srslte_sl_comm_resource_pool_t;
typedef enum SRSLTE_API {
SRSLTE_SIDELINK_DATA_SYMBOL = 0,
SRSLTE_SIDELINK_SYNC_SYMBOL,
SRSLTE_SIDELINK_DMRS_SYMBOL,
SRSLTE_SIDELINK_GUARD_SYMBOL
} srslte_sl_symbol_t;
#define SRSLTE_SL_DUPLEX_MODE_FDD (1)
#define SRSLTE_SL_DUPLEX_MODE_TDD (2)
#define SRSLTE_SLSS_SIDE_PEAK_OFFSET (0.005f)
#define SRSLTE_SLSS_SIDE_PEAK_THRESHOLD_HIGH (0.49f) // square(0.7), max 70% of main peak
#define SRSLTE_SLSS_SIDE_PEAK_THRESHOLD_LOW (0.09f) // square(0.3), min 30% of main peak
#define SRSLTE_PSBCH_NOF_PRB (6)
#define SRSLTE_PSCCH_TM34_NOF_PRB (2)
#define SRSLTE_MIB_SL_LEN (40) // TM1/2: 40 bits
#define SRSLTE_MIB_SL_V2X_LEN (48) // TM3/4: 48 bits
#define SRSLTE_MIB_SL_MAX_LEN (SRSLTE_MIB_SL_V2X_LEN)
#define SRSLTE_SL_TM12_DEFAULT_NUM_DMRS_SYMBOLS (2)
#define SRSLTE_SL_TM34_DEFAULT_NUM_DMRS_SYMBOLS (4) ///< In TM3/4, all channels have 4 DMRS by default
#define SRSLTE_PSBCH_TM12_NUM_DATA_SYMBOLS (8) // PSBCH is in 8 OFDM symbols (but only 7 are tx'ed)
#define SRSLTE_PSBCH_TM12_NUM_DATA_SYMBOLS_EXT \
(6) // PSBCH is in 7 OFDM symbols for extended cyclic prefix (but only 6 are tx'ed)
#define SRSLTE_PSBCH_TM12_NUM_DMRS_SYMBOLS (2) ///< PSBCH has 2 DMRS symbols
#define SRSLTE_PSBCH_TM12_NUM_SYNC_SYMBOLS (4) ///< Two symbols PSSS and two SSSS
#define SRSLTE_PSBCH_TM34_NUM_DATA_SYMBOLS (7) ///< SL-BCH is in 7 OFDM symbols (but only 6 are tx'ed)
#define SRSLTE_PSBCH_TM34_NUM_DMRS_SYMBOLS (3) ///< PSBCH has 3 DMRS symbols in TM3 and TM4
#define SRSLTE_PSBCH_TM34_NUM_SYNC_SYMBOLS (4) ///< Two symbols PSSS and two SSSS
#define SRSLTE_SCI_CRC_LEN (16)
#define SRSLTE_SCI_MAX_LEN (45)
#define SRSLTE_SCI_TM34_LEN (32)
#define SRSLTE_PSCCH_QM 2
#define SRSLTE_PSCCH_TM12_NOF_PRB (1)
#define SRSLTE_PSCCH_TM34_NOF_PRB (2)
#define SRSLTE_PSCCH_MAX_NOF_PRB (SRSLTE_PSCCH_TM34_NOF_PRB)
#define SRSLTE_PSCCH_SCRAMBLING_SEED (510) ///< Scrambling seed for PSCCH is 510
#define SRSLTE_PSCCH_TM12_NUM_DATA_SYMBOLS (12)
#define SRSLTE_PSCCH_TM12_NUM_DMRS_SYMBOLS (2)
#define SRSLTE_PSCCH_TM12_NUM_DATA_SYMBOLS_EXT (10)
#define SRSLTE_PSCCH_TM34_NUM_DATA_SYMBOLS (10)
#define SRSLTE_PSCCH_TM34_NUM_DMRS_SYMBOLS (4)
#define SRSLTE_PSCCH_TM12_NOF_CODED_BITS \
(SRSLTE_NRE * SRSLTE_PSCCH_TM12_NUM_DATA_SYMBOLS * SRSLTE_PSCCH_TM12_NOF_PRB * SRSLTE_PSCCH_QM)
#define SRSLTE_PSCCH_TM34_NOF_CODED_BITS \
(SRSLTE_NRE * SRSLTE_PSCCH_TM34_NUM_DATA_SYMBOLS * SRSLTE_PSCCH_TM34_NOF_PRB * SRSLTE_PSCCH_QM)
#define SRSLTE_PSCCH_MAX_CODED_BITS SRSLTE_MAX(SRSLTE_PSCCH_TM12_NOF_CODED_BITS, SRSLTE_PSCCH_TM34_NOF_CODED_BITS)
#define SRSLTE_PSSCH_MAX_QM 6
#define SRSLTE_PSSCH_CRC_LEN 24
#define SRSLTE_MAX_CODEWORD_LEN 168000 // 12 subcarriers * 100 PRB * 14 symbols * 10 bits, assuming 1024QAM
#define SRSLTE_SL_SCH_MAX_TB_LEN (48936) // 3GPP 36.306 v15.4.0 Table 4.1B-1
#define SRSLTE_PSSCH_MAX_CODED_BITS (3 * SRSLTE_TCOD_MAX_LEN_CB + SRSLTE_TCOD_TOTALTAIL)
#define SRSLTE_PSSCH_TM12_NUM_DATA_SYMBOLS (12) // PSSCH is in 12 OFDM symbols (but only 11 are tx'ed)
#define SRSLTE_PSSCH_TM12_NUM_DMRS_SYMBOLS (2) // PSSCH has 2 DMRS symbols in TM1 and TM2
#define SRSLTE_PSSCH_TM12_NUM_DATA_SYMBOLS_CP_EXT \
(10) // PSSCH is in 10 OFDM symbols for extended cyclic prefix (but only 9 are tx'ed)
#define SRSLTE_PSSCH_TM12_NUM_DMRS_SYMBOLS_CP_EXT \
(2) // PSSCH has 2 DMRS symbols for extended cyclic prefix in TM1 and TM2
#define SRSLTE_PSSCH_TM34_NUM_DATA_SYMBOLS (10) // PSSCH is in 10 OFDM symbols (but only 9 are tx'ed)
#define SRSLTE_PSSCH_TM34_NUM_DMRS_SYMBOLS (4) // PSSCH has 4 DMRS symbols in TM3 and TM4
SRSLTE_API int srslte_sl_group_hopping_f_gh(uint32_t f_gh[SRSLTE_NSLOTS_X_FRAME * 2], uint32_t N_x_id);
#define SRSLTE_PSCCH_MAX_NUM_DATA_SYMBOLS (SRSLTE_PSCCH_TM12_NUM_DATA_SYMBOLS)
SRSLTE_API bool srslte_slss_side_peak_pos_is_valid(uint32_t side_peak_pos,
uint32_t main_peak_pos,
uint32_t side_peak_delta_a,
uint32_t side_peak_delta_b);
SRSLTE_API bool srslte_slss_side_peak_value_is_valid(float side_peak_value, float threshold_low, float threshold_high);
SRSLTE_API int srslte_sl_tm_to_cell_sl_tm_t(srslte_cell_sl_t* q, uint32_t tm);
SRSLTE_API uint32_t srslte_sl_get_num_symbols(srslte_sl_tm_t tm, srslte_cp_t cp);
SRSLTE_API bool srslte_psbch_is_symbol(srslte_sl_symbol_t type, srslte_sl_tm_t tm, uint32_t i, srslte_cp_t cp);
SRSLTE_API bool srslte_pscch_is_symbol(srslte_sl_symbol_t type, srslte_sl_tm_t tm, uint32_t i, srslte_cp_t cp);
SRSLTE_API bool srslte_pssch_is_symbol(srslte_sl_symbol_t type, srslte_sl_tm_t tm, uint32_t i, srslte_cp_t cp);
SRSLTE_API uint32_t srslte_sci_format0_sizeof(uint32_t nof_prb);
SRSLTE_API int srslte_sl_comm_resource_pool_get_default_config(srslte_sl_comm_resource_pool_t* q,
srslte_cell_sl_t cell);
#endif // SRSLTE_PHY_COMMON_SL_H

@ -1,73 +0,0 @@
/**
* Copyright 2013-2021 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/.
*
*/
/**********************************************************************************************
* File: timestamp.h
*
* Description: A simple timestamp struct with separate variables for full and frac seconds.
* Separate variables are used to avoid loss of precision in our frac seconds.
* Only positive timestamps are supported.
*
* Reference:
*********************************************************************************************/
#ifndef SRSLTE_TIMESTAMP_H
#define SRSLTE_TIMESTAMP_H
#include "srslte/config.h"
#include <stdbool.h>
#include <stdint.h>
#include <time.h>
typedef struct SRSLTE_API {
time_t full_secs;
double frac_secs;
} srslte_timestamp_t;
#ifdef __cplusplus
extern "C" {
#endif
SRSLTE_API int srslte_timestamp_init(srslte_timestamp_t* t, time_t full_secs, double frac_secs);
SRSLTE_API void srslte_timestamp_init_uint64(srslte_timestamp_t* ts_time, uint64_t ts_count, double base_srate);
SRSLTE_API int srslte_timestamp_copy(srslte_timestamp_t* dest, srslte_timestamp_t* src);
SRSLTE_API int srslte_timestamp_compare(const srslte_timestamp_t* a, const srslte_timestamp_t* b);
SRSLTE_API int srslte_timestamp_add(srslte_timestamp_t* t, time_t full_secs, double frac_secs);
SRSLTE_API int srslte_timestamp_sub(srslte_timestamp_t* t, time_t full_secs, double frac_secs);
SRSLTE_API double srslte_timestamp_real(const srslte_timestamp_t* t);
SRSLTE_API bool srslte_timestamp_iszero(const srslte_timestamp_t* t);
SRSLTE_API uint32_t srslte_timestamp_uint32(srslte_timestamp_t* t);
SRSLTE_API uint64_t srslte_timestamp_uint64(const srslte_timestamp_t* t, double srate);
#ifdef __cplusplus
}
#endif
#endif // SRSLTE_TIMESTAMP_H

@ -1,61 +0,0 @@
/**
* Copyright 2013-2021 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/.
*
*/
/**********************************************************************************************
* File: dft_precoding.h
*
* Description: DFT-based transform precoding object.
* Used in generation of uplink SCFDMA signals.
*
* Reference: 3GPP TS 36.211 version 10.0.0 Release 10 Sec. 5.3.3
*********************************************************************************************/
#ifndef SRSLTE_DFT_PRECODING_H
#define SRSLTE_DFT_PRECODING_H
#include "srslte/config.h"
#include "srslte/phy/common/phy_common.h"
#include "srslte/phy/dft/dft.h"
/* DFT-based Transform Precoding object */
typedef struct SRSLTE_API {
uint32_t max_prb;
srslte_dft_plan_t dft_plan[SRSLTE_MAX_PRB + 1];
} srslte_dft_precoding_t;
SRSLTE_API int srslte_dft_precoding_init(srslte_dft_precoding_t* q, uint32_t max_prb, bool is_tx);
SRSLTE_API int srslte_dft_precoding_init_tx(srslte_dft_precoding_t* q, uint32_t max_prb);
SRSLTE_API int srslte_dft_precoding_init_rx(srslte_dft_precoding_t* q, uint32_t max_prb);
SRSLTE_API void srslte_dft_precoding_free(srslte_dft_precoding_t* q);
SRSLTE_API bool srslte_dft_precoding_valid_prb(uint32_t nof_prb);
SRSLTE_API uint32_t srslte_dft_precoding_get_valid_prb(uint32_t nof_prb);
SRSLTE_API int
srslte_dft_precoding(srslte_dft_precoding_t* q, cf_t* input, cf_t* output, uint32_t nof_prb, uint32_t nof_symbols);
#endif // SRSLTE_DFT_PRECODING_H

@ -1,171 +0,0 @@
/**
* Copyright 2013-2021 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/.
*
*/
/******************************************************************************
* File: enb_dl.h
*
* Description: ENB downlink object.
*
* This module is a frontend to all the downlink data and control
* channel processing modules for the ENB transmitter side.
*
* Reference:
*****************************************************************************/
#ifndef SRSLTE_ENB_DL_H
#define SRSLTE_ENB_DL_H
#include <stdbool.h>
#include "srslte/phy/ch_estimation/refsignal_dl.h"
#include "srslte/phy/common/phy_common.h"
#include "srslte/phy/dft/ofdm.h"
#include "srslte/phy/phch/dci.h"
#include "srslte/phy/phch/pbch.h"
#include "srslte/phy/phch/pcfich.h"
#include "srslte/phy/phch/pdcch.h"
#include "srslte/phy/phch/pdsch.h"
#include "srslte/phy/phch/pdsch_cfg.h"
#include "srslte/phy/phch/phich.h"
#include "srslte/phy/phch/pmch.h"
#include "srslte/phy/phch/ra.h"
#include "srslte/phy/phch/regs.h"
#include "srslte/phy/sync/pss.h"
#include "srslte/phy/sync/sss.h"
#include "srslte/phy/enb/enb_ul.h"
#include "srslte/phy/ue/ue_dl.h"
#include "srslte/phy/utils/debug.h"
#include "srslte/phy/utils/vector.h"
#include "srslte/config.h"
typedef struct SRSLTE_API {
srslte_cell_t cell;
srslte_dl_sf_cfg_t dl_sf;
cf_t* sf_symbols[SRSLTE_MAX_PORTS];
srslte_ofdm_t ifft[SRSLTE_MAX_PORTS];
srslte_ofdm_t ifft_mbsfn;
srslte_pbch_t pbch;
srslte_pcfich_t pcfich;
srslte_regs_t regs;
srslte_pdcch_t pdcch;
srslte_pdsch_t pdsch;
srslte_pmch_t pmch;
srslte_phich_t phich;
srslte_refsignal_t csr_signal;
srslte_refsignal_t mbsfnr_signal;
cf_t pss_signal[SRSLTE_PSS_LEN];
float sss_signal0[SRSLTE_SSS_LEN];
float sss_signal5[SRSLTE_SSS_LEN];
uint32_t nof_common_locations[3];
srslte_dci_location_t common_locations[3][SRSLTE_MAX_CANDIDATES_COM];
} srslte_enb_dl_t;
typedef struct {
uint8_t ack;
uint32_t n_prb_lowest;
uint32_t n_dmrs;
} srslte_enb_dl_phich_t;
/* This function shall be called just after the initial synchronization */
SRSLTE_API int srslte_enb_dl_init(srslte_enb_dl_t* q, cf_t* out_buffer[SRSLTE_MAX_PORTS], uint32_t max_prb);
SRSLTE_API void srslte_enb_dl_free(srslte_enb_dl_t* q);
SRSLTE_API int srslte_enb_dl_set_cell(srslte_enb_dl_t* q, srslte_cell_t cell);
SRSLTE_API bool srslte_enb_dl_location_is_common_ncce(srslte_enb_dl_t* q, uint32_t ncce);
SRSLTE_API void srslte_enb_dl_put_base(srslte_enb_dl_t* q, srslte_dl_sf_cfg_t* dl_sf);
SRSLTE_API void srslte_enb_dl_put_phich(srslte_enb_dl_t* q, srslte_phich_grant_t* grant, bool ack);
SRSLTE_API int srslte_enb_dl_put_pdcch_dl(srslte_enb_dl_t* q, srslte_dci_cfg_t* dci_cfg, srslte_dci_dl_t* dci_dl);
SRSLTE_API int srslte_enb_dl_put_pdcch_ul(srslte_enb_dl_t* q, srslte_dci_cfg_t* dci_cfg, srslte_dci_ul_t* dci_ul);
SRSLTE_API int
srslte_enb_dl_put_pdsch(srslte_enb_dl_t* q, srslte_pdsch_cfg_t* pdsch, uint8_t* data[SRSLTE_MAX_CODEWORDS]);
SRSLTE_API int srslte_enb_dl_put_pmch(srslte_enb_dl_t* q, srslte_pmch_cfg_t* pmch_cfg, uint8_t* data);
SRSLTE_API void srslte_enb_dl_gen_signal(srslte_enb_dl_t* q);
SRSLTE_API bool srslte_enb_dl_gen_cqi_periodic(const srslte_cell_t* cell,
const srslte_dl_cfg_t* dl_cfg,
uint32_t tti,
uint32_t last_ri,
srslte_cqi_cfg_t* cqi_cfg);
SRSLTE_API bool srslte_enb_dl_gen_cqi_aperiodic(const srslte_cell_t* cell,
const srslte_dl_cfg_t* dl_cfg,
uint32_t ri,
srslte_cqi_cfg_t* cqi_cfg);
SRSLTE_API void srslte_enb_dl_save_signal(srslte_enb_dl_t* q);
/**
* Generates the uplink control information configuration from the cell, subframe and HARQ ACK information. Note that
* it expects the UCI configuration shall have been configured already with scheduling request and channel quality
* information prior to this call.
*
* @param cell points to the physical layer cell parameters
* @param sf points to the subframe configuration
* @param ack_info is the HARQ-ACK information
* @param uci_cfg the UCI configuration destination
*/
SRSLTE_API void srslte_enb_dl_gen_ack(const srslte_cell_t* cell,
const srslte_dl_sf_cfg_t* sf,
const srslte_pdsch_ack_t* ack_info,
srslte_uci_cfg_t* uci_cfg);
/**
* gets the HARQ-ACK values from the received Uplink Control Information configuration, the cell, and HARQ ACK
* info itself. Note that it expects that the HARQ-ACK info has been set prior the UCI Data decoding.
*
* @param cell points to the physical layer cell parameters
* @param uci_cfg points to the UCI configration
* @param uci_value points to the received UCI values
* @param ack_info is the HARQ-ACK information
*/
SRSLTE_API void srslte_enb_dl_get_ack(const srslte_cell_t* cell,
const srslte_uci_cfg_t* uci_cfg,
const srslte_uci_value_t* uci_value,
srslte_pdsch_ack_t* pdsch_ack);
/**
* Gets the maximum signal power in decibels full scale. It is equivalent to the transmit power if all resource elements
* were populated.
* @return The maximum power
*/
SRSLTE_API float srslte_enb_dl_get_maximum_signal_power_dBfs(uint32_t nof_prb);
#endif // SRSLTE_ENB_DL_H

@ -1,76 +0,0 @@
/**
* Copyright 2013-2021 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_ENB_DL_NR_H
#define SRSLTE_ENB_DL_NR_H
#include "srslte/phy/common/phy_common_nr.h"
#include "srslte/phy/dft/ofdm.h"
#include "srslte/phy/phch/pdcch_nr.h"
#include "srslte/phy/phch/pdsch_nr.h"
typedef struct SRSLTE_API {
srslte_pdsch_nr_args_t pdsch;
srslte_pdcch_nr_args_t pdcch;
uint32_t nof_tx_antennas;
uint32_t nof_max_prb;
} srslte_enb_dl_nr_args_t;
typedef struct SRSLTE_API {
uint32_t max_prb;
uint32_t nof_tx_antennas;
srslte_carrier_nr_t carrier;
srslte_coreset_t coreset;
srslte_ofdm_t fft[SRSLTE_MAX_PORTS];
cf_t* sf_symbols[SRSLTE_MAX_PORTS];
srslte_pdsch_nr_t pdsch;
srslte_dmrs_sch_t dmrs;
srslte_pdcch_nr_t pdcch;
} srslte_enb_dl_nr_t;
SRSLTE_API int
srslte_enb_dl_nr_init(srslte_enb_dl_nr_t* q, cf_t* output[SRSLTE_MAX_PORTS], const srslte_enb_dl_nr_args_t* args);
SRSLTE_API int srslte_enb_dl_nr_set_carrier(srslte_enb_dl_nr_t* q, const srslte_carrier_nr_t* carrier);
SRSLTE_API int srslte_enb_dl_nr_set_coreset(srslte_enb_dl_nr_t* q, const srslte_coreset_t* coreset);
SRSLTE_API void srslte_enb_dl_nr_free(srslte_enb_dl_nr_t* q);
SRSLTE_API int srslte_enb_dl_nr_base_zero(srslte_enb_dl_nr_t* q);
SRSLTE_API void srslte_enb_dl_nr_gen_signal(srslte_enb_dl_nr_t* q);
SRSLTE_API int
srslte_enb_dl_nr_pdcch_put(srslte_enb_dl_nr_t* q, const srslte_slot_cfg_t* slot_cfg, const srslte_dci_dl_nr_t* dci_dl);
SRSLTE_API int srslte_enb_dl_nr_pdsch_put(srslte_enb_dl_nr_t* q,
const srslte_slot_cfg_t* slot,
const srslte_sch_cfg_nr_t* cfg,
uint8_t* data[SRSLTE_MAX_TB]);
SRSLTE_API int
srslte_enb_dl_nr_pdsch_info(const srslte_enb_dl_nr_t* q, const srslte_sch_cfg_nr_t* cfg, char* str, uint32_t str_len);
#endif // SRSLTE_ENB_DL_NR_H

@ -1,87 +0,0 @@
/**
* Copyright 2013-2021 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/.
*
*/
/******************************************************************************
* File: enb_ul.h
*
* Description: ENB uplink object.
*
* This module is a frontend to all the uplink data and control
* channel processing modules for the ENB receiver side.
*
* Reference:
*****************************************************************************/
#ifndef SRSLTE_ENB_UL_H
#define SRSLTE_ENB_UL_H
#include <stdbool.h>
#include "srslte/phy/ch_estimation/chest_ul.h"
#include "srslte/phy/common/phy_common.h"
#include "srslte/phy/dft/ofdm.h"
#include "srslte/phy/phch/prach.h"
#include "srslte/phy/phch/pucch.h"
#include "srslte/phy/phch/pusch.h"
#include "srslte/phy/phch/pusch_cfg.h"
#include "srslte/phy/phch/ra.h"
#include "srslte/phy/utils/debug.h"
#include "srslte/phy/utils/vector.h"
#include "srslte/config.h"
typedef struct SRSLTE_API {
srslte_cell_t cell;
cf_t* sf_symbols;
srslte_chest_ul_res_t chest_res;
srslte_ofdm_t fft;
srslte_chest_ul_t chest;
srslte_pusch_t pusch;
srslte_pucch_t pucch;
} srslte_enb_ul_t;
/* This function shall be called just after the initial synchronization */
SRSLTE_API int srslte_enb_ul_init(srslte_enb_ul_t* q, cf_t* in_buffer, uint32_t max_prb);
SRSLTE_API void srslte_enb_ul_free(srslte_enb_ul_t* q);
SRSLTE_API int srslte_enb_ul_set_cell(srslte_enb_ul_t* q,
srslte_cell_t cell,
srslte_refsignal_dmrs_pusch_cfg_t* pusch_cfg,
srslte_refsignal_srs_cfg_t* srs_cfg);
SRSLTE_API void srslte_enb_ul_fft(srslte_enb_ul_t* q);
SRSLTE_API int srslte_enb_ul_get_pucch(srslte_enb_ul_t* q,
srslte_ul_sf_cfg_t* ul_sf,
srslte_pucch_cfg_t* cfg,
srslte_pucch_res_t* res);
SRSLTE_API int srslte_enb_ul_get_pusch(srslte_enb_ul_t* q,
srslte_ul_sf_cfg_t* ul_sf,
srslte_pusch_cfg_t* cfg,
srslte_pusch_res_t* res);
#endif // SRSLTE_ENB_UL_H

@ -1,47 +0,0 @@
/**
* Copyright 2013-2021 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/.
*
*/
/**********************************************************************************************
* File: convcoder.h
*
* Description: Convolutional encoder.
* LTE uses a tail biting convolutional code with constraint length 7
* and coding rate 1/3.
*
* Reference: 3GPP TS 36.212 version 10.0.0 Release 10 Sec. 5.1.3.1
*********************************************************************************************/
#ifndef SRSLTE_CONVCODER_H
#define SRSLTE_CONVCODER_H
#include "srslte/config.h"
#include <stdbool.h>
typedef struct SRSLTE_API {
uint32_t R;
uint32_t K;
int poly[3];
bool tail_biting;
} srslte_convcoder_t;
SRSLTE_API int srslte_convcoder_encode(srslte_convcoder_t* q, uint8_t* input, uint8_t* output, uint32_t frame_length);
#endif // SRSLTE_CONVCODER_H

@ -1,51 +0,0 @@
/**
* Copyright 2013-2021 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/.
*
*/
/**********************************************************************************************
* File: rm_conv.h
*
* Description: Rate matching for convolutionally coded transport channels and control
* information.
*
* Reference: 3GPP TS 36.212 version 10.0.0 Release 10 Sec. 5.1.4.2
*********************************************************************************************/
#ifndef SRSLTE_RM_CONV_H
#define SRSLTE_RM_CONV_H
#include "srslte/config.h"
#ifndef SRSLTE_RX_NULL
#define SRSLTE_RX_NULL 10000
#endif
#ifndef SRSLTE_TX_NULL
#define SRSLTE_TX_NULL 100
#endif
SRSLTE_API int srslte_rm_conv_tx(uint8_t* input, uint32_t in_len, uint8_t* output, uint32_t out_len);
SRSLTE_API int srslte_rm_conv_rx(float* input, uint32_t in_len, float* output, uint32_t out_len);
/************* FIX THIS. MOVE ALL PROCESSING TO INT16 AND HAVE ONLY 1 IMPLEMENTATION ******/
SRSLTE_API int srslte_rm_conv_rx_s(int16_t* input, uint32_t in_len, int16_t* output, uint32_t out_len);
#endif // SRSLTE_RM_CONV_H

@ -1,85 +0,0 @@
/**
* Copyright 2013-2021 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/.
*
*/
/**********************************************************************************************
* File: convcoder.h
*
* Description: Cyclic Redundancy Check
* LTE requires CRC lengths 8, 16, 24A and 24B, each with it's own generator
* polynomial.
*
* Reference: 3GPP TS 36.212 version 10.0.0 Release 10 Sec. 5.1.1
*********************************************************************************************/
#ifndef SRSLTE_CRC_H
#define SRSLTE_CRC_H
#include "srslte/config.h"
#include <stdint.h>
typedef struct SRSLTE_API {
uint64_t table[256];
int polynom;
int order;
uint64_t crcinit;
uint64_t crcmask;
uint64_t crchighbit;
uint32_t srslte_crc_out;
} srslte_crc_t;
SRSLTE_API int srslte_crc_init(srslte_crc_t* h, uint32_t srslte_crc_poly, int srslte_crc_order);
SRSLTE_API int srslte_crc_set_init(srslte_crc_t* h, uint64_t init_value);
SRSLTE_API uint32_t srslte_crc_attach(srslte_crc_t* h, uint8_t* data, int len);
SRSLTE_API uint32_t srslte_crc_attach_byte(srslte_crc_t* h, uint8_t* data, int len);
static inline void srslte_crc_checksum_put_byte(srslte_crc_t* h, uint8_t byte)
{
uint64_t crc = h->crcinit;
uint32_t idx;
if (h->order > 8) {
// For more than 8 bits
uint32_t ord = h->order - 8U;
idx = ((crc >> (ord)) & 0xffU) ^ byte;
} else {
// For 8 bits or less
uint32_t ord = 8U - h->order;
idx = ((crc << (ord)) & 0xffU) ^ byte;
}
crc = (crc << 8U) ^ h->table[idx];
h->crcinit = crc;
}
static inline uint64_t srslte_crc_checksum_get(srslte_crc_t* h)
{
return (h->crcinit & h->crcmask);
}
SRSLTE_API uint32_t srslte_crc_checksum_byte(srslte_crc_t* h, const uint8_t* data, int len);
SRSLTE_API uint32_t srslte_crc_checksum(srslte_crc_t* h, uint8_t* data, int len);
#endif // SRSLTE_CRC_H

@ -1,37 +0,0 @@
/**
* Copyright 2013-2021 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/.
*
*/
/*!
* \file ldpc_common.h
* \brief Declaration of elements common to both the LDPC encoder and the LDPC decoder.
* \author David Gregoratti
* \date 2020
*
* \copyright Software Radio Systems Limited
*
*/
#ifndef SRSLTE_LDPCCOMMON_H
#define SRSLTE_LDPCCOMMON_H
#define FILLER_BIT 254 /*!< \brief Identifies a filler bit. */
#endif // SRSLTE_LDPCCOMMON_H

@ -1,100 +0,0 @@
/**
* Copyright 2013-2021 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/.
*
*/
/******************************************************************************
* File: softbuffer.h
*
* Description: Buffer for RX and TX soft bits. This should be provided by MAC.
* Provided here basically for the examples.
*
* Reference:
*****************************************************************************/
#ifndef SRSLTE_SOFTBUFFER_H
#define SRSLTE_SOFTBUFFER_H
#include "srslte/config.h"
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct SRSLTE_API {
uint32_t max_cb;
uint32_t max_cb_size;
int16_t** buffer_f;
uint8_t** data;
bool* cb_crc;
bool tb_crc;
} srslte_softbuffer_rx_t;
typedef struct SRSLTE_API {
uint32_t max_cb;
uint32_t max_cb_size;
uint8_t** buffer_b;
} srslte_softbuffer_tx_t;
#define SOFTBUFFER_SIZE 18600
SRSLTE_API int srslte_softbuffer_rx_init(srslte_softbuffer_rx_t* q, uint32_t nof_prb);
/**
* @brief Initialises Rx soft-buffer for a number of code blocks and their size
* @param q The Rx soft-buffer pointer
* @param max_cb The maximum number of code blocks to allocate
* @param max_cb_size The code block size to allocate
* @return It returns SRSLTE_SUCCESS if it allocates the soft-buffer succesfully, otherwise it returns SRSLTE_ERROR code
*/
SRSLTE_API int srslte_softbuffer_rx_init_guru(srslte_softbuffer_rx_t* q, uint32_t max_cb, uint32_t max_cb_size);
SRSLTE_API void srslte_softbuffer_rx_reset(srslte_softbuffer_rx_t* p);
SRSLTE_API void srslte_softbuffer_rx_reset_tbs(srslte_softbuffer_rx_t* q, uint32_t tbs);
SRSLTE_API void srslte_softbuffer_rx_reset_cb(srslte_softbuffer_rx_t* q, uint32_t nof_cb);
SRSLTE_API void srslte_softbuffer_rx_free(srslte_softbuffer_rx_t* p);
SRSLTE_API int srslte_softbuffer_tx_init(srslte_softbuffer_tx_t* q, uint32_t nof_prb);
/**
* @brief Initialises Tx soft-buffer for a number of code blocks and their size
* @param q The Tx soft-buffer pointer
* @param max_cb The maximum number of code blocks to allocate
* @param max_cb_size The code block size to allocate
* @return It returns SRSLTE_SUCCESS if it allocates the soft-buffer succesfully, otherwise it returns SRSLTE_ERROR code
*/
SRSLTE_API int srslte_softbuffer_tx_init_guru(srslte_softbuffer_tx_t* q, uint32_t max_cb, uint32_t max_cb_size);
SRSLTE_API void srslte_softbuffer_tx_reset(srslte_softbuffer_tx_t* p);
SRSLTE_API void srslte_softbuffer_tx_reset_tbs(srslte_softbuffer_tx_t* q, uint32_t tbs);
SRSLTE_API void srslte_softbuffer_tx_reset_cb(srslte_softbuffer_tx_t* q, uint32_t nof_cb);
SRSLTE_API void srslte_softbuffer_tx_free(srslte_softbuffer_tx_t* p);
#ifdef __cplusplus
}
#endif
#endif // SRSLTE_SOFTBUFFER_H

@ -1,50 +0,0 @@
/**
* Copyright 2013-2021 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/.
*
*/
/**********************************************************************************************
* File: tc_interl.h
*
* Description: Turbo code interleaver.
*
* Reference: 3GPP TS 36.212 version 10.0.0 Release 10 Sec. 5.1.3.2.3
*********************************************************************************************/
#ifndef SRSLTE_TC_INTERL_H
#define SRSLTE_TC_INTERL_H
#include "srslte/config.h"
#include <stdint.h>
typedef struct SRSLTE_API {
uint16_t* forward;
uint16_t* reverse;
uint32_t max_long_cb;
} srslte_tc_interl_t;
SRSLTE_API int srslte_tc_interl_LTE_gen(srslte_tc_interl_t* h, uint32_t long_cb);
SRSLTE_API int srslte_tc_interl_LTE_gen_interl(srslte_tc_interl_t* h, uint32_t long_cb, uint32_t interl_win);
SRSLTE_API int srslte_tc_interl_init(srslte_tc_interl_t* h, uint32_t max_long_cb);
SRSLTE_API void srslte_tc_interl_free(srslte_tc_interl_t* h);
#endif // SRSLTE_TC_INTERL_H

@ -1,71 +0,0 @@
/**
* Copyright 2013-2021 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/.
*
*/
/**********************************************************************************************
* File: turbocoder.h
*
* Description: Turbo coder.
* Parallel Concatenated Convolutional Code (PCCC) with two 8-state constituent
* encoders and one turbo code internal interleaver. The coding rate of turbo
* encoder is 1/3.
*
* Reference: 3GPP TS 36.212 version 10.0.0 Release 10 Sec. 5.1.3.2
*********************************************************************************************/
#ifndef SRSLTE_TURBOCODER_H
#define SRSLTE_TURBOCODER_H
#include "srslte/config.h"
#include "srslte/phy/fec/crc.h"
#include "srslte/phy/fec/turbo/tc_interl.h"
#define SRSLTE_TCOD_MAX_LEN_CB_BYTES (6144 / 8)
#ifndef SRSLTE_TX_NULL
#define SRSLTE_TX_NULL 100
#endif
typedef struct SRSLTE_API {
uint32_t max_long_cb;
uint8_t* temp;
} srslte_tcod_t;
/* This structure is used as an output for the LUT version of the encoder.
* The encoder produces parity bits only and rate matching will interleave them
* with the systematic bits
*/
SRSLTE_API int srslte_tcod_init(srslte_tcod_t* h, uint32_t max_long_cb);
SRSLTE_API void srslte_tcod_free(srslte_tcod_t* h);
SRSLTE_API int srslte_tcod_encode(srslte_tcod_t* h, uint8_t* input, uint8_t* output, uint32_t long_cb);
SRSLTE_API int srslte_tcod_encode_lut(srslte_tcod_t* h,
srslte_crc_t* crc_tb,
srslte_crc_t* crc_cb,
uint8_t* input,
uint8_t* parity,
uint32_t cblen_idx,
bool last_cb);
SRSLTE_API void srslte_tcod_gentable();
#endif // SRSLTE_TURBOCODER_H

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save