oep-client-python 0.0.39__py3-none-any.whl → 0.0.41__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. oep_client/__init__.py +1 -1
  2. oep_client/__main__.py +30 -15
  3. oep_client/acquire.py +1866 -0
  4. oep_client/capture.py +137 -7
  5. oep_client/capture_blocks.py +123 -2
  6. oep_client/conformance.py +19 -2
  7. oep_client/conformance_capture_serial.py +2 -2
  8. oep_client/conformance_capture_timeline.py +1 -1
  9. oep_client/conformance_core_fixed_fields.py +1 -1
  10. oep_client/conformance_core_smoke.py +3 -2
  11. oep_client/conformance_host_core.py +14 -8
  12. oep_client/conformance_host_core_sample.py +7 -5
  13. oep_client/conformance_host_deadline.py +3 -3
  14. oep_client/conformance_host_deadline_sample.py +1 -1
  15. oep_client/conformance_host_request_sample.py +27 -12
  16. oep_client/conformance_host_requests.py +66 -34
  17. oep_client/conformance_host_resend.py +1 -1
  18. oep_client/conformance_host_resend_sample.py +1 -1
  19. oep_client/conformance_host_tlv.py +1 -1
  20. oep_client/conformance_host_wait.py +2 -2
  21. oep_client/conformance_lease.py +1 -1
  22. oep_client/conformance_oep_smoke.py +4 -4
  23. oep_client/conformance_port_speed_execution.py +1 -1
  24. oep_client/conformance_response_race.py +1 -1
  25. oep_client/conformance_writer_lease.py +1 -1
  26. oep_client/discovery.py +1 -1
  27. oep_client/endpoint.py +72 -25
  28. oep_client/fixture.py +389 -3
  29. oep_client/interfaces.py +25 -0
  30. oep_client/link.py +123 -43
  31. oep_client/pins.py +382 -58
  32. oep_client/probe_log.py +97 -0
  33. oep_client/registry.py +21 -1
  34. oep_client/settings.py +36 -7
  35. oep_client/stimulus.py +132 -0
  36. oep_client/targets.py +47 -10
  37. oep_client/virtual_bench.py +165 -13
  38. oep_client/virtual_bench_capture.py +582 -67
  39. oep_client/virtual_bench_serve.py +5 -2
  40. oep_client/virtual_bench_trigger.py +207 -45
  41. oep_client/virtual_core.py +2 -2
  42. oep_client/virtual_fixture_drive.py +404 -0
  43. {oep_client_python-0.0.39.dist-info → oep_client_python-0.0.41.dist-info}/METADATA +48 -32
  44. {oep_client_python-0.0.39.dist-info → oep_client_python-0.0.41.dist-info}/RECORD +47 -43
  45. {oep_client_python-0.0.39.dist-info → oep_client_python-0.0.41.dist-info}/WHEEL +1 -1
  46. {oep_client_python-0.0.39.dist-info → oep_client_python-0.0.41.dist-info}/entry_points.txt +0 -0
  47. {oep_client_python-0.0.39.dist-info → oep_client_python-0.0.41.dist-info}/licenses/LICENSE +0 -0
oep_client/__init__.py CHANGED
@@ -2,4 +2,4 @@
2
2
 
3
3
  __all__ = ["__version__"]
4
4
 
5
- __version__ = "0.0.39"
5
+ __version__ = "0.0.41"
oep_client/__main__.py CHANGED
@@ -1,6 +1,6 @@
1
1
  """The oep command: what a probe offers (dump) and its settings (settings, core §13).
2
2
 
3
- oep dump --port /run/board-identify/by-id/<probe> oep dump --virtual p4-x035 --prefix oep.target --json
3
+ oep dump --port /dev/ttyACM0 oep dump --virtual p4-x035 --prefix oep.target --json
4
4
  oep settings show <probe> (every value, the storage state; lock-free)
5
5
  oep settings items <probe> (what each owner declares: names, forms, choices)
6
6
  oep settings set <probe> core channel.GPIO23.label=v003.nrst channel.GPIO20.idle=pull-up [--save]
@@ -20,8 +20,8 @@
20
20
  host's time - the reading with the shortest round trip of n)
21
21
  oep restart <probe> [--reopen-s S] (oep.probe.restart: the probe restarts; waits until it is back, its new boot_id)
22
22
 
23
- <probe>: a serial port, tcp://HOST[:PORT] (no port: the one DNS-SD finds), tcp:UNIT_ID (found by DNS-SD) or
24
- usb[:VID:PID[:SERIAL]]. A change takes the lock (owner "oep settings") and
23
+ <probe>: an OEP address, oep://UNIT_ID[?via=usb|bulk|hid|cdc|net|tcp:HOST:PORT|tty:PATH] (host guide §5.3), or, for a
24
+ probe whose unit_id is not known, a serial port, tcp://HOST[:PORT] (no port: the one DNS-SD finds) or usb (the only one). A change takes the lock (owner "oep settings") and
25
25
  ends the session after it; it takes effect at once, and stays over a restart only after `save` (or --save).
26
26
  """
