forked from M-Labs/artiq
1
0
Fork 0

ddb: controller support

This commit is contained in:
Sebastien Bourdeauducq 2015-02-05 22:53:31 +08:00
parent 776381a332
commit 2f06574381
2 changed files with 33 additions and 4 deletions

View File

@ -5,6 +5,7 @@ import numpy
import h5py
from artiq.protocols.sync_struct import Notifier
from artiq.protocols.pc_rpc import Client
_type_to_hdf5 = {
@ -72,9 +73,15 @@ class ResultDB:
def _create_device(desc, dbh):
module = importlib.import_module(desc["module"])
device_class = getattr(module, desc["class"])
return device_class(dbh, **desc["arguments"])
ty = desc["type"]
if ty == "local":
module = importlib.import_module(desc["module"])
device_class = getattr(module, desc["class"])
return device_class(dbh, **desc["arguments"])
elif ty == "controller":
return Client(desc["host"], desc["port"], desc["target_name"])
else:
raise ValueError("Unsupported type in device DB: " + ty)
class DBHub:
@ -112,5 +119,7 @@ class DBHub:
"""
for dev in reversed(list(self.active_devices.values())):
if hasattr(dev, "close"):
if isinstance(dev, Client):
dev.close_rpc()
elif hasattr(dev, "close"):
dev.close()

View File

@ -1,65 +1,77 @@
{
"comm": {
"type": "local",
"module": "artiq.coredevice.comm_serial",
"class": "Comm",
"arguments": {}
},
"core": {
"type": "local",
"module": "artiq.coredevice.core",
"class": "Core",
"arguments": {}
},
"led": {
"type": "local",
"module": "artiq.coredevice.gpio",
"class": "GPIOOut",
"arguments": {"channel": 0}
},
"pmt0": {
"type": "local",
"module": "artiq.coredevice.rtio",
"class": "RTIOIn",
"arguments": {"channel": 0}
},
"pmt1": {
"type": "local",
"module": "artiq.coredevice.rtio",
"class": "RTIOIn",
"arguments": {"channel": 1}
},
"ttl0": {
"type": "local",
"module": "artiq.coredevice.rtio",
"class": "RTIOOut",
"arguments": {"channel": 2}
},
"ttl1": {
"type": "local",
"module": "artiq.coredevice.rtio",
"class": "RTIOOut",
"arguments": {"channel": 3}
},
"ttl2": {
"type": "local",
"module": "artiq.coredevice.rtio",
"class": "RTIOOut",
"arguments": {"channel": 4}
},
"dds0": {
"type": "local",
"module": "artiq.coredevice.dds",
"class": "DDS",
"arguments": {"reg_channel": 0, "rtio_switch": 5}
},
"dds1": {
"type": "local",
"module": "artiq.coredevice.dds",
"class": "DDS",
"arguments": {"reg_channel": 1, "rtio_switch": 6}
},
"dds2": {
"type": "local",
"module": "artiq.coredevice.dds",
"class": "DDS",
"arguments": {"reg_channel": 2, "rtio_switch": 7}
},
"electrodes": {
"type": "local",
"module": "artiq.devices.pdq2",
"class": "CompoundPDQ2",
"arguments": {
@ -70,6 +82,14 @@
"comment": "Conflicts with dds2 and ttl0-2"
},
"lda": {
"type": "controller",
"host": "::1",
"port": 3253,
"target_name": "lda",
"command": "lda_controller -p {port} -d sim"
},
"pmt": "pmt0",
"bd": "dds0",
"bdd": "dds1"