-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathComponents.cs
More file actions
1045 lines (903 loc) · 30.4 KB
/
Copy pathComponents.cs
File metadata and controls
1045 lines (903 loc) · 30.4 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
//
// Copyright (c) 2018, Intel Corporation. All rights reserved.
//
// Author: Cezary Rojewski <cezary.rojewski@intel.com>
//
// SPDX-License-Identifier: Apache-2.0 OR MIT
//
using System;
using System.Collections.Generic;
using System.Linq;
namespace NUcmSerializer
{
public abstract class Section
{
[UcmIdentifier]
public virtual string Identifier { get; set; }
[UcmElement("comment")]
public string Comment { get; set; }
public Section(string identifier)
{
Identifier = identifier;
}
}
public static class TPLG_CTL
{
// individual kcontrol info types
public const uint VOLSW = 1;
public const uint VOLSW_SX = 2;
public const uint VOLSW_XR_SX = 3;
public const uint ENUM = 4;
public const uint BYTES = 5;
public const uint ENUM_VALUE = 6;
public const uint RANGE = 7;
public const uint STROBE = 8;
// individual widget kcontrol info types
public const uint DAPM_VOLSW = 64;
public const uint DAPM_ENUM_DOUBLE = 65;
public const uint DAPM_ENUM_VIRT = 66;
public const uint DAPM_ENUM_VALUE = 67;
public const uint DAPM_PIN = 68;
}
[UcmSection("ops")]
public class Ops : Section
{
[UcmElement("get")]
public uint? Get { get; set; }
[UcmElement("put")]
public uint? Put { get; set; }
[UcmElement("info")]
public uint? Info { get; set; }
public Ops(string identifier)
: base(identifier)
{
}
public Ops()
: this(null)
{
}
}
public static class ChannelName
{
public static readonly string Mono = "mono";
public static readonly string FrontLeft = "fl";
public static readonly string FrontRight = "fr";
public static readonly string RearLeft = "rl";
public static readonly string RearRight = "rr";
public static readonly string FrontCenter = "fc";
public static readonly string LFE = "lfe";
public static readonly string SideLeft = "sl";
public static readonly string SideRight = "sr";
public static readonly string RearCenter = "rc";
public static readonly string FrontLeftCenter = "flc";
public static readonly string FrontRightCenter = "frc";
public static readonly string RearLeftCenter = "rlc";
public static readonly string RearRightCenter = "rrc";
public static readonly string FrontLeftWide = "flw";
public static readonly string FrontRightWide = "frw";
public static readonly string FrontLeftHigh = "flh";
public static readonly string FrontCenterHigh = "fch";
public static readonly string FrontRightHigh = "frh";
public static readonly string TopCenter = "tc";
public static readonly string TopFrontLeft = "tfl";
public static readonly string TopFrontRight = "tfr";
public static readonly string TopFrontCenter = "tfc";
public static readonly string TopRearLeft = "trl";
public static readonly string TopRearRight = "trr";
public static readonly string TopRearCenter = "trc";
public static readonly string TopFrontLeftCenter = "tflc";
public static readonly string TopFrontRightCenter = "tfrc";
public static readonly string TopSideLeft = "tsl";
public static readonly string TopSideRight = "tsr";
public static readonly string LeftLFE = "llfe";
public static readonly string RightLFE = "rlfe";
public static readonly string BottomCenter = "bc";
public static readonly string BottomLeftCenter = "blc";
public static readonly string BottomRightCenter = "brc";
}
[UcmSection("channel")]
public class ChannelMap : Section
{
[UcmElement("reg")]
public int Reg { get; set; }
[UcmElement("shift")]
public int Shift { get; set; }
[UcmIdentifier]
public override string Identifier
{
get
{
return base.Identifier;
}
set
{
if (typeof(ChannelName).GetFields()
.Any(f => f.GetValue(null).Equals(value)))
base.Identifier = value;
}
}
public ChannelMap(string identifier)
: base(identifier)
{
}
public ChannelMap()
: this(ChannelName.Mono)
{
}
}
[UcmSection("scale")]
public class DBScale : Section
{
[UcmElement("min")]
public int? Min { get; set; }
[UcmElement("step")]
public int Step { get; set; }
[UcmElement("mute")]
public byte Mute { get; set; }
public DBScale(string identifier)
: base(identifier)
{
}
public DBScale()
: this(ChannelName.Mono)
{
}
}
public class SectionData : Section
{
public byte[] Bytes;
public ushort[] Shorts;
public uint[] Words;
[UcmElement("file"), UcmExclusive("value")]
public string File { get; set; }
[UcmElement("bytes"), UcmExclusive("value")]
public string BytesString
{
get
{
return (Bytes == null) ? null :
string.Join(", ", Bytes.Select(e => $"0x{e.ToString("X2")}"));
}
set
{
Bytes = value?.ToBytes();
}
}
[UcmElement("shorts"), UcmExclusive("value")]
public string ShortsString
{
get
{
return (Shorts == null) ? null :
string.Join(", ", Shorts.Select(e => $"0x{e.ToString("X4")}"));
}
set
{
Shorts = value?.ToUInts16();
}
}
[UcmElement("words"), UcmExclusive("value")]
public string WordsString
{
get
{
return (Words == null) ? null :
string.Join(", ", Words.Select(e => $"0x{e.ToString("X8")}"));
}
set
{
Words = value?.ToUInts32();
}
}
[UcmElement("tuples"), UcmExclusive("value")]
public string[] Tuples { get; set; }
[UcmElement("type")]
public uint? Type { get; set; }
public SectionData(string identifier)
: base(identifier)
{
}
public SectionData()
: this(null)
{
}
}
public abstract class VendorTuples : Section
{
public const int CTL_ELEM_ID_NAME_MAXLEN = 44;
public static readonly Dictionary<Type, string> TupleTypes =
new Dictionary<Type, string>()
{
{ typeof(string), "string" },
{ typeof(Guid), "uuid" },
{ typeof(bool), "bool" },
{ typeof(byte), "byte" },
{ typeof(ushort), "short" },
{ typeof(uint), "word" },
};
public static int GetElementSize<T>()
{
Type type = typeof(T);
if (type == typeof(string))
return CTL_ELEM_ID_NAME_MAXLEN;
else if (type == typeof(Guid))
return 16 * sizeof(byte);
return sizeof(uint);
}
protected VendorTuples(string identifier)
: base(identifier)
{
}
public abstract int Size();
}
[UcmSection("tuples")]
public class VendorTuples<T> : VendorTuples
{
[UcmIgnore]
public static string TupleType { get; }
[UcmArray(Inline = true)]
public Tuple<string, T>[] Tuples { get; set; }
[UcmIdentifier]
public override string Identifier
{
get
{
return base.Identifier;
}
set
{
base.Identifier = string.IsNullOrEmpty(value) ? TupleType : $"{TupleType}.{value}";
}
}
static VendorTuples()
{
Type type = typeof(T);
if (TupleTypes.ContainsKey(type))
TupleType = TupleTypes[type];
else
TupleType = type.Name;
}
public VendorTuples(string identifier)
: base(identifier)
{
}
public VendorTuples()
: this(null)
{
}
public override int Size()
{
return (Tuples == null) ?
0 : (sizeof(uint) + GetElementSize<T>()) * Tuples.Length;
}
}
public class SectionVendorTokens : Section
{
[UcmArray(Inline = true)]
public Tuple<string, uint>[] Tokens { get; set; }
public SectionVendorTokens(string identifier)
: base(identifier)
{
}
public SectionVendorTokens()
: this(null)
{
}
}
public class SectionVendorTuples : Section
{
[UcmElement("tokens")]
public string Tokens { get; set; }
[UcmArray("tuples", Inline = true)]
public VendorTuples[] Tuples { get; set; }
public SectionVendorTuples(string identifier)
: base(identifier)
{
}
public SectionVendorTuples()
: this(null)
{
}
public int Size()
{
return (Tuples == null) ? 0 : Tuples.Sum(t => t.Size());
}
}
[Flags]
public enum CTL_ELEM_ACCESS
{
[UcmEnum(Name = "read")]
READ = (1 << 0),
[UcmEnum(Name = "write")]
WRITE = (1 << 1),
[UcmEnum(Name = "read_write")]
READWRITE = (READ | WRITE),
[UcmEnum(Name = "volatile")]
VOLATILE = (1 << 2), // control value may be changed without a notification
[UcmEnum(Name = "timestamp")]
TIMESTAMP = (1 << 3), // when was control changed
[UcmEnum(Name = "tlv_read")]
TLV_READ = (1 << 4), // TLV read is possible
[UcmEnum(Name = "tlv_write")]
TLV_WRITE = (1 << 5), // TLV write is possible
[UcmEnum(Name = "tlv_read_write")]
TLV_READWRITE = (TLV_READ | TLV_WRITE),
[UcmEnum(Name = "tlv_command")]
TLV_COMMAND = (1 << 6), // TLV command is possible
[UcmEnum(Name = "inactive")]
INACTIVE = (1 << 8), // control does actually nothing, but may be updated
[UcmEnum(Name = "lock")]
LOCK = (1 << 9), // write lock
[UcmEnum(Name = "owner")]
OWNER = (1 << 10), // write lock owner
[UcmEnum(Name = "tlv_callback")]
TLV_CALLBACK = (1 << 28), // kernel use a TLV callback
[UcmEnum(Name = "user")]
USER = (1 << 29) // user space element
}
public abstract class SectionControl : Section
{
[UcmElement("index")]
public uint Index { get; set; }
[UcmArray("channel", Inline = true)]
public ChannelMap[] Channel { get; set; }
[UcmSection("ops")]
public Ops Ops { get; set; }
[UcmArray("access")]
public CTL_ELEM_ACCESS[] Access { get; set; }
[UcmElement("data")]
public string Data { get; set; }
public SectionControl(string identifier)
: base(identifier)
{
}
}
public class SectionControlMixer : SectionControl
{
[UcmElement("max")]
public int? Max { get; set; }
[UcmElement("invert")]
public bool Invert { get; set; }
[UcmElement("tlv")]
public string TLV { get; set; }
public SectionControlMixer(string identifier)
: base(identifier)
{
}
public SectionControlMixer()
: this(null)
{
}
}
public class SectionControlBytes : SectionControl
{
[UcmSection("extops")]
public Ops ExtOps { get; set; }
[UcmElement("base")]
public int? Base { get; set; }
[UcmElement("num_regs")]
public int? NumRegs { get; set; }
[UcmElement("mask")]
public int? Mask { get; set; }
[UcmElement("max")]
public int? Max { get; set; }
[UcmElement("tlv")]
public string TLV { get; set; }
public SectionControlBytes(string identifier)
: base(identifier)
{
}
public SectionControlBytes()
: this(null)
{
}
}
public class SectionControlEnum : SectionControl
{
[UcmElement("texts")]
public string Texts { get; set; }
public SectionControlEnum(string identifier)
: base(identifier)
{
}
public SectionControlEnum()
: this(null)
{
}
}
public class SectionText : Section
{
[UcmArray("values")]
public string[] Values { get; set; }
public SectionText(string identifier)
: base(identifier)
{
}
public SectionText()
: this(null)
{
}
}
public class SectionGraph : Section
{
[UcmElement("index")]
public uint Index { get; set; }
[UcmArray("lines")]
public string[] Lines { get; set; }
public SectionGraph(string identifier)
: base(identifier)
{
}
public SectionGraph()
: this(null)
{
}
}
public enum TPLG_DAPM
{
// DAPM widget types - add new items to the end
[UcmEnum(Name = "input")] INPUT,
[UcmEnum(Name = "output")] OUTPUT,
[UcmEnum(Name = "mux")] MUX,
[UcmEnum(Name = "mixer")] MIXER,
[UcmEnum(Name = "pga")] PGA,
[UcmEnum(Name = "out_drv")] OUT_DRV,
[UcmEnum(Name = "adc")] ADC,
[UcmEnum(Name = "dac")] DAC,
[UcmEnum(Name = "switch")] SWITCH,
[UcmEnum(Name = "pre")] PRE,
[UcmEnum(Name = "post")] POST,
[UcmEnum(Name = "aif_in")] AIF_IN,
[UcmEnum(Name = "aif_out")] AIF_OUT,
[UcmEnum(Name = "dai_in")] DAI_IN,
[UcmEnum(Name = "dai_out")] DAI_OUT,
[UcmEnum(Name = "dai_link")] DAI_LINK,
[UcmEnum(Name = "buffer")] BUFFER,
[UcmEnum(Name = "scheduler")] SCHEDULER,
[UcmEnum(Name = "effect")] EFFECT,
[UcmEnum(Name = "siggen")] SIGGEN,
[UcmEnum(Name = "src")] SRC,
[UcmEnum(Name = "asrc")] ASRC,
[UcmEnum(Name = "encoder")] ENCODER,
[UcmEnum(Name = "decoder")] DECODER
}
[Flags]
public enum DAPM_EVENT
{
// dapm event types
PRE_PMU = 0x1, // before widget power up
POST_PMU = 0x2, // after widget power up
PRE_PMD = 0x4, // before widget power down
POST_PMD = 0x8, // after widget power down
PRE_REG = 0x10, // before audio path setup
POST_REG = 0x20, // after audio path setup
WILL_PMU = 0x40, // called at start of sequence
WILL_PMD = 0x80, // called at start of sequence
PRE_POST_PMD = (PRE_PMD | POST_PMD),
}
public class SectionWidget : Section
{
[UcmElement("index")]
public uint Index { get; set; }
[UcmElement("type")]
public TPLG_DAPM Type { get; set; }
[UcmElement("stream_name")]
public string StreamName { get; set; }
[UcmElement("no_pm")]
public bool? NoPm { get; set; }
[UcmElement("reg")]
public int? Reg { get; set; }
[UcmElement("shift")]
public int? Shift { get; set; }
[UcmElement("invert")]
public bool? Invert { get; set; }
[UcmElement("subseq")]
public uint? Subseq { get; set; }
[UcmElement("event_type")]
public uint? EventType { get; set; }
[UcmElement("event_flags")]
public DAPM_EVENT? EventFlags { get; set; }
[UcmElement("mixer"), UcmExclusive("control")]
public string[] Mixer { get; set; }
[UcmElement("enum"), UcmExclusive("control")]
public string[] Enum { get; set; }
[UcmElement("bytes"), UcmExclusive("control")]
public string[] Bytes { get; set; }
[UcmElement("data")]
public string[] Data { get; set; }
public SectionWidget(string identifier)
: base(identifier)
{
}
public SectionWidget()
: this(null)
{
}
}
public enum PCM_FORMAT
{
S8 = 0, // Signed 8 bit
U8, // Unsigned 8 bit
S16_LE, // Signed 16 bit Little Endian
S16_BE, // Signed 16 bit Big Endian
U16_LE, // Unsigned 16 bit Little Endian
U16_BE, // Unsigned 16 bit Big Endian
S24_LE, // Signed 24 bit Little Endian using low three bytes in 32-bit word
S24_BE, // Signed 24 bit Big Endian using low three bytes in 32-bit word
U24_LE, // Unsigned 24 bit Little Endian using low three bytes in 32-bit word
U24_BE, // Unsigned 24 bit Big Endian using low three bytes in 32-bit word
S32_LE, // Signed 32 bit Little Endian
S32_BE, // Signed 32 bit Big Endian
U32_LE, // Unsigned 32 bit Little Endian
U32_BE, // Unsigned 32 bit Big Endian
FLOAT_LE, // Float 32 bit Little Endian, Range -1.0 to 1.0
FLOAT_BE, // Float 32 bit Big Endian, Range -1.0 to 1.0
FLOAT64_LE, // Float 64 bit Little Endian, Range -1.0 to 1.0
FLOAT64_BE, // Float 64 bit Big Endian, Range -1.0 to 1.0
IEC958_SUBFRAME_LE, // IEC-958 Little Endian
IEC958_SUBFRAME_BE, // IEC-958 Big Endian
MU_LAW, // Mu-Law
A_LAW, // A-Law
IMA_ADPCM, // Ima-ADPCM
MPEG, // MPEG
GSM, // GSM
S20_LE, // Signed 20bit Little Endian in 4bytes format, LSB justified
S20_BE, // Signed 20bit Big Endian in 4bytes format, LSB justified
U20_LE, // Unsigned 20bit Little Endian in 4bytes format, LSB justified
U20_BE, // Unsigned 20bit Big Endian in 4bytes format, LSB justified
SPECIAL = 31, // Special
S24_3LE = 32, // Signed 24bit Little Endian in 3bytes format
S24_3BE, // Signed 24bit Big Endian in 3bytes format
U24_3LE, // Unsigned 24bit Little Endian in 3bytes format
U24_3BE, // Unsigned 24bit Big Endian in 3bytes format
S20_3LE, // Signed 20bit Little Endian in 3bytes format
S20_3BE, // Signed 20bit Big Endian in 3bytes format
U20_3LE, // Unsigned 20bit Little Endian in 3bytes format
U20_3BE, // Unsigned 20bit Big Endian in 3bytes format
S18_3LE, // Signed 18bit Little Endian in 3bytes format
S18_3BE, // Signed 18bit Big Endian in 3bytes format
U18_3LE, // Unsigned 18bit Little Endian in 3bytes format
U18_3BE, // Unsigned 18bit Big Endian in 3bytes format
G723_24, // G.723 (ADPCM) 24 kbit/s, 8 samples in 3 bytes
G723_24_1B, // G.723 (ADPCM) 24 kbit/s, 1 sample in 1 byte
G723_40, // G.723 (ADPCM) 40 kbit/s, 8 samples in 3 bytes
G723_40_1B, // G.723 (ADPCM) 40 kbit/s, 1 sample in 1 byte
DSD_U8, // Direct Stream Digital (DSD) in 1-byte samples (x8)
DSD_U16_LE, // Direct Stream Digital (DSD) in 2-byte samples (x16)
DSD_U32_LE, // Direct Stream Digital (DSD) in 4-byte samples (x32)
DSD_U16_BE, // Direct Stream Digital (DSD) in 2-byte samples (x16)
DSD_U32_BE // Direct Stream Digital (DSD) in 4-byte samples (x32)
}
public enum PCM_RATE
{
_5512 = 0, // 5512Hz
_8000, // 8000Hz
_11025, // 11025Hz
_16000, // 16000Hz
_22050, // 22050Hz
_32000, // 32000Hz
_44100, // 44100Hz
_48000, // 48000Hz
_64000, // 64000Hz
_88200, // 88200Hz
_96000, // 96000Hz
_176400, // 176400Hz
_192000, // 192000Hz
CONTINUOUS = 30, // continuous range
KNOT = 31 // supports more non-continuos rates
}
public class SectionPCMCapabilities : Section
{
public readonly HashSet<PCM_FORMAT> Formats;
public readonly HashSet<PCM_RATE> Rates;
[UcmElement("formats")]
public string FormatsString
{
get
{
return string.Join(", ", Formats);
}
set
{
Formats.Clear();
if (value == null)
return;
string[] substrs = value.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries)
.Select(s => s.Trim())
.Distinct().ToArray();
foreach (string s in substrs)
if (Enum.GetNames<PCM_FORMAT>().Contains(s))
Formats.Add(Enum.Parse<PCM_FORMAT>(s));
}
}
[UcmElement("rates")]
public string RatesString
{
get
{
var rates = Rates.Select(r => r.ToString().TrimStart('_'));
return string.Join(", ", rates);
}
set
{
Rates.Clear();
if (value == null)
return;
string[] substrs = value.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries)
.Select(s => s.Trim())
.Distinct().ToArray();
foreach (string s in substrs)
{
string tmp;
if (s[0] == '_')
continue;
if (char.IsDigit(s[0]))
tmp = s.Insert(0, "_");
else
tmp = s;
if (Enum.GetNames<PCM_RATE>().Contains(tmp))
Rates.Add(Enum.Parse<PCM_RATE>(tmp));
}
}
}
[UcmElement("rate_min")]
public uint? RateMin { get; set; }
[UcmElement("rate_max")]
public uint? RateMax { get; set; }
[UcmElement("channels_min")]
public uint? ChannelsMin { get; set; }
[UcmElement("channels_max")]
public uint? ChannelsMax { get; set; }
[UcmElement("periods_min")]
public uint? PeriodsMin { get; set; }
[UcmElement("periods_max")]
public uint? PeriodsMax { get; set; }
[UcmElement("period_size_min")]
public uint? PeriodSizeMin { get; set; }
[UcmElement("period_size_max")]
public uint? PeriodSizeMax { get; set; }
[UcmElement("buffer_size_min")]
public uint? BufferSizeMin { get; set; }
[UcmElement("buffer_size_max")]
public uint? BufferSizeMax { get; set; }
[UcmElement("sig_bits")]
public uint? SigBits { get; set; }
public SectionPCMCapabilities(string identifier)
: base(identifier)
{
Formats = new HashSet<PCM_FORMAT>();
Rates = new HashSet<PCM_RATE>();
}
public SectionPCMCapabilities()
: this(null)
{
}
}
public class FE_DAI : Section
{
[UcmElement("id")]
public uint ID { get; set; }
public FE_DAI(string identifier)
: base(identifier)
{
}
public FE_DAI()
: this(null)
{
}
}
public class PCMStream : Section
{
[UcmElement("capabilities")]
public string Capabilities { get; set; }
public PCMStream(string identifier)
: base(identifier)
{
}
public PCMStream()
: this(null)
{
}
}
public class SectionPCM : Section
{
[UcmElement("index")]
public uint Index { get; set; }
[UcmElement("id")]
public uint ID { get; set; }
[UcmSection("dai")]
public FE_DAI DAI { get; set; }
[UcmSection("pcm", "playback")]
public PCMStream Playback { get; set; }
[UcmSection("pcm", "capture")]
public PCMStream Capture { get; set; }
[UcmElement("compress")]
public bool? Compress { get; set; }
[UcmElement("symmetric_rates")]
public bool? SymmetricRates { get; set; }
[UcmElement("symmetric_channels")]
public bool? SymmetricChannels { get; set; }
[UcmElement("symmetric_sample_bits")]
public bool? SymmetricSampleBits { get; set; }
[UcmElement("data")]
public string Data { get; set; }
public SectionPCM(string identifier)
: base(identifier)
{
}
public SectionPCM()
: this(null)
{
}
}
public class SectionLink : Section
{
[UcmElement("index")]
public uint Index { get; set; }
[UcmElement("id")]
public uint ID { get; set; }
[UcmElement("stream_name")]
public string StreamName { get; set; }
[UcmArray("hw_configs")]
public string[] HwConfigs { get; set; }
[UcmElement("default_hw_conf_id")]
public uint DefaultHwConfId { get; set; }
[UcmElement("symmetric_rates")]
public bool? SymmetricRates { get; set; }
[UcmElement("symmetric_channels")]
public bool? SymmetricChannels { get; set; }
[UcmElement("symmetric_sample_bits")]
public bool? SymmetricSampleBits { get; set; }
[UcmElement("data")]
public string Data { get; set; }
public SectionLink(string identifier)
: base(identifier)
{
}
public SectionLink()
: this(null)
{
}
}
public class SectionCC : Section
{
[UcmElement("id")]
public uint ID { get; set; }
public SectionCC(string identifier)
: base(identifier)
{
}
public SectionCC()
: this(null)
{
}
}
/// <summary>
/// DAI physical PCM data formats.
/// </summary>
public enum DAI_FORMAT
{
[UcmEnum(Name = "I2S")] I2S = 1, // I2S mode
[UcmEnum(Name = "RIGHT_J")] RIGHT_J = 2, // Right Justified mode
[UcmEnum(Name = "LEFT_J")] LEFT_J = 3, // Left Justified mode
[UcmEnum(Name = "DSP_A")] DSP_A = 4, // L data MSB after FRM LRC
[UcmEnum(Name = "DSP_B")] DSP_B = 5, // L data MSB during FRM LRC
[UcmEnum(Name = "AC97")] AC97 = 6, // AC97
[UcmEnum(Name = "PDM")] PDM = 7 // Pulse density modulation
}
/// <summary>
/// DAI topology BCLK parameter.
/// For the backwards capability, by default codec is bclk master.
/// </summary>
public enum TPLG_BCLK
{
[UcmEnum("codec_master")] CM = 0, // codec is bclk master
[UcmEnum("codec_slave")] CS = 1 // codec is bclk slave
}
/// <summary>
/// DAI topology FSYNC parameter.
/// For the backwards capability, by default codec is fsync master.
/// </summary>
public enum TPLG_FSYNC
{
[UcmEnum("codec_master")] CM = 0, // codec is fsync master
[UcmEnum("codec_slave")] CS = 1 // codec is fsync slave
}
/// <summary>
/// DAI mclk_direction.
/// </summary>
public enum TPLG_MCLK
{
[UcmEnum("codec_mclk_out")] CO = 0, // for codec, mclk is output
[UcmEnum("codec_mclk_in")] CI = 1 // for codec, mclk is input
}
public class SectionHWConfig : Section
{
[UcmElement("id")]
public uint ID { get; set; }
[UcmElement("format")]
public DAI_FORMAT? Format { get; set; }
[UcmElement("bclk")]
public TPLG_BCLK? Bclk { get; set; }
[UcmElement("invert_bclk")]
public bool? InvertBclk { get; set; }
[UcmElement("bclk_rate")]
public uint? BclkRate { get; set; }
[UcmElement("fsync")]
public TPLG_FSYNC? Fsync { get; set; }
[UcmElement("invert_fsync")]
public bool? InvertFsync { get; set; }
[UcmElement("fsync_rate")]
public uint? FsyncRate { get; set; }
[UcmElement("mclk")]
public TPLG_MCLK? Mclk { get; set; }
[UcmElement("mclk_rate")]
public uint? MclkRate { get; set; }
[UcmElement("clock_gated")]
public bool? ClockGated { get; set; }
[UcmElement("tdm_slots")]
public uint? TdmSlots { get; set; }
[UcmElement("tdm_slot_width")]
public uint? TdmSlotWidth { get; set; }
[UcmElement("tx_slots")]
public uint? TxSlots { get; set; }
[UcmElement("rx_slots")]
public uint? RxSlots { get; set; }
[UcmElement("tx_channels")]
public uint? TxChannels { get; set; }
[UcmElement("rx_channels")]
public uint? RxChannels { get; set; }
public SectionHWConfig(string identifier)
: base(identifier)
{
}
public SectionHWConfig()
: this(null)
{
}
}
public class SectionDAI : Section
{
[UcmElement("index")]
public uint Index { get; set; }
[UcmElement("id")]
public uint ID { get; set; }
[UcmElement("playback")]