Home | History | Annotate | Line # | Download | only in dev
sh.h revision 1.4
      1  1.4  uwe /* -*-C++-*-	$NetBSD: sh.h,v 1.4 2006/03/05 04:05:39 uwe Exp $	*/
      2  1.1  uch 
      3  1.1  uch /*-
      4  1.1  uch  * Copyright (c) 2001, 2002 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.1  uch #ifndef _HPCBOOT_SH_DEV_SH_H_
     40  1.2  uch #define	_HPCBOOT_SH_DEV_SH_H_
     41  1.1  uch 
     42  1.1  uch /*
     43  1.1  uch  * SH3, SH4 embeded devices.
     44  1.1  uch  */
     45  1.1  uch 
     46  1.1  uch /*
     47  1.1  uch  * INTC
     48  1.1  uch  */
     49  1.1  uch /* SH7709/7709A */
     50  1.1  uch /* R/W 16bit */
     51  1.2  uch #define	SH3_ICR0		0xfffffee0
     52  1.2  uch #define	SH3_ICR1		0xa4000010
     53  1.2  uch #define	SH3_ICR2		0xa4000012
     54  1.2  uch #define	SH3_PINTER		0xa4000014
     55  1.2  uch #define	SH3_IPRA		0xfffffee2
     56  1.2  uch #define	SH3_IPRB		0xfffffee4
     57  1.2  uch #define	SH3_IPRC		0xa4000016
     58  1.2  uch #define	SH3_IPRD		0xa4000018
     59  1.2  uch #define	SH3_IPRE		0xa400001a
     60  1.2  uch /* R/W 8bit */
     61  1.2  uch #define	SH3_IRR0		0xa4000004
     62  1.2  uch /* R 8bit */
     63  1.2  uch #define	SH3_IRR1		0xa4000006
     64  1.2  uch #define	SH3_IRR2		0xa4000008
     65  1.2  uch 
     66  1.2  uch #define	SH3_ICR0_NMIL		  0x8000
     67  1.2  uch #define	SH3_ICR0_NMIE		  0x0100
     68  1.2  uch 
     69  1.2  uch #define	SH3_ICR1_MAI		  0x8000
     70  1.2  uch #define	SH3_ICR1_IRQLVL		  0x4000
     71  1.2  uch #define	SH3_ICR1_BLMSK		  0x2000
     72  1.2  uch #define	SH3_ICR1_IRLSEN		  0x1000
     73  1.2  uch #define	SH3_ICR1_IRQ51S		  0x0800
     74  1.2  uch #define	SH3_ICR1_IRQ50S		  0x0400
     75  1.2  uch #define	SH3_ICR1_IRQ41S		  0x0200
     76  1.2  uch #define	SH3_ICR1_IRQ40S		  0x0100
     77  1.2  uch #define	SH3_ICR1_IRQ31S		  0x0080
     78  1.2  uch #define	SH3_ICR1_IRQ30S		  0x0040
     79  1.2  uch #define	SH3_ICR1_IRQ21S		  0x0020
     80  1.2  uch #define	SH3_ICR1_IRQ20S		  0x0010
     81  1.2  uch #define	SH3_ICR1_IRQ11S		  0x0008
     82  1.2  uch #define	SH3_ICR1_IRQ10S		  0x0004
     83  1.2  uch #define	SH3_ICR1_IRQ01S		  0x0002
     84  1.2  uch #define	SH3_ICR1_IRQ00S		  0x0001
     85  1.2  uch 
     86  1.2  uch #define	SH3_SENSE_SELECT_MASK		  0x3
     87  1.2  uch #define	SH3_SENSE_SELECT_FALLING_EDGE	  0x0
     88  1.2  uch #define	SH3_SENSE_SELECT_RAISING_EDGE	  0x1
     89  1.2  uch #define	SH3_SENSE_SELECT_LOW_LEVEL	  0x2
     90  1.2  uch #define	SH3_SENSE_SELECT_RESERVED	  0x3
     91  1.2  uch 
     92  1.2  uch #define	SH3_ICR2_PINT15S	  0x8000
     93  1.2  uch #define	SH3_ICR2_PINT14S	  0x4000
     94  1.2  uch #define	SH3_ICR2_PINT13S	  0x2000
     95  1.2  uch #define	SH3_ICR2_PINT12S	  0x1000
     96  1.2  uch #define	SH3_ICR2_PINT11S	  0x0800
     97  1.2  uch #define	SH3_ICR2_PINT10S	  0x0400
     98  1.2  uch #define	SH3_ICR2_PINT9S		  0x0200
     99  1.2  uch #define	SH3_ICR2_PINT8S		  0x0100
    100  1.2  uch #define	SH3_ICR2_PINT7S		  0x0080
    101  1.2  uch #define	SH3_ICR2_PINT6S		  0x0040
    102  1.2  uch #define	SH3_ICR2_PINT5S		  0x0020
    103  1.2  uch #define	SH3_ICR2_PINT4S		  0x0010
    104  1.2  uch #define	SH3_ICR2_PINT3S		  0x0008
    105  1.2  uch #define	SH3_ICR2_PINT2S		  0x0004
    106  1.2  uch #define	SH3_ICR2_PINT1S		  0x0002
    107  1.2  uch #define	SH3_ICR2_PINT0S		  0x0001
    108  1.1  uch 
    109  1.2  uch #define	SH_IPR_MASK		0xf
    110  1.1  uch 
    111  1.1  uch /* SH7750 */
    112  1.2  uch #define	SH4_ICR			0xffd00000
    113  1.2  uch #define	  SH4_ICR_NMIL		  0x8000
    114  1.2  uch #define	  SH4_ICR_MAI		  0x4000
    115  1.2  uch #define	  SH4_ICR_NMIB		  0x0200
    116  1.2  uch #define	  SH4_ICR_NMIE		  0x0100
    117  1.2  uch #define	  SH4_ICR_IRLM		  0x0080
    118  1.2  uch #define	SH4_IPRA		0xffd00004
    119  1.2  uch #define	SH4_IPRB		0xffd00008
    120  1.2  uch #define	SH4_IPRC		0xffd0000c
    121  1.1  uch /* SH7750S */
    122  1.2  uch #define	SH4_IPRD		0xffd00010
    123  1.1  uch 
    124  1.1  uch /*
    125  1.1  uch  * Bus State Controller
    126  1.1  uch  */
    127  1.2  uch #define	SH3_BCR1	        0xffffff60
    128  1.2  uch #define	SH3_BCR2	        0xffffff62
    129  1.2  uch #define	SH3_WCR1	        0xffffff64
    130  1.2  uch #define	SH3_WCR2	        0xffffff66
    131  1.2  uch #define	SH3_MCR		        0xffffff68
    132  1.2  uch #define	SH3_DCR		        0xffffff6a
    133  1.2  uch #define	SH3_PCR		        0xffffff6c
    134  1.2  uch #define	SH3_RTCSR	        0xffffff6e
    135  1.2  uch #define	SH3_RTCNT	        0xffffff70
    136  1.2  uch #define	SH3_RTCOR	        0xffffff72
    137  1.2  uch #define	SH3_RFCR	        0xffffff74
    138  1.2  uch #define	SH3_BCR3	        0xffffff7e
    139  1.1  uch 
    140  1.1  uch /*
    141  1.1  uch  * Pin Function Controller
    142  1.2  uch  */
    143  1.2  uch #define	SH3_PACR		0xa4000100
    144  1.2  uch #define	SH3_PBCR		0xa4000102
    145  1.2  uch #define	SH3_PCCR		0xa4000104
    146  1.2  uch #define	SH3_PDCR		0xa4000106
    147  1.2  uch #define	SH3_PECR		0xa4000108
    148  1.2  uch #define	SH3_PFCR		0xa400010a
    149  1.2  uch #define	SH3_PGCR		0xa400010c
    150  1.2  uch #define	SH3_PHCR		0xa400010e
    151  1.2  uch #define	SH3_PJCR		0xa4000110
    152  1.2  uch #define	SH3_PKCR		0xa4000112
    153  1.2  uch #define	SH3_PLCR		0xa4000114
    154  1.2  uch #define	SH3_SCPCR		0xa4000116
    155  1.1  uch 
    156  1.1  uch /*
    157  1.1  uch  * I/O port
    158  1.1  uch  */
    159  1.2  uch #define	SH3_PADR		0xa4000120
    160  1.2  uch #define	SH3_PBDR		0xa4000122
    161  1.2  uch #define	SH3_PCDR		0xa4000124
    162  1.2  uch #define	SH3_PDDR		0xa4000126
    163  1.2  uch #define	SH3_PEDR		0xa4000128
    164  1.2  uch #define	SH3_PFDR		0xa400012a
    165  1.2  uch #define	SH3_PGDR		0xa400012c
    166  1.2  uch #define	SH3_PHDR		0xa400012e
    167  1.2  uch #define	SH3_PJDR		0xa4000130
    168  1.2  uch #define	SH3_PKDR		0xa4000132
    169  1.2  uch #define	SH3_PLDR		0xa4000134
    170  1.2  uch #define	SH3_SCPDR		0xa4000136
    171  1.1  uch 
    172  1.1  uch /*
    173  1.1  uch  * TMU
    174  1.1  uch  */
    175  1.2  uch #define	SH3_TOCR		0xfffffe90
    176  1.2  uch #define	  SH3_TOCR_TCOE		  0x01
    177  1.2  uch #define	SH3_TSTR		0xfffffe92
    178  1.2  uch #define	  SH3_TSTR_STR2		  0x04
    179  1.2  uch #define	  SH3_TSTR_STR1		  0x02
    180  1.2  uch #define	  SH3_TSTR_STR0		  0x01
    181  1.2  uch #define	SH3_TCOR0		0xfffffe94
    182  1.2  uch #define	SH3_TCNT0		0xfffffe98
    183  1.2  uch #define	SH3_TCR0		0xfffffe9c
    184  1.2  uch #define	SH3_TCOR1		0xfffffea0
    185  1.2  uch #define	SH3_TCNT1		0xfffffea4
    186  1.2  uch #define	SH3_TCR1		0xfffffea8
    187  1.2  uch #define	SH3_TCOR2		0xfffffeac
    188  1.2  uch #define	SH3_TCNT2		0xfffffeb0
    189  1.2  uch #define	SH3_TCR2		0xfffffeb4
    190  1.2  uch #define	SH3_TCPR2		0xfffffeb8
    191  1.2  uch #define	  SH3_TCR_ICPF		  0x0200
    192  1.2  uch #define	  SH3_TCR_UNF		  0x0100
    193  1.2  uch #define	  SH3_TCR_ICPE1		  0x0080
    194  1.2  uch #define	  SH3_TCR_ICPE0		  0x0040
    195  1.2  uch #define	  SH3_TCR_UNIE		  0x0020
    196  1.2  uch #define	  SH3_TCR_CKEG1		  0x0010
    197  1.2  uch #define	  SH3_TCR_CKEG0		  0x0008
    198  1.2  uch #define	  SH3_TCR_TPSC2		  0x0004
    199  1.2  uch #define	  SH3_TCR_TPSC1		  0x0002
    200  1.2  uch #define	  SH3_TCR_TPSC0		  0x0001
    201  1.2  uch 
    202  1.2  uch #define	  SH3_TCR_TPSC_P4	  0x0000
    203  1.2  uch #define	  SH3_TCR_TPSC_P16	  0x0001
    204  1.2  uch #define	  SH3_TCR_TPSC_P64	  0x0002
    205  1.2  uch #define	  SH3_TCR_TPSC_P256	  0x0003
    206  1.1  uch 
    207  1.1  uch /*
    208  1.1  uch  * SCI
    209  1.1  uch  */
    210  1.2  uch #define	SH4_SCSMR		0xffe00000
    211  1.2  uch #define	SH4_SCBRR		0xffe00004
    212  1.2  uch #define	SH4_SCSCR		0xffe00008
    213  1.2  uch #define	SH4_SCTDR		0xffe0000c
    214  1.2  uch #define	SH4_SCSSR		0xffe00010
    215  1.2  uch #define	SH4_SCRDR		0xffe00014
    216  1.2  uch 
    217  1.2  uch #define	SH3_SCRSR		/* can't access from CPU */
    218  1.2  uch #define	SH3_SCTSR		/* can't access from CPU */
    219  1.2  uch #define	SH3_SCSMR		0xfffffe80
    220  1.2  uch #define	SH3_SCBRR		0xfffffe82
    221  1.2  uch #define	SH3_SCSCR		0xfffffe84
    222  1.2  uch #define	SH3_SCTDR		0xfffffe86
    223  1.2  uch #define	SH3_SCSSR		0xfffffe88
    224  1.2  uch #define	SH3_SCRDR		0xfffffe8a
    225  1.2  uch #define	SH3_SCPCR		0xa4000116
    226  1.2  uch #define	SH3_SCPDR		0xa4000136
    227  1.1  uch 
    228  1.2  uch #define	SCSSR_TDRE		  0x80
    229  1.1  uch 
    230  1.2  uch #define	SH3_SCI_TX_BUSY()						\
    231  1.1  uch 	while ((_reg_read_1(SH3_SCSSR) & SCSSR_TDRE) == 0)
    232  1.1  uch 
    233  1.2  uch #define	SH3_SCI_PUTC(c)							\
    234  1.1  uch __BEGIN_MACRO								\
    235  1.1  uch 	SH3_SCI_TX_BUSY();						\
    236  1.1  uch 	_reg_write_1(SH3_SCTDR, c);					\
    237  1.1  uch 	_reg_write_1(SH3_SCSSR,						\
    238  1.1  uch 	    _reg_read_1(SH3_SCSSR) & ~SCSSR_TDRE);			\
    239  1.1  uch __END_MACRO
    240  1.1  uch 
    241  1.2  uch #define	SH3_SCI_PRINT(s)							\
    242  1.1  uch __BEGIN_MACRO								\
    243  1.1  uch 	char *__s =(char *)(s);						\
    244  1.1  uch 	int __i;							\
    245  1.1  uch 	for (__i = 0; __s[__i] != '\0'; __i++) {			\
    246  1.1  uch 		char __c = __s[__i];					\
    247  1.1  uch 		if (__c == '\n')					\
    248  1.1  uch 			SH3_SCI_PUTC('\r');				\
    249  1.1  uch 		SH3_SCI_PUTC(__c);					\
    250  1.1  uch 	}								\
    251  1.1  uch __END_MACRO
    252  1.1  uch 
    253  1.2  uch /*
    254  1.1  uch  * SCIF
    255  1.1  uch  */
    256  1.2  uch #define	SH4_SCSMR2		0xffe80000
    257  1.2  uch #define	SH4_SCBRR2		0xffe80004
    258  1.2  uch #define	SH4_SCSCR2		0xffe80008
    259  1.2  uch #define	SH4_SCFTDR2		0xffe8000c
    260  1.2  uch #define	SH4_SCFSR2		0xffe80010
    261  1.2  uch #define	SH4_SCFRDR2		0xffe80014
    262  1.2  uch #define	SH4_SCFCR2		0xffe80018
    263  1.2  uch #define	SH4_SCFDR2		0xffe8001c
    264  1.2  uch #define	SH4_SCSPTR2		0xffe80020
    265  1.2  uch #define	SH4_SCLSR2		0xffe80024
    266  1.2  uch #define	SH4_SCSMR2		0xffe80000
    267  1.2  uch #define	SH4_SCBRR2		0xffe80004
    268  1.2  uch #define	SH4_SCSCR2		0xffe80008
    269  1.2  uch #define	SH4_SCFTDR2		0xffe8000c
    270  1.2  uch #define	SH4_SCFSR2		0xffe80010
    271  1.2  uch #define	SH4_SCFRDR2		0xffe80014
    272  1.2  uch #define	SH4_SCFCR2		0xffe80018
    273  1.2  uch #define	SH4_SCFDR2		0xffe8001c
    274  1.2  uch #define	SH4_SCSPTR2		0xffe80020
    275  1.2  uch #define	SH4_SCLSR2		0xffe80024
    276  1.1  uch 
    277  1.1  uch #define	SH4_SCSSR2		SH4_SCFSR2
    278  1.1  uch #define	SH4_SCSSR2		SH4_SCFSR2
    279  1.1  uch 
    280  1.2  uch #define	SH3_SCSMR2		0xa4000150	/* R/W */
    281  1.2  uch #define	SH3_SCBRR2		0xa4000152	/* R/W */
    282  1.2  uch #define	SH3_SCSCR2		0xa4000154	/* R/W */
    283  1.2  uch #define	SH3_SCFTDR2		0xa4000156	/* W */
    284  1.2  uch #define	SH3_SCSSR2		0xa4000158	/* R/W(0 write only) */
    285  1.2  uch #define	SH3_SCFRDR2		0xa400015a	/* R */
    286  1.2  uch #define	SH3_SCFCR2		0xa400015c	/* R/W */
    287  1.2  uch #define	SH3_SCFDR2		0xa400015e	/* R */
    288  1.2  uch #define	SH3_SCSMR2		0xa4000150	/* R/W */
    289  1.2  uch #define	SH3_SCBRR2		0xa4000152	/* R/W */
    290  1.2  uch #define	SH3_SCSCR2		0xa4000154	/* R/W */
    291  1.2  uch #define	SH3_SCFTDR2		0xa4000156	/* W */
    292  1.2  uch #define	SH3_SCSSR2		0xa4000158	/* R/W(0 write only) */
    293  1.2  uch #define	SH3_SCFRDR2		0xa400015a	/* R */
    294  1.2  uch #define	SH3_SCFCR2		0xa400015c	/* R/W */
    295  1.2  uch #define	SH3_SCFDR2		0xa400015e	/* R */
    296  1.2  uch 
    297  1.2  uch #define	SCSCR2_TIE	          0x0080	/* Transmit Interrupt Enable */
    298  1.2  uch #define	SCSCR2_RIE	          0x0040	/* Receive Interrupt Enable */
    299  1.2  uch #define	SCSCR2_TE	          0x0020	/* Transmit Enable */
    300  1.2  uch #define	SCSCR2_RE	          0x0010	/* Receive Enable */
    301  1.2  uch #define	SCSCR2_CKE1	          0x0002	/* ClocK Enable 1 */
    302  1.2  uch #define	SCSCR2_CKE0	          0x0001	/* ClocK Enable 0 */
    303  1.2  uch #define	SCSCR2_CKE	          0x0003	/* ClocK Enable mask */
    304  1.2  uch 
    305  1.2  uch #define	SCSSR2_ER	          0x0080	/* ERror */
    306  1.2  uch #define	SCSSR2_TEND	          0x0040	/* Transmit END */
    307  1.2  uch #define	SCSSR2_TDFE	          0x0020	/* Transmit Data Fifo Empty */
    308  1.2  uch #define	SCSSR2_BRK	          0x0010	/* BReaK detection */
    309  1.2  uch #define	SCSSR2_FER	          0x0008	/* Framing ERror */
    310  1.2  uch #define	SCSSR2_PER	          0x0004	/* Parity ERror */
    311  1.2  uch #define	SCSSR2_RDF	          0x0002	/* Receive fifo Data Full */
    312  1.2  uch #define	SCSSR2_DR	          0x0001	/* Data Ready */
    313  1.2  uch 
    314  1.2  uch #define	SCFCR2_RTRG1		  0x0080	/* Receive TRiGger 1 */
    315  1.2  uch #define	SCFCR2_RTRG0		  0x0040	/* Receive TRiGger 0 */
    316  1.2  uch #define	SCFCR2_TTRG1		  0x0020	/* Transmit TRiGger 1 */
    317  1.2  uch #define	SCFCR2_TTRG0		  0x0010	/* Transmit TRiGger 0 */
    318  1.2  uch #define	SCFCR2_MCE		  0x0008	/* Modem Control Enable */
    319  1.2  uch #define	SCFCR2_TFRST		  0x0004	/* Transmit Fifo register ReSeT */
    320  1.2  uch #define	SCFCR2_RFRST		  0x0002	/* Receive Fifo register ReSeT */
    321  1.2  uch #define	SCFCR2_LOOP		  0x0001	/* LOOP back test */
    322  1.2  uch #define	FIFO_RCV_TRIGGER_1	  0x0000
    323  1.2  uch #define	FIFO_RCV_TRIGGER_4	  0x0040
    324  1.2  uch #define	FIFO_RCV_TRIGGER_8	  0x0080
    325  1.2  uch #define	FIFO_RCV_TRIGGER_14	  0x00c0
    326  1.2  uch #define	FIFO_XMT_TRIGGER_8	  0x0000
    327  1.2  uch #define	FIFO_XMT_TRIGGER_4	  0x0010
    328  1.2  uch #define	FIFO_XMT_TRIGGER_2	  0x0020
    329  1.2  uch #define	FIFO_XMT_TRIGGER_1	  0x0030
    330  1.2  uch 
    331  1.2  uch #define	SCFDR2_TXCNT		  0xff00	/* Tx CouNT */
    332  1.2  uch #define	SCFDR2_RECVCNT		  0x00ff	/* Rx CouNT */
    333  1.2  uch #define	SCFDR2_TXF_FULL		  0x1000	/* Tx FULL */
    334  1.2  uch #define	SCFDR2_RXF_EPTY		  0x0000	/* Rx EMPTY */
    335  1.2  uch 
    336  1.2  uch #define	SCSMR2_CHR		  0x40		/* Character length */
    337  1.2  uch #define	SCSMR2_PE		  0x20		/* Parity enable */
    338  1.2  uch #define	SCSMR2_OE		  0x10		/* Parity mode */
    339  1.2  uch #define	SCSMR2_STOP		  0x08		/* Stop bit length */
    340  1.2  uch #define	SCSMR2_CKS		  0x03		/* Clock select */
    341  1.1  uch 
    342  1.1  uch /* simple serial console macros. */
    343  1.2  uch #define	SH3_SCIF_TX_BUSY()						\
    344  1.1  uch 	while ((_reg_read_2(SH3_SCSSR2) & SCSSR2_TDFE) == 0)
    345  1.1  uch 
    346  1.2  uch #define	SH3_SCIF_PUTC(c)						\
    347  1.1  uch __BEGIN_MACRO								\
    348  1.1  uch 	SH3_SCIF_TX_BUSY();						\
    349  1.1  uch 	/*  wait until previous transmit done. */			\
    350  1.1  uch 	_reg_write_1(SH3_SCFTDR2, c);					\
    351  1.1  uch 	/* Clear transmit FIFO empty flag */				\
    352  1.1  uch 	_reg_write_1(SH3_SCSSR2,					\
    353  1.1  uch 	    _reg_read_1(SH3_SCSSR2) & ~(SCSSR2_TDFE | SCSSR2_TEND));	\
    354  1.1  uch __END_MACRO
    355  1.1  uch 
    356  1.2  uch #define	SH3_SCIF_PRINT(s)						\
    357  1.1  uch __BEGIN_MACRO								\
    358  1.1  uch 	char *__s =(char *)(s);						\
    359  1.1  uch 	int __i;							\
    360  1.1  uch 	for (__i = 0; __s[__i] != '\0'; __i++) {			\
    361  1.1  uch 		char __c = __s[__i];					\
    362  1.1  uch 		if (__c == '\n')					\
    363  1.1  uch 			SH3_SCIF_PUTC('\r');				\
    364  1.1  uch 		SH3_SCIF_PUTC(__c);					\
    365  1.1  uch 	}								\
    366  1.1  uch __END_MACRO
    367  1.1  uch 
    368  1.2  uch #define	SH3_SCIF_PRINT_HEX(h)						\
    369  1.1  uch __BEGIN_MACRO								\
    370  1.4  uwe 	uint32_t __h =(uint32_t)(h);					\
    371  1.1  uch 	int __i;							\
    372  1.1  uch 	SH3_SCIF_PUTC('0'); SH3_SCIF_PUTC('x');				\
    373  1.1  uch 	for (__i = 0; __i < 8; __i++, __h <<= 4) {			\
    374  1.1  uch 		int __n =(__h >> 28) & 0xf;				\
    375  1.1  uch 		char __c = __n > 9 ? 'A' + __n - 10 : '0' + __n;	\
    376  1.1  uch 		SH3_SCIF_PUTC(__c);					\
    377  1.1  uch 	}								\
    378  1.1  uch 	SH3_SCIF_PUTC('\r'); SH3_SCIF_PUTC('\n');			\
    379  1.1  uch __END_MACRO
    380  1.1  uch 
    381  1.1  uch #endif /* _HPCBOOT_SH_DEV_SH_H_ */
    382