transceiver: Add an option to generate random Access Bursts.

This commit is contained in:
Alexander Chemeris 2016-03-23 17:06:32 +03:00 committed by Tom Tsou
parent 78d1fc9a13
commit 5efe05021a
7 changed files with 53 additions and 1 deletions

View File

@ -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)
{

View File

@ -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. */

View File

@ -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);

View File

@ -156,6 +156,7 @@ public:
FILLER_ZERO,
FILLER_NORM_RAND,
FILLER_EDGE_RAND,
FILLER_ACCESS_RAND,
};
private:

View File

@ -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;

View File

@ -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))

View File

@ -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);