Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:23:50

0001 /* SPDX-License-Identifier: BSD-2-Clause */
0002 
0003 /**
0004  * @file
0005  *
0006  * @ingroup RTEMSBSPsMIPSMalta
0007  *
0008  * @brief Global BSP definitions.
0009  */
0010 
0011 /*
0012  *  COPYRIGHT (c) 1989-2012.
0013  *  On-Line Applications Research Corporation (OAR).
0014  *
0015  * Redistribution and use in source and binary forms, with or without
0016  * modification, are permitted provided that the following conditions
0017  * are met:
0018  * 1. Redistributions of source code must retain the above copyright
0019  *    notice, this list of conditions and the following disclaimer.
0020  * 2. Redistributions in binary form must reproduce the above copyright
0021  *    notice, this list of conditions and the following disclaimer in the
0022  *    documentation and/or other materials provided with the distribution.
0023  *
0024  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
0025  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
0026  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
0027  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
0028  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
0029  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
0030  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
0031  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
0032  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
0033  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
0034  * POSSIBILITY OF SUCH DAMAGE.
0035  */
0036 
0037 #ifndef LIBBSP_MIPS_MALTA_BSP_H
0038 #define LIBBSP_MIPS_MALTA_BSP_H
0039 
0040 /**
0041  * @defgroup RTEMSBSPsMIPSMalta Malta
0042  *
0043  * @ingroup RTEMSBSPsMIPS
0044  *
0045  * @brief Malta Board Support Package.
0046  *
0047  * @{
0048  */
0049 
0050 #ifndef ASM
0051 
0052 #include <bspopts.h>
0053 #include <bsp/default-initial-extension.h>
0054 
0055 #include <rtems.h>
0056 
0057 #ifdef __cplusplus
0058 extern "C" {
0059 #endif
0060 
0061 #define BSP_FEATURE_IRQ_EXTENSION
0062 #define BSP_SHARED_HANDLER_SUPPORT      1
0063 
0064 #define REVISION_REGISTER_ADDRESS  0x1fc00010
0065 #define PRORV_MASK       0x0000000f   /* 4 bit Product Revision */
0066 #define PROID_MASK       0x000000f0   /* 4 bit Product ID */
0067 #define CORRV_MASK       0x00000300   /* 2 bit Core Board Revision */
0068 #define CORID_MASK       0x0000fc00   /* 6 bit Core Board ID */
0069 #define FPGRV_MASK       0x00ff0000   /* 8 bit CBUS FPGA Revision */
0070 #define BSP_8259_BASE_ADDRESS    (0x18000000UL | 0xa0000000UL)
0071 #define BSP_PCI_BASE_ADDRESS     (0x1be00000UL | 0xa0000000UL)
0072 #define BSP_NIC_IO_BASE          (0x10000000UL | 0xa0000000UL)
0073 #define PCI0_IO_BASE             (0x18000000UL | 0xa0000000UL)
0074 #define BSP_NIC_MEM_BASE         (0x00000000UL | 0xa0000000UL)
0075 
0076 /* functions */
0077 #define WRITE_PROTECTED_UINT8( _addr, _value ) \
0078         do { \
0079           volatile uint8_t *_ptr = _addr | 0x80000000; \
0080           *_ptr = _value; \
0081         }
0082 #define WRITE_PROTECTED_UINT16( _addr, _value ) \
0083         do { \
0084           volatile uint16_t *_ptr = _addr | 0x80000000; \
0085           *_ptr = _value; \
0086         }
0087 #define WRITE_PROTECTED_UINT32( _addr, _value ) \
0088         do { \
0089           volatile uint32_t *_ptr = _addr | 0x80000000; \
0090           *_ptr = _value; \
0091         }
0092 #define READ_PROTECTED_UINT8( _addr, _value ) \
0093         do { \
0094           volatile uint8_t *_ptr = _addr | 0x80000000; \
0095          _value = *_ptr; \
0096         }
0097 #define READ_PROTECTED_UINT16( _addr, _value ) \
0098         do { \
0099           volatile uint16_t *_ptr = _addr | 0x80000000; \
0100          _value = *_ptr; \
0101         }
0102 #define READ_PROTECTED_UINT32( _addr, _value ) \
0103         do { \
0104           volatile uint32_t *_ptr = _addr | 0x80000000; \
0105          _value = *_ptr; \
0106         }
0107 
0108 #define READ_UINT8( _register_, _value_ ) \
0109         ((_value_) = *((volatile unsigned char *)(_register_)))
0110 
0111 #define WRITE_UINT8( _register_, _value_ ) \
0112         (*((volatile unsigned char *)(_register_)) = (_value_))
0113 
0114 #define READ_UINT16( _register_, _value_ ) \
0115      ((_value_) = *((volatile unsigned short *)(_register_)))
0116 
0117 #define WRITE_UINT16( _register_, _value_ ) \
0118      (*((volatile unsigned short *)(_register_)) = (_value_))
0119 
0120 void simple_out_32(uint32_t base, uint32_t addr, uint32_t val);
0121 void simple_out_le32(uint32_t base, uint32_t addr, uint32_t val);
0122 uint8_t simple_in_8( uint32_t base, uint32_t addr );
0123 void simple_out_8( uint32_t base, uint32_t addr, uint8_t val );
0124 int16_t simple_in_le16( uint32_t base, uint32_t addr );
0125 int16_t simple_in_16( uint32_t base, uint32_t addr );
0126 uint32_t simple_in_le32( uint32_t base, uint32_t addr );
0127 uint32_t simple_in_32( uint32_t base, uint32_t addr );
0128 void simple_out_le16( uint32_t base, uint32_t addr, uint16_t val );
0129 void simple_out_16( uint32_t base, uint32_t addr, uint16_t val );
0130 
0131 /*
0132  * Prototypes for methods called from .S for dependency tracking
0133  */
0134 void init_tlb(void);
0135 void resettlb(int i);
0136 
0137 #ifdef __cplusplus
0138 }
0139 #endif
0140 
0141 #endif /* !ASM */
0142 
0143 /** @} */
0144 
0145 #endif