[U-Boot] [PATCH 2/2] RFC: Add XON/XOFF support

Simon Glass sjg at chromium.org
Wed Oct 26 01:56:10 CEST 2011


Hi Graeme,

On Tue, Oct 25, 2011 at 1:09 AM, Graeme Russ <graeme.russ at gmail.com> wrote:
> Hi Simon,
>
> On 25/10/11 14:52, Simon Glass wrote:
>> This is just for testing - please try it out and report back with results.
>> For me it works on Minicom but not ser2net.
>>
>> This needs to be controlled by an environment variable, CONFIG option or
>> both. We may need a way of specifying flow control on a per-device basis.
>> We may need to do something special for X-modem transfers, etc. This might
>> turn out to be a can of worms.
>>
>> Signed-off-by: Simon Glass <sjg at chromium.org>
>> ---
>>  common/command.c |    1 +
>>  common/console.c |   12 ++++++++++++
>>  common/main.c    |    3 +++
>>  include/common.h |    2 ++
>>  4 files changed, 18 insertions(+), 0 deletions(-)
>>
>> diff --git a/common/command.c b/common/command.c
>> index acc1c15..7b7c24e 100644
>> --- a/common/command.c
>> +++ b/common/command.c
>> @@ -492,6 +492,7 @@ int cmd_call(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
>>  {
>>       int result;
>>
>> +     console_suspend_input();
>
> Not the best name, but I cannot think of better right now
>
>>       result = (cmdtp->cmd)(cmdtp, flag, argc, argv);
>>       if (result)
>>               debug("Command failed, result=%d", result);
>> diff --git a/common/console.c b/common/console.c
>> index f17875e..eeb58e6 100644
>> --- a/common/console.c
>> +++ b/common/console.c
>> @@ -199,6 +199,18 @@ static inline void console_doenv(int file, struct stdio_dev *dev)
>>  }
>>  #endif /* defined(CONFIG_CONSOLE_MUX) */
>>
>> +void console_suspend_input(void)
>> +{
>> +     /* Send XOFF to tell the other end to stop sending */
>> +     console_putc(stdout, 'S' - '@');
>
> Uugh - #define XON and XOFF please

OK

>
>> +}
>> +
>> +void console_resume_input(void)
>> +{
>> +     /* Send XON to tell the other end to start sending */
>> +     console_putc(stdout, 'Q' - '@');
>> +}
>> +
>>  /** U-Boot INITIAL CONSOLE-NOT COMPATIBLE FUNCTIONS *************************/
>>
>>  int serial_printf(const char *fmt, ...)
>> diff --git a/common/main.c b/common/main.c
>> index 3b60d27..b030176 100644
>> --- a/common/main.c
>> +++ b/common/main.c
>> @@ -948,6 +948,7 @@ int readline_into_buffer (const char *const prompt, char * buffer)
>>
>>               if (prompt)
>>                       puts (prompt);
>> +             console_resume_input();
>
> Not needed - move to getc()

Well we need to thing about the other issues mentioned in my commit
message also.

>
>>               rc = cread_line(prompt, p, &len);
>>               return rc < 0 ? rc : len;
>> @@ -967,6 +968,8 @@ int readline_into_buffer (const char *const prompt, char * buffer)
>>       }
>>       col = plen;
>>
>> +     console_resume_input();
>
> Not needed (in getc())
>
>> +
>>       for (;;) {
>>  #ifdef CONFIG_BOOT_RETRY_TIME
>>               while (!tstc()) {       /* while no incoming data */
>> diff --git a/include/common.h b/include/common.h
>> index a1683a2..970ec0d 100644
>> --- a/include/common.h
>> +++ b/include/common.h
>> @@ -738,6 +738,8 @@ int       ctrlc (void);
>>  int  had_ctrlc (void);       /* have we had a Control-C since last clear? */
>>  void clear_ctrlc (void);     /* clear the Control-C condition */
>>  int  disable_ctrlc (int);    /* 1 to disable, 0 to enable Control-C detect */
>> +void console_suspend_input(void);
>> +void console_resume_input(void);
>>
>>  /*
>>   * STDIO based functions (can always be used)
>
> What about the secondart 'rx_flush()' I mentioned?

Will await discussions before doing a new patch :-)

Regards,
Simon

>
> Regards,
>
> Graeme
>


More information about the U-Boot mailing list