(self, usb:USB3|None=None)
| 189 | |
| 190 | class CustomASM24Controller: |
| 191 | def __init__(self, usb:USB3|None=None): |
| 192 | if not usb: |
| 193 | devs = USB3.list_devices(0xADD1, 0x0001) |
| 194 | assert len(devs), "no ASM24 controller found" |
| 195 | self.usb = USB3(devs[0][0], 0x81, 0x83, 0x02, 0x04, use_bot=True) |
| 196 | else: self.usb = usb |
| 197 | self._pci_cacheable: list[tuple[int, int]] = [] |
| 198 | self._pci_cache: dict[int, int|None] = {} |
| 199 | |
| 200 | self._f0_out_buf, self._f0_out_mv = alloc_cbuffer(0x1000) # for f0 and e4, allocate big enough for e4 |
| 201 | self._f0_in_buf, _ = alloc_cbuffer(8) |
| 202 | |
| 203 | # Custom firmware now boots with PCIe off. Power it on before probing the link. |
| 204 | ltssm = self.read(0xB450, 1)[0] |
| 205 | if ltssm != 0x78: self.set_pcie_power(True) |
| 206 | ltssm = self.read(0xB450, 1)[0] |
| 207 | if ltssm != 0x78: raise RuntimeError(f"PCIe link not up (LTSSM=0x{ltssm:02X}), custom firmware not ready") |
| 208 | |
| 209 | def set_pcie_power(self, enabled:bool, timeout:int=10000): |
| 210 | checked(libusb.libusb_control_transfer, |
nothing calls this directly
no test coverage detected