#include #include #include #include #include #include #include "otc.h" using namespace DMA; constexpr uint32_t DMA_OTC_CTRL = DMA::CH_CONTROL_ADDR + 0x10 * (int)Channel::OTC; // Check DMA6 OTC with standard parameters // DMA should create a reverse linked list where nth item points to n-1 item // and item 0 is terminated with 0xffffff void testOtcStandard() { volatile uint32_t buf[4] = { 0x11111111, 0x22222222, 0x33333333, 0x44444444 }; auto control = CHCR::OTC(); setupDmaOtc((uint32_t)&buf[3], 4, control); TEST_MULTIPLE_BEGIN(); assertEquals(buf[3], ((uint32_t)&buf[2]) & 0xffffff); assertEquals(buf[2], ((uint32_t)&buf[1]) & 0xffffff); assertEquals(buf[1], ((uint32_t)&buf[0]) & 0xffffff); assertEquals(buf[0], 0xffffff); TEST_MULTIPLE_END(); } // Check Transfer with size == 0 void testOtcBigTransfer() { const int SIZE = 64 * 1024; uint32_t* buf = (uint32_t*)malloc(sizeof(uint32_t) * SIZE); for (int i = 0; i