Home | History | Annotate | Line # | Download | only in sh3
sh_arch.cpp revision 1.3
      1  1.3  uch /*	$NetBSD: sh_arch.cpp,v 1.3 2001/03/02 18:26:38 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.3  uch 	HpcMenuInterface &menu = HpcMenuInterface::Instance();
    168  1.1  uch 
    169  1.1  uch 	Architecture::systemInfo();
    170  1.1  uch 
    171  1.3  uch 	// check debug level.
    172  1.3  uch 	if (menu._cons_parameter == 0)
    173  1.3  uch 		return;
    174  1.3  uch 
    175  1.1  uch 	_kmode = SetKMode(1);
    176  1.1  uch 
    177  1.1  uch 	// Cache
    178  1.1  uch 	reg = VOLATILE_REF(CCR);
    179  1.1  uch 	DPRINTF((TEXT("Cache ")));
    180  1.1  uch 	if (reg & CCR_CE)
    181  1.1  uch 		DPRINTF((TEXT("Enabled. %s-mode, P0/U0/P3 Write-%s, P1 Write-%s\n"),
    182  1.1  uch 			 reg & CCR_RA ? TEXT("RAM") : TEXT("normal"),
    183  1.1  uch 			 reg & CCR_WT ? TEXT("Through") : TEXT("Back"),
    184  1.1  uch 			 reg & CCR_CB ? TEXT("Back") : TEXT("Through")));
    185  1.1  uch 	else
    186  1.1  uch 		DPRINTF((TEXT("Disabled.\n")));
    187  1.1  uch 
    188  1.1  uch 	// MMU
    189  1.1  uch 	reg = VOLATILE_REF(MMUCR);
    190  1.1  uch 	DPRINTF((TEXT("MMU ")));
    191  1.1  uch 	if (reg & MMUCR_AT)
    192  1.1  uch 		DPRINTF((TEXT("Enabled. %s index-mode, %s virtual storage mode\n"),
    193  1.1  uch 			 reg & MMUCR_IX
    194  1.1  uch 			 ? TEXT("ASID + VPN") : TEXT("VPN only"),
    195  1.1  uch 			 reg & MMUCR_SV ? TEXT("single") : TEXT("multiple")));
    196  1.1  uch 	else
    197  1.1  uch 		DPRINTF((TEXT("Disabled.\n")));
    198  1.1  uch 
    199  1.1  uch 	// Status register
    200  1.1  uch 	reg = 0;
    201  1.1  uch 	__asm("stc	sr, r0\n"
    202  1.1  uch 	      "mov.l	r0, @r4", &reg);
    203  1.1  uch 	DPRINTF((TEXT("SR 0x%08x\n"), reg));
    204  1.1  uch 
    205  1.2  uch 	// BSC
    206  1.2  uch 	bsc_dump();
    207  1.2  uch 
    208  1.1  uch 	// ICU
    209  1.1  uch 	print_stack_pointer();
    210  1.1  uch 	icu_dump();
    211  1.1  uch 
    212  1.2  uch 	// PFC , I/O port
    213  1.2  uch 	pfc_dump();
    214  1.2  uch 
    215  1.2  uch 	// SCIF
    216  1.2  uch 	scif_dump(19200);
    217  1.2  uch 
    218  1.2  uch 	// HD64461
    219  1.2  uch 	platid_t platform;
    220  1.2  uch 	platform.dw.dw0 = menu._pref.platid_hi;
    221  1.2  uch 	platform.dw.dw1 = menu._pref.platid_lo;
    222  1.2  uch 	hd64461_dump(platform);
    223  1.1  uch 
    224  1.1  uch 	SetKMode(_kmode);
    225  1.1  uch }
    226  1.1  uch 
    227  1.1  uch void
    228  1.1  uch SHArchitecture::icu_dump(void)
    229  1.1  uch {
    230  1.2  uch 	DPRINTF((TEXT("<<<Interrupt Controller>>>\n")));
    231  1.1  uch 	print_stack_pointer();
    232  1.1  uch 
    233  1.2  uch 	DPRINTF((TEXT("ICR0   0x%08x\n"), reg_read_2(ICU_ICR0_REG16)));
    234  1.2  uch 	DPRINTF((TEXT("ICR1   0x%08x\n"), reg_read_2(ICU_ICR1_REG16)));
    235  1.2  uch 	DPRINTF((TEXT("ICR2   0x%08x\n"), reg_read_2(ICU_ICR2_REG16)));
    236  1.2  uch 	DPRINTF((TEXT("PINTER 0x%08x\n"), reg_read_2(ICU_PINTER_REG16)));
    237  1.2  uch 	DPRINTF((TEXT("IPRA   0x%08x\n"), reg_read_2(ICU_IPRA_REG16)));
    238  1.2  uch 	DPRINTF((TEXT("IPRB   0x%08x\n"), reg_read_2(ICU_IPRB_REG16)));
    239  1.2  uch 	DPRINTF((TEXT("IPRC   0x%08x\n"), reg_read_2(ICU_IPRC_REG16)));
    240  1.2  uch 	DPRINTF((TEXT("IPRD   0x%08x\n"), reg_read_2(ICU_IPRD_REG16)));
    241  1.2  uch 	DPRINTF((TEXT("IPRE   0x%08x\n"), reg_read_2(ICU_IPRE_REG16)));
    242  1.2  uch 	DPRINTF((TEXT("IRR0   0x%08x\n"), reg_read_1(ICU_IRR0_REG8)));
    243  1.2  uch 	DPRINTF((TEXT("IRR1   0x%08x\n"), reg_read_1(ICU_IRR1_REG8)));
    244  1.2  uch 	DPRINTF((TEXT("IRR2   0x%08x\n"), reg_read_1(ICU_IRR2_REG8)));
    245  1.1  uch 	icu_control();
    246  1.1  uch 	icu_priority();
    247  1.1  uch }
    248  1.1  uch 
    249  1.1  uch void
    250  1.1  uch SHArchitecture::icu_priority(void)
    251  1.1  uch {
    252  1.1  uch 	struct intr_priority *tab;
    253  1.1  uch 	DPRINTF((TEXT("----interrupt priority----\n")));
    254  1.1  uch 	for (tab = ipr_table; tab->name; tab++) {
    255  1.1  uch 		DPRINTF((TEXT("%-10S %d\n"), tab->name,
    256  1.2  uch 			 (reg_read_2(tab->reg) >> tab->shift) & ICU_IPR_MASK));
    257  1.1  uch 	}
    258  1.1  uch 	DPRINTF((TEXT("--------------------------\n")));
    259  1.1  uch }
    260  1.1  uch 
    261  1.1  uch void
    262  1.1  uch SHArchitecture::icu_control(void)
    263  1.1  uch {
    264  1.1  uch 	const char *sense_select[] = {
    265  1.1  uch 		"falling edge",
    266  1.1  uch 		"raising edge",
    267  1.1  uch 		"low level",
    268  1.1  uch 		"reserved",
    269  1.1  uch 	};
    270  1.1  uch 	u_int16_t r;
    271  1.2  uch 
    272  1.1  uch 	// PINT0-15
    273  1.1  uch 	DPRINTF((TEXT("PINT enable(on |)  :")));
    274  1.2  uch 	bitdisp(reg_read_2(ICU_PINTER_REG16));
    275  1.1  uch 	DPRINTF((TEXT("PINT detect(high |):")));
    276  1.2  uch 	bitdisp(reg_read_2(ICU_ICR2_REG16));
    277  1.1  uch 	// NMI
    278  1.2  uch 	r = reg_read_2(ICU_ICR0_REG16);
    279  1.1  uch 	DPRINTF((TEXT("NMI(%S %S-edge),"),
    280  1.1  uch 		 r & ICU_ICR0_NMIL ? "High" : "Low",
    281  1.1  uch 		 r & ICU_ICR0_NMIE ? "raising" : "falling"));
    282  1.2  uch 	r = reg_read_2(ICU_ICR1_REG16);
    283  1.1  uch 	DPRINTF((TEXT(" %S maskable,"), r & ICU_ICR1_MAI ? "" : "never"));
    284  1.1  uch 	DPRINTF((TEXT("  SR.BL %S\n"),
    285  1.1  uch 		 r & ICU_ICR1_BLMSK ? "ignored" : "maskable"));
    286  1.1  uch 	// IRQ0-5
    287  1.2  uch 	DPRINTF((TEXT("IRQ[3:0]pin : %S mode\n"),
    288  1.2  uch 		 r & ICU_ICR1_IRQLVL ? "IRL 15level" : "IRQ[0:3]"));
    289  1.1  uch 	if (r & ICU_ICR1_IRQLVL) {
    290  1.1  uch 		DPRINTF((TEXT("IRLS[0:3] %S\n"),
    291  1.1  uch 			 r & ICU_ICR1_IRLSEN ? "enabled" : "disabled"));
    292  1.1  uch 	}
    293  1.1  uch 	// sense select
    294  1.1  uch 	for (int i = 5; i >= 0; i--) {
    295  1.1  uch 		DPRINTF((TEXT("IRQ[%d] %S\n"), i,
    296  1.1  uch 			 sense_select [
    297  1.1  uch 				 (r >>(i * 2)) & ICU_SENSE_SELECT_MASK]));
    298  1.1  uch 	}
    299  1.1  uch }
    300  1.1  uch 
    301  1.1  uch SH_BOOT_FUNC_(7709);
    302  1.1  uch SH_BOOT_FUNC_(7709A);
    303  1.1  uch 
    304  1.1  uch //
    305  1.1  uch // Debug Functions.
    306  1.1  uch //
    307  1.1  uch void
    308  1.2  uch SHArchitecture::bsc_dump()
    309  1.2  uch {
    310  1.2  uch 	DPRINTF((TEXT("<<<Bus State Controller>>>\n")));
    311  1.2  uch #define DUMP_BSC_REG(x)							\
    312  1.2  uch 	DPRINTF((TEXT("%-8S"), #x));					\
    313  1.2  uch 	bitdisp(reg_read_2(SH3_BSC_##x##_REG))
    314  1.2  uch 	DUMP_BSC_REG(BCR1);
    315  1.2  uch 	DUMP_BSC_REG(BCR2);
    316  1.2  uch 	DUMP_BSC_REG(WCR1);
    317  1.2  uch 	DUMP_BSC_REG(WCR2);
    318  1.2  uch 	DUMP_BSC_REG(MCR);
    319  1.2  uch 	DUMP_BSC_REG(DCR);
    320  1.2  uch 	DUMP_BSC_REG(PCR);
    321  1.2  uch 	DUMP_BSC_REG(RTCSR);
    322  1.2  uch 	DUMP_BSC_REG(RTCNT);
    323  1.2  uch 	DUMP_BSC_REG(RTCOR);
    324  1.2  uch 	DUMP_BSC_REG(RFCR);
    325  1.2  uch 	DUMP_BSC_REG(BCR3);
    326  1.2  uch #undef DUMP_BSC_REG
    327  1.2  uch }
    328  1.2  uch 
    329  1.2  uch void
    330  1.1  uch SHArchitecture::scif_dump(int bps)
    331  1.1  uch {
    332  1.1  uch 	u_int16_t r16;
    333  1.1  uch 	u_int8_t r8;
    334  1.1  uch 	int n;
    335  1.1  uch 
    336  1.2  uch 	DPRINTF((TEXT("<<<SCIF>>>\n")));
    337  1.1  uch 	/* mode */
    338  1.1  uch 	r8 = SHREG_SCSMR2;
    339  1.1  uch 	n = 1 <<((r8 & SCSMR2_CKS) << 1);
    340  1.1  uch 	DPRINTF((TEXT("mode: %dbit %S-parity %d stop bit clock PCLOCK/%d\n"),
    341  1.1  uch 		 r8 & SCSMR2_CHR ? 7 : 8,
    342  1.1  uch 		 r8 & SCSMR2_PE	? r8 & SCSMR2_OE ? "odd" : "even" : "non",
    343  1.1  uch 		 r8 & SCSMR2_STOP ? 2 : 1,
    344  1.1  uch 		 n));
    345  1.1  uch 	/* bit rate */
    346  1.1  uch 	r8 = SHREG_SCBRR2;
    347  1.1  uch 	DPRINTF((TEXT("SCBRR=%d(%dbps) estimated PCLOCK %dHz\n"), r8, bps,
    348  1.1  uch 		 32 * bps *(r8 + 1) * n));
    349  1.1  uch 
    350  1.1  uch 	/* control */
    351  1.1  uch #define DBG_BIT_PRINT(r, m)	_dbg_bit_print(r, SCSCR2_##m, #m)
    352  1.1  uch 	DPRINTF((TEXT("SCSCR2: ")));
    353  1.1  uch 	r8 = SHREG_SCSCR2;
    354  1.1  uch 	DBG_BIT_PRINT(r8, TIE);
    355  1.1  uch 	DBG_BIT_PRINT(r8, RIE);
    356  1.1  uch 	DBG_BIT_PRINT(r8, TE);
    357  1.1  uch 	DBG_BIT_PRINT(r8, RE);
    358  1.1  uch 	DPRINTF((TEXT("CKE=%d\n"), r8 & SCSCR2_CKE));
    359  1.1  uch #undef	DBG_BIT_PRINT
    360  1.1  uch 
    361  1.1  uch 	/* status */
    362  1.1  uch #define DBG_BIT_PRINT(r, m)	_dbg_bit_print(r, SCSSR2_##m, #m)
    363  1.1  uch 	r16 = SHREG_SCSSR2;
    364  1.1  uch 	DPRINTF((TEXT("SCSSR2: ")));
    365  1.1  uch 	DBG_BIT_PRINT(r16, ER);
    366  1.1  uch 	DBG_BIT_PRINT(r16, TEND);
    367  1.1  uch 	DBG_BIT_PRINT(r16, TDFE);
    368  1.1  uch 	DBG_BIT_PRINT(r16, BRK);
    369  1.1  uch 	DBG_BIT_PRINT(r16, FER);
    370  1.1  uch 	DBG_BIT_PRINT(r16, PER);
    371  1.1  uch 	DBG_BIT_PRINT(r16, RDF);
    372  1.1  uch 	DBG_BIT_PRINT(r16, DR);
    373  1.1  uch #undef	DBG_BIT_PRINT
    374  1.1  uch 
    375  1.1  uch 	/* FIFO control */
    376  1.1  uch #define DBG_BIT_PRINT(r, m)	_dbg_bit_print(r, SCFCR2_##m, #m)
    377  1.1  uch 	r8 = SHREG_SCFCR2;
    378  1.1  uch 	DPRINTF((TEXT("SCFCR2: ")));
    379  1.1  uch 	DBG_BIT_PRINT(r8, RTRG1);
    380  1.1  uch 	DBG_BIT_PRINT(r8, RTRG0);
    381  1.1  uch 	DBG_BIT_PRINT(r8, TTRG1);
    382  1.1  uch 	DBG_BIT_PRINT(r8, TTRG0);
    383  1.1  uch 	DBG_BIT_PRINT(r8, MCE);
    384  1.1  uch 	DBG_BIT_PRINT(r8, TFRST);
    385  1.1  uch 	DBG_BIT_PRINT(r8, RFRST);
    386  1.1  uch 	DBG_BIT_PRINT(r8, LOOP);
    387  1.1  uch 	DPRINTF((TEXT("\n")));
    388  1.1  uch #undef	DBG_BIT_PRINT
    389  1.1  uch }
    390  1.1  uch 
    391  1.1  uch void
    392  1.2  uch SHArchitecture::pfc_dump()
    393  1.1  uch {
    394  1.2  uch 	DPRINTF((TEXT("<<<Pin Function Controller>>>\n")));
    395  1.2  uch 	DPRINTF((TEXT("[control]\n")));
    396  1.2  uch #define DUMP_PFC_REG(x)							\
    397  1.2  uch 	DPRINTF((TEXT("P%SCR :"), #x));					\
    398  1.2  uch 	bitdisp(reg_read_2(SH3_P##x##CR_REG16))
    399  1.2  uch 	DUMP_PFC_REG(A);
    400  1.2  uch 	DUMP_PFC_REG(B);
    401  1.2  uch 	DUMP_PFC_REG(C);
    402  1.2  uch 	DUMP_PFC_REG(D);
    403  1.2  uch 	DUMP_PFC_REG(E);
    404  1.2  uch 	DUMP_PFC_REG(F);
    405  1.2  uch 	DUMP_PFC_REG(G);
    406  1.2  uch 	DUMP_PFC_REG(H);
    407  1.2  uch 	DUMP_PFC_REG(J);
    408  1.2  uch 	DUMP_PFC_REG(K);
    409  1.2  uch 	DUMP_PFC_REG(L);
    410  1.2  uch #undef DUMP_PFC_REG
    411  1.2  uch 	DPRINTF((TEXT("SCPCR :")));
    412  1.2  uch 	bitdisp(reg_read_2(SH3_SCPCR_REG16));
    413  1.2  uch 	DPRINTF((TEXT("\n[data]\n")));
    414  1.2  uch #define DUMP_IOPORT_REG(x)						\
    415  1.2  uch 	DPRINTF((TEXT("P%SDR :"), #x));					\
    416  1.2  uch 	bitdisp(reg_read_1(SH3_P##x##DR_REG8))
    417  1.2  uch 	DUMP_IOPORT_REG(A);
    418  1.2  uch 	DUMP_IOPORT_REG(B);
    419  1.2  uch 	DUMP_IOPORT_REG(C);
    420  1.2  uch 	DUMP_IOPORT_REG(D);
    421  1.2  uch 	DUMP_IOPORT_REG(E);
    422  1.2  uch 	DUMP_IOPORT_REG(F);
    423  1.2  uch 	DUMP_IOPORT_REG(G);
    424  1.2  uch 	DUMP_IOPORT_REG(H);
    425  1.2  uch 	DUMP_IOPORT_REG(J);
    426  1.2  uch 	DUMP_IOPORT_REG(K);
    427  1.2  uch 	DUMP_IOPORT_REG(L);
    428  1.2  uch #undef DUMP_IOPORT_REG
    429  1.2  uch 	DPRINTF((TEXT("SCPDR :")));
    430  1.2  uch 	bitdisp(reg_read_1(SH3_SCPDR_REG8));
    431  1.2  uch }
    432  1.2  uch 
    433  1.2  uch void
    434  1.2  uch SHArchitecture::hd64461_dump(platid_t &platform)
    435  1.2  uch {
    436  1.2  uch 	u_int16_t r16;
    437  1.2  uch 	u_int8_t r8;
    438  1.2  uch 
    439  1.2  uch #define MATCH(p)						\
    440  1.2  uch 	platid_match(&platform, &platid_mask_MACH_##p)
    441  1.2  uch 
    442  1.2  uch 	DPRINTF((TEXT("<<<HD64461>>>\n")));
    443  1.2  uch 	if (!MATCH(HP_LX) &&
    444  1.2  uch 	    !MATCH(HP_JORNADA_6XX) &&
    445  1.2  uch 	    !MATCH(HITACHI_PERSONA_HPW230JC)) {
    446  1.2  uch 		DPRINTF((TEXT("don't exist.")));
    447  1.2  uch 		return;
    448  1.2  uch 	}
    449  1.2  uch 
    450  1.2  uch #if 0
    451  1.1  uch 	DPRINTF((TEXT("frame buffer test start\n")));
    452  1.2  uch 	u_int8_t *fb = reinterpret_cast<u_int8_t *>(HD64461_FBBASE);
    453  1.2  uch 
    454  1.2  uch 	for (int i = 0; i < 320 * 240 * 2 / 8; i++)
    455  1.2  uch 		*fb++ = 0xff;
    456  1.2  uch 	DPRINTF((TEXT("frame buffer test end\n")));
    457  1.2  uch #endif
    458  1.2  uch 	// System
    459  1.2  uch 	DPRINTF((TEXT("STBCR (System Control Register)\n")));
    460  1.2  uch 	r16 = reg_read_2(HD64461_SYSSTBCR_REG16);
    461  1.2  uch 	bitdisp(r16);
    462  1.2  uch #define DBG_BIT_PRINT(r, m)	_dbg_bit_print(r, HD64461_SYSSTBCR_##m, #m)
    463  1.2  uch 	DBG_BIT_PRINT(r16, CKIO_STBY);
    464  1.2  uch 	DBG_BIT_PRINT(r16, SAFECKE_IST);
    465  1.2  uch 	DBG_BIT_PRINT(r16, SLCKE_IST);
    466  1.2  uch 	DBG_BIT_PRINT(r16, SAFECKE_OST);
    467  1.2  uch 	DBG_BIT_PRINT(r16, SLCKE_OST);
    468  1.2  uch 	DBG_BIT_PRINT(r16, SMIAST);
    469  1.2  uch 	DBG_BIT_PRINT(r16, SLCDST);
    470  1.2  uch 	DBG_BIT_PRINT(r16, SPC0ST);
    471  1.2  uch 	DBG_BIT_PRINT(r16, SPC1ST);
    472  1.2  uch 	DBG_BIT_PRINT(r16, SAFEST);
    473  1.2  uch 	DBG_BIT_PRINT(r16, STM0ST);
    474  1.2  uch 	DBG_BIT_PRINT(r16, STM1ST);
    475  1.2  uch 	DBG_BIT_PRINT(r16, SIRST);
    476  1.2  uch 	DBG_BIT_PRINT(r16, SURTSD);
    477  1.2  uch #undef DBG_BIT_PRINT
    478  1.2  uch 	DPRINTF((TEXT("\n")));
    479  1.2  uch 
    480  1.2  uch 	DPRINTF((TEXT("SYSCR (System Configuration Register)\n")));
    481  1.2  uch 	r16 = reg_read_2(HD64461_SYSSYSCR_REG16);
    482  1.2  uch 	bitdisp(r16);
    483  1.2  uch #define DBG_BIT_PRINT(r, m)	_dbg_bit_print(r, HD64461_SYSSYSCR_##m, #m)
    484  1.2  uch 	DBG_BIT_PRINT(r16, SCPU_BUS_IGAT);
    485  1.2  uch 	DBG_BIT_PRINT(r16, SPTA_IR);
    486  1.2  uch 	DBG_BIT_PRINT(r16, SPTA_TM);
    487  1.2  uch 	DBG_BIT_PRINT(r16, SPTB_UR);
    488  1.2  uch 	DBG_BIT_PRINT(r16, WAIT_CTL_SEL);
    489  1.2  uch 	DBG_BIT_PRINT(r16, SMODE1);
    490  1.2  uch 	DBG_BIT_PRINT(r16, SMODE0);
    491  1.2  uch #undef DBG_BIT_PRINT
    492  1.2  uch 	DPRINTF((TEXT("\n")));
    493  1.2  uch 
    494  1.2  uch 	DPRINTF((TEXT("SCPUCR (CPU Data Bus Control Register)\n")));
    495  1.2  uch 	r16 = reg_read_2(HD64461_SYSSCPUCR_REG16);
    496  1.2  uch 	bitdisp(r16);
    497  1.2  uch #define DBG_BIT_PRINT(r, m)	_dbg_bit_print(r, HD64461_SYSSCPUCR_##m, #m)
    498  1.2  uch 	DBG_BIT_PRINT(r16, SPDSTOF);
    499  1.2  uch 	DBG_BIT_PRINT(r16, SPDSTIG);
    500  1.2  uch 	DBG_BIT_PRINT(r16, SPCSTOF);
    501  1.2  uch 	DBG_BIT_PRINT(r16, SPCSTIG);
    502  1.2  uch 	DBG_BIT_PRINT(r16, SPBSTOF);
    503  1.2  uch 	DBG_BIT_PRINT(r16, SPBSTIG);
    504  1.2  uch 	DBG_BIT_PRINT(r16, SPASTOF);
    505  1.2  uch 	DBG_BIT_PRINT(r16, SPASTIG);
    506  1.2  uch 	DBG_BIT_PRINT(r16, SLCDSTIG);
    507  1.2  uch 	DBG_BIT_PRINT(r16, SCPU_CS56_EP);
    508  1.2  uch 	DBG_BIT_PRINT(r16, SCPU_CMD_EP);
    509  1.2  uch 	DBG_BIT_PRINT(r16, SCPU_ADDR_EP);
    510  1.2  uch 	DBG_BIT_PRINT(r16, SCPDPU);
    511  1.2  uch 	DBG_BIT_PRINT(r16, SCPU_A2319_EP);
    512  1.2  uch #undef DBG_BIT_PRINT
    513  1.2  uch 	DPRINTF((TEXT("\n")));
    514  1.2  uch 
    515  1.2  uch 	DPRINTF((TEXT("\n")));
    516  1.2  uch 
    517  1.2  uch 	// INTC
    518  1.2  uch 	DPRINTF((TEXT("NIRR (Interrupt Request Register)\n")));
    519  1.2  uch 	r16 = reg_read_2(HD64461_INTCNIRR_REG16);
    520  1.2  uch 	bitdisp(r16);
    521  1.2  uch #define DBG_BIT_PRINT(r, m)	_dbg_bit_print(r, HD64461_INTCNIRR_##m, #m)
    522  1.2  uch 	DBG_BIT_PRINT(r16, PCC0R);
    523  1.2  uch 	DBG_BIT_PRINT(r16, PCC1R);
    524  1.2  uch 	DBG_BIT_PRINT(r16, AFER);
    525  1.2  uch 	DBG_BIT_PRINT(r16, GPIOR);
    526  1.2  uch 	DBG_BIT_PRINT(r16, TMU0R);
    527  1.2  uch 	DBG_BIT_PRINT(r16, TMU1R);
    528  1.2  uch 	DBG_BIT_PRINT(r16, IRDAR);
    529  1.2  uch 	DBG_BIT_PRINT(r16, UARTR);
    530  1.2  uch #undef DBG_BIT_PRINT
    531  1.2  uch 	DPRINTF((TEXT("\n")));
    532  1.2  uch 
    533  1.2  uch 	DPRINTF((TEXT("NIMR (Interrupt Mask Register)\n")));
    534  1.2  uch 	r16 = reg_read_2(HD64461_INTCNIMR_REG16);
    535  1.2  uch 	bitdisp(r16);
    536  1.2  uch #define DBG_BIT_PRINT(r, m)	_dbg_bit_print(r, HD64461_INTCNIMR_##m, #m)
    537  1.2  uch 	DBG_BIT_PRINT(r16, PCC0M);
    538  1.2  uch 	DBG_BIT_PRINT(r16, PCC1M);
    539  1.2  uch 	DBG_BIT_PRINT(r16, AFEM);
    540  1.2  uch 	DBG_BIT_PRINT(r16, GPIOM);
    541  1.2  uch 	DBG_BIT_PRINT(r16, TMU0M);
    542  1.2  uch 	DBG_BIT_PRINT(r16, TMU1M);
    543  1.2  uch 	DBG_BIT_PRINT(r16, IRDAM);
    544  1.2  uch 	DBG_BIT_PRINT(r16, UARTM);
    545  1.2  uch #undef DBG_BIT_PRINT
    546  1.2  uch 	DPRINTF((TEXT("\n")));
    547  1.2  uch 
    548  1.2  uch 	DPRINTF((TEXT("\n")));
    549  1.2  uch 
    550  1.2  uch 	// PCMCIA
    551  1.2  uch 	// PCC0
    552  1.2  uch 	DPRINTF((TEXT("[PCC0 memory and I/O card (SH3 Area 6)]\n")));
    553  1.2  uch 	DPRINTF((TEXT("PCC0 Interface Status Register\n")));
    554  1.2  uch 	r8 = reg_read_1(HD64461_PCC0ISR_REG8);
    555  1.2  uch 	bitdisp(r8);
    556  1.2  uch #define DBG_BIT_PRINT(r, m)	_dbg_bit_print(r, HD64461_PCC0ISR_##m, #m)
    557  1.2  uch 	DBG_BIT_PRINT(r8, P0READY);
    558  1.2  uch 	DBG_BIT_PRINT(r8, P0MWP);
    559  1.2  uch 	DBG_BIT_PRINT(r8, P0VS2);
    560  1.2  uch 	DBG_BIT_PRINT(r8, P0VS1);
    561  1.2  uch 	DBG_BIT_PRINT(r8, P0CD2);
    562  1.2  uch 	DBG_BIT_PRINT(r8, P0CD1);
    563  1.2  uch 	DBG_BIT_PRINT(r8, P0BVD2);
    564  1.2  uch 	DBG_BIT_PRINT(r8, P0BVD1);
    565  1.2  uch #undef DBG_BIT_PRINT
    566  1.2  uch 	DPRINTF((TEXT("\n")));
    567  1.2  uch 
    568  1.2  uch 	DPRINTF((TEXT("PCC0 General Control Register\n")));
    569  1.2  uch 	r8 = reg_read_1(HD64461_PCC0GCR_REG8);
    570  1.2  uch 	bitdisp(r8);
    571  1.2  uch #define DBG_BIT_PRINT(r, m)	_dbg_bit_print(r, HD64461_PCC0GCR_##m, #m)
    572  1.2  uch 	DBG_BIT_PRINT(r8, P0DRVE);
    573  1.2  uch 	DBG_BIT_PRINT(r8, P0PCCR);
    574  1.2  uch 	DBG_BIT_PRINT(r8, P0PCCT);
    575  1.2  uch 	DBG_BIT_PRINT(r8, P0VCC0);
    576  1.2  uch 	DBG_BIT_PRINT(r8, P0MMOD);
    577  1.2  uch 	DBG_BIT_PRINT(r8, P0PA25);
    578  1.2  uch 	DBG_BIT_PRINT(r8, P0PA24);
    579  1.2  uch 	DBG_BIT_PRINT(r8, P0REG);
    580  1.2  uch #undef DBG_BIT_PRINT
    581  1.2  uch 	DPRINTF((TEXT("\n")));
    582  1.2  uch 
    583  1.2  uch 	DPRINTF((TEXT("PCC0 Card Status Change Register\n")));
    584  1.2  uch 	r8 = reg_read_1(HD64461_PCC0CSCR_REG8);
    585  1.2  uch 	bitdisp(r8);
    586  1.2  uch #define DBG_BIT_PRINT(r, m)	_dbg_bit_print(r, HD64461_PCC0CSCR_##m, #m)
    587  1.2  uch 	DBG_BIT_PRINT(r8, P0SCDI);
    588  1.2  uch 	DBG_BIT_PRINT(r8, P0IREQ);
    589  1.2  uch 	DBG_BIT_PRINT(r8, P0SC);
    590  1.2  uch 	DBG_BIT_PRINT(r8, P0CDC);
    591  1.2  uch 	DBG_BIT_PRINT(r8, P0RC);
    592  1.2  uch 	DBG_BIT_PRINT(r8, P0BW);
    593  1.2  uch 	DBG_BIT_PRINT(r8, P0BD);
    594  1.2  uch #undef DBG_BIT_PRINT
    595  1.2  uch 	DPRINTF((TEXT("\n")));
    596  1.2  uch 
    597  1.2  uch 	DPRINTF((TEXT("PCC0 Card Status Change Interrupt Enable Register\n")));
    598  1.2  uch 	r8 = reg_read_1(HD64461_PCC0CSCIER_REG8);
    599  1.2  uch 	bitdisp(r8);
    600  1.2  uch #define DBG_BIT_PRINT(r, m)	_dbg_bit_print(r, HD64461_PCC0CSCIER_##m, #m)
    601  1.2  uch 	DBG_BIT_PRINT(r8, P0CRE);
    602  1.2  uch 	DBG_BIT_PRINT(r8, P0SCE);
    603  1.2  uch 	DBG_BIT_PRINT(r8, P0CDE);
    604  1.2  uch 	DBG_BIT_PRINT(r8, P0RE);
    605  1.2  uch 	DBG_BIT_PRINT(r8, P0BWE);
    606  1.2  uch 	DBG_BIT_PRINT(r8, P0BDE);
    607  1.2  uch #undef DBG_BIT_PRINT
    608  1.2  uch 	DPRINTF((TEXT("\ninterrupt type: ")));
    609  1.2  uch 	switch (r8 & HD64461_PCC0CSCIER_P0IREQE_MASK) {
    610  1.2  uch 	case HD64461_PCC0CSCIER_P0IREQE_NONE:
    611  1.2  uch 		DPRINTF((TEXT("none\n")));
    612  1.2  uch 		break;
    613  1.2  uch 	case HD64461_PCC0CSCIER_P0IREQE_LEVEL:
    614  1.2  uch 		DPRINTF((TEXT("level\n")));
    615  1.2  uch 		break;
    616  1.2  uch 	case HD64461_PCC0CSCIER_P0IREQE_FEDGE:
    617  1.2  uch 		DPRINTF((TEXT("falling edge\n")));
    618  1.2  uch 		break;
    619  1.2  uch 	case HD64461_PCC0CSCIER_P0IREQE_REDGE:
    620  1.2  uch 		DPRINTF((TEXT("rising edge\n")));
    621  1.2  uch 		break;
    622  1.2  uch 	}
    623  1.2  uch 
    624  1.2  uch 	DPRINTF((TEXT("PCC0 Software Control Register\n")));
    625  1.2  uch 	r8 = reg_read_1(HD64461_PCC0SCR_REG8);
    626  1.2  uch 	bitdisp(r8);
    627  1.2  uch #define DBG_BIT_PRINT(r, m)	_dbg_bit_print(r, HD64461_PCC0SCR_##m, #m)
    628  1.2  uch 	DBG_BIT_PRINT(r8, P0VCC1);
    629  1.2  uch 	DBG_BIT_PRINT(r8, P0SWP);
    630  1.2  uch #undef DBG_BIT_PRINT
    631  1.2  uch 	DPRINTF((TEXT("\n")));
    632  1.2  uch 
    633  1.2  uch 	// PCC1
    634  1.2  uch 	DPRINTF((TEXT("[PCC1 memory card only (SH3 Area 5)]\n")));
    635  1.2  uch 	DPRINTF((TEXT("PCC1 Interface Status Register\n")));
    636  1.2  uch 	r8 = reg_read_1(HD64461_PCC1ISR_REG8);
    637  1.2  uch 	bitdisp(r8);
    638  1.2  uch #define DBG_BIT_PRINT(r, m)	_dbg_bit_print(r, HD64461_PCC1ISR_##m, #m)
    639  1.2  uch 	DBG_BIT_PRINT(r8, P1READY);
    640  1.2  uch 	DBG_BIT_PRINT(r8, P1MWP);
    641  1.2  uch 	DBG_BIT_PRINT(r8, P1VS2);
    642  1.2  uch 	DBG_BIT_PRINT(r8, P1VS1);
    643  1.2  uch 	DBG_BIT_PRINT(r8, P1CD2);
    644  1.2  uch 	DBG_BIT_PRINT(r8, P1CD1);
    645  1.2  uch 	DBG_BIT_PRINT(r8, P1BVD2);
    646  1.2  uch 	DBG_BIT_PRINT(r8, P1BVD1);
    647  1.2  uch #undef DBG_BIT_PRINT
    648  1.2  uch 	DPRINTF((TEXT("\n")));
    649  1.2  uch 
    650  1.2  uch 	DPRINTF((TEXT("PCC1 General Contorol Register\n")));
    651  1.2  uch 	r8 = reg_read_1(HD64461_PCC1GCR_REG8);
    652  1.2  uch 	bitdisp(r8);
    653  1.2  uch #define DBG_BIT_PRINT(r, m)	_dbg_bit_print(r, HD64461_PCC1GCR_##m, #m)
    654  1.2  uch 	DBG_BIT_PRINT(r8, P1DRVE);
    655  1.2  uch 	DBG_BIT_PRINT(r8, P1PCCR);
    656  1.2  uch 	DBG_BIT_PRINT(r8, P1VCC0);
    657  1.2  uch 	DBG_BIT_PRINT(r8, P1MMOD);
    658  1.2  uch 	DBG_BIT_PRINT(r8, P1PA25);
    659  1.2  uch 	DBG_BIT_PRINT(r8, P1PA24);
    660  1.2  uch 	DBG_BIT_PRINT(r8, P1REG);
    661  1.2  uch #undef DBG_BIT_PRINT
    662  1.2  uch 	DPRINTF((TEXT("\n")));
    663  1.2  uch 
    664  1.2  uch 	DPRINTF((TEXT("PCC1 Card Status Change Register\n")));
    665  1.2  uch 	r8 = reg_read_1(HD64461_PCC1CSCR_REG8);
    666  1.2  uch 	bitdisp(r8);
    667  1.2  uch #define DBG_BIT_PRINT(r, m)	_dbg_bit_print(r, HD64461_PCC1CSCR_##m, #m)
    668  1.2  uch 	DBG_BIT_PRINT(r8, P1SCDI);
    669  1.2  uch 	DBG_BIT_PRINT(r8, P1CDC);
    670  1.2  uch 	DBG_BIT_PRINT(r8, P1RC);
    671  1.2  uch 	DBG_BIT_PRINT(r8, P1BW);
    672  1.2  uch 	DBG_BIT_PRINT(r8, P1BD);
    673  1.2  uch #undef DBG_BIT_PRINT
    674  1.2  uch 	DPRINTF((TEXT("\n")));
    675  1.2  uch 
    676  1.2  uch 	DPRINTF((TEXT("PCC1 Card Status Change Interrupt Enable Register\n")));
    677  1.2  uch 	r8 = reg_read_1(HD64461_PCC1CSCIER_REG8);
    678  1.2  uch 	bitdisp(r8);
    679  1.2  uch #define DBG_BIT_PRINT(r, m)	_dbg_bit_print(r, HD64461_PCC1CSCIER_##m, #m)
    680  1.2  uch 	DBG_BIT_PRINT(r8, P1CRE);
    681  1.2  uch 	DBG_BIT_PRINT(r8, P1CDE);
    682  1.2  uch 	DBG_BIT_PRINT(r8, P1RE);
    683  1.2  uch 	DBG_BIT_PRINT(r8, P1BWE);
    684  1.2  uch 	DBG_BIT_PRINT(r8, P1BDE);
    685  1.2  uch #undef DBG_BIT_PRINT
    686  1.2  uch 	DPRINTF((TEXT("\n")));
    687  1.2  uch 
    688  1.2  uch 	DPRINTF((TEXT("PCC1 Software Control Register\n")));
    689  1.2  uch 	r8 = reg_read_1(HD64461_PCC1SCR_REG8);
    690  1.2  uch 	bitdisp(r8);
    691  1.2  uch #define DBG_BIT_PRINT(r, m)	_dbg_bit_print(r, HD64461_PCC1SCR_##m, #m)
    692  1.2  uch 	DBG_BIT_PRINT(r8, P1VCC1);
    693  1.2  uch 	DBG_BIT_PRINT(r8, P1SWP);
    694  1.2  uch #undef DBG_BIT_PRINT
    695  1.2  uch 	DPRINTF((TEXT("\n")));
    696  1.2  uch 
    697  1.2  uch 	// General Control
    698  1.2  uch 	DPRINTF((TEXT("[General Control]\n")));
    699  1.2  uch 	DPRINTF((TEXT("PCC0 Output pins Control Register\n")));
    700  1.2  uch 	r8 = reg_read_1(HD64461_PCCP0OCR_REG8);
    701  1.2  uch 	bitdisp(r8);
    702  1.2  uch #define DBG_BIT_PRINT(r, m)	_dbg_bit_print(r, HD64461_PCCP0OCR_##m, #m)
    703  1.2  uch 	DBG_BIT_PRINT(r8, P0DEPLUP);
    704  1.2  uch 	DBG_BIT_PRINT(r8, P0AEPLUP);
    705  1.2  uch #undef DBG_BIT_PRINT
    706  1.2  uch 	DPRINTF((TEXT("\n")));
    707  1.2  uch 
    708  1.2  uch 	DPRINTF((TEXT("PCC1 Output pins Control Register\n")));
    709  1.2  uch 	r8 = reg_read_1(HD64461_PCCP1OCR_REG8);
    710  1.2  uch 	bitdisp(r8);
    711  1.2  uch #define DBG_BIT_PRINT(r, m)	_dbg_bit_print(r, HD64461_PCCP1OCR_##m, #m)
    712  1.2  uch 	DBG_BIT_PRINT(r8, P1RST8MA);
    713  1.2  uch 	DBG_BIT_PRINT(r8, P1RST4MA);
    714  1.2  uch 	DBG_BIT_PRINT(r8, P1RAS8MA);
    715  1.2  uch 	DBG_BIT_PRINT(r8, P1RAS4MA);
    716  1.2  uch #undef DBG_BIT_PRINT
    717  1.2  uch 	DPRINTF((TEXT("\n")));
    718  1.2  uch 
    719  1.2  uch 	DPRINTF((TEXT("PC Card General Control Register\n")));
    720  1.2  uch 	r8 = reg_read_1(HD64461_PCCPGCR_REG8);
    721  1.2  uch 	bitdisp(r8);
    722  1.2  uch #define DBG_BIT_PRINT(r, m)	_dbg_bit_print(r, HD64461_PCCPGCR_##m, #m)
    723  1.2  uch 	DBG_BIT_PRINT(r8, PSSDIR);
    724  1.2  uch 	DBG_BIT_PRINT(r8, PSSRDWR);
    725  1.2  uch #undef DBG_BIT_PRINT
    726  1.2  uch 	DPRINTF((TEXT("\n")));
    727  1.2  uch 
    728  1.2  uch 	// GPIO
    729  1.2  uch #define GPIO_DUMP_REG8(x)						\
    730  1.2  uch 	bitdisp(reg_read_1(HD64461_GPA##x##R_REG16));			\
    731  1.2  uch 	bitdisp(reg_read_1(HD64461_GPB##x##R_REG16));			\
    732  1.2  uch 	bitdisp(reg_read_1(HD64461_GPC##x##R_REG16));			\
    733  1.2  uch 	bitdisp(reg_read_1(HD64461_GPD##x##R_REG16))
    734  1.2  uch #define GPIO_DUMP_REG16(x)						\
    735  1.2  uch 	bitdisp(reg_read_2(HD64461_GPA##x##R_REG16));			\
    736  1.2  uch 	bitdisp(reg_read_2(HD64461_GPB##x##R_REG16));			\
    737  1.2  uch 	bitdisp(reg_read_2(HD64461_GPC##x##R_REG16));			\
    738  1.2  uch 	bitdisp(reg_read_2(HD64461_GPD##x##R_REG16))
    739  1.2  uch 
    740  1.2  uch 	DPRINTF((TEXT("GPIO Port Control Register\n")));
    741  1.2  uch 	GPIO_DUMP_REG16(C);
    742  1.2  uch 	DPRINTF((TEXT("GPIO Port Data Register\n")));
    743  1.2  uch 	GPIO_DUMP_REG8(D);
    744  1.2  uch 	DPRINTF((TEXT("GPIO Port Interrupt Control Register\n")));
    745  1.2  uch 	GPIO_DUMP_REG8(IC);
    746  1.2  uch 	DPRINTF((TEXT("GPIO Port Interrupt Status  Register\n")));
    747  1.2  uch 	GPIO_DUMP_REG8(IS);
    748  1.2  uch }
    749  1.2  uch 
    750  1.2  uch #ifdef SH7709TEST
    751  1.1  uch 	u_int32_t sh7707_fb_dma_addr;
    752  1.1  uch 	u_int16_t val;
    753  1.1  uch 	int s;
    754  1.1  uch 
    755  1.1  uch 	s = suspendIntr();
    756  1.1  uch 	VOLATILE_REF16(SH7707_LCDAR_REG16) = SH7707_LCDAR_LCDDMR0;
    757  1.1  uch 	val = VOLATILE_REF16(SH7707_LCDDMR_REG16);
    758  1.1  uch 	sh7707_fb_dma_addr = val;
    759  1.1  uch 	VOLATILE_REF16(SH7707_LCDAR_REG16) = SH7707_LCDAR_LCDDMR1;
    760  1.1  uch 	val = VOLATILE_REF16(SH7707_LCDDMR_REG16);
    761  1.1  uch 	sh7707_fb_dma_addr |= (val << 16);
    762  1.1  uch 	resumeIntr(s);
    763  1.1  uch 
    764  1.1  uch 	DPRINTF((TEXT("SH7707 frame buffer dma address: 0x%08x\n"),
    765  1.1  uch 		 sh7707_fb_dma_addr));
    766  1.1  uch #endif
    767