Skip to content

Commit

Permalink
module: export symbols for loadable modules
Browse files Browse the repository at this point in the history
Export a number of symbols, commonly used by loadable modules.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
  • Loading branch information
lyakh authored and kv2019i committed Jan 9, 2024
1 parent 76926da commit 12d958a
Show file tree
Hide file tree
Showing 13 changed files with 78 additions and 1 deletion.
11 changes: 11 additions & 0 deletions posix/include/rtos/symbol.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/* SPDX-License-Identifier: BSD-3-Clause
*
* Copyright(c) 2023 Intel Corporation. All rights reserved.
*/

#ifndef __RTOS_SYMBOL_H__
#define __RTOS_SYMBOL_H__

#define EXPORT_SYMBOL(x)

#endif
2 changes: 2 additions & 0 deletions src/audio/component.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <sof/list.h>
#include <rtos/sof.h>
#include <rtos/string.h>
#include <rtos/symbol.h>
#include <ipc/topology.h>
#include <errno.h>
#include <stdbool.h>
Expand Down Expand Up @@ -49,6 +50,7 @@ int comp_register(struct comp_driver_info *drv)

return 0;
}
EXPORT_SYMBOL(comp_register);

void comp_unregister(struct comp_driver_info *drv)
{
Expand Down
4 changes: 4 additions & 0 deletions src/audio/data_blob.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <sof/audio/module_adapter/module/generic.h>
#include <rtos/sof.h>
#include <rtos/alloc.h>
#include <rtos/symbol.h>
#include <ipc/topology.h>
#include <ipc/control.h>
#include <sof/audio/component.h>
Expand Down Expand Up @@ -426,6 +427,7 @@ int ipc4_comp_data_blob_set(struct comp_data_blob_handler *blob_handler,

return 0;
}
EXPORT_SYMBOL(comp_data_blob_set);

int comp_data_blob_set_cmd(struct comp_data_blob_handler *blob_handler,
struct sof_ipc_ctrl_data *cdata)
Expand Down Expand Up @@ -645,6 +647,7 @@ comp_data_blob_handler_new_ext(struct comp_dev *dev, bool single_blob,

return handler;
}
EXPORT_SYMBOL(comp_data_blob_handler_new_ext);

void comp_data_blob_handler_free(struct comp_data_blob_handler *blob_handler)
{
Expand All @@ -655,3 +658,4 @@ void comp_data_blob_handler_free(struct comp_data_blob_handler *blob_handler)

rfree(blob_handler);
}
EXPORT_SYMBOL(comp_data_blob_handler_free);
15 changes: 14 additions & 1 deletion src/audio/module_adapter/module_adapter.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <sof/platform.h>
#include <sof/ut.h>
#include <rtos/interrupt.h>
#include <rtos/symbol.h>
#include <limits.h>
#include <stdint.h>

Expand Down Expand Up @@ -128,6 +129,7 @@ struct comp_dev *module_adapter_new(const struct comp_driver *drv,
rfree(dev);
return NULL;
}
EXPORT_SYMBOL(module_adapter_new);

#if CONFIG_ZEPHYR_DP_SCHEDULER
static int module_adapter_dp_queue_prepare(struct comp_dev *dev)
Expand Down Expand Up @@ -552,6 +554,7 @@ int module_adapter_prepare(struct comp_dev *dev)
mod->input_buffers = NULL;
return ret;
}
EXPORT_SYMBOL(module_adapter_prepare);

