source: rtems/cpukit/libpci/pci/irq.h @ a31845f7

4.115
Last change on this file since a31845f7 was a31845f7, checked in by Daniel Hellstrom <daniel@…>, on 11/28/11 at 09:11:10

LIBPCI: added PCI layer to cpukit/libpci

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