summaryrefslogtreecommitdiff
path: root/firmware/export/pcm_sampr.h
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/export/pcm_sampr.h')
-rw-r--r--firmware/export/pcm_sampr.h87
1 files changed, 66 insertions, 21 deletions
diff --git a/firmware/export/pcm_sampr.h b/firmware/export/pcm_sampr.h
index 84f4466308..70f2dc2ba2 100644
--- a/firmware/export/pcm_sampr.h
+++ b/firmware/export/pcm_sampr.h
@@ -34,21 +34,25 @@
34/* These must be macros for comparison with SAMPR_CAP_* flags by the 34/* These must be macros for comparison with SAMPR_CAP_* flags by the
35 preprocessor. Add samplerate index in descending order renumbering 35 preprocessor. Add samplerate index in descending order renumbering
36 the ones later in the list if any */ 36 the ones later in the list if any */
37#define FREQ_96 0 37#define FREQ_192 0
38#define FREQ_88 1 38#define FREQ_176 1
39#define FREQ_64 2 39#define FREQ_96 2
40#define FREQ_48 3 40#define FREQ_88 3
41#define FREQ_44 4 41#define FREQ_64 4
42#define FREQ_32 5 42#define FREQ_48 5
43#define FREQ_24 6 43#define FREQ_44 6
44#define FREQ_22 7 44#define FREQ_32 7
45#define FREQ_16 8 45#define FREQ_24 8
46#define FREQ_12 9 46#define FREQ_22 9
47#define FREQ_11 10 47#define FREQ_16 10
48#define FREQ_8 11 48#define FREQ_12 11
49#define SAMPR_NUM_FREQ 12 49#define FREQ_11 12
50#define FREQ_8 13
51#define SAMPR_NUM_FREQ 14
50 52
51/* sample rate values in HZ */ 53/* sample rate values in HZ */
54#define SAMPR_192 192000
55#define SAMPR_176 176400
52#define SAMPR_96 96000 56#define SAMPR_96 96000
53#define SAMPR_88 88200 57#define SAMPR_88 88200
54#define SAMPR_64 64000 58#define SAMPR_64 64000
@@ -63,6 +67,8 @@
63#define SAMPR_8 8000 67#define SAMPR_8 8000
64 68
65/* sample rate capability bits */ 69/* sample rate capability bits */
70#define SAMPR_CAP_192 (1 << FREQ_192)
71#define SAMPR_CAP_176 (1 << FREQ_176)
66#define SAMPR_CAP_96 (1 << FREQ_96) 72#define SAMPR_CAP_96 (1 << FREQ_96)
67#define SAMPR_CAP_88 (1 << FREQ_88) 73#define SAMPR_CAP_88 (1 << FREQ_88)
68#define SAMPR_CAP_64 (1 << FREQ_64) 74#define SAMPR_CAP_64 (1 << FREQ_64)
@@ -75,13 +81,25 @@
75#define SAMPR_CAP_12 (1 << FREQ_12) 81#define SAMPR_CAP_12 (1 << FREQ_12)
76#define SAMPR_CAP_11 (1 << FREQ_11) 82#define SAMPR_CAP_11 (1 << FREQ_11)
77#define SAMPR_CAP_8 (1 << FREQ_8) 83#define SAMPR_CAP_8 (1 << FREQ_8)
78#define SAMPR_CAP_ALL (SAMPR_CAP_96 | SAMPR_CAP_88 | SAMPR_CAP_64 | \ 84
85#define SAMPR_CAP_ALL_192 (SAMPR_CAP_192 | SAMPR_CAP_176 | \
86 SAMPR_CAP_96 | SAMPR_CAP_88 | SAMPR_CAP_64 | \
87 SAMPR_CAP_48 | SAMPR_CAP_44 | SAMPR_CAP_32 | \
88 SAMPR_CAP_24 | SAMPR_CAP_22 | SAMPR_CAP_16 | \
89 SAMPR_CAP_12 | SAMPR_CAP_11 | SAMPR_CAP_8)
90
91#define SAMPR_CAP_ALL_96 (SAMPR_CAP_96 | SAMPR_CAP_88 | SAMPR_CAP_64 | \
79 SAMPR_CAP_48 | SAMPR_CAP_44 | SAMPR_CAP_32 | \ 92 SAMPR_CAP_48 | SAMPR_CAP_44 | SAMPR_CAP_32 | \
80 SAMPR_CAP_24 | SAMPR_CAP_22 | SAMPR_CAP_16 | \ 93 SAMPR_CAP_24 | SAMPR_CAP_22 | SAMPR_CAP_16 | \
81 SAMPR_CAP_12 | SAMPR_CAP_11 | SAMPR_CAP_8) 94 SAMPR_CAP_12 | SAMPR_CAP_11 | SAMPR_CAP_8)
82 95
96#define SAMPR_CAP_ALL_48 (SAMPR_CAP_48 | SAMPR_CAP_44 | SAMPR_CAP_32 | \
97 SAMPR_CAP_24 | SAMPR_CAP_22 | SAMPR_CAP_16 | \
98 SAMPR_CAP_12 | SAMPR_CAP_11 | SAMPR_CAP_8)
99
83/* List of sampling rates that are good enough for most purposes. */ 100/* List of sampling rates that are good enough for most purposes. */
84#define SAMPR_CAP_ALL_GE_22 (SAMPR_CAP_96 | SAMPR_CAP_88 | SAMPR_CAP_64 | \ 101#define SAMPR_CAP_ALL_GE_22 (SAMPR_CAP_192 | SAMPR_CAP_176 | \
102 SAMPR_CAP_96 | SAMPR_CAP_88 | SAMPR_CAP_64 | \
85 SAMPR_CAP_48 | SAMPR_CAP_44 | SAMPR_CAP_32 | \ 103 SAMPR_CAP_48 | SAMPR_CAP_44 | SAMPR_CAP_32 | \
86 SAMPR_CAP_24 | SAMPR_CAP_22) 104 SAMPR_CAP_24 | SAMPR_CAP_22)
87 105
@@ -99,13 +117,29 @@ enum hw_freq_indexes
99{ 117{
100 __HW_FREQ_START_INDEX = -1, /* Make sure first in list is 0 */ 118 __HW_FREQ_START_INDEX = -1, /* Make sure first in list is 0 */
101 119
120/* 192000 */
121#if (HW_SAMPR_CAPS & SAMPR_CAP_192) /* Macros and enums for each FREQ: */
122 HW_FREQ_192, /* Index in enumeration */
123#define HW_HAVE_192 /* Defined if this FREQ is defined */
124#define HW_HAVE_192_(...) __VA_ARGS__ /* Output its parameters for this FREQ */
125#else
126#define HW_HAVE_192_(...) /* Discards its parameters for this FREQ */
127#endif
128/* 176400 */
129#if (HW_SAMPR_CAPS & SAMPR_CAP_176)
130 HW_FREQ_176,
131#define HW_HAVE_176
132#define HW_HAVE_176_(...) __VA_ARGS__
133#else
134#define HW_HAVE_176_(...)
135#endif
102/* 96000 */ 136/* 96000 */
103#if (HW_SAMPR_CAPS & SAMPR_CAP_96) /* Macros and enums for each FREQ: */ 137#if (HW_SAMPR_CAPS & SAMPR_CAP_96)
104 HW_FREQ_96, /* Index in enumeration */ 138 HW_FREQ_96,
105#define HW_HAVE_96 /* Defined if this FREQ is defined */ 139#define HW_HAVE_96
106#define HW_HAVE_96_(...) __VA_ARGS__ /* Output its parameters for this FREQ */ 140#define HW_HAVE_96_(...) __VA_ARGS__
107#else 141#else
108#define HW_HAVE_96_(...) /* Discards its parameters for this FREQ */ 142#define HW_HAVE_96_(...)
109#endif 143#endif
110/* 88200 */ 144/* 88200 */
111#if (HW_SAMPR_CAPS & SAMPR_CAP_88) 145#if (HW_SAMPR_CAPS & SAMPR_CAP_88)
@@ -202,11 +236,22 @@ enum hw_freq_indexes
202extern const unsigned long hw_freq_sampr[HW_NUM_FREQ]; 236extern const unsigned long hw_freq_sampr[HW_NUM_FREQ];
203#endif /* PCM_SAMPR_CONFIG_ONLY */ 237#endif /* PCM_SAMPR_CONFIG_ONLY */
204 238
239#if HW_SAMPR_CAPS & SAMPR_CAP_44
205#define HW_FREQ_DEFAULT HW_FREQ_44 240#define HW_FREQ_DEFAULT HW_FREQ_44
206#define HW_SAMPR_DEFAULT SAMPR_44 241#define HW_SAMPR_DEFAULT SAMPR_44
242#elif HW_SAMPR_CAPS & SAMPR_CAP_48
243#define HW_FREQ_DEFAULT HW_FREQ_48
244#define HW_SAMPR_DEFAULT SAMPR_48
245#else
246#error "Neither 48 or 44KHz supported?"
247#endif
207 248
208 249
209#if HW_SAMPR_CAPS & SAMPR_CAP_96 250#if HW_SAMPR_CAPS & SAMPR_CAP_192
251# define HW_SAMPR_MAX SAMPR_192
252#elif HW_SAMPR_CAPS & SAMPR_CAP_176
253# define HW_SAMPR_MAX SAMPR_176
254#elif HW_SAMPR_CAPS & SAMPR_CAP_96
210# define HW_SAMPR_MAX SAMPR_96 255# define HW_SAMPR_MAX SAMPR_96
211#elif HW_SAMPR_CAPS & SAMPR_CAP_88 256#elif HW_SAMPR_CAPS & SAMPR_CAP_88
212# define HW_SAMPR_MAX SAMPR_88 257# define HW_SAMPR_MAX SAMPR_88