diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2013-10-07 07:59:18 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2013-10-07 07:59:18 +0200 |
commit | 574947ef76428803c3a2cbe8a02f294e3227d8e0 (patch) | |
tree | 20ef37824aa8b169faf6cb87868aa7de912811a8 /common | |
parent | fb0c2ee1ae85b9f5127c37e604b92899a907082c (diff) | |
parent | 6a5121f74894ed2d3514b59bd287d126eb7f1488 (diff) | |
download | barebox-574947ef76428803c3a2cbe8a02f294e3227d8e0.tar.gz barebox-574947ef76428803c3a2cbe8a02f294e3227d8e0.tar.xz |
Merge branch 'for-next/console'
Diffstat (limited to 'common')
-rw-r--r-- | common/console.c | 18 | ||||
-rw-r--r-- | common/console_common.c | 22 | ||||
-rw-r--r-- | common/console_simple.c | 7 |
3 files changed, 39 insertions, 8 deletions
diff --git a/common/console.c b/common/console.c index 6ca94e2a02..4ca5f1809f 100644 --- a/common/console.c +++ b/common/console.c @@ -63,19 +63,21 @@ static int console_std_set(struct device_d *dev, struct param_d *param, unsigned int flag = 0, i = 0; if (val) { - if (strchr(val, 'i') && cdev->f_caps & CONSOLE_STDIN) { + if (strchr(val, 'i') && cdev->getc) { active[i++] = 'i'; flag |= CONSOLE_STDIN; } - if (strchr(val, 'o') && cdev->f_caps & CONSOLE_STDOUT) { - active[i++] = 'o'; - flag |= CONSOLE_STDOUT; - } + if (cdev->putc) { + if (strchr(val, 'o')) { + 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')) { + active[i++] = 'e'; + flag |= CONSOLE_STDERR; + } } } diff --git a/common/console_common.c b/common/console_common.c index d139d1a8fe..a3aca6f46b 100644 --- a/common/console_common.c +++ b/common/console_common.c @@ -108,3 +108,25 @@ int fputc(int fd, char c) return 0; } EXPORT_SYMBOL(fputc); + +/* + * @brief returns current used console device + * + * @return console device which is registered with CONSOLE_STDIN and + * CONSOLE_STDOUT + */ +struct console_device *console_get_first_active(void) +{ + struct console_device *cdev; + /* + * Assumption to have BOTH CONSOLE_STDIN AND STDOUT in the + * same output console + */ + for_each_console(cdev) { + if ((cdev->f_active & (CONSOLE_STDIN | CONSOLE_STDOUT))) + return cdev; + } + + return NULL; +} +EXPORT_SYMBOL(console_get_first_active); diff --git a/common/console_simple.c b/common/console_simple.c index 101064b69a..5ab937fdb7 100644 --- a/common/console_simple.c +++ b/common/console_simple.c @@ -82,6 +82,13 @@ int console_register(struct console_device *newcdev) console_list.prev = console_list.next = &newcdev->list; newcdev->list.prev = newcdev->list.next = &console_list; + if (newcdev->setbrg) { + newcdev->baudrate = CONFIG_BAUDRATE; + newcdev->setbrg(newcdev, newcdev->baudrate); + } + + newcdev->f_active = CONSOLE_STDIN | CONSOLE_STDOUT | CONSOLE_STDERR; + barebox_banner(); return 0; |