[Suzaku-en:00791] Re: SZ410 - communication between linux and fpga / reading and writing variables

Yasushi SHOJI email@hidden
Wed May 20 11:54:07 JST 2009


Benjamin,

At Tue, 19 May 2009 09:01:57 +0200,
Begandt, Benjamin wrote:
> 
> I'm trying to programm an interface/driver in linux that connects the
> fpga to linux. 
> 
> My goal - I finally want to reach - is a comunication/possibility to
> read and write variables from/to the fpga from the ethernet, for example
> from the webserver.
> 
> In this case I'm searching for a method to write and read variables to
> the fpga, so that the fpga is able to use them for calculations and so
> on, or that I can read calculated values from the fpga. 
> My idea is to use the PLB to do that, but till now I found no
> explanation how to programm or how to use it in Linux with c/c++ as
> programming language.

to make the problem simple, forget about linux for now.  just think
cpu and fpga and you want them to share some data.

now, for cpu, either microblaze or powerpc, accessing something means
either:

	- read form somewhere, or
	- write to somewhere

nothing else.  no other method exist for those cpu.

now, "somewhere" is a place you can point to with address.  address is
representation of value with 32 lines of signal called address bus.

when your cpu execute read instruction, the cpu will drive address bus
with the value you specified as operand, and wait the data bus is
driven by a device located at the address you specified.

the write is a bit diffrent, your cpu drives the address bus and then
it also drives data bus with your data on it.  and the cpu hope that a
device on the other side of the bus will latch the data you sent.

so far so good? now you want to make your fpga communicate with your
cpu.  when fpga want to accept data from cpu, fpga must latch the data
the cpu sent on the data bus.  if your fpga want to return some data
to the cpu, the fpga must drive the data bus with your data.

if you already have fpga ready to accept and send data, and you are
familier with accessing hardware from software, all you need to do is
to write a simple linux device driver.  gpio device driver is the most
simple one, I assume.  check that in the linux kernel tarball.

if you are not familier with accessing hardware, check bboot, suzaku's
first boot loader.  the code is in the fpga project.

if you do not have fpga ready reacting to cpu's action (read/write),
check ipif document on xilinx site.  the ipif is a glue logic to bind
your logic and CoreConnect buses, such as PLB and OPB.

Unfortunatly, we only have suzaku starter kit guide in Japanese. the
guide describe the above problem step by step with a lot of screen
shots of ISE/EDK.  you can just skim through and pick HDL and C code
form the guide, if you want.

http://suzaku.atmark-techno.com/files/downloads/suzaku-starter-kit/suzaku_starter_kit_guide_fpga_ja-2.4.4.pdf
http://suzaku.atmark-techno.com/files/downloads/suzaku-starter-kit/suzaku-v_starter_kit_guide_linux_ja-2.0.2.pdf
http://suzaku.atmark-techno.com/files/downloads/suzaku-starter-kit/suzaku-s_starter_kit_guide_linux_ja-1.3.5.pdf

hope this helps,
-- 
               yashi



More information about the suzaku-en mailing list