Skip to content

Commit ae817f9

Browse files
committed
[#92101] ti_dac38j8x_eyescan: Adapt to eyescan library changes
1 parent 176b9ca commit ae817f9

File tree

3 files changed

+55
-6
lines changed

3 files changed

+55
-6
lines changed

protoplaster/tests/dac/ti_dac38j8x_eyescan/process_eyescan.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
TI_DAC38J8X_EYESCAN_LIBRARY = False
1010
try:
1111
from eyescan.eyescan import perform_eyescan
12+
from eyescan.instructions import TestPattern
1213
TI_DAC38J8X_EYESCAN_LIBRARY = True
1314
except OSError:
1415
print(
@@ -18,15 +19,28 @@
1819

1920
class EyeScan:
2021

21-
def __init__(self, ftdi_dev: int, bit: int) -> None:
22+
def __init__(self, pyftdi_url: str, ftdi_jtag_frequency: float,
23+
ftdi_direction: int, ftdi_initial_value: int,
24+
ftdi_reset_bit: int, daisy_chain_device_number: int,
25+
daisy_chain_device_count: int, bit: int,
26+
test_pattern: TestPattern) -> None:
2227
self.eyescan_file = tempfile.NamedTemporaryFile()
2328
self.axis_multiplier = {"x": 1, "y": 10}
2429
self.bit = bit
2530

2631
# Check if the eyescan library is available
2732
assert TI_DAC38J8X_EYESCAN_LIBRARY, "TI DAC38J8X eyescan library is not available."
2833

29-
perform_eyescan(ftdi_dev, self.eyescan_file.name, bit)
34+
perform_eyescan(pyftdi_url=pyftdi_url,
35+
ftdi_jtag_frequency=ftdi_jtag_frequency,
36+
ftdi_direction=ftdi_direction,
37+
ftdi_initial_value=ftdi_initial_value,
38+
ftdi_reset_bit=ftdi_reset_bit,
39+
daisy_chain_device_number=daisy_chain_device_number,
40+
daisy_chain_device_count=daisy_chain_device_count,
41+
output_path=self.eyescan_file.name,
42+
bit_number=bit,
43+
test_pattern=test_pattern)
3044

3145
def parse_file(self) -> list[dict]:
3246
samples_by_lane = defaultdict(lambda: defaultdict(list))

protoplaster/tests/dac/ti_dac38j8x_eyescan/test.py

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
from protoplaster.conf.module import ModuleName
55
from .process_eyescan import EyeScan
6+
from eyescan.instructions import TestPattern
67

78

89
@ModuleName("ti_dac38j8x_eyescan")
@@ -16,8 +17,6 @@ class TestTiDac38j8xEyescan:
1617
"""
1718

1819
def configure(self):
19-
assert hasattr(self,
20-
"ftdi_dev"), "`ftdi_dev` test attribute is required"
2120
assert hasattr(self, "bit"), "`bit` test attribute is required"
2221
assert hasattr(
2322
self,
@@ -26,7 +25,43 @@ def configure(self):
2625
self,
2726
"eyescan_diagram"), "`eyescan_diagram` test attribute is required"
2827

29-
self.eyescan = EyeScan(self.ftdi_dev, self.bit)
28+
def parse_test_pattern(pattern):
29+
try:
30+
return TestPattern[pattern]
31+
except KeyError:
32+
raise ValueError(
33+
f"{pattern} is not a valid test pattern ({[str(i) for i in TestPattern]})"
34+
)
35+
36+
if not hasattr(self, "ftdi_jtag_frequency"):
37+
setattr(self, "ftdi_jtag_frequency", 1E5)
38+
if not hasattr(self, "ftdi_direction"):
39+
setattr(self, "ftdi_direction", 0x308B)
40+
if not hasattr(self, "ftdi_initial_value"):
41+
setattr(self, "ftdi_initial_value", 0x2088)
42+
if not hasattr(self, "ftdi_reset_bit"):
43+
setattr(self, "ftdi_reset_bit", 0x2000)
44+
if not hasattr(self, "daisy_chain_count"):
45+
setattr(self, "daisy_chain_count", 1)
46+
if not hasattr(self, "daisy_chain_number"):
47+
setattr(self, "daisy_chain_number", 1)
48+
if not hasattr(self, "pyftdi_url"):
49+
setattr(self, "pyftdi_url", "ftdi:///1")
50+
if not hasattr(self, "test_pattern"):
51+
setattr(self, "test_pattern", TestPattern.PRBS_7_BIT)
52+
else:
53+
self.test_pattern = parse_test_pattern(self.test_pattern)
54+
55+
self.eyescan = EyeScan(
56+
pyftdi_url=self.pyftdi_url,
57+
ftdi_jtag_frequency=self.ftdi_jtag_frequency,
58+
ftdi_direction=self.ftdi_direction,
59+
ftdi_initial_value=self.ftdi_initial_value,
60+
ftdi_reset_bit=self.ftdi_reset_bit,
61+
daisy_chain_device_number=self.daisy_chain_number,
62+
daisy_chain_device_count=self.daisy_chain_count,
63+
bit=self.bit,
64+
test_pattern=self.test_pattern)
3065

3166
def test_create_diagram(self, record_artifact, artifacts_dir):
3267
"""

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ Flask==3.1.2
1212
flask-cors==6.0.1
1313
requests==2.32.5
1414
waitress==3.0.2
15-
eyescan @ git+https://github.com/antmicro/dac-eyescan-test.git@3228304
15+
eyescan @ git+https://github.com/antmicro/dac-eyescan-test.git@9e49c22

0 commit comments

Comments
 (0)