Revision 2c99037f
| os/core/src/aos_iostream.c | ||
|---|---|---|
| 72 | 72 |
/** |
| 73 | 73 |
* @brief Implementation of the BaseAsynchronousChannel putt() method. |
| 74 | 74 |
*/ |
| 75 |
static msg_t _channelputt(void *instance, uint8_t b, systime_t time)
|
|
| 75 |
static msg_t _channelputt(void *instance, uint8_t b, sysinterval_t time)
|
|
| 76 | 76 |
{
|
| 77 | 77 |
if (((AosIOChannel*)instance)->flags & AOS_IOCHANNEL_OUTPUT_ENABLE) {
|
| 78 | 78 |
return chnPutTimeout(((AosIOChannel*)instance)->asyncchannel, b, time); |
| ... | ... | |
| 84 | 84 |
/** |
| 85 | 85 |
* @brief Implementation of the BaseAsynchronousChannel gett() method. |
| 86 | 86 |
*/ |
| 87 |
static msg_t _channelgett(void *instance, systime_t time)
|
|
| 87 |
static msg_t _channelgett(void *instance, sysinterval_t time)
|
|
| 88 | 88 |
{
|
| 89 | 89 |
if (((AosIOChannel*)instance)->flags & AOS_IOCHANNEL_INPUT_ENABLE) {
|
| 90 | 90 |
return chnGetTimeout(((AosIOChannel*)instance)->asyncchannel, time); |
| ... | ... | |
| 96 | 96 |
/** |
| 97 | 97 |
* @brief Implementation of the BaseAsynchronousChannel writet() method. |
| 98 | 98 |
*/ |
| 99 |
static size_t _channelwritet(void *instance, const uint8_t *bp, size_t n, systime_t time)
|
|
| 99 |
static size_t _channelwritet(void *instance, const uint8_t *bp, size_t n, sysinterval_t time)
|
|
| 100 | 100 |
{
|
| 101 | 101 |
if (((AosIOChannel*)instance)->flags & AOS_IOCHANNEL_OUTPUT_ENABLE) {
|
| 102 | 102 |
return chnWriteTimeout(((AosIOChannel*)instance)->asyncchannel, bp, n, time); |
| ... | ... | |
| 108 | 108 |
/** |
| 109 | 109 |
* @brief Implementation of the BaseAsynchronousChannel readt() method. |
| 110 | 110 |
*/ |
| 111 |
static size_t _channelreadt(void *instance, uint8_t *bp, size_t n, systime_t time)
|
|
| 111 |
static size_t _channelreadt(void *instance, uint8_t *bp, size_t n, sysinterval_t time)
|
|
| 112 | 112 |
{
|
| 113 | 113 |
if (((AosIOChannel*)instance)->flags & AOS_IOCHANNEL_INPUT_ENABLE) {
|
| 114 | 114 |
return chnReadTimeout(((AosIOChannel*)instance)->asyncchannel, bp, n, time); |
| ... | ... | |
| 118 | 118 |
} |
| 119 | 119 |
|
| 120 | 120 |
/** |
| 121 |
* @brief Implementation of the BaseAsynchronousChannel ctl() method. |
|
| 122 |
*/ |
|
| 123 |
static msg_t _channelctl(void *instance, unsigned int operation, void *arg) {
|
|
| 124 |
(void) instance; |
|
| 125 |
|
|
| 126 |
switch (operation) {
|
|
| 127 |
case CHN_CTL_NOP: |
|
| 128 |
osalDbgCheck(arg == NULL); |
|
| 129 |
break; |
|
| 130 |
case CHN_CTL_INVALID: |
|
| 131 |
osalDbgAssert(false, "invalid CTL operation"); |
|
| 132 |
break; |
|
| 133 |
default: |
|
| 134 |
break; |
|
| 135 |
} |
|
| 136 |
return MSG_OK; |
|
| 137 |
} |
|
| 138 |
|
|
| 139 |
/** |
|
| 121 | 140 |
* @brief Virtual methods table for all AosIOChannel objects. |
| 122 | 141 |
*/ |
| 123 | 142 |
static const struct AosIOChannelVMT _channelvmt = {
|
| ... | ... | |
| 130 | 149 |
_channelgett, |
| 131 | 150 |
_channelwritet, |
| 132 | 151 |
_channelreadt, |
| 152 |
_channelctl, |
|
| 133 | 153 |
}; |
| 134 | 154 |
|
| 135 | 155 |
/** |
| os/core/src/aos_shell.c | ||
|---|---|---|
| 85 | 85 |
/** |
| 86 | 86 |
* @brief Implementation of the BaseAsynchronous putt() method. |
| 87 | 87 |
*/ |
| 88 |
static msg_t _channelputt(void *instance, uint8_t b, systime_t time)
|
|
| 88 |
static msg_t _channelputt(void *instance, uint8_t b, sysinterval_t time)
|
|
| 89 | 89 |
{
|
| 90 | 90 |
if (((AosShellChannel*)instance)->flags & AOS_SHELLCHANNEL_OUTPUT_ENABLED) {
|
| 91 | 91 |
return chnPutTimeout(((AosShellChannel*)instance)->asyncchannel, b, time); |
| ... | ... | |
| 97 | 97 |
/** |
| 98 | 98 |
* @brief Implementation of the BaseAsynchronous gett() method. |
| 99 | 99 |
*/ |
| 100 |
static msg_t _channelgett(void *instance, systime_t time)
|
|
| 100 |
static msg_t _channelgett(void *instance, sysinterval_t time)
|
|
| 101 | 101 |
{
|
| 102 | 102 |
if (((AosShellChannel*)instance)->flags & AOS_SHELLCHANNEL_INPUT_ENABLED) {
|
| 103 | 103 |
return chnGetTimeout(((AosShellChannel*)instance)->asyncchannel, time); |
| ... | ... | |
| 109 | 109 |
/** |
| 110 | 110 |
* @brief Implementation of the BaseAsynchronous writet() method. |
| 111 | 111 |
*/ |
| 112 |
static size_t _channelwritet(void *instance, const uint8_t *bp, size_t n, systime_t time)
|
|
| 112 |
static size_t _channelwritet(void *instance, const uint8_t *bp, size_t n, sysinterval_t time)
|
|
| 113 | 113 |
{
|
| 114 | 114 |
if (((AosShellChannel*)instance)->flags & AOS_SHELLCHANNEL_OUTPUT_ENABLED) {
|
| 115 | 115 |
return chnWriteTimeout(((AosShellChannel*)instance)->asyncchannel, bp, n, time); |
| ... | ... | |
| 121 | 121 |
/** |
| 122 | 122 |
* @brief Implementation of the BaseAsynchronous readt() method. |
| 123 | 123 |
*/ |
| 124 |
static size_t _channelreadt(void *instance, uint8_t *bp, size_t n, systime_t time)
|
|
| 124 |
static size_t _channelreadt(void *instance, uint8_t *bp, size_t n, sysinterval_t time)
|
|
| 125 | 125 |
{
|
| 126 | 126 |
if (((AosShellChannel*)instance)->flags & AOS_SHELLCHANNEL_INPUT_ENABLED) {
|
| 127 | 127 |
return chnReadTimeout(((AosShellChannel*)instance)->asyncchannel, bp, n, time); |
| ... | ... | |
| 130 | 130 |
} |
| 131 | 131 |
} |
| 132 | 132 |
|
| 133 |
/** |
|
| 134 |
* @brief Implementation of the BaseAsynchronousChannel ctl() method. |
|
| 135 |
*/ |
|
| 136 |
static msg_t _channelctl(void *instance, unsigned int operation, void *arg) {
|
|
| 137 |
(void) instance; |
|
| 138 |
|
|
| 139 |
switch (operation) {
|
|
| 140 |
case CHN_CTL_NOP: |
|
| 141 |
osalDbgCheck(arg == NULL); |
|
| 142 |
break; |
|
| 143 |
case CHN_CTL_INVALID: |
|
| 144 |
osalDbgAssert(false, "invalid CTL operation"); |
|
| 145 |
break; |
|
| 146 |
default: |
|
| 147 |
break; |
|
| 148 |
} |
|
| 149 |
return MSG_OK; |
|
| 150 |
} |
|
| 151 |
|
|
| 133 | 152 |
static const struct AosShellChannelVMT _channelvmt = {
|
| 134 | 153 |
(size_t) 0, |
| 135 | 154 |
_channelwrite, |
| ... | ... | |
| 140 | 159 |
_channelgett, |
| 141 | 160 |
_channelwritet, |
| 142 | 161 |
_channelreadt, |
| 162 |
_channelctl, |
|
| 143 | 163 |
}; |
| 144 | 164 |
|
| 145 | 165 |
static size_t _streamwrite(void *instance, const uint8_t *bp, size_t n) |
Also available in: Unified diff