diff --git a/src/shared/drivers/dma/DMA.h b/src/shared/drivers/dma/DMA.h index 4234aa34292175643ad4aee7f295c4e3250d4e8b..b1276864a47ca7532704f1c0ac675295f7913b6f 100644 --- a/src/shared/drivers/dma/DMA.h +++ b/src/shared/drivers/dma/DMA.h @@ -24,7 +24,6 @@ #include <kernel/scheduler/scheduler.h> #include <kernel/sync.h> -#include <utils/TimedPollingFlag.h> #include <chrono> #include <functional> @@ -405,13 +404,15 @@ private: // Pool the flag if the user did not enable the interrupt if (timeout_ns >= 0) { - // TODO: this doesn't work, because the methods passed as - // getEventStatus do not update the flags (reading them - // by calling readFlags()). - // This means that it always polls a value that will - // never become true, then exit when the timeout is - // reached. - result = timedPollingFlag(getEventStatus, timeout_ns); + const long long start = miosix::getTime(); + + do + { + readFlags(); + } while (!getEventStatus() && + miosix::getTime() - start < timeout_ns); + + result = getEventStatus(); } else {