Re: how to write info to a pci device

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

 



> 
> >I create a pci device which I want to interact with Linux for a user
> >application.  This pci device is a FPGA.  I create a kernel module for
> >communication kernel - user space and now I want to send settings
> >information to this pci device.
> >
> >
> >
> Ive been looking for a PCI card with a user-programmable FPGA, tell us more.
> 
> does it have a hardwired PCI interface (ie already in silicon)
> if so, it should have a pci-config-space (64 bytes, i think), and
> could be programmable thru that.
>
yes, I can't config it.

The problem is to interact with the device.  The FPGA do some calcul
and I need to change some value (register) of the algo that it
perform.

Here a partial code :

u32 io_addr;
#define SLOPE_REGISTER 0x04
...
pci_read_config_dword(dev, PCI_BASE_ADDRESS_0, &io_addr);
...
if(PCI_BASE_ADDRESS_SPACE_IO& io_addr)
{
  //here I want set a register
  u8 slope = 10;
  outb(slope  ,  io_addr + SLOPE_REGISTER );  //can I do that ??
}
 
> >I need to use (I/O memory) to do that.  But I don't how.  I can't get
> >the base address with pci_read_config and after that I am confuse.
> >
> yeah - something doesnt add up.  Does it appear in /sys ?
> 
> $> file /sys/bus/pci/devices/0000\:00\:00.0/config
> /sys/bus/pci/devices/0000:00:00.0/config: data
> 
> > I
> >think I can use both function outb or writeb to send information but I
> >don't know which is better.
> >
> >
> >
> Read LDD-3, both ch 3(chr-driver), 8-(mem) IIRC.
> 
> The choice between them is basically ioport or iomem,
> and I think its somewhat dicated by the processor.
> x86 has a separate IO-addr-space so inb, outb just work,
> 68k does not, so those boards must map IO ops into memory,
> and U must use ioremap to tell the kernel where the IO-space is.
> 
> But I dont have one of these, and U shouldnt just take my word for it.
> 
> what kind of board are u using.
> 
> >outb seem to be Intel specific and writeb need to map I/0 memory with ioremap
> >
> >
> >
> I think youve got ioremap usage backwards.
> I have intel board, im using inb,outb, and have no ioremap,
> and Im getting expected results.
> 
> >Which method is more standard for a pci device (portable)?
> >
> >On 6/22/05, Christophe Lucas <clucas@xxxxxxxxxxxxx> wrote:
> >
> >
> >>Eric Clément (clement.eric@xxxxxxxxx) wrote:
> >>
> >>
> >>>Hi,
> >>>
> >>>I know the base address (I/O memory) of my device, but I don't know
> >>>how to write information to the device.
> >>>
> >>>Which fonction shoud I use :
> >>>
> >>>outb, writeb or ... ?
> >>>
> >>>
> >>I think you should use outb();
> >>You can see how is declared writeb() for x86 :
> >>
> >>        http://lxr.linux.no/source/include/asm-i386/io.h#L165
> >>
> >>But I think you should give more information to us to be able to help
> >>you.
> >>
> >>                                                - Christophe
> >>
> >>
> >>
> >
> >--
> >Kernelnewbies: Help each other learn about the Linux kernel.
> >Archive:       http://mail.nl.linux.org/kernelnewbies/
> >FAQ:           http://kernelnewbies.org/faq/
> >
> >
> >
> 
>

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