Added a block for generating Access Bursts
This commit is contained in:
parent
2f0406b76d
commit
2344483869
|
@ -27,6 +27,7 @@
|
||||||
<block>gsm_txtime_setter</block>
|
<block>gsm_txtime_setter</block>
|
||||||
<block>gsm_gmsk_mod</block>
|
<block>gsm_gmsk_mod</block>
|
||||||
<block>gsm_preprocess_tx_burst</block>
|
<block>gsm_preprocess_tx_burst</block>
|
||||||
|
<block>gsm_gen_test_ab</block>
|
||||||
</cat>
|
</cat>
|
||||||
<cat>
|
<cat>
|
||||||
<name>Logical channels demapping</name>
|
<name>Logical channels demapping</name>
|
||||||
|
|
|
@ -19,7 +19,9 @@
|
||||||
|
|
||||||
install(FILES
|
install(FILES
|
||||||
gsm_gmsk_mod.xml
|
gsm_gmsk_mod.xml
|
||||||
gsm_txtime_bursts_tagger.xml
|
gsm_txtime_bursts_tagger.xml
|
||||||
gsm_txtime_setter.xml
|
gsm_txtime_setter.xml
|
||||||
gsm_preprocess_tx_burst.xml DESTINATION share/gnuradio/grc/blocks
|
gsm_preprocess_tx_burst.xml
|
||||||
|
gsm_gen_test_ab.xml
|
||||||
|
DESTINATION share/gnuradio/grc/blocks
|
||||||
)
|
)
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<block>
|
||||||
|
<name>Gen Test AB</name>
|
||||||
|
<key>gsm_gen_test_ab</key>
|
||||||
|
<import>import grgsm</import>
|
||||||
|
<make>grgsm.gen_test_ab()</make>
|
||||||
|
|
||||||
|
<sink>
|
||||||
|
<name>bursts_in</name>
|
||||||
|
<type>message</type>
|
||||||
|
<optional>1</optional>
|
||||||
|
</sink>
|
||||||
|
|
||||||
|
<source>
|
||||||
|
<name>bursts_out</name>
|
||||||
|
<type>message</type>
|
||||||
|
<optional>1</optional>
|
||||||
|
</source>
|
||||||
|
</block>
|
|
@ -23,5 +23,6 @@
|
||||||
install(FILES
|
install(FILES
|
||||||
txtime_setter.h
|
txtime_setter.h
|
||||||
preprocess_tx_burst.h
|
preprocess_tx_burst.h
|
||||||
|
gen_test_ab.h
|
||||||
DESTINATION include/grgsm/transmitter
|
DESTINATION include/grgsm/transmitter
|
||||||
)
|
)
|
||||||
|
|
|
@ -0,0 +1,60 @@
|
||||||
|
/* -*- c++ -*- */
|
||||||
|
/* @file
|
||||||
|
* @author Piotr Krysik <ptrkrysik@gmail.com>
|
||||||
|
* @section LICENSE
|
||||||
|
*
|
||||||
|
* Gr-gsm is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 3, or (at your option)
|
||||||
|
* any later version.
|
||||||
|
*
|
||||||
|
* Gr-gsm 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 General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with gr-gsm; see the file COPYING. If not, write to
|
||||||
|
* the Free Software Foundation, Inc., 51 Franklin Street,
|
||||||
|
* Boston, MA 02110-1301, USA.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef INCLUDED_GSM_GEN_TEST_AB_H
|
||||||
|
#define INCLUDED_GSM_GEN_TEST_AB_H
|
||||||
|
|
||||||
|
#include <grgsm/api.h>
|
||||||
|
#include <gnuradio/block.h>
|
||||||
|
|
||||||
|
namespace gr {
|
||||||
|
namespace gsm {
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief A block that does preprocessing tasks before sending bursts to modulator.
|
||||||
|
* \ingroup gsm
|
||||||
|
*
|
||||||
|
* Currently it removes GSMTAP header from a burst and puts it in first part of PDU
|
||||||
|
* pair and removes tailing zeros from Access Bursts coming from TRX interface.
|
||||||
|
*/
|
||||||
|
class GRGSM_API gen_test_ab : virtual public gr::block
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
typedef boost::shared_ptr<gen_test_ab> sptr;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Return a shared_ptr to a new instance of gsm::gen_test_ab.
|
||||||
|
*
|
||||||
|
* To avoid accidental use of raw pointers, gsm::gen_test_ab's
|
||||||
|
* constructor is in a private implementation
|
||||||
|
* class. gsm::gen_test_ab::make is the public interface for
|
||||||
|
* creating new instances.
|
||||||
|
*/
|
||||||
|
static sptr make();
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace gsm
|
||||||
|
} // namespace gr
|
||||||
|
|
||||||
|
#endif /* INCLUDED_GSM_GEN_TEST_AB_H */
|
||||||
|
|
|
@ -20,4 +20,5 @@
|
||||||
add_sources(
|
add_sources(
|
||||||
txtime_setter_impl.cc
|
txtime_setter_impl.cc
|
||||||
preprocess_tx_burst_impl.cc
|
preprocess_tx_burst_impl.cc
|
||||||
|
gen_test_ab_impl
|
||||||
)
|
)
|
||||||
|
|
|
@ -0,0 +1,107 @@
|
||||||
|
/* -*- c++ -*- */
|
||||||
|
/* @file
|
||||||
|
* @author Piotr Krysik <ptrkrysik@gmail.com>
|
||||||
|
* @section LICENSE
|
||||||
|
*
|
||||||
|
* Gr-gsm is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 3, or (at your option)
|
||||||
|
* any later version.
|
||||||
|
*
|
||||||
|
* Gr-gsm 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 General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with gr-gsm; see the file COPYING. If not, write to
|
||||||
|
* the Free Software Foundation, Inc., 51 Franklin Street,
|
||||||
|
* Boston, MA 02110-1301, USA.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <gnuradio/io_signature.h>
|
||||||
|
#include <grgsm/gsmtap.h>
|
||||||
|
#include <grgsm/gsm_constants.h>
|
||||||
|
#include "gen_test_ab_impl.h"
|
||||||
|
|
||||||
|
namespace gr {
|
||||||
|
namespace gsm {
|
||||||
|
|
||||||
|
static uint8_t rach_synch_seq[] = {
|
||||||
|
0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1,
|
||||||
|
1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0 ,
|
||||||
|
1, 0, 1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0,
|
||||||
|
};
|
||||||
|
|
||||||
|
// static uint8_t AB[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||||
|
// static uint8_t AB[] = {0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1};
|
||||||
|
// static uint8_t AB[] = { 1, 1, 0, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1};
|
||||||
|
static uint8_t AB[] = {1,1,1,1,1,1,1,1,1,0,1,1,0,1,0,0,1,0,0,0,0,0,0,0,0,1,1,0,0,1,1,0,0,1,0,1,0,1,0,1,1,1,0,0,0,0,1,1,1,0,0,1,0,0,0,1,0,1,0,1,0,0,1,0,1,0,1,1,0,1,1,0,0,1,0,1,0,0,0,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
|
||||||
|
,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1};
|
||||||
|
gen_test_ab::sptr
|
||||||
|
gen_test_ab::make()
|
||||||
|
{
|
||||||
|
return gnuradio::get_initial_sptr
|
||||||
|
(new gen_test_ab_impl());
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The private constructor
|
||||||
|
*/
|
||||||
|
gen_test_ab_impl::gen_test_ab_impl()
|
||||||
|
: gr::block("gen_test_ab",
|
||||||
|
gr::io_signature::make(0, 0, 0),
|
||||||
|
gr::io_signature::make(0, 0, 0))
|
||||||
|
{
|
||||||
|
message_port_register_in(pmt::intern("bursts_in"));
|
||||||
|
message_port_register_out(pmt::intern("bursts_out"));
|
||||||
|
|
||||||
|
set_msg_handler(pmt::intern("bursts_in"), boost::bind(&gen_test_ab_impl::generate_ab, this, _1));
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Our virtual destructor.
|
||||||
|
*/
|
||||||
|
gen_test_ab_impl::~gen_test_ab_impl()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void gen_test_ab_impl::generate_ab(pmt::pmt_t burst)
|
||||||
|
{
|
||||||
|
uint8_t buf[sizeof(gsmtap_hdr) + 148];
|
||||||
|
struct gsmtap_hdr *tap_header = (struct gsmtap_hdr *) buf;
|
||||||
|
uint8_t *access_burst = buf + sizeof(gsmtap_hdr);
|
||||||
|
|
||||||
|
// memset(access_burst, 0, 8); /* TB */
|
||||||
|
// memcpy(access_burst + 8, rach_synch_seq, 41); /* sync seq */
|
||||||
|
// memcpy(access_burst + 49, AB, 36); /* payload */
|
||||||
|
// memset(access_burst + 85, 0, 63); /* TB + GP */
|
||||||
|
|
||||||
|
memcpy(access_burst, AB, 148);
|
||||||
|
|
||||||
|
gsmtap_hdr * header = (gsmtap_hdr *)(pmt::blob_data(pmt::cdr(burst)));
|
||||||
|
uint32_t frame_nr = be32toh(header->frame_number);
|
||||||
|
frame_nr = (frame_nr+51)% (26*51*2048);
|
||||||
|
|
||||||
|
tap_header->version = GSMTAP_VERSION;
|
||||||
|
tap_header->hdr_len = sizeof(gsmtap_hdr) / 4;
|
||||||
|
tap_header->type = GSMTAP_TYPE_UM_BURST;
|
||||||
|
tap_header->sub_type = GSMTAP_BURST_ACCESS;
|
||||||
|
tap_header->frame_number = htobe32(frame_nr);
|
||||||
|
tap_header->timeslot = header->timeslot;
|
||||||
|
tap_header->arfcn = 0;
|
||||||
|
|
||||||
|
pmt::pmt_t blob = pmt::make_blob(buf, sizeof(gsmtap_hdr) + BURST_SIZE);
|
||||||
|
pmt::pmt_t pdu_header = pmt::make_dict();
|
||||||
|
|
||||||
|
pmt::pmt_t new_msg = pmt::cons(pdu_header, blob);
|
||||||
|
message_port_pub(pmt::intern("bursts_out"), new_msg);
|
||||||
|
}
|
||||||
|
} /* namespace gsm */
|
||||||
|
} /* namespace gr */
|
||||||
|
|
|
@ -0,0 +1,47 @@
|
||||||
|
/* -*- c++ -*- */
|
||||||
|
/* @file
|
||||||
|
* @author Piotr Krysik <ptrkrysik@gmail.com>
|
||||||
|
* @section LICENSE
|
||||||
|
*
|
||||||
|
* Gr-gsm is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 3, or (at your option)
|
||||||
|
* any later version.
|
||||||
|
*
|
||||||
|
* Gr-gsm 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 General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with gr-gsm; see the file COPYING. If not, write to
|
||||||
|
* the Free Software Foundation, Inc., 51 Franklin Street,
|
||||||
|
* Boston, MA 02110-1301, USA.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef INCLUDED_GSM_GEN_TEST_AB_IMPL_H
|
||||||
|
#define INCLUDED_GSM_GEN_TEST_AB_IMPL_H
|
||||||
|
|
||||||
|
#include <grgsm/transmitter/gen_test_ab.h>
|
||||||
|
#include <grgsm/misc_utils/time_spec.h>
|
||||||
|
#include <grgsm/misc_utils/fn_time.h>
|
||||||
|
|
||||||
|
namespace gr {
|
||||||
|
namespace gsm {
|
||||||
|
|
||||||
|
class gen_test_ab_impl : public gen_test_ab
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
void generate_ab(pmt::pmt_t burst);
|
||||||
|
|
||||||
|
public:
|
||||||
|
gen_test_ab_impl();
|
||||||
|
~gen_test_ab_impl();
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace gsm
|
||||||
|
} // namespace gr
|
||||||
|
|
||||||
|
#endif /* INCLUDED_GSM_GEN_TEST_AB_IMPL_H */
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/* -*- c++ -*- */
|
/* -*- c++ -*- */
|
||||||
/*
|
/*
|
||||||
* @file
|
* @file
|
||||||
* @author (C) 2014 by Piotr Krysik <ptrkrysik@gmail.com>
|
* @author (C) 2014-2017 by Piotr Krysik <ptrkrysik@gmail.com>
|
||||||
* @section LICENSE
|
* @section LICENSE
|
||||||
*
|
*
|
||||||
* Gr-gsm is free software; you can redistribute it and/or modify
|
* Gr-gsm is free software; you can redistribute it and/or modify
|
||||||
|
@ -72,6 +72,7 @@
|
||||||
#include "grgsm/misc_utils/fn_time.h"
|
#include "grgsm/misc_utils/fn_time.h"
|
||||||
#include "grgsm/transmitter/txtime_setter.h"
|
#include "grgsm/transmitter/txtime_setter.h"
|
||||||
#include "grgsm/transmitter/preprocess_tx_burst.h"
|
#include "grgsm/transmitter/preprocess_tx_burst.h"
|
||||||
|
#include "grgsm/transmitter/gen_test_ab.h"
|
||||||
#include "grgsm/misc_utils/trx_burst_if.h"
|
#include "grgsm/misc_utils/trx_burst_if.h"
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
@ -144,10 +145,6 @@ GR_SWIG_BLOCK_MAGIC2(gsm, msg_to_tag);
|
||||||
GR_SWIG_BLOCK_MAGIC2(gsm, controlled_fractional_resampler_cc);
|
GR_SWIG_BLOCK_MAGIC2(gsm, controlled_fractional_resampler_cc);
|
||||||
%include "grgsm/misc_utils/extract_cmc.h"
|
%include "grgsm/misc_utils/extract_cmc.h"
|
||||||
GR_SWIG_BLOCK_MAGIC2(gsm, extract_cmc);
|
GR_SWIG_BLOCK_MAGIC2(gsm, extract_cmc);
|
||||||
%include "grgsm/misc_utils/trx_burst_if.h"
|
|
||||||
GR_SWIG_BLOCK_MAGIC2(gsm, trx_burst_if);
|
|
||||||
|
|
||||||
|
|
||||||
%include "grgsm/qa_utils/burst_sink.h"
|
%include "grgsm/qa_utils/burst_sink.h"
|
||||||
GR_SWIG_BLOCK_MAGIC2(gsm, burst_sink);
|
GR_SWIG_BLOCK_MAGIC2(gsm, burst_sink);
|
||||||
%include "grgsm/qa_utils/burst_source.h"
|
%include "grgsm/qa_utils/burst_source.h"
|
||||||
|
@ -185,3 +182,9 @@ GR_SWIG_BLOCK_MAGIC2(gsm, message_sink);
|
||||||
GR_SWIG_BLOCK_MAGIC2(gsm, txtime_setter);
|
GR_SWIG_BLOCK_MAGIC2(gsm, txtime_setter);
|
||||||
%include "grgsm/transmitter/preprocess_tx_burst.h"
|
%include "grgsm/transmitter/preprocess_tx_burst.h"
|
||||||
GR_SWIG_BLOCK_MAGIC2(gsm, preprocess_tx_burst);
|
GR_SWIG_BLOCK_MAGIC2(gsm, preprocess_tx_burst);
|
||||||
|
|
||||||
|
%include "grgsm/transmitter/gen_test_ab.h"
|
||||||
|
GR_SWIG_BLOCK_MAGIC2(gsm, gen_test_ab);
|
||||||
|
|
||||||
|
%include "grgsm/misc_utils/trx_burst_if.h"
|
||||||
|
GR_SWIG_BLOCK_MAGIC2(gsm, trx_burst_if);
|
||||||
|
|
Loading…
Reference in New Issue