How PCI bus works in QNX

I have two question on PCI under QNX OS.

  1. How PCI bus access on the QNX?
  2. How PCI interfacing shall be done in Device driver to access PCI bus??
  1. There are two ways to access the PCI bus. You either use the in and out instructions, or you setup a DMA channel. Both of these require you running as super user and requesting I/O access from the OS before attempting it. There are utility routines for reading and setting the PCI configuration itself.

  2. Same as answer 1.

I have seen some pci examples for configuration and reading / writing. That example uses

  1. pci_attach
  2. pci_attach_device
  3. pci_read_config32
    I could not understand, how to set up a DMA channel for PCI bus ??? Can you please elaborate on DMA for PCI ??

Typically you’d create a shared memory region ( mmap () ) to DMA into. Then you pci_attach to the device, get the base address of the card and write in the register’s card to configure DMA. How that is done is device specific, you need to get the specification and start from there.