Use mutual exclusion to access DMA engine

Fixes #1