RTEMS 6.1-rc7
Loading...
Searching...
No Matches
irq.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-2-Clause */
2
9/*
10 * COPYRIGHT (c) 2010 Cobham Gaisler AB.
11 *
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
14 * are met:
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in the
19 * documentation and/or other materials provided with the distribution.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
25 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 * POSSIBILITY OF SUCH DAMAGE.
32 */
33
34/* IRQ handling does not have so much with PCI to do, this library depends
35 * on the BSP to implement shared interrupts.
36 */
37
38#ifndef __PCI_IRQ_H__
39#define __PCI_IRQ_H__
40
41#include <rtems/rtems/intr.h>
43
44/* PCI Handler (ISR) called when IRQ is generated by any of the PCI devices
45 * connected to the same PCI IRQ Pin. This has been defined the same way as
46 * rtems_interrupt_handler in order for BSPs to "direct-map" the register
47 * and unregister functions rtems_interrupt_handler_install/remove
48 */
49typedef void (*pci_isr)(void *arg);
50
51/* Get assigned system IRQ to a PCI Device. If no IRQ 0 is returned */
52extern int pci_dev_irq(pci_dev_t dev);
53
54/* Register shared PCI IRQ handler, but does not enable it. The system interrupt
55 * number is read from the PCI board's PCI configuration space header iline
56 * field. The iline field is initialized by the PCI subsystem during start up,
57 * the ipin field is translated into a system IRQ and written to iline. The
58 * board's driver should use the iline field as the irq argument to this
59 * function.
60 *
61 * Arguments
62 * irq System IRQ number, normally taken from the PCI configuration area
63 * isr Function pointer to the ISR
64 * arg Second argument to function isr
65 */
66static inline int pci_interrupt_register(int irq, const char *info,
67 pci_isr isr, void *arg)
68{
69 return rtems_interrupt_handler_install(irq, info,
71 arg);
72}
73
74/* Unregister previously registered shared PCI IRQ handler
75 *
76 * Arguments
77 * irq System IRQ number, normally taken from the PCI configuration area
78 * isr Function pointer to the ISR
79 * arg Second argument to function isr
80 */
81static inline int pci_interrupt_unregister(int irq, pci_isr isr,
82 void *arg)
83{
84 return rtems_interrupt_handler_remove(irq, isr, arg);
85}
86
87/* Enable shared PCI IRQ handler. This function will unmask the interrupt
88 * controller and mark this interrupt handler ready to handle interrupts. Note
89 * that since it is a shared interrupt handler service the interrupt may
90 * already be enabled, however no calls to this specific handler is made
91 * until it is enabled.
92 *
93 * Arguments
94 * irq System IRQ number, normally taken from the PCI configuration area
95 * isr Function pointer to the ISR
96 * arg Second argument to function isr
97 */
98static inline void pci_interrupt_unmask(int irq)
99{
101}
102
103/* Disable shared PCI IRQ handler. This function will mask the interrupt
104 * controller and mark this interrupt handler not ready to receive interrupts.
105 * Note that since it is a shared interrupt handler service the interrupt may
106 * still be enabled, however no calls to this specific handler is made
107 * while it is disabled.
108 *
109 * Arguments
110 * irq System IRQ number, normally taken from the PCI configuration area
111 * isr Function pointer to the ISR
112 * arg Second argument to function isr
113 */
114static inline void pci_interrupt_mask(int irq)
115{
117}
118
119/* Acknowledge the interrupt controller by writing to the interrupt controller.
120 * Note that since it is a shared interrupt handler service, clearing the
121 * interrupt source may affect other ISRs registered to this IRQ.
122 *
123 * Arguments
124 * irq System IRQ number, normally taken from the PCI configuration area
125 * isr Function pointer to the ISR
126 * arg Second argument to function isr
127 */
128static inline void pci_interrupt_clear(int irq)
129{
131}
132
133#endif /* !__PCI_IRQ_H__ */
This header file provides basic definitions used by the API and the implementation.
rtems_status_code rtems_interrupt_vector_disable(rtems_vector_number vector)
Disables the interrupt vector.
Definition: irq-enable-disable.c:94
rtems_status_code rtems_interrupt_handler_install(rtems_vector_number vector, const char *info, rtems_option options, rtems_interrupt_handler routine, void *arg)
Installs the interrupt handler routine and argument at the interrupt vector.
Definition: irq-handler-install.c:85
ISR_Vector_number rtems_vector_number
This integer type represents interrupt vector numbers.
Definition: intr.h:102
#define RTEMS_INTERRUPT_SHARED
This interrupt handler install option allows that the interrupt handler may share the interrupt vecto...
Definition: intr.h:960
rtems_status_code rtems_interrupt_handler_remove(rtems_vector_number vector, rtems_interrupt_handler routine, void *arg)
Removes the interrupt handler routine and argument from the interrupt vector.
Definition: irq-handler-remove.c:62
rtems_status_code rtems_interrupt_vector_enable(rtems_vector_number vector)
Enables the interrupt vector.
Definition: irq-enable-disable.c:85
rtems_status_code rtems_interrupt_clear(rtems_vector_number vector)
Clears the interrupt vector.
Definition: irq-raise-clear.c:92
This header file defines the Interrupt Manager API.