diff options
author | Luca Barbieri <luca@luca-barbieri.com> | 2010-03-28 17:42:11 +0200 |
---|---|---|
committer | Luca Barbieri <luca@luca-barbieri.com> | 2010-03-28 17:42:11 +0200 |
commit | 349120895c1a91ed50c973d08de33fdb8b386ce8 (patch) | |
tree | e860b0f74bba8e40e5e56fdfc7e9de567de35c4d | |
parent | e41b282580ee90b44a2ed34a0aca6772dea63c98 (diff) |
add dump and dump-nonzero
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | dump-nonzero.cpp | 18 | ||||
-rw-r--r-- | dump.cpp | 23 |
3 files changed, 42 insertions, 1 deletions
@@ -1,6 +1,6 @@ CXXFLAGS = -g -O0 -Wall -fmessage-length=0 -fno-inline-functions -fno-inline LIBS = -lpciaccess -TARGETS = nvexec_raw ramfc fifos ramht pgraph peek poke +TARGETS = nvexec_raw ramfc fifos ramht pgraph peek poke dump dump-nonzero all: $(TARGETS) diff --git a/dump-nonzero.cpp b/dump-nonzero.cpp new file mode 100644 index 0000000..077b6eb --- /dev/null +++ b/dump-nonzero.cpp @@ -0,0 +1,18 @@ +#include "nvlib.h" + +int main(int argc, char** argv) +{ + std::auto_ptr<nv_device> dev; + dev.reset(nv_device::open_default()); + + unsigned base = strtoul(argv[1], 0, 0); + unsigned size = strtoul(argv[2], 0, 0); + for(unsigned i = 0; i < size; i += 4) { + unsigned v = dev->rd32(base + i); + if(v) + printf("%08x: %08x\n", base + i, v); + } + + return 0; +} + diff --git a/dump.cpp b/dump.cpp new file mode 100644 index 0000000..ccbb349 --- /dev/null +++ b/dump.cpp @@ -0,0 +1,23 @@ +#include "nvlib.h" + +int main(int argc, char** argv) +{ + std::auto_ptr<nv_device> dev; + dev.reset(nv_device::open_default()); + + unsigned base = strtoul(argv[1], 0, 0); + unsigned size = strtoul(argv[2], 0, 0); + for(unsigned i = 0; i < size; i += 4) { + if(!(i & 15)) { + if(i) + printf("\n"); + printf("%08x:", base + i); + } + printf(" %08x", dev->rd32(base + i)); + } + if(size) + printf("\n"); + + return 0; +} + |