public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] problem with generic serial driver?
@ 2005-05-19  8:43 David Roethig
  2005-05-19 12:16 ` Nick Garnett
  0 siblings, 1 reply; 4+ messages in thread
From: David Roethig @ 2005-05-19  8:43 UTC (permalink / raw)
  To: ecos-discuss


I am using (as of recently) the generic serial driver
package (16x5x compatible serial device drivers).

The application was sending data to the port using the
file i/o interface:

    /* output string to serial port */
    err = cyg_io_write( serHandle, writeBuffer, length );

Nothing came out the serial port! That is, until, the app
output a 'diag_printf()'. That was a head-scratcher until
looking at the pc_serial_start_xmit() routine, I noticed
that the trasmitter wasn't being 'kicked' with a character
to the transmit register.

   // Enable the transmitter on the device
   static void
   pc_serial_start_xmit(serial_channel *chan)
   {
       pc_serial_info *ser_chan = (pc_serial_info *)chan->dev_priv;
       cyg_addrword_t base = ser_chan->base;
       cyg_uint8 _ier;

       HAL_READ_UINT8(base+REG_ier, _ier);
       _ier |= IER_XMT;                    // Enable xmit interrupt
       HAL_WRITE_UINT8(base+REG_ier, _ier);

       /* kick transmitter */              // **!! added !!**
       (chan->callbacks->xmt_char)(chan);  // **!! added !!**
   }

My questions:
  1) is the generic serial package still being used?
  2) is this a bug or are things configured incorrectly?



Thanks
Dave






-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [ECOS] problem with generic serial driver?
  2005-05-19  8:43 [ECOS] problem with generic serial driver? David Roethig
@ 2005-05-19 12:16 ` Nick Garnett
  2005-05-19 20:01   ` David Roethig
  0 siblings, 1 reply; 4+ messages in thread
From: Nick Garnett @ 2005-05-19 12:16 UTC (permalink / raw)
  To: droethig; +Cc: ecos-discuss

David Roethig <droethig@cipher.com> writes:

> I am using (as of recently) the generic serial driver
> package (16x5x compatible serial device drivers).
> 
> The application was sending data to the port using the
> file i/o interface:
> 
>     /* output string to serial port */
>     err = cyg_io_write( serHandle, writeBuffer, length );
> 
> Nothing came out the serial port! That is, until, the app
> output a 'diag_printf()'. That was a head-scratcher until
> looking at the pc_serial_start_xmit() routine, I noticed
> that the trasmitter wasn't being 'kicked' with a character
> to the transmit register.
> 
>    // Enable the transmitter on the device
>    static void
>    pc_serial_start_xmit(serial_channel *chan)
>    {
>        pc_serial_info *ser_chan = (pc_serial_info *)chan->dev_priv;
>        cyg_addrword_t base = ser_chan->base;
>        cyg_uint8 _ier;
> 
>        HAL_READ_UINT8(base+REG_ier, _ier);
>        _ier |= IER_XMT;                    // Enable xmit interrupt
>        HAL_WRITE_UINT8(base+REG_ier, _ier);
> 
>        /* kick transmitter */              // **!! added !!**
>        (chan->callbacks->xmt_char)(chan);  // **!! added !!**
>    }
> 
> My questions:
>   1) is the generic serial package still being used?
>   2) is this a bug or are things configured incorrectly?

This driver is being used on lots of targets, any that have 16x5x
compatible serial devices will use it. However, not all devices that
claim to be 16x5x compatible actually are. Some are missing features,
some have extra features.

Under normal circumstances the XMT interrupt occurs whenever the
transmit buffer (or FIFO) is empty. That's why we have to enable and
disable it, since we would otherwise be flooded with interrupts when
we had nothing to transmit.

It looks like your 16x5x clone either has this wrong, or, more likely,
has a "transmit interrupt holdoff" feature in an attempt to solve the
interrupt flood problem. Another example of hardware designers trying
to be helpful but actually just making the software more complicated.

Your fix is the correct thing to do, and is benign even for correctly
functioning 16x5xs.


Out of interest, what is the target you are working on?



-- 
Nick Garnett                                     eCos Kernel Architect
http://www.ecoscentric.com                The eCos and RedBoot experts


-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [ECOS] problem with generic serial driver?
  2005-05-19 12:16 ` Nick Garnett
