source: rtems/c/src/lib/libbsp/sparc/leon2/include/bsp.h @ 8d830fae

4.115
Last change on this file since 8d830fae was 8d830fae, checked in by Radu <radustoma@…>, on 12/02/13 at 20:07:35

leon2_doxygen_1

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