aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/platforms/Posix/console.c
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2013-05-26 07:36:40 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2013-05-26 07:36:40 +0000
commit386a2bf39039dc2a2723058921482b7cd3cb9e77 (patch)
treec5c4912cf020acb74cf2383c6161cfe0a27b3bd4 /os/hal/platforms/Posix/console.c
parentd9f59f37daebf16abaca81dfabba1c198b5d2f33 (diff)
downloadChibiOS-386a2bf39039dc2a2723058921482b7cd3cb9e77.tar.gz
ChibiOS-386a2bf39039dc2a2723058921482b7cd3cb9e77.tar.bz2
ChibiOS-386a2bf39039dc2a2723058921482b7cd3cb9e77.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@5759 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal/platforms/Posix/console.c')
-rw-r--r--os/hal/platforms/Posix/console.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/os/hal/platforms/Posix/console.c b/os/hal/platforms/Posix/console.c
index f2e79323c..dbbfbf661 100644
--- a/os/hal/platforms/Posix/console.c
+++ b/os/hal/platforms/Posix/console.c
@@ -43,8 +43,7 @@ BaseChannel CD1;
/* Driver local functions. */
/*===========================================================================*/
-
-static size_t writes(void *ip, const uint8_t *bp, size_t n) {
+static size_t write(void *ip, const uint8_t *bp, size_t n) {
size_t ret;
(void)ip;
@@ -53,22 +52,26 @@ static size_t writes(void *ip, const uint8_t *bp, size_t n) {
return ret;
}
-static size_t reads(void *ip, uint8_t *bp, size_t n) {
+static size_t read(void *ip, uint8_t *bp, size_t n) {
(void)ip;
return fread(bp, 1, n, stdin);
}
-static bool_t putwouldblock(void *ip) {
+static msg_t put(void *ip, uint8_t b) {
(void)ip;
- return FALSE;
+
+ fputc(b, stdout);
+ fflush(stdout);
+ return RDY_OK;
}
-static bool_t getwouldblock(void *ip) {
+static msg_t get(void *ip) {
(void)ip;
- return TRUE;
+
+ return fgetc(stdin);
}
static msg_t putt(void *ip, uint8_t b, systime_t time) {
@@ -105,7 +108,8 @@ static size_t readt(void *ip, uint8_t *bp, size_t n, systime_t time) {
}
static const struct BaseChannelVMT vmt = {
- writes, reads, putwouldblock, getwouldblock, putt, gett, writet, readt
+ write, read, put, get,
+ putt, gett, writet, readt
};
/*===========================================================================*/