[Armadeus-commitlog] armadeus branch, master, updated. release-3.4-127-ge182208
Brought to you by:
sszy
|
From: Fabien M <fa...@us...> - 2011-05-12 09:03:53
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "armadeus".
The branch, master has been updated
via e1822083461afa622a4c03887084095a80576c5b (commit)
from 499042ffeda3181646cdad4d108fc9a100c0b8e2 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit e1822083461afa622a4c03887084095a80576c5b
Author: Fabien Marteau <fab...@ar...>
Date: Thu May 12 11:02:51 2011 +0200
[firmware] Adding wishbone example for apf51
-----------------------------------------------------------------------
Summary of changes:
firmware/wishbone_example/wishbone_example51.pod | 14 +
.../binaries/top_wishbone_example51_lx9.bin | Bin 0 -> 340604 bytes
.../components/button00/button00.xml | 53 ++
.../components/button00/doc/README | 1 +
.../button00/drivers_templates/armadeus/Makefile | 37 ++
.../drivers_templates/armadeus/board_buttons.c | 92 ++++
.../button00/drivers_templates/armadeus/button.c | 226 ++++++++
.../button00/drivers_templates/armadeus/button.h | 99 ++++
.../drivers_templates/armadeus}/button_specific.h | 0
.../button00/drivers_templates/armadeus/gbutton.c | 360 +++++++++++++
.../drivers_templates/armadeus/testbutton.c | 90 ++++
.../components/button00/hdl/button.vhd | 98 ++++
.../components/imx51_wb16_wrapper00/doc/README | 15 +
.../hdl/imx51_wb16_wrapper.vhd | 87 ++++
.../imx51_wb16_wrapper00/imx51_wb16_wrapper00.xml | 102 ++++
.../hdl/imx51_wb16_wrapper00_mwb16_intercon.vhd | 168 ++++++
.../imx51_wb16_wrapper00_mwb16_intercon.xml | 83 +++
.../components/irq_mngr00/doc/README | 1 +
.../irq_mngr00/drivers_templates/armadeus/Makefile | 35 ++
.../irq_mngr00/drivers_templates/armadeus}/README | 0
.../irq_mngr00/drivers_templates/armadeus/main.c | 272 ++++++++++
.../irq_mngr00/drivers_templates/armadeus/test.c | 81 +++
.../components/irq_mngr00/hdl/irq_mngr.vhd | 154 ++++++
.../components/irq_mngr00/irq_mngr00.xml | 63 +++
.../wishbone_example51/components/led00/doc/README | 1 +
.../led00/drivers_templates/armadeus/Makefile | 36 ++
.../led00/drivers_templates/armadeus/board_leds.c | 87 ++++
.../led00/drivers_templates/armadeus/g_led.c | 354 +++++++++++++
.../led00/drivers_templates/armadeus/led.h | 98 ++++
.../led00/drivers_templates/armadeus/testled.c | 132 +++++
.../components/led00/hdl/led.vhd | 86 +++
.../wishbone_example51/components/led00/led00.xml | 52 ++
.../wishbone_example51/components/led00/wb8.xml | 48 ++
.../components/rstgen_syscon00/doc/README | 1 +
.../rstgen_syscon00/hdl/rstgen_syscon.vhd | 61 +++
.../components/rstgen_syscon00/rstgen_syscon00.xml | 32 ++
.../simulation/apf51_test_pkg.vhd | 150 ++++++
.../wishbone_example51/synthesis/button/button.vhd | 98 ++++
.../imx51_wb16_wrapper/imx51_wb16_wrapper.vhd | 87 ++++
.../imx51_wb16_wrapper00_mwb16_intercon.vhd | 168 ++++++
.../synthesis/irq_mngr/irq_mngr.vhd | 154 ++++++
.../wishbone_example51/synthesis/led/led.vhd | 86 +++
.../synthesis/rstgen_syscon/rstgen_syscon.vhd | 61 +++
.../wishbone_example51/synthesis/synthesis.xml | 7 +
.../synthesis/top_wishbone_example51.vhd | 545 ++++++++++++++++++++
.../synthesis/wishbone_example51.tcl | 23 +
.../synthesis/wishbone_example51.ucf | 27 +
.../wishbone_example51/wishbone_example51.xml | 132 +++++
.../{ => wishbone_example9328_27}/Makefile | 0
.../{ => wishbone_example9328_27}/README | 0
.../bin/wishbone_example_apf27_200k.bit | Bin 149603 -> 149603 bytes
.../bin/wishbone_example_apf9328_200k.bit | Bin 131038 -> 131038 bytes
.../{ => wishbone_example9328_27}/intercon.odg | Bin 14278 -> 14278 bytes
.../{ => wishbone_example9328_27}/src/button.vhd | 0
.../{ => wishbone_example9328_27}/src/intercon.vhd | 0
.../{ => wishbone_example9328_27}/src/irq_mngr.vhd | 0
.../{ => wishbone_example9328_27}/src/led.vhd | 0
.../src/rstgen_syscon.vhd | 0
.../src/top_wishbone_example.vhd | 0
.../src/wishbone_example_apf27.ucf | 0
.../src/wishbone_example_apf9328.ucf | 0
.../src/wishbone_wrapper.vhd | 0
.../testbench/apf_test_pkg.vhd | 0
.../testbench/top_wishbone_example_tb.vhd | 0
.../{ => wishbone_example9328_27}/wb_buttonled.odg | Bin 13989 -> 13989 bytes
65 files changed, 4657 insertions(+), 0 deletions(-)
create mode 100644 firmware/wishbone_example/wishbone_example51.pod
create mode 100644 firmware/wishbone_example/wishbone_example51/binaries/top_wishbone_example51_lx9.bin
create mode 100644 firmware/wishbone_example/wishbone_example51/components/button00/button00.xml
create mode 100644 firmware/wishbone_example/wishbone_example51/components/button00/doc/README
create mode 100644 firmware/wishbone_example/wishbone_example51/components/button00/drivers_templates/armadeus/Makefile
create mode 100644 firmware/wishbone_example/wishbone_example51/components/button00/drivers_templates/armadeus/board_buttons.c
create mode 100644 firmware/wishbone_example/wishbone_example51/components/button00/drivers_templates/armadeus/button.c
create mode 100644 firmware/wishbone_example/wishbone_example51/components/button00/drivers_templates/armadeus/button.h
copy {target/linux/modules/fpga/wishbone_example/wb_button => firmware/wishbone_example/wishbone_example51/components/button00/drivers_templates/armadeus}/button_specific.h (100%)
create mode 100644 firmware/wishbone_example/wishbone_example51/components/button00/drivers_templates/armadeus/gbutton.c
create mode 100644 firmware/wishbone_example/wishbone_example51/components/button00/drivers_templates/armadeus/testbutton.c
create mode 100644 firmware/wishbone_example/wishbone_example51/components/button00/hdl/button.vhd
create mode 100644 firmware/wishbone_example/wishbone_example51/components/imx51_wb16_wrapper00/doc/README
create mode 100644 firmware/wishbone_example/wishbone_example51/components/imx51_wb16_wrapper00/hdl/imx51_wb16_wrapper.vhd
create mode 100644 firmware/wishbone_example/wishbone_example51/components/imx51_wb16_wrapper00/imx51_wb16_wrapper00.xml
create mode 100644 firmware/wishbone_example/wishbone_example51/components/imx51_wb16_wrapper00_mwb16_intercon/hdl/imx51_wb16_wrapper00_mwb16_intercon.vhd
create mode 100644 firmware/wishbone_example/wishbone_example51/components/imx51_wb16_wrapper00_mwb16_intercon/imx51_wb16_wrapper00_mwb16_intercon.xml
create mode 100644 firmware/wishbone_example/wishbone_example51/components/irq_mngr00/doc/README
create mode 100644 firmware/wishbone_example/wishbone_example51/components/irq_mngr00/drivers_templates/armadeus/Makefile
copy {target/linux/modules/fpga/wishbone_example/wb_irq_mngr => firmware/wishbone_example/wishbone_example51/components/irq_mngr00/drivers_templates/armadeus}/README (100%)
create mode 100644 firmware/wishbone_example/wishbone_example51/components/irq_mngr00/drivers_templates/armadeus/main.c
create mode 100644 firmware/wishbone_example/wishbone_example51/components/irq_mngr00/drivers_templates/armadeus/test.c
create mode 100644 firmware/wishbone_example/wishbone_example51/components/irq_mngr00/hdl/irq_mngr.vhd
create mode 100644 firmware/wishbone_example/wishbone_example51/components/irq_mngr00/irq_mngr00.xml
create mode 100644 firmware/wishbone_example/wishbone_example51/components/led00/doc/README
create mode 100644 firmware/wishbone_example/wishbone_example51/components/led00/drivers_templates/armadeus/Makefile
create mode 100644 firmware/wishbone_example/wishbone_example51/components/led00/drivers_templates/armadeus/board_leds.c
create mode 100644 firmware/wishbone_example/wishbone_example51/components/led00/drivers_templates/armadeus/g_led.c
create mode 100644 firmware/wishbone_example/wishbone_example51/components/led00/drivers_templates/armadeus/led.h
create mode 100644 firmware/wishbone_example/wishbone_example51/components/led00/drivers_templates/armadeus/testled.c
create mode 100644 firmware/wishbone_example/wishbone_example51/components/led00/hdl/led.vhd
create mode 100644 firmware/wishbone_example/wishbone_example51/components/led00/led00.xml
create mode 100644 firmware/wishbone_example/wishbone_example51/components/led00/wb8.xml
create mode 100644 firmware/wishbone_example/wishbone_example51/components/rstgen_syscon00/doc/README
create mode 100644 firmware/wishbone_example/wishbone_example51/components/rstgen_syscon00/hdl/rstgen_syscon.vhd
create mode 100644 firmware/wishbone_example/wishbone_example51/components/rstgen_syscon00/rstgen_syscon00.xml
create mode 100644 firmware/wishbone_example/wishbone_example51/simulation/apf51_test_pkg.vhd
create mode 100644 firmware/wishbone_example/wishbone_example51/synthesis/button/button.vhd
create mode 100644 firmware/wishbone_example/wishbone_example51/synthesis/imx51_wb16_wrapper/imx51_wb16_wrapper.vhd
create mode 100644 firmware/wishbone_example/wishbone_example51/synthesis/imx51_wb16_wrapper00_mwb16/imx51_wb16_wrapper00_mwb16_intercon.vhd
create mode 100644 firmware/wishbone_example/wishbone_example51/synthesis/irq_mngr/irq_mngr.vhd
create mode 100644 firmware/wishbone_example/wishbone_example51/synthesis/led/led.vhd
create mode 100644 firmware/wishbone_example/wishbone_example51/synthesis/rstgen_syscon/rstgen_syscon.vhd
create mode 100644 firmware/wishbone_example/wishbone_example51/synthesis/synthesis.xml
create mode 100644 firmware/wishbone_example/wishbone_example51/synthesis/top_wishbone_example51.vhd
create mode 100644 firmware/wishbone_example/wishbone_example51/synthesis/wishbone_example51.tcl
create mode 100644 firmware/wishbone_example/wishbone_example51/synthesis/wishbone_example51.ucf
create mode 100644 firmware/wishbone_example/wishbone_example51/wishbone_example51.xml
rename firmware/wishbone_example/{ => wishbone_example9328_27}/Makefile (100%)
rename firmware/wishbone_example/{ => wishbone_example9328_27}/README (100%)
rename firmware/wishbone_example/{ => wishbone_example9328_27}/bin/wishbone_example_apf27_200k.bit (100%)
rename firmware/wishbone_example/{ => wishbone_example9328_27}/bin/wishbone_example_apf9328_200k.bit (100%)
rename firmware/wishbone_example/{ => wishbone_example9328_27}/intercon.odg (100%)
rename firmware/wishbone_example/{ => wishbone_example9328_27}/src/button.vhd (100%)
rename firmware/wishbone_example/{ => wishbone_example9328_27}/src/intercon.vhd (100%)
rename firmware/wishbone_example/{ => wishbone_example9328_27}/src/irq_mngr.vhd (100%)
rename firmware/wishbone_example/{ => wishbone_example9328_27}/src/led.vhd (100%)
rename firmware/wishbone_example/{ => wishbone_example9328_27}/src/rstgen_syscon.vhd (100%)
rename firmware/wishbone_example/{ => wishbone_example9328_27}/src/top_wishbone_example.vhd (100%)
rename firmware/wishbone_example/{ => wishbone_example9328_27}/src/wishbone_example_apf27.ucf (100%)
rename firmware/wishbone_example/{ => wishbone_example9328_27}/src/wishbone_example_apf9328.ucf (100%)
rename firmware/wishbone_example/{ => wishbone_example9328_27}/src/wishbone_wrapper.vhd (100%)
rename firmware/wishbone_example/{ => wishbone_example9328_27}/testbench/apf_test_pkg.vhd (100%)
rename firmware/wishbone_example/{ => wishbone_example9328_27}/testbench/top_wishbone_example_tb.vhd (100%)
rename firmware/wishbone_example/{ => wishbone_example9328_27}/wb_buttonled.odg (100%)
diff --git a/firmware/wishbone_example/wishbone_example51.pod b/firmware/wishbone_example/wishbone_example51.pod
new file mode 100644
index 0000000..8cad165
--- /dev/null
+++ b/firmware/wishbone_example/wishbone_example51.pod
@@ -0,0 +1,14 @@
+project.create wishbone_example51
+project.selectplatform standard.apf51
+project.addinstance components.led.wb16
+project.addinstance components.button.wb16
+project.connectpin button00.int_button.irq irq_mngr00.irq.irqport.0
+project.connectpin button00.int_button.button apf51.fpga.IO_L41N_GCLK8_M1CASN_1
+project.connectpin led00.int_led.led apf51.fpga.IO_L41P_GCLK9_IRDY1_M1RASN_1
+project.autoconnectbus
+project.getmapping imx51_wb16_wrapper00
+project.getmapping imx51_wb16_wrapper00.mwb16
+project.intercon imx51_wb16_wrapper00.mwb16
+project.top
+project.synthesis.selecttoolchain ise
+project.synthesis.generateproject
diff --git a/firmware/wishbone_example/wishbone_example51/binaries/top_wishbone_example51_lx9.bin b/firmware/wishbone_example/wishbone_example51/binaries/top_wishbone_example51_lx9.bin
new file mode 100644
index 0000000..96c84f8
Binary files /dev/null and b/firmware/wishbone_example/wishbone_example51/binaries/top_wishbone_example51_lx9.bin differ
diff --git a/firmware/wishbone_example/wishbone_example51/components/button00/button00.xml b/firmware/wishbone_example/wishbone_example51/components/button00/button00.xml
new file mode 100644
index 0000000..153661f
--- /dev/null
+++ b/firmware/wishbone_example/wishbone_example51/components/button00/button00.xml
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="utf-8"?>
+<component instance_name="button00" name="button" num="0" version="1.0">
+ <description>
+ A simple button ip
+ </description>
+ <driver_files>
+ <driver_templates architecture="armadeus">
+ <support version="3" />
+ <file name="Makefile" />
+ <file name="board_buttons.c" />
+ <file name="button.h" />
+ <file name="gbutton.c" />
+ <file name="testbutton.c" />
+ </driver_templates>
+ </driver_files>
+ <generics>
+ <generic destination="both" match="\d+" name="id" public="true" type="natural" value="3" />
+ </generics>
+ <hdl_files>
+ <hdl_file filename="button.vhd" istop="1" scope="both" />
+ </hdl_files>
+ <interrupts>
+ <interrupt interface="int_button" port="irq" />
+ </interrupts>
+ <interfaces>
+ <interface class="gls" name="int_button">
+ <ports>
+ <port dir="in" name="button" size="1" type="EXPORT" />
+ <port dir="out" name="irq" size="1" type="EXPORT" />
+ </ports>
+ </interface>
+ <interface class="clk_rst" name="candr">
+ <ports>
+ <port dir="in" name="gls_reset" size="1" type="RST" />
+ <port dir="in" name="gls_clk" size="1" type="CLK" />
+ </ports>
+ </interface>
+ <interface bus="wishbone16" class="slave" clockandreset="candr" name="swb16">
+ <registers base="0xc">
+ <register name="id" offset="0x00" rows="1" size="16" />
+ <register name="reg_button" offset="0x01" rows="1" size="16" />
+ </registers>
+ <ports>
+ <port dir="in" name="wbs_add" size="1" type="ADR" />
+ <port dir="out" name="wbs_readdata" size="16" type="DAT_O" />
+ <port dir="in" name="wbs_strobe" size="1" type="STB" />
+ <port dir="in" name="wbs_write" size="1" type="WE" />
+ <port dir="out" name="wbs_ack" size="1" type="ACK" />
+ <port dir="in" name="wbs_cycle" size="1" type="CYC" />
+ </ports>
+ </interface>
+ </interfaces>
+</component>
diff --git a/firmware/wishbone_example/wishbone_example51/components/button00/doc/README b/firmware/wishbone_example/wishbone_example51/components/button00/doc/README
new file mode 100644
index 0000000..6db0586
--- /dev/null
+++ b/firmware/wishbone_example/wishbone_example51/components/button00/doc/README
@@ -0,0 +1 @@
+Ask fab...@ar... to document this
diff --git a/firmware/wishbone_example/wishbone_example51/components/button00/drivers_templates/armadeus/Makefile b/firmware/wishbone_example/wishbone_example51/components/button00/drivers_templates/armadeus/Makefile
new file mode 100644
index 0000000..1a0482c
--- /dev/null
+++ b/firmware/wishbone_example/wishbone_example51/components/button00/drivers_templates/armadeus/Makefile
@@ -0,0 +1,37 @@
+#
+# Makefile for the Armadeus Wb_button drivers
+#
+
+BASE_DIR="../../../../../buildroot/"
+
+REL=`grep "BR2_PACKAGE_LINUX_VERSION=" $(BASE_DIR).config | \
+ sed "s/BR2_PACKAGE_LINUX_VERSION=\\"//" | sed "s/\\"//"`
+
+ARMADEUS_KERNEL_DIR=$(BASE_DIR)build_arm/linux-$(REL)
+
+ifneq ($(KERNELRELEASE),)
+
+obj-$(CONFIG_POD_DRIVERS) += board_buttons.o gbutton.o
+
+# Part executed when called from standard make in this directory:
+# (preferably use Makefile in parent directory)
+
+else
+
+KDIR := $(ARMADEUS_KERNEL_DIR)
+PWD := $(shell pwd)
+
+default:
+ $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules
+ -cp button.ko /tftpboot/
+
+test:
+ ~/armadeus/buildroot/build_arm/staging_dir/bin/arm-linux-gcc testbutton.c -o testbutton
+ chmod 755 testbutton
+
+clean:
+ rm -f *.*o \
+ rm -f Module.symvers
+
+endif
+
diff --git a/firmware/wishbone_example/wishbone_example51/components/button00/drivers_templates/armadeus/board_buttons.c b/firmware/wishbone_example/wishbone_example51/components/button00/drivers_templates/armadeus/board_buttons.c
new file mode 100644
index 0000000..032bc7b
--- /dev/null
+++ b/firmware/wishbone_example/wishbone_example51/components/button00/drivers_templates/armadeus/board_buttons.c
@@ -0,0 +1,92 @@
+/*
+ ***********************************************************************
+ *
+ * (c) Copyright 2008 Armadeus project
+ * Fabien Marteau <fab...@ar...>
+ * Specific button driver for generic button driver
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ **********************************************************************
+ */
+
+#include <linux/version.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
+#include <linux/config.h>
+#endif
+
+/* form module/drivers */
+#include <linux/init.h>
+#include <linux/module.h>
+
+/* for platform device */
+#include <linux/platform_device.h>
+#include <mach/hardware.h>
+#ifdef CONFIG_MACH_APF27 /* To remove when MX1 platform merged */
+#include <mach/fpga.h>
+#endif
+
+
+#include "button.h"
+
+/*$foreach:instance$*/
+#define /*$instance_name$*/_IRQ IRQ_FPGA(/*$interrupt_number$*/)
+/*$foreach:instance:end$*/
+
+/*$foreach:instance$*/
+static struct plat_button_port plat_button/*$instance_num$*/_data={
+ .name = "/*$instance_name$*/",
+ .interrupt_number=/*$instance_name$*/_IRQ,
+ .num=/*$instance_num$*/,
+ .membase = (void *)(ARMADEUS_FPGA_BASE_ADDR_VIRT +
+ /*$registers_base_address:swb16$*/),
+ .idnum=/*$generic:id$*/,
+ .idoffset=/*$register:swb16:id:offset$*/ * (/*$register:swb16:id:size$*/ /8)
+};
+/*$foreach:instance:end$*/
+
+/*$foreach:instance$*/
+static struct platform_device plat_button/*$instance_num$*/_device={
+ .name = "button",
+ .id=/*$instance_num$*/,
+ .dev={
+ .platform_data = &plat_button/*$instance_num$*/_data
+ },
+};
+/*$foreach:instance:end$*/
+
+static int __init board_button_init(void)
+{
+ int ret = -1;
+/*$foreach:instance$*/
+ ret = platform_device_register(&plat_button/*$instance_num$*/_device);
+ if(ret<0)return ret;
+/*$foreach:instance:end$*/
+ return ret;
+}
+
+static void __exit board_button_exit(void)
+{
+/*$foreach:instance$*/
+ platform_device_unregister(&plat_button/*$instance_num$*/_device);
+/*$foreach:instance:end$*/
+}
+
+module_init(board_button_init);
+module_exit(board_button_exit);
+
+MODULE_AUTHOR("Fabien Marteau <fab...@ar...>");
+MODULE_DESCRIPTION("Board specific button driver");
+MODULE_LICENSE("GPL");
+
diff --git a/firmware/wishbone_example/wishbone_example51/components/button00/drivers_templates/armadeus/button.c b/firmware/wishbone_example/wishbone_example51/components/button00/drivers_templates/armadeus/button.c
new file mode 100644
index 0000000..71ab24b
--- /dev/null
+++ b/firmware/wishbone_example/wishbone_example51/components/button00/drivers_templates/armadeus/button.c
@@ -0,0 +1,226 @@
+/*
+ ***********************************************************************
+ *
+ * (c) Copyright 2007 Armadeus project
+ * Fabien Marteau <fab...@ar...>
+ * Driver for Wb_button IP
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ **********************************************************************
+ */
+
+#include "button.h"
+
+/*********************************
+ * simple fpga read/write
+ *********************************/
+
+
+static ssize_t button_fpga_read(void * addr,u16 *data,struct button_dev *dev){
+ *data = ioread16(addr);/* read the button value */
+ return 2;
+}
+
+
+static ssize_t button_fpga_write(void * addr,u16 *data,struct button_dev *dev){
+ ssize_t retval;
+
+ iowrite16(*data,addr);/* write the button value */
+ retval = 2;
+ return retval;
+}
+
+/**********************************
+ * irq management
+ * awake read process
+ * ********************************/
+
+static irqreturn_t fpga_interrupt(int irq,void *dev_id,struct pt_regs *reg){
+ struct button_dev *ldev = dev_id;
+ u16 data;
+
+ button_fpga_read(ldev->fpga_virtual_base_address + FPGA_IRQ_PEND,&data,ldev);
+ PDEBUG("Interrupt raised %x\n",data);
+
+ if(data&WB_BUTTON_IRQ){
+ /* wake up reading process */
+ if(ldev->reading)up(&ldev->sem);
+ /* acknowledge irq_mngr */
+ button_fpga_write(ldev->fpga_virtual_base_address + FPGA_IRQ_ACK,&data,ldev);
+ return IRQ_HANDLED;
+ }else
+ return IRQ_NONE;
+
+}
+
+/***********************************
+ * characters file /dev operations
+ * *********************************/
+ssize_t button_read(struct file *fildes, char __user *buff, size_t count, loff_t *offp){
+ struct button_dev *ldev = fildes->private_data;
+ u16 data=0;
+ ssize_t retval = 0;
+ DEFINE_WAIT(wait);
+
+ ldev->reading = 1;
+
+ if(*offp + count >= 1) /* Only one word can be read */
+ count = 1 - *offp;
+
+ if((retval=down_interruptible(&ldev->sem))<0)
+ goto out;
+
+ if((retval = button_fpga_read(ldev->fpga_virtual_base_address + FPGA_BUTTON,&data,ldev))<0)
+ goto out;
+
+ /* return data for user */
+ if(copy_to_user(buff,&data,2)){
+ printk(KERN_WARNING "read : copy to user data error\n");
+ retval = -EFAULT;
+ goto out;
+ }
+
+ *offp = *offp + count;
+ retval = 1;
+
+out:
+ PDEBUG("read : Return value %d\n",(int)retval);
+ ldev->reading = 0;
+ return retval;
+}
+
+
+int button_open(struct inode *inode, struct file *filp){
+ /* Allocate and fill any data structure to be put in filp->private_data */
+ filp->private_data = container_of(inode->i_cdev,struct button_dev, cdev);
+ PDEBUG( "file opened\n");
+ return 0;
+}
+
+/* ******************************
+ * Init and release functions
+ * ******************************/
+int button_release(struct inode *inode, struct file *filp){
+ PDEBUG( "released\n");
+ return 0;
+}
+
+/**********************************
+ * Module management
+ **********************************/
+static int __init button_init(void){
+
+ int result; /* error return */
+ int button_major,button_minor;
+ u16 data;
+ struct button_dev *sdev;
+
+ button_major = 252;
+ button_minor = 0;
+
+ /* Allocate a private structure and reference it as driver's data */
+ sdev = (struct button_dev *)kmalloc(sizeof(struct button_dev),GFP_KERNEL);
+ if(sdev == NULL){
+ printk(KERN_WARNING "button: unable to allocate private structure\n");
+ return -ENOMEM;
+ }
+
+ /* initiate mutex locked */
+ sdev->reading = 0;
+ init_MUTEX_LOCKED(&sdev->sem);
+
+ /* Get the major and minor device numbers */
+ PDEBUG("Get the major and minor device numbers\n");
+ if(button_major){
+ devno = MKDEV(button_major,button_minor);
+ result = register_chrdev_region(devno, N_DEV,BUTTON_NAME);
+ }else{
+ result = alloc_chrdev_region(&devno,button_minor,N_DEV,BUTTON_NAME);
+ button_major = MAJOR(devno);
+ }
+ printk(KERN_INFO "button: MAJOR: %d MINOR: %d\n",MAJOR(devno),MINOR(devno));
+ if(result < 0){
+ printk(KERN_WARNING "button: can't get major %d\n",button_major);
+ }
+
+ /* Init the cdev structure */
+ PDEBUG("Init the cdev structure\n");
+ cdev_init(&sdev->cdev,&button_fops);
+ sdev->cdev.owner = THIS_MODULE;
+
+ /* Add the device to the kernel, connecting cdev to major/minor number */
+ PDEBUG("Add the device to the kernel, connecting cdev to major/minor number \n");
+ result = cdev_add(&sdev->cdev,devno,1);
+ if(result < 0)printk(KERN_WARNING "button: can't add cdev\n");
+
+ /* Requested I/O memory */
+ sdev->fpga_virtual_base_address = (void*)IMX_CS1_VIRT;
+
+ /* irq unmask */
+ data=1 | ioread16(sdev->fpga_virtual_base_address + FPGA_IRQ_MASK);
+ if((result=button_fpga_write(sdev->fpga_virtual_base_address + FPGA_IRQ_MASK,&data,sdev))<0)
+ goto error;
+
+ /* irq acknowledge */
+ data=1;
+ if((result=button_fpga_write(sdev->fpga_virtual_base_address + FPGA_IRQ_ACK,&data,sdev))<0)
+ goto error;
+
+ /* irq registering */
+ printk(KERN_INFO "button: fpga irq shared gpioa 1\n");
+ if(request_irq(IRQ_GPIOA(1),(irq_handler_t)fpga_interrupt,IRQF_SHARED,BUTTON_IRQ_NAME,sdev)<0){
+ printk(KERN_ERR "Can't request fpga irq\n");
+ goto error;
+ }
+
+
+ /* OK module inserted ! */
+ buttondev = sdev;
+ printk(KERN_INFO "button module insered\n");
+ return 0;
+
+
+error:
+ printk(KERN_ERR "%s: not inserted\n",BUTTON_NAME);
+ free_all();
+ return result;
+}
+
+static void __exit button_exit(void){
+ free_all();
+}
+
+static void free_all(void){
+ struct button_dev *sdev = buttondev;
+
+ /* free irq*/
+ free_irq(IRQ_GPIOA(1),sdev);
+
+ /* delete the cdev structure */
+ cdev_del(&sdev->cdev);
+
+ /* Free the allocated memory */
+ kfree(sdev);
+
+ /* Release I/O memories */
+ release_mem_region(FPGA_BASE_ADDR,FPGA_MEM_SIZE);
+
+ /* free major and minor number */
+ unregister_chrdev_region(devno,N_DEV);
+ printk(KERN_INFO "button module deleted\n");
+}
+
+module_init(button_init);
+module_exit(button_exit);
diff --git a/firmware/wishbone_example/wishbone_example51/components/button00/drivers_templates/armadeus/button.h b/firmware/wishbone_example/wishbone_example51/components/button00/drivers_templates/armadeus/button.h
new file mode 100644
index 0000000..5676816
--- /dev/null
+++ b/firmware/wishbone_example/wishbone_example51/components/button00/drivers_templates/armadeus/button.h
@@ -0,0 +1,99 @@
+/*
+ ***********************************************************************
+ *
+ * (c) Copyright 2007 Armadeus project
+ * Fabien Marteau <fab...@ar...>
+ * Driver for Wb_button IP
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ **********************************************************************
+ */
+
+
+#ifndef __BUTTON_H__
+#define __BUTTON_H__
+
+#include <linux/version.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
+#include <linux/config.h>
+#endif
+
+/* form module/drivers */
+#include <linux/init.h>
+#include <linux/module.h>
+
+/* for file operations */
+#include <linux/fs.h>
+#include <linux/cdev.h>
+
+/* copy_to_user function */
+#include <asm/uaccess.h>
+
+/* request_mem_region */
+#include <linux/ioport.h>
+
+/* readw() writew() */
+#include <asm/io.h>
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27)
+/* hardware addresses */
+# include <asm/hardware.h>
+# include <asm/semaphore.h>
+#else
+# include <mach/hardware.h>
+# include <linux/semaphore.h>
+#endif
+
+/* interruptions */
+#include <linux/interrupt.h>
+#include <asm/irq.h>
+#include <linux/wait.h>
+
+/* measure time */
+#include <linux/jiffies.h>
+#endif
+
+/* for debugging messages*/
+/*#define BUTTON_DEBUG*/
+
+#undef PDEBUG
+#ifdef BUTTON_DEBUG
+# ifdef __KERNEL__
+ /* for kernel spage */
+# define PDEBUG(fmt,args...) printk(KERN_INFO "button : " fmt, ##args)
+# else
+ /* for user space */
+# define PDEBUG(fmt,args...) printk(stderr, fmt, ##args)
+# endif
+#else
+# define PDEBUG(fmt,args...) /* no debbuging message */
+#endif
+
+#define BUTTON_NUMBER 1
+
+#define BUTTON_REG_OFFSET (0x02)
+#define BUTTON_ID_OFFSET (0x00)
+
+/* platform device */
+struct plat_button_port{
+ const char *name; /*instance name */
+ int interrupt_number; /* interrupt_number */
+ int num; /* instance number */
+ void * membase; /* ioremap base address */
+ int idnum; /* identity number */
+ int idoffset; /* identity relative address */
+ struct button_dev *sdev; /* struct for main device structure*/
+};
+
diff --git a/target/linux/modules/fpga/wishbone_example/wb_button/button_specific.h b/firmware/wishbone_example/wishbone_example51/components/button00/drivers_templates/armadeus/button_specific.h
similarity index 100%
copy from target/linux/modules/fpga/wishbone_example/wb_button/button_specific.h
copy to firmware/wishbone_example/wishbone_example51/components/button00/drivers_templates/armadeus/button_specific.h
diff --git a/firmware/wishbone_example/wishbone_example51/components/button00/drivers_templates/armadeus/gbutton.c b/firmware/wishbone_example/wishbone_example51/components/button00/drivers_templates/armadeus/gbutton.c
new file mode 100644
index 0000000..6a2aa4a
--- /dev/null
+++ b/firmware/wishbone_example/wishbone_example51/components/button00/drivers_templates/armadeus/gbutton.c
@@ -0,0 +1,360 @@
+/*
+ ***********************************************************************
+ *
+ * (c) Copyright 2008 Armadeus project
+ * Fabien Marteau <fab...@ar...>
+ * Generic driver for Wishbone button IP
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ **********************************************************************
+ */
+
+#include <linux/version.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
+#include <linux/config.h>
+#endif
+
+/* form module/drivers */
+#include <linux/init.h>
+#include <linux/module.h>
+
+/* for file operations */
+#include <linux/fs.h>
+#include <linux/cdev.h>
+
+/* copy_to_user function */
+#include <asm/uaccess.h>
+
+/* request_mem_region */
+#include <linux/ioport.h>
+
+/* readw() writew() */
+#include <asm/io.h>
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27)
+/* hardware addresses */
+# include <asm/hardware.h>
+#else
+# include <mach/hardware.h>
+#endif
+
+
+/* for platform device */
+#include <linux/platform_device.h>
+
+/* button */
+#include "button.h"
+
+
+/* for debugging messages*/
+//#define BUTTON_DEBUG
+
+#undef PDEBUG
+#ifdef BUTTON_DEBUG
+# ifdef __KERNEL__
+/* for kernel spage */
+# define PDEBUG(fmt,args...) printk(KERN_DEBUG "BUTTON : " fmt, ##args)
+# else
+/* for user space */
+# define PDEBUG(fmt,args...) printk(stderr, fmt, ##args)
+# endif
+#else
+# define PDEBUG(fmt,args...) /* no debbuging message */
+#endif
+
+/********************************
+ * main device structure
+ * ******************************/
+struct button_dev{
+ char *name; /* name of the instance */
+ struct cdev cdev; /* char device structure */
+ struct semaphore sem; /* mutex */
+ void * membase; /* base address for instance */
+ dev_t devno; /* to store Major and minor numbers */
+ u8 read_in_wait; /* user is waiting for value to read */
+};
+
+/***********************************
+ * characters file /dev operations
+ * *********************************/
+ssize_t button_read(struct file *fildes, char __user *buff,
+ size_t count, loff_t *offp)
+{
+ struct button_dev *ldev = fildes->private_data;
+ u16 data=0;
+ ssize_t retval = 0;
+
+ ldev->read_in_wait = 1;
+
+ if(*offp + count >= 1) /* Only one word can be read */
+ count = 1 - *offp;
+
+ if((retval=down_interruptible(&ldev->sem))<0)
+ {
+ goto out;
+ }
+
+ data=ioread16(ldev->membase+BUTTON_REG_OFFSET);
+ PDEBUG("Read %d at 0x%x\n",data,(unsigned int)ldev->membase + BUTTON_REG_OFFSET);
+
+ /* return data for user */
+ if(copy_to_user(buff,&data,2)){
+ printk(KERN_WARNING "read : copy to user data error\n");
+ retval = -EFAULT;
+ goto out;
+ }
+
+ *offp = *offp + count;
+ retval = 1;
+
+out:
+ ldev->read_in_wait = 0;
+ return retval;
+}
+
+
+int button_open(struct inode *inode, struct file *filp){
+ /* Allocate and fill any data structure to be put in filp->private_data */
+ filp->private_data = container_of(inode->i_cdev,struct button_dev, cdev);
+ return 0;
+}
+
+int button_release(struct inode *inode, struct file *filp)
+{
+ struct button_dev *dev;
+
+ dev = container_of(inode->i_cdev,struct button_dev,cdev);
+ filp->private_data=NULL;
+
+ return 0;
+}
+
+
+static struct file_operations button_fops = {
+ .owner = THIS_MODULE,
+ .read = button_read,
+ .open = button_open,
+ .release = button_release,
+};
+
+/**********************************
+ * irq management
+ * awake read process
+ * ********************************/
+
+static irqreturn_t button_interrupt(int irq,void *dev_id){
+ struct button_dev *ldev = dev_id;
+ /* wake up reading process */
+ if(ldev->read_in_wait)up(&ldev->sem);
+ /* acknowledge irq_mngr */
+ return IRQ_HANDLED;
+}
+
+/**********************************
+ * driver probe
+ **********************************/
+static int button_probe(struct platform_device *pdev)
+{
+ struct plat_button_port *dev = pdev->dev.platform_data;
+
+ int result = 0; /* error return */
+ int button_major,button_minor;
+ u16 data;
+ struct button_dev *sdev;
+
+ PDEBUG("Button probing\n");
+ PDEBUG("Register %s num %d\n",dev->name,dev->num);
+
+ /**************************/
+ /* check if ID is correct */
+ /**************************/
+ data = ioread16(dev->membase+BUTTON_ID_OFFSET);
+ if(data != dev->idnum){
+ result = -1;
+ printk(KERN_WARNING "For %s id:%d doesn't match "
+ "with id read %d,\n is device present ?\n",
+ dev->name,dev->idnum,data);
+ goto error_id;
+ }
+
+ /********************************************/
+ /* allocate memory for sdev structure */
+ /********************************************/
+ sdev = kmalloc(sizeof(struct button_dev),GFP_KERNEL);
+ if(!sdev){
+ result = -ENOMEM;
+ goto error_sdev_alloc;
+ }
+ dev->sdev = sdev;
+ sdev->membase = dev->membase;
+ sdev->name = (char *)kmalloc((1+strlen(dev->name))*sizeof(char),
+ GFP_KERNEL);
+ if (sdev->name == NULL) {
+ printk("Kmalloc name space error\n");
+ goto error_name_alloc;
+ }
+ if (strncpy(sdev->name,dev->name,1+strlen(dev->name)) < 0) {
+ printk("copy error");
+ goto error_name_copy;
+ }
+
+ /******************************************/
+ /* Get the major and minor device numbers */
+ /******************************************/
+ button_major = 251;
+ button_minor = dev->num;
+
+ sdev->devno = MKDEV(button_major, button_minor);
+ result = alloc_chrdev_region(&(sdev->devno),button_minor, 1,dev->name);
+ if (result < 0) {
+ printk(KERN_WARNING "%s: can't get major %d\n",
+ dev->name,button_major);
+ goto error_devno;
+ }
+ printk(KERN_INFO "%s: MAJOR: %d MINOR: %d\n",
+ dev->name,
+ MAJOR(sdev->devno),
+ MINOR(sdev->devno));
+
+ /* initiate mutex locked */
+ sdev->read_in_wait = 0;
+ init_MUTEX_LOCKED(&sdev->sem);
+
+ /****************************/
+ /* Init the cdev structure */
+ /****************************/
+ PDEBUG("Init the cdev structure\n");
+ cdev_init(&sdev->cdev,&button_fops);
+ sdev->cdev.owner = THIS_MODULE;
+ sdev->cdev.ops = &button_fops;
+
+ /* Add the device to the kernel, connecting cdev to major/minor number */
+ PDEBUG("%s: Add the device to the kernel, "
+ "connecting cdev to major/minor number \n",dev->name);
+ result = cdev_add(&sdev->cdev,sdev->devno,1);
+ if(result < 0){
+ printk(KERN_WARNING "%s: can't add cdev\n",dev->name);
+ goto error_cdev_add;
+ }
+
+ /* irq registering */
+ result = request_irq(dev->interrupt_number,
+ button_interrupt,
+ IRQF_SAMPLE_RANDOM,
+ sdev->name,
+ sdev);
+ if(result < 0){
+ printk(KERN_ERR "Can't register irq %d\n",
+ dev->interrupt_number);
+ goto request_irq_error;
+ }
+ printk(KERN_INFO "button: irq registered : %d\n",
+ dev->interrupt_number);
+
+ /* OK module inserted ! */
+ printk(KERN_INFO "%s insered\n",dev->name);
+ return 0;
+
+ /*********************/
+ /* Errors management */
+ /*********************/
+ /* freeing irq */
+ free_irq(dev->interrupt_number,sdev);
+request_irq_error:
+ /* delete the cdev structure */
+ cdev_del(&sdev->cdev);
+ PDEBUG("%s:cdev deleted\n",dev->name);
+error_cdev_add:
+ /* free major and minor number */
+ unregister_chrdev_region(sdev->devno,1);
+ printk(KERN_INFO "%s: Led deleted\n",dev->name);
+error_devno:
+error_name_copy:
+ kfree(sdev->name);
+error_name_alloc:
+ kfree(sdev);
+error_sdev_alloc:
+ printk(KERN_ERR "%s: not inserted\n", dev->name);
+error_id:
+ return result;
+}
+
+static int __devexit button_remove(struct platform_device *pdev)
+{
+ struct plat_button_port *dev = pdev->dev.platform_data;
+ struct button_dev *sdev = (*dev).sdev;
+ /* freeing irq */
+ free_irq(dev->interrupt_number,sdev);
+//request_irq_error:
+ /* delete the cdev structure */
+ cdev_del(&sdev->cdev);
+ PDEBUG("%s:cdev deleted\n",dev->name);
+//error_cdev_add:
+ /* free major and minor number */
+ unregister_chrdev_region(sdev->devno,1);
+ printk(KERN_INFO "%s: Led deleted\n",dev->name);
+//error_devno:
+//error_name_copy:
+ kfree(sdev->name);
+//error_name_alloc:
+ kfree(sdev);
+//error_sdev_alloc:
+ printk(KERN_INFO "%s: deleted with success\n", dev->name);
+//error_id:
+ return 0;
+
+}
+
+static struct platform_driver plat_button_driver =
+{
+ .probe = button_probe,
+ .remove = __devexit_p(button_remove),
+ .driver =
+ {
+ .name = "button",
+ .owner = THIS_MODULE,
+ },
+};
+
+/**********************************
+ * Module management
+ **********************************/
+static int __init button_init(void)
+{
+ int ret;
+
+ PDEBUG("Platform driver name %s",plat_button_driver.driver.name);
+ ret = platform_driver_register(&plat_button_driver);
+ if (ret) {
+ printk(KERN_ERR "Platform driver register error\n");
+ return ret;
+ }
+ return 0;
+}
+
+static void __exit button_exit(void)
+{
+ platform_driver_unregister(&plat_button_driver);
+}
+
+module_init(button_init);
+module_exit(button_exit);
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Fabien Marteau <fab...@ar...> "
+ "- ARMadeus Systems");
+MODULE_DESCRIPTION("button device generic driver");
+
+
diff --git a/firmware/wishbone_example/wishbone_example51/components/button00/drivers_templates/armadeus/testbutton.c b/firmware/wishbone_example/wishbone_example51/components/button00/drivers_templates/armadeus/testbutton.c
new file mode 100644
index 0000000..8765669
--- /dev/null
+++ b/firmware/wishbone_example/wishbone_example51/components/button00/drivers_templates/armadeus/testbutton.c
@@ -0,0 +1,90 @@
+/* a program to write/read values on fpga address map
+ * Fabien Marteau <fab...@ar...>
+ * 7 april 2008
+ * fpgaaccess.h
+ *
+ * (c) Copyright 2008 Armadeus project
+ * Fabien Marteau <fab...@ar...>
+ *
+ * A simple driver for reading and writing on
+ * fpga throught a character file /dev/fpgaaccess
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ **********************************************************************
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+/* file management */
+#include <sys/stat.h>
+#include <fcntl.h>
+
+/* as name said */
+#include <signal.h>
+
+/* sleep */
+#include <unistd.h>
+
+int fled;
+
+void quit(int pouet){
+ close(fled);
+ exit(0);
+}
+
+int main(int argc, char *argv[])
+{
+ unsigned short i,j;
+
+ /* quit when Ctrl-C pressed */
+ signal(SIGINT, quit);
+
+ j=0;
+
+ printf( "Testing button driver\n" );
+
+ if(argc < 2){
+ perror("invalide arguments number\ntestled <button_filename>\n");
+ exit(EXIT_FAILURE);
+ }
+
+ fled=open(argv[1],O_RDWR);
+ if(fled<0){
+ perror("can't open file\n");
+ exit(EXIT_FAILURE);
+ }
+
+ while(1){
+ i = (i==0)?1:0;
+ fflush(stdout);
+
+ /* read value */
+ if(read(fled,&j,1)<0){
+ perror("read error\n");
+ exit(EXIT_FAILURE);
+ }
+ printf("Read %d\n",j);
+
+ if(lseek(fled,0,SEEK_SET)<0){
+ perror("lseek error\n");
+ exit(EXIT_FAILURE);
+ }
+ }
+
+ close(fled);
+ exit(0);
+}
+
diff --git a/firmware/wishbone_example/wishbone_example51/components/button00/hdl/button.vhd b/firmware/wishbone_example/wishbone_example51/components/button00/hdl/button.vhd
new file mode 100644
index 0000000..7aec507
--- /dev/null
+++ b/firmware/wishbone_example/wishbone_example51/components/button00/hdl/button.vhd
@@ -0,0 +1,98 @@
+---------------------------------------------------------------------------
+-- Company : ARMades Systems
+-- Author(s) : Fabien Marteau <fab...@ar...>
+--
+-- Creation Date : 10/03/2008
+-- File : button.vhd
+--
+-- Abstract :
+--
+---------------------------------------------------------------------------
+
+library IEEE;
+use IEEE.STD_LOGIC_1164.ALL;
+use IEEE.numeric_std.all;
+
+---------------------------------------------------------------------------
+Entity button is
+---------------------------------------------------------------------------
+ generic(
+ id : natural := 2
+ );
+ port
+ (
+ -- global signals
+ gls_reset : in std_logic ;
+ gls_clk : in std_logic ;
+ -- Wishbone signals
+ wbs_add : in std_logic ;
+ wbs_readdata : out std_logic_vector( 15 downto 0);
+ wbs_strobe : in std_logic ;
+ wbs_cycle : in std_logic ;
+ wbs_write : in std_logic ;
+ wbs_ack : out std_logic;
+ -- irq
+ irq : out std_logic ;
+ -- fpga input
+ button : in std_logic
+ );
+end entity;
+
+
+---------------------------------------------------------------------------
+Architecture button_1 of button is
+ ---------------------------------------------------------------------------
+ signal button_r : std_logic ;
+ signal reg : std_logic_vector( 15 downto 0);
+begin
+
+ -- connect button
+ cbutton : process(gls_clk,gls_reset)
+ begin
+ if gls_reset = '1' then
+ reg <= (others => '0');
+ elsif rising_edge(gls_clk) then
+ reg <= "000000000000000"&button;
+ end if;
+ end process cbutton;
+
+
+ -- rise interruption
+ pbutton : process(gls_clk,gls_reset)
+ begin
+ if gls_reset = '1' then
+ irq <= '0';
+ button_r <= '0';
+ elsif rising_edge(gls_clk) then
+ if button_r /= button then
+ irq <= '1';
+ else
+ irq <= '0';
+ end if;
+ button_r <= button;
+ end if;
+ end process pbutton;
+
+ -- register reading process
+ pread : process(gls_clk,gls_reset)
+ begin
+ if(gls_reset = '1') then
+ wbs_ack <= '0';
+ wbs_readdata <= (others => '0');
+ elsif(rising_edge(gls_clk)) then
+ wbs_ack <= '0';
+ if(wbs_strobe = '1' and wbs_write = '0' and wbs_cycle = '1')then
+ wbs_ack <= '1';
+ if wbs_add = '0' then
+ wbs_readdata <= std_logic_vector(to_unsigned(id,16));
+ else
+ wbs_readdata <= reg;
+ end if;
+ else
+ wbs_readdata <= (others => '0');
+ end if;
+ end if;
+ end process pread;
+
+end architecture button_1;
+
diff --git a/firmware/wishbone_example/wishbone_example51/components/imx51_wb16_wrapper00/doc/README b/firmware/wishbone_example/wishbone_example51/components/imx51_wb16_wrapper00/doc/README
new file mode 100644
index 0000000..60cc40e
--- /dev/null
+++ b/firmware/wishbone_example/wishbone_example51/components/imx51_wb16_wrapper00/doc/README
@@ -0,0 +1,15 @@
+imx51_wb16_wrapper component
+============================
+
+This component is designed to convert WEIM bus from i.MX51
+to Wisbone 16 bits bus.
+
+FPGA component
+--------------
+
+No registers
+
+ARMadeus linux driver
+---------------------
+
+TODO
diff --git a/firmware/wishbone_example/wishbone_example51/components/imx51_wb16_wrapper00/hdl/imx51_wb16_wrapper.vhd b/firmware/wishbone_example/wishbone_example51/components/imx51_wb16_wrapper00/hdl/imx51_wb16_wrapper.vhd
new file mode 100644
index 0000000..5220c6c
--- /dev/null
+++ b/firmware/wishbone_example/wishbone_example51/components/imx51_wb16_wrapper00/hdl/imx51_wb16_wrapper.vhd
@@ -0,0 +1,87 @@
+-------------------------------------------------------------------------------
+--
+-- File : imx51_wb16_wrapper.vhd
+-- Related files : (none)
+--
+-- Author(s) : Fabien Marteau <fab...@ar...>
+-- Project : i.MX51 wrapper to Wishbone bus
+--
+-- Creation Date : 17/12/2010
+--
+-- Description : This is the top file of the IP
+-------------------------------------------------------------------------------
+-- Modifications :
+--
+-------------------------------------------------------------------------------
+
+library IEEE;
+ use IEEE.std_logic_1164.all;
+ use IEEE.numeric_std.all;
+
+---------------------------------------------------------------------------
+Entity imx51_wb16_wrapper is
+---------------------------------------------------------------------------
+port
+(
+ -- i.MX Signals
+ imx_da : inout std_logic_vector(15 downto 0);
+ imx_cs_n : in std_logic;
+ imx_rw : in std_logic ;
+ imx_adv : in std_logic ;
+
+ -- Global Signals
+ gls_reset : in std_logic;
+ gls_clk : in std_logic;
+
+ -- Wishbone interface signals
+ wbm_address : out std_logic_vector(15 downto 0); -- Address bus
+ wbm_readdata : in std_logic_vector(15 downto 0); -- Data bus for read access
+ wbm_writedata : out std_logic_vector(15 downto 0); -- Data bus for write access
+ wbm_strobe : out std_logic; -- Data Strobe
+ wbm_write : out std_logic; -- Write access
+ wbm_ack : in std_logic; -- acknowledge
+ wbm_cycle : out std_logic -- bus cycle in progress
+);
+end entity;
+
+---------------------------------------------------------------------------
+Architecture RTL of imx51_wb16_wrapper is
+---------------------------------------------------------------------------
+
+ signal write : std_logic;
+ signal read : std_logic;
+ signal strobe : std_logic;
+ signal writedata : std_logic_vector(15 downto 0);
+ signal address : std_logic_vector(15 downto 0);
+
+begin
+
+ -- ----------------------------------------------------------------------------
+ -- External signals synchronization process
+ -- ----------------------------------------------------------------------------
+ process(gls_clk, gls_reset)
+ begin
+ if(gls_reset='1') then
+ writedata <= (others => '0');
+ address <= (others => '0');
+ elsif(rising_edge(gls_clk)) then
+ if (imx_adv = '0') then
+ address <= imx_da;
+ else
+ writedata <= imx_da;
+ end if;
+ end if;
+ end process;
+ strobe <= not (imx_cs_n);
+ write <= (not (imx_cs_n)) and (not(imx_rw));
+ read <= (not (imx_cs_n)) and imx_rw;
+
+ wbm_address <= address;
+ wbm_writedata <= writedata when (write = '1') else (others => '0');
+ wbm_strobe <= strobe;
+ wbm_write <= write;
+ wbm_cycle <= strobe;
+
+ imx_da <= wbm_readdata when ((read = '1') and (strobe = '1')) else (others => 'Z');
+
+end architecture RTL;
diff --git a/firmware/wishbone_example/wishbone_example51/components/imx51_wb16_wrapper00/imx51_wb16_wrapper00.xml b/firmware/wishbone_example/wishbone_example51/components/imx51_wb16_wrapper00/imx51_wb16_wrapper00.xml
new file mode 100644
index 0000000..046425c
--- /dev/null
+++ b/firmware/wishbone_example/wishbone_example51/components/imx51_wb16_wrapper00/imx51_wb16_wrapper00.xml
@@ -0,0 +1,102 @@
+<?xml version="1.0" encoding="utf-8"?>
+<component instance_name="imx51_wb16_wrapper00" name="imx51_wb16_wrapper" num="0" version="0.1">
+ <description>
+ Convert EIM i.mx51 bus into a Wishbone 16bits master bus.
+ </description>
+ <hdl_files>
+ <hdl_file filename="imx51_wb16_wrapper.vhd" istop="1" scope="spartan6" />
+ </hdl_files>
+ <interfaces>
+ <interface class="gls" name="eim">
+ <ports>
+ <port dir="inout" name="imx_da" size="16" type="EXPORT">
+ <pin num="0">
+ <connect instance_dest="apf51" interface_dest="fpga" pin_dest="0" port_dest="EIM_DA0" />
+ </pin>
+ <pin num="1">
+ <connect instance_dest="apf51" interface_dest="fpga" pin_dest="0" port_dest="EIM_DA1" />
+ </pin>
+ <pin num="2">
+ <connect instance_dest="apf51" interface_dest="fpga" pin_dest="0" port_dest="EIM_DA2" />
+ </pin>
+ <pin num="3">
+ <connect instance_dest="apf51" interface_dest="fpga" pin_dest="0" port_dest="EIM_DA3" />
+ </pin>
+ <pin num="4">
+ <connect instance_dest="apf51" interface_dest="fpga" pin_dest="0" port_dest="EIM_DA4" />
+ </pin>
+ <pin num="5">
+ <connect instance_dest="apf51" interface_dest="fpga" pin_dest="0" port_dest="EIM_DA5" />
+ </pin>
+ <pin num="6">
+ <connect instance_dest="apf51" interface_dest="fpga" pin_dest="0" port_dest="EIM_DA6" />
+ </pin>
+ <pin num="7">
+ <connect instance_dest="apf51" interface_dest="fpga" pin_dest="0" port_dest="EIM_DA7" />
+ </pin>
+ <pin num="8">
+ <connect instance_dest="apf51" interface_dest="fpga" pin_dest="0" port_dest="EIM_DA8" />
+ </pin>
+ <pin num="9">
+ <connect instance_dest="apf51" interface_dest="fpga" pin_dest="0" port_dest="EIM_DA9" />
+ </pin>
+ <pin num="10">
+ <connect instance_dest="apf51" interface_dest="fpga" pin_dest="0" port_dest="EIM_DA10" />
+ </pin>
+ <pin num="11">
+ <connect instance_dest="apf51" interface_dest="fpga" pin_dest="0" port_dest="EIM_DA11" />
+ </pin>
+ <pin num="12">
+ <connect instance_dest="apf51" interface_dest="fpga" pin_dest="0" port_dest="EIM_DA12" />
+ </pin>
+ <pin num="13">
+ <connect instance_dest="apf51" interface_dest="fpga" pin_dest="0" port_dest="EIM_DA13" />
+ </pin>
+ <pin num="14">
+ <connect instance_dest="apf51" interface_dest="fpga" pin_dest="0" port_dest="EIM_DA14" />
+ </pin>
+ <pin num="15">
+ <connect instance_dest="apf51" interface_dest="fpga" pin_dest="0" port_dest="EIM_DA15" />
+ </pin>
+ </port>
+ <port dir="in" name="imx_cs_n" size="1" type="EXPORT">
+ <pin num="0">
+ <connect instance_dest="apf51" interface_dest="fpga" pin_dest="0" port_dest="EIM_CS1" />
+ </pin>
+ </port>
+ <port dir="in" name="imx_adv" size="1" type="EXPORT">
+ <pin num="0">
+ <connect instance_dest="apf51" interface_dest="fpga" pin_dest="0" port_dest="EIM_LBA" />
+ </pin>
+ </port>
+ <port dir="in" name="imx_rw" size="1" type="EXPORT">
+ <pin num="0">
+ <connect instance_dest="apf51" interface_dest="fpga" pin_dest="0" port_dest="EIM_RW" />
+ </pin>
+ </port>
+ </ports>
+ </interface>
+ <interface class="clk_rst" name="candr">
+ <ports>
+ <port dir="in" name="gls_reset" size="1" type="RST" />
+ <port dir="in" name="gls_clk" size="1" type="CLK" />
+ </ports>
+ </interface>
+ <interface bus="wishbone16" class="master" clockandreset="candr" name="mwb16">
+ <ports>
+ <port dir="out" name="wbm_address" size="16" type="ADR" />
+ <port dir="in" name="wbm_readdata" size="16" type="DAT_I" />
+ <port dir="out" name="wbm_writedata" size="16" type="DAT_O" />
+ <port dir="out" name="wbm_strobe" size="1" type="STB" />
+ <port dir="out" name="wbm_write" size="1" type="WE" />
+ <port dir="in" name="wbm_ack" size="1" type="ACK" />
+ <port dir="out" name="wbm_cycle" size="1" type="CYC" />
+ </ports>
+ <slaves>
+ <slave instancename="irq_mngr00" interfacename="swb16" />
+ <slave instancename="led00" interfacename="swb16" />
+ <slave instancename="button00" interfacename="swb16" />
+ </slaves>
+ </interface>
+ </interfaces>
+</component>
diff --git a/firmware/wishbone_example/wishbone_example51/components/imx51_wb16_wrapper00_mwb16_intercon/hdl/imx51_wb16_wrapper00_mwb16_intercon.vhd b/firmware/wishbone_example/wishbone_example51/components/imx51_wb16_wrapper00_mwb16_intercon/hdl/imx51_wb16_wrapper00_mwb16_intercon.vhd
new file mode 100644
index 0000000..194226a
--- /dev/null
+++ b/firmware/wishbone_example/wishbone_example51/components/imx51_wb16_wrapper00_mwb16_intercon/hdl/imx51_wb16_wrapper00_mwb16_intercon.vhd
@@ -0,0 +1,168 @@
+---------------------------------------------------------------------------
+-- Company : Automaticaly generated by POD
+-- Author(s) :
+--
+-- Creation Date : 2011-05-03
+-- File : imx51_wb16_wrapper00_mwb16.vhd
+--
+-- Abstract :
+-- Connect slaves to mwb16 from imx51_wb16_wrapper00
+--
+---------------------------------------------------------------------------
+
+library IEEE;
+use IEEE.STD_LOGIC_1164.ALL;
+use IEEE.numeric_std.all;
+
+Entity imx51_wb16_wrapper00_mwb16 is
+ port
+ (
+
+ -- irq_mngr00_swb16 connection
+ irq_mngr00_wbs_s1_address : out std_logic_vector(1 downto 0);
+ irq_mngr00_wbs_s1_readdata : in std_logic_vector(15 downto 0);
+ irq_mngr00_wbs_s1_writedata : out std_logic_vector(15 downto 0);
+ irq_mngr00_wbs_s1_ack : in std_logic;
+ irq_mngr00_wbs_s1_strobe : out std_logic;
+ irq_mngr00_wbs_s1_cycle : out std_logic;
+ irq_mngr00_wbs_s1_write : out std_logic;
+
+ -- irq_mngr00_candr connection
+ irq_mngr00_gls_clk : out std_logic;
+ irq_mngr00_gls_reset : out std_logic;
+
+ -- led00_swb16 connection
+ led00_wbs_add : out std_logic;
+ led00_wbs_writedata : out std_logic_vector(15 downto 0);
+ led00_wbs_readdata : in std_logic_vector(15 downto 0);
+ led00_wbs_strobe : out std_logic;
+ led00_wbs_cycle : out std_logic;
+ led00_wbs_write : out std_logic;
+ led00_wbs_ack : in std_logic;
+
+ -- led00_candr connection
+ led00_gls_reset : out std_logic;
+ led00_gls_clk : out std_logic;
+
+ -- button00_swb16 connection
+ button00_wbs_add : out std_logic;
+ button00_wbs_readdata : in std_logic_vector(15 downto 0);
+ button00_wbs_strobe : out std_logic;
+ button00_wbs_write : out std_logic;
+ button00_wbs_ack : in std_logic;
+ button00_wbs_cycle : out std_logic;
+
+ -- button00_candr connection
+ button00_gls_reset : out std_logic;
+ button00_gls_clk : out std_logic;
+
+ -- imx51_wb16_wrapper00_mwb16 connection
+ imx51_wb16_wrapper00_wbm_address : in std_logic_vector(15 downto 0);
+ imx51_wb16_wrapper00_wbm_readdata : out std_logic_vector(15 downto 0);
+ imx51_wb16_wrapper00_wbm_writedata : in std_logic_vector(15 downto 0);
+ imx51_wb16_wrapper00_wbm_strobe : in std_logic;
+ imx51_wb16_wrapper00_wbm_write : i...
[truncated message content] |