Retrieve PCI IRQ routing information
#include <hw/pci.h>
int pci_irq_routing_options(
IRQRoutingOptionsBuffer * buf,
uint32_t * irq );
libc
Use the -l c option to qcc to link against this library. This library is usually included automatically.
The pci_irq_routing_options() function returns the following:
Routing information is returned in a data buffer that contains an IRQ routing for each PCI device or slot.
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <inttypes.h>
#include <hw/pci.h>
#include <sys/neutrino.h>
struct {
IRQRoutingOptionsBuffer buf;
uint8_t databuf [2048];
} route_buf;
int main (void)
{
int phdl;
uint32_t irq;
if ((phdl = pci_attach (0)) == -1) {
printf ("Unable to attach - errno %s\n", strerror (errno));
exit (1);
}
memset (route_buf.databuf, 0, sizeof (route_buf.databuf));
route_buf.buf.BufferSize = sizeof (route_buf.databuf);
if (pci_irq_routing_options (&route_buf.buf, &irq) !=
PCI_SUCCESS) {
printf ("Routing option failed - errno %s\n",
strerror (errno));
exit (1);
}
printf ("PCI Irq Map = %x\n", irq);
pci_detach (phdl);
return (0);
}
| Safety: | |
|---|---|
| Cancellation point | Yes |
| Interrupt handler | No |
| Signal handler | Yes |
| Thread | Yes |