Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 19 May 2004 09:11:42 +0100
From:      Doug Rabson <dfr@nlsystems.com>
To:        freebsd-firewire@freebsd.org
Subject:   Re: async bug
Message-ID:  <200405190911.42668.dfr@nlsystems.com>
In-Reply-To: <Pine.GSO.4.58.0405181432030.18744@mono.arc.nasa.gov>
References:  <Pine.GSO.4.58.0405181432030.18744@mono.arc.nasa.gov>

next in thread | previous in thread | raw e-mail | index | archive | help
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;
}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200405190911.42668.dfr>