From bc489e39a8036bd8cc70569ac8e31ec257d68747 Mon Sep 17 00:00:00 2001
From: gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>
Date: Wed, 6 Jan 2010 10:30:01 +0000
Subject: Coverage 100% for modified queues.

git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1505 35acf78f-673a-0410-8e92-d51de3d6d3f4
---
 os/hal/platforms/Linux/console.c | 38 +++++++++++++++++++++++++++++++++-----
 os/hal/platforms/Win32/console.c | 38 +++++++++++++++++++++++++++++++++-----
 2 files changed, 66 insertions(+), 10 deletions(-)

(limited to 'os')

diff --git a/os/hal/platforms/Linux/console.c b/os/hal/platforms/Linux/console.c
index c7b71823a..0c47ff491 100644
--- a/os/hal/platforms/Linux/console.c
+++ b/os/hal/platforms/Linux/console.c
@@ -45,6 +45,19 @@ BaseChannel CD1;
 /* Driver local functions.                                                   */
 /*===========================================================================*/
 
+
+static size_t writes(void *ip, const uint8_t *bp, size_t n) {
+
+  (void)ip;
+  return fwrite(bp, 1, n, stdout);
+}
+
+static size_t reads(void *ip, uint8_t *bp, size_t n) {
+
+  (void)ip;
+  return fread(bp, 1, n, stdin);
+}
+
 static bool_t putwouldblock(void *ip) {
 
   (void)ip;
@@ -57,24 +70,39 @@ static bool_t getwouldblock(void *ip) {
   return TRUE;
 }
 
-static msg_t put(void *ip, uint8_t b, systime_t timeout) {
+static msg_t putt(void *ip, uint8_t b, systime_t time) {
 
   (void)ip;
-  (void)timeout;
+  (void)time;
   fputc(b, stdout);
   fflush(stdout);
   return RDY_OK;
 }
 
-static msg_t get(void *ip, systime_t timeout) {
+static msg_t gett(void *ip, systime_t time) {
 
   (void)ip;
-  (void)timeout;
+  (void)time;
   return fgetc(stdin);
 }
 
+static size_t writet(void *ip, const uint8_t *bp, size_t n, systime_t time) {
+
+  (void)ip;
+  (void)time;
+  return fwrite(bp, 1, n, stdout);
+}
+
+static size_t readt(void *ip, uint8_t *bp, size_t n, systime_t time) {
+
+  (void)ip;
+  (void)time;
+  return fread(bp, 1, n, stdin);
+}
+
 static const struct BaseChannelVMT vmt = {
-  {putwouldblock, getwouldblock, put, get}
+  {writes, reads},
+  {putwouldblock, getwouldblock, putt, gett, writet, readt}
 };
 
 /*===========================================================================*/
diff --git a/os/hal/platforms/Win32/console.c b/os/hal/platforms/Win32/console.c
index c7b71823a..0c47ff491 100644
--- a/os/hal/platforms/Win32/console.c
+++ b/os/hal/platforms/Win32/console.c
@@ -45,6 +45,19 @@ BaseChannel CD1;
 /* Driver local functions.                                                   */
 /*===========================================================================*/
 
+
+static size_t writes(void *ip, const uint8_t *bp, size_t n) {
+
+  (void)ip;
+  return fwrite(bp, 1, n, stdout);
+}
+
+static size_t reads(void *ip, uint8_t *bp, size_t n) {
+
+  (void)ip;
+  return fread(bp, 1, n, stdin);
+}
+
 static bool_t putwouldblock(void *ip) {
 
   (void)ip;
@@ -57,24 +70,39 @@ static bool_t getwouldblock(void *ip) {
   return TRUE;
 }
 
-static msg_t put(void *ip, uint8_t b, systime_t timeout) {
+static msg_t putt(void *ip, uint8_t b, systime_t time) {
 
   (void)ip;
-  (void)timeout;
+  (void)time;
   fputc(b, stdout);
   fflush(stdout);
   return RDY_OK;
 }
 
-static msg_t get(void *ip, systime_t timeout) {
+static msg_t gett(void *ip, systime_t time) {
 
   (void)ip;
-  (void)timeout;
+  (void)time;
   return fgetc(stdin);
 }
 
+static size_t writet(void *ip, const uint8_t *bp, size_t n, systime_t time) {
+
+  (void)ip;
+  (void)time;
+  return fwrite(bp, 1, n, stdout);
+}
+
+static size_t readt(void *ip, uint8_t *bp, size_t n, systime_t time) {
+
+  (void)ip;
+  (void)time;
+  return fread(bp, 1, n, stdin);
+}
+
 static const struct BaseChannelVMT vmt = {
-  {putwouldblock, getwouldblock, put, get}
+  {writes, reads},
+  {putwouldblock, getwouldblock, putt, gett, writet, readt}
 };
 
 /*===========================================================================*/
-- 
cgit v1.2.3