AnsweredAssumed Answered

BF548 DMA Example problem

Question asked by BFProgrammer on Oct 5, 2010
Latest reply on Nov 18, 2010 by PrasanthR

Hi BF programmers!

 

     I took the Example from "DSP-BF54x Blackfin Processor Hardware Reference" named:

"Register-Based 2D Memory DMA" and ran it. It worked OK, as explained in ADI manual. This example is written

in Assembler, so I translate it to C as follows in DMA Example 1.

The problem is that the C version does not work. I compared the registers values

between the original Assembler Version and C version in debugger while running, and there is no difference.

So, what's the problem?

 

Peter.

 

 

DMA Example 1 (C language)

===============================================================================

#define X 5
#define Y 6

section("L1_data_a") volatile unsigned char aSource[X*Y] =
{
        1, 7,  13, 19, 25,
        2, 8,  14, 20, 26,
        3, 9,  15, 21, 27,
        4, 10, 16, 22, 28,
        5, 11, 17, 23, 29,
        6, 12, 18, 24, 30
};

section("L1_data_b") volatile unsigned char  aDestination[X*Y];

 

int main( void )
{

 

     memset((void *)aDestination, 0, sizeof(aDestination));

 

    // Setup 1D source DMA for 16-bit transfers
     *(pMDMA_S0_START_ADDR) = (unsigned short*)aSource;
     *(pMDMA_S0_X_MODIFY)   = 2;
     *(pMDMA_S0_X_COUNT)    = X*Y;
     *(pMDMA_S0_CONFIG)     = (*(pMDMA_S0_CONFIG)) | WDSIZE_16 | DMAEN;

     // setup 2D destination DMA for 16-bit transfers
     *(pMDMA_D0_START_ADDR) = (unsigned short*)aDestination;
     *(pMDMA_D0_X_MODIFY)   = 2*Y;
     *(pMDMA_D0_Y_COUNT)    = Y;
     *(pMDMA_D0_X_COUNT)    = X;
     *(pMDMA_D0_Y_MODIFY)   = -2 * (Y * (X-1) - 1);
     *(pMDMA_D0_CONFIG)     = *(pMDMA_D0_CONFIG) | DMA2D | DI_EN | WDSIZE_16 | WNR | DMAEN;

     // Polling DMA Status
    READ_DMA_STATUS_LABEL0:
     nDMAStatus = *(pMDMA_D0_IRQ_STATUS);
     if ( nDMAStatus == 0)
         goto READ_DMA_STATUS_LABEL0;
    
     *(pMDMA_D0_IRQ_STATUS) = DMA_DONE;

 

}

 

Outcomes