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
6#ifndef __SOC_DEBUG_WINDOW_SLOT_H__
7#define __SOC_DEBUG_WINDOW_SLOT_H__
8
9#include <user/debug_stream.h>
10
11/*
12 * This file describes how Debug Stream can be transported over debug
13 * window memory slot. The debug stream is an abstract media API for
14 * passing debug data records from SOF DSP to the host system for
15 * presentation. The debug stream records are described in debug_stream.h.
16 *
17 * This example describes how Debug Stream data is transferred from
18 * DSP to host side using a debug memory window slot. To learn more
19 * see soc/intel/intel_adsp/common/include/adsp_debug_window.h
20 * under Zephyr source tree.
21 *
22 * DEBUG_STREAM slot is reserved from SRAM window and a header is
23 * written in the beginning of the slot. The header is a static data
24 * structure that is initialized once at DSP boot time. All elements
25 * in bellow example are 32-bit unsigned integers:
26 *
27 * --------------------------------------------------
28 * | id = DEBUG_STREAM_IDENTIFIER |
29 * | total_size = 4096 |
30 * | num_sections = CONFIG_MP_MAX_NUM_CPUS * |
31 * | section_descriptor [] = { |
32 * | { |
33 * | core_id = 0 |
34 * | size = 1344 |
35 * | offset = 64 |
36 * | } |
37 * | { |
38 * | core_id = 1 |
39 * | size = 1344 |
40 * | offset = 1344+64 |
41 * | } |
42 * | { |
43 * | core_id = 2 |
44 * | size = 1344 |
45 * | offset = 2*1344+64 |
46 * | } |
47 * | } |
48 * | <padding> |
49 * -------------------------------------------------- n * 64 bytes
50 * * CONFIG_MP_MAX_NUM_CPUS is 3 in this example
51 *
52 * The header contains generic information like identifier, total
53 * size, and number of sections. After the generic fields there is an
54 * array of section descriptors. The array has 'num_sections' number
55 * of elements. Each element in the array describes a circular buffer,
56 * one for each DSP core.
57 *
58 * The remaining memory in the debug window slot is divided between
59 * those sections. The buffers are not necessarily of equal size, like
60 * in this example. The circular buffers are all cache line aligned,
61 * 64 in this example. One section looks like this:
62 *
63 * -------------------------------------------------- ---
64 * | next_seqno = <counter for written objects> | |
65 * | w_ptr = <write position in 32-bit words> | 1344 bytes
66 * | buffer_data[1344/4-2] = { | |
67 * | <debug data records> | |
68 * | } | |
69 * -------------------------------------------------- ---
70 *
71 * The data records are described in debug_strem.h. In the case of
72 * debug window memory slot the next record should always be aligned
73 * to word (4-byte) boundary.
74 *
75 * The debug stream writes the records of abstract data to the
76 * circular buffer, and updates the w_ptr when the record is
77 * completely written. The host side receiver tries to keep up with the
78 * w_ptr and keeps track of its read position.
79 *
80 * The size of the record is written - again - after each record and
81 * before the next. This is to allow parsing the stream backwards in
82 * an overrun recovery situation. The w_ptr value is updated last,
83 * when the record is completely written.
84 */
85
86#include <stdint.h>
87
88/* Core specific section descriptor
89 *
90 * Section descriptor defines core ID, offset and size of the circular
91 * buffer in the debug window slot.
92 */
94 uint32_t core_id; /* Core ID */
95 uint32_t buf_words; /* Circular buffer size in 32-bit words */
96 uint32_t offset; /* Core section offset */
98
99/* Debug window slot header for Debug Stream.
100 *
101 * The header should be written in the beginning of the slot.
102 */
105 uint32_t total_size; /* total size of payload including all sections */
106 uint32_t num_sections; /* number of core specific sections */
108} __packed;
109
111 uint32_t next_seqno;
112 uint32_t w_ptr;
113 uint32_t data[];
114} __aligned(CONFIG_DCACHE_LINE_SIZE);
115
131
132#include <zephyr/syscalls/debug_stream_slot.h>
133
134#endif /* __SOC_DEBUG_WINDOW_SLOT_H__ */
__syscall int debug_stream_slot_send_record(struct debug_stream_record *rec)
Send debug stream records over debug window slot.
#define __packed
Definition ext_manifest.h:43
Definition debug_stream_slot.h:110
uint32_t data[]
Definition debug_stream_slot.h:113
uint32_t next_seqno
Definition debug_stream_slot.h:111
uint32_t w_ptr
Definition debug_stream_slot.h:112
Definition debug_stream.h:22
Definition debug_stream.h:41
Definition debug_stream_slot.h:93
uint32_t core_id
Definition debug_stream_slot.h:94
uint32_t buf_words
Definition debug_stream_slot.h:95
uint32_t offset
Definition debug_stream_slot.h:96
Definition debug_stream_slot.h:103
uint32_t num_sections
Definition debug_stream_slot.h:106
uint32_t total_size
Definition debug_stream_slot.h:105
struct debug_stream_hdr hdr
Definition debug_stream_slot.h:104
struct debug_stream_section_descriptor section_desc[]
Definition debug_stream_slot.h:107
#define __aligned(x)
Definition compiler_attributes.h:27