Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:24:08

0001 /**
0002  * @file
0003  *
0004  * @ingroup RTEMSBSPsSPARCLEON2
0005  *
0006  * @brief Global BSP definitions.
0007  */
0008 
0009 /*  bsp.h
0010  *
0011  *  This include file contains all SPARC simulator definitions.
0012  *
0013  *  COPYRIGHT (c) 1989-1998.
0014  *  On-Line Applications Research Corporation (OAR).
0015  *
0016  *  The license and distribution terms for this file may be
0017  *  found in the file LICENSE in this distribution or at
0018  *  http://www.rtems.org/license/LICENSE.
0019  *
0020  *  Ported to ERC32 implementation of the SPARC by On-Line Applications
0021  *  Research Corporation (OAR) under contract to the European Space
0022  *  Agency (ESA).
0023  *
0024  *  ERC32 modifications of respective RTEMS file: COPYRIGHT (c) 1995.
0025  *  European Space Agency.
0026  */
0027 
0028 #ifndef LIBBSP_SPARC_LEON2_BSP_H
0029 #define LIBBSP_SPARC_LEON2_BSP_H
0030 
0031 #include <bspopts.h>
0032 #include <bsp/default-initial-extension.h>
0033 
0034 #include <rtems.h>
0035 #include <leon.h>
0036 #include <rtems/irq-extension.h>
0037 
0038 #ifdef __cplusplus
0039 extern "C" {
0040 #endif
0041 
0042 /**
0043  * @defgroup RTEMSBSPsSPARCLEON2 LEON2
0044  *
0045  * @ingroup RTEMSBSPsSPARC
0046  *
0047  * @brief LEON2 Board Support Package.
0048  *
0049  * @{
0050  */
0051 
0052 /* SPARC CPU variant: LEON2 */
0053 #define LEON2 1
0054 
0055 #define BSP_FEATURE_IRQ_EXTENSION
0056 
0057 /*
0058  *  BSP provides its own Idle thread body
0059  */
0060 void *bsp_idle_thread( uintptr_t ignored );
0061 #define BSP_IDLE_TASK_BODY bsp_idle_thread
0062 
0063 /*
0064  * Network driver configuration
0065  */
0066 struct rtems_bsdnet_ifconfig;
0067 extern int rtems_leon_open_eth_driver_attach(
0068   struct rtems_bsdnet_ifconfig *config
0069 );
0070 extern int rtems_smc91111_driver_attach_leon2(
0071   struct rtems_bsdnet_ifconfig *config
0072 );
0073 #define RTEMS_BSP_NETWORK_DRIVER_NAME "open_eth1"
0074 #define RTEMS_BSP_NETWORK_DRIVER_ATTACH_OPENETH \
0075           rtems_leon_open_eth_driver_attach
0076 #define RTEMS_BSP_NETWORK_DRIVER_ATTACH_SMC91111 \
0077           rtems_smc91111_driver_attach_leon2
0078 
0079 #define HAS_SMC91111
0080 
0081 /* Configure GRETH driver */
0082 #define GRETH_SUPPORTED
0083 #define GRETH_MEM_LOAD(addr) leon_r32_no_cache((uintptr_t) addr)
0084 
0085 /*
0086  *  The synchronous trap is an arbitrarily chosen software trap.
0087  */
0088 
0089 extern int   CPU_SPARC_HAS_SNOOPING;
0090 
0091 /* Constants */
0092 
0093 /*
0094  *  Information placed in the linkcmds file.
0095  */
0096 
0097 extern int   RAM_START;
0098 extern int   RAM_END;
0099 extern int   RAM_SIZE;
0100 
0101 extern int   PROM_START;
0102 extern int   PROM_END;
0103 extern int   PROM_SIZE;
0104 
0105 extern int   CLOCK_SPEED;
0106 
0107 extern int   end;        /* last address in the program */
0108 
0109 /* miscellaneous stuff assumed to exist */
0110 
0111 rtems_isr_entry set_vector(                     /* returns old vector */
0112     rtems_isr_entry     handler,                /* isr routine        */
0113     rtems_vector_number vector,                 /* vector number      */
0114     int                 type                    /* RTEMS or RAW intr  */
0115 );
0116 
0117 void BSP_fatal_exit(uint32_t error);
0118 
0119 /* Interrupt Service Routine (ISR) pointer */
0120 typedef void (*bsp_shared_isr)(void *arg);
0121 
0122 /* Registers a shared IRQ handler, and enable it at IRQ controller. Multiple
0123  * interrupt handlers may use the same IRQ number, all ISRs will be called
0124  * when an interrupt on that line is fired.
0125  *
0126  * Arguments
0127  *  irq       System IRQ number
0128  *  info      Optional Name of IRQ source
0129  *  isr       Function pointer to the ISR
0130  *  arg       Second argument to function isr
0131  */
0132 RTEMS_DEPRECATED static inline int BSP_shared_interrupt_register
0133        (
0134        int irq,
0135        const char *info,
0136        bsp_shared_isr isr,
0137        void *arg
0138        )
0139 {
0140        return rtems_interrupt_handler_install(irq, info,
0141                                        RTEMS_INTERRUPT_SHARED, isr, arg);
0142 }
0143 
0144 /* Unregister previously registered shared IRQ handler.
0145  *
0146  * Arguments
0147  *  irq       System IRQ number
0148  *  isr       Function pointer to the ISR
0149  *  arg       Second argument to function isr
0150  */
0151 RTEMS_DEPRECATED static inline int BSP_shared_interrupt_unregister
0152        (
0153        int irq,
0154        bsp_shared_isr isr,
0155        void *arg
0156        )
0157 {
0158        return rtems_interrupt_handler_remove(irq, isr, arg);
0159 }
0160 
0161 /* Clear interrupt pending on IRQ controller, this is typically done on a
0162  * level triggered interrupt source such as PCI to avoid taking double IRQs.
0163  * In such a case the interrupt source must be cleared first on LEON, before
0164  * acknowledging the IRQ with this function.
0165  *
0166  * Arguments
0167  *  irq       System IRQ number
0168  */
0169 RTEMS_DEPRECATED static inline void BSP_shared_interrupt_clear( int irq )
0170 {
0171   (void) rtems_interrupt_clear( (rtems_vector_number) irq );
0172 }
0173 
0174 /* Enable Interrupt. This function will unmask the IRQ at the interrupt
0175  * controller. This is normally done by _register(). Note that this will
0176  * affect all ISRs on this IRQ.
0177  *
0178  * Arguments
0179  *  irq       System IRQ number
0180  */
0181 RTEMS_DEPRECATED static inline void BSP_shared_interrupt_unmask( int irq )
0182 {
0183   (void) rtems_interrupt_vector_enable( (rtems_vector_number) irq );
0184 }
0185 
0186 /* Disable Interrupt. This function will mask one IRQ at the interrupt
0187  * controller. This is normally done by _unregister().  Note that this will
0188  * affect all ISRs on this IRQ.
0189  *
0190  * Arguments
0191  *  irq         System IRQ number
0192  */
0193 RTEMS_DEPRECATED static inline void BSP_shared_interrupt_mask( int irq )
0194 {
0195   (void) rtems_interrupt_vector_disable( (rtems_vector_number) irq );
0196 }
0197 
0198 /*
0199  * Delay method
0200  */
0201 void rtems_bsp_delay(int usecs);
0202 
0203 /*
0204  * Prototypes for BSP methods that are used across file boundaries
0205  */
0206 int cchip1_register(void);
0207 
0208 /* AT697 has PCI defined as big endian */
0209 #define BSP_PCI_BIG_ENDIAN
0210 
0211 /* Common driver build-time configurations. On small systems undefine
0212  * [DRIVER]_INFO_AVAIL to avoid info routines get dragged in. It is good
0213  * for debugging and printing information about the system, but makes the
0214  * image bigger.
0215  */
0216 #define AMBAPPBUS_INFO_AVAIL          /* AMBAPP Bus driver */
0217 #define GPTIMER_INFO_AVAIL            /* GPTIMER Timer driver */
0218 #define GRETH_INFO_AVAIL              /* GRETH Ethernet driver */
0219 
0220 void console_outbyte_polled( int port, unsigned char ch );
0221 
0222 int console_inbyte_nonblocking( int port );
0223 
0224 #ifdef __cplusplus
0225 }
0226 #endif
0227 
0228 /** @} */
0229 
0230 #endif