From: sithglan Date: Wed, 21 Mar 2007 12:20:27 +0000 (+0000) Subject: += read registers from userland X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/raggedstone/commitdiff_plain/7af9c8491ec2f4c8a5f6d9b3321d697b7b08b001?ds=inline += read registers from userland --- diff --git a/ethernet/userland/register.c b/ethernet/userland/register.c new file mode 100644 index 0000000..4f98f72 --- /dev/null +++ b/ethernet/userland/register.c @@ -0,0 +1,46 @@ +#include +#include +#include +#include +#include + +#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); +}