aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Eversberg <jolly@eversberg.eu>2011-08-18 19:27:16 +0200
committerAndreas Eversberg <jolly@eversberg.eu>2011-10-03 13:01:00 +0200
commitaf1c0dd68b254d97b8d8693fdbbba77c1b09b4bf (patch)
tree9311ca2957c188400aa1141ae2ce5a04944ff531
parente9e0c48a157984e287913ac9e61aa6735822d621 (diff)
osmoBTS: Added option to define required clock source ARFCN
-rw-r--r--src/osmo-bts-bb/l1_if.c2
-rw-r--r--src/osmo-bts-bb/l1_if.h2
-rw-r--r--src/osmo-bts-bb/main.c22
3 files changed, 22 insertions, 4 deletions
diff --git a/src/osmo-bts-bb/l1_if.c b/src/osmo-bts-bb/l1_if.c
index 54f37628..7a6c0f3f 100644
--- a/src/osmo-bts-bb/l1_if.c
+++ b/src/osmo-bts-bb/l1_if.c
@@ -43,6 +43,8 @@
#include "l1_if.h"
+uint16_t ref_arfcn;
+
/* l1 confirms setup */
static int l1if_setup_conf(struct gsm_bts_trx *trx)
{
diff --git a/src/osmo-bts-bb/l1_if.h b/src/osmo-bts-bb/l1_if.h
index 786a51ae..77aa48f3 100644
--- a/src/osmo-bts-bb/l1_if.h
+++ b/src/osmo-bts-bb/l1_if.h
@@ -1,6 +1,8 @@
#ifndef _BB_L1_H
#define _BB_L1_H
+extern uint16_t ref_arfcn;
+
int l1if_setup(struct gsm_bts_trx *trx);
int l1if_open(void);
int l1if_close(void);
diff --git a/src/osmo-bts-bb/main.c b/src/osmo-bts-bb/main.c
index c93388e2..711e57eb 100644
--- a/src/osmo-bts-bb/main.c
+++ b/src/osmo-bts-bb/main.c
@@ -46,9 +46,10 @@
#include <string.h>
#include <time.h>
-char *debugs = "DL1C:DLAPDM:DABIS:DOML:DRSL:DSUM";
+char *debugs = "DL1C:DLLAPDM:DABIS:DOML:DRSL:DSUM";
int debug_set = 0;
int level_set = 0;
+int ref_set = 0;
static int daemonize = 0;
void *l23_ctx = NULL;
static struct gsm_bts *bts;
@@ -107,8 +108,9 @@ struct ipabis_link *link_init(struct gsm_bts *bts, uint32_t bsc_ip)
static void print_usage(const char *app)
{
- printf("Usage: %s [option]\n", app);
+ printf("Usage: %s -r <arfcn> [option]\n", app);
printf(" -h --help this text\n");
+ printf(" -r --ref-arfcn Set channel number of reference BTS for clocking\n");
printf(" -d --debug Change debug flags. (default %s)\n", debugs);
printf(" -s --disable-color Don't use colors in stderr log output\n");
printf(" -T --timestamp Prefix every log line with a timestamp\n");
@@ -130,6 +132,7 @@ static void handle_options(int argc, char **argv)
int option_index = 0, c;
static struct option long_options[] = {
{ "help", 0, 0, 'h' },
+ { "ref-arfcn", 1, 0, 'r' },
{ "debug", 1, 0, 'd' },
{ "disable-color", 0, 0, 's' },
{ "timestamp", 0, 0, 'T' },
@@ -139,7 +142,7 @@ static void handle_options(int argc, char **argv)
{0, 0, 0, 0},
};
- c = getopt_long(argc, argv, "hd:sTe:i:D",
+ c = getopt_long(argc, argv, "hr:d:sTe:i:D",
long_options, &option_index);
if (c == -1)
break;
@@ -148,6 +151,10 @@ static void handle_options(int argc, char **argv)
case 'h':
print_usage(argv[0]);
exit(0);
+ case 'r':
+ ref_arfcn = atoi(optarg);
+ ref_set = 1;
+ break;
case 'd':
log_parse_category_mask(osmo_stderr_target, optarg);
debug_set = 1;
@@ -179,7 +186,8 @@ void sighandler(int sigset)
if (sigset == SIGHUP || sigset == SIGPIPE)
return;
- fprintf(stderr, "Signal %d recevied.\n", sigset);
+ fprintf(stderr, "Signal %d recevied. Press ^C again to terminate "
+ "instantly.\n", sigset);
/* in case there is a lockup during exit */
signal(SIGINT, SIG_DFL);
@@ -227,6 +235,12 @@ int main(int argc, char **argv)
handle_options(argc, argv);
+ if (!ref_set) {
+ fprintf(stderr, "Error: ARFCN for reference clock not specified. Use '-h' for help.\n");
+ exit(1);
+ }
+ printf("Using ARFCN '%d' for clock reference.\n", ref_arfcn);
+
if (!debug_set)
log_parse_category_mask(osmo_stderr_target, debugs);
if (!level_set)