Received: from aris1.eb3ago.org (root@[195.76.214.8])
       by mail.club-internet.fr (Grolier/MGC-970630-No_Relay) with SMTP id QAA17091
       for <[email protected]>; Sun, 14 Sep 1997 16:04:50 +0200 (MET DST)
Received: from zone.pspt.fi ([email protected] [193.166.55.160]) by aris1.eb3ago.org (8.6.12/8.6.9) with ESMTP id PAA05505 for <[email protected]>; Sun, 14 Sep 1997 15:10:04 +0100
Received: by zone.pspt.fi id <182278-13947>; Sun, 14 Sep 1997 17:04:18 +0300
Sender: [email protected]
Message-ID: <[email protected]>
Date:   Sun, 14 Sep 1997 12:57:13 +0200
From: Frederic RIBLE F1OAT <[email protected]>
X-Mailer: Mozilla 3.01Gold (X11; I; Linux 2.0.30 i586)
MIME-Version: 1.0
To: Joerg Reuter <[email protected]>
CC: dev-hams <[email protected]>
Subject: scc: fix for corrupted rx frames
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Old-Return-Path: <[email protected]>
X-Orcpt: rfc822;[email protected]
Resent-Message-ID: <"7_NqtFEzjqA.0.N44.Sx-6q"@zone.pspt.fi>
Resent-From: [email protected]
Resent-Reply-To: [email protected]
X-Mailing-List: <[email protected]> archive/latest/266
X-Loop: [email protected]
Precedence: list
Resent-Sender: [email protected]
Resent-Date: Sun, 14 Sep 1997 17:04:12 +0300
X-UIDL: 46676a5bb8b1791e0b4fe66f7aa3fe80

Hello Joerg,

 Me and some friends have seen corrupted rx frames on listen traces on
1200 bit/s half-duplex channels. We use kernel 2.0.30 with
z8530drv-2.4c.dl1bke.tar.gz and ATEPRA SCC boards. Clock source is
"divider".

 The problem is worse with a 386-SX16 than with a P5-90. Corrupted
frames appear only just after tx goes down. There is no problem in
full-duplex. So I suspect the scc_key_trx() function.  I have done a
small fix to avoid switching off the rx portion of Z8530 : this fix
cures the problem !!! May be another silicium bug of the Z8530 ...
Grrrrr %$@##"$%$ !!!

 This patched driver is running well here and on F6FBB station for some
weeks. We did not see any side effect. For purists, some code must be
added to trash rx frames when the driver is in transmit phase.

73's Frederic F1OAT.

==========================================================================================
 My fix for scc_key_trx() (against z8530drv-2.4c.dl1bke.tar.gz)
==========================================================================================


/* ----> scc_key_trx sets the time constant for the baudrate
        generator and keys the transmitter                  <---- */

static void
scc_key_trx(struct scc_channel *scc, char tx)
{
       unsigned int time_const;

       if (scc->brand & PRIMUS)
               Outb(scc->ctrl + 4, scc->option | (tx? 0x80 : 0));

       if (scc->modem.speed < 300)
               scc->modem.speed = 1200;

       time_const = (unsigned) (scc->clock / (scc->modem.speed * (tx? 2:64)))
- 2;

       disable_irq(scc->irq);

       if (tx)
       {
               or(scc, R1, TxINT_ENAB);        /* t_maxkeyup may have reset these */
               or(scc, R15, TxUIE);
       }

       if (scc->modem.clocksrc == CLK_DPLL)
       {                               /* force simplex operation */
               if (tx)
               {
                       cl(scc, R3, RxENABLE|ENT_HM);   /* switch off receiver */
                       cl(scc, R15, DCDIE);            /* No DCD changes, please */
                       set_brg(scc, time_const);       /* reprogram baudrate generator */

                       /* DPLL -> Rx clk, BRG -> Tx CLK, TRxC mode output, TRxC = BRG */
                       wr(scc, R11, RCDPLL|TCBR|TRxCOI|TRxCBR);

                       or(scc,R5,RTS|TxENAB);          /* set the RTS line and enable TX */
               } else {
                       cl(scc,R5,RTS|TxENAB);

                       set_brg(scc, time_const);       /* reprogram baudrate generator */

                       /* DPLL -> Rx clk, DPLL -> Tx CLK, TRxC mode output, TRxC = DPLL */
                       wr(scc, R11, RCDPLL|TCDPLL|TRxCOI|TRxCDP);

                       or(scc,R3,RxENABLE|ENT_HM);
                       or(scc,R15, DCDIE);
               }
       } else {
               if (tx)
               {
/* F1OAT                if (scc->kiss.fulldup == KISS_DUPLEX_HALF)
                       {
                               cl(scc, R3, RxENABLE);
                               cl(scc, R15, DCDIE);
                       }
*/

                       or(scc,R5,RTS|TxENAB);          /* enable tx */
               } else {
                       cl(scc,R5,RTS|TxENAB);          /* disable tx */

/* F1OAT                if (scc->kiss.fulldup == KISS_DUPLEX_HALF)
                       {
                               or(scc, R3, RxENABLE|ENT_HM);
                               or(scc, R15, DCDIE);
                       }
*/              }
       }

       enable_irq(scc->irq);
}