diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2007-07-05 18:01:52 +0200 |
---|---|---|
committer | Sascha Hauer <sha@octopus.labnet.pengutronix.de> | 2007-07-05 18:01:52 +0200 |
commit | 6feab47528c7a3e58e1955df356af5475990133b (patch) | |
tree | 998fa4c7c67dff4829e75f7165e4d4778746c440 /arch | |
parent | 680ed15c9062f74053a1fa84bade1c24d16ec358 (diff) | |
download | barebox-6feab47528c7a3e58e1955df356af5475990133b.tar.gz barebox-6feab47528c7a3e58e1955df356af5475990133b.tar.xz |
svn_rev_414
Diffstat (limited to 'arch')
-rw-r--r-- | arch/linux/board/Makefile | 2 | ||||
-rw-r--r-- | arch/linux/board/console.c | 70 |
2 files changed, 72 insertions, 0 deletions
diff --git a/arch/linux/board/Makefile b/arch/linux/board/Makefile index 6c23dc7a49..af62aa25dc 100644 --- a/arch/linux/board/Makefile +++ b/arch/linux/board/Makefile @@ -1,3 +1,5 @@ obj-y += board.o obj-y += clock.o obj-y += hostfile.o +obj-y += console.o + diff --git a/arch/linux/board/console.c b/arch/linux/board/console.c new file mode 100644 index 0000000000..a7f9e8b12e --- /dev/null +++ b/arch/linux/board/console.c @@ -0,0 +1,70 @@ +#include <common.h> +#include <driver.h> +#include <init.h> +#include <asm/arch/linux.h> +#include <malloc.h> +#include <console.h> + +static void linux_console_putc(struct console_device *cdev, char c) +{ + linux_putc(c); +} + +static int linux_console_tstc(struct console_device *cdev) +{ + return linux_tstc(); +} + +static int linux_console_getc(struct console_device *cdev) +{ + return linux_getc(); +} + +static int linux_console_probe(struct device_d *dev) +{ + struct console_device *cdev; + + cdev = malloc(sizeof(struct console_device)); + dev->type_data = cdev; + cdev->dev = dev; + cdev->flags = CONSOLE_STDIN | CONSOLE_STDOUT | CONSOLE_STDERR; + cdev->tstc = linux_console_tstc; + cdev->putc = linux_console_putc; + cdev->getc = linux_console_getc; + + console_register(cdev); + + return 0; +} + + +static struct driver_d linux_console_driver = { + .name = "console", + .probe = linux_console_probe, + .type = DEVICE_TYPE_CONSOLE, +}; + +static struct device_d linux_console_device = { + .name = "console", + .id = "cs0", + .type = DEVICE_TYPE_CONSOLE, +}; + +#if 0 +static struct device_d linux_console_device1 = { + .name = "console", + .id = "cs1", + .type = DEVICE_TYPE_CONSOLE, +}; +#endif + +static int console_init(void) +{ + register_driver(&linux_console_driver); + register_device(&linux_console_device); +// register_device(&linux_console_device1); + return 0; +} + +console_initcall(console_init); + |