[U-Boot-Users] PXA27x usbtty start up sequence

Bryan O'Donoghue bodonoghue at codehermit.ie
Sun May 20 15:54:36 CEST 2007


On Fri, 18 May 2007 19:15:21 +0200
Rodolfo Giometti <giometti at enneenne.com> wrote:

> > /* Not tested */
> > unsigned int len = 0;
> > while(len > 0) {
> > 	usbtty_poll();
> > 
> > 	/* Do stuff */
> > }
> > 
> > in __usbtty_puts()
> 
> No, this doesn't resolve the problem.

That's really quite odd. The following should be similar to what you
did and it *does* seem to work just fine, for me.

/*
 * Output a string to the usb client port - implementing flow control
 */
static void __usbtty_puts (const char *str, int len)
{
	int maxlen = usbtty_output.totalsize;
	int space, n, retries = 0;

	/* break str into chunks < buffer size, if needed */
	while (len > 0 && retries < 10000L) {
		usbtty_poll ();

		space = maxlen - usbtty_output.size;
		/* Empty buffer here, if needed, to ensure space... */
		if (space) {
			write_buffer (&usbtty_output);
			
			n = MIN (space, MIN (len, maxlen));
			buf_push (&usbtty_output, str, n);

			str += n;
			len -= n;
			retries = 0;		
		}else{
			retries++;
		}
	}
}

Das U-Boot environment:
stdin usbtty
stdout usbtty
usbtty cdc_acm


Best,
Bryan




More information about the U-Boot mailing list