Home | History | Annotate | Line # | Download | only in sh3
sh_arch.cpp revision 1.2
      1  1.2  uch /*	$NetBSD: sh_arch.cpp,v 1.2 2001/02/21 16:01:54 uch Exp $	*/
      2  1.1  uch 
      3  1.1  uch /*-
      4  1.1  uch  * Copyright (c) 2001 The NetBSD Foundation, Inc.
      5  1.1  uch  * All rights reserved.
      6  1.1  uch  *
      7  1.1  uch  * This code is derived from software contributed to The NetBSD Foundation
      8  1.1  uch  * by UCHIYAMA Yasushi.
      9  1.1  uch  *
     10  1.1  uch  * Redistribution and use in source and binary forms, with or without
     11  1.1  uch  * modification, are permitted provided that the following conditions
     12  1.1  uch  * are met:
     13  1.1  uch  * 1. Redistributions of source code must retain the above copyright
     14  1.1  uch  *    notice, this list of conditions and the following disclaimer.
     15  1.1  uch  * 2. Redistributions in binary form must reproduce the above copyright
     16  1.1  uch  *    notice, this list of conditions and the following disclaimer in the
     17  1.1  uch  *    documentation and/or other materials provided with the distribution.
     18  1.1  uch  * 3. All advertising materials mentioning features or use of this software
     19  1.1  uch  *    must display the following acknowledgement:
     20  1.1  uch  *        This product includes software developed by the NetBSD
     21  1.1  uch  *        Foundation, Inc. and its contributors.
     22  1.1  uch  * 4. Neither the name of The NetBSD Foundation nor the names of its
     23  1.1  uch  *    contributors may be used to endorse or promote products derived
     24  1.1  uch  *    from this software without specific prior written permission.
     25  1.1  uch  *
     26  1.1  uch  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     27  1.1  uch  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     28  1.1  uch  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     29  1.1  uch  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     30  1.1  uch  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     31  1.1  uch  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     32  1.1  uch  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     33  1.1  uch  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     34  1.1  uch  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     35  1.1  uch  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     36  1.1  uch  * POSSIBILITY OF SUCH DAMAGE.
     37  1.1  uch  */
     38  1.1  uch 
     39  1.2  uch #include <hpcmenu.h>
     40  1.1  uch #include <sh3/sh_arch.h>
     41  1.2  uch #include <sh3/hd64461.h>
     42  1.1  uch #include "scifreg.h"
     43  1.1  uch 
     44  1.1  uch struct SHArchitecture::intr_priority SHArchitecture::ipr_table[] = {
     45  1.1  uch 	{ "TMU0",	ICU_IPRA_REG16, 12 },
     46  1.1  uch 	{ "TMU1",	ICU_IPRA_REG16,  8 },
     47  1.1  uch 	{ "TMU2",	ICU_IPRA_REG16,  4 },
     48  1.1  uch 	{ "RTC",	ICU_IPRA_REG16,  0 },
     49  1.1  uch 	{ "WDT",	ICU_IPRB_REG16, 12 },
     50  1.1  uch 	{ "REF",	ICU_IPRB_REG16,  8 },
     51  1.1  uch 	{ "SCI",	ICU_IPRB_REG16,  4 },
     52  1.1  uch 	{ "reserve",	ICU_IPRB_REG16,  0 },
     53  1.1  uch 	{ "IRQ3",	ICU_IPRC_REG16, 12 },
     54  1.1  uch 	{ "IRQ2",	ICU_IPRC_REG16,  8 },
     55  1.1  uch 	{ "IRQ1",	ICU_IPRC_REG16,  4 },
     56  1.1  uch 	{ "IRQ0",	ICU_IPRC_REG16,  0 },
     57  1.1  uch 	{ "PINT0-7",	ICU_IPRD_REG16, 12 },
     58  1.1  uch 	{ "PINT8-15",	ICU_IPRD_REG16,  8 },
     59  1.1  uch 	{ "IRQ5",	ICU_IPRD_REG16,  4 },
     60  1.1  uch 	{ "IRQ4",	ICU_IPRD_REG16,  0 },
     61  1.1  uch 	{ "DMAC",	ICU_IPRE_REG16, 12 },
     62  1.1  uch 	{ "IrDA",	ICU_IPRE_REG16,  8 },
     63  1.1  uch 	{ "SCIF",	ICU_IPRE_REG16,  4 },
     64  1.1  uch 	{ "ADC",	ICU_IPRE_REG16,  0 },
     65  1.1  uch 	{ 0, 0, 0} /* terminator */
     66  1.1  uch };
     67  1.1  uch 
     68  1.1  uch BOOL
     69  1.1  uch SHArchitecture::init(void)
     70  1.1  uch {
     71  1.1  uch 	if (!_mem->init()) {
     72  1.1  uch 		DPRINTF((TEXT("can't initialize memory manager.\n")));
     73  1.1  uch 		return FALSE;
     74  1.1  uch 	}
     75  1.1  uch 	// set D-RAM information
     76  1.1  uch 	_mem->loadBank(DRAM_BANK0_START, DRAM_BANK_SIZE);
     77  1.1  uch 	_mem->loadBank(DRAM_BANK1_START, DRAM_BANK_SIZE);
     78  1.1  uch 
     79  1.1  uch 	return TRUE;
     80  1.1  uch }
     81  1.1  uch 
     82  1.1  uch BOOL
     83  1.1  uch SHArchitecture::setupLoader()
     84  1.1  uch {
     85  1.1  uch 	vaddr_t v;
     86  1.1  uch 
     87  1.1  uch 	if (!_mem->getPage(v , _loader_addr)) {
     88  1.1  uch 		DPRINTF((TEXT("can't get page for 2nd loader.\n")));
     89  1.1  uch 		return FALSE;
     90  1.1  uch 	}
     91  1.1  uch 	DPRINTF((TEXT("2nd bootloader vaddr=0x%08x paddr=0x%08x\n"),
     92  1.1  uch 		 (unsigned)v,(unsigned)_loader_addr));
     93  1.1  uch 
     94  1.1  uch 	memcpy(LPVOID(v), LPVOID(_boot_func), _mem->getPageSize());
     95  1.1  uch 	DPRINTF((TEXT("2nd bootloader copy done.\n")));
     96  1.1  uch 
     97  1.1  uch 	return TRUE;
     98  1.1  uch }
     99  1.1  uch 
    100  1.1  uch void
    101  1.1  uch SHArchitecture::jump(paddr_t info, paddr_t pvec)
    102  1.1  uch {
    103  1.1  uch 	kaddr_t sp;
    104  1.1  uch 	vaddr_t v;
    105  1.1  uch 	paddr_t p;
    106  1.1  uch 
    107  1.1  uch 	// stack for bootloader
    108  1.1  uch 	_mem->getPage(v, p);
    109  1.1  uch 	sp = ptokv(p + _mem->getPageSize() / 2);
    110  1.1  uch 
    111  1.1  uch 	info = ptokv(info);
    112  1.1  uch 	pvec = ptokv(pvec);
    113  1.1  uch 	_loader_addr = ptokv(_loader_addr);
    114  1.1  uch 	DPRINTF((TEXT("BootArgs 0x%08x Stack 0x%08x\nBooting kernel...\n"),
    115  1.1  uch 		 info, sp));
    116  1.1  uch 
    117  1.1  uch 	// Change to privilege-mode.
    118  1.1  uch 	SetKMode(1);
    119  1.1  uch 
    120  1.1  uch 	// Disable external interrupt.
    121  1.1  uch 	suspendIntr();
    122  1.1  uch 
    123  1.1  uch 	// Cache flush(for 2nd bootloader)
    124  1.1  uch 	cache_flush();
    125  1.1  uch 
    126  1.1  uch 	// jump to 2nd loader.(run P1) at this time I still use MMU.
    127  1.1  uch 	__asm("mov	r6, r15\n"
    128  1.1  uch 	      "jmp	@r7\n"
    129  1.1  uch 	      "nop\n", info, pvec, sp, _loader_addr);
    130  1.1  uch 	// NOTREACHED
    131  1.1  uch }
    132  1.1  uch 
    133  1.1  uch // disable external interrupt and save its priority.
    134  1.1  uch u_int32_t
    135  1.1  uch suspendIntr(void)
    136  1.1  uch {
    137  1.1  uch 	u_int32_t sr;
    138  1.1  uch 	__asm("stc	sr, r0\n"
    139  1.1  uch 	      "mov.l	r0, @r4\n"
    140  1.1  uch 	      "or	r5, r0\n"
    141  1.1  uch 	      "ldc	r0, sr\n", &sr, 0x000000f0);
    142  1.1  uch 	return sr & 0x000000f0;
    143  1.1  uch }
    144  1.1  uch 
    145  1.1  uch // resume external interrupt priority.
    146  1.1  uch void
    147  1.1  uch resumeIntr(u_int32_t s)
    148  1.1  uch {
    149  1.1  uch 	__asm("stc	sr, r0\n"
    150  1.1  uch 	      "and	r5, r0\n"
    151  1.1  uch 	      "or	r4, r0\n"
    152  1.1  uch 	      "ldc	r0, sr\n", s, 0xffffff0f);
    153  1.1  uch }
    154  1.1  uch 
    155  1.1  uch void
    156  1.1  uch SHArchitecture::print_stack_pointer(void)
    157  1.1  uch {
    158  1.1  uch 	int sp;
    159  1.1  uch 	__asm("mov.l	r15, @r4", &sp);
    160  1.1  uch 	DPRINTF((TEXT("SP 0x%08x\n"), sp));
    161  1.1  uch }
    162  1.1  uch 
    163  1.1  uch void
    164  1.1  uch SHArchitecture::systemInfo()
    165  1.1  uch {
    166  1.1  uch 	u_int32_t reg;
    167  1.1  uch 
    168  1.1  uch 	Architecture::systemInfo();
    169  1.1  uch 
    170  1.1  uch 	_kmode = SetKMode(1);
    171  1.1  uch 
    172  1.1  uch 	// Cache
    173  1.1  uch 	reg = VOLATILE_REF(CCR);
    174  1.1  uch 	DPRINTF((TEXT("Cache ")));
    175  1.1  uch 	if (reg & CCR_CE)
    176  1.1  uch 		DPRINTF((TEXT("Enabled. %s-mode, P0/U0/P3 Write-%s, P1 Write-%s\n"),
    177  1.1  uch 			 reg & CCR_RA ? TEXT("RAM") : TEXT("normal"),
    178  1.1  uch 			 reg & CCR_WT ? TEXT("Through") : TEXT("Back"),
    179  1.1  uch 			 reg & CCR_CB ? TEXT("Back") : TEXT("Through")));
    180  1.1  uch 	else
    181  1.1  uch 		DPRINTF((TEXT("Disabled.\n")));
    182  1.1  uch 
    183  1.1  uch 	// MMU
    184  1.1  uch 	reg = VOLATILE_REF(MMUCR);
    185  1.1  uch 	DPRINTF((TEXT("MMU ")));
    186  1.1  uch 	if (reg & MMUCR_AT)
    187  1.1  uch 		DPRINTF((TEXT("Enabled. %s index-mode, %s virtual storage mode\n"),
    188  1.1  uch 			 reg & MMUCR_IX
    189  1.1  uch 			 ? TEXT("ASID + VPN") : TEXT("VPN only"),
    190  1.1  uch 			 reg & MMUCR_SV ? TEXT("single") : TEXT("multiple")));
    191  1.1  uch 	else
    192  1.1  uch 		DPRINTF((TEXT("Disabled.\n")));
    193  1.1  uch 
    194  1.1  uch 	// Status register
    195  1.1  uch 	reg = 0;
    196  1.1  uch 	__asm("stc	sr, r0\n"
    197  1.1  uch 	      "mov.l	r0, @r4", &reg);
    198  1.1  uch 	DPRINTF((TEXT("SR 0x%08x\n"), reg));
    199  1.1  uch 
    200  1.2  uch 	// BSC
    201  1.2  uch 	bsc_dump();
    202  1.2  uch 
    203  1.1  uch 	// ICU
    204  1.1  uch 	print_stack_pointer();
    205  1.1  uch 	icu_dump();
    206  1.1  uch 
    207  1.2  uch 	// PFC , I/O port
    208  1.2  uch 	pfc_dump();
    209  1.2  uch 
    210  1.2  uch 	// SCIF
    211  1.2  uch 	scif_dump(19200);
    212  1.2  uch 
    213  1.2  uch 	// HD64461
    214  1.2  uch 	platid_t platform;
    215  1.2  uch 	HpcMenuInterface &menu = HpcMenuInterface::Instance();
    216  1.2  uch 	platform.dw.dw0 = menu._pref.platid_hi;
    217  1.2  uch 	platform.dw.dw1 = menu._pref.platid_lo;
    218  1.2  uch 	hd64461_dump(platform);
    219  1.1  uch 
    220  1.1  uch 	SetKMode(_kmode);
    221  1.1  uch }
    222  1.1  uch 
    223  1.1  uch void
    224  1.1  uch SHArchitecture::icu_dump(void)
    225  1.1  uch {
    226  1.2  uch 	DPRINTF((TEXT("<<<Interrupt Controller>>>\n")));
    227  1.1  uch 	print_stack_pointer();
    228  1.1  uch 
    229  1.2  uch 	DPRINTF((TEXT("ICR0   0x%08x\n"), reg_read_2(ICU_ICR0_REG16)));
    230  1.2  uch 	DPRINTF((TEXT("ICR1   0x%08x\n"), reg_read_2(ICU_ICR1_REG16)));
    231  1.2  uch 	DPRINTF((TEXT("ICR2   0x%08x\n"), reg_read_2(ICU_ICR2_REG16)));
    232  1.2  uch 	DPRINTF((TEXT("PINTER 0x%08x\n"), reg_read_2(ICU_PINTER_REG16)));
    233  1.2  uch 	DPRINTF((TEXT("IPRA   0x%08x\n"), reg_read_2(ICU_IPRA_REG16)));
    234  1.2  uch 	DPRINTF((TEXT("IPRB   0x%08x\n"), reg_read_2(ICU_IPRB_REG16)));
    235  1.2  uch 	DPRINTF((TEXT("IPRC   0x%08x\n"), reg_read_2(ICU_IPRC_REG16)));
    236  1.2  uch 	DPRINTF((TEXT("IPRD   0x%08x\n"), reg_read_2(ICU_IPRD_REG16)));
    237  1.2  uch 	DPRINTF((TEXT("IPRE   0x%08x\n"), reg_read_2(ICU_IPRE_REG16)));
    238  1.2  uch 	DPRINTF((TEXT("IRR0   0x%08x\n"), reg_read_1(ICU_IRR0_REG8)));
    239  1.2  uch 	DPRINTF((TEXT("IRR1   0x%08x\n"), reg_read_1(ICU_IRR1_REG8)));
    240  1.2  uch 	DPRINTF((TEXT("IRR2   0x%08x\n"), reg_read_1(ICU_IRR2_REG8)));
    241  1.1  uch 	icu_control();
    242  1.1  uch 	icu_priority();
    243  1.1  uch }
    244  1.1  uch 
    245  1.1  uch void
    246  1.1  uch SHArchitecture::icu_priority(void)
    247  1.1  uch {
    248  1.1  uch 	struct intr_priority *tab;
    249  1.1  uch 	DPRINTF((TEXT("----interrupt priority----\n")));
    250  1.1  uch 	for (tab = ipr_table; tab->name; tab++) {
    251  1.1  uch 		DPRINTF((TEXT("%-10S %d\n"), tab->name,
    252  1.2  uch 			 (reg_read_2(tab->reg) >> tab->shift) & ICU_IPR_MASK));
    253  1.1  uch 	}
    254  1.1  uch 	DPRINTF((TEXT("--------------------------\n")));
    255  1.1  uch }
    256  1.1  uch 
    257  1.1  uch void
    258  1.1  uch SHArchitecture::icu_control(void)
    259  1.1  uch {
    260  1.1  uch 	const char *sense_select[] = {
    261  1.1  uch 		"falling edge",
    262  1.1  uch 		"raising edge",
    263  1.1  uch 		"low level",
    264  1.1  uch 		"reserved",
    265  1.1  uch 	};
    266  1.1  uch 	u_int16_t r;
    267  1.2  uch 
    268  1.1  uch 	// PINT0-15
    269  1.1  uch 	DPRINTF((TEXT("PINT enable(on |)  :")));
    270  1.2  uch 	bitdisp(reg_read_2(ICU_PINTER_REG16));
    271  1.1  uch 	DPRINTF((TEXT("PINT detect(high |):")));
    272  1.2  uch 	bitdisp(reg_read_2(ICU_ICR2_REG16));
    273  1.1  uch 	// NMI
    274  1.2  uch 	r = reg_read_2(ICU_ICR0_REG16);
    275  1.1  uch 	DPRINTF((TEXT("NMI(%S %S-edge),"),
    276  1.1  uch 		 r & ICU_ICR0_NMIL ? "High" : "Low",
    277  1.1  uch 		 r & ICU_ICR0_NMIE ? "raising" : "falling"));
    278  1.2  uch 	r = reg_read_2(ICU_ICR1_REG16);
    279  1.1  uch 	DPRINTF((TEXT(" %S maskable,"), r & ICU_ICR1_MAI ? "" : "never"));
    280  1.1  uch 	DPRINTF((TEXT("  SR.BL %S\n"),
    281  1.1  uch 		 r & ICU_ICR1_BLMSK ? "ignored" : "maskable"));
    282  1.1  uch 	// IRQ0-5
    283  1.2  uch 	DPRINTF((TEXT("IRQ[3:0]pin : %S mode\n"),
    284  1.2  uch 		 r & ICU_ICR1_IRQLVL ? "IRL 15level" : "IRQ[0:3]"));
    285  1.1  uch 	if (r & ICU_ICR1_IRQLVL) {
    286  1.1  uch 		DPRINTF((TEXT("IRLS[0:3] %S\n"),
    287  1.1  uch 			 r & ICU_ICR1_IRLSEN ? "enabled" : "disabled"));
    288  1.1  uch 	}
    289  1.1  uch 	// sense select
    290  1.1  uch 	for (int i = 5; i >= 0; i--) {
    291  1.1  uch 		DPRINTF((TEXT("IRQ[%d] %S\n"), i,
    292  1.1  uch 			 sense_select [
    293  1.1  uch 				 (r >>(i * 2)) & ICU_SENSE_SELECT_MASK]));
    294  1.1  uch 	}
    295  1.1  uch }
    296  1.1  uch 
    297  1.1  uch SH_BOOT_FUNC_(7709);
    298  1.1  uch SH_BOOT_FUNC_(7709A);
    299  1.1  uch 
    300  1.1  uch //
    301  1.1  uch // Debug Functions.
    302  1.1  uch //
    303  1.1  uch void
    304  1.2  uch SHArchitecture::bsc_dump()
    305  1.2  uch {
    306  1.2  uch 	DPRINTF((TEXT("<<<Bus State Controller>>>\n")));
    307  1.2  uch #define DUMP_BSC_REG(x)							\
    308  1.2  uch 	DPRINTF((TEXT("%-8S"), #x));					\
    309  1.2  uch 	bitdisp(reg_read_2(SH3_BSC_##x##_REG))
    310  1.2  uch 	DUMP_BSC_REG(BCR1);
    311  1.2  uch 	DUMP_BSC_REG(BCR2);
    312  1.2  uch 	DUMP_BSC_REG(WCR1);
    313  1.2  uch 	DUMP_BSC_REG(WCR2);
    314  1.2  uch 	DUMP_BSC_REG(MCR);
    315  1.2  uch 	DUMP_BSC_REG(DCR);
    316  1.2  uch 	DUMP_BSC_REG(PCR);
    317  1.2  uch 	DUMP_BSC_REG(RTCSR);
    318  1.2  uch 	DUMP_BSC_REG(RTCNT);
    319  1.2  uch 	DUMP_BSC_REG(RTCOR);
    320  1.2  uch 	DUMP_BSC_REG(RFCR);
    321  1.2  uch 	DUMP_BSC_REG(BCR3);
    322  1.2  uch #undef DUMP_BSC_REG
    323  1.2  uch }
    324  1.2  uch 
    325  1.2  uch void
    326  1.1  uch SHArchitecture::scif_dump(int bps)
    327  1.1  uch {
    328  1.1  uch 	u_int16_t r16;
    329  1.1  uch 	u_int8_t r8;
    330  1.1  uch 	int n;
    331  1.1  uch 
    332  1.2  uch 	DPRINTF((TEXT("<<<SCIF>>>\n")));
    333  1.1  uch 	/* mode */
    334  1.1  uch 	r8 = SHREG_SCSMR2;
    335  1.1  uch 	n = 1 <<((r8 & SCSMR2_CKS) << 1);
    336  1.1  uch 	DPRINTF((TEXT("mode: %dbit %S-parity %d stop bit clock PCLOCK/%d\n"),
    337  1.1  uch 		 r8 & SCSMR2_CHR ? 7 : 8,
    338  1.1  uch 		 r8 & SCSMR2_PE	? r8 & SCSMR2_OE ? "odd" : "even" : "non",
    339  1.1  uch 		 r8 & SCSMR2_STOP ? 2 : 1,
    340  1.1  uch 		 n));
    341  1.1  uch 	/* bit rate */
    342  1.1  uch 	r8 = SHREG_SCBRR2;
    343  1.1  uch 	DPRINTF((TEXT("SCBRR=%d(%dbps) estimated PCLOCK %dHz\n"), r8, bps,
    344  1.1  uch 		 32 * bps *(r8 + 1) * n));
    345  1.1  uch 
    346  1.1  uch 	/* control */
    347  1.1  uch #define DBG_BIT_PRINT(r, m)	_dbg_bit_print(r, SCSCR2_##m, #m)
    348  1.1  uch 	DPRINTF((TEXT("SCSCR2: ")));
    349  1.1  uch 	r8 = SHREG_SCSCR2;
    350  1.1  uch 	DBG_BIT_PRINT(r8, TIE);
    351  1.1  uch 	DBG_BIT_PRINT(r8, RIE);
    352  1.1  uch 	DBG_BIT_PRINT(r8, TE);
    353  1.1  uch 	DBG_BIT_PRINT(r8, RE);
    354  1.1  uch 	DPRINTF((TEXT("CKE=%d\n"), r8 & SCSCR2_CKE));
    355  1.1  uch #undef	DBG_BIT_PRINT
    356  1.1  uch 
    357  1.1  uch 	/* status */
    358  1.1  uch #define DBG_BIT_PRINT(r, m)	_dbg_bit_print(r, SCSSR2_##m, #m)
    359  1.1  uch 	r16 = SHREG_SCSSR2;
    360  1.1  uch 	DPRINTF((TEXT("SCSSR2: ")));
    361  1.1  uch 	DBG_BIT_PRINT(r16, ER);
    362  1.1  uch 	DBG_BIT_PRINT(r16, TEND);
    363  1.1  uch 	DBG_BIT_PRINT(r16, TDFE);
    364  1.1  uch 	DBG_BIT_PRINT(r16, BRK);
    365  1.1  uch 	DBG_BIT_PRINT(r16, FER);
    366  1.1  uch 	DBG_BIT_PRINT(r16, PER);
    367  1.1  uch 	DBG_BIT_PRINT(r16, RDF);
    368  1.1  uch 	DBG_BIT_PRINT(r16, DR);
    369  1.1  uch #undef	DBG_BIT_PRINT
    370  1.1  uch 
    371  1.1  uch 	/* FIFO control */
    372  1.1  uch #define DBG_BIT_PRINT(r, m)	_dbg_bit_print(r, SCFCR2_##m, #m)
    373  1.1  uch 	r8 = SHREG_SCFCR2;
    374  1.1  uch 	DPRINTF((TEXT("SCFCR2: ")));
    375  1.1  uch 	DBG_BIT_PRINT(r8, RTRG1);
    376  1.1  uch 	DBG_BIT_PRINT(r8, RTRG0);
    377  1.1  uch 	DBG_BIT_PRINT(r8, TTRG1);
    378  1.1  uch 	DBG_BIT_PRINT(r8, TTRG0);
    379  1.1  uch 	DBG_BIT_PRINT(r8, MCE);
    380  1.1  uch 	DBG_BIT_PRINT(r8, TFRST);
    381  1.1  uch 	DBG_BIT_PRINT(r8, RFRST);
    382  1.1  uch 	DBG_BIT_PRINT(r8, LOOP);
    383  1.1  uch 	DPRINTF((TEXT("\n")));
    384  1.1  uch #undef	DBG_BIT_PRINT
    385  1.1  uch }
    386  1.1  uch 
    387  1.1  uch void
    388  1.2  uch SHArchitecture::pfc_dump()
    389  1.1  uch {
    390  1.2  uch 	DPRINTF((TEXT("<<<Pin Function Controller>>>\n")));
    391  1.2  uch 	DPRINTF((TEXT("[control]\n")));
    392  1.2  uch #define DUMP_PFC_REG(x)							\
    393  1.2  uch 	DPRINTF((TEXT("P%SCR :"), #x));					\
    394  1.2  uch 	bitdisp(reg_read_2(SH3_P##x##CR_REG16))
    395  1.2  uch 	DUMP_PFC_REG(A);
    396  1.2  uch 	DUMP_PFC_REG(B);
    397  1.2  uch 	DUMP_PFC_REG(C);
    398  1.2  uch 	DUMP_PFC_REG(D);
    399  1.2  uch 	DUMP_PFC_REG(E);
    400  1.2  uch 	DUMP_PFC_REG(F);
    401  1.2  uch 	DUMP_PFC_REG(G);
    402  1.2  uch 	DUMP_PFC_REG(H);
    403  1.2  uch 	DUMP_PFC_REG(J);
    404  1.2  uch 	DUMP_PFC_REG(K);
    405  1.2  uch 	DUMP_PFC_REG(L);
    406  1.2  uch #undef DUMP_PFC_REG
    407  1.2  uch 	DPRINTF((TEXT("SCPCR :")));
    408  1.2  uch 	bitdisp(reg_read_2(SH3_SCPCR_REG16));
    409  1.2  uch 	DPRINTF((TEXT("\n[data]\n")));
    410  1.2  uch #define DUMP_IOPORT_REG(x)						\
    411  1.2  uch 	DPRINTF((TEXT("P%SDR :"), #x));					\
    412  1.2  uch 	bitdisp(reg_read_1(SH3_P##x##DR_REG8))
    413  1.2  uch 	DUMP_IOPORT_REG(A);
    414  1.2  uch 	DUMP_IOPORT_REG(B);
    415  1.2  uch 	DUMP_IOPORT_REG(C);
    416  1.2  uch 	DUMP_IOPORT_REG(D);
    417  1.2  uch 	DUMP_IOPORT_REG(E);
    418  1.2  uch 	DUMP_IOPORT_REG(F);
    419  1.2  uch 	DUMP_IOPORT_REG(G);
    420  1.2  uch 	DUMP_IOPORT_REG(H);
    421  1.2  uch 	DUMP_IOPORT_REG(J);
    422  1.2  uch 	DUMP_IOPORT_REG(K);
    423  1.2  uch 	DUMP_IOPORT_REG(L);
    424  1.2  uch #undef DUMP_IOPORT_REG
    425  1.2  uch 	DPRINTF((TEXT("SCPDR :")));
    426  1.2  uch 	bitdisp(reg_read_1(SH3_SCPDR_REG8));
    427  1.2  uch }
    428  1.2  uch 
    429  1.2  uch void
    430  1.2  uch SHArchitecture::hd64461_dump(platid_t &platform)
    431  1.2  uch {
    432  1.2  uch 	u_int16_t r16;
    433  1.2  uch 	u_int8_t r8;
    434  1.2  uch 
    435  1.2  uch #define MATCH(p)						\
    436  1.2  uch 	platid_match(&platform, &platid_mask_MACH_##p)
    437  1.2  uch 
    438  1.2  uch 	DPRINTF((TEXT("<<<HD64461>>>\n")));
    439  1.2  uch 	if (!MATCH(HP_LX) &&
    440  1.2  uch 	    !MATCH(HP_JORNADA_6XX) &&
    441  1.2  uch 	    !MATCH(HITACHI_PERSONA_HPW230JC)) {
    442  1.2  uch 		DPRINTF((TEXT("don't exist.")));
    443  1.2  uch 		return;
    444  1.2  uch 	}
    445  1.2  uch 
    446  1.2  uch #if 0
    447  1.1  uch 	DPRINTF((TEXT("frame buffer test start\n")));
    448  1.2  uch 	u_int8_t *fb = reinterpret_cast<u_int8_t *>(HD64461_FBBASE);
    449  1.2  uch 
    450  1.2  uch 	for (int i = 0; i < 320 * 240 * 2 / 8; i++)
    451  1.2  uch 		*fb++ = 0xff;
    452  1.2  uch 	DPRINTF((TEXT("frame buffer test end\n")));
    453  1.2  uch #endif
    454  1.2  uch 	// System
    455  1.2  uch 	DPRINTF((TEXT("STBCR (System Control Register)\n")));
    456  1.2  uch 	r16 = reg_read_2(HD64461_SYSSTBCR_REG16);
    457  1.2  uch 	bitdisp(r16);
    458  1.2  uch #define DBG_BIT_PRINT(r, m)	_dbg_bit_print(r, HD64461_SYSSTBCR_##m, #m)
    459  1.2  uch 	DBG_BIT_PRINT(r16, CKIO_STBY);
    460  1.2  uch 	DBG_BIT_PRINT(r16, SAFECKE_IST);
    461  1.2  uch 	DBG_BIT_PRINT(r16, SLCKE_IST);
    462  1.2  uch 	DBG_BIT_PRINT(r16, SAFECKE_OST);
    463  1.2  uch 	DBG_BIT_PRINT(r16, SLCKE_OST);
    464  1.2  uch 	DBG_BIT_PRINT(r16, SMIAST);
    465  1.2  uch 	DBG_BIT_PRINT(r16, SLCDST);
    466  1.2  uch 	DBG_BIT_PRINT(r16, SPC0ST);
    467  1.2  uch 	DBG_BIT_PRINT(r16, SPC1ST);
    468  1.2  uch 	DBG_BIT_PRINT(r16, SAFEST);
    469  1.2  uch 	DBG_BIT_PRINT(r16, STM0ST);
    470  1.2  uch 	DBG_BIT_PRINT(r16, STM1ST);
    471  1.2  uch 	DBG_BIT_PRINT(r16, SIRST);
    472  1.2  uch 	DBG_BIT_PRINT(r16, SURTSD);
    473  1.2  uch #undef DBG_BIT_PRINT
    474  1.2  uch 	DPRINTF((TEXT("\n")));
    475  1.2  uch 
    476  1.2  uch 	DPRINTF((TEXT("SYSCR (System Configuration Register)\n")));
    477  1.2  uch 	r16 = reg_read_2(HD64461_SYSSYSCR_REG16);
    478  1.2  uch 	bitdisp(r16);
    479  1.2  uch #define DBG_BIT_PRINT(r, m)	_dbg_bit_print(r, HD64461_SYSSYSCR_##m, #m)
    480  1.2  uch 	DBG_BIT_PRINT(r16, SCPU_BUS_IGAT);
    481  1.2  uch 	DBG_BIT_PRINT(r16, SPTA_IR);
    482  1.2  uch 	DBG_BIT_PRINT(r16, SPTA_TM);
    483  1.2  uch 	DBG_BIT_PRINT(r16, SPTB_UR);
    484  1.2  uch 	DBG_BIT_PRINT(r16, WAIT_CTL_SEL);
    485  1.2  uch 	DBG_BIT_PRINT(r16, SMODE1);
    486  1.2  uch 	DBG_BIT_PRINT(r16, SMODE0);
    487  1.2  uch #undef DBG_BIT_PRINT
    488  1.2  uch 	DPRINTF((TEXT("\n")));
    489  1.2  uch 
    490  1.2  uch 	DPRINTF((TEXT("SCPUCR (CPU Data Bus Control Register)\n")));
    491  1.2  uch 	r16 = reg_read_2(HD64461_SYSSCPUCR_REG16);
    492  1.2  uch 	bitdisp(r16);
    493  1.2  uch #define DBG_BIT_PRINT(r, m)	_dbg_bit_print(r, HD64461_SYSSCPUCR_##m, #m)
    494  1.2  uch 	DBG_BIT_PRINT(r16, SPDSTOF);
    495  1.2  uch 	DBG_BIT_PRINT(r16, SPDSTIG);
    496  1.2  uch 	DBG_BIT_PRINT(r16, SPCSTOF);
    497  1.2  uch 	DBG_BIT_PRINT(r16, SPCSTIG);
    498  1.2  uch 	DBG_BIT_PRINT(r16, SPBSTOF);
    499  1.2  uch 	DBG_BIT_PRINT(r16, SPBSTIG);
    500  1.2  uch 	DBG_BIT_PRINT(r16, SPASTOF);
    501  1.2  uch 	DBG_BIT_PRINT(r16, SPASTIG);
    502  1.2  uch 	DBG_BIT_PRINT(r16, SLCDSTIG);
    503  1.2  uch 	DBG_BIT_PRINT(r16, SCPU_CS56_EP);
    504  1.2  uch 	DBG_BIT_PRINT(r16, SCPU_CMD_EP);
    505  1.2  uch 	DBG_BIT_PRINT(r16, SCPU_ADDR_EP);
    506  1.2  uch 	DBG_BIT_PRINT(r16, SCPDPU);
    507  1.2  uch 	DBG_BIT_PRINT(r16, SCPU_A2319_EP);
    508  1.2  uch #undef DBG_BIT_PRINT
    509  1.2  uch 	DPRINTF((TEXT("\n")));
    510  1.2  uch 
    511  1.2  uch 	DPRINTF((TEXT("\n")));
    512  1.2  uch 
    513  1.2  uch 	// INTC
    514  1.2  uch 	DPRINTF((TEXT("NIRR (Interrupt Request Register)\n")));
    515  1.2  uch 	r16 = reg_read_2(HD64461_INTCNIRR_REG16);
    516  1.2  uch 	bitdisp(r16);
    517  1.2  uch #define DBG_BIT_PRINT(r, m)	_dbg_bit_print(r, HD64461_INTCNIRR_##m, #m)
    518  1.2  uch 	DBG_BIT_PRINT(r16, PCC0R);
    519  1.2  uch 	DBG_BIT_PRINT(r16, PCC1R);
    520  1.2  uch 	DBG_BIT_PRINT(r16, AFER);
    521  1.2  uch 	DBG_BIT_PRINT(r16, GPIOR);
    522  1.2  uch 	DBG_BIT_PRINT(r16, TMU0R);
    523  1.2  uch 	DBG_BIT_PRINT(r16, TMU1R);
    524  1.2  uch 	DBG_BIT_PRINT(r16, IRDAR);
    525  1.2  uch 	DBG_BIT_PRINT(r16, UARTR);
    526  1.2  uch #undef DBG_BIT_PRINT
    527  1.2  uch 	DPRINTF((TEXT("\n")));
    528  1.2  uch 
    529  1.2  uch 	DPRINTF((TEXT("NIMR (Interrupt Mask Register)\n")));
    530  1.2  uch 	r16 = reg_read_2(HD64461_INTCNIMR_REG16);
    531  1.2  uch 	bitdisp(r16);
    532  1.2  uch #define DBG_BIT_PRINT(r, m)	_dbg_bit_print(r, HD64461_INTCNIMR_##m, #m)
    533  1.2  uch 	DBG_BIT_PRINT(r16, PCC0M);
    534  1.2  uch 	DBG_BIT_PRINT(r16, PCC1M);
    535  1.2  uch 	DBG_BIT_PRINT(r16, AFEM);
    536  1.2  uch 	DBG_BIT_PRINT(r16, GPIOM);
    537  1.2  uch 	DBG_BIT_PRINT(r16, TMU0M);
    538  1.2  uch 	DBG_BIT_PRINT(r16, TMU1M);
    539  1.2  uch 	DBG_BIT_PRINT(r16, IRDAM);
    540  1.2  uch 	DBG_BIT_PRINT(r16, UARTM);
    541  1.2  uch #undef DBG_BIT_PRINT
    542  1.2  uch 	DPRINTF((TEXT("\n")));
    543  1.2  uch 
    544  1.2  uch 	DPRINTF((TEXT("\n")));
    545  1.2  uch 
    546  1.2  uch 	// PCMCIA
    547  1.2  uch 	// PCC0
    548  1.2  uch 	DPRINTF((TEXT("[PCC0 memory and I/O card (SH3 Area 6)]\n")));
    549  1.2  uch 	DPRINTF((TEXT("PCC0 Interface Status Register\n")));
    550  1.2  uch 	r8 = reg_read_1(HD64461_PCC0ISR_REG8);
    551  1.2  uch 	bitdisp(r8);
    552  1.2  uch #define DBG_BIT_PRINT(r, m)	_dbg_bit_print(r, HD64461_PCC0ISR_##m, #m)
    553  1.2  uch 	DBG_BIT_PRINT(r8, P0READY);
    554  1.2  uch 	DBG_BIT_PRINT(r8, P0MWP);
    555  1.2  uch 	DBG_BIT_PRINT(r8, P0VS2);
    556  1.2  uch 	DBG_BIT_PRINT(r8, P0VS1);
    557  1.2  uch 	DBG_BIT_PRINT(r8, P0CD2);
    558  1.2  uch 	DBG_BIT_PRINT(r8, P0CD1);
    559  1.2  uch 	DBG_BIT_PRINT(r8, P0BVD2);
    560  1.2  uch 	DBG_BIT_PRINT(r8, P0BVD1);
    561  1.2  uch #undef DBG_BIT_PRINT
    562  1.2  uch 	DPRINTF((TEXT("\n")));
    563  1.2  uch 
    564  1.2  uch 	DPRINTF((TEXT("PCC0 General Control Register\n")));
    565  1.2  uch 	r8 = reg_read_1(HD64461_PCC0GCR_REG8);
    566  1.2  uch 	bitdisp(r8);
    567  1.2  uch #define DBG_BIT_PRINT(r, m)	_dbg_bit_print(r, HD64461_PCC0GCR_##m, #m)
    568  1.2  uch 	DBG_BIT_PRINT(r8, P0DRVE);
    569  1.2  uch 	DBG_BIT_PRINT(r8, P0PCCR);
    570  1.2  uch 	DBG_BIT_PRINT(r8, P0PCCT);
    571  1.2  uch 	DBG_BIT_PRINT(r8, P0VCC0);
    572  1.2  uch 	DBG_BIT_PRINT(r8, P0MMOD);
    573  1.2  uch 	DBG_BIT_PRINT(r8, P0PA25);
    574  1.2  uch 	DBG_BIT_PRINT(r8, P0PA24);
    575  1.2  uch 	DBG_BIT_PRINT(r8, P0REG);
    576  1.2  uch #undef DBG_BIT_PRINT
    577  1.2  uch 	DPRINTF((TEXT("\n")));
    578  1.2  uch 
    579  1.2  uch 	DPRINTF((TEXT("PCC0 Card Status Change Register\n")));
    580  1.2  uch 	r8 = reg_read_1(HD64461_PCC0CSCR_REG8);
    581  1.2  uch 	bitdisp(r8);
    582  1.2  uch #define DBG_BIT_PRINT(r, m)	_dbg_bit_print(r, HD64461_PCC0CSCR_##m, #m)
    583  1.2  uch 	DBG_BIT_PRINT(r8, P0SCDI);
    584  1.2  uch 	DBG_BIT_PRINT(r8, P0IREQ);
    585  1.2  uch 	DBG_BIT_PRINT(r8, P0SC);
    586  1.2  uch 	DBG_BIT_PRINT(r8, P0CDC);
    587  1.2  uch 	DBG_BIT_PRINT(r8, P0RC);
    588  1.2  uch 	DBG_BIT_PRINT(r8, P0BW);
    589  1.2  uch 	DBG_BIT_PRINT(r8, P0BD);
    590  1.2  uch #undef DBG_BIT_PRINT
    591  1.2  uch 	DPRINTF((TEXT("\n")));
    592  1.2  uch 
    593  1.2  uch 	DPRINTF((TEXT("PCC0 Card Status Change Interrupt Enable Register\n")));
    594  1.2  uch 	r8 = reg_read_1(HD64461_PCC0CSCIER_REG8);
    595  1.2  uch 	bitdisp(r8);
    596  1.2  uch #define DBG_BIT_PRINT(r, m)	_dbg_bit_print(r, HD64461_PCC0CSCIER_##m, #m)
    597  1.2  uch 	DBG_BIT_PRINT(r8, P0CRE);
    598  1.2  uch 	DBG_BIT_PRINT(r8, P0SCE);
    599  1.2  uch 	DBG_BIT_PRINT(r8, P0CDE);
    600  1.2  uch 	DBG_BIT_PRINT(r8, P0RE);
    601  1.2  uch 	DBG_BIT_PRINT(r8, P0BWE);
    602  1.2  uch 	DBG_BIT_PRINT(r8, P0BDE);
    603  1.2  uch #undef DBG_BIT_PRINT
    604  1.2  uch 	DPRINTF((TEXT("\ninterrupt type: ")));
    605  1.2  uch 	switch (r8 & HD64461_PCC0CSCIER_P0IREQE_MASK) {
    606  1.2  uch 	case HD64461_PCC0CSCIER_P0IREQE_NONE:
    607  1.2  uch 		DPRINTF((TEXT("none\n")));
    608  1.2  uch 		break;
    609  1.2  uch 	case HD64461_PCC0CSCIER_P0IREQE_LEVEL:
    610  1.2  uch 		DPRINTF((TEXT("level\n")));
    611  1.2  uch 		break;
    612  1.2  uch 	case HD64461_PCC0CSCIER_P0IREQE_FEDGE:
    613  1.2  uch 		DPRINTF((TEXT("falling edge\n")));
    614  1.2  uch 		break;
    615  1.2  uch 	case HD64461_PCC0CSCIER_P0IREQE_REDGE:
    616  1.2  uch 		DPRINTF((TEXT("rising edge\n")));
    617  1.2  uch 		break;
    618  1.2  uch 	}
    619  1.2  uch 
    620  1.2  uch 	DPRINTF((TEXT("PCC0 Software Control Register\n")));
    621  1.2  uch 	r8 = reg_read_1(HD64461_PCC0SCR_REG8);
    622  1.2  uch 	bitdisp(r8);
    623  1.2  uch #define DBG_BIT_PRINT(r, m)	_dbg_bit_print(r, HD64461_PCC0SCR_##m, #m)
    624  1.2  uch 	DBG_BIT_PRINT(r8, P0VCC1);
    625  1.2  uch 	DBG_BIT_PRINT(r8, P0SWP);
    626  1.2  uch #undef DBG_BIT_PRINT
    627  1.2  uch 	DPRINTF((TEXT("\n")));
    628  1.2  uch 
    629  1.2  uch 	// PCC1
    630  1.2  uch 	DPRINTF((TEXT("[PCC1 memory card only (SH3 Area 5)]\n")));
    631  1.2  uch 	DPRINTF((TEXT("PCC1 Interface Status Register\n")));
    632  1.2  uch 	r8 = reg_read_1(HD64461_PCC1ISR_REG8);
    633  1.2  uch 	bitdisp(r8);
    634  1.2  uch #define DBG_BIT_PRINT(r, m)	_dbg_bit_print(r, HD64461_PCC1ISR_##m, #m)
    635  1.2  uch 	DBG_BIT_PRINT(r8, P1READY);
    636  1.2  uch 	DBG_BIT_PRINT(r8, P1MWP);
    637  1.2  uch 	DBG_BIT_PRINT(r8, P1VS2);
    638  1.2  uch 	DBG_BIT_PRINT(r8, P1VS1);
    639  1.2  uch 	DBG_BIT_PRINT(r8, P1CD2);
    640  1.2  uch 	DBG_BIT_PRINT(r8, P1CD1);
    641  1.2  uch 	DBG_BIT_PRINT(r8, P1BVD2);
    642  1.2  uch 	DBG_BIT_PRINT(r8, P1BVD1);
    643  1.2  uch #undef DBG_BIT_PRINT
    644  1.2  uch 	DPRINTF((TEXT("\n")));
    645  1.2  uch 
    646  1.2  uch 	DPRINTF((TEXT("PCC1 General Contorol Register\n")));
    647  1.2  uch 	r8 = reg_read_1(HD64461_PCC1GCR_REG8);
    648  1.2  uch 	bitdisp(r8);
    649  1.2  uch #define DBG_BIT_PRINT(r, m)	_dbg_bit_print(r, HD64461_PCC1GCR_##m, #m)
    650  1.2  uch 	DBG_BIT_PRINT(r8, P1DRVE);
    651  1.2  uch 	DBG_BIT_PRINT(r8, P1PCCR);
    652  1.2  uch 	DBG_BIT_PRINT(r8, P1VCC0);
    653  1.2  uch 	DBG_BIT_PRINT(r8, P1MMOD);
    654  1.2  uch 	DBG_BIT_PRINT(r8, P1PA25);
    655  1.2  uch 	DBG_BIT_PRINT(r8, P1PA24);
    656  1.2  uch 	DBG_BIT_PRINT(r8, P1REG);
    657  1.2  uch #undef DBG_BIT_PRINT
    658  1.2  uch 	DPRINTF((TEXT("\n")));
    659  1.2  uch 
    660  1.2  uch 	DPRINTF((TEXT("PCC1 Card Status Change Register\n")));
    661  1.2  uch 	r8 = reg_read_1(HD64461_PCC1CSCR_REG8);
    662  1.2  uch 	bitdisp(r8);
    663  1.2  uch #define DBG_BIT_PRINT(r, m)	_dbg_bit_print(r, HD64461_PCC1CSCR_##m, #m)
    664  1.2  uch 	DBG_BIT_PRINT(r8, P1SCDI);
    665  1.2  uch 	DBG_BIT_PRINT(r8, P1CDC);
    666  1.2  uch 	DBG_BIT_PRINT(r8, P1RC);
    667  1.2  uch 	DBG_BIT_PRINT(r8, P1BW);
    668  1.2  uch 	DBG_BIT_PRINT(r8, P1BD);
    669  1.2  uch #undef DBG_BIT_PRINT
    670  1.2  uch 	DPRINTF((TEXT("\n")));
    671  1.2  uch 
    672  1.2  uch 	DPRINTF((TEXT("PCC1 Card Status Change Interrupt Enable Register\n")));
    673  1.2  uch 	r8 = reg_read_1(HD64461_PCC1CSCIER_REG8);
    674  1.2  uch 	bitdisp(r8);
    675  1.2  uch #define DBG_BIT_PRINT(r, m)	_dbg_bit_print(r, HD64461_PCC1CSCIER_##m, #m)
    676  1.2  uch 	DBG_BIT_PRINT(r8, P1CRE);
    677  1.2  uch 	DBG_BIT_PRINT(r8, P1CDE);
    678  1.2  uch 	DBG_BIT_PRINT(r8, P1RE);
    679  1.2  uch 	DBG_BIT_PRINT(r8, P1BWE);
    680  1.2  uch 	DBG_BIT_PRINT(r8, P1BDE);
    681  1.2  uch #undef DBG_BIT_PRINT
    682  1.2  uch 	DPRINTF((TEXT("\n")));
    683  1.2  uch 
    684  1.2  uch 	DPRINTF((TEXT("PCC1 Software Control Register\n")));
    685  1.2  uch 	r8 = reg_read_1(HD64461_PCC1SCR_REG8);
    686  1.2  uch 	bitdisp(r8);
    687  1.2  uch #define DBG_BIT_PRINT(r, m)	_dbg_bit_print(r, HD64461_PCC1SCR_##m, #m)
    688  1.2  uch 	DBG_BIT_PRINT(r8, P1VCC1);
    689  1.2  uch 	DBG_BIT_PRINT(r8, P1SWP);
    690  1.2  uch #undef DBG_BIT_PRINT
    691  1.2  uch 	DPRINTF((TEXT("\n")));
    692  1.2  uch 
    693  1.2  uch 	// General Control
    694  1.2  uch 	DPRINTF((TEXT("[General Control]\n")));
    695  1.2  uch 	DPRINTF((TEXT("PCC0 Output pins Control Register\n")));
    696  1.2  uch 	r8 = reg_read_1(HD64461_PCCP0OCR_REG8);
    697  1.2  uch 	bitdisp(r8);
    698  1.2  uch #define DBG_BIT_PRINT(r, m)	_dbg_bit_print(r, HD64461_PCCP0OCR_##m, #m)
    699  1.2  uch 	DBG_BIT_PRINT(r8, P0DEPLUP);
    700  1.2  uch 	DBG_BIT_PRINT(r8, P0AEPLUP);
    701  1.2  uch #undef DBG_BIT_PRINT
    702  1.2  uch 	DPRINTF((TEXT("\n")));
    703  1.2  uch 
    704  1.2  uch 	DPRINTF((TEXT("PCC1 Output pins Control Register\n")));
    705  1.2  uch 	r8 = reg_read_1(HD64461_PCCP1OCR_REG8);
    706  1.2  uch 	bitdisp(r8);
    707  1.2  uch #define DBG_BIT_PRINT(r, m)	_dbg_bit_print(r, HD64461_PCCP1OCR_##m, #m)
    708  1.2  uch 	DBG_BIT_PRINT(r8, P1RST8MA);
    709  1.2  uch 	DBG_BIT_PRINT(r8, P1RST4MA);
    710  1.2  uch 	DBG_BIT_PRINT(r8, P1RAS8MA);
    711  1.2  uch 	DBG_BIT_PRINT(r8, P1RAS4MA);
    712  1.2  uch #undef DBG_BIT_PRINT
    713  1.2  uch 	DPRINTF((TEXT("\n")));
    714  1.2  uch 
    715  1.2  uch 	DPRINTF((TEXT("PC Card General Control Register\n")));
    716  1.2  uch 	r8 = reg_read_1(HD64461_PCCPGCR_REG8);
    717  1.2  uch 	bitdisp(r8);
    718  1.2  uch #define DBG_BIT_PRINT(r, m)	_dbg_bit_print(r, HD64461_PCCPGCR_##m, #m)
    719  1.2  uch 	DBG_BIT_PRINT(r8, PSSDIR);
    720  1.2  uch 	DBG_BIT_PRINT(r8, PSSRDWR);
    721  1.2  uch #undef DBG_BIT_PRINT
    722  1.2  uch 	DPRINTF((TEXT("\n")));
    723  1.2  uch 
    724  1.2  uch 	// GPIO
    725  1.2  uch #define GPIO_DUMP_REG8(x)						\
    726  1.2  uch 	bitdisp(reg_read_1(HD64461_GPA##x##R_REG16));			\
    727  1.2  uch 	bitdisp(reg_read_1(HD64461_GPB##x##R_REG16));			\
    728  1.2  uch 	bitdisp(reg_read_1(HD64461_GPC##x##R_REG16));			\
    729  1.2  uch 	bitdisp(reg_read_1(HD64461_GPD##x##R_REG16))
    730  1.2  uch #define GPIO_DUMP_REG16(x)						\
    731  1.2  uch 	bitdisp(reg_read_2(HD64461_GPA##x##R_REG16));			\
    732  1.2  uch 	bitdisp(reg_read_2(HD64461_GPB##x##R_REG16));			\
    733  1.2  uch 	bitdisp(reg_read_2(HD64461_GPC##x##R_REG16));			\
    734  1.2  uch 	bitdisp(reg_read_2(HD64461_GPD##x##R_REG16))
    735  1.2  uch 
    736  1.2  uch 	DPRINTF((TEXT("GPIO Port Control Register\n")));
    737  1.2  uch 	GPIO_DUMP_REG16(C);
    738  1.2  uch 	DPRINTF((TEXT("GPIO Port Data Register\n")));
    739  1.2  uch 	GPIO_DUMP_REG8(D);
    740  1.2  uch 	DPRINTF((TEXT("GPIO Port Interrupt Control Register\n")));
    741  1.2  uch 	GPIO_DUMP_REG8(IC);
    742  1.2  uch 	DPRINTF((TEXT("GPIO Port Interrupt Status  Register\n")));
    743  1.2  uch 	GPIO_DUMP_REG8(IS);
    744  1.2  uch }
    745  1.2  uch 
    746  1.2  uch #ifdef SH7709TEST
    747  1.1  uch 	u_int32_t sh7707_fb_dma_addr;
    748  1.1  uch 	u_int16_t val;
    749  1.1  uch 	int s;
    750  1.1  uch 
    751  1.1  uch 	s = suspendIntr();
    752  1.1  uch 	VOLATILE_REF16(SH7707_LCDAR_REG16) = SH7707_LCDAR_LCDDMR0;
    753  1.1  uch 	val = VOLATILE_REF16(SH7707_LCDDMR_REG16);
    754  1.1  uch 	sh7707_fb_dma_addr = val;
    755  1.1  uch 	VOLATILE_REF16(SH7707_LCDAR_REG16) = SH7707_LCDAR_LCDDMR1;
    756  1.1  uch 	val = VOLATILE_REF16(SH7707_LCDDMR_REG16);
    757  1.1  uch 	sh7707_fb_dma_addr |= (val << 16);
    758  1.1  uch 	resumeIntr(s);
    759  1.1  uch 
    760  1.1  uch 	DPRINTF((TEXT("SH7707 frame buffer dma address: 0x%08x\n"),
    761  1.1  uch 		 sh7707_fb_dma_addr));
    762  1.1  uch #endif
    763