AnsweredAssumed Answered

AD-FMCOMMS1-EBZ  No OS Ref Design - ADC Function : Sample Location

Question asked by DrTom on Feb 20, 2013
Latest reply on Sep 5, 2013 by ACozma

Can anyone explain the macro call "   Xil_Out32((baddr + 0x058), (qwcnt * 8)); // number of bytes" shown below from the test.c file. I assume it is capturing two channels of 14 bit data(each) from the ADC and storing them in DDR3 memory via the DMA. If that is true, why does the code tell the DMA that it is passing "qwcnt*8" bytes instead of "qwcnt*4" bytes?  And how is each channel placed in memory i.e. if it is really writing 64 bits to memory, which bits are channel 1 and which are channel 2?

Thanks...Tom

 

 

 

ref:

void adc_capture(uint32_t sel, uint32_t qwcnt, uint32_t sa)

{ //See

    uint32_t baddr;

    baddr = (sel == IICSEL_B1HPC) ? DMA9643_1_BASEADDR : DMA9643_0_BASEADDR;

 

    Xil_Out32((baddr + 0x030), 0); // clear dma operations

    Xil_Out32((baddr + 0x030), 1); // enable dma operations

    Xil_Out32((baddr + 0x048), sa); // capture start address

    Xil_Out32((baddr + 0x058), (qwcnt * 8)); // number of bytes

 

    baddr = (sel == IICSEL_B1HPC) ? CFAD9643_1_BASEADDR : CFAD9643_0_BASEADDR;

    Xil_Out32((baddr + 0x00c), 0x0); // capture disable

    Xil_Out32((baddr + 0x010), 0xf); // clear status

    Xil_Out32((baddr + 0x014), 0xf); // clear status

    Xil_Out32((baddr + 0x00c), (0x10000 | (qwcnt-1))); // start capture

 

  do

    {

        delay_ms(1);

    }

    while ((Xil_In32(baddr + 0x010) & 0x1) == 1);

 

    if ((Xil_In32(baddr + 0x010) & 0x02) == 0x02)

    {

        xil_printf("adc_capture: overflow occured, data may be corrupted\n\r");

    }

 

#ifdef _XPARAMETERS_PS_H_

    Xil_DCacheFlush();

#else

    microblaze_flush_dcache();

    microblaze_invalidate_dcache();

#endif

}

Outcomes