source: rtems/c/src/lib/libbsp/sparc/erc32/include/bsp.h @ 95518e59

4.115
Last change on this file since 95518e59 was 95518e59, checked in by Daniel Hellstrom <daniel@…>, on 04/06/12 at 10:05:07

SPARC BSPs: implemented shared-irq using libbsp/shared layer

The implementation use IRQ number instead of vector number since
some IRQs does not have a unique vector, for example the extended
interrupts all enter the same trap vector entry.

Added support for the LEON3 extended interrupt controller when using
the shared IRQ layer.

ERC32 patches untested.

Signed-off-by: Daniel Hellstrom <daniel@…>

Regenerate

  • Property mode set to 100644
File size: 4.4 KB
Line 
1/*  bsp.h
2 *
3 *  This include file contains all SPARC simulator definitions.
4 *
5 *  COPYRIGHT (c) 1989-2007.
6 *  On-Line Applications Research Corporation (OAR).
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 *  Ported to ERC32 implementation of the SPARC by On-Line Applications
13 *  Research Corporation (OAR) under contract to the European Space
14 *  Agency (ESA).
15 *
16 *  ERC32 modifications of respective RTEMS file: COPYRIGHT (c) 1995.
17 *  European Space Agency.
18 */
19
20#ifndef _BSP_H
21#define _BSP_H
22
23#ifdef __cplusplus
24extern "C" {
25#endif
26
27#include <bspopts.h>
28
29#include <rtems.h>
30#include <rtems/iosupp.h>
31#include <erc32.h>
32#include <rtems/clockdrv.h>
33#include <rtems/console.h>
34#include <rtems/irq-extension.h>
35
36/*
37 *  BSP provides its own Idle thread body
38 */
39void *bsp_idle_thread( uintptr_t ignored );
40#define BSP_IDLE_TASK_BODY bsp_idle_thread
41
42/*
43 * Network driver configuration
44 */
45struct rtems_bsdnet_ifconfig;
46extern int rtems_erc32_sonic_driver_attach(
47  struct rtems_bsdnet_ifconfig *config
48);
49#define RTEMS_BSP_NETWORK_DRIVER_NAME   "sonic1"
50#define RTEMS_BSP_NETWORK_DRIVER_ATTACH rtems_erc32_sonic_driver_attach
51
52/* Constants */
53
54/*
55 *  Information placed in the linkcmds file.
56 */
57
58extern int   RAM_START;
59extern int   RAM_END;
60extern int   RAM_SIZE;
61
62extern int   PROM_START;
63extern int   PROM_END;
64extern int   PROM_SIZE;
65
66extern int   CLOCK_SPEED;
67
68extern int   end;        /* last address in the program */
69
70/* functions */
71
72rtems_isr_entry set_vector(                     /* returns old vector */
73    rtems_isr_entry     handler,                /* isr routine        */
74    rtems_vector_number vector,                 /* vector number      */
75    int                 type                    /* RTEMS or RAW intr  */
76);
77
78void BSP_fatal_return( void );
79
80void bsp_spurious_initialize( void );
81
82/* Allocate 8-byte aligned non-freeable pre-malloc() memory. The function
83 * can be called at any time. The work-area will shrink when called before
84 * bsp_get_work_area(). malloc() is called to get memory when this function
85 * is called after bsp_get_work_area().
86 */
87void *bsp_early_malloc(int size);
88
89/* Interrupt Service Routine (ISR) pointer */
90typedef void (*bsp_shared_isr)(void *arg);
91
92/* Initializes the Shared System Interrupt service */
93extern int BSP_shared_interrupt_init(void);
94
95/* Registers a shared IRQ handler, and enable it at IRQ controller. Multiple
96 * interrupt handlers may use the same IRQ number, all ISRs will be called
97 * when an interrupt on that line is fired.
98 *
99 * Arguments
100 *  irq       System IRQ number
101 *  info      Optional Name of IRQ source
102 *  isr       Function pointer to the ISR
103 *  arg       Second argument to function isr
104 */
105static __inline__ int BSP_shared_interrupt_register
106       (
107       int irq,
108       const char *info,
109       bsp_shared_isr isr,
110       void *arg
111       )
112{
113       return rtems_interrupt_handler_install(irq, info,
114                                       RTEMS_INTERRUPT_SHARED, isr, arg);
115}
116
117/* Unregister previously registered shared IRQ handler.
118 *
119 * Arguments
120 *  irq       System IRQ number
121 *  isr       Function pointer to the ISR
122 *  arg       Second argument to function isr
123 */
124static __inline__ int BSP_shared_interrupt_unregister
125       (
126       int irq,
127       bsp_shared_isr isr,
128       void *arg
129       )
130{
131       return rtems_interrupt_handler_remove(irq, isr, arg);
132}
133
134/* Clear interrupt pending on IRQ controller, this is typically done on a
135 * level triggered interrupt source such as PCI to avoid taking double IRQs.
136 * In such a case the interrupt source must be cleared first on LEON, before
137 * acknowledging the IRQ with this function.
138 *
139 * Arguments
140 *  irq       System IRQ number
141 */
142extern void BSP_shared_interrupt_clear(int irq);
143
144/* Enable Interrupt. This function will unmask the IRQ at the interrupt
145 * controller. This is normally done by _register(). Note that this will
146 * affect all ISRs on this IRQ.
147 *
148 * Arguments
149 *  irq       System IRQ number
150 */
151extern void BSP_shared_interrupt_unmask(int irq);
152
153/* Disable Interrupt. This function will mask one IRQ at the interrupt
154 * controller. This is normally done by _unregister().  Note that this will
155 * affect all ISRs on this IRQ.
156 *
157 * Arguments
158 *  irq         System IRQ number
159 */
160extern void BSP_shared_interrupt_mask(int irq);
161
162#ifdef __cplusplus
163}
164#endif
165
166#endif
Note: See TracBrowser for help on using the repository browser.