diff options
author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2010-01-06 10:30:01 +0000 |
---|---|---|
committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2010-01-06 10:30:01 +0000 |
commit | bc489e39a8036bd8cc70569ac8e31ec257d68747 (patch) | |
tree | 36d97fd5e1b3f4b2082ab1bac3b9125428b799d9 /os | |
parent | 78167cbb9fcc6c3e215c6827d0df5035d1c6d079 (diff) | |
download | ChibiOS-bc489e39a8036bd8cc70569ac8e31ec257d68747.tar.gz ChibiOS-bc489e39a8036bd8cc70569ac8e31ec257d68747.tar.bz2 ChibiOS-bc489e39a8036bd8cc70569ac8e31ec257d68747.zip |
Coverage 100% for modified queues.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1505 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os')
-rw-r--r-- | os/hal/platforms/Linux/console.c | 38 | ||||
-rw-r--r-- | os/hal/platforms/Win32/console.c | 38 |
2 files changed, 66 insertions, 10 deletions
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}
};
/*===========================================================================*/
|