Skip to content

Commit 32f9eca

Browse files
Jyri Sarhafabiobaltieri
authored andcommitted
soc: intel_adsp: tools: cavstool.py: Add debug_slot_offset_by_type()
Add debug_slot_offset_by_type() for getting debug window slot offset by type identifier. How to find the correct slot and what types there are is documented here: soc/intel/intel_adsp/common/include/adsp_debug_window.h In a normal situation a client program would try to find a specific slot right after DSP boot. Because of that the we can not expect it to be there immediately. Instead we need to try multiple times and give firmware some time to update the debug slot descriptor table. Signed-off-by: Jyri Sarha <jyri.sarha@linux.intel.com>
1 parent 5275d44 commit 32f9eca

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

soc/intel/intel_adsp/tools/cavstool.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -748,6 +748,26 @@ def debug_offset():
748748
def debug_slot_offset(num):
749749
return debug_offset() + DEBUG_SLOT_SIZE * (1 + num)
750750

751+
def debug_slot_offset_by_type(the_type, timeout_s=0.2):
752+
ADSP_DW_SLOT_COUNT=15
753+
hertz = 100
754+
attempts = timeout_s * hertz
755+
while attempts > 0:
756+
data = win_read(debug_offset(), 0, ADSP_DW_SLOT_COUNT * 3 * 4)
757+
for i in range(ADSP_DW_SLOT_COUNT):
758+
start_index = i * (3 * 4)
759+
end_index = (i + 1) * (3 * 4)
760+
desc = data[start_index:end_index]
761+
resource_id, type_id, vma = struct.unpack('<III', desc)
762+
if type_id == the_type:
763+
log.info("found desc %u resource_id 0x%08x type_id 0x%08x vma 0x%08x",
764+
i, resource_id, type_id, vma)
765+
return debug_slot_offset(i)
766+
log.debug("not found, %u attempts left", attempts)
767+
attempts -= 1
768+
time.sleep(1 / hertz)
769+
return None
770+
751771
def shell_base_offset():
752772
return debug_offset() + DEBUG_SLOT_SIZE * (1 + DEBUG_SLOT_SHELL)
753773

0 commit comments

Comments
 (0)