Back to home page

LXR

 
 

    


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

0001 /**
0002  * @file
0003  *
0004  * @ingroup RTEMSBSPsM68kMVME162
0005  *
0006  * @brief Global BSP definitions.
0007  */
0008 
0009 /*
0010  *  This include file contains all MVME162fx board IO definitions.
0011  */
0012 
0013 /*
0014  *  COPYRIGHT (c) 1989-2014.
0015  *  On-Line Applications Research Corporation (OAR).
0016  *
0017  *  The license and distribution terms for this file may be
0018  *  found in the file LICENSE in this distribution or at
0019  *  http://www.rtems.org/license/LICENSE.
0020  *
0021  *  Modifications of respective RTEMS file: COPYRIGHT (c) 1994.
0022  *  EISCAT Scientific Association. M.Savitski
0023  *
0024  *  This material is a part of the MVME162 Board Support Package
0025  *  for the RTEMS executive. Its licensing policies are those of the
0026  *  RTEMS above.
0027  */
0028 
0029 #ifndef LIBBSP_M68K_MVME162_BSP_H
0030 #define LIBBSP_M68K_MVME162_BSP_H
0031 
0032 /**
0033  * @defgroup RTEMSBSPsM68kMVME162 MVME162
0034  *
0035  * @ingroup RTEMSBSPsM68k
0036  *
0037  * @brief MVME162 Board Support Package.
0038  *
0039  * @{
0040  */
0041 
0042 #include <bspopts.h>
0043 #include <bsp/default-initial-extension.h>
0044 
0045 #include <rtems.h>
0046 
0047 #include <mvme16x_hw.h>
0048 
0049 #ifdef __cplusplus
0050 extern "C" {
0051 #endif
0052 
0053 /*----------------------------------------------------------------*/
0054 
0055 typedef volatile struct {
0056 
0057   unsigned char     chipID;
0058   unsigned char     chipREV;
0059   unsigned char     gen_control;
0060   unsigned char     vector_base;
0061 
0062   unsigned long     timer_cmp_1;
0063   unsigned long     timer_cnt_1;
0064   unsigned long     timer_cmp_2;
0065   unsigned long     timer_cnt_2;
0066 
0067   unsigned char     LSB_prescaler_count;
0068   unsigned char     prescaler_clock_adjust;
0069   unsigned char     time_ctl_2;
0070   unsigned char     time_ctl_1;
0071 
0072   unsigned char     time_int_ctl_4;
0073   unsigned char     time_int_ctl_3;
0074   unsigned char     time_int_ctl_2;
0075   unsigned char     time_int_ctl_1;
0076 
0077   unsigned char     dram_err_int_ctl;
0078   unsigned char     SCC_int_ctl;
0079   unsigned char     time_ctl_4;
0080   unsigned char     time_ctl_3;
0081 
0082   unsigned short    DRAM_space_base;
0083   unsigned short    SRAM_space_base;
0084 
0085   unsigned char     DRAM_size;
0086   unsigned char     DRAM_SRAM_opt;
0087   unsigned char     SRAM_size;
0088   unsigned char     reserved;
0089 
0090   unsigned char     LANC_error;
0091   unsigned char     reserved1;
0092   unsigned char     LANC_int_ctl;
0093   unsigned char     LANC_berr_ctl;
0094 
0095   unsigned char     SCSI_error;
0096   unsigned char     general_inputs;
0097   unsigned char     MVME_162_version;
0098   unsigned char     SCSI_int_ctl;
0099 
0100   unsigned long     timer_cmp_3;
0101   unsigned long     timer_cnt_3;
0102   unsigned long     timer_cmp_4;
0103   unsigned long     timer_cnt_4;
0104 
0105   unsigned char     bus_clk;
0106   unsigned char     PROM_acc_time_ctl;
0107   unsigned char     FLASH_acc_time_ctl;
0108   unsigned char     ABORT_int_ctl;
0109 
0110   unsigned char     RESET_ctl;
0111   unsigned char     watchdog_timer_ctl;
0112   unsigned char     acc_watchdog_time_base_sel;
0113   unsigned char     reserved2;
0114 
0115   unsigned char     DRAM_ctl;
0116   unsigned char     reserved4;
0117   unsigned char     MPU_status;
0118   unsigned char     reserved3;
0119 
0120   unsigned long     prescaler_count;
0121 
0122 } mcchip_regs;
0123 
0124 #define mcchip      ((mcchip_regs * const) 0xFFF42000)
0125 
0126 /*----------------------------------------------------------------*/
0127 
0128 /*
0129  * SCC Z8523(0) defines and macros
0130  * -------------------------------
0131  * Prototypes for the low-level serial io are also included here,
0132  * because such stuff is bsp-specific (yet). The function bodies
0133  * are in console.c
0134  *
0135  * NOTE from Eric Vaitl <evaitl@viasat.com>:
0136  *
0137  * I dropped RTEMS into a 162FX today (the MVME162-513). The 162FX has a
0138  * bug in the MC2 chip (revision 1) such that the SCC data register is
0139  * not accessible, it has to be accessed indirectly through the SCC
0140  * control register.
0141  */
0142 
0143 enum {portB, portA};
0144 
0145 extern bool char_ready(int port, char *ch);
0146 extern char char_wait(int port);
0147 extern void char_put(int port, char ch);
0148 
0149 #define TX_BUFFER_EMPTY   0x04
0150 #define RX_DATA_AVAILABLE 0x01
0151 #define SCC_VECTOR        0x40
0152 
0153 typedef volatile struct {
0154   unsigned char pad1;
0155   volatile unsigned char          csr;
0156   unsigned char pad2;
0157   volatile unsigned char          buf;
0158 } scc_regs;
0159 
0160 #define scc       ((scc_regs * const) 0xFFF45000)
0161 
0162 #define ZWRITE0(port, v)  (scc[port].csr = (unsigned char)(v))
0163 #define ZREAD0(port)  (scc[port].csr)
0164 
0165 #define ZREAD(port, n)  (ZWRITE0(port, n), (scc[port].csr))
0166 #define ZREADD(port)  (scc[port].csr=0x08, scc[port].csr )
0167 
0168 #define ZWRITE(port, n, v) (ZWRITE0(port, n), ZWRITE0(port, v))
0169 #define ZWRITED(port, v)  (scc[port].csr = 0x08, \
0170                            scc[port].csr = (unsigned char)(v))
0171 /*----------------------------------------------------------------*/
0172 
0173 #ifdef M162_INIT
0174 #undef EXTERN
0175 #define EXTERN
0176 #else
0177 #undef EXTERN
0178 #define EXTERN extern
0179 #endif
0180 
0181 /*
0182  *  This value is the default address location of the 162Bug vector table
0183  *  and is also the default start address of the boards DRAM.  This value
0184  *  may be different for your specific board based on a number of factors:
0185  *
0186  *     Default DRAM address:   0x00000000
0187  *     Default SRAM address:   0xFFE00000
0188  *
0189  *  o  If no DRAM can be found by the 162Bug program, it will use SRAM.
0190  *  o  The default SRAM address may be different if SRAM mezzanine boards
0191  *     are installed on the main board.
0192  *  o  Both the DRAM and SRAM addresses can be modified by changing the
0193  *     appropriate values in NVRAM using the ENV command at the 162Bug
0194  *     prompt.
0195  *
0196  *  If your board has different values than the defaults, change the value
0197  *  of the following define.
0198  *
0199  */
0200 #define MOT_162BUG_VEC_ADDRESS  0x00000000
0201 
0202 extern rtems_isr_entry M68Kvec[];   /* vector table address */
0203 
0204 /* functions */
0205 
0206 rtems_isr_entry set_vector(
0207   rtems_isr_entry     handler,
0208   rtems_vector_number vector,
0209   int                 type
0210 );
0211 
0212 /*
0213  * Prototypes for methods in the BSP that cross file boundaries.
0214  */
0215 bool char_ready(int port, char *ch);
0216 
0217 
0218 #ifdef __cplusplus
0219 }
0220 #endif
0221 
0222 /** @} */
0223 
0224 #endif