kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
* Linux PCI driver.
@ 2014-08-18  7:50 testlaster
  2014-08-18  8:35 ` Greg KH
  0 siblings, 1 reply; 5+ messages in thread
From: testlaster @ 2014-08-18  7:50 UTC (permalink / raw)
  To: kernelnewbies

Hey Guys

Im writing a PCI driver in Linux ( Lubuntu ). Now its not an entire 
driver its really just a little program that will latch onto a space of 
ram and dump the entire content of the ram into a file.
I have done this before in a Unix/Linux based OS and it took me quite a 
while to figure it out.

So at startup the configuration for the PCI is already done so I wont 
have to do any of that myself.
I really just need to set a pointer to a register.

My problem is that I cant find the functions to do that for linux.
I cant find similar functions to things like :
PCI_ATTACH()
pci_attach_device();
mmap_device_memory();

I think that is really all I need at the moment.
Anybody have some ideas of where I can start looking?

Thanks and regards.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Linux PCI driver.
  2014-08-18  7:50 Linux PCI driver testlaster
@ 2014-08-18  8:35 ` Greg KH
  2014-08-18 12:30   ` testlaster
  0 siblings, 1 reply; 5+ messages in thread
From: Greg KH @ 2014-08-18  8:35 UTC (permalink / raw)
  To: kernelnewbies

On Mon, Aug 18, 2014 at 09:50:44AM +0200, testlaster wrote:
> Hey Guys
> 
> Im writing a PCI driver in Linux ( Lubuntu ). Now its not an entire 
> driver its really just a little program that will latch onto a space of 
> ram and dump the entire content of the ram into a file.
> I have done this before in a Unix/Linux based OS and it took me quite a 
> while to figure it out.
> 
> So at startup the configuration for the PCI is already done so I wont 
> have to do any of that myself.
> I really just need to set a pointer to a register.
> 
> My problem is that I cant find the functions to do that for linux.
> I cant find similar functions to things like :
> PCI_ATTACH()
> pci_attach_device();
> mmap_device_memory();
> 
> I think that is really all I need at the moment.
> Anybody have some ideas of where I can start looking?

Have you read the book, Linux Device Drivers, 3rd edition, it's free
online and has a whole chapter on PCI that should answer these questions
for you.

If not, please feel free to post your code and we will be glad to review
it.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Linux PCI driver.
  2014-08-18  8:35 ` Greg KH
@ 2014-08-18 12:30   ` testlaster
  2014-08-18 12:33     ` Greg KH
  0 siblings, 1 reply; 5+ messages in thread
From: testlaster @ 2014-08-18 12:30 UTC (permalink / raw)
  To: kernelnewbies

Hi Greg

Yes I have read the book and some of it does make sense to me.

What doesnt make sense though is that my pci.h file that I have found 
/include/linux only has like 30 lines max?

None of the functions in the book are in the header.

Thanks
Testo

On 8/18/2014 10:35 AM, Greg KH wrote:
> On Mon, Aug 18, 2014 at 09:50:44AM +0200, testlaster wrote:
>> Hey Guys
>>
>> Im writing a PCI driver in Linux ( Lubuntu ). Now its not an entire
>> driver its really just a little program that will latch onto a space of
>> ram and dump the entire content of the ram into a file.
>> I have done this before in a Unix/Linux based OS and it took me quite a
>> while to figure it out.
>>
>> So at startup the configuration for the PCI is already done so I wont
>> have to do any of that myself.
>> I really just need to set a pointer to a register.
>>
>> My problem is that I cant find the functions to do that for linux.
>> I cant find similar functions to things like :
>> PCI_ATTACH()
>> pci_attach_device();
>> mmap_device_memory();
>>
>> I think that is really all I need at the moment.
>> Anybody have some ideas of where I can start looking?
> Have you read the book, Linux Device Drivers, 3rd edition, it's free
> online and has a whole chapter on PCI that should answer these questions
> for you.
>
> If not, please feel free to post your code and we will be glad to review
> it.
>
> thanks,
>
> greg k-h

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Linux PCI driver.
  2014-08-18 12:30   ` testlaster
@ 2014-08-18 12:33     ` Greg KH
  2014-08-18 13:06       ` testlaster
  0 siblings, 1 reply; 5+ messages in thread
From: Greg KH @ 2014-08-18 12:33 UTC (permalink / raw)
  To: kernelnewbies

On Mon, Aug 18, 2014 at 02:30:33PM +0200, testlaster wrote:
> Hi Greg
> 
> Yes I have read the book and some of it does make sense to me.
> 
> What doesnt make sense though is that my pci.h file that I have found
> /include/linux only has like 30 lines max?

$ wc include/linux/pci.h 
 1832  7982 65670 include/linux/pci.h

are you sure you are looking at the kernel source tree?

> None of the functions in the book are in the header.

Then I don't think you are looking at kernel source, but perhaps the
header file for libpci in userspace?

good luck,

greg k-h

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Linux PCI driver.
  2014-08-18 12:33     ` Greg KH
@ 2014-08-18 13:06       ` testlaster
  0 siblings, 0 replies; 5+ messages in thread
From: testlaster @ 2014-08-18 13:06 UTC (permalink / raw)
  To: kernelnewbies

I think you are right Greg

I eventually after looking for alternative header folders I found one 
here that seems to be more in the line of what I am looking for .

/usr/src/linux-header-3.13.0-32-generic/include/linux/pc.h .

This should work right?

On 8/18/2014 2:33 PM, Greg KH wrote:
> On Mon, Aug 18, 2014 at 02:30:33PM +0200, testlaster wrote:
>> Hi Greg
>>
>> Yes I have read the book and some of it does make sense to me.
>>
>> What doesnt make sense though is that my pci.h file that I have found
>> /include/linux only has like 30 lines max?
> $ wc include/linux/pci.h
>   1832  7982 65670 include/linux/pci.h
>
> are you sure you are looking at the kernel source tree?
>
>> None of the functions in the book are in the header.
> Then I don't think you are looking at kernel source, but perhaps the
> header file for libpci in userspace?
>
> good luck,
>
> greg k-h
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-08-18 13:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-18  7:50 Linux PCI driver testlaster
2014-08-18  8:35 ` Greg KH
2014-08-18 12:30   ` testlaster
2014-08-18 12:33     ` Greg KH
2014-08-18 13:06       ` testlaster

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).