forked from thesofproject/sof
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug_stream_text_msg.c
More file actions
37 lines (30 loc) · 807 Bytes
/
debug_stream_text_msg.c
File metadata and controls
37 lines (30 loc) · 807 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// SPDX-License-Identifier: BSD-3-Clause
//
// Copyright(c) 2024 Intel Corporation.
#include <sys/types.h>
#include <stdarg.h>
#include <stdio.h>
#include <soc.h>
#include <adsp_debug_window.h>
#include <sof/common.h>
#include <user/debug_stream_text_msg.h>
void ds_msg(const char *format, ...)
{
va_list args;
struct {
struct debug_stream_text_msg msg;
char text[128];
} __packed buf = { 0 };
ssize_t len;
va_start(args, format);
len = vsnprintf(buf.text, sizeof(buf.text), format, args);
va_end(args);
if (len < 0)
return;
len = MIN(len, sizeof(buf.text));
buf.msg.hdr.id = DEBUG_STREAM_RECORD_ID_TEXT_MSG;
buf.msg.hdr.size_words = SOF_DIV_ROUND_UP(sizeof(buf.msg) + len,
sizeof(buf.msg.hdr.data[0]));
debug_stream_slot_send_record(&buf.msg.hdr);
}
EXPORT_SYMBOL(ds_msg);