Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions pynq/lib/dma.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ def stop(self):
def _clear_interrupt(self):
self._mmio.write(self._offset + 4, 0x1000)

def transfer(self, array, start=0, nbytes=0, cyclic=False):
def transfer(self, array, start=0, nbytes=0, cyclic=False, bd_allocate_target=None):
"""Transfer memory with the DMA

Transfer must only be called when the channel is halted
Expand Down Expand Up @@ -345,7 +345,9 @@ def transfer(self, array, start=0, nbytes=0, cyclic=False):
Number of bytes to transfer. Default is 0.
cyclic : bool
Enable cyclic BD mode. Default is False.

bd_allocate_target : PynqBuffer
The target memory to allocate buffer descriptors. Default is None.
If None, the buffer descriptors are allocated in the active memory.
"""

if not self.halted:
Expand Down Expand Up @@ -377,7 +379,10 @@ def transfer(self, array, start=0, nbytes=0, cyclic=False):

# Zero-Allocate buffer for descriptors: uint32[_num_descr][16]
# Descriptor is only 52 bytes but each one has to be 64-byte aligned!
self._descr = allocate(shape=(self._num_descr, 16), dtype=numpy.uint32)
self._descr = allocate(shape=(self._num_descr, 16), dtype=numpy.uint32, target=bd_allocate_target)

# Fill descriptors with zeros in case of re-use of allocated memory without board reset
self._descr.fill(0)

# Idle DMA engine
self.stop()
Expand Down