27
27
 
@@ -47,7 +47,7 @@ def _open_host(target: str, **kw):
47
47
  return link.open_host(target, **kw)
48
48
  except (OSError, ValueError, ImportError, host.OepError) as e:
49
49
  why = " ".join(str(e).split()).rstrip(".") or type(e).__name__
50
- hint = f" Hint: {USB_HINT}." if isinstance(e, FileNotFoundError) and (target == "usb" or target.startswith("usb:")) \
50
+ hint = f" Hint: {USB_HINT}." if isinstance(e, FileNotFoundError) and (target == "usb" or target.lower().startswith("oep://")) \
51
51
  else ""
52
52
  raise SystemExit(f"oep: cannot open {target}: {why}.{hint}") from None
53
53
 
@@ -81,7 +81,7 @@ def main(argv=None) -> int:
81
81
  sp.add_argument("--baud", type=int, default=link.BASE_BAUD, help="the boot speed (default 115200)")
82
82
  sp.add_argument("--json", action="store_true")
83
83
  lt = sub.add_parser("linktest", help="measure the link: traffic patterns at rates the host asks for, what breaks")
84
- lt.add_argument("probe", help="a probe: a serial port, tcp://HOST:PORT or usb[:VID:PID]")
84
+ lt.add_argument("probe", help="a probe: oep://UNIT_ID[?via=...], a serial port, tcp://HOST:PORT or usb")
85
85
  lt.add_argument("--rates", default="", help="comma-separated rates to switch to with port_speed and measure at "
86
86
  "(each on its own; 0 or 'now' = the speed in force). Default: only the speed in force")
87
87
  lt.add_argument("--patterns", default="in,out,duplex", help="in (probe->host), out (host->probe), duplex")
@@ -96,23 +96,31 @@ def main(argv=None) -> int:
96
96
  lt.add_argument("--json", action="store_true", help="one JSON object per cell")
97
97
  pn = sub.add_parser("pins", help="find where a target is wired: classify the channels, scan the wire, find the "
98
98
  "reset line, suggest labels (writes nothing without --save)")
99
- pn.add_argument("probe", help="a probe: a serial port, tcp://HOST:PORT or usb[:VID:PID[:SERIAL]]")
99
+ pn.add_argument("probe", help="a probe: oep://UNIT_ID[?via=...], a serial port, tcp://HOST:PORT or usb")
100
100
  pn.add_argument("--power", type=int, help="the gpio channel that powers the target: switched off, then on, to "
101
101
  "see which channels follow it (never touched without this)")
102
102
  pn.add_argument("--exclude", default="", help="channels never to read, scan or hold, comma-separated")
103
103
  pn.add_argument("--wire", choices=("swio", "rvswd", "swd"), default="swio")
104
- pn.add_argument("--steps", default="classify,hold,scan,identify,reset,labels",
105
- help="the steps to run, comma-separated (default all: classify, hold, scan, identify, reset, labels)")
104
+ pn.add_argument("--pairs", default="",
105
+ help="the pairs to scan instead of what classify allows: SWDIO:SWCLK,... (swio: SWIO,...); the host's "
106
+ "word - no reading decides")
107
+ pn.add_argument("--steps", default="classify,hold,scan,identify,map,reset,labels",
108
+ help="the steps to run, comma-separated (default all: classify, hold, scan, identify, map, reset, "
109
+ "labels)")
110
+ pn.add_argument("--budget", type=float, default=55.0, help="seconds the whole run may take (default 55); a wider "
111
+ "scan wants more (pairs go the nearest first: about 0.1 s each over rvswd)")
112
+ pn.add_argument("--all-pairs", action="store_true", help="scan every pair, not only up to the first that answers "
113
+ "(a second target shows; needs the time)")
106
114
  pn.add_argument("--save", action="store_true", help="write the suggested labels (settings set, then save)")
107
- pn.add_argument("--name", help="the host's connection profile name: labels <name>.nrst / <name>.power_hi (a probe "
108
- "serving several targets; default: nrst / power_hi)")
115
+ pn.add_argument("--name", help="the host's connection profile name: labels <name>.swdio / <name>.swclk (or "
116
+ "<name>.swio), <name>.nrst, <name>.power_hi; the probe is then opened as oep://<unit_id>/<name>")
109
117
  pn.add_argument("--json", action="store_true", help="the report as JSON (the steps' lines go to stderr)")
110
118
  ck = sub.add_parser("clock", help="the probe's clock (fn 0 clock, core §7.6) against this host's: lock-free")
111
- ck.add_argument("probe", help="a probe: a serial port, tcp://HOST:PORT or usb[:VID:PID[:SERIAL]]")
119
+ ck.add_argument("probe", help="a probe: oep://UNIT_ID[?via=...], a serial port, tcp://HOST:PORT or usb")
112
120
  ck.add_argument("-n", type=int, default=8, help="readings; the one with the shortest round trip is kept (default 8)")
113
121
  ck.add_argument("--json", action="store_true")
114
122
  rs = sub.add_parser("restart", help="restart the probe (oep.probe.restart, optional) and wait until it is back")
115
- rs.add_argument("probe", help="a probe: a serial port, tcp://HOST:PORT or usb[:VID:PID[:SERIAL]]")
123
+ rs.add_argument("probe", help="a probe: oep://UNIT_ID[?via=...], a serial port, tcp://HOST:PORT or usb")
116
124
  rs.add_argument("--force", action="store_true", help="take the lock from its holder")
117
125
  rs.add_argument("--reopen-s", type=float, default=0.0, metavar="S",
118
126
  help="when the probe is not back within its restart_max_ms, open it again for up to S more seconds "
@@ -130,7 +138,7 @@ def main(argv=None) -> int:
130
138
  d = sub.add_parser("dump", help="list and describe every interface a probe offers")
131
139
  src = d.add_mutually_exclusive_group(required=True)
132
140
  src.add_argument("--virtual", choices=sorted(virtual_bench.PROFILES), help="an in-process virtual bench (no hardware)")
133
- src.add_argument("--port", help="a probe: a serial port, tcp://HOST:PORT or usb[:VID:PID] (lock-free reads only)")
141
+ src.add_argument("--port", help="a probe: oep://UNIT_ID[?via=...], a serial port, tcp://HOST:PORT or usb (lock-free reads only)")
134
142
  d.add_argument("--prefix", default="", help="only names under this namespace (label boundaries)")
135
143
  d.add_argument("--exact", action="store_true", help="the prefix is a whole name")
136
144
  d.add_argument("--json", action="store_true", help="machine-readable output")
@@ -238,8 +246,15 @@ def _pins_cmd(args) -> int:
238
246
  hst = _open_host(args.probe)
239
247
  try:
240
248
  core.take(hst, 10000, owner="oep pins")
249
+ pairs = None
250
+ if args.pairs:
251
+ pairs = []
252
+ for item in args.pairs.replace(" ", "").split(","):
253
+ dio, _, clk = item.partition(":")
254
+ pairs.append((int(dio, 0), int(clk, 0) if clk else 0xFFFF))
241
255
  finder = pins.PinFinder(hst, wire=args.wire, power=args.power, exclude=exclude, say=say, probe=args.probe,
242
- save=args.save, name=args.name)
256
+ save=args.save, name=args.name, pairs=pairs, budget_s=args.budget,
257
+ all_pairs=args.all_pairs)
243
258
  report = finder.run(steps=tuple(s for s in args.steps.split(",") if s))
244
259
  say(f"done in {report.elapsed_s:.1f} s")
245
260
  if args.json:
@@ -253,7 +268,7 @@ def _pins_cmd(args) -> int:
253
268
  return 2
254
269
  finally:
255
270
  hst.link.close()
256
- return 0 if report.resolution == 'unique-candidate' else 1
271
+ return 0 if report.resolution in ('unique-candidate', 'unique-in-partial') else 1 # one target found
257
272
 
258
273
 
259
274
  # ---- oep linktest -------------------------------------------------------------------------------------------------