Repository navigation
Expand file tree
/
Copy pathsrc.c
More file actions
111 lines (89 loc) · 3.17 KB
/
Copy pathsrc.c
File metadata and controls
111 lines (89 loc) · 3.17 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
// SPDX-License-Identifier: BSD-3-Clause
//
// Copyright(c) 2024 Intel Corporation. All rights reserved.
//
// Author: Tobiasz Dryjanski <tobiaszx.dryjanski@intel.com>
/*
* This file has been extracted from src_common.c (formerly src.c)
* to create separation between defines in different src types.
*/
#include <rtos/init.h>
#include "src_common.h"
#include "src_config.h"
#if SRC_SHORT || CONFIG_COMP_SRC_TINY
#include "coef/src_tiny_int16_define.h"
#include "coef/src_tiny_int16_table.h"
#elif CONFIG_COMP_SRC_SMALL
#include "coef/src_small_int32_define.h"
#include "coef/src_small_int32_table.h"
#elif CONFIG_COMP_SRC_STD
#include "coef/src_std_int32_define.h"
#include "coef/src_std_int32_table.h"
#elif CONFIG_COMP_SRC_IPC4_FULL_MATRIX
#include "coef/src_ipc4_int32_define.h"
#include "coef/src_ipc4_int32_table.h"
#else
#error "No valid configuration selected for SRC"
#endif
LOG_MODULE_DECLARE(src, CONFIG_SOF_LOG_LEVEL);
static int src_prepare(struct processing_module *mod,
struct sof_source **sources, int num_of_sources,
struct sof_sink **sinks, int num_of_sinks)
{
struct comp_data *cd = module_get_private_data(mod);
struct src_param *a = &cd->param;
int ret;
comp_info(mod->dev, "src_prepare()");
if (num_of_sources != 1 || num_of_sinks != 1)
return -EINVAL;
a->in_fs = src_in_fs;
a->out_fs = src_out_fs;
a->num_in_fs = NUM_IN_FS;
a->num_out_fs = NUM_OUT_FS;
a->max_fir_delay_size_xnch = (PLATFORM_MAX_CHANNELS * MAX_FIR_DELAY_SIZE);
a->max_out_delay_size_xnch = (PLATFORM_MAX_CHANNELS * MAX_OUT_DELAY_SIZE);
src_get_source_sink_params(mod->dev, sources[0], sinks[0]);
ret = src_param_set(mod->dev, cd);
if (ret < 0)
return ret;
a->stage1 = src_table1[a->idx_out][a->idx_in];
a->stage2 = src_table2[a->idx_out][a->idx_in];
ret = src_params_general(mod, sources[0], sinks[0]);
if (ret < 0)
return ret;
return src_prepare_general(mod, sources[0], sinks[0]);
}
static const struct module_interface src_interface = {
.init = src_init,
.prepare = src_prepare,
.process = src_process,
.is_ready_to_process = src_is_ready_to_process,
.set_configuration = src_set_config,
.get_configuration = src_get_config,
.reset = src_reset,
.free = src_free,
};
DECLARE_MODULE_ADAPTER(src_interface, SRC_UUID, src_tr);
SOF_MODULE_INIT(src, sys_comp_module_src_interface_init);
#if CONFIG_COMP_SRC_MODULE
/* modular: llext dynamic link */
#include <module/module/api_ver.h>
#include <module/module/llext.h>
#include <rimage/sof/user/manifest.h>
#define UUID_SRC 0x8D, 0xB2, 0x1B, 0xE6, 0x9A, 0x14, 0x1F, 0x4C, \
0xB7, 0x09, 0x46, 0x82, 0x3E, 0xF5, 0xF5, 0xAE
SOF_LLEXT_MOD_ENTRY(src, &src_interface);
#if CONFIG_COMP_SRC_LITE
#define UUID_SRC_LITE 0x51, 0x10, 0x44, 0x33, 0xCD, 0x44, 0x6A, 0x46, \
0x83, 0xA3, 0x17, 0x84, 0x78, 0x70, 0x8A, 0xEA
extern const struct module_interface src_lite_interface;
SOF_LLEXT_MOD_ENTRY(src_lite, &src_lite_interface);
#endif
static const struct sof_man_module_manifest mod_manifest[] __section(".module") __used = {
SOF_LLEXT_MODULE_MANIFEST("SRC", src_llext_entry, 1, UUID_SRC, 1),
#if CONFIG_COMP_SRC_LITE
SOF_LLEXT_MODULE_MANIFEST("SRC_LITE", src_lite_llext_entry, 1, UUID_SRC_LITE, 1),
#endif
};
SOF_LLEXT_BUILDINFO;
#endif