Skip to content

Commit af55b45

Browse files
Jyri Sarhakv2019i
authored andcommitted
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>
1 parent fe7c3df commit af55b45

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

tools/debug_stream/debug_stream.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import ctypes
1212
import time
1313
import sys
14+
import os
1415

1516
import logging
1617

@@ -505,7 +506,15 @@ def cavstool_main_loop(my_args):
505506
while True:
506507
if not cavstool.fw_is_alive(dsp):
507508
cavstool.wait_fw_entered(dsp, timeout_s=None)
508-
offset = cavstool.debug_slot_offset(my_args.direct_access_slot)
509+
if my_args.direct_access_slot < 0:
510+
offset = cavstool.debug_slot_offset_by_type(ADSP_DW_SLOT_DEBUG_STREAM)
511+
if offset is None:
512+
logging.error("Could not find debug_stream slot")
513+
sys.exit(1)
514+
logging.info("Got offset 0x%08x by type 0x%08x", offset,
515+
ADSP_DW_SLOT_DEBUG_STREAM)
516+
else:
517+
offset = cavstool.debug_slot_offset(my_args.direct_access_slot)
509518
buf = cavstool.win_read(offset, 0, DEBUG_SLOT_SIZE)
510519
decoder.set_slot(buf)
511520
if not decoder.get_descriptors():
@@ -529,7 +538,7 @@ def main_f(my_args):
529538
about the host CPU load. That is why there where no synchronous mechanism
530539
done and the host simply polls for new records.
531540
"""
532-
if my_args.direct_access_slot >= 0:
541+
if my_args.direct_access_slot >= 0 or not os.path.isfile(my_args.debugstream_file):
533542
return cavstool_main_loop(my_args)
534543
decoder = DebugStreamDecoder()
535544
prev_error = None

0 commit comments

Comments
 (0)