Commit 25437c09 authored by Rene Stange's avatar Rene Stange Committed by Peter Maydell
Browse files

bcm2835_dma: Re-initialize xlen in TD mode



TD (two dimensions) DMA mode did not work, because the xlen variable
has not been re-initialized before each additional ylen run through
in bcm2835_dma_update(). Fix it.

Signed-off-by: default avatarRene Stange <rsta2@o2online.de>
Reviewed-by: default avatarPhilippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
parent eb87ff05
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -54,7 +54,7 @@
static void bcm2835_dma_update(BCM2835DMAState *s, unsigned c)
{
    BCM2835DMAChan *ch = &s->chan[c];
    uint32_t data, xlen, ylen;
    uint32_t data, xlen, xlen_td, ylen;
    int16_t dst_stride, src_stride;

    if (!(s->enable & (1 << c))) {
@@ -82,6 +82,7 @@ static void bcm2835_dma_update(BCM2835DMAState *s, unsigned c)
            dst_stride = 0;
            src_stride = 0;
        }
        xlen_td = xlen;

        while (ylen != 0) {
            /* Normal transfer mode */
@@ -117,6 +118,7 @@ static void bcm2835_dma_update(BCM2835DMAState *s, unsigned c)
            if (--ylen != 0) {
                ch->source_ad += src_stride;
                ch->dest_ad += dst_stride;
                xlen = xlen_td;
            }
        }
        ch->cs |= BCM2708_DMA_END;