transceiver: Add an option to emulate a RACH delay in random filler mode.

Signed-off-by: Tom Tsou <tom.tsou@ettus.com>
diff --git a/Transceiver52M/osmo-trx.cpp b/Transceiver52M/osmo-trx.cpp
index d56b5c6..f4b585e 100644
--- a/Transceiver52M/osmo-trx.cpp
+++ b/Transceiver52M/osmo-trx.cpp
@@ -70,6 +70,7 @@
 	unsigned rx_sps;
 	unsigned chans;
 	unsigned rtsc;
+	unsigned rach_delay;
 	bool extref;
 	Transceiver::FillerType filler;
 	bool diversity;
@@ -265,7 +266,7 @@
 	trx = new Transceiver(config->port, config->addr.c_str(),
 			      config->tx_sps, config->rx_sps, config->chans,
 			      GSM::Time(3,0), radio, config->rssi_offset);
-	if (!trx->init(config->filler, config->rtsc)) {
+	if (!trx->init(config->filler, config->rtsc, config->rach_delay)) {
 		LOG(ALERT) << "Failed to initialize transceiver";
 		delete trx;
 		return NULL;
@@ -317,8 +318,8 @@
 		"  -c    Number of ARFCN channels (default=1)\n"
 		"  -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    Random Normal Burst test mode with TSC\n"
+		"  -A    Random Access Burst test mode with delay\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");
@@ -333,6 +334,7 @@
 	config->rx_sps = DEFAULT_RX_SPS;
 	config->chans = DEFAULT_CHANS;
 	config->rtsc = 0;
+	config->rach_delay = 0;
 	config->extref = false;
 	config->filler = Transceiver::FILLER_ZERO;
 	config->diversity = false;
@@ -341,7 +343,7 @@
 	config->swap_channels = false;
 	config->edge = false;
 
-	while ((option = getopt(argc, argv, "ha:l:i:p:c:dxfo:s:r:AR:Se")) != -1) {
+	while ((option = getopt(argc, argv, "ha:l:i:p:c:dxfo:s:r:A:R:Se")) != -1) {
 		switch (option) {
 		case 'h':
 			print_help();
@@ -382,6 +384,7 @@
 			config->filler = Transceiver::FILLER_NORM_RAND;
 			break;
 		case 'A':
+			config->rach_delay = atoi(optarg);
 			config->filler = Transceiver::FILLER_ACCESS_RAND;
 			break;
 		case 'R':
@@ -420,6 +423,12 @@
 		print_help();
 		exit(0);
 	}
+
+	if (config->rach_delay > 68) {
+		printf("RACH delay is too big %i\n\n", config->rach_delay);
+		print_help();
+		exit(0);
+	}
 }
 
 int main(int argc, char *argv[])