git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@5759 35acf78f-673a-0410-8e92-d51de3d6d3f4

master
gdisirio 2013-05-26 07:36:40 +00:00
parent d9f59f37da
commit 386a2bf390
2 changed files with 24 additions and 16 deletions

View File

@ -43,8 +43,7 @@ BaseChannel CD1;
/* Driver local functions. */ /* Driver local functions. */
/*===========================================================================*/ /*===========================================================================*/
static size_t write(void *ip, const uint8_t *bp, size_t n) {
static size_t writes(void *ip, const uint8_t *bp, size_t n) {
size_t ret; size_t ret;
(void)ip; (void)ip;
@ -53,22 +52,26 @@ static size_t writes(void *ip, const uint8_t *bp, size_t n) {
return ret; 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; (void)ip;
return fread(bp, 1, n, stdin); return fread(bp, 1, n, stdin);
} }
static bool_t putwouldblock(void *ip) { static msg_t put(void *ip, uint8_t b) {
(void)ip; (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; (void)ip;
return TRUE;
return fgetc(stdin);
} }
static msg_t putt(void *ip, uint8_t b, systime_t time) { 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 = { static const struct BaseChannelVMT vmt = {
writes, reads, putwouldblock, getwouldblock, putt, gett, writet, readt write, read, put, get,
putt, gett, writet, readt
}; };
/*===========================================================================*/ /*===========================================================================*/

View File

@ -43,8 +43,7 @@ BaseChannel CD1;
/* Driver local functions. */ /* Driver local functions. */
/*===========================================================================*/ /*===========================================================================*/
static size_t write(void *ip, const uint8_t *bp, size_t n) {
static size_t writes(void *ip, const uint8_t *bp, size_t n) {
size_t ret; size_t ret;
(void)ip; (void)ip;
@ -53,22 +52,26 @@ static size_t writes(void *ip, const uint8_t *bp, size_t n) {
return ret; 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; (void)ip;
return fread(bp, 1, n, stdin); return fread(bp, 1, n, stdin);
} }
static bool_t putwouldblock(void *ip) { static msg_t put(void *ip, uint8_t b) {
(void)ip; (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; (void)ip;
return TRUE;
return fgetc(stdin);
} }
static msg_t putt(void *ip, uint8_t b, systime_t time) { 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 = { static const struct BaseChannelVMT vmt = {
writes, reads, putwouldblock, getwouldblock, putt, gett, writet, readt write, read, put, get,
putt, gett, writet, readt
}; };
/*===========================================================================*/ /*===========================================================================*/