forked from M-Labs/artiq
Make syscall an experiment function instead of a core method
This commit is contained in:
parent
9db8627081
commit
79f20ebfcf
|
@ -17,9 +17,9 @@ class DDS:
|
||||||
@kernel
|
@kernel
|
||||||
def pulse(self, frequency, duration):
|
def pulse(self, frequency, duration):
|
||||||
if self._previous_frequency != frequency:
|
if self._previous_frequency != frequency:
|
||||||
self.core.syscall("rtio_sync", self.rtio_channel) # wait until output is off
|
syscall("rtio_sync", self.rtio_channel) # wait until output is off
|
||||||
self.core.syscall("dds_program", self.reg_channel, frequency)
|
syscall("dds_program", self.reg_channel, frequency)
|
||||||
self._previous_frequency = frequency
|
self._previous_frequency = frequency
|
||||||
self.core.syscall("rtio_set", now()-self.latency, self.rtio_channel, 1)
|
syscall("rtio_set", now()-self.latency, self.rtio_channel, 1)
|
||||||
delay(duration)
|
delay(duration)
|
||||||
self.core.syscall("rtio_set", now()-self.latency, self.rtio_channel, 0)
|
syscall("rtio_set", now()-self.latency, self.rtio_channel, 0)
|
||||||
|
|
|
@ -57,9 +57,19 @@ def set_time_manager(time_manager):
|
||||||
global _time_manager
|
global _time_manager
|
||||||
_time_manager = time_manager
|
_time_manager = time_manager
|
||||||
|
|
||||||
|
class _DummySyscallManager:
|
||||||
|
def do(self, *args):
|
||||||
|
raise NotImplementedError("Attempted to interpret kernel without a syscall manager")
|
||||||
|
|
||||||
|
_syscall_manager = _DummySyscallManager()
|
||||||
|
|
||||||
|
def set_syscall_manager(syscall_manager):
|
||||||
|
global _syscall_manager
|
||||||
|
_syscall_manager = syscall_manager
|
||||||
|
|
||||||
# global namespace for kernels
|
# global namespace for kernels
|
||||||
|
|
||||||
kernel_globals = "sequential", "parallel", "delay", "now", "at"
|
kernel_globals = "sequential", "parallel", "delay", "now", "at", "syscall"
|
||||||
|
|
||||||
class _Sequential:
|
class _Sequential:
|
||||||
def __enter__(self):
|
def __enter__(self):
|
||||||
|
@ -85,3 +95,6 @@ def now():
|
||||||
|
|
||||||
def at(time):
|
def at(time):
|
||||||
_time_manager.set_time(time)
|
_time_manager.set_time(time)
|
||||||
|
|
||||||
|
def syscall(*args):
|
||||||
|
return _syscall_manager.do(*args)
|
||||||
|
|
Loading…
Reference in New Issue