aboutsummaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2012-11-24 13:14:09 +0100
committerHarald Welte <laforge@gnumonks.org>2012-12-06 20:58:35 +0100
commit6e264ae3cdd5962182b66a07151d4bcf2f104e40 (patch)
treeefa70f2fb6e424a63afe6b05a409af8c2c9b0738 /utils
parent0357e9b37528911397ba019319065d206f067af0 (diff)
osmo-arfcn: add support for PCS band
Diffstat (limited to 'utils')
-rw-r--r--utils/osmo-arfcn.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/utils/osmo-arfcn.c b/utils/osmo-arfcn.c
index 15adbca2..b88db5af 100644
--- a/utils/osmo-arfcn.c
+++ b/utils/osmo-arfcn.c
@@ -34,9 +34,8 @@ enum program_mode {
MODE_F2A,
};
-static int arfcn2freq(char *arfcn_str)
+static int arfcn2freq(int arfcn)
{
- int arfcn = atoi(arfcn_str);
uint16_t freq10u, freq10d;
if (arfcn < 0 || arfcn > 0xffff) {
@@ -53,25 +52,30 @@ static int arfcn2freq(char *arfcn_str)
}
printf("ARFCN %4d: Uplink %4u.%1u MHz / Downlink %4u.%1u MHz\n",
- arfcn, freq10u/10, freq10u%10, freq10d/10, freq10d%10);
+ arfcn & ~ARFCN_FLAG_MASK,
+ freq10u/10, freq10u%10, freq10d/10, freq10d%10);
return 0;
}
static void help(const char *progname)
{
- printf("Usage: %s [-h] [-a arfcn] [-f freq] [-u|-d]\n",
+ printf("Usage: %s [-h] [-p] [-a arfcn] [-f freq] [-u|-d]\n",
progname);
}
int main(int argc, char **argv)
{
+ int arfcn, pcs = 0;
int opt;
char *param;
enum program_mode mode = MODE_NONE;
- while ((opt = getopt(argc, argv, "a:f:ud")) != -1) {
+ while ((opt = getopt(argc, argv, "pa:f:ud")) != -1) {
switch (opt) {
+ case 'p':
+ pcs = 1;
+ break;
case 'a':
mode = MODE_A2F;
param = optarg;
@@ -95,7 +99,10 @@ int main(int argc, char **argv)
exit(2);
break;
case MODE_A2F:
- arfcn2freq(param);
+ arfcn = atoi(param);
+ if (pcs)
+ arfcn |= ARFCN_PCS;
+ arfcn2freq(arfcn);
break;
}