mirror of https://github.com/thesofproject/sof.git
testbench: free components and pipeline after test results.
Move the comp free to after the results and free the pipeline. Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
This commit is contained in:
parent
777c0008c1
commit
305223a1f6
|
@ -56,6 +56,38 @@ int tb_pipeline_setup(struct sof *sof)
|
|||
return 0;
|
||||
}
|
||||
|
||||
struct ipc_data {
|
||||
struct ipc_data_host_buffer dh_buffer;
|
||||
};
|
||||
|
||||
void tb_pipeline_free(struct sof *sof)
|
||||
{
|
||||
struct schedule_data *sch;
|
||||
struct schedulers **schedulers;
|
||||
struct list_item *slist, *_slist;
|
||||
struct notify **notify = arch_notify_get();
|
||||
struct ipc_data *iipc;
|
||||
|
||||
free(sof->sa);
|
||||
free(*notify);
|
||||
|
||||
/* free all scheduler data */
|
||||
schedule_free();
|
||||
schedulers = arch_schedulers_get();
|
||||
list_for_item_safe(slist, _slist, &(*schedulers)->list) {
|
||||
sch = container_of(slist, struct schedule_data, list);
|
||||
free(sch);
|
||||
}
|
||||
free(*arch_schedulers_get());
|
||||
|
||||
/* free IPC data */
|
||||
iipc = sof->ipc->private;
|
||||
free(sof->ipc->comp_data);
|
||||
free(iipc->dh_buffer.page_table);
|
||||
free(iipc);
|
||||
free(sof->ipc);
|
||||
}
|
||||
|
||||
/* set up pcm params, prepare and trigger pipeline */
|
||||
int tb_pipeline_start(struct ipc *ipc, struct pipeline *p,
|
||||
struct testbench_prm *tp)
|
||||
|
|
|
@ -67,6 +67,7 @@ void sys_comp_file_init(void);
|
|||
void sys_comp_filewrite_init(void);
|
||||
|
||||
int tb_pipeline_setup(struct sof *sof);
|
||||
void tb_pipeline_free(struct sof *sof);
|
||||
|
||||
int tb_pipeline_start(struct ipc *ipc, struct pipeline *p,
|
||||
struct testbench_prm *tp);
|
||||
|
|
|
@ -158,20 +158,13 @@ static void free_comps(void)
|
|||
icd = container_of(clist, struct ipc_comp_dev, list);
|
||||
switch (icd->type) {
|
||||
case COMP_TYPE_COMPONENT:
|
||||
comp_free(icd->cd);
|
||||
list_item_del(&icd->list);
|
||||
rfree(icd);
|
||||
ipc_comp_free(sof_get()->ipc, icd->id);
|
||||
break;
|
||||
case COMP_TYPE_BUFFER:
|
||||
rfree(icd->cb->stream.addr);
|
||||
rfree(icd->cb);
|
||||
list_item_del(&icd->list);
|
||||
rfree(icd);
|
||||
ipc_buffer_free(sof_get()->ipc, icd->id);
|
||||
break;
|
||||
default:
|
||||
rfree(icd->pipeline);
|
||||
list_item_del(&icd->list);
|
||||
rfree(icd);
|
||||
ipc_pipeline_free(sof_get()->ipc, icd->id);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -385,9 +378,6 @@ int main(int argc, char **argv)
|
|||
t_exec = (double)(toc - tic) / CLOCKS_PER_SEC;
|
||||
c_realtime = (double)n_out / tp.channels / tp.fs_out / t_exec;
|
||||
|
||||
/* free all components/buffers in pipeline */
|
||||
free_comps();
|
||||
|
||||
/* print test summary */
|
||||
printf("==========================================================\n");
|
||||
printf(" Test Summary\n");
|
||||
|
@ -406,6 +396,12 @@ int main(int argc, char **argv)
|
|||
printf("Total execution time: %.2f us, %.2f x realtime\n",
|
||||
1e3 * t_exec, c_realtime);
|
||||
|
||||
/* free all components/buffers in pipeline */
|
||||
free_comps();
|
||||
|
||||
/* free other core FW services */
|
||||
tb_pipeline_free(sof_get());
|
||||
|
||||
/* free all other data */
|
||||
free(tp.bits_in);
|
||||
free(tp.input_file);
|
||||
|
|
Loading…
Reference in New Issue