aboutsummaryrefslogtreecommitdiff
path: root/board/digsy_mtc
diff options
context:
space:
mode:
authorGrzegorz Bernacki2009-08-05 18:37:42 +0200
committerWolfgang Denk2009-08-09 22:59:27 +0200
commit5cc69084189bf49aa99d13d57515be72d1844bdf (patch)
tree22003717a493e93e7bea1d8ed99f81098f95274e /board/digsy_mtc
parent716655288a53c95fad203ebf21d0b8ffdc2f7525 (diff)
digsy_mtc: Add mtc state command.
Signed-off-by: Grzegorz Bernacki <gjb@semihalf.com>
Diffstat (limited to 'board/digsy_mtc')
-rw-r--r--board/digsy_mtc/cmd_mtc.c30
-rw-r--r--board/digsy_mtc/cmd_mtc.h1
2 files changed, 31 insertions, 0 deletions
diff --git a/board/digsy_mtc/cmd_mtc.c b/board/digsy_mtc/cmd_mtc.c
index 2ecb4f8c394..dc167719f48 100644
--- a/board/digsy_mtc/cmd_mtc.c
+++ b/board/digsy_mtc/cmd_mtc.c
@@ -246,6 +246,34 @@ static int do_mtc_version(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
return err;
}
+static int do_mtc_state(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
+{
+ tx_msp_cmd pcmd;
+ rx_msp_cmd prx;
+ int err = 0;
+
+ memset(&pcmd, 0, sizeof(pcmd));
+ memset(&prx, 0, sizeof(prx));
+
+ pcmd.cmd = CMD_WD_WDSTATE;
+ pcmd.cmd_val2 = 1;
+
+ mtc_calculate_checksum(&pcmd);
+ err = spi_xfer(NULL, MTC_TRANSFER_SIZE, &pcmd, &prx,
+ SPI_XFER_BEGIN | SPI_XFER_END);
+
+ if (!err) {
+ printf("State %02Xh\n", prx.state);
+ printf("Input %02Xh\n", prx.input);
+ printf("UserWD %02Xh\n", prx.ack2);
+ printf("Sys WD %02Xh\n", prx.ack3);
+ printf("WD Timout %02Xh\n", prx.ack0);
+ printf("eSysState %02Xh\n", prx.ack1);
+ }
+
+ return err;
+}
+
static int do_mtc_help(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
cmd_tbl_t cmd_mtc_sub[] = {
@@ -267,6 +295,8 @@ cmd_tbl_t cmd_mtc_sub[] = {
U_BOOT_CMD_MKENT(digout, 2, 1, do_mtc_digout,
"sets digital outputs",
"<on|off> <on|off>- set state of digital output 1 and 2\n"),
+ U_BOOT_CMD_MKENT(state, 0, 1, do_mtc_state,
+ "displays state\n", ""),
U_BOOT_CMD_MKENT(help, 4, 1, do_mtc_help, "get help",
"[command] - get help for command\n"),
};
diff --git a/board/digsy_mtc/cmd_mtc.h b/board/digsy_mtc/cmd_mtc.h
index db3aeed51cd..81714e34d31 100644
--- a/board/digsy_mtc/cmd_mtc.h
+++ b/board/digsy_mtc/cmd_mtc.h
@@ -27,6 +27,7 @@
#define CMD_MTC_H
#define CMD_WD_PARA 0x02
+#define CMD_WD_WDSTATE 0x04
#define CMD_FW_VERSION 0x10
#define CMD_GET_VIM 0x30
#define CMD_SET_LED 0x40