From: Graeme Russ <graeme.russ@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/2] RFC: Add XON/XOFF support
Date: Tue, 25 Oct 2011 19:09:36 +1100 [thread overview]
Message-ID: <4EA66EC0.80602@gmail.com> (raw)
In-Reply-To: <1319514744-18697-2-git-send-email-sjg@chromium.org>
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@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
> +}
> +
> +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()
> 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?
Regards,
Graeme
next prev parent reply other threads:[~2011-10-25 8:09 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-25 3:52 [U-Boot] [PATCH 1/2] Create a single cmd_call() function to handle command execution Simon Glass
2011-10-25 3:52 ` [U-Boot] [PATCH 2/2] RFC: Add XON/XOFF support Simon Glass
2011-10-25 8:09 ` Graeme Russ [this message]
2011-10-25 23:56 ` Simon Glass
2011-10-30 21:30 ` Mike Frysinger
2011-10-30 23:53 ` Albert ARIBAUD
2011-10-25 7:46 ` [U-Boot] [PATCH 1/2] Create a single cmd_call() function to handle command execution Wolfgang Denk
2011-10-25 8:03 ` Graeme Russ
2011-10-25 13:33 ` Simon Glass
2011-10-25 18:20 ` Wolfgang Denk
2011-10-25 13:57 ` Mike Frysinger
2011-10-25 23:05 ` Simon Glass
2011-10-30 21:28 ` Mike Frysinger
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=4EA66EC0.80602@gmail.com \
--to=graeme.russ@gmail.com \
--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