Thanks to Jonathan Larmour. I found the problem by debugging the ecos
sourcecode. The reason is that i have set the "Buffer size for At91
serial" to 0. If i set the buffer size to a non-zero value, i will got
the right result. In the ecos sourcecode serial_get_config() has
following statements:
case CYG_IO_GET_CONFIG_SERIAL_ABORT:
// Abort any outstanding I/O, including blocked reads
// Caution - assumed to be called from 'timeout' (i.e. DSR) code
if (in_cbuf->len != 0) {
in_cbuf->abort = true;
cyg_drv_cond_broadcast(&in_cbuf->wait);
}
if (out_cbuf->len != 0) {
out_cbuf->abort = true;
cyg_drv_cond_broadcast(&out_cbuf->wait);
}
break;
So i will not pass the if statement, i don't know why shoud so this
judge, if i set serial buffer to 0, i can't use the timeout function,
and if i don't set serial buffer to 0, my application may have some
trouble. Are there have another timeout version for serial buffer 0
size?