1 |
/* GXemul: $Id: sh4_scifreg.h,v 1.1 2006/10/19 10:15:57 debug Exp $ */ |
2 |
/* $NetBSD: scifreg.h,v 1.10 2006/02/18 00:41:32 uwe Exp $ */ |
3 |
|
4 |
#ifndef _SH3_SCIFREG_H_ |
5 |
#define _SH3_SCIFREG_H_ |
6 |
|
7 |
/*- |
8 |
* Copyright (C) 1999 SAITOH Masanobu. All rights reserved. |
9 |
* |
10 |
* Redistribution and use in source and binary forms, with or without |
11 |
* modification, are permitted provided that the following conditions |
12 |
* are met: |
13 |
* 1. Redistributions of source code must retain the above copyright |
14 |
* notice, this list of conditions and the following disclaimer. |
15 |
* 2. Redistributions in binary form must reproduce the above copyright |
16 |
* notice, this list of conditions and the following disclaimer in the |
17 |
* documentation and/or other materials provided with the distribution. |
18 |
* 3. The name of the author may not be used to endorse or promote products |
19 |
* derived from this software without specific prior written permission. |
20 |
* |
21 |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
22 |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
23 |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
24 |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
25 |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
26 |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
27 |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
28 |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
29 |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
30 |
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
31 |
*/ |
32 |
|
33 |
/* |
34 |
* Serial Communication Interface with FIFO (SCIF) |
35 |
*/ |
36 |
|
37 |
#define SH3_SCIF0_BASE 0xa4000150 |
38 |
#define SH3_SCIF1_BASE 0xa4000140 |
39 |
|
40 |
#define SH4_SCIF_BASE 0xffe80000 |
41 |
|
42 |
#ifdef SH3 |
43 |
|
44 |
/* SH3 definitions */ |
45 |
|
46 |
#define SCIF_SMR 0x0 /* serial mode */ |
47 |
#define SCIF_BRR 0x2 /* bit rate */ |
48 |
#define SCIF_SCR 0x4 /* serial control */ |
49 |
#define SCIF_FTDR 0x6 /* transmit fifo data */ |
50 |
#define SCIF_SSR 0x8 /* serial status */ |
51 |
#define SCIF_FRDR 0xa /* receive fifo data */ |
52 |
#define SCIF_FCR 0xc /* fifo control */ |
53 |
#define SCIF_FDR 0xe /* fifo data count set */ |
54 |
|
55 |
#define SHREG_SCSMR2 (*(volatile uint8_t *)(SH3_SCIF0_BASE + SCIF_SMR)) |
56 |
#define SHREG_SCBRR2 (*(volatile uint8_t *)(SH3_SCIF0_BASE + SCIF_BRR)) |
57 |
#define SHREG_SCSCR2 (*(volatile uint8_t *)(SH3_SCIF0_BASE + SCIF_SCR)) |
58 |
#define SHREG_SCFTDR2 (*(volatile uint8_t *)(SH3_SCIF0_BASE + SCIF_FTDR)) |
59 |
#define SHREG_SCSSR2 (*(volatile uint16_t *)(SH3_SCIF0_BASE + SCIF_SSR)) |
60 |
#define SHREG_SCFRDR2 (*(volatile uint8_t *)(SH3_SCIF0_BASE + SCIF_FRDR)) |
61 |
#define SHREG_SCFCR2 (*(volatile uint8_t *)(SH3_SCIF0_BASE + SCIF_FCR)) |
62 |
#define SHREG_SCFDR2 (*(volatile uint16_t *)(SH3_SCIF0_BASE + SCIF_FDR)) |
63 |
|
64 |
#else /* !SH3 */ |
65 |
|
66 |
/* SH4 definitions */ |
67 |
|
68 |
#define SCIF_SMR 0x00 /* serial mode */ |
69 |
#define SCIF_BRR 0x04 /* bit rate */ |
70 |
#define SCIF_SCR 0x08 /* serial control */ |
71 |
#define SCIF_FTDR 0x0c /* transmit fifo data */ |
72 |
#define SCIF_SSR 0x10 /* serial status */ |
73 |
#define SCIF_FRDR 0x14 /* receive fifo data */ |
74 |
#define SCIF_FCR 0x18 /* fifo control */ |
75 |
#define SCIF_FDR 0x1c /* fifo data count set */ |
76 |
|
77 |
#define SCIF_SPTR 0x20 /* seial port */ |
78 |
#define SCIF_LSR 0x24 /* line status */ |
79 |
|
80 |
#define SHREG_SCSMR2 (*(volatile uint16_t *)(SH4_SCIF_BASE + SCIF_SMR)) |
81 |
#define SHREG_SCBRR2 (*(volatile uint8_t *)(SH4_SCIF_BASE + SCIF_BRR)) |
82 |
#define SHREG_SCSCR2 (*(volatile uint16_t *)(SH4_SCIF_BASE + SCIF_SCR)) |
83 |
#define SHREG_SCFTDR2 (*(volatile uint8_t *)(SH4_SCIF_BASE + SCIF_FTDR)) |
84 |
#define SHREG_SCSSR2 (*(volatile uint16_t *)(SH4_SCIF_BASE + SCIF_SSR)) |
85 |
#define SHREG_SCFRDR2 (*(volatile uint8_t *)(SH4_SCIF_BASE + SCIF_FRDR)) |
86 |
#define SHREG_SCFCR2 (*(volatile uint16_t *)(SH4_SCIF_BASE + SCIF_FCR)) |
87 |
#define SHREG_SCFDR2 (*(volatile uint16_t *)(SH4_SCIF_BASE + SCIF_FDR)) |
88 |
|
89 |
#define SHREG_SCSPTR2 (*(volatile uint16_t *)(SH4_SCIF_BASE + SCIF_SPTR)) |
90 |
#define SHREG_SCLSR2 (*(volatile uint16_t *)(SH4_SCIF_BASE + SCIF_LSR)) |
91 |
|
92 |
/* alias */ |
93 |
#define SHREG_SCSFDR2 SHREG_SCFTDR2 |
94 |
#define SHREG_SCFSR2 SHREG_SCSSR2 |
95 |
|
96 |
#define SCSPTR2_RTSIO 0x0080 |
97 |
#define SCSPTR2_RTSDT 0x0040 |
98 |
#define SCSPTR2_CTSIO 0x0020 |
99 |
#define SCSPTR2_CTSDT 0x0010 |
100 |
#define SCSPTR2_SCKIO 0x0008 |
101 |
#define SCSPTR2_SCKDT 0x0004 |
102 |
#define SCSPTR2_SPB2IO 0x0002 |
103 |
#define SCSPTR2_SPB2DT 0x0001 |
104 |
|
105 |
#define SCLSR2_ORER 0x0001 /* overrun error */ |
106 |
|
107 |
#endif /* !SH3 */ |
108 |
|
109 |
/* SMR: serial mode */ |
110 |
#define SCSMR2_CHR 0x40 /* character width (set = 7bit) */ |
111 |
#define SCSMR2_PE 0x20 /* Parity Enable */ |
112 |
#define SCSMR2_O 0x10 /* parity mode Odd */ |
113 |
#define SCSMR2_STOP 0x08 /* STOP bit (set = 2 stop bits) */ |
114 |
#define SCSMR2_CKS1 0x02 /* ClocK Select 1 */ |
115 |
#define SCSMR2_CKS0 0x01 /* ClocK Select 0 */ |
116 |
|
117 |
/* SMR: serial mode (for IrDA) */ |
118 |
#define SCSMR2_IRMOD 0x80 /* IrDA mode */ |
119 |
#define SCSMR2_ICK3 0x40 |
120 |
#define SCSMR2_ICK2 0x20 |
121 |
#define SCSMR2_ICK1 0x10 |
122 |
#define SCSMR2_ICK0 0x08 |
123 |
#define SCSMR2_PSEL 0x04 /* Pulse width SELelect */ |
124 |
|
125 |
/* SCR: serial control */ |
126 |
#define SCSCR2_TIE 0x80 /* Transmit Interrupt Enable */ |
127 |
#define SCSCR2_RIE 0x40 /* Recieve Interrupt Enable */ |
128 |
#define SCSCR2_TE 0x20 /* Transmit Enable */ |
129 |
#define SCSCR2_RE 0x10 /* Receive Enable */ |
130 |
#define SCSCR2_CKE1 0x02 /* ClocK Enable 1 */ |
131 |
#define SCSCR2_CKE0 0x01 /* ClocK Enable 0 (not in sh4) */ |
132 |
|
133 |
/* SSR: serial status */ |
134 |
#define SCSSR2_ER 0x0080 /* ERror */ |
135 |
#define SCSSR2_TEND 0x0040 /* Transmit END */ |
136 |
#define SCSSR2_TDFE 0x0020 /* Transmit Data Fifo Empty */ |
137 |
#define SCSSR2_BRK 0x0010 /* BReaK detection */ |
138 |
#define SCSSR2_FER 0x0008 /* Framing ERror */ |
139 |
#define SCSSR2_PER 0x0004 /* Parity ERror */ |
140 |
#define SCSSR2_RDF 0x0002 /* Recieve fifo Data Full */ |
141 |
#define SCSSR2_DR 0x0001 /* Data Ready */ |
142 |
|
143 |
/* FCR: fifo control */ |
144 |
#define SCFCR2_RTRG1 0x80 /* Receive TRiGger 1 */ |
145 |
#define SCFCR2_RTRG0 0x40 /* Receive TRiGger 0 */ |
146 |
#define SCFCR2_TTRG1 0x20 /* Transmit TRiGger 1 */ |
147 |
#define SCFCR2_TTRG0 0x10 /* Transmit TRiGger 0 */ |
148 |
#define SCFCR2_MCE 0x08 /* Modem Control Enable */ |
149 |
#define SCFCR2_TFRST 0x04 /* Transmit Fifo register ReSeT */ |
150 |
#define SCFCR2_RFRST 0x02 /* Receive Fifo register ReSeT */ |
151 |
#define SCFCR2_LOOP 0x01 /* LOOP back test */ |
152 |
|
153 |
#define FIFO_RCV_TRIGGER_1 0x00 |
154 |
#define FIFO_RCV_TRIGGER_4 0x40 |
155 |
#define FIFO_RCV_TRIGGER_8 0x80 |
156 |
#define FIFO_RCV_TRIGGER_14 0xc0 |
157 |
|
158 |
#define FIFO_XMT_TRIGGER_8 0x00 |
159 |
#define FIFO_XMT_TRIGGER_4 0x10 |
160 |
#define FIFO_XMT_TRIGGER_2 0x20 |
161 |
#define FIFO_XMT_TRIGGER_1 0x30 |
162 |
|
163 |
/* FDR: fifo data count set */ |
164 |
#define SCFDR2_TXCNT 0xff00 /* Tx CouNT */ |
165 |
#define SCFDR2_RECVCNT 0x00ff /* Rx CouNT */ |
166 |
#define SCFDR2_TXF_FULL 0x1000 /* Tx FULL */ |
167 |
#define SCFDR2_RXF_EPTY 0x0000 /* Rx EMPTY */ |
168 |
|
169 |
#endif /* !_SH3_SCIFREG_ */ |