The updated MODDMA library worked fine with the following test program
when compiled for Mbed OS 6:
#include "mbed.h"
#include "MODDMA.h"
DigitalOut myled(LED1);
DigitalOut led2(LED2);
MODDMA dma;
int transferState = 0;
void myCallback(void)
{
if (transferState == 0) {
led2 = 1;
transferState = 1;
}
}
int main()
{
printf("Hello World\r\n");
// Create a source buffer we are going to move.
char src[] = "TEST TEST TEST";
// Create a buffer for the destination to copy to.
char dst[sizeof(src)];
// Create a MODDMA configuration object.
MODDMA_Config* config = new MODDMA_Config;
// Setup that configuration
config
->channelNum(MODDMA::Channel_0)
->srcMemAddr((uint32_t) & src)
->dstMemAddr((uint32_t) & dst)
->transferSize(sizeof(src))
->transferType(MODDMA::m2m)
->attach_tc(&myCallback);
// config end
// Pass the configuration to the controller
dma.Setup(config);
// Tell the controller to perform the DMA operation
// defined by that configuration.
dma.Enable(config);
while (1) {
if (transferState == 1) {
transferState = 2;
printf("%s\r\n", dst);
}
myled = 1;
ThisThread::sleep_for(250ms);
myled = 0;
ThisThread::sleep_for(250ms);
}
}