Skip to content

Commit

Permalink
getDaqInfo(): retrieval of event list information can be skipped
Browse files Browse the repository at this point in the history
  • Loading branch information
christoph2 committed Feb 3, 2025
1 parent 96500d1 commit b7361f1
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 42 deletions.
2 changes: 1 addition & 1 deletion pyxcp/daq_stim/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def __init__(self, daq_lists: List[DaqList]):
def setup(self, start_datetime: Optional[CurrentDatetime] = None, write_multiple: bool = True):
if not self.xcp_master.slaveProperties.supportsDaq:
raise RuntimeError("DAQ functionality is not supported.")
self.daq_info = self.xcp_master.getDaqInfo()
self.daq_info = self.xcp_master.getDaqInfo(include_event_lists=False)
if start_datetime is None:
start_datetime = CurrentDatetime(time_ns())
self.start_datetime = start_datetime
Expand Down
4 changes: 3 additions & 1 deletion pyxcp/daq_stim/stim_wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ using namespace py::literals;

PYBIND11_MODULE(stim, m) {
py::class_<DaqEventInfo>(m, "DaqEventInfo")
.def(py::init<const std::string&, std::int8_t, std::size_t, std::size_t, std::size_t, std::string_view, bool, bool, bool>()
.def(py::init<const std::string&, std::int8_t, std::size_t, std::size_t, std::size_t, std::string_view, bool, bool, bool>(),
"name"_a, "type_code"_a, "cycle"_a, "max_daq_lists"_a, "priority"_a, "consistency"_a, "daq_supported"_a,
"stim_supported"_a, "packed_supported"_a
);

py::class_<Stim>(m, "Stim")
Expand Down
81 changes: 41 additions & 40 deletions pyxcp/master/master.py
Original file line number Diff line number Diff line change
Expand Up @@ -1670,7 +1670,7 @@ def verify(self, addr, length):
self.logger.debug(f"Our checksum : 0x{cc:08X}")
return cs.checksum == cc

def getDaqInfo(self):
def getDaqInfo(self, include_event_lists=True):
"""Get DAQ information: processor, resolution, events."""
result = {}
dpi = self.getDaqProcessorInfo()
Expand Down Expand Up @@ -1711,45 +1711,46 @@ def getDaqInfo(self):
result["resolution"] = resolutionInfo
channels = []
daq_events = []
for ecn in range(dpi.maxEventChannel):
eci = self.getDaqEventInfo(ecn)
cycle = eci["eventChannelTimeCycle"]
maxDaqList = eci["maxDaqList"]
priority = eci["eventChannelPriority"]
time_unit = eci["eventChannelTimeUnit"]
consistency = eci["daqEventProperties"]["consistency"]
daq_supported = eci["daqEventProperties"]["daq"]
stim_supported = eci["daqEventProperties"]["stim"]
packed_supported = eci["daqEventProperties"]["packed"]
name = self.fetch(eci.eventChannelNameLength)
if name:
name = decode_bytes(name)
channel = {
"name": name,
"priority": eci["eventChannelPriority"],
"unit": eci["eventChannelTimeUnit"],
"cycle": eci["eventChannelTimeCycle"],
"maxDaqList": eci["maxDaqList"],
"properties": {
"consistency": consistency,
"daq": daq_supported,
"stim": stim_supported,
"packed": packed_supported,
},
}
daq_event_info = DaqEventInfo(
name,
types.EVENT_CHANNEL_TIME_UNIT_TO_EXP[time_unit],
cycle,
maxDaqList,
priority,
consistency,
daq_supported,
stim_supported,
packed_supported,
)
daq_events.append(daq_event_info)
channels.append(channel)
if include_event_lists:
for ecn in range(dpi.maxEventChannel):
eci = self.getDaqEventInfo(ecn)
cycle = eci["eventChannelTimeCycle"]
maxDaqList = eci["maxDaqList"]
priority = eci["eventChannelPriority"]
time_unit = eci["eventChannelTimeUnit"]
consistency = eci["daqEventProperties"]["consistency"]
daq_supported = eci["daqEventProperties"]["daq"]
stim_supported = eci["daqEventProperties"]["stim"]
packed_supported = eci["daqEventProperties"]["packed"]
name = self.fetch(eci.eventChannelNameLength)
if name:
name = decode_bytes(name)
channel = {
"name": name,
"priority": eci["eventChannelPriority"],
"unit": eci["eventChannelTimeUnit"],
"cycle": eci["eventChannelTimeCycle"],
"maxDaqList": eci["maxDaqList"],
"properties": {
"consistency": consistency,
"daq": daq_supported,
"stim": stim_supported,
"packed": packed_supported,
},
}
daq_event_info = DaqEventInfo(
name,
types.EVENT_CHANNEL_TIME_UNIT_TO_EXP[time_unit],
cycle,
maxDaqList,
priority,
consistency,
daq_supported,
stim_supported,
packed_supported,
)
daq_events.append(daq_event_info)
channels.append(channel)
result["channels"] = channels
self.stim.setDaqEventInfo(daq_events)
return result
Expand Down

0 comments on commit b7361f1

Please sign in to comment.