Skip to content

Commit

Permalink
tools: debug_stream.py: Use cavstool.debug_slot_offset_by_type()
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
Jyri Sarha authored and kv2019i committed Oct 7, 2024
1 parent fe7c3df commit af55b45
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions tools/debug_stream/debug_stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import ctypes
import time
import sys
import os

import logging

Expand Down Expand Up @@ -505,7 +506,15 @@ def cavstool_main_loop(my_args):
while True:
if not cavstool.fw_is_alive(dsp):
cavstool.wait_fw_entered(dsp, timeout_s=None)
offset = cavstool.debug_slot_offset(my_args.direct_access_slot)
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)
if not decoder.get_descriptors():
Expand All @@ -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
Expand Down

0 comments on commit af55b45

Please sign in to comment.