Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/audio/copier/copier.c
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ static int do_conversion_copy(struct comp_dev *dev,

comp_get_copy_limits(src, sink, processed_data);

i = IPC4_SINK_QUEUE_ID(sink->id);
i = IPC4_SINK_QUEUE_ID(buf_get_id(sink));
if (i >= IPC4_COPIER_MODULE_OUTPUT_PINS_COUNT)
return -EINVAL;
buffer_stream_invalidate(src, processed_data->source_bytes);
Expand Down Expand Up @@ -483,7 +483,7 @@ static int copier_module_copy(struct processing_module *mod,
uint32_t samples;
int sink_queue_id;

sink_queue_id = IPC4_SINK_QUEUE_ID(sink_c->id);
sink_queue_id = IPC4_SINK_QUEUE_ID(buf_get_id(sink_c));
if (sink_queue_id >= IPC4_COPIER_MODULE_OUTPUT_PINS_COUNT)
return -EINVAL;

Expand Down Expand Up @@ -668,7 +668,7 @@ static int copier_set_sink_fmt(struct comp_dev *dev, const void *data,

sink = container_of(sink_list, struct comp_buffer, source_list);

sink_id = IPC4_SINK_QUEUE_ID(sink->id);
sink_id = IPC4_SINK_QUEUE_ID(buf_get_id(sink));
if (sink_id == sink_fmt->sink_id) {
ipc4_update_buffer_format(sink, &sink_fmt->sink_fmt);
break;
Expand Down
2 changes: 1 addition & 1 deletion src/audio/copier/copier_generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ void copier_update_params(struct copier_data *cd, struct comp_dev *dev,

sink = container_of(sink_list, struct comp_buffer, source_list);

j = IPC4_SINK_QUEUE_ID(sink->id);
j = IPC4_SINK_QUEUE_ID(buf_get_id(sink));

ipc4_update_buffer_format(sink, &cd->out_fmt[j]);
}
Expand Down
4 changes: 2 additions & 2 deletions src/audio/dai-zephyr.c
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ dai_dma_cb(struct dai_data *dd, struct comp_dev *dev, uint32_t bytes,

sink_dev = sink->sink;

j = IPC4_SINK_QUEUE_ID(sink->id);
j = IPC4_SINK_QUEUE_ID(buf_get_id(sink));

if (j >= IPC4_COPIER_MODULE_OUTPUT_PINS_COUNT) {
comp_err(dev, "Sink queue ID: %d >= max output pin count: %d\n",
Expand Down Expand Up @@ -1635,7 +1635,7 @@ int dai_zephyr_unbind(struct dai_data *dd, struct comp_dev *dev, void *data)
buf_id = IPC4_COMP_ID(bu->extension.r.src_queue, bu->extension.r.dst_queue);

if (dd && dd->local_buffer) {
if (dd->local_buffer->id == buf_id) {
if (buf_get_id(dd->local_buffer) == buf_id) {
comp_dbg(dev, "dai_zephyr_unbind: local_buffer %x unbound", buf_id);
dd->local_buffer = NULL;
}
Expand Down
8 changes: 5 additions & 3 deletions src/audio/dp_queue.c
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,8 @@ static const struct sink_ops dp_queue_sink_ops = {
.audio_set_ipc_params = dp_queue_set_ipc_params_sink,
};

struct dp_queue *dp_queue_create(size_t min_available, size_t min_free_space, uint32_t flags)
struct dp_queue *dp_queue_create(size_t min_available, size_t min_free_space, uint32_t flags,
uint32_t id)
{
struct dp_queue *dp_queue;

Expand Down Expand Up @@ -286,8 +287,9 @@ struct dp_queue *dp_queue_create(size_t min_available, size_t min_free_space, ui
if (!dp_queue->_data_buffer)
goto err;

tr_info(&dp_queue_tr, "DpQueue created, shared: %u min_available: %u min_free_space %u, size %u",
dp_queue_is_shared(dp_queue), min_available, min_free_space,
dp_queue->audio_stream_params.id = id;
tr_info(&dp_queue_tr, "DpQueue created, id: %u shared: %u min_available: %u min_free_space %u, size %u",
id, dp_queue_is_shared(dp_queue), min_available, min_free_space,
dp_queue->data_buffer_size);

/* return a pointer to allocated structure */
Expand Down
3 changes: 2 additions & 1 deletion src/audio/google/google_rtc_audio_processing.c
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,8 @@ static int google_rtc_audio_processing_prepare(struct processing_module *mod,
struct comp_buffer *source = container_of(source_buffer_list_item,
struct comp_buffer, sink_list);
#if CONFIG_IPC_MAJOR_4
if (IPC4_SINK_QUEUE_ID(source->id) == SOF_AEC_FEEDBACK_QUEUE_ID) {
if (IPC4_SINK_QUEUE_ID(buf_get_id(source)) ==
SOF_AEC_FEEDBACK_QUEUE_ID) {
#else
if (source->source->pipeline->pipeline_id != dev->pipeline->pipeline_id) {
#endif
Expand Down
4 changes: 2 additions & 2 deletions src/audio/kpb.c
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ static int kpb_bind(struct comp_dev *dev, void *data)
break;
}

sink_buf_id = sink->id;
sink_buf_id = buf_get_id(sink);

if (sink_buf_id == buf_id) {
if (sink_buf_id == 0)
Expand Down Expand Up @@ -903,7 +903,7 @@ static int kpb_prepare(struct comp_dev *dev)

audio_stream_init_alignment_constants(byte_align, frame_align_req,
&sink->stream);
sink_id = sink->id;
sink_id = buf_get_id(sink);

if (sink_id == 0)
audio_stream_set_channels(&sink->stream, kpb->num_of_sel_mic);
Expand Down
4 changes: 2 additions & 2 deletions src/audio/mixin_mixout/mixin_mixout.c
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ static int mixin_process(struct processing_module *mod,
unused_in_between_buf_c = container_of(output_buffers[i].data,
struct comp_buffer, stream);
mixout = unused_in_between_buf_c->sink;
sink_id = IPC4_SRC_QUEUE_ID(unused_in_between_buf_c->id);
sink_id = IPC4_SRC_QUEUE_ID(buf_get_id(unused_in_between_buf_c));

active_mixouts[i] = mixout;
sinks_ids[i] = sink_id;
Expand Down Expand Up @@ -570,7 +570,7 @@ static int mixin_params(struct processing_module *mod)
/* Applying channel remapping may produce sink stream with channel count
* different from source channel count.
*/
sink_id = IPC4_SRC_QUEUE_ID(sink->id);
sink_id = IPC4_SRC_QUEUE_ID(buf_get_id(sink));
if (sink_id >= MIXIN_MAX_SINKS) {
comp_err(dev, "Sink index out of range: %u, max sink count: %u",
(uint32_t)sink_id, MIXIN_MAX_SINKS);
Expand Down
46 changes: 29 additions & 17 deletions src/audio/module_adapter/module_adapter.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,9 @@ static int module_adapter_dp_queue_prepare(struct comp_dev *dev)
* first, set all parameters by calling "module prepare" with pointers to
* "main" audio_stream buffers
*/
list_init(&mod->dp_queue_ll_to_dp_list);
list_init(&mod->dp_queue_dp_to_ll_list);

ret = module_adapter_sink_src_prepare(dev);
if (ret)
return ret;
Expand All @@ -177,7 +180,6 @@ static int module_adapter_dp_queue_prepare(struct comp_dev *dev)
* and copy stream parameters to shadow buffers
*/
i = 0;
list_init(&mod->dp_queue_ll_to_dp_list);
list_for_item(blist, &dev->bsource_list) {
struct comp_buffer *source_buffer =
container_of(blist, struct comp_buffer, sink_list);
Expand All @@ -189,7 +191,8 @@ static int module_adapter_dp_queue_prepare(struct comp_dev *dev)
sink_get_min_free_space(audio_stream_get_sink(&source_buffer->stream));

/* create a shadow dp queue */
dp_queue = dp_queue_create(min_available, min_free_space, dp_mode);
dp_queue = dp_queue_create(min_available, min_free_space, dp_mode,
buf_get_id(source_buffer));

if (!dp_queue)
goto err;
Expand All @@ -211,7 +214,6 @@ static int module_adapter_dp_queue_prepare(struct comp_dev *dev)
unsigned int period = UINT32_MAX;

i = 0;
list_init(&mod->dp_queue_dp_to_ll_list);
list_for_item(blist, &dev->bsink_list) {
struct comp_buffer *sink_buffer =
container_of(blist, struct comp_buffer, source_list);
Expand All @@ -223,7 +225,8 @@ static int module_adapter_dp_queue_prepare(struct comp_dev *dev)
sink_get_min_free_space(audio_stream_get_sink(&sink_buffer->stream));

/* create a shadow dp queue */
dp_queue = dp_queue_create(min_available, min_free_space, dp_mode);
dp_queue = dp_queue_create(min_available, min_free_space, dp_mode,
buf_get_id(sink_buffer));

if (!dp_queue)
goto err;
Expand Down Expand Up @@ -1068,24 +1071,33 @@ static int module_adapter_copy_dp_queues(struct comp_dev *dev)
dp_queue = dp_queue_get_next_item(dp_queue);
}

dp_queue = dp_queue_get_first_item(&mod->dp_queue_dp_to_ll_list);
list_for_item(blist, &dev->bsink_list) {
if (!mod->DP_startup_delay) {
Comment thread
marcinszkudlinski marked this conversation as resolved.
dp_queue = dp_queue_get_first_item(&mod->dp_queue_dp_to_ll_list);
list_for_item(blist, &dev->bsink_list) {
/* output - we need to copy data from dp_queue (as source)
* to audio_stream (as sink)
*/
assert(dp_queue);
struct comp_buffer *buffer =
container_of(blist, struct comp_buffer, source_list);
struct sof_sink *data_sink = audio_stream_get_sink(&buffer->stream);
struct sof_source *data_src = dp_queue_get_source(dp_queue);
uint32_t to_copy = MIN(sink_get_free_size(data_sink),
source_get_data_available(data_src));
assert(dp_queue);
struct comp_buffer *buffer =
container_of(blist, struct comp_buffer, source_list);
struct sof_sink *data_sink = audio_stream_get_sink(&buffer->stream);
struct sof_source *following_mod_data_source =
audio_stream_get_source(&buffer->stream);
struct sof_source *data_src = dp_queue_get_source(dp_queue);
size_t dp_data_available = source_get_data_available(data_src);

err = source_to_sink_copy(data_src, data_sink, true, to_copy);
if (err)
return err;
if (!dp_data_available)
comp_err(dev, "!!!! no data available from DP");

dp_queue = dp_queue_get_next_item(dp_queue);
uint32_t to_copy = MIN(source_get_min_available(following_mod_data_source),
dp_data_available);

err = source_to_sink_copy(data_src, data_sink, true, to_copy);
return err;

dp_queue = dp_queue_get_next_item(dp_queue);

}
}
return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion src/audio/mux/mux.c
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ static void set_mux_params(struct processing_module *mod)
source = container_of(source_list, struct comp_buffer, sink_list);
audio_stream_init_alignment_constants(byte_align, frame_align_req,
&source->stream);
j = source->id;
j = buf_get_id(source);
cd->config.streams[j].pipeline_id = source->pipeline_id;
if (j == BASE_CFG_QUEUED_ID)
audio_fmt = &cd->md.base_cfg.audio_fmt;
Expand Down
8 changes: 4 additions & 4 deletions src/audio/pipeline/pipeline-graph.c
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,9 @@ int pipeline_connect(struct comp_dev *comp, struct comp_buffer *buffer,
uint32_t flags;

if (dir == PPL_CONN_DIR_COMP_TO_BUFFER)
comp_info(comp, "connect buffer %d as sink", buffer->id);
comp_info(comp, "connect buffer %d as sink", buf_get_id(buffer));
else
comp_info(comp, "connect buffer %d as source", buffer->id);
comp_info(comp, "connect buffer %d as source", buf_get_id(buffer));

irq_local_disable(flags);

Expand All @@ -202,9 +202,9 @@ void pipeline_disconnect(struct comp_dev *comp, struct comp_buffer *buffer, int
uint32_t flags;

if (dir == PPL_CONN_DIR_COMP_TO_BUFFER)
comp_dbg(comp, "disconnect buffer %d as sink", buffer->id);
comp_dbg(comp, "disconnect buffer %d as sink", buf_get_id(buffer));
else
comp_dbg(comp, "disconnect buffer %d as source", buffer->id);
comp_dbg(comp, "disconnect buffer %d as source", buf_get_id(buffer));

irq_local_disable(flags);

Expand Down
3 changes: 2 additions & 1 deletion src/audio/rtnr/rtnr.c
Original file line number Diff line number Diff line change
Expand Up @@ -780,7 +780,8 @@ static int rtnr_copy(struct comp_dev *dev)
/* Process integer multiple of RTNR internal block length */
frames = frames & ~RTNR_BLK_LENGTH_MASK;

comp_dbg(dev, "rtnr_copy() source->id: %d, frames = %d", source->id, frames);
comp_dbg(dev, "rtnr_copy() source_id: %d, frames = %d", buf_get_id(source),
frames);

if (frames) {
source_bytes = frames * audio_stream_frame_bytes(&source->stream);
Expand Down
6 changes: 6 additions & 0 deletions src/audio/sink_api_helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -185,3 +185,9 @@ size_t sink_get_min_free_space(struct sof_sink *sink)
{
return sink->min_free_space;
}

uint32_t sink_get_id(struct sof_sink *sink)
{
return sink->audio_stream_params->id;
}

13 changes: 13 additions & 0 deletions src/audio/source_api_helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,14 @@ bool source_get_underrun(struct sof_source *source)
return source->audio_stream_params->underrun_permitted;
}

int source_set_frm_fmt(struct sof_source *source, enum sof_ipc_frame frm_fmt)
{
source->audio_stream_params->frame_fmt = frm_fmt;
if (source->ops->on_audio_format_set)
return source->ops->on_audio_format_set(source);
return 0;
}

int source_set_valid_fmt(struct sof_source *source,
enum sof_ipc_frame valid_sample_fmt)
{
Expand Down Expand Up @@ -175,3 +183,8 @@ size_t source_get_min_available(struct sof_source *source)
{
return source->min_available;
}

uint32_t source_get_id(struct sof_source *source)
{
return source->audio_stream_params->id;
}
14 changes: 14 additions & 0 deletions src/idc/zephyr_idc.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,16 @@
#include <rtos/alloc.h>
#include <rtos/spinlock.h>
#include <ipc/topology.h>
#include <sof/trace/trace.h>
#include <sof/lib/uuid.h>

LOG_MODULE_REGISTER(zephyr_idc, CONFIG_SOF_LOG_LEVEL);

/* 5f1ec3f8-faaf-4099-903c-cee98351f169 */
DECLARE_SOF_UUID("zephyr-idc", zephyr_idc_uuid, 0x5f1ec3f8, 0xfaaf, 0x4099,
0x90, 0x3c, 0xce, 0xe9, 0x83, 0x51, 0xf1, 0x69);

DECLARE_TR_CTX(zephyr_idc_tr, SOF_UUID(zephyr_idc_uuid), LOG_LEVEL_INFO);

/*
* Inter-CPU communication is only used in
Expand Down Expand Up @@ -119,6 +129,10 @@ int idc_send_msg(struct idc_msg *msg, uint32_t mode)
work->handler = idc_handler;
work->sync = mode == IDC_BLOCKING;

if (!cpu_is_core_enabled(target_cpu)) {
tr_err(&zephyr_idc_tr, "Core %u is down, cannot sent IDC message", target_cpu);
return -EACCES;
}
if (msg->payload) {
idc_send_memcpy_err = memcpy_s(payload->data, sizeof(payload->data),
msg->payload, msg->size);
Expand Down
6 changes: 6 additions & 0 deletions src/include/ipc4/base-config.h
Original file line number Diff line number Diff line change
Expand Up @@ -244,5 +244,11 @@ void ipc4_base_module_cfg_to_stream_params(const struct ipc4_base_module_cfg *ba
struct comp_buffer;
void ipc4_update_buffer_format(struct comp_buffer *buf_c,
const struct ipc4_audio_format *fmt);
struct sof_source;
void ipc4_update_source_format(struct sof_source *source,
const struct ipc4_audio_format *fmt);
struct sof_sink;
void ipc4_update_sink_format(struct sof_sink *sink,
const struct ipc4_audio_format *fmt);

#endif
1 change: 1 addition & 0 deletions src/include/sof/audio/audio_stream.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
* TODO: compressed formats
*/
struct sof_audio_stream_params {
uint32_t id;
enum sof_ipc_frame frame_fmt; /**< Sample data format */
enum sof_ipc_frame valid_sample_fmt;

Expand Down
Loading