1 /* SPDX-License-Identifier: BSD-3-Clause 2 * 3 * Copyright(c) 2018 Intel Corporation. All rights reserved. 4 */ 5 6 #ifndef _COMMON_TEST_H 7 #define _COMMON_TEST_H 8 9 #include <stdint.h> 10 #include <stddef.h> 11 #include <stdbool.h> 12 #include <time.h> 13 #include <stdio.h> 14 #include <rtos/sof.h> 15 #include <sof/audio/component_ext.h> 16 #include <sof/math/numbers.h> 17 #include <sof/audio/format.h> 18 19 #include <sof/lib/uuid.h> 20 21 #define DEBUG_MSG_LEN 1024 22 #define MAX_LIB_NAME_LEN 1024 23 24 #define MAX_INPUT_FILE_NUM 16 25 #define MAX_OUTPUT_FILE_NUM 16 26 27 /* number of widgets types supported in testbench */ 28 #define NUM_WIDGETS_SUPPORTED 16 29 30 struct tplg_context; 31 32 /* 33 * Global testbench data. 34 * 35 * TODO: some items are topology and pipeline specific and need moved out 36 * into per pipeline data and per topology data structures. 37 */ 38 struct testbench_prm { 39 char *tplg_file; /* topology file to use */ 40 char *input_file[MAX_INPUT_FILE_NUM]; /* input file names */ 41 char *output_file[MAX_OUTPUT_FILE_NUM]; /* output file names */ 42 int input_file_num; /* number of input files */ 43 int output_file_num; /* number of output files */ 44 char *bits_in; /* input bit format */ 45 int pipelines[MAX_OUTPUT_FILE_NUM]; /* output file names */ 46 int pipeline_num; 47 struct tplg_context *ctx; 48 49 int fr_id; 50 int fw_id; 51 52 int max_pipeline_id; 53 int copy_iterations; 54 bool copy_check; 55 bool quiet; 56 int dynamic_pipeline_iterations; 57 int num_vcores; 58 int tick_period_us; 59 int pipeline_duration_ms; 60 int real_time; 61 FILE *file; 62 char *pipeline_string; 63 int output_file_index; 64 int input_file_index; 65 66 struct tplg_comp_info *info; 67 int info_index; 68 int info_elems; 69 70 /* 71 * input and output sample rate parameters 72 * By default, these are calculated from pipeline frames_per_sched 73 * and period but they can also be overridden via input arguments 74 * to the testbench. 75 */ 76 uint32_t fs_in; 77 uint32_t fs_out; 78 uint32_t channels_in; 79 uint32_t channels_out; 80 enum sof_ipc_frame frame_fmt; 81 }; 82 83 extern int debug; 84 85 int tb_parse_topology(struct testbench_prm *tb, struct tplg_context *ctx); 86 87 int edf_scheduler_init(void); 88 89 void sys_comp_file_init(void); 90 91 void sys_comp_filewrite_init(void); 92 93 int tb_setup(struct sof *sof, struct testbench_prm *tp); 94 void tb_free(struct sof *sof); 95 96 int tb_pipeline_start(struct ipc *ipc, struct pipeline *p); 97 98 int tb_pipeline_params(struct testbench_prm *tp, struct ipc *ipc, struct pipeline *p, 99 struct tplg_context *ctx); 100 101 int tb_pipeline_stop(struct ipc *ipc, struct pipeline *p); 102 103 int tb_pipeline_reset(struct ipc *ipc, struct pipeline *p); 104 105 void debug_print(char *message); 106 107 void sys_comp_asrc_init(void); 108 void sys_comp_crossover_init(void); 109 void sys_comp_dcblock_init(void); 110 void sys_comp_drc_init(void); 111 void sys_comp_eq_iir_init(void); 112 void sys_comp_mixer_init(void); 113 void sys_comp_multiband_drc_init(void); 114 void sys_comp_selector_init(void); 115 void sys_comp_src_init(void); 116 117 void sys_comp_module_demux_interface_init(void); 118 void sys_comp_module_eq_fir_interface_init(void); 119 void sys_comp_module_eq_iir_interface_init(void); 120 void sys_comp_module_mux_interface_init(void); 121 void sys_comp_module_tdfb_interface_init(void); 122 void sys_comp_module_volume_interface_init(void); 123 124 #endif 125