@ 2005-05-19 20:01   ` David Roethig
  2005-05-19 23:15     ` Nick Garnett
  0 siblings, 1 reply; 4+ messages in thread
From: David Roethig @ 2005-05-19 20:01 UTC (permalink / raw)
  To: Nick Garnett; +Cc: ecos-discuss


Nick Garnett wrote:

> David Roethig <droethig@cipher.com> writes:
> 
> 
>>I am using (as of recently) the generic serial driver
>>package (16x5x compatible serial device drivers).
>>
>>The application was sending data to the port using the
>>file i/o interface:
>>
>>    /* output string to serial port */
>>    err = cyg_io_write( serHandle, writeBuffer, length );
>>
>>Nothing came out the serial port! That is, until, the app
>>output a 'diag_printf()'. That was a head-scratcher until
>>looking at the pc_serial_start_xmit() routine, I noticed
>>that the trasmitter wasn't being 'kicked' with a character
>>to the transmit register.
>>
>>   // Enable the transmitter on the device
>>   static void
>>   pc_serial_start_xmit(serial_channel *chan)
>>   {
>>       pc_serial_info *ser_chan = (pc_serial_info *)chan->dev_priv;
>>       cyg_addrword_t base = ser_chan->base;
>>       cyg_uint8 _ier;
>>
>>       HAL_READ_UINT8(base+REG_ier, _ier);
>>       _ier |= IER_XMT;                    // Enable xmit interrupt
>>       HAL_WRITE_UINT8(base+REG_ier, _ier);
>>
>>       /* kick transmitter */              // **!! added !!**
>>       (chan->callbacks->xmt_char)(chan);  // **!! added !!**
>>   }
>>
>>My questions:
>>  1) is the generic serial package still being used?
>>  2) is this a bug or are things configured incorrectly?
> 
> 
> This driver is being used on lots of targets, any that have 16x5x
> compatible serial devices will use it. However, not all devices that
> claim to be 16x5x compatible actually are. Some are missing features,
> some have extra features.
> 
> Under normal circumstances the XMT interrupt occurs whenever the
> transmit buffer (or FIFO) is empty. That's why we have to enable and
> disable it, since we would otherwise be flooded with interrupts when
> we had nothing to transmit.
> 
> It looks like your 16x5x clone either has this wrong, or, more likely,
> has a "transmit interrupt holdoff" feature in an attempt to solve the
> interrupt flood problem. Another example of hardware designers trying
> to be helpful but actually just making the software more complicated.
> 
> Your fix is the correct thing to do, and is benign even for correctly
> functioning 16x5xs.
> 
> 
> Out of interest, what is the target you are working on?

We are working on a Philips LPC2292 custom board.
We started our design before the LPC2xxx port was released. Recently,
the generic serial port driver package was added because we thought
it would be more robust than the code we cobbled together.

Thanks
Dave



-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [ECOS] problem with generic serial driver?
  2005-05-19 20:01   ` David Roethig
@ 2005-05-19 23:15     ` Nick Garnett
  0 siblings, 0 replies; 4+ messages in thread
From: Nick Garnett @ 2005-05-19 23:15 UTC (permalink / raw)
  To: droethig; +Cc: ecos-discuss

David Roethig <droethig@cipher.com> writes:

> > Out of interest, what is the target you are working on?
> 
> We are working on a Philips LPC2292 custom board.
> We started our design before the LPC2xxx port was released. Recently,
> the generic serial port driver package was added because we thought
> it would be more robust than the code we cobbled together.

That makes sense, I think it was in the context of the LPC2xxx serial
devices that I came across the same problem.

-- 
Nick Garnett                                     eCos Kernel Architect
http://www.ecoscentric.com                The eCos and RedBoot experts


-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-05-19 14:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-05-19  8:43 [ECOS] problem with generic serial driver? David Roethig
2005-05-19 12:16 ` Nick Garnett
2005-05-19 20:01   ` David Roethig
2005-05-19 23:15     ` Nick Garnett

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).