aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/sysmobts-calib/sysmobts-calib.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/sysmobts-calib/sysmobts-calib.c')
-rw-r--r--contrib/sysmobts-calib/sysmobts-calib.c53
1 files changed, 49 insertions, 4 deletions
diff --git a/contrib/sysmobts-calib/sysmobts-calib.c b/contrib/sysmobts-calib/sysmobts-calib.c
index 14bc36f..053032d 100644
--- a/contrib/sysmobts-calib/sysmobts-calib.c
+++ b/contrib/sysmobts-calib/sysmobts-calib.c
@@ -33,6 +33,8 @@
#include <sysmocom/femtobts/superfemto.h>
#include <sysmocom/femtobts/gsml1types.h>
+#include <osmocom/gsm/gsm_utils.h>
+
#include <osmocom/core/utils.h>
#include "sysmobts-layer1.h"
@@ -41,12 +43,14 @@ enum actions {
ACTION_SCAN,
ACTION_CALIB,
ACTION_BCCH,
+ ACTION_BCCH_CCCH,
};
static const char *modes[] = {
[ACTION_SCAN] = "scan",
[ACTION_CALIB] = "calibrate",
[ACTION_BCCH] = "bcch",
+ [ACTION_BCCH_CCCH] = "bcch_ccch",
};
static const char *bands[] = {
@@ -80,6 +84,32 @@ static const char *clk_source[] = {
[SuperFemto_ClkSrcId_NetList] = "netlisten",
};
+static const struct value_string sapi_names[GsmL1_Sapi_NUM+1] = {
+ { GsmL1_Sapi_Fcch, "FCCH" },
+ { GsmL1_Sapi_Sch, "SCH" },
+ { GsmL1_Sapi_Sacch, "SACCH" },
+ { GsmL1_Sapi_Sdcch, "SDCCH" },
+ { GsmL1_Sapi_Bcch, "BCCH" },
+ { GsmL1_Sapi_Pch, "PCH" },
+ { GsmL1_Sapi_Agch, "AGCH" },
+ { GsmL1_Sapi_Cbch, "CBCH" },
+ { GsmL1_Sapi_Rach, "RACH" },
+ { GsmL1_Sapi_TchF, "TCH/F" },
+ { GsmL1_Sapi_FacchF, "FACCH/F" },
+ { GsmL1_Sapi_TchH, "TCH/H" },
+ { GsmL1_Sapi_FacchH, "FACCH/H" },
+ { GsmL1_Sapi_Nch, "NCH" },
+ { GsmL1_Sapi_Pdtch, "PDTCH" },
+ { GsmL1_Sapi_Pacch, "PACCH" },
+ { GsmL1_Sapi_Pbcch, "PBCCH" },
+ { GsmL1_Sapi_Pagch, "PAGCH" },
+ { GsmL1_Sapi_Ppch, "PPCH" },
+ { GsmL1_Sapi_Pnch, "PNCH" },
+ { GsmL1_Sapi_Ptcch, "PTCCH" },
+ { GsmL1_Sapi_Prach, "PRACH" },
+ { 0, NULL }
+};
+
static int action = ACTION_SCAN;
static int band = GsmL1_FreqBand_900;
static int calib = SuperFemto_ClkSrcId_Ocxo;
@@ -102,7 +132,7 @@ static void print_help(void)
printf(" -s --calibration-source "
"ocxo|tcxo|external|gps|trx|rx|edge|netlisten\n");
printf(" -b --band 850|900|1800|1900\n");
- printf(" -m --mode scan|calibrate|bcch\n");
+ printf(" -m --mode scan|calibrate|bcch|bcch_ccch\n");
printf(" -a --arfcn NR arfcn for calibration\n");
printf(" -d --dsp-flags NR dsp mask for debug log\n");
printf(" -t --threshold level\n");
@@ -432,16 +462,31 @@ static int bcch_follow(void)
rc = follow_bcch(layer1);
CHECK_RC_MSG(rc, "Follow BCCH");
+ /* follow the pch */
+ if (action == ACTION_BCCH_CCCH) {
+ rc = follow_pch(layer1);
+ CHECK_RC_MSG(rc, "Follow BCCH/CCCH");
+ }
+
/* now wait for the PhDataInd */
for (;;) {
+ uint32_t fn;
+ uint8_t block;
uint8_t data[23];
size_t size;
+ struct gsm_time gsmtime;
+ GsmL1_Sapi_t sapi;
- rc = wait_for_data(data, &size);
+ rc = wait_for_data(data, &size, &fn, &block, &sapi);
if (rc == 1)
continue;
CHECK_RC_MSG(rc, "No Data Indication");
- printf("Data: %s\n", osmo_hexdump(data, size));
+
+ gsm_fn2gsmtime(&gsmtime, fn);
+ printf("%02u/%02u/%02u %6s %s\n",
+ gsmtime.t1, gsmtime.t2, gsmtime.t3,
+ get_value_string(sapi_names, sapi),
+ osmo_hexdump(data, size));
}
rc = mph_close(layer1);
@@ -470,7 +515,7 @@ int main(int argc, char **argv)
if (action == ACTION_SCAN)
return scan_band();
- else if (action == ACTION_BCCH)
+ else if (action == ACTION_BCCH || action == ACTION_BCCH_CCCH)
return bcch_follow();
else {
if (source == SuperFemto_ClkSrcId_NetList)