From 9460154b364d7ec0df4e69828aab467a1514a7ec Mon Sep 17 00:00:00 2001 From: Alexander Chemeris Date: Wed, 23 Mar 2016 17:06:32 +0300 Subject: [PATCH] transceiver: Add an option to generate random Access Bursts. --- GSM/GSMCommon.cpp | 3 +++ GSM/GSMCommon.h | 2 ++ Transceiver52M/Transceiver.cpp | 3 +++ Transceiver52M/Transceiver.h | 1 + Transceiver52M/osmo-trx.cpp | 9 ++++++++- Transceiver52M/sigProcLib.cpp | 33 +++++++++++++++++++++++++++++++++ Transceiver52M/sigProcLib.h | 3 +++ 7 files changed, 53 insertions(+), 1 deletion(-) diff --git a/GSM/GSMCommon.cpp b/GSM/GSMCommon.cpp index 3b5331f2..8aba3bef 100644 --- a/GSM/GSMCommon.cpp +++ b/GSM/GSMCommon.cpp @@ -56,6 +56,9 @@ const BitVector GSM::gDummyBurst("0001111101101110110000010100100111000001001000 const BitVector GSM::gRACHSynchSequence("01001011011111111001100110101010001111000"); +// |-head-||---------midamble----------------------||--------------data----------------||t| +const BitVector GSM::gRACHBurst("0011101001001011011111111001100110101010001111000110111101111110000111001001010110011000"); + int32_t GSM::FNDelta(int32_t v1, int32_t v2) { diff --git a/GSM/GSMCommon.h b/GSM/GSMCommon.h index 004536bf..8b8d5e86 100644 --- a/GSM/GSMCommon.h +++ b/GSM/GSMCommon.h @@ -53,6 +53,8 @@ extern const BitVector gDummyBurst; /** Random access burst synch. sequence */ extern const BitVector gRACHSynchSequence; +/** Random access burst synch. sequence, GSM 05.02 5.2.7 */ +extern const BitVector gRACHBurst; /**@name Modulus operations for frame numbers. */ diff --git a/Transceiver52M/Transceiver.cpp b/Transceiver52M/Transceiver.cpp index 43b62ffe..e687f38a 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 5c151091..99948242 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 3026f554..a734a0be 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 9674aa83..2182550a 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 93251b59..7af58e75 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);