int module_adapter_params(struct comp_dev *dev, struct sof_ipc_stream_params *params)
{
Expand Down Expand Up @@ -591,6 +594,7 @@ int module_adapter_params(struct comp_dev *dev, struct sof_ipc_stream_params *pa

return 0;
}
EXPORT_SYMBOL(module_adapter_params);

/*
* Function to copy from source buffer to the module buffer
Expand Down Expand Up @@ -1243,6 +1247,7 @@ int module_adapter_copy(struct comp_dev *dev)
comp_err(dev, "module_adapter_copy(): unknown processing_data_type");
return -EINVAL;
}
EXPORT_SYMBOL(module_adapter_copy);

int module_adapter_trigger(struct comp_dev *dev, int cmd)
{
Expand All @@ -1268,6 +1273,7 @@ int module_adapter_trigger(struct comp_dev *dev, int cmd)

return module_adapter_set_state(mod, dev, cmd);
}
EXPORT_SYMBOL(module_adapter_trigger);

int module_adapter_reset(struct comp_dev *dev)
{
Expand Down Expand Up @@ -1341,6 +1347,7 @@ int module_adapter_reset(struct comp_dev *dev)

return comp_set_state(dev, COMP_TRIGGER_RESET);
}
EXPORT_SYMBOL(module_adapter_reset);

void module_adapter_free(struct comp_dev *dev)
{
Expand Down Expand Up @@ -1368,6 +1375,7 @@ void module_adapter_free(struct comp_dev *dev)
rfree(mod);
rfree(dev);
}
EXPORT_SYMBOL(module_adapter_free);

/*
* \brief Get DAI hw params
Expand All @@ -1390,6 +1398,7 @@ int module_adapter_get_hw_params(struct comp_dev *dev, struct sof_ipc_stream_par

return -EOPNOTSUPP;
}
EXPORT_SYMBOL(module_adapter_get_hw_params);

/*
* \brief Get stream position
Expand All @@ -1410,6 +1419,7 @@ int module_adapter_position(struct comp_dev *dev, struct sof_ipc_stream_posn *po

return -EOPNOTSUPP;
}
EXPORT_SYMBOL(module_adapter_position);

/*
* \brief DAI timestamp configure
Expand All @@ -1429,6 +1439,7 @@ int module_adapter_ts_config_op(struct comp_dev *dev)

return -EOPNOTSUPP;
}
EXPORT_SYMBOL(module_adapter_ts_config_op);

/*
* \brief DAI timestamp start
Expand All @@ -1448,6 +1459,7 @@ int module_adapter_ts_start_op(struct comp_dev *dev)

return -EOPNOTSUPP;
}
EXPORT_SYMBOL(module_adapter_ts_start_op);

/*
* \brief DAI timestamp stop
Expand All @@ -1467,6 +1479,7 @@ int module_adapter_ts_stop_op(struct comp_dev *dev)

return -EOPNOTSUPP;
}
EXPORT_SYMBOL(module_adapter_ts_stop_op);

/*
* \brief Get DAI timestamp
Expand All @@ -1491,4 +1504,4 @@ int module_adapter_ts_get_op(struct comp_dev *dev, struct timestamp_data *tsd)

return -EOPNOTSUPP;
}

EXPORT_SYMBOL(module_adapter_ts_get_op);
7 changes: 7 additions & 0 deletions src/audio/module_adapter/module_adapter_ipc4.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <sof/platform.h>
#include <sof/ut.h>
#include <rtos/interrupt.h>
#include <rtos/symbol.h>
#include <limits.h>
#include <stdint.h>

Expand Down Expand Up @@ -131,6 +132,7 @@ int module_set_large_config(struct comp_dev *dev, uint32_t param_id, bool first_
fragment_size, NULL, 0);
return 0;
}
EXPORT_SYMBOL(module_set_large_config);

int module_get_large_config(struct comp_dev *dev, uint32_t param_id, bool first_block,
bool last_block, uint32_t *data_offset_size, char *data)
Expand All @@ -157,6 +159,7 @@ int module_get_large_config(struct comp_dev *dev, uint32_t param_id, bool first_
(uint8_t *)data, fragment_size);
return 0;
}
EXPORT_SYMBOL(module_get_large_config);

int module_adapter_get_attribute(struct comp_dev *dev, uint32_t type, void *value)
{
Expand All @@ -173,6 +176,7 @@ int module_adapter_get_attribute(struct comp_dev *dev, uint32_t type, void *valu

return 0;
}
EXPORT_SYMBOL(module_adapter_get_attribute);

static bool module_adapter_multi_sink_source_prepare(struct comp_dev *dev)
{
Expand Down Expand Up @@ -226,6 +230,7 @@ int module_adapter_bind(struct comp_dev *dev, void *data)

return 0;
}
EXPORT_SYMBOL(module_adapter_bind);

int module_adapter_unbind(struct comp_dev *dev, void *data)
{
Expand All @@ -240,6 +245,7 @@ int module_adapter_unbind(struct comp_dev *dev, void *data)

return 0;
}
EXPORT_SYMBOL(module_adapter_unbind);

uint64_t module_adapter_get_total_data_processed(struct comp_dev *dev,
uint32_t stream_no, bool input)
Expand All @@ -255,6 +261,7 @@ uint64_t module_adapter_get_total_data_processed(struct comp_dev *dev,
else
return mod->total_data_consumed;
}
EXPORT_SYMBOL(module_adapter_get_total_data_processed);

int module_adapter_sink_src_prepare(struct comp_dev *dev)
{
Expand Down
2 changes: 2 additions & 0 deletions src/ipc/ipc-helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include <sof/platform.h>
#include <rtos/sof.h>
#include <rtos/spinlock.h>
#include <rtos/symbol.h>
#include <ipc/dai.h>
#include <ipc/header.h>
#include <ipc/stream.h>
Expand Down Expand Up @@ -160,6 +161,7 @@ int comp_verify_params(struct comp_dev *dev, uint32_t flag,

return 0;
}
EXPORT_SYMBOL(comp_verify_params);

int comp_buffer_connect(struct comp_dev *comp, uint32_t comp_core,
struct comp_buffer *buffer, uint32_t dir)
Expand Down
3 changes: 3 additions & 0 deletions src/ipc/ipc4/helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <sof/list.h>
#include <sof/platform.h>
#include <sof/schedule/ll_schedule_domain.h>
#include <rtos/symbol.h>
#include <rtos/wait.h>

/* TODO: Remove platform-specific code, see https://github.com/thesofproject/sof/issues/7549 */
Expand Down Expand Up @@ -1058,6 +1059,7 @@ void ipc4_base_module_cfg_to_stream_params(const struct ipc4_base_module_cfg *ba
for (i = 0; i < SOF_IPC_MAX_CHANNELS; i++)
params->chmap[i] = (base_cfg->audio_fmt.ch_map >> i * 4) & 0xf;
}
EXPORT_SYMBOL(ipc4_base_module_cfg_to_stream_params);

void ipc4_update_buffer_format(struct comp_buffer *buf_c,
const struct ipc4_audio_format *fmt)
Expand Down Expand Up @@ -1115,3 +1117,4 @@ void ipc4_update_sink_format(struct sof_sink *sink,
sink_set_valid_fmt(sink, valid_fmt);
sink_set_buffer_fmt(sink, fmt->interleaving_style);
}
EXPORT_SYMBOL(ipc4_update_buffer_format);
2 changes: 2 additions & 0 deletions src/math/numbers.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

#include <sof/audio/format.h>
#include <sof/math/numbers.h>
#include <rtos/symbol.h>
#include <stdint.h>

/* This function returns the greatest common divisor of two numbers
Expand Down Expand Up @@ -72,6 +73,7 @@ int gcd(int a, int b)
/* restore common factors of 2 */
return a << k;
}
EXPORT_SYMBOL(gcd);

