ide: rework the code for selecting the best DMA transfer mode (v3)