summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2012-02-29 02:11:06 +0100
committerHarald Welte <laforge@gnumonks.org>2012-02-29 02:11:06 +0100
commit67877f16923485f0b4e3c28bd2e856904db78fb6 (patch)
treeece3bbc4a5205c029bb05c77981bd439a00c017e
parentc8ac848695acb2a11c8d17d35bcb5b0064764e15 (diff)
improve commandline readability (prompt) and more tuner commands
-rw-r--r--firmware/sdr-test-project/main.c42
-rw-r--r--firmware/src/uart_cmd.c4
2 files changed, 44 insertions, 2 deletions
diff --git a/firmware/sdr-test-project/main.c b/firmware/sdr-test-project/main.c
index ed77b6d..a30b943 100644
--- a/firmware/sdr-test-project/main.c
+++ b/firmware/sdr-test-project/main.c
@@ -249,6 +249,40 @@ static int cmd_si570_dump(struct cmd_state *cs, enum cmd_op op,
return 0;
}
+static int cmd_flt_bw(struct cmd_state *cs, enum cmd_op op,
+ const char *cmd, int argc, char **argv)
+{
+ enum e4k_if_filter filt;
+ int bw, rc;
+
+ if (!strcmp(cmd, "tuner.flt_bw_mix"))
+ filt = E4K_IF_FILTER_MIX;
+ else if (!strcmp(cmd, "tuner.flt_bw_chan"))
+ filt = E4K_IF_FILTER_CHAN;
+ else if (!strcmp(cmd, "tuner.flt_bw_rc"))
+ filt = E4K_IF_FILTER_RC;
+ else
+ return -EINVAL;
+
+ switch (op) {
+ case CMD_OP_GET:
+ bw = e4k_if_filter_bw_get(&e4k, filt);
+ uart_cmd_out(cs, "%s:%d\n\r", cmd, bw);
+ break;
+ case CMD_OP_SET:
+ if (argc < 1)
+ return -EINVAL;
+ rc = e4k_if_filter_bw_set(&e4k, filt, atoi(argv[0]));
+ if (rc < 0)
+ return -EINVAL;
+ break;
+ default:
+ return -EINVAL;
+ }
+
+ return 0;
+}
+
static struct cmd cmds[] = {
{ "tuner.init", CMD_OP_EXEC, cmd_tuner_init,
"Initialize the tuner" },
@@ -256,6 +290,12 @@ static struct cmd cmds[] = {
"Tune to the specified frequency" },
{ "tuner.gain", CMD_OP_SET|CMD_OP_GET, cmd_tuner_gain,
"Tune to the specified gain" },
+ { "tuner.flt_bw_mix", CMD_OP_SET|CMD_OP_GET, cmd_flt_bw,
+ "Filter bandwidth (Mixer)" },
+ { "tuner.flt_bw_chan", CMD_OP_SET|CMD_OP_GET, cmd_flt_bw,
+ "Filter bandwidth (Channel)" },
+ { "tuner.flt_bw_rc", CMD_OP_SET|CMD_OP_GET, cmd_flt_bw,
+ "Filter bandwidth (RC)" },
{ "si570.freq", CMD_OP_SET|CMD_OP_GET, cmd_si570_freq,
"Change the SI570 clock frequency" },
@@ -344,7 +384,7 @@ int main(void)
key = DBGU_GetChar();
// Process user input
if (uart_cmd_char(&cmd_state, key) == 1) {
- ssc_stats();
+ //ssc_stats();
}
}
diff --git a/firmware/src/uart_cmd.c b/firmware/src/uart_cmd.c
index 2e58b94..e45d051 100644
--- a/firmware/src/uart_cmd.c
+++ b/firmware/src/uart_cmd.c
@@ -107,7 +107,7 @@ static void print_list(struct cmd_state *cs)
if (c->help)
help = c->help;
- uart_cmd_out(cs, "%s %s\n\r", c->cmd, c->help);
+ uart_cmd_out(cs, "%s -- %s\n\r", c->cmd, c->help);
}
}
@@ -188,5 +188,7 @@ int uart_cmd_reset(struct cmd_state *cs)
strbuf_reset(&cs->arg);
cs->state = ST_IN_CMD;
+ uart_cmd_out(cs, "\r\n > ");
+
return 0;
}