2020-07-21 16:57:14 +08:00
|
|
|
from artiq.experiment import *
|
|
|
|
|
|
|
|
class DMAPulses(EnvExperiment):
|
|
|
|
def build(self):
|
|
|
|
self.setattr_device("core")
|
|
|
|
self.setattr_device("core_dma")
|
|
|
|
self.setattr_device("led0")
|
|
|
|
|
|
|
|
@kernel
|
|
|
|
def record(self):
|
2020-07-30 22:25:14 +08:00
|
|
|
with self.core_dma.record("pulse"):
|
|
|
|
delay(200*ms)
|
|
|
|
# all RTIO operations now go to the "pulse"
|
2020-07-21 16:57:14 +08:00
|
|
|
# DMA buffer, instead of being executed immediately.
|
2020-07-30 22:25:14 +08:00
|
|
|
self.led0.pulse(500*ms)
|
|
|
|
|
2020-07-21 16:57:14 +08:00
|
|
|
|
|
|
|
@kernel
|
|
|
|
def run(self):
|
|
|
|
self.core.reset()
|
|
|
|
self.record()
|
|
|
|
# prefetch the address of the DMA buffer
|
|
|
|
# for faster playback trigger
|
2020-07-30 22:25:14 +08:00
|
|
|
pulse_handle = self.core_dma.get_handle("pulse")
|
2020-07-21 16:57:14 +08:00
|
|
|
self.core.break_realtime()
|
2020-07-30 22:25:14 +08:00
|
|
|
self.core_dma.playback_handle(pulse_handle)
|