From owner-freebsd-questions@FreeBSD.ORG Tue Aug 5 14:30:12 2003 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7A8C737B404 for ; Tue, 5 Aug 2003 14:30:12 -0700 (PDT) Received: from rwcrmhc13.comcast.net (rwcrmhc13.comcast.net [204.127.198.39]) by mx1.FreeBSD.org (Postfix) with ESMTP id CFF5343FBF for ; Tue, 5 Aug 2003 14:30:11 -0700 (PDT) (envelope-from jshamlet@comcast.net) Received: from [192.168.1.1] (pcp04633217pcs.gambrl01.md.comcast.net[68.49.68.116](untrusted sender)) by comcast.net (rwcrmhc13) with SMTP id <200308052130100150091hbge>; Tue, 5 Aug 2003 21:30:10 +0000 From: "J. Seth Henry" To: freebsd-questions@freebsd.org Content-Type: text/plain Organization: Message-Id: <1060119004.53095.25.camel@alexandria> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.2 Date: 05 Aug 2003 17:30:07 -0400 Content-Transfer-Encoding: 7bit Subject: FreeBSD programming question X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Aug 2003 21:30:12 -0000 Not sure if this is the right list or not, but I could really use some pointers. How can I code trap serial port interrupts in my C program? For example, I want to read values from a serial device every user-specified number of seconds, calculate some stuff and then sit for a while. Should the serial device decide it wants to send some data unsolicited, I would like to enter an interrupt service routine, handle the communication, and then return to the previous loop. I can get the loop going by using sleep(n), but I don't know how to write the ISR in C, and (additionally) make it such that it will run on any *nix like platform. Any pointers, HOWTO's, or examples would be greatly appreciated! Thanks, Seth