source: rtems/bsps/sparc/include/bsp/genirq.h @ 2afb22b

5
Last change on this file since 2afb22b was 2afb22b, checked in by Chris Johns <chrisj@…>, on 12/23/17 at 07:18:56

Remove make preinstall

A speciality of the RTEMS build system was the make preinstall step. It
copied header files from arbitrary locations into the build tree. The
header files were included via the -Bsome/build/tree/path GCC command
line option.

This has at least seven problems:

  • The make preinstall step itself needs time and disk space.
  • Errors in header files show up in the build tree copy. This makes it hard for editors to open the right file to fix the error.
  • There is no clear relationship between source and build tree header files. This makes an audit of the build process difficult.
  • The visibility of all header files in the build tree makes it difficult to enforce API barriers. For example it is discouraged to use BSP-specifics in the cpukit.
  • An introduction of a new build system is difficult.
  • Include paths specified by the -B option are system headers. This may suppress warnings.
  • The parallel build had sporadic failures on some hosts.

This patch removes the make preinstall step. All installed header
files are moved to dedicated include directories in the source tree.
Let @RTEMS_CPU@ be the target architecture, e.g. arm, powerpc, sparc,
etc. Let @RTEMS_BSP_FAMILIY@ be a BSP family base directory, e.g.
erc32, imx, qoriq, etc.

The new cpukit include directories are:

  • cpukit/include
  • cpukit/score/cpu/@RTEMS_CPU@/include
  • cpukit/libnetworking

The new BSP include directories are:

  • bsps/include
  • bsps/@RTEMS_CPU@/include
  • bsps/@RTEMS_CPU@/@RTEMS_BSP_FAMILIY@/include

There are build tree include directories for generated files.

The include directory order favours the most general header file, e.g.
it is not possible to override general header files via the include path
order.

The "bootstrap -p" option was removed. The new "bootstrap -H" option
should be used to regenerate the "headers.am" files.

Update #3254.

  • Property mode set to 100644
File size: 4.5 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.org/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. Also the handlers will be freed.
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/* Allocate one ISR handler and initialize it. Input to genirq_register().
51 *
52 * \param isr    The interrupt service routine called upon IRQ
53 * \param arg    The argument given to isr() when called.
54 *
55 * Returns a pointer on success, on failure NULL is returned.
56 */
57extern void *genirq_alloc_handler(genirq_handler isr, void *arg);
58
59/* Free handler memory */
60#define genirq_free_handler(handler) free(handler)
61
62/* Register shared interrupt handler previously initialized with
63 * genirq_alloc_handler().
64 *
65 * NOTE: internal list structures are accessed and needs to be protected by
66 *       spin-locks/IRQ disable by the user to guarantee a correct behaviour.
67 *
68 * \param irq    The interrupt number to register ISR on
69 * \param handler Install the pre- allocated and initialized handler.
70 *
71 * Return Values
72 * -1  = Failed
73 * 0   = Handler registered Successfully, first handler on this IRQ
74 * 1   = Handler registered Successfully, _not_ first handler on this IRQ
75 */
76extern int genirq_register(genirq_t d, int irq, void *handler);
77
78/* Unregister an previous registered interrupt handler. It is the user's
79 * responsibility to free the handler returned by genirq_unregister().
80 *
81 * NOTE: internal list structures are accessed and needs to be protected by
82 *       spin-locks/IRQ disable by the user to guarantee a correct behaviour.
83 *
84 * Return Values
85 * NULL    = ISR not registered before or unable to unregister enabled ISR
86 * Pointer = ISR sucessfully unregistered. Returned is the handler pointer
87 *           previously allocated with genirq_alloc_handler().
88 */
89extern void *genirq_unregister(genirq_t d, int irq,
90                                genirq_handler isr, void *arg);
91
92/* Enables IRQ only for this isr[arg] combination. Records if this
93 * is the first interrupt enable, only then must interrupts be enabled
94 * on the interrupt controller.
95 *
96 * NOTE: internal list structures are accessed and needs to be protected by
97 *       spin-locks/IRQ disable by the user to guarantee a correct behaviour.
98 *
99 * Return values
100 *  -1 = Failure, for example isr[arg] not registered on this irq
101 *  0  = IRQ must be enabled, it is the first IRQ handler to be enabled
102 *  1  = IRQ has already been enabled, either by isr[arg] or by another handler
103 */
104extern int genirq_enable(genirq_t d, int irq, genirq_handler isr, void *arg);
105
106/* Disables IRQ only for this isr[arg] combination. Records if this
107 * is the only interrupt handler that is enabled on this IRQ, only then
108 * must interrupts be disabled on the interrupt controller.
109 *
110 * NOTE: internal list structures are accessed and needs to be protected by
111 *       spin-locks/IRQ disable by the user to guarantee a correct behaviour.
112 *
113 * Return values
114 *  -1 = Failure, for example isr[arg] not registered on this irq
115 *  0  = IRQ must be disabled, no ISR are enabled for this IRQ
116 *  1  = ISR has already been disabled, or other ISRs are still enabled
117 */
118extern int genirq_disable(genirq_t d, int irq, genirq_handler isr, void *arg);
119
120/* Must be called by user when an IRQ has fired, the argument 'irq'
121 * is the IRQ number of the IRQ which was fired.
122 *
123 * NOTE: internal list structures are accessed and needs to be protected by
124 *       spin-locks/IRQ disable by the user to guarantee a correct behaviour.
125 */
126extern void genirq_doirq(genirq_t d, int irq);
127
128#ifdef __cplusplus
129}
130#endif
131
132#endif
Note: See TracBrowser for help on using the repository browser.