MCPcopy Create free account
hub / github.com/tinygrad/tinygrad / __init__

Method __init__

tinygrad/runtime/support/usb.py:312–324  ·  view source on GitHub ↗
(self, usb:USB3|None=None)

Source from the content-addressed store, hash-verified

310
311class ASM24Controller:
312 def __init__(self, usb:USB3|None=None):
313 if not usb:
314 devs = USB3.list_devices(0xADD1, 0x0001)
315 assert len(devs), "no ASM24 controller found"
316 self.usb = USB3(devs[0][0], 0x81, 0x83, 0x02, 0x04, use_bot=bool(getenv("USE_BOT", 0)))
317 else: self.usb = usb
318 self._cache: dict[int, int|None] = {}
319 self._pci_cacheable: list[tuple[int, int]] = []
320 self._pci_cache: dict[int, int|None] = {}
321
322 # Init controller.
323 self.exec_ops([WriteOp(0x54b, b' '), WriteOp(0x54e, b'\x04'), WriteOp(0x5a8, b'\x02'), WriteOp(0x5f8, b'\x04'),
324 WriteOp(0x7ec, b'\x01\x00\x00\x00'), WriteOp(0xc422, b'\x02'), WriteOp(0x0, b'\x33')])
325
326 def exec_ops(self, ops:Sequence[WriteOp|ReadOp|ScsiWriteOp]):
327 cdbs:list[bytes] = []

Callers

nothing calls this directly

Calls 5

exec_opsMethod · 0.95
USB3Class · 0.90
getenvFunction · 0.90
WriteOpClass · 0.85
list_devicesMethod · 0.45

Tested by

no test coverage detected