forked from thesofproject/sof
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhost.c
More file actions
79 lines (66 loc) · 2.05 KB
/
host.c
File metadata and controls
79 lines (66 loc) · 2.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
// SPDX-License-Identifier: BSD-3-Clause
//
// Copyright(c) 2019 Intel Corporation. All rights reserved.
//
// Author: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
/* Topology parser */
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <stddef.h>
#include <errno.h>
#include <string.h>
#include <ipc/topology.h>
#include <sof/lib/uuid.h>
#include <sof/ipc/topology.h>
#include <tplg_parser/topology.h>
#include <tplg_parser/tokens.h>
/* PCM */
static const struct sof_topology_token pcm_tokens[] = {
{SOF_TKN_PCM_DMAC_CONFIG, SND_SOC_TPLG_TUPLE_TYPE_WORD,
tplg_token_get_uint32_t,
offsetof(struct sof_ipc_comp_host, dmac_config), 0},
};
/* PCM - IPC3 */
static const struct sof_topology_token_group pcm_ipc3_tokens[] = {
{pcm_tokens, ARRAY_SIZE(pcm_tokens),
offsetof(struct sof_ipc_comp_host, comp)},
{comp_tokens, ARRAY_SIZE(comp_tokens),
offsetof(struct sof_ipc_comp_host, config)},
};
static int pcm_ipc3_build(struct tplg_context *ctx, void *_pcm)
{
struct sof_ipc_comp_host *host = _pcm;
int comp_id = ctx->comp_id;
/* configure host comp IPC message */
host->comp.hdr.size = sizeof(*host);
host->comp.hdr.cmd = SOF_IPC_GLB_TPLG_MSG | SOF_IPC_TPLG_COMP_NEW;
host->comp.id = comp_id;
host->comp.type = SOF_COMP_HOST;
host->comp.pipeline_id = ctx->pipeline_id;
host->direction = ctx->dir;
host->config.hdr.size = sizeof(host->config);
return 0;
}
/* PCM - IPC4 */
static const struct sof_topology_token pcm4_tokens[] = {
/* TODO */
};
static const struct sof_topology_token_group pcm_ipc4_tokens[] = {
{pcm4_tokens, ARRAY_SIZE(pcm4_tokens)},
};
static int pcm_ipc4_build(struct tplg_context *ctx, void *pcm)
{
/* TODO */
return 0;
}
static const struct sof_topology_module_desc pcm_ipc[] = {
{3, pcm_ipc3_tokens, ARRAY_SIZE(pcm_ipc3_tokens),
pcm_ipc3_build, sizeof(struct sof_ipc_comp_host)},
{4, pcm_ipc4_tokens, ARRAY_SIZE(pcm_ipc4_tokens), pcm_ipc4_build},
};
int tplg_new_pcm(struct tplg_context *ctx, void *host, size_t host_size)
{
return tplg_create_object(ctx, pcm_ipc, ARRAY_SIZE(pcm_ipc),
"pcm", host, host_size);
}