source: rtems/c/src/lib/libbsp/sparc/shared/include/genirq.h @ e53daed

4.115
Last change on this file since e53daed was 3bb4122, checked in by Daniel Hellstrom <daniel@…>, on 02/23/15 at 12:02:39

LEON: added new drivers to the LEON2/LEON3 BSPs

Most drivers use the Driver Manager for device probing, they
work on AMBA-over-PCI systems if PCI is big-endian.

New APIs:

  • GPIO Library, interfaced to GRGPIO
  • GENIRQ, Generic interrupt service implementation helper

New GRLIB Drivers:

  • ACTEL 1553 RT, user interface is similar to 1553 BRM driver
  • GR1553 (1553 BC, RT and BM core)
  • AHBSTAT (AHB error status core)
  • GRADCDAC (Core interfacing to ADC/DAC hardware)
  • GRGPIO (GPIO port accessed from GPIO Library)
  • MCTRL (Memory controller settings configuration)
  • GRETH (10/100/1000 Ethernet driver using Driver manager)
  • GRPWM (Pulse Width Modulation core)
  • SPICTRL (SPI master interface)
  • GRSPW_ROUTER (SpaceWire? Router AMBA configuration interface)
  • GRCTM (SpaceCraft? on-board Time Management core)
  • SPWCUC (Time distribution over SpaceWire?)
  • GRTC (SpaceCraft? up-link Tele core)
  • GRTM (SpaceCraft? down-link Tele Metry core)

GR712RC ASIC specific interfaces:

  • GRASCS
  • CANMUX (select between OCCAN and SATCAN)
  • SATCAN
  • SLINK
  • Property mode set to 100644
File size: 3.2 KB
Line 
1/* General Shared Interrupt handling function interface
2 *
3 * The functions does not manipulate the IRQ controller or the
4 * interrupt level of the CPU. It simply helps the caller with
5 * managing shared interrupts where multiple interrupt routines
6 * share on interrupt vector/number.
7 *
8 * COPYRIGHT (c) 2008.
9 * Cobham Gaisler AB.
10 *
11 * The license and distribution terms for this file may be
12 * found in the file LICENSE in this distribution or at
13 * http://www.rtems.com/license/LICENSE.
14 */
15
16#ifndef __GENIRQ_H__
17#define __GENIRQ_H__
18
19#ifdef __cplusplus
20extern "C" {
21#endif
22
23typedef void (*genirq_handler)(void *arg);
24typedef void* genirq_t;
25
26struct genirq_stats {
27        unsigned int    irq_cnt;
28};
29
30/* Initialize the genirq interface. Must be the first function
31 * called.
32 *
33 * Returns zero on success, otherwise failure.
34 */
35extern genirq_t genirq_init(int number_of_irqs);
36
37/* Free the dynamically allocated memory that the genirq interface has
38 * allocated.
39 *
40 * Returns zero on success, otherwise failure.
41 */
42extern void genirq_destroy(genirq_t d);
43
44/* Check IRQ number validity
45 *
46 * Returns zero for valid IRQ numbers, -1 of invalid IRQ numbers.
47 */
48extern int genirq_check(genirq_t d, int irq);
49
50/* Register shared interrupt handler.
51 *
52 * \param irq    The interrupt number to register ISR on
53 * \param isr    The interrupt service routine called upon IRQ
54 * \param arg    The argument given to isr() when called.
55 *
56 * Return Values
57 * -1  = Failed
58 * 0   = Handler registered Successfully, first handler on this IRQ
59 * 1   = Handler registered Successfully, _not_ first handler on this IRQ
60 */
61extern int genirq_register(genirq_t d, int irq, genirq_handler isr, void *arg);
62
63/* Unregister an previous registered interrupt handler
64 *
65 * Return Values
66 *  -1 = ISR not registered before
67 *  0  = ISR unregistered
68 *  1  = Unable to unregister enabled ISR
69 */
70extern int genirq_unregister(genirq_t d, int irq, genirq_handler isr, void *arg);
71
72/* Enables IRQ only for this isr[arg] combination. Records if this
73 * is the first interrupt enable, only then must interrupts be enabled
74 * on the interrupt controller.
75 *
76 * IRQs must be disabled before entering this function.
77 *
78 * Return values
79 *  -1 = Failure, for example isr[arg] not registered on this irq
80 *  0  = IRQ must be enabled, it is the first IRQ handler to be enabled
81 *  1  = IRQ has already been enabled, either by isr[arg] or by another handler
82 */
83extern int genirq_enable(genirq_t d, int irq, genirq_handler isr, void *arg);
84
85/* Disables IRQ only for this isr[arg] combination. Records if this
86 * is the only interrupt handler that is enabled on this IRQ, only then
87 * must interrupts be disabled on the interrupt controller.
88 *
89 * IRQs must be disabled before entering this function.
90 *
91 * Return values
92 *  -1 = Failure, for example isr[arg] not registered on this irq
93 *  0  = IRQ must be disabled, no ISR are enabled for this IRQ
94 *  1  = ISR has already been disabled, or other ISRs are still enabled
95 */
96extern int genirq_disable(genirq_t d, int irq, genirq_handler isr, void *arg);
97
98/* Must be called by user when an IRQ has fired, the argument 'irq'
99 * is the IRQ number of the IRQ which was fired.
100 */
101extern void genirq_doirq(genirq_t d, int irq);
102
103#ifdef __cplusplus
104}
105#endif
106
107#endif
Note: See TracBrowser for help on using the repository browser.