public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Bryan O'Donoghue <bodonoghue@codehermit.ie>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] PXA27x usbtty start up sequence
Date: Sun, 20 May 2007 22:40:17 +0100	[thread overview]
Message-ID: <20070520224017.1e50894c@localhost.localdomain> (raw)
In-Reply-To: <20070520160702.GB3887@enneenne.com>

On Sun, 20 May 2007 18:07:02 +0200
Rodolfo Giometti <giometti@enneenne.com> wrote:

Hold on wait... I think I've thought of a better way still to send
that data..

How about

__puts()
{
	while(usb_configured() == TRUE && data_to_send){
		/* do the thing */
	}
}

I think something like that would be better from the __puts()
perspective, then a retry count.... I'll get back to you on that one
though, because I may find some way to break that else I'll code up a
patch around this idea, and submit at a later date.

Basically the __puts() function would function as a guaranteed
delivery if and only-if the device was in the configured state, else
it should happily allow the system to boot, for example in the case
where the USB cable hasn't been connected.

This would mean that each usbdcore_* would export usb_get_state() or
similar and disjoin on state == CONFIGURED, which
would allow us not to do naff things like "retries", especially on
something like USB bulk endpoints, which are supposed to guarantee
data tx.

> It's into usbtty_poll() which calls write_buffer() when the USB
> device get connected (usbtty_configured() is true).

> Function write_buffer() calls udc_endpoint_write() who calls driver
> low level function. This low level function, PXA270 specific, waits
> all data has been transmitted before returning to the caller, this
> because I need to know when a packet has been transmetted before
> sending a new one or I get some data lost during transmission.

If you loop indefinitely at the low-level BULK tx level... how would
you deal with ep0 control requests that *must* be responded to
immediately ? 

You are right that you can't abandon BULK IN data... but, you aren't
right to be doing the infinite loop in your function below
endpoint_write() since this means you can't deal with a control
request if one should happen.

You'll see I have a tx_retry in udc_ep_tx and you *might* be thinking
that that means I *give up* data transfer but, that's not so..

write_buffer() won't increment the data unless endpoint_write() says
it successfully transmitted the data. Thus if the endpoint_write call
stack returns anything other then 0, the implication is that there is
TX data *still* to be sent, and that's precisely what a function
like __puts() should do with a statement like 

while(usb_configured() == TRUE && data_to_send) as the control.

The rationale behind this behavior is that it allows a high level
function such as __puts() to make a decision as to provide
either guaranteed or best-effort data transport to the host system.


Greetings,
Bryan

  reply	other threads:[~2007-05-20 21:40 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-12 23:19 [U-Boot-Users] PXA27x usbtty start up sequence Rodolfo Giometti
2007-05-13 12:25 ` Bryan O'Donoghue
2007-05-14  6:35   ` Rodolfo Giometti
2007-05-18 17:15   ` Rodolfo Giometti
2007-05-20 13:54     ` Bryan O'Donoghue
2007-05-20 16:07       ` Rodolfo Giometti
2007-05-20 21:40         ` Bryan O'Donoghue [this message]
2007-05-20 22:23           ` Rodolfo Giometti
2007-05-20 23:11             ` Bryan O'Donoghue
2007-05-20 23:59               ` Bryan O'Donoghue

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070520224017.1e50894c@localhost.localdomain \
    --to=bodonoghue@codehermit.ie \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox