ALSA project - the C library reference
Main Page
Related Pages
Modules
Data Structures
Files
Examples
File List
Globals
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
include
topology.h
1
/*
2
*
3
* This library is free software; you can redistribute it and/or modify
4
* it under the terms of the GNU Lesser General Public License as
5
* published by the Free Software Foundation; either version 2.1 of
6
* the License, or (at your option) any later version.
7
*
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU Lesser General Public License for more details.
12
*
13
* You should have received a copy of the GNU Lesser General Public
14
* License along with this library; if not, write to the Free Software
15
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
*
17
* Copyright (C) 2015 Intel Corporation
18
*
19
*/
20
21
#ifndef __ALSA_TOPOLOGY_H
22
#define __ALSA_TOPOLOGY_H
23
24
#include <stdint.h>
25
26
#ifdef __cplusplus
27
extern
"C"
{
28
#endif
29
743
#define SND_TPLG_MAX_CHAN 8
744
746
typedef
struct
snd_tplg
snd_tplg_t
;
747
749
enum
snd_tplg_type
{
750
SND_TPLG_TYPE_TLV
= 0,
751
SND_TPLG_TYPE_MIXER
,
752
SND_TPLG_TYPE_ENUM
,
753
SND_TPLG_TYPE_TEXT
,
754
SND_TPLG_TYPE_DATA
,
755
SND_TPLG_TYPE_BYTES
,
756
SND_TPLG_TYPE_STREAM_CONFIG
,
757
SND_TPLG_TYPE_STREAM_CAPS
,
758
SND_TPLG_TYPE_PCM
,
759
SND_TPLG_TYPE_DAPM_WIDGET
,
760
SND_TPLG_TYPE_DAPM_GRAPH
,
761
SND_TPLG_TYPE_BE
,
762
SND_TPLG_TYPE_CC
,
763
SND_TPLG_TYPE_MANIFEST
,
764
SND_TPLG_TYPE_TOKEN
,
765
SND_TPLG_TYPE_TUPLE
,
766
SND_TPLG_TYPE_LINK
,
767
SND_TPLG_TYPE_HW_CONFIG
,
768
SND_TPLG_TYPE_DAI
,
769
};
770
772
#define SND_TPLG_INDEX_ALL 0
773
775
#define SND_TPLG_CREATE_VERBOSE (1<<0)
776
#define SND_TPLG_CREATE_DAPM_NOSORT (1<<1)
782
const char *snd_tplg_version(void);
783
788
snd_tplg_t
*
snd_tplg_new
(
void
);
789
794
snd_tplg_t
*
snd_tplg_create
(
int
flags);
795
800
void
snd_tplg_free
(
snd_tplg_t
*tplg);
801
809
int
snd_tplg_load
(
snd_tplg_t
*tplg,
const
char
*buf,
size_t
size);
810
818
int
snd_tplg_build_file
(
snd_tplg_t
*tplg,
const
char
*infile,
819
const
char
*outfile);
820
826
void
snd_tplg_verbose
(
snd_tplg_t
*tplg,
int
verbose);
827
831
struct
snd_tplg_tlv_template
{
832
int
type
;
833
};
834
838
struct
snd_tplg_tlv_dbscale_template
{
839
struct
snd_tplg_tlv_template
hdr
;
840
int
min
;
841
int
step
;
842
int
mute
;
843
};
844
848
struct
snd_tplg_channel_elem
{
849
int
size
;
850
int
reg
;
851
int
shift
;
852
int
id
;
853
};
854
858
struct
snd_tplg_channel_map_template
{
859
int
num_channels
;
860
struct
snd_tplg_channel_elem
channel
[
SND_TPLG_MAX_CHAN
];
861
};
862
866
struct
snd_tplg_pdata_template
{
867
unsigned
int
length
;
868
const
void
*
data
;
869
};
870
874
struct
snd_tplg_io_ops_template
{
875
int
get
;
876
int
put
;
877
int
info
;
878
};
879
883
struct
snd_tplg_ctl_template
{
884
int
type
;
885
const
char
*
name
;
886
int
access
;
887
struct
snd_tplg_io_ops_template
ops
;
888
union
{
889
struct
snd_tplg_tlv_template
*
tlv
;
890
struct
snd_tplg_tlv_dbscale_template
*
tlv_scale
;
891
};
892
};
893
897
struct
snd_tplg_mixer_template
{
898
struct
snd_tplg_ctl_template
hdr
;
899
struct
snd_tplg_channel_map_template
*
map
;
900
int
min
;
901
int
max
;
902
int
platform_max
;
903
int
invert
;
904
struct
snd_soc_tplg_private *
priv
;
905
};
906
910
struct
snd_tplg_enum_template
{
911
struct
snd_tplg_ctl_template
hdr
;
912
struct
snd_tplg_channel_map_template
*
map
;
913
int
items
;
914
int
mask
;
915
const
char
**
texts
;
916
const
int
**
values
;
917
struct
snd_soc_tplg_private *
priv
;
918
};
919
923
struct
snd_tplg_bytes_template
{
924
struct
snd_tplg_ctl_template
hdr
;
925
int
max
;
926
int
mask
;
927
int
base
;
928
int
num_regs
;
929
struct
snd_tplg_io_ops_template
ext_ops
;
930
struct
snd_soc_tplg_private *
priv
;
931
};
932
936
struct
snd_tplg_graph_elem
{
937
const
char
*
src
;
938
const
char
*
ctl
;
939
const
char
*
sink
;
940
};
941
945
struct
snd_tplg_graph_template
{
946
int
count
;
947
struct
snd_tplg_graph_elem
elem
[0];
948
};
949
953
struct
snd_tplg_widget_template
{
954
int
id
;
955
const
char
*
name
;
956
const
char
*
sname
;
957
int
reg
;
958
int
shift
;
959
int
mask
;
960
int
subseq
;
961
unsigned
int
invert
;
962
unsigned
int
ignore_suspend
;
963
unsigned
short
event_flags
;
964
unsigned
short
event_type
;
965
struct
snd_soc_tplg_private *
priv
;
966
int
num_ctls
;
967
struct
snd_tplg_ctl_template
*
ctl
[0];
968
};
969
973
struct
snd_tplg_stream_template
{
974
const
char
*
name
;
975
int
format
;
976
int
rate
;
977
int
period_bytes
;
978
int
buffer_bytes
;
979
int
channels
;
980
};
981
985
struct
snd_tplg_stream_caps_template
{
986
const
char
*
name
;
987
uint64_t
formats
;
988
unsigned
int
rates
;
989
unsigned
int
rate_min
;
990
unsigned
int
rate_max
;
991
unsigned
int
channels_min
;
992
unsigned
int
channels_max
;
993
unsigned
int
periods_min
;
994
unsigned
int
periods_max
;
995
unsigned
int
period_size_min
;
996
unsigned
int
period_size_max
;
997
unsigned
int
buffer_size_min
;
998
unsigned
int
buffer_size_max
;
999
unsigned
int
sig_bits
;
1000
};
1001
1005
struct
snd_tplg_pcm_template
{
1006
const
char
*
pcm_name
;
1007
const
char
*
dai_name
;
1008
unsigned
int
pcm_id
;
1009
unsigned
int
dai_id
;
1010
unsigned
int
playback
;
1011
unsigned
int
capture
;
1012
unsigned
int
compress
;
1013
struct
snd_tplg_stream_caps_template
*
caps
[2];
1014
unsigned
int
flag_mask
;
1015
unsigned
int
flags
;
1016
struct
snd_soc_tplg_private *
priv
;
1017
int
num_streams
;
1018
struct
snd_tplg_stream_template
stream
[0];
1019
};
1020
1025
struct
snd_tplg_hw_config_template
{
1026
int
id;
/* unique ID - - used to match */
1027
unsigned
int
fmt;
/* SND_SOC_DAI_FORMAT_ format value */
1028
unsigned
char
clock_gated;
/* SND_SOC_TPLG_DAI_CLK_GATE_ value */
1029
unsigned
char
invert_bclk;
/* 1 for inverted BCLK, 0 for normal */
1030
unsigned
char
invert_fsync;
/* 1 for inverted frame clock, 0 for normal */
1031
unsigned
char
bclk_master;
/* SND_SOC_TPLG_BCLK_ value */
1032
unsigned
char
fsync_master;
/* SND_SOC_TPLG_FSYNC_ value */
1033
unsigned
char
mclk_direction;
/* SND_SOC_TPLG_MCLK_ value */
1034
unsigned
short
reserved;
/* for 32bit alignment */
1035
unsigned
int
mclk_rate;
/* MCLK or SYSCLK freqency in Hz */
1036
unsigned
int
bclk_rate;
/* BCLK freqency in Hz */
1037
unsigned
int
fsync_rate;
/* frame clock in Hz */
1038
unsigned
int
tdm_slots;
/* number of TDM slots in use */
1039
unsigned
int
tdm_slot_width;
/* width in bits for each slot */
1040
unsigned
int
tx_slots;
/* bit mask for active Tx slots */
1041
unsigned
int
rx_slots;
/* bit mask for active Rx slots */
1042
unsigned
int
tx_channels;
/* number of Tx channels */
1043
unsigned
int
*tx_chanmap;
/* array of slot number */
1044
unsigned
int
rx_channels;
/* number of Rx channels */
1045
unsigned
int
*rx_chanmap;
/* array of slot number */
1046
};
1047
1052
struct
snd_tplg_dai_template
{
1053
const
char
*
dai_name
;
1054
unsigned
int
dai_id
;
1055
unsigned
int
playback
;
1056
unsigned
int
capture
;
1057
struct
snd_tplg_stream_caps_template
*
caps
[2];
1058
unsigned
int
flag_mask
;
1059
unsigned
int
flags
;
1060
struct
snd_soc_tplg_private *
priv
;
1062
};
1063
1067
struct
snd_tplg_link_template
{
1068
const
char
*
name
;
1069
int
id
;
1070
const
char
*
stream_name
;
1072
int
num_streams
;
1073
struct
snd_tplg_stream_template
*
stream
;
1075
struct
snd_tplg_hw_config_template
*
hw_config
;
1076
int
num_hw_configs;
/* number of hw configs */
1077
int
default_hw_config_id;
/* default hw config ID for init */
1078
1079
unsigned
int
flag_mask;
/* bitmask of flags to configure */
1080
unsigned
int
flags;
/* SND_SOC_TPLG_LNK_FLGBIT_* flag value */
1081
struct
snd_soc_tplg_private *
priv
;
1082
};
1083
1087
typedef
struct
snd_tplg_obj_template
{
1088
enum
snd_tplg_type
type
;
1089
int
index
;
1090
int
version
;
1091
int
vendor_type
;
1092
union
{
1093
struct
snd_tplg_widget_template
*
widget
;
1094
struct
snd_tplg_mixer_template
*
mixer
;
1095
struct
snd_tplg_bytes_template
*
bytes_ctl
;
1096
struct
snd_tplg_enum_template
*
enum_ctl
;
1097
struct
snd_tplg_graph_template
*
graph
;
1098
struct
snd_tplg_pcm_template
*
pcm
;
1099
struct
snd_tplg_link_template
*
link
;
1100
struct
snd_tplg_dai_template
*
dai
;
1101
};
1102
}
snd_tplg_obj_template_t
;
1103
1110
int
snd_tplg_add_object
(
snd_tplg_t
*tplg,
snd_tplg_obj_template_t
*t);
1111
1118
int
snd_tplg_build
(
snd_tplg_t
*tplg,
const
char
*outfile);
1119
1127
int
snd_tplg_build_bin
(
snd_tplg_t
*tplg,
void
**bin,
size_t
*size);
1128
1136
int
snd_tplg_set_manifest_data
(
snd_tplg_t
*tplg,
const
void
*data,
int
len
);
1137
1144
int
snd_tplg_set_version
(
snd_tplg_t
*tplg,
unsigned
int
version);
1145
1146
/*
1147
* Flags for the snd_tplg_save()
1148
*/
1149
#define SND_TPLG_SAVE_SORT (1<<0)
1150
#define SND_TPLG_SAVE_GROUPS (1<<1)
1151
#define SND_TPLG_SAVE_NOCHECK (1<<16)
1159
int snd_tplg_save(snd_tplg_t *tplg, char **dst, int flags);
1160
1168
int
snd_tplg_decode
(
snd_tplg_t
*tplg,
void
*bin,
size_t
size,
int
dflags);
1169
1170
/* \} */
1171
1172
#ifdef __cplusplus
1173
}
1174
#endif
1175
1176
#endif
/* __ALSA_TOPOLOGY_H */
Generated by
1.8.3.1