diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2018-02-21 12:40:18 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2018-03-06 12:32:09 +0100 |
commit | 337a1869092779be0afca381dba674d3de4d7c9b (patch) | |
tree | 02a8dc8e446160b69b4053caf51ef0cc6bf68b5a /cpukit/libcsupport/src/consolesimpleread.c | |
parent | bsps/sparc: Fix global construction/destruction (diff) | |
download | rtems-337a1869092779be0afca381dba674d3de4d7c9b.tar.bz2 |
Add a simple task console driver
Close #3320.
Diffstat (limited to 'cpukit/libcsupport/src/consolesimpleread.c')
-rw-r--r-- | cpukit/libcsupport/src/consolesimpleread.c | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/cpukit/libcsupport/src/consolesimpleread.c b/cpukit/libcsupport/src/consolesimpleread.c new file mode 100644 index 0000000000..a796e4380f --- /dev/null +++ b/cpukit/libcsupport/src/consolesimpleread.c @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2017 embedded brains GmbH. All rights reserved. + * + * embedded brains GmbH + * Dornierstr. 4 + * 82178 Puchheim + * Germany + * <rtems@embedded-brains.de> + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.org/license/LICENSE. + */ + +#include <rtems/bspIo.h> +#include <rtems/libio.h> + +#include "consolesimple.h" + +ssize_t _Console_simple_Read( + rtems_libio_t *iop, + void *buffer, + size_t count +) +{ + char *buf; + ssize_t i; + ssize_t n; + + buf = buffer; + n = (ssize_t) count; + + for ( i = 0; i < n; ++i ) { + int c; + + do { + c = getchark(); + } while (c == -1); + + buf[ i ] = (char) c; + } + + return n; +} |