correct use of bus_dmamap_sync

From: Dinesh Nair (dinesh_at_alphaque.com)
Date: 10/25/05

  • Next message: Dinesh Nair: "Re: correct use of bus_dmamap_sync"
    Date: Tue, 25 Oct 2005 21:15:47 +0800
    To: freebsd-hackers@freebsd.org
    
    

    i came across this message
    http://lists.freebsd.org/pipermail/freebsd-current/2004-December/044395.html

    and while it explains the use of bus_dmamap_sync, i'm still a little
    confused on it's usage. i'm trying to port over a driver from freebsd 5.x
    to freebsd 4.x, and it uses dma mapped addresses extensively.

    i've been trying to figure out the best places to use bus_dmamap_sync when
    reading/writing to a dma mapped address space. however, i cant seem to get
    the gist of this, either from the mailing list discussions or the man page.

    i've got two buffers, one for read, and one for write. both have been set
    up with calls to bus_dma_tag_create, bus_dmamem_alloc and bus_dmamap_load.

    the buffers, which are used in the calls to bus_dmamem_alloc and
    bus_dmamap_load are,

    int *readbuf;
    int *writebuf;

    (must i malloc space for them before passing them into those functions, or
    will the call to bus_dmamem_alloc do it for me ?)

    also, i'm on FreeBSD 4.11 right now, and i notice the definitions of
    BUS_DMASYNC_* has changed from an enum (0-3) in 4.x to a typedef in 5.x in
    machine/bus_dma.h

    the pseudo code for the read and write, called during an interrupt cycle, are:

    rx_func()
    {
            POSITION A

            while(there_is_some_data) {
                    memcpy(somebuf, readbuf)
            }
            POSITION B
    }

    tx_func()
    {
            POSITION C

            while(there_is_some_data) {
                    memcpy(writebuf, somebuf)
            }
            POSITION D
    }

    the question is, what op should i use for bus_dmamap_sync in positions A,
    B, C and D ?

    any assistance would be gladly appreciated, as i'm seeing some really weird
    symptoms on this device, where data written out is being immediately read
    in. i'm guessing this has to do with my wrong usage of bus_dmamap_sync().

    -- 
    Regards,                           /\_/\   "All dogs go to heaven."
    dinesh@alphaque.com                (0 0)    http://www.alphaque.com/
    +==========================----oOO--(_)--OOo----==========================+
    | for a in past present future; do                                        |
    |   for b in clients employers associates relatives neighbours pets; do   |
    |   echo "The opinions here in no way reflect the opinions of my $a $b."  |
    | done; done                                                              |
    +=========================================================================+
    -- 
    Regards,                           /\_/\   "All dogs go to heaven."
    dinesh@alphaque.com                (0 0)    http://www.alphaque.com/
    +==========================----oOO--(_)--OOo----==========================+
    | for a in past present future; do                                        |
    |   for b in clients employers associates relatives neighbours pets; do   |
    |   echo "The opinions here in no way reflect the opinions of my $a $b."  |
    | done; done                                                              |
    +=========================================================================+
    -- 
    Regards,                           /\_/\   "All dogs go to heaven."
    dinesh@alphaque.com                (0 0)    http://www.alphaque.com/
    +==========================----oOO--(_)--OOo----==========================+
    | for a in past present future; do                                        |
    |   for b in clients employers associates relatives neighbours pets; do   |
    |   echo "The opinions here in no way reflect the opinions of my $a $b."  |
    | done; done                                                              |
    +=========================================================================+
    _______________________________________________
    freebsd-hackers@freebsd.org mailing list
    http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
    To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"
    

  • Next message: Dinesh Nair: "Re: correct use of bus_dmamap_sync"

    Relevant Pages

    • Re: correct use of bus_dmamap_sync
      ... but that doesn't exist on freebsd 4.x. ... | for b in clients employers associates relatives neighbours pets; ... To unsubscribe, ...
      (freebsd-hackers)
    • Re: [9fans] Capitalization in man pages.
      ... But the unwritten style guide for BSD man pages ... I just looked at Rob's example, qsort, on my FreeBSD ... I think FreeBSD generally follows the traditional UNIX usage in this ...
      (comp.os.plan9)
    • Re: Using brandelf
      ... what that usage does. ... If you're attempting to rebrand the linux flash exec (I assume 9 since ... FreeBSD since it uses some linux specific stuff... ... Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org ...
      (freebsd-questions)
    • Re: FreeBSD vs Linux
      ... On Tuesday 17 January 2006 18:42, Mehmet Fatih AKBULUT wrote: ... > used as a server. ... not much suitable for PC usage. ... I have run FreeBSD on a laptop since 3.4 ...
      (freebsd-questions)
    • Re: Heap Memory
      ... On 11/16/06, Thinker wrote: ... In FreeBSD, ... to print out usage of the ... Is there a simliar method for it? ...
      (comp.lang.python)