aboutsummaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2013-01-12 21:44:48 +0100
committerHolger Hans Peter Freyther <zecke@selfish.org>2013-01-12 21:44:48 +0100
commitfad5b0862514ab4ef6d13fe0d5e4b39a2983e13c (patch)
treeaeffc621e27297327b288831a827e8862f72c4fe /contrib
parent24b2128e2975f14f9941caa156890480005df81e (diff)
WIP... use gps for calibration..
Diffstat (limited to 'contrib')
-rw-r--r--contrib/sysmobts-calib/sysmobts-calib.c32
-rw-r--r--contrib/sysmobts-calib/sysmobts-layer1.c2
-rw-r--r--contrib/sysmobts-calib/sysmobts-layer1.h2
3 files changed, 27 insertions, 9 deletions
diff --git a/contrib/sysmobts-calib/sysmobts-calib.c b/contrib/sysmobts-calib/sysmobts-calib.c
index b9605dbb..73385cdf 100644
--- a/contrib/sysmobts-calib/sysmobts-calib.c
+++ b/contrib/sysmobts-calib/sysmobts-calib.c
@@ -1,7 +1,7 @@
/* OCXO/TCXO based calibration utility */
/*
- * (C) 2012 Holger Hans Peter Freyther
+ * (C) 2012-2013 Holger Hans Peter Freyther
*
* All Rights Reserved
*
@@ -194,7 +194,7 @@ static void handle_options(int argc, char **argv)
exit(-4);
}
- if (action == ACTION_CALIB) {
+ if (action == ACTION_CALIB && source == SuperFemto_ClkSrcId_NetList) {
if (cal_arfcn == 0) {
printf("Please specify the reference ARFCN.\n");
exit(-5);
@@ -274,7 +274,7 @@ static int scan_band()
return 0;
}
-static int calib_clock_after_sync(HANDLE *layer1)
+static int calib_clock_after_sync(void)
{
int rc, clkErr, clkErrRes, iteration, cor;
@@ -289,7 +289,7 @@ static int calib_clock_after_sync(HANDLE *layer1)
else
printf("Iteration %d with correction: %d\n", iteration, cor);
- rc = rf_clock_info(layer1, &clkErr, &clkErrRes);
+ rc = rf_clock_info(&clkErr, &clkErrRes);
CHECK_RC_MSG(rc, "Clock info failed.\n");
/*
@@ -343,7 +343,7 @@ static int find_initial_clock(HANDLE layer1, int *clock)
return 0;
}
-static int calib_clock(void)
+static int calib_clock_netlisten(void)
{
int rc, cor = initial_cor;
float mean_rssi;
@@ -364,7 +364,7 @@ static int calib_clock(void)
rc = set_clock_cor(cor, calib, source);
CHECK_RC_MSG(rc, "Clock setup failed.");
- calib_clock_after_sync(&layer1);
+ calib_clock_after_sync();
rc = mph_close(layer1);
CHECK_RC_MSG(rc, "MPH-Close");
@@ -372,6 +372,21 @@ static int calib_clock(void)
return EXIT_SUCCESS;
}
+static int calib_clock(void)
+{
+ int rc;
+
+ /* now try to calibrate it */
+ rc = set_clock_cor(initial_cor, calib, source);
+ CHECK_RC_MSG(rc, "Clock setup failed.");
+
+ calib_clock_after_sync();
+
+ CHECK_RC_MSG(rc, "MPH-Close");
+
+ return EXIT_SUCCESS;
+}
+
static int bcch_follow(void)
{
int rc, cor = initial_cor;
@@ -440,8 +455,11 @@ int main(int argc, char **argv)
return scan_band();
else if (action == ACTION_BCCH)
return bcch_follow();
- else
+ else {
+ if (source == SuperFemto_ClkSrcId_NetList)
+ return calib_clock_netlisten();
return calib_clock();
+ }
return EXIT_SUCCESS;
}
diff --git a/contrib/sysmobts-calib/sysmobts-layer1.c b/contrib/sysmobts-calib/sysmobts-layer1.c
index 8c04c77a..18b946fc 100644
--- a/contrib/sysmobts-calib/sysmobts-layer1.c
+++ b/contrib/sysmobts-calib/sysmobts-layer1.c
@@ -603,7 +603,7 @@ int set_clock_cor(int clock_cor, int calib, int source)
return 0;
}
-int rf_clock_info(HANDLE *layer1, int *clkErr, int *clkErrRes)
+int rf_clock_info(int *clkErr, int *clkErrRes)
{
SuperFemto_Prim_t prim;
memset(&prim, 0, sizeof(prim));
diff --git a/contrib/sysmobts-calib/sysmobts-layer1.h b/contrib/sysmobts-calib/sysmobts-layer1.h
index 1e0968a8..aeef354d 100644
--- a/contrib/sysmobts-calib/sysmobts-layer1.h
+++ b/contrib/sysmobts-calib/sysmobts-layer1.h
@@ -35,7 +35,7 @@ extern int follow_bch(HANDLE layer1);
extern int find_bsic(void);
extern int set_tsc_from_bsic(HANDLE layer1, int bsic);
extern int set_clock_cor(int clock_corr, int calib, int source);
-extern int rf_clock_info(HANDLE *layer1, int *clkErr, int *clkErrRes);
+extern int rf_clock_info(int *clkErr, int *clkErrRes);
extern int mph_close(HANDLE layer1);
extern int wait_for_sync(HANDLE layer1, int cor, int calib, int source);
extern int follow_bcch(HANDLE layer1);