Sound Open Firmware
Loading...
Searching...
No Matches
debug_stream_slot.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-3-Clause
2 *
3 * Copyright(c) 2024 Intel Corporation.
4 */
5
12#ifndef __SOC_DEBUG_WINDOW_SLOT_H__
13#define __SOC_DEBUG_WINDOW_SLOT_H__
14
15#include <user/debug_stream.h>
16
17/*
18 * This file describes how Debug Stream can be transported over debug
19 * window memory slot. The debug stream is an abstract media API for
20 * passing debug data records from SOF DSP to the host system for
21 * presentation. The debug stream records are described in debug_stream.h.
22 *
23 * This example describes how Debug Stream data is transferred from
24 * DSP to host side using a debug memory window slot. To learn more
25 * see soc/intel/intel_adsp/common/include/adsp_debug_window.h
26 * under Zephyr source tree.
27 *
28 * DEBUG_STREAM slot is reserved from SRAM window and a header is
29 * written in the beginning of the slot. The header is a static data
30 * structure that is initialized once at DSP boot time. All elements
31 * in bellow example are 32-bit unsigned integers:
32 *
33 * --------------------------------------------------
34 * | id = DEBUG_STREAM_IDENTIFIER |
35 * | total_size = 4096 |
36 * | num_sections = CONFIG_MP_MAX_NUM_CPUS * |
37 * | section_descriptor [] = { |
38 * | { |
39 * | core_id = 0 |
40 * | size = 1344 |
41 * | offset = 64 |
42 * | } |
43 * | { |
44 * | core_id = 1 |
45 * | size = 1344 |
46 * | offset = 1344+64 |
47 * | } |
48 * | { |
49 * | core_id = 2 |
50 * | size = 1344 |
51 * | offset = 2*1344+64 |
52 * | } |
53 * | } |
54 * | <padding> |
55 * -------------------------------------------------- n * 64 bytes
56 * * CONFIG_MP_MAX_NUM_CPUS is 3 in this example
57 *
58 * The header contains generic information like identifier, total
59 * size, and number of sections. After the generic fields there is an
60 * array of section descriptors. The array has 'num_sections' number
61 * of elements. Each element in the array describes a circular buffer,
62 * one for each DSP core.
63 *
64 * The remaining memory in the debug window slot is divided between
65 * those sections. The buffers are not necessarily of equal size, like
66 * in this example. The circular buffers are all cache line aligned,
67 * 64 in this example. One section looks like this:
68 *
69 * -------------------------------------------------- ---
70 * | next_seqno = <counter for written objects> | |
71 * | w_ptr = <write position in 32-bit words> | 1344 bytes
72 * | buffer_data[1344/4-2] = { | |
73 * | <debug data records> | |
74 * | } | |
75 * -------------------------------------------------- ---
76 *
77 * The data records are described in debug_strem.h. In the case of
78 * debug window memory slot the next record should always be aligned
79 * to word (4-byte) boundary.
80 *
81 * The debug stream writes the records of abstract data to the
82 * circular buffer, and updates the w_ptr when the record is
83 * completely written. The host side receiver tries to keep up with the
84 * w_ptr and keeps track of its read position.
85 *
86 * The size of the record is written - again - after each record and
87 * before the next. This is to allow parsing the stream backwards in
88 * an overrun recovery situation. The w_ptr value is updated last,
89 * when the record is completely written.
90 */
91
92#include <stdint.h>
93
105 uint32_t core_id;
106 uint32_t buf_words;
107 uint32_t offset;
108} __packed;
109
120
126 uint32_t next_seqno;
127 uint32_t w_ptr;
128 uint32_t data[];
129} __aligned(CONFIG_DCACHE_LINE_SIZE);
130
132
140
141#include <zephyr/syscalls/debug_stream_slot.h>
142
143#endif /* __SOC_DEBUG_WINDOW_SLOT_H__ */
User-space ABI stream protocol for passing abstract debug data objects to host.
int debug_stream_slot_send_record(struct debug_stream_record *rec)
Send a debug stream record over the memory window debug slot.
Per-core circular buffer layout within a debug stream slot.
Definition debug_stream_slot.h:125
uint32_t data[]
Circular data buffer holding stream records.
Definition debug_stream_slot.h:128
uint32_t next_seqno
Sequence counter of next record to write.
Definition debug_stream_slot.h:126
uint32_t w_ptr
Current write position in 32-bit words.
Definition debug_stream_slot.h:127
Stream preamble header recognized by host debug tools.
Definition debug_stream.h:22
Abstract debug record envelope carrying application-specific payloads.
Definition debug_stream.h:31
Core-specific section descriptor within the debug window slot.
Definition debug_stream_slot.h:104
uint32_t core_id
Reporting DSP core identifier.
Definition debug_stream_slot.h:105
uint32_t buf_words
Circular buffer data capacity in 32-bit words.
Definition debug_stream_slot.h:106
uint32_t offset
Byte offset from slot base (4-byte aligned)
Definition debug_stream_slot.h:107
Preamble header placed at the beginning of Memory Window 2 Debug Slot.
Definition debug_stream_slot.h:114
uint32_t num_sections
Number of active core-specific sections.
Definition debug_stream_slot.h:117
uint32_t total_size
Total size of payload across all core sections.
Definition debug_stream_slot.h:116
struct debug_stream_hdr hdr
Base stream identifier and size.
Definition debug_stream_slot.h:115
struct debug_stream_section_descriptor section_desc[]
Array of per-core section descriptors.
Definition debug_stream_slot.h:118