summaryrefslogtreecommitdiff
path: root/common/cmd_itest.c
diff options
context:
space:
mode:
authorStefano Babic <sbabic@denx.de>2015-10-30 14:52:51 +0100
committerStefano Babic <sbabic@denx.de>2015-10-30 14:52:51 +0100
commite573bdb324c78fac56655a493bea843842c9d9f8 (patch)
tree3933d354a6be71cbe66d583fec3f5b2479e596ee /common/cmd_itest.c
parenta69fdc7787bfa2f27eed74c2ee58c28ce932d502 (diff)
parent0eb4cf9c14315e1976a116de75da6f420ac0e8dd (diff)
downloadu-boot-imx-e573bdb324c78fac56655a493bea843842c9d9f8.zip
u-boot-imx-e573bdb324c78fac56655a493bea843842c9d9f8.tar.gz
u-boot-imx-e573bdb324c78fac56655a493bea843842c9d9f8.tar.bz2
Merge branch 'master' of git://git.denx.de/u-boot
Diffstat (limited to 'common/cmd_itest.c')
-rw-r--r--common/cmd_itest.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/common/cmd_itest.c b/common/cmd_itest.c
index 76af62b..596341c 100644
--- a/common/cmd_itest.c
+++ b/common/cmd_itest.c
@@ -15,6 +15,9 @@
#include <common.h>
#include <config.h>
#include <command.h>
+#include <mapmem.h>
+
+#include <asm/io.h>
#define EQ 0
#define NE 1
@@ -49,16 +52,24 @@ static const op_tbl_t op_table [] = {
static long evalexp(char *s, int w)
{
long l = 0;
- long *p;
+ unsigned long addr;
+ void *buf;
/* if the parameter starts with a * then assume is a pointer to the value we want */
if (s[0] == '*') {
- p = (long *)simple_strtoul(&s[1], NULL, 16);
+ addr = simple_strtoul(&s[1], NULL, 16);
+ buf = map_physmem(addr, w, MAP_WRBACK);
+ if (!buf) {
+ puts("Failed to map physical memory\n");
+ return 0;
+ }
switch (w) {
- case 1: return((long)(*(unsigned char *)p));
- case 2: return((long)(*(unsigned short *)p));
- case 4: return(*p);
+ case 1: l = (long)(*(unsigned char *)buf);
+ case 2: l = (long)(*(unsigned short *)buf);
+ case 4: l = (long)(*(unsigned long *)buf);
}
+ unmap_physmem(buf, w);
+ return l;
} else {
l = simple_strtoul(s, NULL, 16);
}