diff options
author | Holger Hans Peter Freyther <zecke@selfish.org> | 2013-01-12 21:44:48 +0100 |
---|---|---|
committer | Holger Hans Peter Freyther <zecke@selfish.org> | 2013-01-15 22:47:38 +0100 |
commit | 0903001d9b92d2bdc9cd275294299827bfe4e70d (patch) | |
tree | ac4d067a093cf08ec7abb2b02d68775d8451559d /contrib | |
parent | c2371cc0115ec8450324d0c687660a56b404dabd (diff) |
calibration: The clock error is absolute for anything but the netlisten
We only need to run this once and we know the clock error. In case it
is 0/0 we know that we didn't receive one of the two clocks. This could
be because the GPS doesn't have a fix. I accidently pushed this code into
the master branch and it is too late to rebase.
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/sysmobts-calib/sysmobts-calib.c | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/contrib/sysmobts-calib/sysmobts-calib.c b/contrib/sysmobts-calib/sysmobts-calib.c index 73385cdf..14bc36fd 100644 --- a/contrib/sysmobts-calib/sysmobts-calib.c +++ b/contrib/sysmobts-calib/sysmobts-calib.c @@ -274,6 +274,25 @@ static int scan_band() return 0; } +static int calib_get_clock_error(void) +{ + int rc, clkErr, clkErrRes; + + printf("Going to determine the clock offset.\n"); + + rc = rf_clock_info(&clkErr, &clkErrRes); + CHECK_RC_MSG(rc, "Clock info failed.\n"); + + if (clkErr == 0 && clkErrRes == 0) { + printf("Failed to get the clock info. Are both clocks present?\n"); + return -1; + } + + /* this is an absolute clock error */ + printf("The calibration value is: %d\n", clkErr); + return 0; +} + static int calib_clock_after_sync(void) { int rc, clkErr, clkErrRes, iteration, cor; @@ -380,9 +399,7 @@ static int calib_clock(void) 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"); + calib_get_clock_error(); return EXIT_SUCCESS; } |