Skip to content

Commit 2bb6ea1

Browse files
committed
module_adapter: Separate generic_module_is_ready_to_process function
Extract generic code from the module_is_ready_to_process function which can be used by other adapters, in particular the userspace module adapter. Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
1 parent 4a43ca4 commit 2bb6ea1

File tree

1 file changed

+22
-10
lines changed
  • src/include/sof/audio/module_adapter/module

1 file changed

+22
-10
lines changed

src/include/sof/audio/module_adapter/module/generic.h

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -160,14 +160,33 @@ int module_prepare(struct processing_module *mod,
160160
struct sof_source **sources, int num_of_sources,
161161
struct sof_sink **sinks, int num_of_sinks);
162162

163+
static inline
164+
bool generic_module_is_ready_to_process(struct processing_module *mod,
165+
struct sof_source **sources,
166+
int num_of_sources,
167+
struct sof_sink **sinks,
168+
int num_of_sinks)
169+
{
170+
int i;
171+
172+
for (i = 0; i < num_of_sources; i++)
173+
if (source_get_data_available(sources[i]) < source_get_min_available(sources[i]))
174+
return false;
175+
176+
for (i = 0; i < num_of_sinks; i++)
177+
if (sink_get_free_size(sinks[i]) < sink_get_min_free_space(sinks[i]))
178+
return false;
179+
180+
return true;
181+
}
182+
163183
static inline
164184
bool module_is_ready_to_process(struct processing_module *mod,
165185
struct sof_source **sources,
166186
int num_of_sources,
167187
struct sof_sink **sinks,
168188
int num_of_sinks)
169189
{
170-
int i;
171190
const struct module_interface *const ops = mod->dev->drv->adapter_ops;
172191

173192
/* LL module has to be always ready for processing */
@@ -179,15 +198,8 @@ bool module_is_ready_to_process(struct processing_module *mod,
179198
/* default action - the module is ready if there's enough data for processing and enough
180199
* space to store result. IBS/OBS as declared in init_instance
181200
*/
182-
for (i = 0; i < num_of_sources; i++)
183-
if (source_get_data_available(sources[i]) < source_get_min_available(sources[i]))
184-
return false;
185-
186-
for (i = 0; i < num_of_sinks; i++)
187-
if (sink_get_free_size(sinks[i]) < sink_get_min_free_space(sinks[i]))
188-
return false;
189-
190-
return true;
201+
return generic_module_is_ready_to_process(mod, sources, num_of_sources, sinks,
202+
num_of_sinks);
191203
}
192204

193205
int module_process_sink_src(struct processing_module *mod,

0 commit comments

Comments
 (0)