Change in ...osmocom-bb[master]: trx_toolkit/rand_burst_gen.py: use TrainingSeqGMSK and BurstType enums

laforge gerrit-no-reply at lists.osmocom.org
Tue Jul 16 04:07:34 UTC 2019


laforge has submitted this change and it was merged. ( https://gerrit.osmocom.org/c/osmocom-bb/+/14691 )

Change subject: trx_toolkit/rand_burst_gen.py: use TrainingSeqGMSK and BurstType enums
......................................................................

trx_toolkit/rand_burst_gen.py: use TrainingSeqGMSK and BurstType enums

Change-Id: I8a3faceae4a8d9b57d86d42600db839da073dad6
---
M src/target/trx_toolkit/rand_burst_gen.py
1 file changed, 16 insertions(+), 56 deletions(-)

Approvals:
  laforge: Looks good to me, but someone else must approve
  osmith: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/target/trx_toolkit/rand_burst_gen.py b/src/target/trx_toolkit/rand_burst_gen.py
index 46c1e09..80ff3f2 100644
--- a/src/target/trx_toolkit/rand_burst_gen.py
+++ b/src/target/trx_toolkit/rand_burst_gen.py
@@ -28,50 +28,6 @@
 
 class RandBurstGen:
 
-	# GSM 05.02 Chapter 5.2.3 Normal Burst
-	nb_tsc_list = [
-		[
-			0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0,
-			0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1,
-		],
-		[
-			0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1,
-			1, 1, 0, 0, 0, 1, 0, 1, 1, 0, 1, 1, 1,
-		],
-		[
-			0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1,
-			0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0,
-		],
-		[
-			0, 1, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0,
-			1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 0,
-		],
-		[
-			0, 0, 0, 1, 1, 0, 1, 0, 1, 1, 1, 0, 0,
-			1, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 1,
-		],
-		[
-			0, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 0,
-			0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, 1, 0,
-		],
-		[
-			1, 0, 1, 0, 0, 1, 1, 1, 1, 1, 0, 1, 1,
-			0, 0, 0, 1, 0, 1, 0, 0, 1, 1, 1, 1, 1,
-		],
-		[
-			1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 1, 0,
-			0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0,
-		],
-	]
-
-	# GSM 05.02 Chapter 5.2.5 SCH training sequence
-	sb_tsc = [
-		1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 1, 0,
-		0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1,
-		0, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1,
-		0, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 1, 1,
-	]
-
 	# GSM 05.02 Chapter 5.2.6 Dummy Burst
 	db_bits = [
 		0, 0, 0,
@@ -87,15 +43,13 @@
 		0, 0, 0,
 	]
 
-	# GSM 05.02 Chapter 5.2.7 Access burst
-	ab_tsc = [
-		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,
-	]
+	# Pick a random TSC for a given burst type
+	def get_rand_tsc(self, bt):
+		tsc_list = filter(lambda seq: seq.bt == bt, list(TrainingSeqGMSK))
+		return random.choice(tsc_list)
 
 	# Generate a normal burst
-	def gen_nb(self, seq_idx = 0):
+	def gen_nb(self, tsc = None):
 		buf = []
 
 		# Tailing bits
@@ -109,7 +63,9 @@
 		buf.append(random.randint(0, 1))
 
 		# Training sequence
-		buf += self.nb_tsc_list[seq_idx]
+		if tsc is None:
+			tsc = self.get_rand_tsc(BurstType.NORMAL)
+		buf += tsc.seq
 
 		# Steal flag 2 / 2
 		buf.append(random.randint(0, 1))
@@ -128,7 +84,7 @@
 		return [0] * GSM_BURST_LEN
 
 	# Generate a synchronization burst
-	def gen_sb(self):
+	def gen_sb(self, tsc = None):
 		buf = []
 
 		# Tailing bits
@@ -139,7 +95,9 @@
 			buf.append(random.randint(0, 1))
 
 		# Training sequence
-		buf += self.sb_tsc
+		if tsc is None:
+			tsc = self.get_rand_tsc(BurstType.SYNC)
+		buf += tsc.seq
 
 		# Random data 2 / 2
 		for i in range(0, 39):
@@ -155,14 +113,16 @@
 		return self.db_bits
 
 	# Generate an access burst
-	def gen_ab(self):
+	def gen_ab(self, tsc = None):
 		buf = []
 
 		# Tailing bits
 		buf += [0] * 8
 
 		# Training sequence
-		buf += self.ab_tsc
+		if tsc is None:
+			tsc = self.get_rand_tsc(BurstType.ACCESS)
+		buf += tsc.seq
 
 		# Random data
 		for i in range(0, 36):

-- 
To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/14691
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Change-Id: I8a3faceae4a8d9b57d86d42600db839da073dad6
Gerrit-Change-Number: 14691
Gerrit-PatchSet: 2
Gerrit-Owner: fixeria <axilirator at gmail.com>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at gnumonks.org>
Gerrit-Reviewer: osmith <osmith at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190716/66d82e37/attachment.html>


More information about the gerrit-log mailing list