tools: debug_stream.py: Use cavstool.debug_slot_offset_by_type()

The new cavstool.debug_slot_offset_by_type() opens an opportunity to
improve debug_stream.py usability a bit. If the debugfs file is not
found, then try to find the correct debug slot the correct slot using
cavstool direct access and debug_slot_offset_by_type().

Signed-off-by: Jyri Sarha <jyri.sarha@linux.intel.com>
This commit is contained in:
Jyri Sarha 2024-09-26 16:44:43 +03:00 committed by Kai Vehmanen
parent fe7c3dfd31
commit af55b454a1
1 changed files with 11 additions and 2 deletions

View File

@ -11,6 +11,7 @@ import argparse
import ctypes
import time
import sys
import os
import logging
@ -505,6 +506,14 @@ def cavstool_main_loop(my_args):
while True:
if not cavstool.fw_is_alive(dsp):
cavstool.wait_fw_entered(dsp, timeout_s=None)
if my_args.direct_access_slot < 0:
offset = cavstool.debug_slot_offset_by_type(ADSP_DW_SLOT_DEBUG_STREAM)
if offset is None:
logging.error("Could not find debug_stream slot")
sys.exit(1)
logging.info("Got offset 0x%08x by type 0x%08x", offset,
ADSP_DW_SLOT_DEBUG_STREAM)
else:
offset = cavstool.debug_slot_offset(my_args.direct_access_slot)
buf = cavstool.win_read(offset, 0, DEBUG_SLOT_SIZE)
decoder.set_slot(buf)
@ -529,7 +538,7 @@ def main_f(my_args):
about the host CPU load. That is why there where no synchronous mechanism
done and the host simply polls for new records.
"""
if my_args.direct_access_slot >= 0:
if my_args.direct_access_slot >= 0 or not os.path.isfile(my_args.debugstream_file):
return cavstool_main_loop(my_args)
decoder = DebugStreamDecoder()
prev_error = None