ALSA project - the C library reference
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 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 
629 #define SND_TPLG_MAX_CHAN 8
630 
632 typedef struct snd_tplg snd_tplg_t;
633 
652 };
653 
658 snd_tplg_t *snd_tplg_new(void);
659 
664 void snd_tplg_free(snd_tplg_t *tplg);
665 
673 int snd_tplg_build_file(snd_tplg_t *tplg, const char *infile,
674  const char *outfile);
675 
681 void snd_tplg_verbose(snd_tplg_t *tplg, int verbose);
682 
687  int type;
688 };
689 
695  int min;
696  int step;
697  int mute;
698 };
699 
704  int size;
705  int reg;
706  int shift;
707  int id;
708 };
709 
716 };
717 
722  unsigned int length;
723  const void *data;
724 };
725 
730  int get;
731  int put;
732  int info;
733 };
734 
739  int type;
740  const char *name;
741  int access;
744 };
745 
752  int min;
753  int max;
755  int invert;
756  struct snd_soc_tplg_private *priv;
757 };
758 
765  int items;
766  int mask;
767  const char **texts;
768  const int **values;
769  struct snd_soc_tplg_private *priv;
770 };
771 
777  int max;
778  int mask;
779  int base;
780  int num_regs;
781  struct snd_tplg_io_ops_template ext_ops;
782  struct snd_soc_tplg_private *priv;
783 };
784 
789  const char *src;
790  const char *ctl;
791  const char *sink;
792 };
793 
798  int count;
799  struct snd_tplg_graph_elem elem[0];
800 };
801 
806  int id;
807  const char *name;
808  const char *sname;
809  int reg;
810  int shift;
811  int mask;
812  int subseq;
813  unsigned int invert;
814  unsigned int ignore_suspend;
815  unsigned short event_flags;
816  unsigned short event_type;
817  struct snd_soc_tplg_private *priv;
818  int num_ctls;
819  struct snd_tplg_ctl_template *ctl[0];
820 };
821 
826  const char *name;
827  int format;
828  int rate;
831  int channels;
832 };
833 
838  const char *name;
839  uint64_t formats;
840  unsigned int rates;
841  unsigned int rate_min;
842  unsigned int rate_max;
843  unsigned int channels_min;
844  unsigned int channels_max;
845  unsigned int periods_min;
846  unsigned int periods_max;
847  unsigned int period_size_min;
848  unsigned int period_size_max;
849  unsigned int buffer_size_min;
850  unsigned int buffer_size_max;
851 };
852 
857  const char *pcm_name;
858  const char *dai_name;
859  unsigned int pcm_id;
860  unsigned int dai_id;
861  unsigned int playback;
862  unsigned int capture;
863  unsigned int compress;
866  struct snd_tplg_stream_template stream[0];
867 };
868 
873  const char *name;
874  int id;
876  struct snd_tplg_stream_template stream[0];
877 };
878 
882 typedef struct snd_tplg_obj_template {
884  int index;
885  int version;
887  union {
895  };
897 
905 
912 int snd_tplg_build(snd_tplg_t *tplg, const char *outfile);
913 
921 int snd_tplg_set_manifest_data(snd_tplg_t *tplg, const void *data, int len);
922 
929 int snd_tplg_set_version(snd_tplg_t *tplg, unsigned int version);
930 
931 /* \} */
932 
933 #ifdef __cplusplus
934 }
935 #endif
936 
937 #endif /* __ALSA_TOPOLOGY_H */
Definition: topology.h:639
struct snd_soc_tplg_private * priv
Definition: topology.h:782
const char * ctl
Definition: topology.h:790
const char * name
Definition: topology.h:838
int rate
Definition: topology.h:828
uint64_t formats
Definition: topology.h:839
int items
Definition: topology.h:765
int num_ctls
Definition: topology.h:818
const int ** values
Definition: topology.h:768
struct snd_soc_tplg_private * priv
Definition: topology.h:817
Template type for enumerated control objects.
Definition: topology.h:762
Definition: topology.h:703
unsigned int rate_min
Definition: topology.h:841
Template type for array of DAPM graph elements.
Definition: topology.h:797
Definition: topology.h:648
int reg
Definition: topology.h:809
Definition: topology.h:649
Template type for DAPM widget objects.
Definition: topology.h:805
snd_tplg_type
Definition: topology.h:635
struct snd_tplg_pcm_template * pcm
Definition: topology.h:893
int mask
Definition: topology.h:766
struct snd_tplg_enum_template * enum_ctl
Definition: topology.h:891
struct snd_tplg_bytes_template * bytes_ctl
Definition: topology.h:890
Definition: topology.h:645
struct snd_soc_tplg_private * priv
Definition: topology.h:756
struct snd_tplg_channel_map_template * map
Definition: topology.h:764
Definition: topology.h:644
int access
Definition: topology.h:741
unsigned int ignore_suspend
Definition: topology.h:814
int subseq
Definition: topology.h:812
int snd_tplg_add_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t)
Register topology template object.
Definition: parser.c:335
Definition: topology.h:637
snd_tplg_t * snd_tplg_new(void)
Create a new topology parser instance.
Definition: parser.c:425
struct snd_tplg_widget_template * widget
Definition: topology.h:888
Template type for control objects.
Definition: topology.h:738
int platform_max
Definition: topology.h:754
unsigned int length
Definition: topology.h:722
Definition: topology.h:882
unsigned int buffer_size_max
Definition: topology.h:850
unsigned int invert
Definition: topology.h:813
struct snd_soc_tplg_private * priv
Definition: topology.h:769
unsigned int rate_max
Definition: topology.h:842
int count
Definition: topology.h:798
const char * dai_name
Definition: topology.h:858
const char * name
Definition: topology.h:807
int format
Definition: topology.h:827
Definition: topology.h:650
struct snd_tplg snd_tplg_t
Definition: topology.h:632
int reg
Definition: topology.h:705
Template type for TLV Scale objects.
Definition: topology.h:693
int vendor_type
Definition: topology.h:886
Stream configurations.
Definition: topology.h:825
void snd_tplg_free(snd_tplg_t *tplg)
Free a topology parser instance.
Definition: parser.c:460
int max
Definition: topology.h:777
unsigned int capture
Definition: topology.h:862
int max
Definition: topology.h:753
int shift
Definition: topology.h:810
int buffer_bytes
Definition: topology.h:830
int mute
Definition: topology.h:697
int num_regs
Definition: topology.h:780
struct snd_tplg_mixer_template * mixer
Definition: topology.h:889
Definition: topology.h:640
#define SND_TPLG_MAX_CHAN
Definition: topology.h:629
unsigned short event_type
Definition: topology.h:816
Generic Template Object.
Template type for PCM (FE DAI & DAI links).
Definition: topology.h:856
const char ** texts
Definition: topology.h:767
int snd_tplg_build_file(snd_tplg_t *tplg, const char *infile, const char *outfile)
Parse and build topology text file into binary file.
Definition: parser.c:289
int snd_tplg_set_version(snd_tplg_t *tplg, unsigned int version)
Set an optional vendor specific version number.
Definition: parser.c:403
unsigned int buffer_size_min
Definition: topology.h:849
const char * src
Definition: topology.h:789
Template type for single DAPM graph element.
Definition: topology.h:788
Definition: topology.h:642
int min
Definition: topology.h:695
void snd_tplg_verbose(snd_tplg_t *tplg, int verbose)
Enable verbose reporting of binary file output.
Definition: parser.c:410
const char * sink
Definition: topology.h:791
Template type for TLV Scale objects.
Definition: topology.h:775
int id
Definition: topology.h:806
Template type for object operations mapping.
Definition: topology.h:729
int put
Definition: topology.h:731
struct snd_tplg_channel_map_template * map
Definition: topology.h:751
int mask
Definition: topology.h:778
unsigned int pcm_id
Definition: topology.h:859
Template type for all TLV objects.
Definition: topology.h:686
unsigned int len
Definition: seq_event.h:198
unsigned int periods_max
Definition: topology.h:846
const char * name
Definition: topology.h:740
Definition: topology.h:643
Definition: topology.h:651
int mask
Definition: topology.h:811
unsigned int periods_min
Definition: topology.h:845
Definition: topology.h:646
unsigned short event_flags
Definition: topology.h:815
Definition: topology.h:647
Definition: topology.h:636
int shift
Definition: topology.h:706
const void * data
Definition: topology.h:723
int invert
Definition: topology.h:755
int num_streams
Definition: topology.h:865
int type
Definition: topology.h:687
int size
Definition: topology.h:704
struct snd_tplg_graph_template * graph
Definition: topology.h:892
Template type for mixer control objects.
Definition: topology.h:749
struct snd_tplg_link_template * link
Definition: topology.h:894
unsigned int channels_min
Definition: topology.h:843
const char * name
Definition: topology.h:826
const char * sname
Definition: topology.h:808
unsigned int dai_id
Definition: topology.h:860
int snd_tplg_set_manifest_data(snd_tplg_t *tplg, const void *data, int len)
Attach private data to topology manifest.
Definition: parser.c:388
unsigned int playback
Definition: topology.h:861
int type
Definition: topology.h:739
int channels
Definition: topology.h:831
int num_channels
Definition: topology.h:714
unsigned int period_size_min
Definition: topology.h:847
Template type for channel mapping.
Definition: topology.h:713
unsigned int period_size_max
Definition: topology.h:848
unsigned int compress
Definition: topology.h:863
int min
Definition: topology.h:752
unsigned int channels_max
Definition: topology.h:844
struct snd_tplg_tlv_template * tlv
Definition: topology.h:743
int base
Definition: topology.h:779
int info
Definition: topology.h:732
int snd_tplg_build(snd_tplg_t *tplg, const char *outfile)
Build all registered topology data into binary file.
Definition: parser.c:359
int step
Definition: topology.h:696
Definition: topology.h:641
unsigned int rates
Definition: topology.h:840
int index
Definition: topology.h:884
Template type for private data objects.
Definition: topology.h:721
int id
Definition: topology.h:707
Stream Capabilities.
Definition: topology.h:837
int period_bytes
Definition: topology.h:829
int version
Definition: topology.h:885
Definition: topology.h:638
const char * pcm_name
Definition: topology.h:857