source: rtems/c/src/lib/libbsp/sparc/leon3/include/bsp.h @ dd8df59

4.11
Last change on this file since dd8df59 was dd8df59, checked in by Sebastian Huber <sebastian.huber@…>, on Nov 14, 2012 at 12:59:27 PM

bsps: Interrupt initialization error is fatal

  • Property mode set to 100644
File size: 5.4 KB
Line 
1/*  bsp.h
2 *
3 *  This include file contains all SPARC simulator definitions.
4 *
5 *  COPYRIGHT (c) 1989-1998.
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#include <bsp/default-initial-extension.h>
29
30#include <rtems.h>
31#include <leon.h>
32#include <rtems/clockdrv.h>
33#include <rtems/console.h>
34#include <rtems/irq-extension.h>
35
36/* SPARC CPU variant: LEON3 */
37#define LEON3 1
38
39/*
40 *  BSP provides its own Idle thread body
41 */
42void *bsp_idle_thread( uintptr_t ignored );
43#define BSP_IDLE_TASK_BODY bsp_idle_thread
44
45/* Maximum supported APBUARTs by BSP */
46#define BSP_NUMBER_OF_TERMIOS_PORTS 8
47
48#define BSP_RESET_BOARD_AT_EXIT 1
49
50/*
51 * Network driver configuration
52 */
53struct rtems_bsdnet_ifconfig;
54extern int rtems_leon_open_eth_driver_attach(
55  struct rtems_bsdnet_ifconfig *config,
56  int attach
57);
58extern int rtems_smc91111_driver_attach_leon3(
59  struct rtems_bsdnet_ifconfig *config,
60  int attach
61);
62extern int rtems_leon_greth_driver_attach(
63  struct rtems_bsdnet_ifconfig *config,
64  int attach
65);
66
67#define RTEMS_BSP_NETWORK_DRIVER_NAME_OPENETH   "open_eth1"
68#define RTEMS_BSP_NETWORK_DRIVER_ATTACH_OPENETH  rtems_leon_open_eth_driver_attach
69#define RTEMS_BSP_NETWORK_DRIVER_NAME_SMC91111  "smc_eth1"
70#define RTEMS_BSP_NETWORK_DRIVER_ATTACH_SMC91111 rtems_smc91111_driver_attach_leon3
71#define RTEMS_BSP_NETWORK_DRIVER_NAME_GRETH      "gr_eth1"
72#define RTEMS_BSP_NETWORK_DRIVER_ATTACH_GRETH    rtems_leon_greth_driver_attach
73
74#ifndef RTEMS_BSP_NETWORK_DRIVER_NAME
75#define RTEMS_BSP_NETWORK_DRIVER_NAME   RTEMS_BSP_NETWORK_DRIVER_NAME_GRETH
76#define RTEMS_BSP_NETWORK_DRIVER_ATTACH RTEMS_BSP_NETWORK_DRIVER_ATTACH_GRETH
77#endif
78
79#define HAS_SMC91111
80
81/* Configure GRETH driver */
82#define GRETH_SUPPORTED
83#define GRETH_MEM_LOAD(addr) leon_r32_no_cache(addr)
84
85extern int   CPU_SPARC_HAS_SNOOPING;
86
87
88/* Constants */
89
90/*
91 *  Information placed in the linkcmds file.
92 */
93
94extern int   RAM_START;
95extern int   RAM_END;
96extern int   RAM_SIZE;
97
98extern int   PROM_START;
99extern int   PROM_END;
100extern int   PROM_SIZE;
101
102extern int   CLOCK_SPEED;
103
104extern int   end;        /* last address in the program */
105
106/* miscellaneous stuff assumed to exist */
107
108rtems_isr_entry set_vector(                     /* returns old vector */
109    rtems_isr_entry     handler,                /* isr routine        */
110    rtems_vector_number vector,                 /* vector number      */
111    int                 type                    /* RTEMS or RAW intr  */
112);
113
114void BSP_fatal_return( void );
115
116void bsp_spurious_initialize( void );
117
118/* Allocate 8-byte aligned non-freeable pre-malloc() memory. The function
119 * can be called at any time. The work-area will shrink when called before
120 * bsp_work_area_initialize(). malloc() is called to get memory when this function
121 * is called after bsp_work_area_initialize().
122 */
123void *bsp_early_malloc(int size);
124
125/* Interrupt Service Routine (ISR) pointer */
126typedef void (*bsp_shared_isr)(void *arg);
127
128/* Initializes the Shared System Interrupt service */
129extern void BSP_shared_interrupt_init(void);
130
131/* Registers a shared IRQ handler, and enable it at IRQ controller. Multiple
132 * interrupt handlers may use the same IRQ number, all ISRs will be called
133 * when an interrupt on that line is fired.
134 *
135 * Arguments
136 *  irq       System IRQ number
137 *  info      Optional Name of IRQ source
138 *  isr       Function pointer to the ISR
139 *  arg       Second argument to function isr
140 */
141static __inline__ int BSP_shared_interrupt_register
142       (
143       int irq,
144       const char *info,
145       bsp_shared_isr isr,
146       void *arg
147       )
148{
149       return rtems_interrupt_handler_install(irq, info,
150                                       RTEMS_INTERRUPT_SHARED, isr, arg);
151}
152
153/* Unregister previously registered shared IRQ handler.
154 *
155 * Arguments
156 *  irq       System IRQ number
157 *  isr       Function pointer to the ISR
158 *  arg       Second argument to function isr
159 */
160static __inline__ int BSP_shared_interrupt_unregister
161       (
162       int irq,
163       bsp_shared_isr isr,
164       void *arg
165       )
166{
167       return rtems_interrupt_handler_remove(irq, isr, arg);
168}
169
170/* Clear interrupt pending on IRQ controller, this is typically done on a
171 * level triggered interrupt source such as PCI to avoid taking double IRQs.
172 * In such a case the interrupt source must be cleared first on LEON, before
173 * acknowledging the IRQ with this function.
174 *
175 * Arguments
176 *  irq       System IRQ number
177 */
178extern void BSP_shared_interrupt_clear(int irq);
179
180/* Enable Interrupt. This function will unmask the IRQ at the interrupt
181 * controller. This is normally done by _register(). Note that this will
182 * affect all ISRs on this IRQ.
183 *
184 * Arguments
185 *  irq       System IRQ number
186 */
187extern void BSP_shared_interrupt_unmask(int irq);
188
189/* Disable Interrupt. This function will mask one IRQ at the interrupt
190 * controller. This is normally done by _unregister().  Note that this will
191 * affect all ISRs on this IRQ.
192 *
193 * Arguments
194 *  irq         System IRQ number
195 */
196extern void BSP_shared_interrupt_mask(int irq);
197
198#ifdef __cplusplus
199}
200#endif
201
202#endif
203
204
Note: See TracBrowser for help on using the repository browser.