diff options
Diffstat (limited to 'sys/arch/mvme68k/dev/scc.h')
-rw-r--r-- | sys/arch/mvme68k/dev/scc.h | 60 |
1 files changed, 45 insertions, 15 deletions
diff --git a/sys/arch/mvme68k/dev/scc.h b/sys/arch/mvme68k/dev/scc.h index 4d94f6c3fde..2b626de4d8b 100644 --- a/sys/arch/mvme68k/dev/scc.h +++ b/sys/arch/mvme68k/dev/scc.h @@ -1,6 +1,7 @@ -/* $NetBSD: scc.h,v 1.1.1.1 1995/07/25 23:12:07 chuck Exp $ */ +/* $Id: scc.h,v 1.2 1995/11/07 08:49:29 deraadt Exp $ */ /* + * Copyright (c) 1995 Theo de Raadt * Copyright (c) 1993 Paul Mackerras. * All rights reserved. * @@ -12,8 +13,12 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software withough specific prior written permission + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed under OpenBSD by + * Theo de Raadt for Willowglen Singapore. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES @@ -30,25 +35,50 @@ * SCC I/O register definitions */ -#define PCLK_FREQ 8333333 /* XXX */ +#define PCLK_FREQ_147 5000000 +#define PCLK_FREQ_162 10000000 -struct scc { - unsigned char cr; - unsigned char dr; +/* + * physical layout in memory of the SCC chips on the MVME147 + */ +struct scc_147 { + u_char cr; + u_char dr; +}; + +/* + * physical layout in memory of the SCC chips on the MVME162 + * (and possibly the MVME172 as well?) + */ +struct scc_162 { + u_char xx1; + u_char cr; + u_char xx2; + u_char dr; }; struct sccregs { - volatile struct scc *s_adr; - unsigned char s_val[16]; + volatile u_char *s_cr; + volatile u_char *s_dr; + u_char s_val[16]; }; -#define ZREAD0(scc) ((scc)->s_adr->cr) -#define ZREAD(scc, n) ((scc)->s_adr->cr = n, (scc)->s_adr->cr) -#define ZREADD(scc) ((scc)->s_adr->dr) +#define ZREAD0(scc) ((*((scc)->s_cr))) +#define ZREAD(scc, n) ((*((scc)->s_cr)) = n, (*((scc)->s_cr))) +#if 1 +#define ZREADD(scc) (ZWRITE0((scc), 8), ZREAD0((scc))) +#else +#define ZREADD(scc) ((*((scc)->s_dr))) +#endif -#define ZWRITE0(scc, v) ((scc)->s_adr->cr = v) -#define ZWRITE(scc, n, v) (ZWRITE0(scc, n), ZWRITE0(scc, (scc)->s_val[n] = v)) -#define ZWRITED(scc, v) ((scc)->s_adr->dr = v) +#define ZWRITE0(scc, v) ((*((scc)->s_cr)) = (u_char)(v)) +#define ZWRITE(scc, n, v) (ZWRITE0(scc, (u_char)n), \ + ZWRITE0(scc, (scc)->s_val[n] = (u_char)(v))) +#if 1 +#define ZWRITED(scc, v) (ZWRITE0((scc), 8), ZWRITE0((scc), (u_char)(v))) +#else +#define ZWRITED(scc, v) ((*((scc)->s_dr)) = (u_char)(v)) +#endif #define ZBIS(scc, n, v) (ZWRITE(scc, n, (scc)->s_val[n] | (v))) #define ZBIC(scc, n, v) (ZWRITE(scc, n, (scc)->s_val[n] & ~(v))) |