From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14834 invoked by alias); 7 Oct 2009 19:27:20 -0000 Received: (qmail 14822 invoked by uid 22791); 7 Oct 2009 19:27:18 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from virtual.bogons.net (HELO virtual.bogons.net) (193.178.223.136) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 07 Oct 2009 19:27:14 +0000 Received: from jifvik.dyndns.org (jifvik.dyndns.org [85.158.45.40]) by virtual.bogons.net (8.10.2+Sun/8.11.2) with ESMTP id n97JRB427467; Wed, 7 Oct 2009 20:27:11 +0100 (BST) Received: from [172.31.1.126] (neelix.jifvik.org [172.31.1.126]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by jifvik.dyndns.org (Postfix) with ESMTP id F03113FEB; Wed, 7 Oct 2009 20:27:10 +0100 (BST) Message-ID: <4ACCEB8D.4090506@jifvik.org> Date: Wed, 07 Oct 2009 19:27:00 -0000 From: Jonathan Larmour User-Agent: Mozilla Thunderbird 1.0.8-1.1.fc4 (X11/20060501) MIME-Version: 1.0 To: wb ning Cc: eCos discussion References: <44185a820909260058k6f820a1aheb6f37b2e4e868fc@mail.gmail.com> <4ABFDF2D.6070709@jifvik.org> <44185a820910061944l2e676e41s8dc91f3f9970a0fd@mail.gmail.com> <4ACC0825.7050707@jifvik.org> <44185a820910070151l673d3ab9r7f68c7adef7cb3ed@mail.gmail.com> In-Reply-To: <44185a820910070151l673d3ab9r7f68c7adef7cb3ed@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Mailing-List: contact ecos-discuss-help@ecos.sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: ecos-discuss-owner@ecos.sourceware.org Subject: Re: [ECOS] how to set overtime to serial port block read/write? X-SW-Source: 2009-10/txt/msg00045.txt.bz2 [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