This is the mail archive of the ecos-discuss@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: how to set overtime to serial port block read/write?


[Please keep things off the list for the benefit of anyone searching the mailing list archives to the solution for a problem like this]
wb ning wrote:
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?

A serial buffer size of 0 means to poll. That's because there's no buffer space whatsoever to store data received by an interrupt. This is handled specially in the serial code, and doesn't check for aborts, which is probably a bug - please report this to bugzilla at http://bugs.ecos.sourceare.org/


Theoretically, all you need to do instead is set the buffer size to 1.

In practice, for the AT91, that may be quite unreliable as it needs more extensive use of buffering than normal UARTs due to the hardware properties - it uses DMA. You're likely to get dropped characters at anything other than very slow line speeds.

Jifl
--
--["No sense being pessimistic, it wouldn't work anyway"]-- Opinions==mine

--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]