Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/include/kernel/tokens.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
/* Token retired with ABI 3.2, do not use for new capabilities
* #define SOF_TKN_COMP_PRELOAD_COUNT 403
*/
#define SOF_TKN_COMP_CORE_ID 404
Comment thread
singalsu marked this conversation as resolved.
Resolved

/* SSP */
#define SOF_TKN_INTEL_SSP_CLKS_CONTROL 500
Expand Down
35 changes: 24 additions & 11 deletions tools/testbench/topology.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,17 @@

/* Topology loader to set up components and pipeline */

#include <dlfcn.h>
#include <errno.h>
#include <math.h>
#include <sof/drivers/ipc.h>
#include <sof/common.h>
#include <stdio.h>
#include <sof/common.h>
#include <sof/string.h>
#include <dlfcn.h>
#include <sof/audio/component.h>
#include "testbench/file.h"
#include <sof/drivers/ipc.h>
#include <tplg_parser/topology.h>
#include "testbench/common_test.h"
#include "testbench/file.h"

FILE *file;
char pipeline_string[DEBUG_MSG_LEN];
Expand Down Expand Up @@ -168,7 +169,7 @@ static int tplg_load_fileread(int comp_id, int pipeline_id, int size,
array = (struct snd_soc_tplg_vendor_array *)malloc(size);
if (!array) {
fprintf(stderr, "error: mem alloc\n");
return -EINVAL;
return -errno;
}

/* read vendor tokens */
Expand Down Expand Up @@ -226,7 +227,7 @@ static int tplg_load_filewrite(int comp_id, int pipeline_id, int size,
array = (struct snd_soc_tplg_vendor_array *)malloc(size);
if (!array) {
fprintf(stderr, "error: mem alloc\n");
return -EINVAL;
return -errno;
}

/* read vendor tokens */
Expand Down Expand Up @@ -572,7 +573,7 @@ static int process_append_data(struct sof_ipc_comp_process **process_ipc,
*process_ipc = malloc(ipc_size);
if (!(*process_ipc)) {
fprintf(stderr, "error: Failed to allocate IPC\n");
return -ENOMEM;
return -errno;
}

/* Copy header */
Expand Down Expand Up @@ -689,16 +690,22 @@ int parse_topology(struct sof *sof, struct shared_lib_table *library_table,
lib_table = library_table;

/* file size */
fseek(file, 0, SEEK_END);
if (fseek(file, 0, SEEK_END)) {
fprintf(stderr, "error: seek to end of topology\n");
return -errno;
Comment thread
ranj063 marked this conversation as resolved.
Resolved
}
file_size = ftell(file);
fseek(file, 0, SEEK_SET);
if (fseek(file, 0, SEEK_SET)) {
fprintf(stderr, "error: seek to beginning of topology\n");
return -errno;
}

/* allocate memory */
size = sizeof(struct snd_soc_tplg_hdr);
hdr = (struct snd_soc_tplg_hdr *)malloc(size);
if (!hdr) {
fprintf(stderr, "error: mem alloc\n");
return -EINVAL;
return -errno;
}

debug_print("topology parsing start\n");
Expand Down Expand Up @@ -750,10 +757,16 @@ int parse_topology(struct sof *sof, struct shared_lib_table *library_table,
if (ftell(file) == file_size)
goto finish;
break;

default:
fseek(file, hdr->payload_size, SEEK_CUR);
if (fseek(file, hdr->payload_size, SEEK_CUR)) {
fprintf(stderr, "error: fseek payload size\n");
return -errno;
}

if (ftell(file) == file_size)
goto finish;

break;
}
}
Expand Down
5 changes: 5 additions & 0 deletions tools/tplg_parser/include/tplg_parser/topology.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ static const struct sof_topology_token buffer_tokens[] = {
offsetof(struct sof_ipc_buffer, caps), 0},
};

static const struct sof_topology_token buffer_comp_tokens[] = {
{SOF_TKN_COMP_CORE_ID, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_uint32_t,
offsetof(struct sof_ipc_comp, core), 0},
};

/* scheduling */
static const struct sof_topology_token sched_tokens[] = {
{SOF_TKN_SCHED_PERIOD, SND_SOC_TPLG_TUPLE_TYPE_WORD,
Expand Down
Loading