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

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

fixeria gerrit-no-reply at lists.osmocom.org
Mon Jul 8 03:42:55 UTC 2019


fixeria has uploaded this change for review. ( 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(-)



  git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/91/14691/1

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: 1
Gerrit-Owner: fixeria <axilirator at gmail.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190708/04e17da0/attachment.htm>


More information about the gerrit-log mailing list