Re: Basic PCI driver questions

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

 



On Fri, Jan 06, 2006 at 05:48:11PM -0500, Medeiros Edward M NPRI wrote:
> 1.	Is a PCI driver always the best choice for a PCI board?  Why not
> write a "block" driver or a "char" driver?

You have to use the PCI api to access the hardware.  This has nothing to
do with the user interface to the driver, which can be block, char,
network, or just plain sysfs if you want.

> 2.   Is there a mechanism for a user-space process to control/access
> a PCI driver like the "ioctl" call for a char driver?

No, again, char and ioctl is totally separate from the pci api.

> 3.	I mentioned that my board does DMA.  I am calling
> "pci_alloc_consistent()"  in my "probe()" function to allow my board
> to DMA data into a kernel space buffer.
> 
> Then I assume that I need to call a function something like
> "move_to_user()" to pass the data to user-space for processing.  Is
> there a way to DMA directly to user-space without double buffering?

See the infiniband drivers for some hacks on how you might be able to do
this.

> 4.  How can I alert a user-space process when there is new data
> available from the PCI board?   I was looking at the "top half" and
> "bottom half"  sections in the driver book and contemplating using a
> "bottom half" process to move the data to user-space but I don't know
> how to alert a user-space process it has new data in its buffer to
> process.    What about synchronization?   Could the function
> "wait_event_interruptable()"  play a role here?

It all depends on how you want to interact with your device, on how you
want to notify userspace.  char and block and network all notify
userspace in different ways.

> 5.  Has anyone done this before?  Is there example driver source code
> that I might have overlooked?  

The kernel source tree has a _lot_ of different drivers.  Odds are
someone there has done it before.

good luck,

greg k-h

--
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