diff options
Diffstat (limited to 'sys/arch/amiga/dev')
-rw-r--r-- | sys/arch/amiga/dev/grf.c | 6 | ||||
-rw-r--r-- | sys/arch/amiga/dev/grf_cv.c | 128 | ||||
-rw-r--r-- | sys/arch/amiga/dev/grf_cvreg.h | 2 | ||||
-rw-r--r-- | sys/arch/amiga/dev/ite.c | 164 | ||||
-rw-r--r-- | sys/arch/amiga/dev/itevar.h | 6 | ||||
-rw-r--r-- | sys/arch/amiga/dev/mfc.c | 27 | ||||
-rw-r--r-- | sys/arch/amiga/dev/ser.c | 12 |
7 files changed, 179 insertions, 166 deletions
diff --git a/sys/arch/amiga/dev/grf.c b/sys/arch/amiga/dev/grf.c index 4890ebe358d..ac6c11e24c7 100644 --- a/sys/arch/amiga/dev/grf.c +++ b/sys/arch/amiga/dev/grf.c @@ -1,4 +1,4 @@ -/* $NetBSD: grf.c,v 1.23 1995/10/09 02:08:43 chopps Exp $ */ +/* $NetBSD: grf.c,v 1.23.2.1 1995/10/20 11:01:06 chopps Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -188,11 +188,9 @@ grfopen(dev, flags, devtype, p) { struct grf_softc *gp; - if (GRFUNIT(dev) >= NGRF) + if (GRFUNIT(dev) >= NGRF || (gp = grfsp[GRFUNIT(dev)]) == NULL) return(ENXIO); - gp = grfsp[GRFUNIT(dev)]; - if ((gp->g_flags & GF_ALIVE) == 0) return(ENXIO); diff --git a/sys/arch/amiga/dev/grf_cv.c b/sys/arch/amiga/dev/grf_cv.c index 0692fa67ddc..83480b8cb04 100644 --- a/sys/arch/amiga/dev/grf_cv.c +++ b/sys/arch/amiga/dev/grf_cv.c @@ -1,3 +1,5 @@ +/* $NetBSD: grf_cv.c,v 1.3.2.2 1995/10/21 15:15:41 chopps Exp $ */ + /* * Copyright (c) 1995 Michael Teske * All rights reserved. @@ -47,11 +49,14 @@ * TODO: * Hardware Cursor support * Blitter support - * Remove the white bord in one 8bit mode * * BUGS: - * Xamiag24 and grf_cv can crash when you use fvwm with xterm's. - * Use the xterm's with the '-ah' option to avoid this for the moment. + * Xamiag24 and grf_cv can crash when you use fvwm with xterm's, you can + * avoid this by starting the xterm with '-ah', see the manpage of xterm + * for more informations about this switch. + * There is a bug in the Trio64 which produce a small (1 or 2 pixel) white + * vertical bar on the right side of an 8bit-Screen (only when you use more + * then 80MHz pixelclock). This has to be fixed in the Xserver. * */ @@ -352,6 +357,7 @@ cv_boardinit(gp) unsigned char test; unsigned int clockpar; int i; + struct grfinfo *gi; /* Reset board */ for (i = 0; i < 6; i++) @@ -402,6 +408,8 @@ cv_boardinit(gp) /* enable 4MB fast Page Mode */ test = test | 1 << 6; WSeq(ba, SEQ_ID_BUS_REQ_CNTL, test); + /* faster LUT write */ + WSeq(ba, SEQ_ID_RAMDAC_CNTL, 0x40); test = RSeq(ba, SEQ_ID_CLKSYN_CNTL_2); /* Clksyn2 read */ @@ -409,9 +417,7 @@ cv_boardinit(gp) test = test & 0xDF; WSeq(ba, SEQ_ID_CLKSYN_CNTL_2, test); - /* Memory CLOCK: 0x3473BC0 = 55 MHz. DO NOT CHANGE IT ! */ clockpar = compute_clock(0x3473BC0); - test = (clockpar & 0xFF00) >> 8; WSeq(ba, SEQ_ID_MCLK_HI, test); /* PLL N-Divider Value */ @@ -508,11 +514,11 @@ cv_boardinit(gp) for (i = 0; i <= 0xf; i++) WAttr (ba, i, i); - WAttr(ba,ACT_ID_ATTR_MODE_CNTL,0x41); - WAttr(ba,ACT_ID_OVERSCAN_COLOR,0x01); - WAttr(ba,ACT_ID_COLOR_PLANE_ENA,0x0F); - WAttr(ba,ACT_ID_HOR_PEL_PANNING,0x0); - WAttr(ba,ACT_ID_COLOR_SELECT,0x0); + WAttr(ba, ACT_ID_ATTR_MODE_CNTL, 0x41); + WAttr(ba, ACT_ID_OVERSCAN_COLOR, 0x01); + WAttr(ba, ACT_ID_COLOR_PLANE_ENA, 0x0F); + WAttr(ba, ACT_ID_HOR_PEL_PANNING, 0x0); + WAttr(ba, ACT_ID_COLOR_SELECT, 0x0); vgaw(ba, VDAC_MASK, 0xFF); /* DAC Mask */ @@ -546,6 +552,12 @@ cv_boardinit(gp) /* If I knew what this really does... but it _is_ necessary to get any gfx on the screen!! Undocumented register? */ WAttr(ba, 0x33, 0); + + gi = &gp->g_display; + gi->gd_regaddr = (caddr_t) kvtop (ba); + gi->gd_regsize = 64 * 1024; + gi->gd_fbaddr = (caddr_t) kvtop (gp->g_fbkva); + gi->gd_fbsize = cv_fbsize; } @@ -848,7 +860,7 @@ cv_toggle(gp,wopp) if (pass_toggle) { cvscreen(0, ba); } else { - cvscreen(1,ba); + cvscreen(1, ba); } return (0); } @@ -903,7 +915,8 @@ cv_load_mon(gp, md) VSE, VT; char LACE, DBLSCAN, TEXT; int uplim, lowlim; - char test; + int cr33, sr15, sr18, clock_mode, test; + int m, n, clock; /* For calc'ing display FIFO */ /* identity */ gv = &md->gv; @@ -922,10 +935,6 @@ cv_load_mon(gp, md) /* provide all needed information in grf device-independant locations */ gp->g_data = (caddr_t) gv; gi = &gp->g_display; - gi->gd_regaddr = (caddr_t) ztwopa (ba); - gi->gd_regsize = 64 * 1024; - gi->gd_fbaddr = (caddr_t) kvtop (fb); - gi->gd_fbsize = cv_fbsize; gi->gd_colors = 1 << gv->depth; gi->gd_planes = gv->depth; gi->gd_fbwidth = gv->disp_width; @@ -1082,23 +1091,16 @@ cv_load_mon(gp, md) vgaw(ba, VDAC_MASK, 0xff); - /* Must use dblclk mode for pixclk > 80MHz */ - if (gv->depth == 8 && gv->pixel_clock > 80000000) { - test = RSeq (ba,SEQ_ID_CLKSYN_CNTL_2); - test |= 0x10; - WSeq(ba, SEQ_ID_CLKSYN_CNTL_2, test); - delay (100000); - WSeq(ba, SEQ_ID_RAMDAC_CNTL, 0x80); - } else { - test = RSeq (ba,SEQ_ID_CLKSYN_CNTL_2); - test &= 0xef; - WSeq(ba, SEQ_ID_CLKSYN_CNTL_2, test); - delay (100000); - WSeq(ba, SEQ_ID_RAMDAC_CNTL, 0x00); - } + sr15 = RSeq(ba, SEQ_ID_CLKSYN_CNTL_2); + sr15 &= 0xef; + sr18 = RSeq(ba, SEQ_ID_RAMDAC_CNTL); + sr18 &= 0x7f; + cr33 = RCrt(ba, CRT_ID_BACKWAD_COMP_2); + cr33 &= 0xdf; + clock_mode = 0x00; test = RCrt(ba, CRT_ID_EXT_MISC_CNTL_2); - test &= 0xf; + test &= 0xd; switch (gv->depth) { case 1: @@ -1106,27 +1108,33 @@ cv_load_mon(gp, md) HDE = gv->disp_width / 16; break; case 8: - if (gv->pixel_clock > 80000000) - WCrt (ba, CRT_ID_EXT_MISC_CNTL_2 ,0x10 | test); - else - WCrt (ba, CRT_ID_EXT_MISC_CNTL_2 ,0x00 | test); + if (gv->pixel_clock > 80000000) { + clock_mode = 0x10 | 0x02; + sr15 |= 0x10; + sr18 |= 0x80; + cr33 |= 0x20; + } HDE = gv->disp_width / 8; break; case 15: - WCrt (ba, CRT_ID_EXT_MISC_CNTL_2 ,0x30 | test); + clock_mode = 0x30; HDE = gv->disp_width / 4; break; case 16: - WCrt (ba, CRT_ID_EXT_MISC_CNTL_2 ,0x50 | test); + clock_mode = 0x50; HDE = gv->disp_width / 4; break; case 24: - WCrt (ba, CRT_ID_EXT_MISC_CNTL_2 ,0xd0 | test); + clock_mode = 0xd0; HDE = (gv->disp_width / 8) * 3; break; } - WCrt(ba, CRT_ID_SCREEN_OFFSET, HDE); + WCrt(ba, CRT_ID_EXT_MISC_CNTL_2, clock_mode | test); + WSeq(ba, SEQ_ID_CLKSYN_CNTL_2, sr15); + WSeq(ba, SEQ_ID_RAMDAC_CNTL, sr18); + WCrt(ba, CRT_ID_BACKWAD_COMP_2, cr33); + WCrt(ba, CRT_ID_SCREEN_OFFSET, HDE); test = RCrt(ba, CRT_ID_EXT_SYS_CNTL_2); /* HDE Overflow in bits 4-5 */ @@ -1140,29 +1148,31 @@ cv_load_mon(gp, md) (gv->depth == 1) ? 0x01 : 0x0f); delay(100000); - /* M-Parameter of Display FIFO - * this is dependant on the pixel clock - * If someone knows a better formula, please tell me! + /* + * Calc. display fifo m and n parameters + * Dont't ask me what the hell these values mean. */ - switch(gv->depth) { - case 24: - test = (unsigned char) ((140.0 / (gv->pixel_clock * 3) - 1.0) * 64.0 -1); - break; - case 15: - case 16: - test = (unsigned char) ((140.0 / (gv->pixel_clock * 2) - 1.0) * 64.0 -1); - break; - default: - test = (unsigned char) ((140.0 / gv->pixel_clock - 1.0) * 64.0 -1); - break; - } -/* test = (unsigned char) ((140.0 / ((gv->depth == 24) ? gv->pixel_clock * 3 : gv->pixel_clock) -1.0) * 64.0 - 1); */ + n = 0xff; + if (gv->depth < 9) + clock = gv->pixel_clock / 500000.0; + else if (gv->depth == 15) + clock = gv->pixel_clock / 250000.0; + else + clock = (gv->pixel_clock * (gv->depth / 8)) / 500000.0; + + m = ((int)((55 * .72 + 16.867) * 89.736 / (clock + 39) - 21.1543) / 2) - 1; + + if (m > 31) + m = 31; + else if (m <= 0) { + m = 0; + n = 16; + } - test = (test & 0x1f) >> 3; - if (test < 0x18) - test = 0x18; - WCrt(ba, CRT_ID_EXT_MEM_CNTL_2, test); + m = m << 3; + WCrt(ba, CRT_ID_EXT_MEM_CNTL_2, m); + WCrt(ba, CRT_ID_EXT_MEM_CNTL_3, n); delay(10000); /* text initialization */ diff --git a/sys/arch/amiga/dev/grf_cvreg.h b/sys/arch/amiga/dev/grf_cvreg.h index d82281d99f0..dbdd657a62d 100644 --- a/sys/arch/amiga/dev/grf_cvreg.h +++ b/sys/arch/amiga/dev/grf_cvreg.h @@ -1,3 +1,5 @@ +/* $NetBSD: grf_cvreg.h,v 1.1.2.1 1995/10/21 15:15:44 chopps Exp $ */ + /* * Copyright (c) 1995 Michael Teske * All rights reserved. diff --git a/sys/arch/amiga/dev/ite.c b/sys/arch/amiga/dev/ite.c index a85b3864cc8..423ea986124 100644 --- a/sys/arch/amiga/dev/ite.c +++ b/sys/arch/amiga/dev/ite.c @@ -1,4 +1,4 @@ -/* $NetBSD: ite.c,v 1.32 1995/10/09 15:20:30 chopps Exp $ */ +/* $NetBSD: ite.c,v 1.32.2.2 1995/10/20 11:01:08 chopps Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -74,8 +74,6 @@ /* * XXX go ask sys/kern/tty.c:ttselect() */ -#include "grf.h" -struct tty *ite_tty[NGRF]; #define ITEUNIT(dev) (minor(dev)) @@ -112,12 +110,14 @@ static char sample[20] = { }; static char *index __P((const char *, char)); -static int inline atoi __P((const char *)); static void ite_sifilter __P((void *, void *)); void iteputchar __P((int c, struct ite_softc *ip)); void ite_putstr __P((const char * s, int len, dev_t dev)); void iteattach __P((struct device *, struct device *, void *)); int itematch __P((struct device *, struct cfdata *, void *)); +static void iteprecheckwrap __P((struct ite_softc *)); +static void itecheckwrap __P((struct ite_softc *)); + struct cfdriver itecd = { NULL, "ite", (cfmatch_t)itematch, iteattach, DV_DULL, @@ -157,7 +157,6 @@ iteattach(pdp, dp, auxp) struct device *pdp, *dp; void *auxp; { - extern int hz; struct grf_softc *gp; struct ite_softc *ip; int s; @@ -252,8 +251,6 @@ itecnprobe(cd) void init_bell() { - short i; - if (bsamplep != NULL) return; bsamplep = alloc_chipmem(20); @@ -407,7 +404,7 @@ iteopen(dev, mode, devtype, p) ip = getitesp(dev); if (ip->tp == NULL) - tp = ite_tty[unit] = ip->tp = ttymalloc(); + tp = ip->tp = ttymalloc(); else tp = ip->tp; if ((tp->t_state & (TS_ISOPEN | TS_XCLUDE)) == (TS_ISOPEN | TS_XCLUDE) @@ -494,7 +491,7 @@ struct tty * itetty(dev) dev_t dev; { - return (ite_tty[ITEUNIT(dev)]); + return (getitesp(dev)->tp); } int @@ -502,7 +499,7 @@ itestop(tp, flag) struct tty *tp; int flag; { - + return (0); } int @@ -589,7 +586,7 @@ itestart(tp) struct clist *rbp; struct ite_softc *ip; u_char buf[ITEBURST]; - int s, len, n; + int s, len; ip = getitesp(tp->t_dev); @@ -659,7 +656,7 @@ ite_on(dev, flag) return (0); } -int +void ite_off(dev, flag) dev_t dev; int flag; @@ -674,7 +671,8 @@ ite_off(dev, flag) if ((flag & 1) || (ip->flags & (ITE_INGRF | ITE_ISCONS | ITE_INITED)) == ITE_INITED) SUBR_DEINIT(ip); - if ((flag & 2) == 0) /* XXX hmm grfon() I think wants this to go inactive. */ + /* XXX hmm grfon() I think wants this to go inactive. */ + if ((flag & 2) == 0) ip->flags &= ~ITE_ACTIVE; } @@ -830,7 +828,7 @@ static u_char tout_pending; static void ite_sifilter(void *arg1, void *arg2) { - ite_filter((u_char)arg1, (enum caller)arg2); + ite_filter((u_char)(size_t)arg1, (enum caller)(size_t)arg2); } @@ -841,8 +839,8 @@ repeat_handler(arg) { tout_pending = 0; if (last_char) - add_sicallback(ite_sifilter, (void *)last_char, - (void *)ITEFILT_REPEATER); + add_sicallback(ite_sifilter, (void *)(size_t)last_char, + (void *)(size_t)ITEFILT_REPEATER); } void @@ -869,7 +867,7 @@ ite_filter(c, caller) * to not allow a key-up event to get thru before a repeat for * the key-down, we remove any outstanding callout requests.. */ - rem_sicallback(ite_filter); + rem_sicallback(ite_sifilter); up = c & 0x80 ? 1 : 0; c &= 0x7f; @@ -1031,7 +1029,7 @@ ite_filter(c, caller) } /* helper functions, makes the code below more readable */ -static void inline +inline static void ite_sendstr(str) char *str; { @@ -1056,7 +1054,7 @@ alignment_display(ip) SUBR_CURSOR(ip, DRAW_CURSOR); } -static void inline +inline static void snap_cury(ip) struct ite_softc *ip; { @@ -1069,7 +1067,7 @@ snap_cury(ip) } } -static void inline +inline static void ite_dnchar(ip, n) struct ite_softc *ip; int n; @@ -1087,7 +1085,7 @@ ite_dnchar(ip, n) SUBR_CURSOR(ip, DRAW_CURSOR); } -static void inline +inline static void ite_inchar(ip, n) struct ite_softc *ip; int n; @@ -1105,7 +1103,7 @@ ite_inchar(ip, n) SUBR_CURSOR(ip, DRAW_CURSOR); } -static void inline +inline static void ite_clrtoeol(ip) struct ite_softc *ip; { @@ -1118,7 +1116,7 @@ ite_clrtoeol(ip) } } -static void inline +inline static void ite_clrtobol(ip) struct ite_softc *ip; { @@ -1128,7 +1126,7 @@ ite_clrtobol(ip) SUBR_CURSOR(ip, DRAW_CURSOR); } -static void inline +inline static void ite_clrline(ip) struct ite_softc *ip; { @@ -1140,7 +1138,7 @@ ite_clrline(ip) -static void inline +inline static void ite_clrtoeos(ip) struct ite_softc *ip; { @@ -1153,7 +1151,7 @@ ite_clrtoeos(ip) } } -static void inline +inline static void ite_clrtobos(ip) struct ite_softc *ip; { @@ -1166,7 +1164,7 @@ ite_clrtobos(ip) } } -static void inline +inline static void ite_clrscreen(ip) struct ite_softc *ip; { @@ -1177,7 +1175,7 @@ ite_clrscreen(ip) -static void inline +inline static void ite_dnline(ip, n) struct ite_softc *ip; int n; @@ -1199,7 +1197,7 @@ ite_dnline(ip, n) SUBR_CURSOR(ip, DRAW_CURSOR); } -static void inline +inline static void ite_inline(ip, n) struct ite_softc *ip; int n; @@ -1221,7 +1219,7 @@ ite_inline(ip, n) SUBR_CURSOR(ip, DRAW_CURSOR); } -static void inline +inline static void ite_lf (ip) struct ite_softc *ip; { @@ -1236,7 +1234,7 @@ ite_lf (ip) clr_attr(ip, ATTR_INV); } -static void inline +inline static void ite_crlf (ip) struct ite_softc *ip; { @@ -1244,7 +1242,7 @@ ite_crlf (ip) ite_lf (ip); } -static void inline +inline static void ite_cr (ip) struct ite_softc *ip; { @@ -1255,7 +1253,7 @@ ite_cr (ip) } } -static void inline +inline static void ite_rlf (ip) struct ite_softc *ip; { @@ -1270,7 +1268,7 @@ ite_rlf (ip) clr_attr(ip, ATTR_INV); } -static int inline +inline static int atoi (cp) const char *cp; { @@ -1293,7 +1291,7 @@ index (cp, ch) -static int inline +inline static int ite_argnum (ip) struct ite_softc *ip; { @@ -1311,11 +1309,11 @@ ite_argnum (ip) return n; } -static int inline +inline static int ite_zargnum (ip) struct ite_softc *ip; { - char ch, *cp; + char ch; int n; /* convert argument string into number */ @@ -1329,7 +1327,7 @@ ite_zargnum (ip) return n; /* don't "n ? n : 1" here, <CSI>0m != <CSI>1m ! */ } -static int inline +inline static int strncmp (a, b, l) const char *a, *b; int l; @@ -1362,6 +1360,51 @@ ite_putstr(s, len, dev) SUBR_CURSOR(ip, END_CURSOROPT); } +static void +iteprecheckwrap(ip) + struct ite_softc *ip; +{ + if (ip->auto_wrap && ip->curx == ip->cols) { + ip->curx = 0; + clr_attr(ip, ATTR_INV); + if (++ip->cury >= ip->bottom_margin + 1) { + ip->cury = ip->bottom_margin; + SUBR_CURSOR(ip, MOVE_CURSOR); + SUBR_SCROLL(ip, ip->top_margin + 1, 0, 1, SCROLL_UP); + ite_clrtoeol(ip); + } else + SUBR_CURSOR(ip, MOVE_CURSOR); + } +} + +static void +itecheckwrap(ip) + struct ite_softc *ip; +{ +#if 0 + if (++ip->curx == ip->cols) { + if (ip->auto_wrap) { + ip->curx = 0; + clr_attr(ip, ATTR_INV); + if (++ip->cury >= ip->bottom_margin + 1) { + ip->cury = ip->bottom_margin; + SUBR_CURSOR(ip, MOVE_CURSOR); + SUBR_SCROLL(ip, ip->top_margin + 1, 0, 1, SCROLL_UP); + ite_clrtoeol(ip); + return; + } + } else + /* stay there if no autowrap.. */ + ip->curx--; + } +#else + if (ip->curx < ip->cols) { + ip->curx++; + SUBR_CURSOR(ip, MOVE_CURSOR); + } +#endif +} + void iteputchar(c, ip) register int c; @@ -1377,7 +1420,6 @@ iteputchar(c, ip) kbd_tty = kbd_ite->tp; if (ip->escape) { -doesc: switch (ip->escape) { case ESC: switch (c) { @@ -2216,47 +2258,3 @@ doesc: } } -int -iteprecheckwrap(ip) - struct ite_softc *ip; -{ - if (ip->auto_wrap && ip->curx == ip->cols) { - ip->curx = 0; - clr_attr(ip, ATTR_INV); - if (++ip->cury >= ip->bottom_margin + 1) { - ip->cury = ip->bottom_margin; - SUBR_CURSOR(ip, MOVE_CURSOR); - SUBR_SCROLL(ip, ip->top_margin + 1, 0, 1, SCROLL_UP); - ite_clrtoeol(ip); - } else - SUBR_CURSOR(ip, MOVE_CURSOR); - } -} - -int -itecheckwrap(ip) - struct ite_softc *ip; -{ -#if 0 - if (++ip->curx == ip->cols) { - if (ip->auto_wrap) { - ip->curx = 0; - clr_attr(ip, ATTR_INV); - if (++ip->cury >= ip->bottom_margin + 1) { - ip->cury = ip->bottom_margin; - SUBR_CURSOR(ip, MOVE_CURSOR); - SUBR_SCROLL(ip, ip->top_margin + 1, 0, 1, SCROLL_UP); - ite_clrtoeol(ip); - return; - } - } else - /* stay there if no autowrap.. */ - ip->curx--; - } -#else - if (ip->curx < ip->cols) { - ip->curx++; - SUBR_CURSOR(ip, MOVE_CURSOR); - } -#endif -} diff --git a/sys/arch/amiga/dev/itevar.h b/sys/arch/amiga/dev/itevar.h index 1adac27e9f7..0b9a4434673 100644 --- a/sys/arch/amiga/dev/itevar.h +++ b/sys/arch/amiga/dev/itevar.h @@ -1,4 +1,4 @@ -/* $NetBSD: itevar.h,v 1.11 1995/08/20 15:22:46 chopps Exp $ */ +/* $NetBSD: itevar.h,v 1.11.2.2 1995/10/20 11:01:11 chopps Exp $ */ /* * Copyright (c) 1994 Christian E. Hopps @@ -50,9 +50,9 @@ enum ite_attr { struct ite_softc { struct device device; + struct tty *tp; char argbuf[MAX_ARGSIZE]; struct grf_softc *grf; /* XXX */ - struct tty *tp; void *priv; char *ap; u_char *tabs; @@ -206,7 +206,7 @@ void itestart __P((struct tty *)); /* ite functions */ int ite_on __P((dev_t, int)); -int ite_off __P((dev_t, int)); +void ite_off __P((dev_t, int)); void ite_reinit __P((dev_t)); int ite_param __P((struct tty *, struct termios *)); void ite_reset __P((struct ite_softc *)); diff --git a/sys/arch/amiga/dev/mfc.c b/sys/arch/amiga/dev/mfc.c index f639beaeb81..1e9639dbd19 100644 --- a/sys/arch/amiga/dev/mfc.c +++ b/sys/arch/amiga/dev/mfc.c @@ -1,4 +1,4 @@ -/* $NetBSD: mfc.c,v 1.8 1995/10/09 15:20:33 chopps Exp $ */ +/* $NetBSD: mfc.c,v 1.8.2.1 1995/10/20 11:01:12 chopps Exp $ */ /* * Copyright (c) 1994 Michael L. Hitch @@ -155,12 +155,14 @@ struct mfcs_softc { struct duart_regs *sc_duart; struct mfc_regs *sc_regs; struct mfc_softc *sc_mfc; + int swflags; long flags; /* XXX */ #define CT_USED 1 /* CT in use */ u_short *rptr, *wptr, incnt, ovfl; u_short inbuf[SERIBUF_SIZE]; char *ptr, *end; char outbuf[SEROBUF_SIZE]; + struct vbl_node vbl_node; }; #endif @@ -208,10 +210,7 @@ struct cfdriver mfcpcd = { int mfcsstart(), mfcsparam(), mfcshwiflow(); int mfcs_active; int mfcsdefaultrate = 38400 /*TTYDEF_SPEED*/; -int mfcsswflags[NMFCS]; -#define SWFLAGS(dev) (mfcsswflags[dev & 31] | (((dev) & 0x80) == 0 ? TIOCFLAG_SOFTCAR : 0)) - -struct vbl_node mfcs_vbl_node[NMFCS]; +#define SWFLAGS(dev) (sc->swflags | (((dev) & 0x80) == 0 ? TIOCFLAG_SOFTCAR : 0)) #ifdef notyet /* @@ -425,9 +424,9 @@ mfcsattach(pdp, dp, auxp) /* * should have only one vbl routine to handle all ports? */ - mfcs_vbl_node[unit].function = (void (*) (void *)) mfcsmint; - mfcs_vbl_node[unit].data = (void *) unit; - add_vbl_function(&mfcs_vbl_node[unit], 1, (void *) unit); + sc->vbl_node.function = (void (*) (void *)) mfcsmint; + sc->vbl_node.data = (void *) unit; + add_vbl_function(&sc->vbl_node, 1, (void *) unit); } /* @@ -488,11 +487,11 @@ mfcsopen(dev, flag, mode, p) /* * do these all the time */ - if (mfcsswflags[unit] & TIOCFLAG_CLOCAL) + if (sc->swflags & TIOCFLAG_CLOCAL) tp->t_cflag |= CLOCAL; - if (mfcsswflags[unit] & TIOCFLAG_CRTSCTS) + if (sc->swflags & TIOCFLAG_CRTSCTS) tp->t_cflag |= CRTSCTS; - if (mfcsswflags[unit] & TIOCFLAG_MDMBUF) + if (sc->swflags & TIOCFLAG_MDMBUF) tp->t_cflag |= MDMBUF; mfcsparam(tp, &tp->t_termios); ttsetwater(tp); @@ -579,7 +578,7 @@ mfcsclose(dev, flag, mode, p) ttyclose(tp); #if not_yet if (tp != &mfcs_cons) { - remove_vbl_function(&mfcs_vbl_node[unit]); + remove_vbl_function(&sc->vbl_node); ttyfree(tp); sc->sc_tty = (struct tty *) NULL; } @@ -686,8 +685,8 @@ mfcsioctl(dev, cmd, data, flag, p) if (error != 0) return(EPERM); - mfcsswflags[unit] = *(int *)data; - mfcsswflags[unit] &= /* only allow valid flags */ + sc->swflags = *(int *)data; + sc->swflags &= /* only allow valid flags */ (TIOCFLAG_SOFTCAR | TIOCFLAG_CLOCAL | TIOCFLAG_CRTSCTS); /* XXXX need to change duart parameters? */ break; diff --git a/sys/arch/amiga/dev/ser.c b/sys/arch/amiga/dev/ser.c index 20b0888a4d4..e9bcac294cd 100644 --- a/sys/arch/amiga/dev/ser.c +++ b/sys/arch/amiga/dev/ser.c @@ -1,4 +1,4 @@ -/* $NetBSD: ser.c,v 1.27 1995/04/23 18:24:40 chopps Exp $ */ +/* $NetBSD: ser.c,v 1.27.2.1 1995/10/20 11:01:14 chopps Exp $ */ /* * Copyright (c) 1982, 1986, 1990 The Regents of the University of California. @@ -67,9 +67,14 @@ void serattach __P((struct device *, struct device *, void *)); int sermatch __P((struct device *, struct cfdata *, void *)); +struct ser_softc { + struct device dev; + struct tty *ser_tty; +}; + struct cfdriver sercd = { NULL, "ser", (cfmatch_t)sermatch, serattach, DV_TTY, - sizeof(struct device), NULL, 0 }; + sizeof(struct ser_softc), NULL, 0 }; #ifndef SEROBUF_SIZE #define SEROBUF_SIZE 32 @@ -248,7 +253,8 @@ seropen(dev, flag, mode, p) if (ser_tty[unit]) tp = ser_tty[unit]; else - tp = ser_tty[unit] = ttymalloc(); + tp = ((struct ser_softc *)sercd.cd_devs[unit])->ser_tty = + ser_tty[unit] = ttymalloc(); tp->t_oproc = (void (*) (struct tty *)) serstart; tp->t_param = serparam; |