]> cvs.zerfleddert.de Git - raggedstone/commitdiff
+= read registers from userland
authorsithglan <sithglan>
Wed, 21 Mar 2007 12:20:27 +0000 (12:20 +0000)
committersithglan <sithglan>
Wed, 21 Mar 2007 12:20:27 +0000 (12:20 +0000)
ethernet/userland/register.c [new file with mode: 0644]

diff --git a/ethernet/userland/register.c b/ethernet/userland/register.c
new file mode 100644 (file)
index 0000000..4f98f72
--- /dev/null
@@ -0,0 +1,46 @@
+#include <stdio.h>
+#include <sys/io.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#define BASE 0xe800
+
+#define die(x) \
+{ \
+        char buf[BUFSIZ]; \
+                snprintf(buf, sizeof(buf), \
+                                "%s: %d: %s: %s", \
+                                __FILE__, (int) __LINE__, __FUNCTION__,  x); \
+                perror(buf); \
+                exit(EXIT_FAILURE); \
+}
+
+int
+main(void)
+{
+        int ret;
+        unsigned int word;
+
+        ret = ioperm(BASE,8,1);
+        if (ret < 0) {
+                die("ioperm");
+        }
+        word = inl(BASE);
+        printf("0x%08x\n", 0x0 | word);
+
+#if 0
+        outl(0x00, BASE);
+        outl(0xFFFFFFFF, BASE);
+
+        word = inl(BASE);
+        printf("0x%08x\n", 0x0 | word);
+#endif
+
+        ret = ioperm(BASE,8,0);
+        if (ret < 0) {
+                die("ioperm");
+        }
+
+        return(EXIT_SUCCESS);
+}
Impressum, Datenschutz