[PATCH 3/4] Make SI printing more flexible.

Max Max.Suraev at fairwaves.ru
Thu Aug 29 15:49:42 UTC 2013


---
 .../layer23/include/osmocom/bb/common/sysinfo.h    |  3 ++
 src/host/layer23/src/common/sysinfo.c              | 46 +++++++++++++---------
 2 files changed, 30 insertions(+), 19 deletions(-)

diff --git a/src/host/layer23/include/osmocom/bb/common/sysinfo.h b/src/host/layer23/include/osmocom/bb/common/sysinfo.h
index f843f27..f0af7ba 100644
--- a/src/host/layer23/include/osmocom/bb/common/sysinfo.h
+++ b/src/host/layer23/include/osmocom/bb/common/sysinfo.h
@@ -125,6 +125,9 @@ uint8_t gsm_refer_pcs(uint16_t arfcn, struct gsm48_sysinfo *s);
 int gsm48_sysinfo_dump(struct gsm48_sysinfo *s, uint16_t arfcn,
 	void (*print)(void *, const char *, ...), void *priv,
 	uint8_t *freq_map);
+int gsm48_sysinfo_dump_ext(struct gsm48_sysinfo *s, uint16_t arfcn,
+	void (*print)(void *, const char *, ...), void *priv,
+		       uint8_t *freq_map, uint8_t no_map, uint8_t print_stat);
 int gsm48_decode_lai(struct gsm48_loc_area_id *lai, uint16_t *mcc,
 	uint16_t *mnc, uint16_t *lac);
 int gsm48_decode_chan_h0(struct gsm48_chan_desc *cd, uint8_t *tsc,
diff --git a/src/host/layer23/src/common/sysinfo.c b/src/host/layer23/src/common/sysinfo.c
index b42bd65..3892d1b 100644
--- a/src/host/layer23/src/common/sysinfo.c
+++ b/src/host/layer23/src/common/sysinfo.c
@@ -68,40 +68,46 @@ uint8_t gsm_refer_pcs(uint16_t arfcn, struct gsm48_sysinfo *s)
 }
 
 int gsm48_sysinfo_dump(struct gsm48_sysinfo *s, uint16_t arfcn,
-	void (*print)(void *, const char *, ...), void *priv, uint8_t *freq_map)
+		       void (*print)(void *, const char *, ...), void *priv, uint8_t *freq_map)
+{
+    return gsm48_sysinfo_dump_ext(s, arfcn, print, priv, freq_map, 0, 1);
+}
+
+int gsm48_sysinfo_dump_ext(struct gsm48_sysinfo *s, uint16_t arfcn,
+			   void (*print)(void *, const char *, ...), void *priv, uint8_t *freq_map, uint8_t no_map, uint8_t print_stat)
 {
 	char buffer[81];
 	int i, j, k, index;
 	int refer_pcs = gsm_refer_pcs(arfcn, s);
 
-	/* available sysinfos */
-	print(priv, "ARFCN = %s  channels 512+ refer to %s\n",
-		gsm_print_arfcn(arfcn),
-		(refer_pcs) ? "PCS (1900)" : "DCS (1800)");
-	print(priv, "Available SYSTEM INFORMATIONS =");
-	if (s->si1)
+	if (print_stat) {/* available sysinfos */
+	    print(priv, "ARFCN = %s  channels 512+ refer to %s\n",
+		  gsm_print_arfcn(arfcn),
+		  (refer_pcs) ? "PCS (1900)" : "DCS (1800)");
+	    print(priv, "Available SYSTEM INFORMATIONS =");
+	    if (s->si1)
 		print(priv, " 1");
-	if (s->si2)
+	    if (s->si2)
 		print(priv, " 2");
-	if (s->si2bis)
+	    if (s->si2bis)
 		print(priv, " 2bis");
-	if (s->si2ter)
+	    if (s->si2ter)
 		print(priv, " 2ter");
-	if (s->si3)
+	    if (s->si3)
 		print(priv, " 3");
-	if (s->si4)
+	    if (s->si4)
 		print(priv, " 4");
-	if (s->si5)
+	    if (s->si5)
 		print(priv, " 5");
-	if (s->si5bis)
+	    if (s->si5bis)
 		print(priv, " 5bis");
-	if (s->si5ter)
+	    if (s->si5ter)
 		print(priv, " 5ter");
-	if (s->si6)
+	    if (s->si6)
 		print(priv, " 6");
-	print(priv, "\n");
-	print(priv, "\n");
-
+	    print(priv, "\n");
+	    print(priv, "\n");
+	}
 	/* frequency list */
 	j = 0; k = 0;
 	for (i = 0; i < 1024; i++) {
@@ -173,6 +179,8 @@ int gsm48_sysinfo_dump(struct gsm48_sysinfo *s, uint16_t arfcn,
 	}
 	print(priv, "\n");
 
+	if (no_map) return 0;
+
 	/* frequency map */
 	for (i = 0; i < 1024; i += 64) {
 		sprintf(buffer, " %3d ", i);
-- 
1.8.1.2


--------------000206000400030101050401
Content-Type: text/x-patch;
 name="0004-Add-filtering-and-additional-information-printing-to.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename*0="0004-Add-filtering-and-additional-information-printing-to.pa";
 filename*1="tch"



More information about the baseband-devel mailing list