[Suzaku-en:00058] Re: FPGA registers

Yasushi SHOJI email@hidden
Fri Oct 14 12:40:11 JST 2005


At Thu, 13 Oct 2005 09:38:24 -0400,
Ford Sleeman wrote:
> 
> Hi everybody,
> 
> I have been trying to access registers in an IP core on the Suzaku-V 
> board but have been unsuccessful. Has anybody done this before? If so, 
> could somebody send me some sample C code of how to read and write to 
> these registers?

ok, here is a simple way to _read_ gpio on sv. the gpio it's reading
is connected to the boot mode select jumper (JP2).  so the value
should change if you open/close the jumper.

if you need to expose it to userland, you need to create char dev for
it.

i'm attaching a patch against suzaku6 tarball.  apply it and select
simple test driver in char driver section in menuconfig.

regards,
--
        yashi


 linux-2.4.x/drivers/char/Config.in |    2 ++
 linux-2.4.x/drivers/char/Makefile  |    2 ++
 linux-2.4.x/drivers/char/simple.c  |   20 ++++++++++++++++++++
 3 files changed, 24 insertions(+)

Index: uClinux-dist-20040408-suzaku6/linux-2.4.x/drivers/char/Config.in
===================================================================
--- uClinux-dist-20040408-suzaku6.orig/linux-2.4.x/drivers/char/Config.in	2005-03-19 10:57:57.000000000 +0900
+++ uClinux-dist-20040408-suzaku6/linux-2.4.x/drivers/char/Config.in	2005-10-14 11:51:28.000000000 +0900
@@ -4,6 +4,8 @@
 mainmenu_option next_comment
 comment 'Character devices'
 
+tristate 'Simple test driver' CONFIG_SIMPLE
+
 #############################################################################
 #
 # uClinux options
Index: uClinux-dist-20040408-suzaku6/linux-2.4.x/drivers/char/Makefile
===================================================================
--- uClinux-dist-20040408-suzaku6.orig/linux-2.4.x/drivers/char/Makefile	2005-03-19 10:57:57.000000000 +0900
+++ uClinux-dist-20040408-suzaku6/linux-2.4.x/drivers/char/Makefile	2005-10-14 11:50:51.000000000 +0900
@@ -446,6 +446,8 @@ ifeq ($(CONFIG_IPMI_HANDLER),y)
   obj-y += ipmi/ipmi.o
 endif
 
+obj-$(CONFIG_SIMPLE) += simple.o
+
 include $(TOPDIR)/Rules.make
 
 fastdep:
Index: uClinux-dist-20040408-suzaku6/linux-2.4.x/drivers/char/simple.c
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ uClinux-dist-20040408-suzaku6/linux-2.4.x/drivers/char/simple.c	2005-10-14 12:32:27.000000000 +0900
@@ -0,0 +1,20 @@
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <asm/io.h>
+
+static int simple_init(void)
+{
+	unsigned int *p;
+	p = ioremap(0xf0ffa000, 0x4);
+	if (!p)
+		return -ENOMEM;
+
+	printk("**** register: %#x\n", readl(p));
+	iounmap(p);
+}
+module_init(simple_init);
+
+static void simple_exit(void)
+{
+}
+module_exit(simple_exit);



More information about the suzaku-en mailing list