Skip to content

Commit bd6abf0

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 1a19ba9 commit bd6abf0

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
@@ -163,14 +163,33 @@ int module_prepare(struct processing_module *mod,
163163
struct sof_source **sources, int num_of_sources,
164164
struct sof_sink **sinks, int num_of_sinks);
165165

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

176195
/* LL module has to be always ready for processing */
@@ -182,15 +201,8 @@ bool module_is_ready_to_process(struct processing_module *mod,
182201
/* default action - the module is ready if there's enough data for processing and enough
183202
* space to store result. IBS/OBS as declared in init_instance
184203
*/
185-
for (i = 0; i < num_of_sources; i++)
186-
if (source_get_data_available(sources[i]) < source_get_min_available(sources[i]))
187-
return false;
188-
189-
for (i = 0; i < num_of_sinks; i++)
190-
if (sink_get_free_size(sinks[i]) < sink_get_min_free_space(sinks[i]))
191-
return false;
192-
193-
return true;
204+
return generic_module_is_ready_to_process(mod, sources, num_of_sources, sinks,
205+
num_of_sinks);
194206
}
195207

196208
int module_process_sink_src(struct processing_module *mod,

0 commit comments

Comments
 (0)