diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2013-08-05 12:49:58 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2013-08-05 12:49:58 +0200 |
commit | 9ebb0554cd0e19f3757f4f5eea723eaf3b6dab78 (patch) | |
tree | 1398d0d22c2e2e4f8724894602ec4a093f45ac53 /common | |
parent | a4b1ee0def6e8e727886cbfed08c7004c84bf78f (diff) | |
parent | 6dd233f435a73af2875484a88684252689e900d9 (diff) | |
download | barebox-9ebb0554cd0e19f3757f4f5eea723eaf3b6dab78.tar.gz barebox-9ebb0554cd0e19f3757f4f5eea723eaf3b6dab78.tar.xz |
Merge branch 'for-next/misc'
Diffstat (limited to 'common')
-rw-r--r-- | common/Kconfig | 11 | ||||
-rw-r--r-- | common/console.c | 36 | ||||
-rw-r--r-- | common/memory_display.c | 2 |
3 files changed, 34 insertions, 15 deletions
diff --git a/common/Kconfig b/common/Kconfig index 88bc677af8..6322d9dcdb 100644 --- a/common/Kconfig +++ b/common/Kconfig @@ -256,6 +256,17 @@ config RELOCATABLE allowing it to relocate to the end of the available RAM. This way you have the whole memory in a single piece. +config PANIC_HANG + bool "hang the system in case of a fatal error" + help + This option enables stop of the system in case of a + fatal error, so that you have to reset it manually. + This is probably NOT a good idea for an embedded + system where you want the system to reboot + automatically as fast as possible, but it may be + useful during development since you can try to debug + the conditions that lead to the situation. + config PROMPT string prompt "barebox command prompt" diff --git a/common/console.c b/common/console.c index a0a06f6300..402dcf53ec 100644 --- a/common/console.c +++ b/common/console.c @@ -62,22 +62,27 @@ static int console_std_set(struct device_d *dev, struct param_d *param, char active[4]; unsigned int flag = 0, i = 0; - if (!val) - dev_param_set_generic(dev, param, NULL); + if (val) { + if (strchr(val, 'i') && cdev->f_caps & CONSOLE_STDIN) { + active[i++] = 'i'; + flag |= CONSOLE_STDIN; + } - if (strchr(val, 'i') && cdev->f_caps & CONSOLE_STDIN) { - active[i++] = 'i'; - flag |= CONSOLE_STDIN; - } + if (strchr(val, 'o') && cdev->f_caps & CONSOLE_STDOUT) { + active[i++] = 'o'; + flag |= CONSOLE_STDOUT; + } - if (strchr(val, 'o') && cdev->f_caps & CONSOLE_STDOUT) { - active[i++] = 'o'; - flag |= CONSOLE_STDOUT; + if (strchr(val, 'e') && cdev->f_caps & CONSOLE_STDERR) { + active[i++] = 'e'; + flag |= CONSOLE_STDERR; + } } - if (strchr(val, 'e') && cdev->f_caps & CONSOLE_STDERR) { - active[i++] = 'e'; - flag |= CONSOLE_STDERR; + if (flag && !cdev->f_active) { + /* The device is being activated, set its baudrate */ + if (cdev->setbrg) + cdev->setbrg(cdev, cdev->baudrate); } active[i] = 0; @@ -104,6 +109,10 @@ static int console_baudrate_set(struct param_d *param, void *priv) struct console_device *cdev = priv; unsigned char c; + /* + * If the device is already active, change its baudrate. + * The baudrate of an inactive device will be set at activation time. + */ if (cdev->f_active) { printf("## Switch baudrate to %d bps and press ENTER ...\n", cdev->baudrate); @@ -113,8 +122,7 @@ static int console_baudrate_set(struct param_d *param, void *priv) do { c = getc(); } while (c != '\r' && c != '\n'); - } else - cdev->setbrg(cdev, cdev->baudrate); + } return 0; } diff --git a/common/memory_display.c b/common/memory_display.c index eb188e1d79..7e4f4da622 100644 --- a/common/memory_display.c +++ b/common/memory_display.c @@ -2,7 +2,7 @@ #define DISP_LINE_LEN 16 -int memory_display(char *addr, loff_t offs, unsigned nbytes, int size, int swab) +int memory_display(const void *addr, loff_t offs, unsigned nbytes, int size, int swab) { ulong linebytes, i; u_char *cp; |