From 5efe05021a97606ee5f98235424eddb85628e25a Mon Sep 17 00:00:00 2001 From: Alexander Chemeris Date: Wed, 23 Mar 2016 17:06:32 +0300 Subject: transceiver: Add an option to generate random Access Bursts. --- Transceiver52M/Transceiver.cpp | 3 +++ Transceiver52M/Transceiver.h | 1 + Transceiver52M/osmo-trx.cpp | 9 ++++++++- Transceiver52M/sigProcLib.cpp | 33 +++++++++++++++++++++++++++++++++ Transceiver52M/sigProcLib.h | 3 +++ 5 files changed, 48 insertions(+), 1 deletion(-) (limited to 'Transceiver52M') diff --git a/Transceiver52M/Transceiver.cpp b/Transceiver52M/Transceiver.cpp index 1f59f78..a19d770 100644 --- a/Transceiver52M/Transceiver.cpp +++ b/Transceiver52M/Transceiver.cpp @@ -90,6 +90,9 @@ bool TransceiverState::init(int filler, size_t sps, float scale, size_t rtsc) case Transceiver::FILLER_EDGE_RAND: burst = generateEdgeBurst(rtsc); break; + case Transceiver::FILLER_ACCESS_RAND: + burst = genRandAccessBurst(sps, n); + break; case Transceiver::FILLER_ZERO: default: burst = generateEmptyBurst(sps, n); diff --git a/Transceiver52M/Transceiver.h b/Transceiver52M/Transceiver.h index 472adbe..013f13b 100644 --- a/Transceiver52M/Transceiver.h +++ b/Transceiver52M/Transceiver.h @@ -156,6 +156,7 @@ public: FILLER_ZERO, FILLER_NORM_RAND, FILLER_EDGE_RAND, + FILLER_ACCESS_RAND, }; private: diff --git a/Transceiver52M/osmo-trx.cpp b/Transceiver52M/osmo-trx.cpp index 3026f55..a734a0b 100644 --- a/Transceiver52M/osmo-trx.cpp +++ b/Transceiver52M/osmo-trx.cpp @@ -187,6 +187,9 @@ bool trx_setup_config(struct trx_config *config) case Transceiver::FILLER_EDGE_RAND: fillstr = "EDGE busrts with random payload"; break; + case Transceiver::FILLER_ACCESS_RAND: + fillstr = "Access busrts with random payload"; + break; } std::ostringstream ost(""); @@ -319,6 +322,7 @@ static void print_help() " -f Enable C0 filler table\n" " -o Set baseband frequency offset (default=auto)\n" " -r Random burst test mode with TSC\n" + " -A Random burst test mode with Access Bursts\n" " -R RSSI to dBm offset in dB (default=0)\n" " -S Swap channels (UmTRX only)\n", "EMERG, ALERT, CRT, ERR, WARNING, NOTICE, INFO, DEBUG"); @@ -341,7 +345,7 @@ static void handle_options(int argc, char **argv, struct trx_config *config) config->swap_channels = false; config->edge = false; - while ((option = getopt(argc, argv, "ha:l:i:p:c:dxfo:s:r:R:Se")) != -1) { + while ((option = getopt(argc, argv, "ha:l:i:p:c:dxfo:s:r:AR:Se")) != -1) { switch (option) { case 'h': print_help(); @@ -381,6 +385,9 @@ static void handle_options(int argc, char **argv, struct trx_config *config) config->rtsc = atoi(optarg); config->filler = Transceiver::FILLER_NORM_RAND; break; + case 'A': + config->filler = Transceiver::FILLER_ACCESS_RAND; + break; case 'R': config->rssi_offset = atof(optarg); break; diff --git a/Transceiver52M/sigProcLib.cpp b/Transceiver52M/sigProcLib.cpp index 9674aa8..2182550 100644 --- a/Transceiver52M/sigProcLib.cpp +++ b/Transceiver52M/sigProcLib.cpp @@ -1005,6 +1005,39 @@ signalVector *genRandNormalBurst(int tsc, int sps, int tn) return burst; } +/* + * Generate a random GSM access burst. + */ +signalVector *genRandAccessBurst(int sps, int tn) +{ + if ((tn < 0) || (tn > 7)) + return NULL; + if ((sps != 1) && (sps != 4)) + return NULL; + + int i = 0; + BitVector *bits = new BitVector(88); + signalVector *burst; + + /* head and synch bits */ + for (int n = 0; i < 49; i++, n++) + (*bits)[i] = gRACHBurst[n]; + + /* Random bits */ + for (; i < 85; i++) + (*bits)[i] = rand() % 2; + + /* Tail bits */ + for (; i < 88; i++) + (*bits)[i] = 0; + + int guard = 68 + !(tn % 4); + burst = modulateBurst(*bits, guard, sps); + delete bits; + + return burst; +} + signalVector *generateEmptyBurst(int sps, int tn) { if ((tn < 0) || (tn > 7)) diff --git a/Transceiver52M/sigProcLib.h b/Transceiver52M/sigProcLib.h index 93251b5..7af58e7 100644 --- a/Transceiver52M/sigProcLib.h +++ b/Transceiver52M/sigProcLib.h @@ -122,6 +122,9 @@ signalVector *generateEmptyBurst(int sps, int tn); /** Generate a normal GSM burst with random payload - 4 or 1 SPS */ signalVector *genRandNormalBurst(int tsc, int sps, int tn); +/** Generate an access GSM burst with random payload - 4 or 1 SPS */ +signalVector *genRandAccessBurst(int sps, int tn); + /** Generate a dummy GSM burst - 4 or 1 SPS */ signalVector *generateDummyBurst(int sps, int tn); -- cgit v1.2.3