Tools: Testbench: Clean up header files

Prefix macros with TB and add TESTBENCH to headers single time
include control macros. Especially ifndef _TRACE_H is in risk
to conflict with possible other headers.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This commit is contained in:
Seppo Ingalsuo 2024-09-17 18:17:27 +03:00 committed by Liam Girdwood
parent e1c0798980
commit ca12ed2b81
4 changed files with 29 additions and 29 deletions

View File

@ -204,7 +204,7 @@ int tb_pipeline_params(struct testbench_prm *tp, struct ipc *ipc, struct pipelin
{
struct comp_dev *cd;
struct sof_ipc_pcm_params params = {{0}};
char message[DEBUG_MSG_LEN];
char message[TB_DEBUG_MSG_LEN];
int fs_period;
int period;
int ret = 0;

View File

@ -3,8 +3,8 @@
* Copyright(c) 2018 Intel Corporation. All rights reserved.
*/
#ifndef _COMMON_TEST_H
#define _COMMON_TEST_H
#ifndef _TESTBENCH_COMMON_TEST_H
#define _TESTBENCH_COMMON_TEST_H
#include <stdint.h>
#include <stddef.h>
@ -18,14 +18,14 @@
#include <sof/lib/uuid.h>
#define DEBUG_MSG_LEN 1024
#define MAX_LIB_NAME_LEN 1024
#define TB_DEBUG_MSG_LEN 1024
#define TB_MAX_LIB_NAME_LEN 1024
#define MAX_INPUT_FILE_NUM 16
#define MAX_OUTPUT_FILE_NUM 16
#define TB_MAX_INPUT_FILE_NUM 16
#define TB_MAX_OUTPUT_FILE_NUM 16
/* number of widgets types supported in testbench */
#define NUM_WIDGETS_SUPPORTED 16
#define TB_NUM_WIDGETS_SUPPORTED 16
struct tplg_context;
@ -38,12 +38,12 @@ struct tplg_context;
struct testbench_prm {
long long total_cycles;
char *tplg_file; /* topology file to use */
char *input_file[MAX_INPUT_FILE_NUM]; /* input file names */
char *output_file[MAX_OUTPUT_FILE_NUM]; /* output file names */
char *input_file[TB_MAX_INPUT_FILE_NUM]; /* input file names */
char *output_file[TB_MAX_OUTPUT_FILE_NUM]; /* output file names */
int input_file_num; /* number of input files */
int output_file_num; /* number of output files */
char *bits_in; /* input bit format */
int pipelines[MAX_OUTPUT_FILE_NUM]; /* output file names */
int pipelines[TB_MAX_OUTPUT_FILE_NUM]; /* output file names */
int pipeline_num;
struct tplg_context *ctx;
@ -105,4 +105,4 @@ void tb_gettime(struct timespec *td);
void tb_getcycles(uint64_t *cycles);
#endif
#endif /* _TESTBENCH_COMMON_TEST_H */

View File

@ -8,9 +8,9 @@
#include <stdbool.h>
#ifndef _TRACE_H
#define _TRACE_H
#ifndef _TESTBENCH_TRACE_H
#define _TESTBENCH_TRACE_H
void tb_enable_trace(unsigned int log_level);
#endif
#endif /* _TESTBENCH_TRACE_H */

View File

@ -33,7 +33,7 @@ static int parse_output_files(char *outputs, struct testbench_prm *tp)
char *token = strtok_r(outputs, ",", &output_token);
int index;
for (index = 0; index < MAX_OUTPUT_FILE_NUM && token; index++) {
for (index = 0; index < TB_MAX_OUTPUT_FILE_NUM && token; index++) {
/* get output file name with current index */
tp->output_file[index] = strdup(token);
@ -41,10 +41,10 @@ static int parse_output_files(char *outputs, struct testbench_prm *tp)
token = strtok_r(NULL, ",", &output_token);
}
if (index == MAX_OUTPUT_FILE_NUM && token) {
if (index == TB_MAX_OUTPUT_FILE_NUM && token) {
fprintf(stderr, "error: max output file number is %d\n",
MAX_OUTPUT_FILE_NUM);
for (index = 0; index < MAX_OUTPUT_FILE_NUM; index++)
TB_MAX_OUTPUT_FILE_NUM);
for (index = 0; index < TB_MAX_OUTPUT_FILE_NUM; index++)
free(tp->output_file[index]);
return -EINVAL;
}
@ -63,7 +63,7 @@ static int parse_input_files(char *inputs, struct testbench_prm *tp)
char *token = strtok_r(inputs, ",", &input_token);
int index;
for (index = 0; index < MAX_INPUT_FILE_NUM && token; index++) {
for (index = 0; index < TB_MAX_INPUT_FILE_NUM && token; index++) {
/* get input file name with current index */
tp->input_file[index] = strdup(token);
@ -71,10 +71,10 @@ static int parse_input_files(char *inputs, struct testbench_prm *tp)
token = strtok_r(NULL, ",", &input_token);
}
if (index == MAX_INPUT_FILE_NUM && token) {
if (index == TB_MAX_INPUT_FILE_NUM && token) {
fprintf(stderr, "error: max input file number is %d\n",
MAX_INPUT_FILE_NUM);
for (index = 0; index < MAX_INPUT_FILE_NUM; index++)
TB_MAX_INPUT_FILE_NUM);
for (index = 0; index < TB_MAX_INPUT_FILE_NUM; index++)
free(tp->input_file[index]);
return -EINVAL;
}
@ -90,7 +90,7 @@ static int parse_pipelines(char *pipelines, struct testbench_prm *tp)
char *token = strtok_r(pipelines, ",", &output_token);
int index;
for (index = 0; index < MAX_OUTPUT_FILE_NUM && token; index++) {
for (index = 0; index < TB_MAX_OUTPUT_FILE_NUM && token; index++) {
/* get output file name with current index */
tp->pipelines[index] = atoi(token);
@ -98,9 +98,9 @@ static int parse_pipelines(char *pipelines, struct testbench_prm *tp)
token = strtok_r(NULL, ",", &output_token);
}
if (index == MAX_OUTPUT_FILE_NUM && token) {
if (index == TB_MAX_OUTPUT_FILE_NUM && token) {
fprintf(stderr, "error: max output file number is %d\n",
MAX_OUTPUT_FILE_NUM);
TB_MAX_OUTPUT_FILE_NUM);
return -EINVAL;
}
@ -743,10 +743,10 @@ int main(int argc, char **argv)
tp.tplg_file = NULL;
tp.input_file_num = 0;
tp.output_file_num = 0;
for (i = 0; i < MAX_OUTPUT_FILE_NUM; i++)
for (i = 0; i < TB_MAX_OUTPUT_FILE_NUM; i++)
tp.output_file[i] = NULL;
for (i = 0; i < MAX_INPUT_FILE_NUM; i++)
for (i = 0; i < TB_MAX_INPUT_FILE_NUM; i++)
tp.input_file[i] = NULL;
tp.channels_in = TESTBENCH_NCH;
@ -755,7 +755,7 @@ int main(int argc, char **argv)
tp.copy_check = false;
tp.quiet = 0;
tp.dynamic_pipeline_iterations = 1;
tp.pipeline_string = calloc(1, DEBUG_MSG_LEN);
tp.pipeline_string = calloc(1, TB_DEBUG_MSG_LEN);
tp.pipelines[0] = 1;
tp.pipeline_num = 1;
tp.tick_period_us = 0; /* Execute fast non-real time, for 1 ms tick use -T 1000 */