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

4.115
Last change on this file since 9f058fb was 9f058fb, checked in by Daniel Cederman <cederman@…>, on 05/08/14 at 15:08:04

bsps/sparc: Change tabs to spaces.

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