LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-21-2013, 07:46 PM   #1
clp510
LQ Newbie
 
Registered: Aug 2012
Posts: 9

Rep: Reputation: Disabled
Lightbulb how to write a driver that treat part of ddr space as io device?


Here is the description:
I am developing on Xilinx zynq-7000 FPGA,board zc702.There is 1 GB ddr on my board,I want do such a thing,divide the ddr space into two parts,512MB for each,part 1 is used for linux operating system,as for part 2,I want to use it as io space,so that my logic part on FPGA can freely access this part without affect the linux operating system,and also,the linux can access this part space at the proper time.
I am almost newbie to linux driver,is that possible?if so,how to do it?
 
Old 11-23-2013, 11:08 AM   #2
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware & Android
Posts: 8,573

Rep: Reputation: 862Reputation: 862Reputation: 862Reputation: 862Reputation: 862Reputation: 862Reputation: 862
/As nobody else is having a go

I would not set about it that way, as it sounds difficult. Just think: 1Gb probably is 1 Dimm, one memory bank, one /ce line. The driver would have to be invasive. The I/O might have to be written to I/O space and copied back to your ram, etc. Then, the fpga probably has one clock, the cpu another, so at the junction between them you lose your synchronous design :-(.

Linux is, OTOH, good at virtual devices, and very good at networked funny devices. It talks to these via established protocols.

Presuming this is a College project, it looks like a time trap. If you're doing a PhD, then fine, you have time and good luck to you. If not, change direction. I would give up on making the board be the ram for the FPGA. The board can be a network device for the fpga and forward stuff online. Make your own ram - you have an fpga, after all. Here - I'll start you off.

include <loads of libs>;
entity ram is <blah>
 
Old 11-23-2013, 11:25 AM   #3
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,284

Rep: Reputation: 371Reputation: 371Reputation: 371Reputation: 371
Not sure how helpful this is, but there are existing filesystems (e.g. tmpfs) that can treat part of system memory as a (transient) filesystem that is accessed via normal POSIX I/O. You might want to take a look at how those work and model what you do after them.
 
Old 11-24-2013, 12:26 AM   #4
clp510
LQ Newbie
 
Registered: Aug 2012
Posts: 9

Original Poster
Rep: Reputation: Disabled
could someone give some specific suggestions or some specific docs or materials?I'am almost newbie to linux
 
Old 11-24-2013, 04:43 AM   #5
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware & Android
Posts: 8,573

Rep: Reputation: 862Reputation: 862Reputation: 862Reputation: 862Reputation: 862Reputation: 862Reputation: 862
You are biting off a huge chunk of work. Have you the time for this?
 
Old 11-24-2013, 09:39 PM   #6
clp510
LQ Newbie
 
Registered: Aug 2012
Posts: 9

Original Poster
Rep: Reputation: Disabled
I have 3 months to do the work including this part which i think is the most difficult,is that enough?
 
Old 11-25-2013, 04:12 AM   #7
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware & Android
Posts: 8,573

Rep: Reputation: 862Reputation: 862Reputation: 862Reputation: 862Reputation: 862Reputation: 862Reputation: 862
> 3 months?

As homework, definitely not imho.
3 months full time 40hrs a week - maybe, if you are a quick learner.

If this code is to be gpl'ed you can borrow chunks and reference them accordingly, use libs, and other existing building blocks. Install the info pages. There is a collection of info pages which give you the standard stuff (printf, etc) and tell you what they do and what o include. There is kernel.org which has gigabytes of kernel documentation. Avoid the howtos - they are too basic, and often self indulgent monologues.

tmpfs sounds like a great idea. With a file in tmpfs, your driver would simmply send it to I/O, and write one back. Also, if you established a network connection between fpga subsystem and main box (maybe tcp/ip tunneling) you could forward through the main box.

I would google how others have done it, check for linux support, etc. Can you even write an fpga under linux. The Xilinx linux board drivers were wedded to a very old kernel (<2.2.23 or such like) and would not compile on later ones.
 
Old 11-25-2013, 05:39 AM   #8
clp510
LQ Newbie
 
Registered: Aug 2012
Posts: 9

Original Poster
Rep: Reputation: Disabled
thank you for your replies,I think i can have a try,good luck to me,^_^.
 
Old 11-26-2013, 08:33 AM   #9
onebuck
Moderator
 
Registered: Jan 2005
Location: Midwest USA, Central Illinois
Distribution: Slackware®
Posts: 12,892
Blog Entries: 27

Rep: Reputation: 2183Reputation: 2183Reputation: 2183Reputation: 2183Reputation: 2183Reputation: 2183Reputation: 2183Reputation: 2183Reputation: 2183Reputation: 2183Reputation: 2183
Member Response

Hi,

Quote:
Originally Posted by clp510 View Post
thank you for your replies,I think i can have a try,good luck to me,^_^.
You can use this information to aid you in developing the driver, especially LDD3(most s still applicable to Linux 3.6);
Quote:
Kernel:
The Linux Kernel Archives <- Kernel.org 'This is the primary site for the Linux kernel source, but it has much more than just Linux kernels.'
LinuxHQ <- 'Web Sites tries to organize and catalog many of the Linux related kernel patches in one central location'.
Linux - 2.6 branch <- freshmeat.net, Good resource
Anatomy of the Linux kernel <- 'The Linux® kernel is the core of a large and complex operating system, and while it's huge, it is well organized in terms of subsystems and layers. In this article, you explore the general structure of the Linux kernel and get to know its major subsystems and core interfaces. Where possible, you get links to other IBM articles to help you dig deeper'
Kernel Reference:
Linux Kernel Parameters <- Find out what's being passed to and from the kernel. Parameters list.
Linux Device Drivers, Third Edition <- 'LDD3 is current as of the 2.6.10 kernel'. + Good online reference
KernelGlossary <- 'A glossary of various terms and acronyms related to the Linux kernel'.
Kernel Links <- 'Index of Documentation for People Interested in Writing and/or Understanding the Linux Kernel'.
Linux Kernel Tester’s Guide <- Great reference + pdf
KernelTrap <- News! Watch the kernel with many different programmers.
Linux Kernel <- Wikipedia
Kernel dissection:
Simplified Kernel diagram <- in the form of a matrix map
Dynamic Interrupt Request Allocation for Device Drivers
Linux Signals for the Application Programmer
IRQ Debate in the Linux kernel
Linux Kernel Interactive Map <- Great!
Kernel Books:
Linux Kernel in a Nutshell <- Good read! downloadable
KernelBooks <- 'Covering Linux 2.4 and Linux 2.6, as well as particular kernel subsystems'.
Do not forget;
Quote:
Newbie:
Linux Kernel Newbies <- 'Kernelnewbies are a community of people that improve or update their Kernels'
&
kernel.org;
Quote:
The Linux Kernel Organization is a California Public Benefit Corporation established in 2002 to distribute the Linux kernel and other Open Source software to the public without charge. We are recognized by the IRS as a 501(c)3 private operating foundation.
The Linux Kernel Organization is managed by The Linux Foundation, which provides full technical, financial and staffing support for running and maintaining the kernel.org infrastructure.
You can find more information at Slackware®-Links section Linux Kernel

You might find that Shared Memory Under Linux - Because "you can't stop the signal" & Shared vs. distributed memory in large Linux useful. I suggest that you do a search on 'inter-processor Linux shared memory concepts' to get loads of useful information.

Looks like you are not going to be discouraged so, good luck with your endeavors in this project. Been a while since I have done shared memory concepts but it is doable. Be sure to look at the kernel concepts. If you do things right you can setup the proper scheduler to enhance your shared memory processes, especially inter-processor functionality.

Hope this helps.
 
1 members found this post helpful.
Old 11-27-2013, 01:55 AM   #10
clp510
LQ Newbie
 
Registered: Aug 2012
Posts: 9

Original Poster
Rep: Reputation: Disabled
You have done a great favour to me,those above are all my need as a start,thank you very much.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] /etc/profile write to 1 failed [No space left on device] cdhar Linux - Newbie 2 03-18-2013 05:54 AM
write to 1 failed [No space left on device] cyberchip Linux - Software 3 10-16-2012 11:55 AM
write to 1 failed [No space left on device] cyberchip Linux - Kernel 1 10-04-2012 02:51 PM
Cannot write: No space left on device louk88 Linux - Newbie 9 04-22-2012 07:43 PM
Linux Driver - how to read/write a block or character device in kernel space (procfs) stybi Linux - Kernel 1 01-27-2011 07:26 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:26 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration