oep-client-python 0.0.7__tar.gz → 0.0.9__tar.gz
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.
- {oep_client_python-0.0.7 → oep_client_python-0.0.9}/CHANGELOG.md +10 -0
- {oep_client_python-0.0.7 → oep_client_python-0.0.9}/PKG-INFO +12 -4
- {oep_client_python-0.0.7 → oep_client_python-0.0.9}/README.ja.md +10 -3
- {oep_client_python-0.0.7 → oep_client_python-0.0.9}/README.md +11 -3
- {oep_client_python-0.0.7 → oep_client_python-0.0.9}/pyproject.toml +1 -1
- {oep_client_python-0.0.7 → oep_client_python-0.0.9}/src/oep_client/__init__.py +1 -1
- {oep_client_python-0.0.7 → oep_client_python-0.0.9}/src/oep_client/endpoint.py +176 -19
- {oep_client_python-0.0.7 → oep_client_python-0.0.9}/src/oep_client/fake.py +45 -5
- oep_client_python-0.0.9/src/oep_client/fake_capture.py +267 -0
- {oep_client_python-0.0.7 → oep_client_python-0.0.9}/src/oep_client/fake_serial.py +2 -0
- {oep_client_python-0.0.7 → oep_client_python-0.0.9}/src/oep_client/fake_serve.py +8 -1
- {oep_client_python-0.0.7 → oep_client_python-0.0.9}/src/oep_client/registry.py +4 -4
- {oep_client_python-0.0.7 → oep_client_python-0.0.9}/src/oep_client/riscv.py +20 -7
- oep_client_python-0.0.9/tests/test_fake_capture.py +182 -0
- {oep_client_python-0.0.7 → oep_client_python-0.0.9}/tests/test_fake_spec.py +44 -0
- {oep_client_python-0.0.7 → oep_client_python-0.0.9}/.gitignore +0 -0
- {oep_client_python-0.0.7 → oep_client_python-0.0.9}/LICENSE +0 -0
- {oep_client_python-0.0.7 → oep_client_python-0.0.9}/src/oep_client/__main__.py +0 -0
- {oep_client_python-0.0.7 → oep_client_python-0.0.9}/src/oep_client/arm.py +0 -0
- {oep_client_python-0.0.7 → oep_client_python-0.0.9}/src/oep_client/capture.py +0 -0
- {oep_client_python-0.0.7 → oep_client_python-0.0.9}/src/oep_client/catalog.py +0 -0
- {oep_client_python-0.0.7 → oep_client_python-0.0.9}/src/oep_client/ch32_flash.py +0 -0
- {oep_client_python-0.0.7 → oep_client_python-0.0.9}/src/oep_client/cobs.py +0 -0
- {oep_client_python-0.0.7 → oep_client_python-0.0.9}/src/oep_client/config.py +0 -0
- {oep_client_python-0.0.7 → oep_client_python-0.0.9}/src/oep_client/console.py +0 -0
- {oep_client_python-0.0.7 → oep_client_python-0.0.9}/src/oep_client/core.py +0 -0
- {oep_client_python-0.0.7 → oep_client_python-0.0.9}/src/oep_client/decode.py +0 -0
- {oep_client_python-0.0.7 → oep_client_python-0.0.9}/src/oep_client/dump.py +0 -0
- {oep_client_python-0.0.7 → oep_client_python-0.0.9}/src/oep_client/esp32_targets.py +0 -0
- {oep_client_python-0.0.7 → oep_client_python-0.0.9}/src/oep_client/fixture.py +0 -0
- {oep_client_python-0.0.7 → oep_client_python-0.0.9}/src/oep_client/frames.py +0 -0
- {oep_client_python-0.0.7 → oep_client_python-0.0.9}/src/oep_client/hid_stream.py +0 -0
- {oep_client_python-0.0.7 → oep_client_python-0.0.9}/src/oep_client/host.py +0 -0
- {oep_client_python-0.0.7 → oep_client_python-0.0.9}/src/oep_client/interfaces.py +0 -0
- {oep_client_python-0.0.7 → oep_client_python-0.0.9}/src/oep_client/link.py +0 -0
- {oep_client_python-0.0.7 → oep_client_python-0.0.9}/src/oep_client/message.py +0 -0
- {oep_client_python-0.0.7 → oep_client_python-0.0.9}/src/oep_client/names.py +0 -0
- {oep_client_python-0.0.7 → oep_client_python-0.0.9}/src/oep_client/rp2350.py +0 -0
- {oep_client_python-0.0.7 → oep_client_python-0.0.9}/src/oep_client/target.py +0 -0
- {oep_client_python-0.0.7 → oep_client_python-0.0.9}/src/oep_client/uiapduino.py +0 -0
- {oep_client_python-0.0.7 → oep_client_python-0.0.9}/src/oep_client/usb_stream.py +0 -0
- {oep_client_python-0.0.7 → oep_client_python-0.0.9}/tests/test_capabilities.py +0 -0
- {oep_client_python-0.0.7 → oep_client_python-0.0.9}/tests/test_capture.py +0 -0
- {oep_client_python-0.0.7 → oep_client_python-0.0.9}/tests/test_cobs.py +0 -0
- {oep_client_python-0.0.7 → oep_client_python-0.0.9}/tests/test_config.py +0 -0
- {oep_client_python-0.0.7 → oep_client_python-0.0.9}/tests/test_esp32_targets.py +0 -0
- {oep_client_python-0.0.7 → oep_client_python-0.0.9}/tests/test_flash_console.py +0 -0
- {oep_client_python-0.0.7 → oep_client_python-0.0.9}/tests/test_hid_stream.py +0 -0
- {oep_client_python-0.0.7 → oep_client_python-0.0.9}/tests/test_interfaces.py +0 -0
- {oep_client_python-0.0.7 → oep_client_python-0.0.9}/tests/test_link_host.py +0 -0
- {oep_client_python-0.0.7 → oep_client_python-0.0.9}/tests/test_link_serial.py +0 -0
- {oep_client_python-0.0.7 → oep_client_python-0.0.9}/tests/test_session.py +0 -0
- {oep_client_python-0.0.7 → oep_client_python-0.0.9}/tests/test_target_parts.py +0 -0
- {oep_client_python-0.0.7 → oep_client_python-0.0.9}/tests/test_usb_stream.py +0 -0
|
@@ -2,6 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 0.0.9
|
|
6
|
+
- (EN) The fake probe has `oep.fixture.capture` (logic, `fake_capture`): one-shot, repeat (a ring and release), streaming (data pushes), level / edge triggers with a pretrigger, events, and a known waveform (sample i = the counter i, channel k = its bit k) in the profile's layout (P4: w 1-16; classic ESP32: w 8). A capture shares pins with other interfaces (it only listens). `Endpoint.pushes()` gives the frames the probe sends by itself; fake_serve sends them on the pty and TCP. `--capture-slipped` sets flags bit2 on every segment.
|
|
7
|
+
- (JA) 偽の probe に `oep.fixture.capture`(ロジック、`fake_capture`)を入れた: ワンショット、リピート(リングと release)、ストリーミング(データの push)、レベル / エッジのトリガとプリトリガ、出来事。取れる波形は決まっている(サンプル i = カウンタ i、チャネル k = そのビット k)。layout は profile のもの(P4: w 1〜16、classic ESP32: w 8)。capture はほかのインターフェースとピンを共有できる(聞くだけ)。`Endpoint.pushes()` が probe の送り出すフレームを返し、fake_serve は pty と TCP に流す。`--capture-slipped` は区画すべてに flags bit2 を立てる。
|
|
8
|
+
- (EN) The fake: an attach without pins joins the wire's one live connection, also on a wire whose pins the host chooses (oep-if-debug §1).
|
|
9
|
+
- (JA) 偽の probe: pins の無い attach は、その線の生きている接続が 1 つならそれに乗る。host がピンを選ぶ線でも同じ(oep-if-debug §1)。
|
|
10
|
+
|
|
11
|
+
## 0.0.8
|
|
12
|
+
- (EN) Wires whose pins the host chooses (oep-if-debug §1, role_channels): the fake takes any allowed free pair, skips the pairs whose pins something holds in a count-0 scan, holds a live connection's pins against plans, and has a profile for it (`rp2350-pins`). `Wire.scan()` goes through the whole list (at most 255 pairs a request; count 0 continues with the new skip TLV until tried = 0).
|
|
13
|
+
- (JA) host がピンを選ぶ wire(oep-if-debug §1、role_channels): 偽の probe は、許された空いている組ならどれでも受け、count = 0 の scan では何かが持っているピンの組を飛ばし、生きている接続のピンを plan から守る。そのための profile(`rp2350-pins`)を足した。`Wire.scan()` は並びを最後まで回る(1 回 255 組まで。count = 0 は新しい skip の TLV で tried = 0 まで続ける)。
|
|
14
|
+
|
|
5
15
|
## 0.0.7
|
|
6
16
|
- (EN) `oep dump` names the wires' reset role (role 3) and no longer lists riscv-dm's clobbers (gone: the probe puts the registers back itself, oep-if-debug §4.5).
|
|
7
17
|
- (JA) `oep dump` は wire の reset の役(role 3)を名前で出し、riscv-dm の clobbers を出さなくなった(無くなった: probe が自分でレジスタを戻す、oep-if-debug §4.5)。
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: oep-client-python
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.9
|
|
4
4
|
Summary: Open Embedded Probe (OEP) v1 host: serial / USB / TCP transports, the session rules, the standard interfaces, and a fake probe
|
|
5
5
|
Project-URL: Homepage, https://github.com/Open-Embedded-Probe/oep-client-python
|
|
6
6
|
Project-URL: Repository, https://github.com/Open-Embedded-Probe/oep-client-python
|
|
@@ -107,8 +107,15 @@ A run on hardware: ArduinoCore-CH32's `tests/manual/oep_smoke/` (`oep_smoke.py`,
|
|
|
107
107
|
|
|
108
108
|
`endpoint.Endpoint` is a fake probe that answers as oep-spec says; ch32rv, this client and the probe firmware are checked
|
|
109
109
|
against it (when the spec changes, this is brought in line before the firmware). `fake` holds example declarations (profiles
|
|
110
|
-
`p4-x035`, `esp32-v003`, `p4-bench` = a made-up jig with three slots and two seats
|
|
111
|
-
port (COBS candidates, raw bytes and binds, held during a session and
|
|
110
|
+
`p4-x035`, `esp32-v003`, `p4-bench` = a made-up jig with three slots and two seats, `rp2350-pins` = a wire whose pins the host
|
|
111
|
+
chooses), `fake_serial` the byte side of a serial port (COBS candidates, raw bytes and binds, held during a session and
|
|
112
|
+
resumed after it).
|
|
113
|
+
|
|
114
|
+
`fake_capture` is `oep.fixture.capture` (logic): one-shot, repeat (segments with the clock at the actual rate, a ring,
|
|
115
|
+
release) and streaming (data pushes while subscribed), level / edge triggers with a pretrigger, and events. What it
|
|
116
|
+
captures is known: sample i is the counter i, channel k its bit k (a square wave of period 2^(k+1) samples), in the layout
|
|
117
|
+
the profile allows (`p4-x035`: w 1-16 as the P4's PARLIO, three channels in w 4; `esp32-v003`: w 8 as the classic ESP32's
|
|
118
|
+
sampler, one-shot only). A capture only listens, so it may be planned on pins other interfaces hold.
|
|
112
119
|
|
|
113
120
|
Other programs' tests run `fake_serve` as a child process:
|
|
114
121
|
|
|
@@ -122,4 +129,5 @@ The pty is a serial port (the host opens it with TIOCEXCL); `--tcp PORT` is `--f
|
|
|
122
129
|
`--framing length` (the vendor bulk / TCP form). Faults: `--drop N` (the N-th answer is not sent, once; the request did run,
|
|
123
130
|
so a resend gets the remembered result), `--noise TEXT` (noise before every answer), `--corrupt N` (the N-th answer's CRC
|
|
124
131
|
broken once). `--uart-plan` / `--uart-rx` give the first fixture UART a plan and RX bytes, `--run-hook` a host's own model of
|
|
125
|
-
riscv-dm run.
|
|
132
|
+
riscv-dm run, `--capture-slipped` flags bit2 on every capture segment. Events and data pushes go out on the pty and on TCP
|
|
133
|
+
(both framings). The rest: `--help`.
|
|
@@ -80,8 +80,14 @@ oep config save <probe> # 再起動の後も残す(remove
|
|
|
80
80
|
|
|
81
81
|
`endpoint.Endpoint` は oep-spec の規範どおりに答える偽の probe で、ch32rv・この client・probe の firmware を突き合わせる
|
|
82
82
|
「動く spec」として使う(spec が変わったら、probe の firmware より先にここを合わせる)。`fake` は宣言の例(profile:
|
|
83
|
-
`p4-x035`、`esp32-v003`、`p4-bench` = スロット 3 か所と席 2
|
|
84
|
-
|
|
83
|
+
`p4-x035`、`esp32-v003`、`p4-bench` = スロット 3 か所と席 2 つの架空の治具、`rp2350-pins` = host がピンを選ぶ wire)、`fake_serial` は
|
|
84
|
+
シリアルの口のバイトの側(COBS の候補、生のバイトと bind、セッション中の停止と再開)。
|
|
85
|
+
|
|
86
|
+
`fake_capture` は `oep.fixture.capture`(ロジック): ワンショット、リピート(実際のレートで時計どおりに区画ができ、リング、release)、
|
|
87
|
+
ストリーミング(購読している間のデータの push)、レベル / エッジのトリガとプリトリガ、出来事。取れるものは決まっている: サンプル i は
|
|
88
|
+
カウンタの値 i で、チャネル k はそのビット k(周期 2^(k+1) サンプルの方形波)。layout は profile が許す形(`p4-x035`: P4 の
|
|
89
|
+
PARLIO と同じ w 1〜16、3 本なら w 4。`esp32-v003`: classic ESP32 の sampler と同じ w 8、ワンショットだけ)。capture は聞くだけ
|
|
90
|
+
なので、ほかのインターフェースが持つピンにも plan できる。
|
|
85
91
|
|
|
86
92
|
外のプログラムの試験には `fake_serve` を子プロセスで使う:
|
|
87
93
|
|
|
@@ -93,6 +99,7 @@ uv run python -m oep_client.fake_serve --pty --profile p4-bench --slot x035 --bi
|
|
|
93
99
|
|
|
94
100
|
pty がシリアルの口(host が TIOCEXCL を掛けて開く)、`--tcp PORT` は `--framing cobs`(シリアルの口)か `--framing length`
|
|
95
101
|
(vendor bulk / TCP の形)。故障の注入は `--drop N`(N 番目の答えを 1 回出さない。要求は実行済みなので送り直しは覚えた答えを
|
|
96
|
-
受ける)、`--noise TEXT`(答えの前に雑音)、`--corrupt N`(N 番目の答えの CRC を 1
|
|
102
|
+
受ける)、`--noise TEXT`(答えの前に雑音)、`--corrupt N`(N 番目の答えの CRC を 1 回壊す)。`--capture-slipped` は capture の
|
|
103
|
+
区画すべてに flags bit2 を立てる。出来事とデータの push は pty にも TCP(両方の framing)にも出る。ほかは `--help`。
|
|
97
104
|
|
|
98
105
|
v0 の client(`oep_client.v0`)は 2026-09-26 に消した(git の履歴に残る)。v0 を話す probe はもう無い。
|
|
@@ -85,8 +85,15 @@ A run on hardware: ArduinoCore-CH32's `tests/manual/oep_smoke/` (`oep_smoke.py`,
|
|
|
85
85
|
|
|
86
86
|
`endpoint.Endpoint` is a fake probe that answers as oep-spec says; ch32rv, this client and the probe firmware are checked
|
|
87
87
|
against it (when the spec changes, this is brought in line before the firmware). `fake` holds example declarations (profiles
|
|
88
|
-
`p4-x035`, `esp32-v003`, `p4-bench` = a made-up jig with three slots and two seats
|
|
89
|
-
port (COBS candidates, raw bytes and binds, held during a session and
|
|
88
|
+
`p4-x035`, `esp32-v003`, `p4-bench` = a made-up jig with three slots and two seats, `rp2350-pins` = a wire whose pins the host
|
|
89
|
+
chooses), `fake_serial` the byte side of a serial port (COBS candidates, raw bytes and binds, held during a session and
|
|
90
|
+
resumed after it).
|
|
91
|
+
|
|
92
|
+
`fake_capture` is `oep.fixture.capture` (logic): one-shot, repeat (segments with the clock at the actual rate, a ring,
|
|
93
|
+
release) and streaming (data pushes while subscribed), level / edge triggers with a pretrigger, and events. What it
|
|
94
|
+
captures is known: sample i is the counter i, channel k its bit k (a square wave of period 2^(k+1) samples), in the layout
|
|
95
|
+
the profile allows (`p4-x035`: w 1-16 as the P4's PARLIO, three channels in w 4; `esp32-v003`: w 8 as the classic ESP32's
|
|
96
|
+
sampler, one-shot only). A capture only listens, so it may be planned on pins other interfaces hold.
|
|
90
97
|
|
|
91
98
|
Other programs' tests run `fake_serve` as a child process:
|
|
92
99
|
|
|
@@ -100,4 +107,5 @@ The pty is a serial port (the host opens it with TIOCEXCL); `--tcp PORT` is `--f
|
|
|
100
107
|
`--framing length` (the vendor bulk / TCP form). Faults: `--drop N` (the N-th answer is not sent, once; the request did run,
|
|
101
108
|
so a resend gets the remembered result), `--noise TEXT` (noise before every answer), `--corrupt N` (the N-th answer's CRC
|
|
102
109
|
broken once). `--uart-plan` / `--uart-rx` give the first fixture UART a plan and RX bytes, `--run-hook` a host's own model of
|
|
103
|
-
riscv-dm run.
|
|
110
|
+
riscv-dm run, `--capture-slipped` flags bit2 on every capture segment. Events and data pushes go out on the pty and on TCP
|
|
111
|
+
(both framings). The rest: `--help`.
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "oep-client-python"
|
|
7
|
-
version = "0.0.
|
|
7
|
+
version = "0.0.9"
|
|
8
8
|
description = "Open Embedded Probe (OEP) v1 host: serial / USB / TCP transports, the session rules, the standard interfaces, and a fake probe"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = "MIT"
|
|
@@ -39,7 +39,7 @@ from collections import OrderedDict
|
|
|
39
39
|
from dataclasses import dataclass, field
|
|
40
40
|
from typing import Callable
|
|
41
41
|
|
|
42
|
-
from . import catalog, fake, message as m, registry as reg
|
|
42
|
+
from . import catalog, fake, fake_capture, message as m, registry as reg
|
|
43
43
|
|
|
44
44
|
TOY_WRITE, TOY_READ = 0x01, 0x02
|
|
45
45
|
OK, WAIT, LINE, FAULT, TIMEOUT, STATE = (reg.STATUS[k] for k in ("ok", "wait", "line", "fault", "timeout", "state"))
|
|
@@ -254,16 +254,29 @@ class Endpoint:
|
|
|
254
254
|
self.pairs: dict[int, list[tuple[int, int]]] = {} # wire fn -> allowed (swdio, swclk), declared order
|
|
255
255
|
self.max_connections: dict[int, int] = {}
|
|
256
256
|
self.reset_channels: dict[int, set[int]] = {} # wire fn -> channels attach_under_reset may take (role 3)
|
|
257
|
+
self.pin_roles: dict[int, dict[int, set[int]]] = {} # wire fn -> role -> candidates (role_channels wires)
|
|
257
258
|
for fn, name in self.names.items():
|
|
258
259
|
if name in WIRES:
|
|
259
260
|
self.pairs[fn] = [self._group_pair(name, t) for t in self.static[fn] if t[0] == catalog.CHANNEL_GROUP]
|
|
261
|
+
roles: dict[int, set[int]] = {}
|
|
262
|
+
for t in self.static[fn]:
|
|
263
|
+
if t[0] == catalog.ROLE_CHANNELS and t[2] in (1, 2):
|
|
264
|
+
roles.setdefault(t[2], set()).update(
|
|
265
|
+
catalog.bitmap_to_channels(struct.unpack_from("<H", t, 3)[0], t[5:2 + t[1]]))
|
|
266
|
+
if roles:
|
|
267
|
+
self.pin_roles[fn] = roles
|
|
260
268
|
self.reset_channels[fn] = {
|
|
261
269
|
c for t in self.static[fn] if t[0] == catalog.ROLE_CHANNELS and t[2] == PIN_ROLE_RESET
|
|
262
270
|
for c in catalog.bitmap_to_channels(struct.unpack_from("<H", t, 3)[0], t[5:2 + t[1]])}
|
|
263
271
|
self.max_connections[fn] = next((t[2] for t in self.static[fn] if t[0] == fake.MAX_CONNECTIONS), 1)
|
|
264
272
|
self.targets: dict[tuple[int, tuple[int, int]], FakeTarget] = {
|
|
265
273
|
(fn, p): FakeTarget() for fn in sorted(self.pairs) for p in self.pairs[fn]}
|
|
274
|
+
for fn in sorted(self.pin_roles): # any pair: one target, on the first pair
|
|
275
|
+
first = self._role_pairs(fn)[0]
|
|
276
|
+
self.targets[(fn, first)] = FakeTarget()
|
|
266
277
|
self.target = next(iter(self.targets.values()), FakeTarget())
|
|
278
|
+
self.captures: dict[int, fake_capture.FakeCapture] = {
|
|
279
|
+
fn: self._capture_from(self.static[fn]) for fn, name in self.names.items() if name == "oep.fixture.capture"}
|
|
267
280
|
self.mechanisms = set()
|
|
268
281
|
for fn, name in self.names.items():
|
|
269
282
|
if name == "oep.target.console":
|
|
@@ -291,6 +304,9 @@ class Endpoint:
|
|
|
291
304
|
self.dropped = 0 # requests a v0 endpoint dropped (role 0x81)
|
|
292
305
|
self.requests: list[m.Request] = []
|
|
293
306
|
self.subscribed: set[int] = set()
|
|
307
|
+
self.push_seq: dict[int, int] = {} # fn -> the next event / data seq (core §11.2)
|
|
308
|
+
self.outbox: list[bytes] = [] # events and data frames waiting to go out (pushes())
|
|
309
|
+
self.capture_slipped = False # every capture segment says flags bit2 (a pace that fell behind)
|
|
294
310
|
self.plan: set[tuple[int, int, int]] = set() # (fn, role, channel), from plan_apply and the config
|
|
295
311
|
self.plan_from_config: set[int] = set() # fns whose plan came from the config (not a session's)
|
|
296
312
|
self.resend: OrderedDict[int, tuple[int, int, int, bytes | None]] = OrderedDict()
|
|
@@ -329,6 +345,123 @@ class Endpoint:
|
|
|
329
345
|
def target_id(self, value: int | None) -> None:
|
|
330
346
|
self.target.target_id = value
|
|
331
347
|
|
|
348
|
+
@staticmethod
|
|
349
|
+
def _capture_from(tlvs: list[bytes]) -> fake_capture.FakeCapture:
|
|
350
|
+
"""A capture as its describe declares it (modes, the w allowed, the rate range, max_read, the ring)."""
|
|
351
|
+
d = reg.FIXTURE_CAPTURE.tlv["describe"]
|
|
352
|
+
modes, widths, lo, hi, ring, most = set(), {8}, 1, 1_000_000, 1, 1024
|
|
353
|
+
for t in tlvs:
|
|
354
|
+
tag, v = t[0], t[2:2 + t[1]]
|
|
355
|
+
if tag == d["mode"]:
|
|
356
|
+
modes.add(v[0])
|
|
357
|
+
elif tag == d["channels"]:
|
|
358
|
+
widths = {1 << i for i in range(6) if v[1] >> i & 1}
|
|
359
|
+
elif tag == catalog.MIN_CLOCK_HZ:
|
|
360
|
+
lo = struct.unpack("<I", v)[0]
|
|
361
|
+
elif tag == catalog.MAX_CLOCK_HZ:
|
|
362
|
+
hi = struct.unpack("<I", v)[0]
|
|
363
|
+
elif tag == d["segment_ring"]:
|
|
364
|
+
ring = struct.unpack("<H", v)[0]
|
|
365
|
+
elif tag == d["max_read"]:
|
|
366
|
+
most = struct.unpack("<I", v)[0]
|
|
367
|
+
return fake_capture.FakeCapture(modes or {fake_capture.MODE["one_shot"]}, widths, lo, hi, ring, most)
|
|
368
|
+
|
|
369
|
+
def _next_seq(self, fn: int) -> int:
|
|
370
|
+
seq = self.push_seq.get(fn, 0)
|
|
371
|
+
self.push_seq[fn] = (seq + 1) & 0xFFFF
|
|
372
|
+
return seq
|
|
373
|
+
|
|
374
|
+
def _events(self, fn: int, events: list[bytes]) -> None:
|
|
375
|
+
"""Events (kind(u8) payload) of `fn` to go out while it is subscribed; unsubscribed, they are not sent."""
|
|
376
|
+
for e in events:
|
|
377
|
+
if fn in self.subscribed:
|
|
378
|
+
self.outbox.append(bytes([m.ROLE_EVENT]) + struct.pack("<HH", fn, self._next_seq(fn)) + e)
|
|
379
|
+
|
|
380
|
+
def pushes(self) -> list[bytes]:
|
|
381
|
+
"""The frames the probe sends by itself now (core §11): events, and a streaming capture's data. A serving loop
|
|
382
|
+
frames and sends them; a test takes them from here."""
|
|
383
|
+
self.tick()
|
|
384
|
+
for fn, cap in self.captures.items():
|
|
385
|
+
if fn in self.subscribed:
|
|
386
|
+
self.outbox += cap.pushes(fn, lambda fn=fn: self._next_seq(fn), self.probe.max_frame)
|
|
387
|
+
out, self.outbox = self.outbox, []
|
|
388
|
+
return out
|
|
389
|
+
|
|
390
|
+
def _capture(self, fn: int, op: int, t: Take) -> tuple[int, int, bytes]:
|
|
391
|
+
cap, O = self.captures[fn], fake_capture.OP
|
|
392
|
+
self._events(fn, cap.tick(self.now())) # what the clock captured up to this request
|
|
393
|
+
roles = sorted(a[1] for a in self.plan if a[0] == fn)
|
|
394
|
+
budget = self.probe.max_frame - m.RESULT_HEADER
|
|
395
|
+
try:
|
|
396
|
+
if op in (O["configure"], O["query"]):
|
|
397
|
+
got, ignored = t.tail(set(fake_capture.TLV.values()) - {fake_capture.TLV["frontend"]})
|
|
398
|
+
settled = cap.settle(got, t.critical, len(roles))
|
|
399
|
+
if op == O["configure"]:
|
|
400
|
+
cap.apply(settled)
|
|
401
|
+
cap.slipped = self.capture_slipped
|
|
402
|
+
return self._answer(cap.answer(settled), ignored)
|
|
403
|
+
if op == O["start"]:
|
|
404
|
+
t.tail()
|
|
405
|
+
self._events(fn, cap.start(self.now()))
|
|
406
|
+
return m.COMPLETED, m.SUCCESS, struct.pack("<I", 0)
|
|
407
|
+
if op == O["stop"]:
|
|
408
|
+
t.tail()
|
|
409
|
+
self._events(fn, cap.stop())
|
|
410
|
+
return m.COMPLETED, m.SUCCESS, b""
|
|
411
|
+
if op == O["force"]:
|
|
412
|
+
t.tail()
|
|
413
|
+
return m.COMPLETED, m.SUCCESS, b"" # nothing waits: a trigger is found at start
|
|
414
|
+
if op == O["status"]:
|
|
415
|
+
t.tail()
|
|
416
|
+
return m.COMPLETED, m.SUCCESS, cap.status()
|
|
417
|
+
if op == O["read"]:
|
|
418
|
+
position, most = t.take("QI")
|
|
419
|
+
return m.COMPLETED, m.SUCCESS, cap.read(position, most, budget)
|
|
420
|
+
if op == O["segments"]:
|
|
421
|
+
first = t.take("I")
|
|
422
|
+
t.tail()
|
|
423
|
+
return m.COMPLETED, m.SUCCESS, cap.segment_list(first, budget)
|
|
424
|
+
if op == O["release"]:
|
|
425
|
+
serial = t.take("I")
|
|
426
|
+
t.tail()
|
|
427
|
+
cap.release(serial, self.now())
|
|
428
|
+
return m.COMPLETED, m.SUCCESS, b""
|
|
429
|
+
except fake_capture.Reject as e:
|
|
430
|
+
raise Reject(e.reason, e.payload)
|
|
431
|
+
return m.REJECTED, m.UNKNOWN_OPERATION, b""
|
|
432
|
+
|
|
433
|
+
def _role_pairs(self, fn: int) -> list[tuple[int, int]]:
|
|
434
|
+
"""A role_channels wire's pairs in the count = 0 order (oep-if-debug §1): swdio ascending, then swclk."""
|
|
435
|
+
roles = self.pin_roles[fn]
|
|
436
|
+
if self.names[fn] == "oep.wire.swio":
|
|
437
|
+
return [(d, 0xFFFF) for d in sorted(roles.get(1, ()))]
|
|
438
|
+
return [(d, c) for d in sorted(roles.get(1, ())) for c in sorted(roles.get(2, ())) if d != c]
|
|
439
|
+
|
|
440
|
+
def _allowed_pairs(self, fn: int) -> list[tuple[int, int]]:
|
|
441
|
+
return self._role_pairs(fn) if fn in self.pin_roles else self.pairs.get(fn, [])
|
|
442
|
+
|
|
443
|
+
def _allows(self, fn: int, pair: tuple[int, int]) -> bool:
|
|
444
|
+
if fn in self.pin_roles:
|
|
445
|
+
roles = self.pin_roles[fn]
|
|
446
|
+
swio = self.names[fn] == "oep.wire.swio"
|
|
447
|
+
return pair[0] in roles.get(1, ()) and (pair[1] == 0xFFFF if swio else
|
|
448
|
+
pair[1] in roles.get(2, ()) and pair[1] != pair[0])
|
|
449
|
+
return pair in self.pairs.get(fn, [])
|
|
450
|
+
|
|
451
|
+
def _held(self, fn: int | None = None, pair: tuple[int, int] | None = None) -> set[int]:
|
|
452
|
+
"""Channels something holds (core §8.1): the plan, the slots' pairs, the live connections' pairs - except
|
|
453
|
+
wire `fn`'s own connection on `pair` (attaching there again, or scanning through it)."""
|
|
454
|
+
held = {a[2] for a in self.plan if a[0] not in self.captures} # a capture only listens
|
|
455
|
+
held |= {p for s in self.slots.values() for p in s.pair if p != 0xFFFF and not (s.wire_fn == fn and s.pair == pair)}
|
|
456
|
+
held |= {p for c in self.conns.values() for p in c.pair if p != 0xFFFF and not (c.fn == fn and c.pair == pair)}
|
|
457
|
+
return held
|
|
458
|
+
|
|
459
|
+
def _target(self, fn: int, pair: tuple[int, int]) -> FakeTarget:
|
|
460
|
+
tg = self.targets.get((fn, pair))
|
|
461
|
+
if tg is None: # a pair nothing is wired to
|
|
462
|
+
tg = self.targets[(fn, pair)] = FakeTarget(present=False)
|
|
463
|
+
return tg
|
|
464
|
+
|
|
332
465
|
@staticmethod
|
|
333
466
|
def _group_pair(name: str, t: bytes) -> tuple[int, int]:
|
|
334
467
|
roles = {t[3 + 3 * i]: struct.unpack_from("<H", t, 4 + 3 * i)[0] for i in range((t[1] - 1) // 3)}
|
|
@@ -570,6 +703,7 @@ class Endpoint:
|
|
|
570
703
|
if fn != 0 and fn not in self.names:
|
|
571
704
|
return m.REJECTED, m.UNAVAILABLE, b""
|
|
572
705
|
self.subscribed.add(fn)
|
|
706
|
+
self.push_seq[fn] = 0 # seq from 0 at every subscribe (core §11.2)
|
|
573
707
|
return m.COMPLETED, m.SUCCESS, b""
|
|
574
708
|
if op == m.OP_UNSUBSCRIBE:
|
|
575
709
|
fn = t.take("H")
|
|
@@ -601,13 +735,24 @@ class Endpoint:
|
|
|
601
735
|
def _check_plan(self, got: list[tuple[int, int, int]]) -> None:
|
|
602
736
|
"""plan_apply's all-or-nothing check: the roles each fn has, and no pin another fn (or a slot) holds."""
|
|
603
737
|
named = {fn for fn, _, _ in got}
|
|
604
|
-
|
|
738
|
+
# a capture only listens: it shares pins with anything, and nothing is kept from a pin by it (core §8.1)
|
|
739
|
+
kept = {a for a in self.plan if a[0] not in named and a[0] not in self.captures}
|
|
605
740
|
slot_pins = {p for s in self.slots.values() for p in s.pair if p != 0xFFFF}
|
|
741
|
+
slot_pins |= {p for c in self.conns.values() for p in c.pair if p != 0xFFFF} # a live connection's pins too
|
|
606
742
|
for fn, role, ch in got:
|
|
743
|
+
if fn in self.captures:
|
|
744
|
+
if role not in self._declared_roles(fn, ch):
|
|
745
|
+
raise Reject(m.UNAVAILABLE)
|
|
746
|
+
continue
|
|
607
747
|
roles = {"oep.fixture.gpio": {1}, "oep.fixture.uart": {1, 2}}.get(self.names.get(fn, ""), set())
|
|
608
748
|
if role not in roles or any(k[2] == ch for k in kept) or ch in slot_pins:
|
|
609
749
|
raise Reject(m.UNAVAILABLE)
|
|
610
750
|
|
|
751
|
+
def _declared_roles(self, fn: int, channel: int) -> set[int]:
|
|
752
|
+
"""The roles fn's describe offers on `channel` (role_channels)."""
|
|
753
|
+
return {t[2] for t in self.static[fn] if t[0] == catalog.ROLE_CHANNELS
|
|
754
|
+
and channel in catalog.bitmap_to_channels(struct.unpack_from("<H", t, 3)[0], t[5:2 + t[1]])}
|
|
755
|
+
|
|
611
756
|
def _drop_plan(self, fn: int) -> None:
|
|
612
757
|
for a in [a for a in self.plan if a[0] == fn]:
|
|
613
758
|
self.gpio_modes.pop(a[2], None)
|
|
@@ -646,17 +791,24 @@ class Endpoint:
|
|
|
646
791
|
|
|
647
792
|
# ---- oep.wire.rvswd / swio ------------------------------------------------------------------
|
|
648
793
|
def _wire(self, fn: int, op: int, t: Take) -> tuple[int, int, bytes]:
|
|
649
|
-
allowed = self.pairs.get(fn, [])
|
|
650
794
|
if op == 0x01: # scan: count(u8) pairs -> tried count found...
|
|
651
795
|
count = t.take("B")
|
|
652
796
|
pairs = [t.take("HH") for _ in range(count)]
|
|
653
|
-
t.tail()
|
|
654
|
-
if
|
|
655
|
-
raise Reject(m.
|
|
656
|
-
|
|
797
|
+
got, _ = t.tail({0x01})
|
|
798
|
+
if 0x01 in got and (count or len(got[0x01]) != 2):
|
|
799
|
+
raise Reject(m.MALFORMED) # skip goes with count 0 only
|
|
800
|
+
live = [c.pair for c in self.conns.values() if c.fn == fn]
|
|
801
|
+
full = len(live) >= self.max_connections.get(fn, 1) # every seat taken: the live pairs only
|
|
802
|
+
if any(not self._allows(fn, p) or set(p) & self._held(fn, p) or (full and p not in live) for p in pairs):
|
|
803
|
+
raise Reject(m.UNAVAILABLE) # not allowed, held (§8.1), or no seat to try it on
|
|
804
|
+
if not pairs: # the count-0 list, from `skip` on (oep-if-debug §1)
|
|
805
|
+
skip = struct.unpack("<H", got[0x01])[0] if 0x01 in got else 0
|
|
806
|
+
pairs = [p for p in self._allowed_pairs(fn)
|
|
807
|
+
if not set(p) & self._held(fn, p) and (not full or p in live)][skip:]
|
|
808
|
+
pairs = pairs[:255] # tried is a u8
|
|
657
809
|
found = []
|
|
658
810
|
for p in pairs:
|
|
659
|
-
tg = self.
|
|
811
|
+
tg = self._target(fn, p)
|
|
660
812
|
if tg.present: # a live connection's pair: read over it, no restart
|
|
661
813
|
found.append(struct.pack("<BHHI", 1, *p, tg.dmstatus()))
|
|
662
814
|
return m.COMPLETED, m.SUCCESS, struct.pack("<BB", len(pairs), len(found)) + b"".join(found)
|
|
@@ -675,7 +827,7 @@ class Endpoint:
|
|
|
675
827
|
raise Reject(m.MALFORMED)
|
|
676
828
|
idle_clock = got[0x04][0] if 0x04 in got else 0
|
|
677
829
|
pair = self._pick_pair(fn, got)
|
|
678
|
-
tg = self.
|
|
830
|
+
tg = self._target(fn, pair)
|
|
679
831
|
speed = min(4_000_000, struct.unpack("<I", got[0x01])[0]) if 0x01 in got else 4_000_000
|
|
680
832
|
cid = self._conn_at(fn, pair)
|
|
681
833
|
flags = 0
|
|
@@ -729,15 +881,18 @@ class Endpoint:
|
|
|
729
881
|
return m.REJECTED, m.UNKNOWN_OPERATION, b""
|
|
730
882
|
|
|
731
883
|
def _pick_pair(self, fn: int, got: dict[int, bytes]) -> tuple[int, int]:
|
|
732
|
-
allowed = self.pairs.get(fn, [])
|
|
733
884
|
if 0x03 in got:
|
|
734
885
|
if len(got[0x03]) != 4:
|
|
735
886
|
raise Reject(m.MALFORMED)
|
|
736
887
|
pair = struct.unpack("<HH", got[0x03])
|
|
737
|
-
if pair
|
|
738
|
-
raise Reject(m.UNAVAILABLE) #
|
|
888
|
+
if not self._allows(fn, pair) or set(pair) & self._held(fn, pair):
|
|
889
|
+
raise Reject(m.UNAVAILABLE) # not allowed here, or its pins are held (§8.1)
|
|
739
890
|
return pair
|
|
740
|
-
|
|
891
|
+
live = [c.pair for c in self.conns.values() if c.fn == fn]
|
|
892
|
+
if len(live) == 1:
|
|
893
|
+
return live[0] # no pins: the wire's one live connection
|
|
894
|
+
allowed = self._allowed_pairs(fn)
|
|
895
|
+
if live or len(allowed) != 1:
|
|
741
896
|
raise Reject(m.UNAVAILABLE) # the host chooses among several
|
|
742
897
|
return allowed[0]
|
|
743
898
|
|
|
@@ -779,7 +934,7 @@ class Endpoint:
|
|
|
779
934
|
|
|
780
935
|
def _target_of(self, cid: int) -> FakeTarget:
|
|
781
936
|
c = self.conns[cid]
|
|
782
|
-
return self.
|
|
937
|
+
return self._target(c.fn, c.pair)
|
|
783
938
|
|
|
784
939
|
# ---- oep.target.riscv-dm --------------------------------------------------------------------
|
|
785
940
|
@staticmethod
|
|
@@ -1181,7 +1336,7 @@ class Endpoint:
|
|
|
1181
1336
|
places = [(s.wire_fn, s.pair) for s in slots.values()]
|
|
1182
1337
|
if len(set(places)) != len(places):
|
|
1183
1338
|
raise Reject(m.UNAVAILABLE)
|
|
1184
|
-
for fn in self.pairs:
|
|
1339
|
+
for fn in self.pairs: # every wire (pin_roles wires have an empty list)
|
|
1185
1340
|
if sum(1 for s in slots.values() if s.wire_fn == fn and s.attach == SLOT_ATTACH["at_boot"]) > \
|
|
1186
1341
|
self.max_connections.get(fn, 1):
|
|
1187
1342
|
raise Reject(m.UNAVAILABLE)
|
|
@@ -1244,7 +1399,7 @@ class Endpoint:
|
|
|
1244
1399
|
raise Reject(m.MALFORMED)
|
|
1245
1400
|
if not SLOT_NAME.fullmatch(name.decode("ascii", "replace")):
|
|
1246
1401
|
raise Reject(m.MALFORMED)
|
|
1247
|
-
if self.names.get(wire_fn) not in WIRES or
|
|
1402
|
+
if self.names.get(wire_fn) not in WIRES or not self._allows(wire_fn, (swdio, swclk)):
|
|
1248
1403
|
raise Reject(m.UNAVAILABLE)
|
|
1249
1404
|
if mech not in self.mechanisms:
|
|
1250
1405
|
raise Reject(m.UNSUPPORTED)
|
|
@@ -1301,7 +1456,7 @@ class Endpoint:
|
|
|
1301
1456
|
s = self.slots[n]
|
|
1302
1457
|
rt = self.slot_rt[n]
|
|
1303
1458
|
rt.last_try_ms = self.now()
|
|
1304
|
-
tg = self.
|
|
1459
|
+
tg = self._target(s.wire_fn, s.pair)
|
|
1305
1460
|
cid = self._conn_at(s.wire_fn, s.pair)
|
|
1306
1461
|
if cid is None:
|
|
1307
1462
|
if not tg.present:
|
|
@@ -1348,9 +1503,11 @@ class Endpoint:
|
|
|
1348
1503
|
self.flows[(port, key)] = Flow(sid, 0)
|
|
1349
1504
|
|
|
1350
1505
|
def tick(self) -> None:
|
|
1351
|
-
"""Time passes: the lease, at-boot retries, mixed lines closed by quiet."""
|
|
1506
|
+
"""Time passes: the lease, at-boot retries, mixed lines closed by quiet, the captures."""
|
|
1352
1507
|
self._lapse()
|
|
1353
1508
|
now = self.now()
|
|
1509
|
+
for fn, cap in self.captures.items():
|
|
1510
|
+
self._events(fn, cap.tick(now))
|
|
1354
1511
|
for n, s in self.slots.items():
|
|
1355
1512
|
rt = self.slot_rt[n]
|
|
1356
1513
|
if (s.attach == SLOT_ATTACH["at_boot"] and s.retry_s and not rt.evicted
|
|
@@ -1498,4 +1655,4 @@ class Endpoint:
|
|
|
1498
1655
|
|
|
1499
1656
|
SIMS = {"oep.wire.rvswd": "wire", "oep.wire.swio": "wire", "oep.target.riscv-dm": "dm",
|
|
1500
1657
|
"oep.target.console": "console", "oep.fixture.gpio": "gpio", "oep.fixture.uart": "uart",
|
|
1501
|
-
"oep.probe.config": "config_op"}
|
|
1658
|
+
"oep.probe.config": "config_op", "oep.fixture.capture": "capture"}
|
|
@@ -108,6 +108,21 @@ TRANSPORT = reg.CORE.enum["transport_kind"]
|
|
|
108
108
|
SERIAL_KINDS = {TRANSPORT["uart_bridge"], TRANSPORT["usb_cdc"], TRANSPORT["usb_serial_jtag"]}
|
|
109
109
|
NS = "io.github.ch32-riscv-ug"
|
|
110
110
|
MECHANISMS = reg.TARGET_CONSOLE.tlv["describe"]["mechanisms"]
|
|
111
|
+
_CAPD = reg.FIXTURE_CAPTURE.tlv["describe"]
|
|
112
|
+
_CAPM = reg.FIXTURE_CAPTURE.enum["mode"]
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
def _capture_decl(modes: list[str], max_channels: int, widths: list[int], max_samples: int, ring: int,
|
|
116
|
+
max_read: int) -> tuple[bytes, ...]:
|
|
117
|
+
"""oep.fixture.capture's declarations (oep-if-capture §3.5): a mode entry per mode, channels (max, the w allowed as
|
|
118
|
+
bits: bit i = w 2^i), the trigger types (immediate, level, edge) with the most pretrigger, max_read, segment_ring."""
|
|
119
|
+
out = tuple(catalog.tlv(_CAPD["mode"], struct.pack("<BBII", _CAPM[k], 1, max_samples, ring if k == "repeat" else 1))
|
|
120
|
+
for k in modes)
|
|
121
|
+
bits = sum(1 << (w.bit_length() - 1) for w in widths)
|
|
122
|
+
return out + (catalog.tlv(_CAPD["channels"], bytes([max_channels, bits])),
|
|
123
|
+
catalog.tlv(_CAPD["trigger"], struct.pack("<BI", 0b111, max_samples - 1)),
|
|
124
|
+
catalog.u32(_CAPD["max_read"], max_read), catalog.u16(_CAPD["segment_ring"], ring),
|
|
125
|
+
catalog.u32(FEATURES, 0b001))
|
|
111
126
|
MAX_CONNECTIONS = reg.WIRE_RVSWD.tlv["describe"]["max_connections"]
|
|
112
127
|
_CFG = reg.PROBE_CONFIG.tlv["describe"]
|
|
113
128
|
|
|
@@ -139,7 +154,8 @@ def _core(firmware: str, model: str, unit_id: bytes, channels: int, reserved: li
|
|
|
139
154
|
return Offered(0, 0, "oep.core", (
|
|
140
155
|
catalog.text(CORE_FIRMWARE, firmware), catalog.text(CORE_MODEL, model), catalog.tlv(CORE_UNIT_ID, unit_id),
|
|
141
156
|
catalog.u16(CORE_CHANNELS, channels), catalog.tlv(CORE_RESERVED, struct.pack("<H", base) + bits),
|
|
142
|
-
catalog.text(CORE_PROFILE, profile)) + tuple(_label(c, n) for c, n in labels.items())
|
|
157
|
+
) + ((catalog.text(CORE_PROFILE, profile),) if profile else ()) + tuple(_label(c, n) for c, n in labels.items())
|
|
158
|
+
+ extra)
|
|
143
159
|
|
|
144
160
|
|
|
145
161
|
def p4_x035() -> FakeProbe:
|
|
@@ -164,9 +180,11 @@ def p4_x035() -> FakeProbe:
|
|
|
164
180
|
catalog.u32(MAX_CLOCK_HZ, 3_000_000), catalog.u8(IMPLEMENTATION, 2))),
|
|
165
181
|
Offered(6, 4, "oep.fixture.uart", _roles({1: pins, 2: pins}) + (
|
|
166
182
|
catalog.u32(MAX_CLOCK_HZ, 3_000_000), catalog.u8(IMPLEMENTATION, 2))),
|
|
167
|
-
|
|
183
|
+
# the P4's PARLIO: w 1-16, one-shot / repeat / streaming
|
|
184
|
+
Offered(7, 5, "oep.fixture.capture", _roles({k: pins for k in range(16)}) + (
|
|
168
185
|
catalog.u32(MAX_CLOCK_HZ, 20_000_000), catalog.u32(MIN_CLOCK_HZ, 1_000),
|
|
169
|
-
catalog.u16(MAX_LENGTH, 65000), catalog.u8(IMPLEMENTATION, 3))
|
|
186
|
+
catalog.u16(MAX_LENGTH, 65000), catalog.u8(IMPLEMENTATION, 3))
|
|
187
|
+
+ _capture_decl(["one_shot", "repeat", "streaming"], 16, [1, 2, 4, 8, 16], 1 << 20, 8, 4096)),
|
|
170
188
|
Offered(8, 6, f"{NS}.esp32.i2c-target", _roles({1: pins, 2: pins}) + (
|
|
171
189
|
catalog.u16(MAX_LENGTH, 128), catalog.u32(MAX_CLOCK_HZ, 1_000_000),
|
|
172
190
|
catalog.u32(FEATURES, 0b11), catalog.u8(IMPLEMENTATION, 2))),
|
|
@@ -193,8 +211,10 @@ def esp32_v003() -> FakeProbe:
|
|
|
193
211
|
Offered(4, 2, "oep.fixture.gpio", _roles({1: wired + [23]})),
|
|
194
212
|
Offered(5, 3, "oep.fixture.uart", _roles({1: wired, 2: wired}) + (
|
|
195
213
|
catalog.u32(MAX_CLOCK_HZ, 115_200), catalog.u8(IMPLEMENTATION, 2))),
|
|
214
|
+
# the classic ESP32's GPIO sampler: a byte a sample (w 8), one-shot
|
|
196
215
|
Offered(6, 4, "oep.fixture.capture", _roles({k: wired for k in range(4)}) + (
|
|
197
|
-
catalog.u32(MAX_CLOCK_HZ, 2_000_000), catalog.u32(MIN_CLOCK_HZ, 400_000), catalog.u8(IMPLEMENTATION, 1))
|
|
216
|
+
catalog.u32(MAX_CLOCK_HZ, 2_000_000), catalog.u32(MIN_CLOCK_HZ, 400_000), catalog.u8(IMPLEMENTATION, 1))
|
|
217
|
+
+ _capture_decl(["one_shot"], 8, [8], 65536, 1, 480)),
|
|
198
218
|
Offered(7, 5, f"{NS}.esp32.i2c-target", _roles({1: wired, 2: wired}) + (
|
|
199
219
|
catalog.u16(MAX_LENGTH, 16), catalog.u32(MAX_CLOCK_HZ, 100_000), catalog.u8(IMPLEMENTATION, 2))),
|
|
200
220
|
# Two fixed pin sets (an example of channel_group; GPIO23 is the DUT's NRST on this jig).
|
|
@@ -230,4 +250,24 @@ def p4_bench() -> FakeProbe:
|
|
|
230
250
|
])
|
|
231
251
|
|
|
232
252
|
|
|
233
|
-
|
|
253
|
+
def rp2350_pins() -> FakeProbe:
|
|
254
|
+
"""A board firmware whose wire takes its pins from the host (oep-if-debug §1, role_channels): any two of GP0-GP29
|
|
255
|
+
but GP19 (the Pro Micro RP2350's PSRAM CS) are an RVSWD pair, a reset line or fixture pins. USB CDC (serial port 0).
|
|
256
|
+
The fake target answers on (0, 1), the first pair."""
|
|
257
|
+
reserved = [19]
|
|
258
|
+
pins = [p for p in range(30) if p not in reserved]
|
|
259
|
+
return FakeProbe("rp2350-pins", 1024, [
|
|
260
|
+
_core("3.0.0", "sparkfun-promicro-rp2350", bytes.fromhex("e66138935f2b1f2c"), 30, reserved, "",
|
|
261
|
+
{}, _transports([(TRANSPORT["usb_cdc"], 0)])),
|
|
262
|
+
Offered(1, 1, "oep.wire.rvswd", _roles({1: pins, 2: pins, 3: pins}) + (
|
|
263
|
+
catalog.u32(MAX_CLOCK_HZ, 5_000_000), catalog.u8(IMPLEMENTATION, 1), catalog.u8(MAX_CONNECTIONS, 1))),
|
|
264
|
+
Offered(2, 1, "oep.target.riscv-dm", (catalog.u32(FEATURES, 0b1111), catalog.u8(IMPLEMENTATION, 1),
|
|
265
|
+
catalog.u16(MAX_LENGTH, 1000))),
|
|
266
|
+
Offered(3, 1, "oep.target.console", (catalog.tlv(MECHANISMS, bytes([0, 1, 2])),)),
|
|
267
|
+
Offered(4, 2, "oep.fixture.gpio", _roles({1: pins})),
|
|
268
|
+
Offered(5, 3, "oep.fixture.uart", _roles({1: pins, 2: pins}) + (
|
|
269
|
+
catalog.u32(MAX_CLOCK_HZ, 3_000_000), catalog.u8(IMPLEMENTATION, 2))),
|
|
270
|
+
])
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
PROFILES = {"p4-x035": p4_x035, "esp32-v003": esp32_v003, "p4-bench": p4_bench, "rp2350-pins": rp2350_pins}
|