#if CONFIG_NUMBERS_VECTOR_FIND

Expand Down
3 changes: 3 additions & 0 deletions src/module/audio/sink_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

#include <module/audio/sink_api.h>
#include <module/audio/audio_stream.h>
#include <rtos/symbol.h>

/* This file contains public sink API functions that were too large to mark is as inline. */

Expand All @@ -23,6 +24,7 @@ int sink_get_buffer(struct sof_sink *sink, size_t req_size,
sink->requested_write_frag_size = req_size;
return ret;
}
EXPORT_SYMBOL(sink_get_buffer);

int sink_commit_buffer(struct sof_sink *sink, size_t commit_size)
{
Expand All @@ -44,6 +46,7 @@ int sink_commit_buffer(struct sof_sink *sink, size_t commit_size)
sink->num_of_bytes_processed += commit_size;
return ret;
}
EXPORT_SYMBOL(sink_commit_buffer);

int sink_set_frm_fmt(struct sof_sink *sink, enum sof_ipc_frame frame_fmt)
{
Expand Down
3 changes: 3 additions & 0 deletions src/module/audio/source_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#include <module/audio/source_api.h>
#include <module/audio/audio_stream.h>
#include <rtos/symbol.h>

/* This file contains public source API functions that were too large to mark is as inline. */

Expand All @@ -23,6 +24,7 @@ int source_get_data(struct sof_source *source, size_t req_size,
source->requested_read_frag_size = req_size;
return ret;
}
EXPORT_SYMBOL(source_get_data);

int source_release_data(struct sof_source *source, size_t free_size)
{
Expand All @@ -44,6 +46,7 @@ int source_release_data(struct sof_source *source, size_t free_size)
source->num_of_bytes_processed += free_size;
return ret;
}
EXPORT_SYMBOL(source_release_data);

size_t source_get_frame_bytes(struct sof_source *source)
{
Expand Down
11 changes: 11 additions & 0 deletions xtos/include/rtos/symbol.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/* SPDX-License-Identifier: BSD-3-Clause
*
* Copyright(c) 2023 Intel Corporation. All rights reserved.
*/

#ifndef __RTOS_SYMBOL_H__
#define __RTOS_SYMBOL_H__

#define EXPORT_SYMBOL(x)

#endif
11 changes: 11 additions & 0 deletions zephyr/include/rtos/symbol.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/* SPDX-License-Identifier: BSD-3-Clause
*
* Copyright(c) 2023 Intel Corporation. All rights reserved.
*/

#ifndef __RTOS_SYMBOL_H__
#define __RTOS_SYMBOL_H__

#include <zephyr/llext/symbol.h>

#endif
5 changes: 5 additions & 0 deletions zephyr/lib/alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <sof/audio/pipeline.h>
#include <sof/audio/component_ext.h>
#include <sof/trace/trace.h>
#include <rtos/symbol.h>
#include <rtos/wait.h>

/* Zephyr includes */
Expand Down Expand Up @@ -272,6 +273,7 @@ void *rmalloc(enum mem_zone zone, uint32_t flags, uint32_t caps, size_t bytes)

return ptr;
}
EXPORT_SYMBOL(rmalloc);

/* Use SOF_MEM_ZONE_BUFFER at the moment */
void *rbrealloc_align(void *ptr, uint32_t flags, uint32_t caps, size_t bytes,
Expand Down Expand Up @@ -320,6 +322,7 @@ void *rzalloc(enum mem_zone zone, uint32_t flags, uint32_t caps, size_t bytes)

return ptr;
}
EXPORT_SYMBOL(rzalloc);

/**
* Allocates memory block from SOF_MEM_ZONE_BUFFER.
Expand All @@ -337,6 +340,7 @@ void *rballoc_align(uint32_t flags, uint32_t caps, size_t bytes,

return (__sparse_force void *)heap_alloc_aligned_cached(&sof_heap, align, bytes);
}
EXPORT_SYMBOL(rballoc_align);

/*
* Free's memory allocated by above alloc calls.
Expand All @@ -355,6 +359,7 @@ void rfree(void *ptr)

heap_free(&sof_heap, ptr);
}
EXPORT_SYMBOL(rfree);

static int heap_init(void)
{
Expand Down

0 comments on commit 12d958a

Please sign in to comment.