Back to home page

LXR

 
 

    


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

0001 /**
0002  * @file
0003  *
0004  * @ingroup RTEMSBSPsSPARCLEON3
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_LEON3_BSP_H
0029 #define LIBBSP_SPARC_LEON3_BSP_H
0030 
0031 #include <bspopts.h>
0032 #include <bsp/default-initial-extension.h>
0033 
0034 #include <rtems.h>
0035 #include <rtems/irq-extension.h>
0036 
0037 #ifdef __cplusplus
0038 extern "C" {
0039 #endif
0040 
0041 /**
0042  * @defgroup RTEMSBSPsSPARCLEON3 LEON3 and LEON4
0043  *
0044  * @ingroup RTEMSBSPsSPARC
0045  *
0046  * @brief LEON3 and LEON4 Board Support Package.
0047  *
0048  * @{
0049  */
0050 
0051 /* SPARC CPU variant: LEON3 */
0052 #define LEON3 1
0053 
0054 #define BSP_FEATURE_IRQ_EXTENSION
0055 
0056 /*
0057  *  BSP provides its own Idle thread body
0058  */
0059 void *bsp_idle_thread( uintptr_t ignored );
0060 #define BSP_IDLE_TASK_BODY bsp_idle_thread
0061 
0062 /* Maximum supported APBUARTs by BSP */
0063 #define BSP_NUMBER_OF_TERMIOS_PORTS 8
0064 
0065 /*
0066  * Network driver configuration
0067  */
0068 struct rtems_bsdnet_ifconfig;
0069 extern int rtems_leon_open_eth_driver_attach(
0070   struct rtems_bsdnet_ifconfig *config,
0071   int attach
0072 );
0073 extern int rtems_smc91111_driver_attach_leon3(
0074   struct rtems_bsdnet_ifconfig *config,
0075   int attach
0076 );
0077 extern int rtems_leon_greth_driver_attach(
0078   struct rtems_bsdnet_ifconfig *config,
0079   int attach
0080 );
0081 
0082 #define RTEMS_BSP_NETWORK_DRIVER_NAME_OPENETH "open_eth1"
0083 #define RTEMS_BSP_NETWORK_DRIVER_ATTACH_OPENETH   \
0084     rtems_leon_open_eth_driver_attach
0085 #define RTEMS_BSP_NETWORK_DRIVER_NAME_SMC91111 "smc_eth1"
0086 #define RTEMS_BSP_NETWORK_DRIVER_ATTACH_SMC91111 \
0087     rtems_smc91111_driver_attach_leon3
0088 #define RTEMS_BSP_NETWORK_DRIVER_NAME_GRETH "gr_eth1"
0089 #define RTEMS_BSP_NETWORK_DRIVER_ATTACH_GRETH \
0090     rtems_leon_greth_driver_attach
0091 
0092 #ifndef RTEMS_BSP_NETWORK_DRIVER_NAME
0093 #define RTEMS_BSP_NETWORK_DRIVER_NAME   RTEMS_BSP_NETWORK_DRIVER_NAME_GRETH
0094 #define RTEMS_BSP_NETWORK_DRIVER_ATTACH RTEMS_BSP_NETWORK_DRIVER_ATTACH_GRETH
0095 #endif
0096 
0097 #define HAS_SMC91111
0098 
0099 /* Configure GRETH driver */
0100 #define GRETH_SUPPORTED
0101 #define GRETH_MEM_LOAD(addr) leon_r32_no_cache((uintptr_t)addr)
0102 
0103 extern int   CPU_SPARC_HAS_SNOOPING;
0104 
0105 /* Constants */
0106 
0107 /*
0108  *  Information placed in the linkcmds file.
0109  */
0110 
0111 extern int   RAM_START;
0112 extern int   RAM_END;
0113 extern int   RAM_SIZE;
0114 
0115 extern int   PROM_START;
0116 extern int   PROM_END;
0117 extern int   PROM_SIZE;
0118 
0119 extern int   CLOCK_SPEED;
0120 
0121 extern int   end;        /* last address in the program */
0122 
0123 /* miscellaneous stuff assumed to exist */
0124 
0125 rtems_isr_entry set_vector(                     /* returns old vector */
0126     rtems_isr_entry     handler,                /* isr routine        */
0127     rtems_vector_number vector,                 /* vector number      */
0128     int                 type                    /* RTEMS or RAW intr  */
0129 );
0130 
0131 void BSP_fatal_exit(uint32_t error);
0132 
0133 /*
0134  *  Delay for the specified number of microseconds.
0135  */
0136 void rtems_bsp_delay(int usecs);
0137 
0138 /* Interrupt Service Routine (ISR) pointer */
0139 typedef void (*bsp_shared_isr)(void *arg);
0140 
0141 /* Registers a shared IRQ handler, and enable it at IRQ controller. Multiple
0142  * interrupt handlers may use the same IRQ number, all ISRs will be called
0143  * when an interrupt on that line is fired.
0144  *
0145  * Arguments
0146  *  irq       System IRQ number
0147  *  info      Optional Name of IRQ source
0148  *  isr       Function pointer to the ISR
0149  *  arg       Second argument to function isr
0150  */
0151 RTEMS_DEPRECATED static inline int BSP_shared_interrupt_register
0152        (
0153        int irq,
0154        const char *info,
0155        bsp_shared_isr isr,
0156        void *arg
0157        )
0158 {
0159        return rtems_interrupt_handler_install(irq, info,
0160                                        RTEMS_INTERRUPT_SHARED, isr, arg);
0161 }
0162 
0163 /* Unregister previously registered shared IRQ handler.
0164  *
0165  * Arguments
0166  *  irq       System IRQ number
0167  *  isr       Function pointer to the ISR
0168  *  arg       Second argument to function isr
0169  */
0170 RTEMS_DEPRECATED static inline int BSP_shared_interrupt_unregister
0171        (
0172        int irq,
0173        bsp_shared_isr isr,
0174        void *arg
0175        )
0176 {
0177        return rtems_interrupt_handler_remove(irq, isr, arg);
0178 }
0179 
0180 /* Clear interrupt pending on IRQ controller, this is typically done on a
0181  * level triggered interrupt source such as PCI to avoid taking double IRQs.
0182  * In such a case the interrupt source must be cleared first on LEON, before
0183  * acknowledging the IRQ with this function.
0184  *
0185  * Arguments
0186  *  irq       System IRQ number
0187  */
0188 RTEMS_DEPRECATED static inline void BSP_shared_interrupt_clear( int irq )
0189 {
0190   (void) rtems_interrupt_clear( (rtems_vector_number) irq );
0191 }
0192 
0193 /* Enable Interrupt. This function will unmask the IRQ at the interrupt
0194  * controller. This is normally done by _register(). Note that this will
0195  * affect all ISRs on this IRQ.
0196  *
0197  * Arguments
0198  *  irq       System IRQ number
0199  */
0200 RTEMS_DEPRECATED static inline void BSP_shared_interrupt_unmask( int irq )
0201 {
0202   (void) rtems_interrupt_vector_enable( (rtems_vector_number) irq );
0203 }
0204 
0205 /* Disable Interrupt. This function will mask one IRQ at the interrupt
0206  * controller. This is normally done by _unregister().  Note that this will
0207  * affect all ISRs on this IRQ.
0208  *
0209  * Arguments
0210  *  irq         System IRQ number
0211  */
0212 RTEMS_DEPRECATED static inline void BSP_shared_interrupt_mask( int irq )
0213 {
0214   (void) rtems_interrupt_vector_disable( (rtems_vector_number) irq );
0215 }
0216 
0217 #if defined(RTEMS_SMP) || defined(RTEMS_MULTIPROCESSING)
0218 /* Irq used by the shared memory driver and for inter-processor interrupts.
0219  * The variable is weakly linked. Redefine the variable in your application
0220  * to override the BSP default.
0221  */
0222 extern const unsigned char LEON3_mp_irq;
0223 #endif
0224 
0225 /* Common driver build-time configurations. On small systems undefine
0226  * [DRIVER]_INFO_AVAIL to avoid info routines get dragged in. It is good
0227  * for debugging and printing information about the system, but makes the
0228  * image bigger.
0229  */
0230 #define AMBAPPBUS_INFO_AVAIL          /* AMBAPP Bus driver */
0231 #define APBUART_INFO_AVAIL            /* APBUART Console driver */
0232 #define GPTIMER_INFO_AVAIL            /* GPTIMER Timer driver */
0233 #define GRETH_INFO_AVAIL              /* GRETH Ethernet driver */
0234 
0235 #ifdef __cplusplus
0236 }
0237 #endif
0238 
0239 /** @} */
0240 
0241 #endif