ADSP-21569 Register based MDMA cannot work well

Hi,

I'm testing register-based MDMA for Griffin-UL..

I'm using the attached source code, but it does not work well.

I think there is no problem with register settings.

#include <stdio.h>
#include <sys/platform.h>
#include "adi_initialize.h"
#include "ex_mdma_reg_1.h"
#include <services/int/adi_int.h>

/** 
 * If you want to use command program arguments, then place them in the following string. 
 */
char __argv_string[] = "";

#define BUF_SIZE 16

// align on 32byte boundary.
#pragma section("seg_l1_block1")
_Pragma("align 4") static uint32_t buf_src[BUF_SIZE] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};

#pragma section("seg_l1_block2")
_Pragma("align 4") static uint32_t buf_dst[BUF_SIZE];

int flag_MDMA_done = 0;	// 1: done.

void MDMA_ISR_Handler(void)
{
   while (!(*pREG_DMA9_STAT & ENUM_DMA_STAT_IRQDONE));// Check DMA Status IRQDONE bit.
   *pREG_DMA9_STAT = ENUM_DMA_STAT_IRQDONE ;// Clear IRQDONE bit
   flag_MDMA_done = 1;
}

int main(int argc, char *argv[])
{
	/**
	 * Initialize managed drivers and/or services that have been added to 
	 * the project.
	 * @return zero on success 
	 */
	adi_initComponents();
	
	/* Begin adding your custom code here */
	adi_int_InstallHandler(  INTR_MDMA0_DST,
			(ADI_INT_HANDLER_PTR)MDMA_ISR_Handler,
			(void*)0,
			true );

	// MDMA Source setting . DMA8 as MDMA0_SRC
	*pREG_DMA8_CFG       = ENUM_DMA_CFG_ADDR1D | ENUM_DMA_CFG_NO_INT | ENUM_DMA_CFG_STOP
			| ENUM_DMA_CFG_MSIZE04 | ENUM_DMA_CFG_PSIZE04 | ENUM_DMA_CFG_READ | ENUM_DMA_CFG_SYNC;
	*pREG_DMA8_ADDRSTART = buf_src;
	*pREG_DMA8_XCNT      = BUF_SIZE;
	*pREG_DMA8_XMOD      = sizeof(buf_src[0]);
	*pREG_DMA8_YCNT      = 0;
	*pREG_DMA8_YMOD      = 0;

	// Clear
	*pREG_DMA8_STAT = ENUM_DMA_STAT_IRQERR;

	// MDMA Destination setting . DMA9 as MDMA0_DST
	*pREG_DMA9_CFG       = ENUM_DMA_CFG_ADDR1D | ENUM_DMA_CFG_XCNT_INT | ENUM_DMA_CFG_STOP
			| ENUM_DMA_CFG_MSIZE04 | ENUM_DMA_CFG_PSIZE04 | ENUM_DMA_CFG_WRITE | ENUM_DMA_CFG_SYNC;
	*pREG_DMA9_ADDRSTART = buf_dst;
	*pREG_DMA9_XCNT      = BUF_SIZE;
	*pREG_DMA9_XMOD      = sizeof(buf_dst[0]);
	*pREG_DMA9_YCNT      = 0;
	*pREG_DMA9_YMOD      = 0;

	// MDMA Source & Destination Enable .
	*pREG_DMA8_CFG |= ENUM_DMA_CFG_EN ;
	*pREG_DMA9_CFG |= ENUM_DMA_CFG_EN ;

	// MDMA Source & Destination Disable .
	while(!flag_MDMA_done);
	*pREG_DMA8_CFG ^= ENUM_DMA_CFG_EN ;
	*pREG_DMA9_CFG ^= ENUM_DMA_CFG_EN ;

	// Compare Source & Destination buffers .
	int i, flag = 0;
	for ( i = 0 ; i< BUF_SIZE ; i++){
		if ( buf_src[i] != buf_dst[i] ){
			flag = 1;// False !
		}
	}

	// Done .
	if ( flag ){
		printf("Failed!\n");
	} else {
		printf("Succeeded!\n");
	}
	while(1);

}

Can you let me know what is wrong ?

Thanks and Regards,

T.Tanaka

  • 0
    •  Analog Employees 
    on Feb 18, 2021 5:38 AM

    Hi Tanaka,

    Apologies for delayed response. Were you able to get going? Please let me know if you are still facing issue.

    Please check the MDMA code available in the below mentioned BSP path.
    [Installation path]:\Analog Devices\ADSP-2156x_EZ-KIT-Rel1.0.0\ADSP-2156x_EZ-KIT\Examples\services\mdma

    Regards,
    Anand Selvaraj.