[ECOS] More questions about the eCos high level serial device driver

Michael Checky Michael_Checky@Thermoking.com
Tue Mar 25 16:19:00 GMT 2003


----- Forwarded by Michael Checky/contractor/tkc/IRCorp on 03/25/2003 10:18
AM -----
|---------+----------------------------------------------->
|         |                              Michael Checky   |
|         |                                               |
|         |                              03/25/2003 10:22 |
|         |                              AM               |
|         |                                               |
|---------+----------------------------------------------->
  >------------------------------------------------------------------------------------------------------------------------------------------|
  |                                                                                                                                          |
  | To:   Jonathan Larmour <jifl@eCosCentric.com>                                                                                            |
  | cc:                                                                                                                                      |
  | Subject: Re: [ECOS] More questions about the eCos high level serial device driver(Document link: Michael Checky)                         |
  |                                                                                                                                          |
  |                                                                                                                                          |
  |                                                                                                                                          |
  >------------------------------------------------------------------------------------------------------------------------------------------|






|---------+----------------------------------------------->
|         |                              Jonathan Larmour |
|         |                              <jifl@eCosCentric|
|         |                              .com>            |
|         |                                               |
|         |                              03/24/2003 08:39 |
|         |                              PM               |
|         |                                               |
|         |                                               |
|         |                                               |
|---------+----------------------------------------------->
  >------------------------------------------------------------------------------------------------------------------------------------------|
  |                                                                                                                                          |
  | To:   Michael Checky <Michael_Checky@Thermoking.com>                                                                                     |
  | cc:   ecos-discuss@sources.redhat.com                                                                                                    |
  | Subject: Re: [ECOS] More questions about the eCos high level serial device driver                                                        |
  >------------------------------------------------------------------------------------------------------------------------------------------|




> Michael Checky wrote:
> > It appears that the design of 'serial.c' does not work well for serial
> > ports with FIFOs.  The functionality provided by the low level device
> > driver's 'stop_xmit' routine is overloaded.
> >
> > The 'stop_xmit' routine is called when '
> > CYG_IO_GET_CONFIG_SERIAL_OUTPUT_FLUSH' is requested.  It can be assumed
> > that in this instance both the serial port transmitter should be
disabled
> > and the tx FIFO should be reset.
>
> One could argue in an ideal world, yes. But the paradigm eCos was using
> was that whatever is in the FIFO is as good as sent.
>
> > The 'stop_xmit' routine is also called when a XOFF character has been
> > received.  In this instance, the serial port transmitter should be
disabled
> > and the tx FIFO should be left as it is.
>
> The same applies here...

Let me give you a real world example.  The UART that I'm writing the driver
for has 256 byte FIFOs and it also has DMA to load and unload it's FIFOs.
Now we're talking lots of bytes that eCos "thinks" it has sent, but in
reality they're only queued, ready to be sent.  I still think it's
important to call out these two cases, so the driver can do the right
thing.  In a 16550 like UART driver, 'stop_xmit' is sufficient for both of
these two cases.

> > The 'stop_xmit' routine is also called by 'serial_xmt_char' and '
> > serial_data_xmt_done' immediately after these routines determine that
they
> > have emptied the tx buffer.  In this instance, the serial port
transmitter
> > should NOT be disabled and the tx FIFO should be left to drain, after
which
> > the serial port transmitter can be disabled.
>
> Now this is a little more interesting... the principle eCos had was that
> there was no longer any reason for it to be informed about tx
availability
> in the FIFO - the FIFO can be just be allowed to be sent naturally.
>
> However, I suppose it's possible that some serial hardware could actually

> need to turn off the TX entirely, not just the TX interrupt. Although in
> that case this could still be worked round in the driver by just turning
> off the TX when the FIFO is indeed empty and you know you wanted to stop.

In this case, I admit my analysis was too shallow.  Until I looked at it
more, I didn't realize this case was about just letting eCos know about tx
availability.  We can ignore this case for now.  Although it might come up
if a driver was trying to support RS-485 and needed to tri-state the
transmitter driver once it knew there were no more bytes to be transmitted.

> I would prefer Roland's solution if anything. I'll check in something
> based on his patch just so we can get the "ideal world" I mentioned
above.
> This is on the assumption that down the road a serial driver will
actually
> use it! But it's very low overhead.

I haven't looked at this patch closely enough to have a position on it, so
don't apply it on my account yet.

Michael Checky







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



More information about the Ecos-discuss mailing list