In message: <[EMAIL PROTECTED]>
            Bruce M Simpson <[EMAIL PROTECTED]> writes:
: Many thanks! The only other question I have is - how would I go about
: doing a bus_space_mmap() to be able to copy the attribute memory off
: to a calling process?

I just re-read this, and you could also be asking how to implement a
read function for your device...

In that case, you'd have to do something like the crd driver does.
Since you already have the window picked out, I've removed the pick a
window code.  I'm also assuming that you have only 1 4k window and
that you don't have to move it around.

static  int
crdread(dev_t dev, struct uio *uio, int ioflag)
{
        if (uio->uio_offset > 0x1000)
                return (EIO);
        while (uio->uio_resid && error == 0) {
                offs = (unsigned int)uio->uio_offset & (0x1000 - 1);
                p = rman_get_virtual(am_res) + offs;
                count = MIN(0x1000 - offs, uio->uio_resid);
                error = uiomove(p, count, uio);
        }
        return (error);
}

I don't recall if uiomove does anything to optimize the memory moving,
but if it does, or if your data is non-linear, you'll have to uiomove
it one byte at a time into userland.

Warner

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to