QNX RTOS v4 Knowledge Base
QNX RTOS v4 Knowledge Base
Title |
Writing a PCI driver for QNX4 |
Ref. No. |
QNX.000009470 |
Category(ies) |
Utilities, Development, Configuration |
Issue |
Are there any examples on how to write a PCI driver for QNX4?
|
Solution |
Yes, there are two examples of how to obtain configuration information using the watcom library functions _CA_PCI_* in the Contributed Software section of the QNX website in the path:
/usr/free/qnx4/os/utils/misc/pci_utils.tgz.
This archive contains pci_write and show_pci. Both the source and the executable are available in the archive.
Once the IRQ/ioport/memory area used by the PCI device has been found using these functions, look at the /etc/readme/technotes/shmem.txt technote on any QNX4.23 or later system, which describes how to open a shared memory object and map a region of memory of a memory object to access the PCI card.
PCI has level triggered interrupts rather than edge-triggered. This means that the interrupt must be acknowledged in the IRC-handler, otherwise the system will crash (infinite interrupts). How to acknowledge depends on the card, and should be documented -- usually it will require reading or writing to a location, often just reading a status register will do it.
PCI allows shared interrupts, so when the handler gets called it has to make sure the IRQ belongs to it. Again, this will often be done by reading a status register, which will often also acknowledge the IRQ.
PCI allows a larger range of memory to be addressed for DMA -- that is, DMA safe memory need not be below the 16M mark, so when allocating DMA safe memory with qnx_segment_alloc_flags(), or in _PMD_DMA_HIGH as well. |
|