Add DSLogic capture, signal conversion and DSView decoders
This commit is contained in:
29
tools/dsview/native/gate_summary.h
Normal file
29
tools/dsview/native/gate_summary.h
Normal file
@@ -0,0 +1,29 @@
|
||||
#pragma once
|
||||
#include <atomic>
|
||||
#include <cstdint>
|
||||
|
||||
// Annotation IDs are the public gate_driver_timing decoder contract.
|
||||
// Independent of row visibility and text search; one summary per decode run.
|
||||
class GateSummary {
|
||||
public:
|
||||
void reset() {
|
||||
controls = 0; acknowledgments = 0; warnings = 0; faults = 0;
|
||||
}
|
||||
void observe(int annotation) {
|
||||
switch (annotation) {
|
||||
case 0: ++controls; break;
|
||||
case 2: ++acknowledgments; break;
|
||||
case 3: ++warnings; break;
|
||||
case 4: case 5: ++faults; break;
|
||||
}
|
||||
}
|
||||
// 0 = OK, 1 = WARNING / incomplete, 2 = FAULT.
|
||||
int severity(bool complete) const {
|
||||
if (faults.load()) return 2;
|
||||
if (!complete || warnings.load() || !acknowledgments.load() ||
|
||||
controls.load() != acknowledgments.load()) return 1;
|
||||
return 0;
|
||||
}
|
||||
private:
|
||||
std::atomic<uint64_t> controls{0}, acknowledgments{0}, warnings{0}, faults{0};
|
||||
};
|
||||
Reference in New Issue
Block a user