Expand PMF_FN_* macros.
[netbsd-mini2440.git] / sys / arch / x68k / dev / mfp.h
blob0fb0d6a6912de2b115525ca66cadc8837fea3d07
1 /* $NetBSD: mfp.h,v 1.8 2009/01/17 10:02:23 isaki Exp $ */
3 /*
4 * Copyright (c) 1998 NetBSD Foundation, Inc.
5 * All rights reserved.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 #define MFP_ADDR 0x00e88000
29 #define MFP_INTR 0x40
31 struct mfp_softc {
32 bus_space_tag_t sc_bst;
33 bus_space_handle_t sc_bht;
34 int sc_intr;
38 * MFP registers
40 #define MFP_GPIP 0x01
41 #define MFP_AER 0x03
42 #define MFP_DDR 0x05
43 #define MFP_IERA 0x07
44 #define MFP_IERB 0x09
45 #define MFP_IPRA 0x0b
46 #define MFP_IPRB 0x0d
47 #define MFP_ISRA 0x0f
48 #define MFP_ISRB 0x11
49 #define MFP_IMRA 0x13
50 #define MFP_IMRB 0x15
51 #define MFP_VR 0x17
52 #define MFP_TACR 0x19
53 #define MFP_TIMERA_STOP 0
54 #define MFP_TIMERA_RESET 0x10
55 #define MFP_TBCR 0x1b
56 #define MFP_TIMERB_STOP 0
57 #define MFP_TIMERB_RESET 0x10
58 #define MFP_TCDCR 0x1d
59 #define MFP_TADR 0x1f
60 #define MFP_TBDR 0x21
61 #define MFP_TCDR 0x23
62 #define MFP_TDDR 0x25
63 #define MFP_UCR 0x29
64 #define MFP_UCR_EVENP 0x02
65 #define MFP_UCR_PARENB 0x04
66 #define MFP_UCR_SYNCMODE 0x00
67 #define MFP_UCR_ONESB 0x08
68 #define MFP_UCR_1P5SB 0x10
69 #define MFP_UCR_TWOSB 0x18
70 #define MFP_UCR_RW_5 0x60
71 #define MFP_UCR_RW_6 0x40
72 #define MFP_UCR_RW_7 0x20
73 #define MFP_UCR_RW_8 0x00
74 #define MFP_UCR_CLKX16 0x80
75 #define MFP_RSR 0x2b
76 #define MFP_RSR_BF 0x80
77 #define MFP_RSR_OE 0x40
78 #define MFP_RSR_PE 0x20
79 #define MFP_RSR_FE 0x10
80 #define MFP_RSR_SS 0x02
81 #define MFP_RSR_RE 0x01
82 #define MFP_TSR 0x2d
83 #define MFP_TSR_BE 0x80
84 #define MFP_TSR_TE 0x01
85 #define MFP_UDR 0x2f
89 * machine dependent definitions
92 /* GPIP port bitmap */
93 #define MFP_GPIP_HSYNC 0x80
94 #define MFP_GPIP_CRTC 0x40
95 #define MFP_GPIP_UNUSED1 0x20
96 #define MFP_GPIP_VDISP 0x10
97 #define MFP_GPIP_OPM 0x08
98 #define MFP_GPIP_FRONT_SWITCH 0x04
99 #define MFP_GPIP_EXPWON 0x02
100 #define MFP_GPIP_RTC_ALARM 0x01
102 /* interrupt A */
103 #define MFP_INTR_HSYNC 0x80
104 #define MFP_INTR_CRTC 0x40
105 #define MFP_INTR_TIMER_A 0x20
106 #define MFP_INTR_RCV_FULL 0x10
107 #define MFP_INTR_RCV_ERROR 0x08
108 #define MFP_INTR_XMIT_EMPTY 0x04
109 #define MFP_INTR_XMIT_ERROR 0x02
110 #define MFP_INTR_TIMER_B 0x01
112 /* interrupt B */
113 #define MFP_INTR_VDISP 0x40
114 #define MFP_INTR_TIMER_C 0x20
115 #define MFP_INTR_TIMER_D 0x10
116 #define MFP_INTR_OPM 0x08
117 #define MFP_INTR_FRONT_SWITCH 0x04
118 #define MFP_INTR_EXPWON 0x02
119 #define MFP_INTR_RTC_ALARM 0x01
122 /* XXX */
123 #include <arch/x68k/dev/intiovar.h>
124 #define mfp_base ((volatile uint8_t *)IIOV(MFP_ADDR))
125 #define mfp_set_aer(a) \
126 mfp_base[MFP_AER] = ((u_int8_t) (a))
127 #define mfp_set_ddr(a) \
128 mfp_base[MFP_DDR] = ((u_int8_t) (a))
129 #define mfp_set_iera(a) \
130 mfp_base[MFP_IERA] = ((u_int8_t) (a))
131 #define mfp_set_ierb(a) \
132 mfp_base[MFP_IERB] = ((u_int8_t) (a))
133 #define mfp_set_ipra(a) \
134 mfp_base[MFP_IPRA] = ((u_int8_t) (a))
135 #define mfp_set_iprb(a) \
136 mfp_base[MFP_IPRB] = ((u_int8_t) (a))
137 #define mfp_set_isra(a) \
138 mfp_base[MFP_ISRA] = ((u_int8_t) (a))
139 #define mfp_set_isrb(a) \
140 mfp_base[MFP_ISRB] = ((u_int8_t) (a))
141 #define mfp_set_imra(a) \
142 mfp_base[MFP_IMRA] = ((u_int8_t) (a))
143 #define mfp_set_imrb(a) \
144 mfp_base[MFP_IMRB] = ((u_int8_t) (a))
145 #define mfp_set_vr(a) \
146 mfp_base[MFP_VR] = ((u_int8_t) (a))
147 #define mfp_set_tacr(a) \
148 mfp_base[MFP_TACR] = ((u_int8_t) (a))
149 #define mfp_set_tbcr(a) \
150 mfp_base[MFP_TBCR] = ((u_int8_t) (a))
151 #define mfp_set_tcdcr(a) \
152 mfp_base[MFP_TCDCR] = ((u_int8_t) (a))
153 #define mfp_set_tadr(a) \
154 mfp_base[MFP_TADR] = ((u_int8_t) (a))
155 #define mfp_set_tbdr(a) \
156 mfp_base[MFP_TBDR] = ((u_int8_t) (a))
157 #define mfp_set_tcdr(a) \
158 mfp_base[MFP_TCDR] = ((u_int8_t) (a))
159 #define mfp_set_tddr(a) \
160 mfp_base[MFP_TDDR] = ((u_int8_t) (a))
161 #define mfp_set_ucr(a) \
162 mfp_base[MFP_UCR] = ((u_int8_t) (a))
163 #define mfp_set_rsr(a) \
164 mfp_base[MFP_RSR] = ((u_int8_t) (a))
165 #define mfp_set_tsr(a) \
166 mfp_base[MFP_TSR] = ((u_int8_t) (a))
167 #define mfp_set_udr(a) \
168 mfp_base[MFP_UDR] = ((u_int8_t) (a))
170 #define mfp_get_gpip() (mfp_base[MFP_GPIP])
171 #define mfp_get_aer() (mfp_base[MFP_AER])
172 #define mfp_get_ddr() (mfp_base[MFP_DDR])
173 #define mfp_get_iera() (mfp_base[MFP_IERA])
174 #define mfp_get_ierb() (mfp_base[MFP_IERB])
175 #define mfp_get_ipra() (mfp_base[MFP_IPRA])
176 #define mfp_get_iprb() (mfp_base[MFP_IPRB])
177 #define mfp_get_isra() (mfp_base[MFP_ISRA])
178 #define mfp_get_isrb() (mfp_base[MFP_ISRB])
179 #define mfp_get_imra() (mfp_base[MFP_IMRA])
180 #define mfp_get_imrb() (mfp_base[MFP_IMRB])
181 #define mfp_get_vr() (mfp_base[MFP_VR])
182 #define mfp_get_tacr() (mfp_base[MFP_TACR])
183 #define mfp_get_tbcr() (mfp_base[MFP_TBCR])
184 #define mfp_get_tcdcr() (mfp_base[MFP_TCDCR])
185 #define mfp_get_tadr() (mfp_base[MFP_TADR])
186 #define mfp_get_tbdr() (mfp_base[MFP_TBDR])
187 #define mfp_get_tcdr() (mfp_base[MFP_TCDR])
188 #define mfp_get_tddr() (mfp_base[MFP_TDDR])
189 #define mfp_get_ucr() (mfp_base[MFP_UCR])
190 #define mfp_get_rsr() (mfp_base[MFP_RSR])
191 #define mfp_get_tsr() (mfp_base[MFP_TSR])
192 #define mfp_get_udr() (mfp_base[MFP_UDR])
194 #define mfp_bit_set(reg,bits) (mfp_base[(reg)] |= (bits))
195 #define mfp_bit_clear(reg,bits) (mfp_base[(reg)] &= (~(bits)))
197 #define mfp_bit_set_gpip(bits) mfp_bit_set(MFP_GPIP, (bits))
198 #define mfp_bit_clear_gpip(bits) mfp_bit_clear(MFP_GPIP, (bits))
199 #define mfp_bit_set_aer(bits) mfp_bit_set(MFP_AER, (bits))
200 #define mfp_bit_clear_aer(bits) mfp_bit_clear(MFP_AER, (bits))
201 #define mfp_bit_set_iera(bits) mfp_bit_set(MFP_IERA, (bits))
202 #define mfp_bit_clear_iera(bits) mfp_bit_clear(MFP_IERA, (bits))
203 #define mfp_bit_set_ierb(bits) mfp_bit_set(MFP_IERB, (bits))
204 #define mfp_bit_clear_ierb(bits) mfp_bit_clear(MFP_IERB, (bits))
206 void mfp_wait_for_hsync(void);
207 int mfp_send_usart(int);
208 int mfp_receive_usart(void);