Add shared PySetTerminal with asynchronous cancellable macros

This commit is contained in:
2026-10-08 18:34:41 +03:00
parent c011c2957b
commit b0c0c05cfa
16 changed files with 1555 additions and 0 deletions

View File

@@ -136,3 +136,22 @@ def memory_response(raw, controller, command):
return None
return data
return None
def bus_steps(write, tetrad, register, data=0):
"""Two bus register operations planned by the shared C core."""
_range(tetrad, 14, "Адрес шины")
_range(register, 15, "Регистр шины")
_range(data, 0xFFFF, "Данные шины")
function = _api("bus_step", [ct.c_int, ct.c_uint, ct.c_uint, ct.c_uint,
ct.c_uint16, ct.POINTER(ct.c_uint32), ct.POINTER(ct.c_uint16),
ct.POINTER(ct.c_uint8)], ct.c_int)
result = []
for step in range(2):
address, value, command = ct.c_uint32(), ct.c_uint16(), ct.c_uint8()
status = function(bool(write), step, tetrad, register, data,
ct.byref(address), ct.byref(value), ct.byref(command))
if status:
raise ValueError(f"Ошибка планирования шины: {status}")
result.append((address.value, None if command.value == PEEK else value.value))
return result