source: rtems/cpukit/libpci/pci/irq.h @ 71e8a5c

4.11
Last change on this file since 71e8a5c was 71e8a5c, checked in by Daniel Hellstrom <daniel@…>, on Feb 27, 2015 at 3:45:59 PM

LIBPCI: moved copyright into a single line

  • Property mode set to 100644
File size: 3.6 KB
Line 
1/* PCI IRQ Library
2 *
3 * IRQ handling does not have so much with PCI to do, this library depends
4 * on the BSP to implement shared interrupts.
5 *
6 * COPYRIGHT (c) 2010 Cobham Gaisler AB.
7 *
8 * The license and distribution terms for this file may be
9 * found in the file LICENSE in this distribution or at
10 * http://www.rtems.com/license/LICENSE.
11 */
12
13#ifndef __PCI_IRQ_H__
14#define __PCI_IRQ_H__
15
16#include <bsp.h>
17
18/* PCI Handler (ISR) called when IRQ is generated by any of the PCI devices
19 * connected to the same PCI IRQ Pin. This is been defined the same way as
20 * rtems_interrupt_handler in order for BSPs to "direct-map" the register
21 * and unregister functions rtems_interrupt_handler_install/remove
22 */
23typedef void (*pci_isr)(void *arg);
24
25/* Get assigned system IRQ to a PCI Device. If no IRQ 0 is returned */
26extern int pci_dev_irq(pci_dev_t dev);
27
28/* Register shared PCI IRQ handler, but does not enable it. The system interrupt
29 * number is read from the PCI board's PCI configuration space header iline
30 * field. The iline field is initialized by the PCI subsystem during start up,
31 * the ipin field is translated into a system IRQ and written to iline. The
32 * board's driver should use the iline field as the irq argument to this
33 * function.
34 *
35 * Arguments
36 *  irq       System IRQ number, normally taken from the PCI configuration area
37 *  isr       Function pointer to the ISR
38 *  arg       Second argument to function isr
39 */
40static inline int pci_interrupt_register(int irq, const char *info,
41                                                pci_isr isr, void *arg)
42{
43        return BSP_PCI_shared_interrupt_register(irq, info, isr, arg);
44}
45
46/* Unregister previously registered shared PCI IRQ handler
47 *
48 * Arguments
49 *  irq       System IRQ number, normally taken from the PCI configuration area
50 *  isr       Function pointer to the ISR
51 *  arg       Second argument to function isr
52 */
53static inline int pci_interrupt_unregister(int irq, pci_isr isr, void *arg)
54{
55        return BSP_PCI_shared_interrupt_unregister(irq, isr, arg);
56}
57
58/* Enable shared PCI IRQ handler. This function will unmask the interrupt
59 * controller and mark this interrupt handler ready to handle interrupts. Note
60 * that since it is a shared interrupt handler service the interrupt may
61 * already be enabled, however no calls to this specific handler is made
62 * until it is enabled.
63 *
64 * Arguments
65 *  irq       System IRQ number, normally taken from the PCI configuration area
66 *  isr       Function pointer to the ISR
67 *  arg       Second argument to function isr
68 */
69static inline void pci_interrupt_unmask(int irq)
70{
71        BSP_PCI_shared_interrupt_unmask(irq);
72}
73
74/* Disable shared PCI IRQ handler. This function will mask the interrupt
75 * controller and mark this interrupt handler not ready to receive interrupts.
76 * Note that since it is a shared interrupt handler service the interrupt may
77 * still be enabled, however no calls to this specific handler is made
78 * while it is disabled.
79 *
80 * Arguments
81 *  irq       System IRQ number, normally taken from the PCI configuration area
82 *  isr       Function pointer to the ISR
83 *  arg       Second argument to function isr
84 */
85static inline void pci_interrupt_mask(int irq)
86{
87        BSP_PCI_shared_interrupt_mask(irq);
88}
89
90/* Acknowledge the interrupt controller by writing to the interrupt controller.
91 * Note that since it is a shared interrupt handler service, clearing the
92 * interrupt source may affect other ISRs registered to this IRQ.
93 *
94 * Arguments
95 *  irq       System IRQ number, normally taken from the PCI configuration area
96 *  isr       Function pointer to the ISR
97 *  arg       Second argument to function isr
98 */
99static inline void pci_interrupt_clear(int irq)
100{
101        BSP_PCI_shared_interrupt_clear(irq);
102}
103
104#endif /* !__PCI_IRQ_H__ */
Note: See TracBrowser for help on using the repository browser.