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 
462 #define SND_TPLG_MAX_CHAN 8
463 
465 typedef struct snd_tplg snd_tplg_t;
466 
483 };
484 
489 snd_tplg_t *snd_tplg_new(void);
490 
495 void snd_tplg_free(snd_tplg_t *tplg);
496 
504 int snd_tplg_build_file(snd_tplg_t *tplg, const char *infile,
505  const char *outfile);
506 
512 void snd_tplg_verbose(snd_tplg_t *tplg, int verbose);
513 
518  int type;
519 };
520 
526  int min;
527  int step;
528  int mute;
529 };
530 
535  int size;
536  int reg;
537  int shift;
538  int id;
539 };
540 
547 };
548 
553  unsigned int length;
554  const void *data;
555 };
556 
561  int get;
562  int put;
563  int info;
564 };
565 
570  int type;
571  const char *name;
572  int access;
575 };
576 
583  int min;
584  int max;
586  int invert;
587  struct snd_soc_tplg_private *priv;
588 };
589 
596  int items;
597  int mask;
598  const char **texts;
599  const int **values;
600  struct snd_soc_tplg_private *priv;
601 };
602 
608  int max;
609  int mask;
610  int base;
611  int num_regs;
613  struct snd_soc_tplg_private *priv;
614 };
615 
620  const char *src;
621  const char *ctl;
622  const char *sink;
623 };
624 
629  int count;
631 };
632 
637  int id;
638  const char *name;
639  const char *sname;
640  int reg;
641  int shift;
642  int mask;
643  int subseq;
644  unsigned int invert;
645  unsigned int ignore_suspend;
646  unsigned short event_flags;
647  unsigned short event_type;
648  struct snd_soc_tplg_private *priv;
649  int num_ctls;
651 };
652 
657  const char *name;
658  int format;
659  int rate;
662  int channels;
663 };
664 
669  const char *name;
670  uint64_t formats;
671  unsigned int rates;
672  unsigned int rate_min;
673  unsigned int rate_max;
674  unsigned int channels_min;
675  unsigned int channels_max;
676  unsigned int periods_min;
677  unsigned int periods_max;
678  unsigned int period_size_min;
679  unsigned int period_size_max;
680  unsigned int buffer_size_min;
681  unsigned int buffer_size_max;
682 };
683 
688  const char *pcm_name;
689  const char *dai_name;
690  unsigned int pcm_id;
691  unsigned int dai_id;
692  unsigned int playback;
693  unsigned int capture;
694  unsigned int compress;
698 };
699 
704  const char *name;
705  int id;
708 };
709 
713 typedef struct snd_tplg_obj_template {
714  enum snd_tplg_type type;
715  int index;
716  int version;
718  union {
726  };
728 
736 
743 int snd_tplg_build(snd_tplg_t *tplg, const char *outfile);
744 
752 int snd_tplg_set_manifest_data(snd_tplg_t *tplg, const void *data, int len);
753 
760 int snd_tplg_set_version(snd_tplg_t *tplg, unsigned int version);
761 
762 /* \} */
763 
764 #ifdef __cplusplus
765 }
766 #endif
767 
768 #endif /* __ALSA_TOPOLOGY_H */
Definition: topology.h:472
struct snd_soc_tplg_private * priv
Definition: topology.h:613
const char * ctl
Definition: topology.h:621
const char * name
Definition: topology.h:669
int rate
Definition: topology.h:659
uint64_t formats
Definition: topology.h:670
int items
Definition: topology.h:596
struct snd_tplg_channel_elem channel[SND_TPLG_MAX_CHAN]
Definition: topology.h:546
int num_ctls
Definition: topology.h:649
const int ** values
Definition: topology.h:599
struct snd_soc_tplg_private * priv
Definition: topology.h:648
Template type for enumerated control objects.
Definition: topology.h:593
Definition: topology.h:534
unsigned int rate_min
Definition: topology.h:672
Template type for array of DAPM graph elements.
Definition: topology.h:628
Definition: topology.h:481
int reg
Definition: topology.h:640
Definition: topology.h:482
Template type for DAPM widget objects.
Definition: topology.h:636
snd_tplg_type
Definition: topology.h:468
struct snd_tplg_pcm_template * pcm
Definition: topology.h:724
int mask
Definition: topology.h:597
struct snd_tplg_enum_template * enum_ctl
Definition: topology.h:722
struct snd_tplg_bytes_template * bytes_ctl
Definition: topology.h:721
Definition: topology.h:478
struct snd_soc_tplg_private * priv
Definition: topology.h:587
struct snd_tplg_channel_map_template * map
Definition: topology.h:595
Definition: topology.h:477
int access
Definition: topology.h:572
struct snd_tplg_io_ops_template ops
Definition: topology.h:573
struct snd_tplg_tlv_template hdr
Definition: topology.h:525
unsigned int ignore_suspend
Definition: topology.h:645
struct snd_tplg_stream_template stream[0]
Definition: topology.h:697
int subseq
Definition: topology.h:643
int snd_tplg_add_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t)
Register topology template object.
Definition: parser.c:301
Definition: topology.h:470
snd_tplg_t * snd_tplg_new(void)
Create a new topology parser instance.
Definition: parser.c:373
struct snd_tplg_widget_template * widget
Definition: topology.h:719
Template type for control objects.
Definition: topology.h:569
int platform_max
Definition: topology.h:585
struct snd_tplg_io_ops_template ext_ops
Definition: topology.h:612
unsigned int length
Definition: topology.h:553
Definition: topology.h:713
unsigned int buffer_size_max
Definition: topology.h:681
unsigned int invert
Definition: topology.h:644
struct snd_soc_tplg_private * priv
Definition: topology.h:600
unsigned int rate_max
Definition: topology.h:673
int count
Definition: topology.h:629
const char * dai_name
Definition: topology.h:689
const char * name
Definition: topology.h:638
int format
Definition: topology.h:658
struct snd_tplg_ctl_template hdr
Definition: topology.h:594
struct snd_tplg snd_tplg_t
Definition: topology.h:465
int reg
Definition: topology.h:536
Template type for TLV Scale objects.
Definition: topology.h:524
int vendor_type
Definition: topology.h:717
struct snd_tplg_ctl_template * ctl[0]
Definition: topology.h:650
Stream configurations.
Definition: topology.h:656
struct snd_tplg_ctl_template hdr
Definition: topology.h:607
void snd_tplg_free(snd_tplg_t *tplg)
Free a topology parser instance.
Definition: parser.c:398
int max
Definition: topology.h:608
unsigned int capture
Definition: topology.h:693
int max
Definition: topology.h:584
int shift
Definition: topology.h:641
int buffer_bytes
Definition: topology.h:661
int mute
Definition: topology.h:528
struct snd_tplg_graph_elem elem[0]
Definition: topology.h:630
int num_regs
Definition: topology.h:611
struct snd_tplg_mixer_template * mixer
Definition: topology.h:720
Definition: topology.h:473
#define SND_TPLG_MAX_CHAN
Definition: topology.h:462
unsigned short event_type
Definition: topology.h:647
Generic Template Object.
Template type for PCM (FE DAI & DAI links).
Definition: topology.h:687
const char ** texts
Definition: topology.h:598
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:255
int snd_tplg_set_version(snd_tplg_t *tplg, unsigned int version)
Set an optional vendor specific version number.
Definition: parser.c:361
unsigned int buffer_size_min
Definition: topology.h:680
const char * src
Definition: topology.h:620
Template type for single DAPM graph element.
Definition: topology.h:619
Definition: topology.h:475
int min
Definition: topology.h:526
void snd_tplg_verbose(snd_tplg_t *tplg, int verbose)
Enable verbose reporting of binary file output.
Definition: parser.c:368
struct snd_tplg_stream_caps_template * caps[2]
Definition: topology.h:695
const char * sink
Definition: topology.h:622
Template type for TLV Scale objects.
Definition: topology.h:606
int id
Definition: topology.h:637
Template type for object operations mapping.
Definition: topology.h:560
struct snd_tplg_ctl_template hdr
Definition: topology.h:581
int put
Definition: topology.h:562
struct snd_tplg_channel_map_template * map
Definition: topology.h:582
int mask
Definition: topology.h:609
unsigned int pcm_id
Definition: topology.h:690
Template type for all TLV objects.
Definition: topology.h:517
unsigned int len
Definition: seq_event.h:198
unsigned int periods_max
Definition: topology.h:677
const char * name
Definition: topology.h:571
Definition: topology.h:476
int mask
Definition: topology.h:642
unsigned int periods_min
Definition: topology.h:676
Definition: topology.h:479
unsigned short event_flags
Definition: topology.h:646
Definition: topology.h:480
Definition: topology.h:469
int shift
Definition: topology.h:537
const void * data
Definition: topology.h:554
int invert
Definition: topology.h:586
int num_streams
Definition: topology.h:696
int type
Definition: topology.h:518
int size
Definition: topology.h:535
struct snd_tplg_graph_template * graph
Definition: topology.h:723
Template type for mixer control objects.
Definition: topology.h:580
struct snd_tplg_link_template * link
Definition: topology.h:725
unsigned int channels_min
Definition: topology.h:674
const char * name
Definition: topology.h:657
const char * sname
Definition: topology.h:639
unsigned int dai_id
Definition: topology.h:691
int snd_tplg_set_manifest_data(snd_tplg_t *tplg, const void *data, int len)
Attach private data to topology manifest.
Definition: parser.c:354
unsigned int playback
Definition: topology.h:692
int type
Definition: topology.h:570
int channels
Definition: topology.h:662
int num_channels
Definition: topology.h:545
unsigned int period_size_min
Definition: topology.h:678
Template type for channel mapping.
Definition: topology.h:544
unsigned int period_size_max
Definition: topology.h:679
unsigned int compress
Definition: topology.h:694
int min
Definition: topology.h:583
unsigned int channels_max
Definition: topology.h:675
struct snd_tplg_tlv_template * tlv
Definition: topology.h:574
int base
Definition: topology.h:610
int info
Definition: topology.h:563
int snd_tplg_build(snd_tplg_t *tplg, const char *outfile)
Build all registered topology data into binary file.
Definition: parser.c:325
int step
Definition: topology.h:527
Definition: topology.h:474
unsigned int rates
Definition: topology.h:671
int index
Definition: topology.h:715
Template type for private data objects.
Definition: topology.h:552
int id
Definition: topology.h:538
Stream Capabilities.
Definition: topology.h:668
int period_bytes
Definition: topology.h:660
int version
Definition: topology.h:716
Definition: topology.h:471
const char * pcm_name
Definition: topology.h:688