From 7af9c8491ec2f4c8a5f6d9b3321d697b7b08b001 Mon Sep 17 00:00:00 2001 From: sithglan Date: Wed, 21 Mar 2007 12:20:27 +0000 Subject: [PATCH 1/1] += read registers from userland --- ethernet/userland/register.c | 46 ++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 ethernet/userland/register.c 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); +} -- 2.39.5