simualtor I/O refactoring - better names and removing duplication
This commit is contained in:
parent
fcbf67c7d7
commit
c71970782f
|
@ -31,7 +31,7 @@ void printToConsole(char *p) {
|
||||||
cputs(p);
|
cputs(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
SerialAdapter_t serialAdapterInstance;
|
BaseChannel serialAdapterInstance;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Console print server done using synchronous messages. This makes the access
|
* Console print server done using synchronous messages. This makes the access
|
||||||
|
|
|
@ -68,8 +68,16 @@ static msg_t wt_get(void *ip) {
|
||||||
return CONSOLE_PORT->vmt->get(CONSOLE_PORT);
|
return CONSOLE_PORT->vmt->get(CONSOLE_PORT);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct BaseChannelVMT vmt = { wt_writes, wt_reads, wt_put, wt_get, wt_putt, wt_gett, wt_writet, wt_readt };
|
/**
|
||||||
|
* These implementation print same content on console screen and send data over the underlying CONSOLE_PORT
|
||||||
|
* this is useful to see what's going on.
|
||||||
|
* See #wt_get() as a typical implementation
|
||||||
|
*/
|
||||||
|
static const struct BaseChannelVMT vmt = {
|
||||||
|
wt_writes, wt_reads, wt_put, wt_get,
|
||||||
|
wt_putt, wt_gett, wt_writet, wt_readt,
|
||||||
|
};
|
||||||
|
|
||||||
void initTestStream(SerialAdapter_t *ts) {
|
void initTestStream(BaseChannel *ts) {
|
||||||
ts->vmt = &vmt;
|
ts->vmt = &vmt;
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ extern "C"
|
||||||
{
|
{
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
void initTestStream(SerialAdapter_t *ts);
|
void initTestStream(BaseChannel *ts);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,14 +55,7 @@
|
||||||
// project-wide default thread stack size
|
// project-wide default thread stack size
|
||||||
#define UTILITY_THREAD_STACK_SIZE 1384
|
#define UTILITY_THREAD_STACK_SIZE 1384
|
||||||
|
|
||||||
/**
|
extern BaseChannel serialAdapterInstance;
|
||||||
*
|
|
||||||
*/
|
|
||||||
typedef struct {
|
|
||||||
const struct BaseChannelVMT *vmt;
|
|
||||||
} SerialAdapter_t;
|
|
||||||
|
|
||||||
extern SerialAdapter_t serialAdapterInstance;
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C"
|
extern "C"
|
||||||
|
|
Loading…
Reference in New Issue