From 354d17523f599746a84e5b22fa670c9910137947 Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Mon, 6 Jul 2015 00:08:33 +0300 Subject: modmachine: Implement physical memory access using /dev/mem (Linux, etc). This requires root access. And on recent Linux kernels, with CONFIG_STRICT_DEVMEM option enabled, only address ranges listed in /proc/iomem can be accessed. The above compiled-time option can be however overriden with boot-time option "iomem=relaxed". This also removed separate read/write paths - there unlikely would be a case when they're different. --- tests/extmod/machine_mem.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 tests/extmod/machine_mem.py (limited to 'tests/extmod/machine_mem.py') diff --git a/tests/extmod/machine_mem.py b/tests/extmod/machine_mem.py new file mode 100644 index 000000000..7d8a9ac01 --- /dev/null +++ b/tests/extmod/machine_mem.py @@ -0,0 +1,16 @@ +# This test requires root privilege, so is usually skipped +# It also assumes x86 legacy hardware (with Video BIOS present). + +try: + import machine +except ImportError: + print("SKIP") + import sys + sys.exit() + +try: + print(hex(machine.mem16[0xc0000])) +except OSError: + print("SKIP") + import sys + sys.exit() -- cgit v1.2.3