From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31211 invoked by alias); 16 Jan 2006 08:40:33 -0000 Received: (qmail 31202 invoked by uid 22791); 16 Jan 2006 08:40:33 -0000 X-Spam-Check-By: sourceware.org Received: from main.gmane.org (HELO ciao.gmane.org) (80.91.229.2) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 16 Jan 2006 08:40:31 +0000 Received: from list by ciao.gmane.org with local (Exim 4.43) id 1EyPuV-0002kc-Ha for ecos-discuss@sources.redhat.com; Mon, 16 Jan 2006 09:40:19 +0100 Received: from h250n1fls34o969.telia.com ([213.67.91.250]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 16 Jan 2006 09:40:19 +0100 Received: from daniel.neri by h250n1fls34o969.telia.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 16 Jan 2006 09:40:19 +0100 To: ecos-discuss@sources.redhat.com From: daniel.neri@sigicom.se (Daniel =?iso-8859-1?Q?N=E9ri?=) Date: Mon, 16 Jan 2006 08:40:00 -0000 Message-ID: <87vewklg60.fsf@ebbot.hq.sigicom.net> References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" User-Agent: Gnus/5.110004 (No Gnus v0.4) Emacs/21.4 (berkeley-unix) X-IsSubscribed: yes Mailing-List: contact ecos-discuss-help@ecos.sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: ecos-discuss-owner@ecos.sourceware.org Subject: [ECOS] Re: DSR Scheduling Problem X-SW-Source: 2006-01/txt/msg00118.txt.bz2 --=-=-= Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Content-length: 806 Grant Edwards writes: > On 2006-01-14, Paul D. DeRocco wrote: > >> If the transmitter has a hardware FIFO, and the software >> transmits one byte per interrupt, > > Then the sofware is completely and utterly broken. It doesn't > deserve to work. > >> then presenting a block of data to it after an idle period >> will invoke the ISR/DSR a slew of times until the FIFO is >> full. > > That's insane. Nobody with a clue would write software like that. Actually, the generic 16x5x serial driver in eCos works exactly like that. > When you get a TX interrupt you write data to the tx FIFO until it's > full. Yep. I've made a somewhat quick-and-dirty fix that is attached below. Regards, -- Daniel NĂ©ri Sigicom AB, Stockholm, Sweden --=-=-= Content-Type: text/x-patch Content-Disposition: attachment Content-length: 1939 diff -r bc43d0ddc306 -r 851938281d52 devs/serial/generic/16x5x/current/src/ser_16x5x.c --- a/devs/serial/generic/16x5x/current/src/ser_16x5x.c Mon Nov 28 14:51:31 2005 +++ b/devs/serial/generic/16x5x/current/src/ser_16x5x.c Thu Dec 1 10:44:47 2005 @@ -212,6 +212,8 @@ s16550, s16550a } deviceType; + unsigned tx_fifo_size; + volatile unsigned tx_fifo_avail; #endif } pc_serial_info; @@ -332,10 +334,15 @@ _fcr_thresh=FCR_RT14; break; } _fcr_thresh|=FCR_FE|FCR_CRF|FCR_CTF; + ser_chan->tx_fifo_size = 16; HAL_WRITE_UINT8(base+REG_fcr, _fcr_thresh); // Enable and clear FIFO } - else + else { + ser_chan->tx_fifo_size = 1; HAL_WRITE_UINT8(base+REG_fcr, 0); // make sure it's disabled + } + + ser_chan->tx_fifo_avail = ser_chan->tx_fifo_size; #endif if (chan->out_cbuf.len != 0) { _ier = IER_RCV; @@ -423,16 +430,26 @@ static bool pc_serial_putc(serial_channel *chan, unsigned char c) { +#ifndef CYGPKG_IO_SERIAL_GENERIC_16X5X_FIFO cyg_uint8 _lsr; +#endif pc_serial_info *ser_chan = (pc_serial_info *)chan->dev_priv; cyg_addrword_t base = ser_chan->base; +#ifdef CYGPKG_IO_SERIAL_GENERIC_16X5X_FIFO + if (ser_chan->tx_fifo_avail > 0) { + HAL_WRITE_UINT8(base+REG_thr, c); + --ser_chan->tx_fifo_avail; + return true; + } +#else HAL_READ_UINT8(base+REG_lsr, _lsr); if (_lsr & LSR_THE) { // Transmit buffer is empty HAL_WRITE_UINT8(base+REG_thr, c); return true; } +#endif // No space return false; } @@ -626,6 +643,9 @@ break; } case ISR_Tx: +#ifdef CYGPKG_IO_SERIAL_GENERIC_16X5X_FIFO + ser_chan->tx_fifo_avail = ser_chan->tx_fifo_size; +#endif (chan->callbacks->xmt_char)(chan); break; --=-=-= Content-Type: text/plain; charset=us-ascii Content-length: 148 -- Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss --=-=-=--