A QDMA Example

Top  Previous  Next

// This example is intended to give a flavour of how to

// use QDMA. It does not attempt to do any error

// detection.

// A complete example is in the installation package.

 

#include <QDMA.h>

#define SIZE 1024

typedef struct {

   float real;

   float imag;

} COMPLEX;

 

// Build a complex structure from two arrays of float

// The values in the arrays Real and Imag are

// interlaced into the array C.

 

void Combine(float *Real, float *Imag, COMPLEX *C) {

   SC6xQDMA *QdmaI = QDMA_Interface();

   QDMA_REGS R;

   QDMA_REGS *Q = QDMA_REGISTERS;

   QDMA_Claim(QdmaI, 15, QDMA_INTERRUPT); // use TCC 15

 

   // move in the real parts

   R.Src = Real;

   R.Dst = &C->real;

   R.Cnt = (SIZE<<16) | 4// size * 4 bytes

   R.Idx = 8;              // every other word

   R.Opt = EDMA_SUM(1)

         | EDMA_DUM(3)

         | EDMA_PRI(1);

   QDMA_Perform(QdmaI, &R);

 

   // move in the imaginary parts

   Q->Src = Imag;

   QDMA_Restart(QDmaI, Q->Dst, &C->Imag);

 

   QDMA_Release(QdmaI);   // done

}