Back to home page

LXR

 
 

    


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

0001 /**
0002  * @file
0003  *
0004  * @ingroup RTEMSBSPsSPARCERC32
0005  *
0006  * @brief Global BSP definitions.
0007  */
0008 
0009 /*
0010  *  COPYRIGHT (c) 1989-2007.
0011  *  On-Line Applications Research Corporation (OAR).
0012  *
0013  *  The license and distribution terms for this file may be
0014  *  found in the file LICENSE in this distribution or at
0015  *  http://www.rtems.org/license/LICENSE.
0016  *
0017  *  Ported to ERC32 implementation of the SPARC by On-Line Applications
0018  *  Research Corporation (OAR) under contract to the European Space
0019  *  Agency (ESA).
0020  *
0021  *  ERC32 modifications of respective RTEMS file: COPYRIGHT (c) 1995.
0022  *  European Space Agency.
0023  */
0024 
0025 #ifndef LIBBSP_SPARC_ERC32_BSP_H
0026 #define LIBBSP_SPARC_ERC32_BSP_H
0027 
0028 /**
0029  * @defgroup RTEMSBSPsSPARCERC32 ERC32
0030  *
0031  * @ingroup RTEMSBSPsSPARC
0032  *
0033  * @brief ERC32 Board Support Package.
0034  *
0035  * @{
0036  */
0037 
0038 #include <bspopts.h>
0039 #include <bsp/default-initial-extension.h>
0040 
0041 #include <rtems.h>
0042 #include <erc32.h>
0043 #include <rtems/irq-extension.h>
0044 
0045 #ifdef __cplusplus
0046 extern "C" {
0047 #endif
0048 
0049 #define BSP_FEATURE_IRQ_EXTENSION
0050 
0051 /*
0052  *  BSP provides its own Idle thread body
0053  */
0054 void *bsp_idle_thread( uintptr_t ignored );
0055 #define BSP_IDLE_TASK_BODY bsp_idle_thread
0056 
0057 /*
0058  * Network driver configuration
0059  */
0060 struct rtems_bsdnet_ifconfig;
0061 extern int rtems_erc32_sonic_driver_attach(
0062   struct rtems_bsdnet_ifconfig *config
0063 );
0064 #define RTEMS_BSP_NETWORK_DRIVER_NAME   "sonic1"
0065 #define RTEMS_BSP_NETWORK_DRIVER_ATTACH rtems_erc32_sonic_driver_attach
0066 
0067 /* Constants */
0068 
0069 /*
0070  *  Information placed in the linkcmds file.
0071  */
0072 
0073 extern int   RAM_START;
0074 extern int   RAM_END;
0075 extern int   RAM_SIZE;
0076 
0077 extern int   PROM_START;
0078 extern int   PROM_END;
0079 extern int   PROM_SIZE;
0080 
0081 extern int   CLOCK_SPEED;
0082 
0083 extern int   end;        /* last address in the program */
0084 
0085 /* functions */
0086 
0087 rtems_isr_entry set_vector(                     /* returns old vector */
0088     rtems_isr_entry     handler,                /* isr routine        */
0089     rtems_vector_number vector,                 /* vector number      */
0090     int                 type                    /* RTEMS or RAW intr  */
0091 );
0092 
0093 void BSP_fatal_exit(uint32_t error);
0094 
0095 /* Interrupt Service Routine (ISR) pointer */
0096 typedef void (*bsp_shared_isr)(void *arg);
0097 
0098 /* Registers a shared IRQ handler, and enable it at IRQ controller. Multiple
0099  * interrupt handlers may use the same IRQ number, all ISRs will be called
0100  * when an interrupt on that line is fired.
0101  *
0102  * Arguments
0103  *  irq       System IRQ number
0104  *  info      Optional Name of IRQ source
0105  *  isr       Function pointer to the ISR
0106  *  arg       Second argument to function isr
0107  */
0108 RTEMS_DEPRECATED static inline int BSP_shared_interrupt_register
0109        (
0110        int irq,
0111        const char *info,
0112        bsp_shared_isr isr,
0113        void *arg
0114        )
0115 {
0116        return rtems_interrupt_handler_install(irq, info,
0117                                        RTEMS_INTERRUPT_SHARED, isr, arg);
0118 }
0119 
0120 /* Unregister previously registered shared IRQ handler.
0121  *
0122  * Arguments
0123  *  irq       System IRQ number
0124  *  isr       Function pointer to the ISR
0125  *  arg       Second argument to function isr
0126  */
0127 RTEMS_DEPRECATED static inline int BSP_shared_interrupt_unregister
0128        (
0129        int irq,
0130        bsp_shared_isr isr,
0131        void *arg
0132        )
0133 {
0134        return rtems_interrupt_handler_remove(irq, isr, arg);
0135 }
0136 
0137 /* Clear interrupt pending on IRQ controller, this is typically done on a
0138  * level triggered interrupt source such as PCI to avoid taking double IRQs.
0139  * In such a case the interrupt source must be cleared first on LEON, before
0140  * acknowledging the IRQ with this function.
0141  *
0142  * Arguments
0143  *  irq       System IRQ number
0144  */
0145 RTEMS_DEPRECATED static inline void BSP_shared_interrupt_clear( int irq )
0146 {
0147   (void) rtems_interrupt_clear( (rtems_vector_number) irq );
0148 }
0149 
0150 /* Enable Interrupt. This function will unmask the IRQ at the interrupt
0151  * controller. This is normally done by _register(). Note that this will
0152  * affect all ISRs on this IRQ.
0153  *
0154  * Arguments
0155  *  irq       System IRQ number
0156  */
0157 RTEMS_DEPRECATED static inline void BSP_shared_interrupt_unmask( int irq )
0158 {
0159   (void) rtems_interrupt_vector_enable( (rtems_vector_number) irq );
0160 }
0161 
0162 /* Disable Interrupt. This function will mask one IRQ at the interrupt
0163  * controller. This is normally done by _unregister().  Note that this will
0164  * affect all ISRs on this IRQ.
0165  *
0166  * Arguments
0167  *  irq         System IRQ number
0168  */
0169 RTEMS_DEPRECATED static inline void BSP_shared_interrupt_mask( int irq )
0170 {
0171   (void) rtems_interrupt_vector_disable( (rtems_vector_number) irq );
0172 }
0173 
0174 /*
0175  *  Delay for the specified number of microseconds.
0176  */
0177 void rtems_bsp_delay(int usecs);
0178 
0179 /*
0180  * Prototypes for methods used across file boundaries
0181  */
0182 void console_outbyte_polled(int  port, unsigned char ch);
0183 int console_inbyte_nonblocking(int port);
0184 
0185 #ifdef __cplusplus
0186 }
0187 #endif
0188 
0189 /** @} */
0190 
0191 #endif