2025-08-21 17:32:36 -05:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0+-with-RTEMS-exception */
|
|
|
|
|
|
2013-12-02 14:07:35 -06:00
|
|
|
/**
|
|
|
|
|
* @file
|
2013-12-09 13:37:48 -06:00
|
|
|
*
|
2019-03-04 15:32:15 +01:00
|
|
|
* @ingroup RTEMSBSPsSPARCLEON2
|
2013-12-09 13:37:48 -06:00
|
|
|
*
|
2019-03-04 15:32:15 +01:00
|
|
|
* @brief Global BSP definitions.
|
2013-12-02 14:07:35 -06:00
|
|
|
*/
|
|
|
|
|
|
2006-01-09 10:36:06 +00:00
|
|
|
/* bsp.h
|
|
|
|
|
*
|
|
|
|
|
* This include file contains all SPARC simulator definitions.
|
|
|
|
|
*
|
|
|
|
|
* COPYRIGHT (c) 1989-1998.
|
|
|
|
|
* On-Line Applications Research Corporation (OAR).
|
|
|
|
|
*
|
|
|
|
|
* The license and distribution terms for this file may be
|
|
|
|
|
* found in the file LICENSE in this distribution or at
|
2014-03-21 08:10:47 +11:00
|
|
|
* http://www.rtems.org/license/LICENSE.
|
2006-01-09 10:36:06 +00:00
|
|
|
*
|
|
|
|
|
* Ported to ERC32 implementation of the SPARC by On-Line Applications
|
2009-11-29 15:33:28 +00:00
|
|
|
* Research Corporation (OAR) under contract to the European Space
|
2006-01-09 10:36:06 +00:00
|
|
|
* Agency (ESA).
|
|
|
|
|
*
|
2009-11-29 15:33:28 +00:00
|
|
|
* ERC32 modifications of respective RTEMS file: COPYRIGHT (c) 1995.
|
2006-01-09 10:36:06 +00:00
|
|
|
* European Space Agency.
|
|
|
|
|
*/
|
|
|
|
|
|
2015-07-16 08:40:05 -07:00
|
|
|
#ifndef LIBBSP_SPARC_LEON2_BSP_H
|
|
|
|
|
#define LIBBSP_SPARC_LEON2_BSP_H
|
2006-01-09 10:36:06 +00:00
|
|
|
|
|
|
|
|
#include <bspopts.h>
|
2012-11-14 09:59:10 +01:00
|
|
|
#include <bsp/default-initial-extension.h>
|
2006-01-09 10:36:06 +00:00
|
|
|
|
|
|
|
|
#include <rtems.h>
|
|
|
|
|
#include <leon.h>
|
2012-04-06 05:05:07 -05:00
|
|
|
#include <rtems/irq-extension.h>
|
2007-09-05 23:58:06 +00:00
|
|
|
|
2014-10-23 10:05:17 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
|
|
|
|
|
2013-12-09 13:37:48 -06:00
|
|
|
/**
|
2019-03-04 15:32:15 +01:00
|
|
|
* @defgroup RTEMSBSPsSPARCLEON2 LEON2
|
2013-12-09 13:37:48 -06:00
|
|
|
*
|
2019-03-04 15:32:15 +01:00
|
|
|
* @ingroup RTEMSBSPsSPARC
|
2013-12-09 13:37:48 -06:00
|
|
|
*
|
2019-03-04 15:32:15 +01:00
|
|
|
* @brief LEON2 Board Support Package.
|
2013-12-09 13:37:48 -06:00
|
|
|
*
|
2019-03-04 15:32:15 +01:00
|
|
|
* @{
|
2013-12-09 13:37:48 -06:00
|
|
|
*/
|
|
|
|
|
|
2007-09-05 23:58:06 +00:00
|
|
|
/* SPARC CPU variant: LEON2 */
|
|
|
|
|
#define LEON2 1
|
2009-11-29 15:33:28 +00:00
|
|
|
|
2021-06-22 15:40:39 +02:00
|
|
|
#define BSP_FEATURE_IRQ_EXTENSION
|
|
|
|
|
|
2006-01-09 10:36:06 +00:00
|
|
|
/*
|
2009-08-19 16:13:01 +00:00
|
|
|
* BSP provides its own Idle thread body
|
2006-01-09 10:36:06 +00:00
|
|
|
*/
|
2009-08-19 16:13:01 +00:00
|
|
|
void *bsp_idle_thread( uintptr_t ignored );
|
|
|
|
|
#define BSP_IDLE_TASK_BODY bsp_idle_thread
|
2006-01-09 10:36:06 +00:00
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Network driver configuration
|
|
|
|
|
*/
|
|
|
|
|
struct rtems_bsdnet_ifconfig;
|
2009-08-19 16:13:01 +00:00
|
|
|
extern int rtems_leon_open_eth_driver_attach(
|
|
|
|
|
struct rtems_bsdnet_ifconfig *config
|
|
|
|
|
);
|
|
|
|
|
extern int rtems_smc91111_driver_attach_leon2(
|
|
|
|
|
struct rtems_bsdnet_ifconfig *config
|
|
|
|
|
);
|
2014-05-08 17:08:04 +02:00
|
|
|
#define RTEMS_BSP_NETWORK_DRIVER_NAME "open_eth1"
|
2009-08-19 16:13:01 +00:00
|
|
|
#define RTEMS_BSP_NETWORK_DRIVER_ATTACH_OPENETH \
|
|
|
|
|
rtems_leon_open_eth_driver_attach
|
|
|
|
|
#define RTEMS_BSP_NETWORK_DRIVER_ATTACH_SMC91111 \
|
|
|
|
|
rtems_smc91111_driver_attach_leon2
|
2006-01-09 10:36:06 +00:00
|
|
|
|
2012-02-06 15:15:49 +01:00
|
|
|
#define HAS_SMC91111
|
|
|
|
|
|
2011-12-02 10:53:35 +01:00
|
|
|
/* Configure GRETH driver */
|
|
|
|
|
#define GRETH_SUPPORTED
|
2014-10-11 18:34:23 -05:00
|
|
|
#define GRETH_MEM_LOAD(addr) leon_r32_no_cache((uintptr_t) addr)
|
2011-12-02 10:53:35 +01:00
|
|
|
|
2006-01-09 10:36:06 +00:00
|
|
|
/*
|
|
|
|
|
* The synchronous trap is an arbitrarily chosen software trap.
|
|
|
|
|
*/
|
|
|
|
|
|
2009-08-19 16:13:01 +00:00
|
|
|
extern int CPU_SPARC_HAS_SNOOPING;
|
2006-01-09 10:36:06 +00:00
|
|
|
|
|
|
|
|
/* Constants */
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Information placed in the linkcmds file.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
extern int RAM_START;
|
|
|
|
|
extern int RAM_END;
|
|
|
|
|
extern int RAM_SIZE;
|
2009-11-29 15:33:28 +00:00
|
|
|
|
2006-01-09 10:36:06 +00:00
|
|
|
extern int PROM_START;
|
|
|
|
|
extern int PROM_END;
|
|
|
|
|
extern int PROM_SIZE;
|
|
|
|
|
|
|
|
|
|
extern int CLOCK_SPEED;
|
2009-11-29 15:33:28 +00:00
|
|
|
|
2006-01-09 10:36:06 +00:00
|
|
|
extern int end; /* last address in the program */
|
|
|
|
|
|
2025-05-16 01:43:20 +05:30
|
|
|
void SPARC_Clear_and_unmask_interrupt(rtems_vector_number vector);
|
2006-01-09 10:36:06 +00:00
|
|
|
|
2014-05-19 17:27:55 +02:00
|
|
|
void BSP_fatal_exit(uint32_t error);
|
|
|
|
|
|
2012-04-06 05:05:07 -05:00
|
|
|
/* Interrupt Service Routine (ISR) pointer */
|
|
|
|
|
typedef void (*bsp_shared_isr)(void *arg);
|
|
|
|
|
|
|
|
|
|
/* Registers a shared IRQ handler, and enable it at IRQ controller. Multiple
|
|
|
|
|
* interrupt handlers may use the same IRQ number, all ISRs will be called
|
|
|
|
|
* when an interrupt on that line is fired.
|
|
|
|
|
*
|
|
|
|
|
* Arguments
|
|
|
|
|
* irq System IRQ number
|
|
|
|
|
* info Optional Name of IRQ source
|
|
|
|
|
* isr Function pointer to the ISR
|
|
|
|
|
* arg Second argument to function isr
|
|
|
|
|
*/
|
2023-06-15 14:59:00 +02:00
|
|
|
RTEMS_DEPRECATED static inline int BSP_shared_interrupt_register
|
2012-04-06 05:05:07 -05:00
|
|
|
(
|
|
|
|
|
int irq,
|
|
|
|
|
const char *info,
|
|
|
|
|
bsp_shared_isr isr,
|
|
|
|
|
void *arg
|
|
|
|
|
)
|
|
|
|
|
{
|
|
|
|
|
return rtems_interrupt_handler_install(irq, info,
|
|
|
|
|
RTEMS_INTERRUPT_SHARED, isr, arg);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Unregister previously registered shared IRQ handler.
|
|
|
|
|
*
|
|
|
|
|
* Arguments
|
|
|
|
|
* irq System IRQ number
|
|
|
|
|
* isr Function pointer to the ISR
|
|
|
|
|
* arg Second argument to function isr
|
|
|
|
|
*/
|
2023-06-15 14:59:00 +02:00
|
|
|
RTEMS_DEPRECATED static inline int BSP_shared_interrupt_unregister
|
2012-04-06 05:05:07 -05:00
|
|
|
(
|
|
|
|
|
int irq,
|
|
|
|
|
bsp_shared_isr isr,
|
|
|
|
|
void *arg
|
|
|
|
|
)
|
|
|
|
|
{
|
|
|
|
|
return rtems_interrupt_handler_remove(irq, isr, arg);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Clear interrupt pending on IRQ controller, this is typically done on a
|
|
|
|
|
* level triggered interrupt source such as PCI to avoid taking double IRQs.
|
|
|
|
|
* In such a case the interrupt source must be cleared first on LEON, before
|
|
|
|
|
* acknowledging the IRQ with this function.
|
|
|
|
|
*
|
|
|
|
|
* Arguments
|
|
|
|
|
* irq System IRQ number
|
|
|
|
|
*/
|
2023-06-15 14:59:00 +02:00
|
|
|
RTEMS_DEPRECATED static inline void BSP_shared_interrupt_clear( int irq )
|
2023-06-15 14:44:35 +02:00
|
|
|
{
|
|
|
|
|
(void) rtems_interrupt_clear( (rtems_vector_number) irq );
|
|
|
|
|
}
|
2012-04-06 05:05:07 -05:00
|
|
|
|
|
|
|
|
/* Enable Interrupt. This function will unmask the IRQ at the interrupt
|
|
|
|
|
* controller. This is normally done by _register(). Note that this will
|
|
|
|
|
* affect all ISRs on this IRQ.
|
|
|
|
|
*
|
|
|
|
|
* Arguments
|
|
|
|
|
* irq System IRQ number
|
|
|
|
|
*/
|
2023-06-15 14:59:00 +02:00
|
|
|
RTEMS_DEPRECATED static inline void BSP_shared_interrupt_unmask( int irq )
|
2023-06-15 14:44:35 +02:00
|
|
|
{
|
|
|
|
|
(void) rtems_interrupt_vector_enable( (rtems_vector_number) irq );
|
|
|
|
|
}
|
2012-04-06 05:05:07 -05:00
|
|
|
|
|
|
|
|
/* Disable Interrupt. This function will mask one IRQ at the interrupt
|
|
|
|
|
* controller. This is normally done by _unregister(). Note that this will
|
|
|
|
|
* affect all ISRs on this IRQ.
|
|
|
|
|
*
|
|
|
|
|
* Arguments
|
|
|
|
|
* irq System IRQ number
|
|
|
|
|
*/
|
2023-06-15 14:59:00 +02:00
|
|
|
RTEMS_DEPRECATED static inline void BSP_shared_interrupt_mask( int irq )
|
2023-06-15 14:44:35 +02:00
|
|
|
{
|
|
|
|
|
(void) rtems_interrupt_vector_disable( (rtems_vector_number) irq );
|
|
|
|
|
}
|
2012-04-06 05:05:07 -05:00
|
|
|
|
2014-10-11 18:34:23 -05:00
|
|
|
/*
|
2014-10-17 08:52:33 -05:00
|
|
|
* Delay method
|
2014-10-11 18:34:23 -05:00
|
|
|
*/
|
|
|
|
|
void rtems_bsp_delay(int usecs);
|
2014-10-17 08:52:33 -05:00
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Prototypes for BSP methods that are used across file boundaries
|
|
|
|
|
*/
|
|
|
|
|
int cchip1_register(void);
|
|
|
|
|
|
2011-12-15 16:39:54 +01:00
|
|
|
/* AT697 has PCI defined as big endian */
|
|
|
|
|
#define BSP_PCI_BIG_ENDIAN
|
|
|
|
|
|
2011-12-15 17:31:17 +01:00
|
|
|
/* Common driver build-time configurations. On small systems undefine
|
|
|
|
|
* [DRIVER]_INFO_AVAIL to avoid info routines get dragged in. It is good
|
|
|
|
|
* for debugging and printing information about the system, but makes the
|
|
|
|
|
* image bigger.
|
|
|
|
|
*/
|
|
|
|
|
#define AMBAPPBUS_INFO_AVAIL /* AMBAPP Bus driver */
|
2011-12-16 10:37:49 +01:00
|
|
|
#define GPTIMER_INFO_AVAIL /* GPTIMER Timer driver */
|
2015-02-23 13:02:39 +01:00
|
|
|
#define GRETH_INFO_AVAIL /* GRETH Ethernet driver */
|
2011-12-15 17:31:17 +01:00
|
|
|
|
2018-12-05 13:02:59 +01:00
|
|
|
void console_outbyte_polled( int port, unsigned char ch );
|
|
|
|
|
|
|
|
|
|
int console_inbyte_nonblocking( int port );
|
|
|
|
|
|
2006-01-09 10:36:06 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
2019-03-04 15:32:15 +01:00
|
|
|
/** @} */
|
|
|
|
|
|
2006-01-09 10:36:06 +00:00
|
|
|
#endif
|