RE: Passing user-space addr. to PCI driver?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

Thank you for your reply.  I am not implementing either a "block" or "char" driver but rather a PCI device driver based on "pci_skel.c" from the "Linux Device Drivers, 3rd edition" book.  "pci_skel.c" has "probe()", "remove()", "init()", and "exit()" functions only and no "ioctl" functionality.  It is unclear to me how I can use a function like "copy_to_user()" that requires a user-space destination address with this type of driver.....Any suggestions?

Thank you

-----Original Message-----
From: Bernd Petrovitsch [mailto:bernd@xxxxxxxxx] 
Sent: Wednesday, January 11, 2006 4:40 PM
To: Medeiros Edward M NPRI
Cc: 'kernelnewbies@xxxxxxxxxxxx'
Subject: Re: Passing user-space addr. to PCI driver?

On Wed, 2006-01-11 at 15:45 -0500, Medeiros Edward M NPRI wrote:
[...]
> I need to perform a "copy_to_user()" call in my PCI device driver.  I
> need to do this to make available the data acquired by my PCI device
> to a user-space DSP routine.    "copy_to_user()"  has an input
> parameter that is the address of the user-space buffer   My question
> is how can I pass this user-space buffer address to my PCI device
> driver?   Alternatively,  if I get_user_pages in my device driver and

User-space is doing a read(2), write(2), mmap(2) or ioctl(2) call where
it may/must pass the buffers address and the size. 
You are probably implementing a char or block device driver for this
secret PCI card.
Your block/char driver has to provide some functions ahich are called
for open(2) and several other sys-calls (including the above mentioned
ones) and there you get the user-space pointer.

See Rubini's book for simple char and block drivers (or in the kernel
source).

	Bernd
-- 
Firmix Software GmbH                   http://www.firmix.at/
mobil: +43 664 4416156                 fax: +43 1 7890849-55
          Embedded Linux Development and Services



--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux