Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/sh5/dev These hackish changes have been sitting aro...



details:   https://anonhg.NetBSD.org/src/rev/8db266f782b5
branches:  trunk
changeset: 537228:8db266f782b5
user:      scw <scw%NetBSD.org@localhost>
date:      Sat Sep 28 11:08:13 2002 +0000

description:
These hackish changes have been sitting around for a while. Commit
them so they don't get lost. This driver will be overhauled later
on anyway to make it shareable between sh[3-5].

diffstat:

 sys/arch/sh5/dev/scif.c |  38 +++++++++++++++++++++++++-------------
 1 files changed, 25 insertions(+), 13 deletions(-)

diffs (102 lines):

diff -r c2179b741cc9 -r 8db266f782b5 sys/arch/sh5/dev/scif.c
--- a/sys/arch/sh5/dev/scif.c   Sat Sep 28 11:04:26 2002 +0000
+++ b/sys/arch/sh5/dev/scif.c   Sat Sep 28 11:08:13 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: scif.c,v 1.3 2002/09/27 20:35:30 thorpej Exp $ */
+/*     $NetBSD: scif.c,v 1.4 2002/09/28 11:08:13 scw Exp $     */
 
 /*-
  * Copyright (C) 1999 T.Horiuchi and SAITOH Masanobu.  All rights reserved.
@@ -251,7 +251,7 @@
 #ifdef SCIFCN_SPEED
 unsigned int scifcn_speed = SCIFCN_SPEED;
 #else
-unsigned int scifcn_speed = 9600;
+unsigned int scifcn_speed = 38400;
 #endif
 
 #define        divrnd(n, q)    (((n)*2/(q)+1)/2)       /* divide and round off */
@@ -350,11 +350,11 @@
        /* Serial Mode Register */
        /* 8bit,NonParity,Even,1Stop */
        bus_space_write_2(bt, bh, SCIF_REG_SCSMR2, 0x00);
-
+#if 0
        /* Bit Rate Register */
        bus_space_write_1(bt, bh, SCIF_REG_SCBRR2,
            divrnd(cprc_clocks.cc_peripheral, 32 * bps) - 1);
-
+#endif
        /*
         * wait 1mSec, because Send/Recv must begin 1 bit period after
         * BRR is set.
@@ -366,7 +366,9 @@
 
        /* Send permission, Receive permission ON */
        bus_space_write_2(bt, bh, SCIF_REG_SCSCR2,
-           SCIF_SCSCR2_TE | SCIF_SCSCR2_RE);
+           SCIF_SCSCR2_TE | SCIF_SCSCR2_RE | 0x0a);
+
+       bus_space_write_2(bt, bh, SCIF_REG_SCSPTR2, 0x85);
 
        /* Serial Status Register */
        /* Clear Status */
@@ -412,6 +414,7 @@
 static unsigned char
 scif_getc(bus_space_tag_t bt, bus_space_handle_t bh)
 {
+#if 0
        u_int8_t c, err_c;
        u_int16_t err_c2;
 
@@ -428,18 +431,15 @@
                }
 
                c = bus_space_read_1(bt, bh, SCIF_REG_SCFDR2);
+
                err_c = bus_space_read_2(bt, bh, SCIF_REG_SCFSR2);
-
                bus_space_write_2(bt, bh, SCIF_REG_SCFSR2,
-                   bus_space_read_2(bt, bh, SCIF_REG_SCFSR2) &
-                   ~(SCIF_SCFSR2_ER | SCIF_SCFSR2_BRK |
-                     SCIF_SCFSR2_RDF | SCIF_SCFSR2_DR));
+                   err_c & ~(SCIF_SCFSR2_ER | SCIF_SCFSR2_BRK |
+                             SCIF_SCFSR2_RDF | SCIF_SCFSR2_DR));
 
                err_c2 = bus_space_read_2(bt, bh, SCIF_REG_SCLSR2);
-
                bus_space_write_2(bt, bh, SCIF_REG_SCLSR2,
-                   bus_space_read_2(bt, bh, SCIF_REG_SCLSR2) &
-                   ~SCIF_SCLSR2_ORER);
+                   err_c2 & ~SCIF_SCLSR2_ORER);
 
                if ((err_c & (SCIF_SCFSR2_ER | SCIF_SCFSR2_BRK | SCIF_SCFSR2_FER
                    | SCIF_SCFSR2_PER)) == 0) {
@@ -447,6 +447,18 @@
                                return(c);
                }
        }
+#else
+       unsigned char c;
+
+       while (!(bus_space_read_2(bt, bh, SCIF_REG_SCFSR2) & SCIF_SCFSR2_DR))
+               ;
+
+       c = bus_space_read_1(bt, bh, SCIF_REG_SCFRD2);
+
+       bus_space_write_2(bt, bh, SCIF_REG_SCFSR2, 0);
+
+       return (c);
+#endif
 }
 
 #if 0
@@ -486,7 +498,7 @@
        sc->sc_fifolen = 16;
 
        sc->sc_iot = pa->pa_bust;
-       bus_space_map(sc->sc_iot, pa->pa_offset, SCIF_REG_SZ, 0, sc->sc_ioh);
+       bus_space_map(sc->sc_iot, pa->pa_offset, SCIF_REG_SZ, 0, &sc->sc_ioh);
 
        if (scifisconsole || kgdb_attached) {
                /* InitializeScif(scifcn_speed); */



Home | Main Index | Thread Index | Old Index