From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23941 invoked by alias); 27 Sep 2009 21:55:02 -0000 Received: (qmail 23927 invoked by uid 22791); 27 Sep 2009 21:55:02 -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; Sun, 27 Sep 2009 21:54:57 +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 n8RLst412807; Sun, 27 Sep 2009 22:54:55 +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 3B9E83FEB; Sun, 27 Sep 2009 22:54:54 +0100 (BST) Message-ID: <4ABFDF2D.6070709@jifvik.org> Date: Sun, 27 Sep 2009 21:55: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-discuss@ecos.sourceware.org References: <44185a820909260058k6f820a1aheb6f37b2e4e868fc@mail.gmail.com> In-Reply-To: <44185a820909260058k6f820a1aheb6f37b2e4e868fc@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-09/txt/msg00253.txt.bz2 wb ning wrote: > Hi, everyone: > I think it's a common question, but i can't find the answer. I > think block read/write of serial port need a overtime, if time exceeds > that, i can made my program don't > wait any longer, if i can't set overtime, maybe i send a command and > wait for response, but when some error occurs and the reponse is lost, > my thread will wait forever. > > Do anyone have find how to send overtime to block read/write? Please help me. By overtime, I assume you mean a timeout. You can use a kernel alarm and from the alarm callback (after the timeout) use the CYG_IO_GET_CONFIG_SERIAL_ABORT config key with cyg_io_get_config(). Look at the eCos documentation for how to use kernel alarms, and cyg_io_get_config(). Alternatively don't forget that with the file I/O package, you can use select() with serial drivers (e.g. if opened as filename "/dev/ser0"). 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