From owner-freebsd-firewire@FreeBSD.ORG Wed May 19 01:13:20 2004 Return-Path: Delivered-To: freebsd-firewire@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7E09A16A4CE for ; Wed, 19 May 2004 01:13:20 -0700 (PDT) Received: from herring.rabson.org (mailgate.nlsystems.com [80.177.232.242]) by mx1.FreeBSD.org (Postfix) with ESMTP id 897E743D31 for ; Wed, 19 May 2004 01:13:19 -0700 (PDT) (envelope-from dfr@nlsystems.com) Received: from herring.rabson.org (herring.rabson.org [10.0.0.2]) by herring.rabson.org (8.12.11/8.12.11) with ESMTP id i4J8BhsY008862; Wed, 19 May 2004 09:11:43 +0100 (BST) (envelope-from dfr@nlsystems.com) From: Doug Rabson To: freebsd-firewire@freebsd.org Date: Wed, 19 May 2004 09:11:42 +0100 User-Agent: KMail/1.6.1 References: In-Reply-To: MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200405190911.42668.dfr@nlsystems.com> X-Spam-Status: No, hits=0.0 required=5.0 tests=none autolearn=no version=2.63 X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on herring.rabson.org X-Virus-Scanned: ClamAV version 'clamd / ClamAV version 0.65', clamav-milter version '0.60p' Subject: Re: async bug X-BeenThere: freebsd-firewire@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Firewire support in FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 May 2004 08:13:20 -0000 On Tuesday 18 May 2004 22:33, Buzz Slye wrote: > The code for the version of 2004/03/28 does not appear to work > correctly for an asyncronus request of a single register. > > (i.e., try: fwcontrol -b 0) > > R. E. Slye > NASA/Ames The ioctl api is very confusing to use. I had to use the kernel debugger to get my test program that reads quads over the bus to work. The code below should work: uint32_t fw_read_quad(int fd, int node, uint64_t addr) { struct fw_asyreq req; memset(&req, 0, sizeof req); req.req.type = FWASREQNODE; req.req.len = sizeof(req.pkt.mode.rreqq) + 2*sizeof(uint32_t); req.pkt.mode.rreqq.dst = FWLOCALBUS | node; req.pkt.mode.rreqq.tcode = FWTCODE_RREQQ; req.pkt.mode.rreqq.dest_hi = addr >> 32; req.pkt.mode.rreqq.dest_lo = addr; if (ioctl(fd, FW_ASYREQ, &req) < 0) { err(1, "ioctl"); return 0; } return req.pkt.mode.rresq.data; }