summaryrefslogtreecommitdiffstats
path: root/firmware/export
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2010-06-26 10:07:17 +0000
committerMichael Sevakis <jethead71@rockbox.org>2010-06-26 10:07:17 +0000
commitb15a523870d6aa45b38b92547053beb986b92d9a (patch)
tree8b75fe5f13a3418186cb11c01062ad415490036b /firmware/export
parentac622c6d673c708d48527db8a189401422a5d03c (diff)
downloadrockbox-b15a523870d6aa45b38b92547053beb986b92d9a.tar.gz
rockbox-b15a523870d6aa45b38b92547053beb986b92d9a.zip
e200v1/c200v1: Implement limited samplerate switching. Rates 24kHz and below are being a bear as far as minor crackling at higher amplitude-- leave them out for the time being since no solution is currently evident. 48, 44, 32 (rec rates 24, 22, 16) seem perfectly fine. I'm betting c200 is ok to include because it uses the same setup as e200.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27139 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/export')
-rw-r--r--firmware/export/as3514.h1
-rw-r--r--firmware/export/config/sansac200.h4
-rw-r--r--firmware/export/config/sansae200.h9
-rw-r--r--firmware/export/pcm.h13
-rw-r--r--firmware/export/pcm_sampr.h20
5 files changed, 40 insertions, 7 deletions
diff --git a/firmware/export/as3514.h b/firmware/export/as3514.h
index ffcf9186e7..de975ce3c6 100644
--- a/firmware/export/as3514.h
+++ b/firmware/export/as3514.h
@@ -28,6 +28,7 @@ extern int tenthdb2master(int db);
extern void audiohw_set_master_vol(int vol_l, int vol_r);
extern void audiohw_set_lineout_vol(int vol_l, int vol_r);
+extern void audiohw_set_sampr_dividers(int fsel);
/* Register Descriptions */
diff --git a/firmware/export/config/sansac200.h b/firmware/export/config/sansac200.h
index 5905b6a3f9..6c05ba5a1c 100644
--- a/firmware/export/config/sansac200.h
+++ b/firmware/export/config/sansac200.h
@@ -7,12 +7,12 @@
#define MODEL_NUMBER 20
#define MODEL_NAME "Sandisk Sansa c200 series"
-#define HW_SAMPR_CAPS (SAMPR_CAP_44)
+#define HW_SAMPR_CAPS (SAMPR_CAP_48 | SAMPR_CAP_44 | SAMPR_CAP_32)
/* define this if you have recording possibility */
#define HAVE_RECORDING
-#define REC_SAMPR_CAPS (SAMPR_CAP_22)
+#define REC_SAMPR_CAPS (SAMPR_CAP_24 | SAMPR_CAP_22 | SAMPR_CAP_16)
#define REC_FREQ_DEFAULT REC_FREQ_22 /* Default is not 44.1kHz */
#define REC_SAMPR_DEFAULT SAMPR_22
diff --git a/firmware/export/config/sansae200.h b/firmware/export/config/sansae200.h
index 8f4f3235dc..501e9eac37 100644
--- a/firmware/export/config/sansae200.h
+++ b/firmware/export/config/sansae200.h
@@ -7,15 +7,20 @@
#define MODEL_NUMBER 16
#define MODEL_NAME "Sandisk Sansa e200 series"
-#define HW_SAMPR_CAPS (SAMPR_CAP_44)
+#define HW_SAMPR_CAPS (SAMPR_CAP_48 | SAMPR_CAP_44 | SAMPR_CAP_32)
/* define this if you have recording possibility */
#define HAVE_RECORDING
-#define REC_SAMPR_CAPS (SAMPR_CAP_22)
+#define REC_SAMPR_CAPS (SAMPR_CAP_24 | SAMPR_CAP_22 | SAMPR_CAP_16)
#define REC_FREQ_DEFAULT REC_FREQ_22 /* Default is not 44.1kHz */
#define REC_SAMPR_DEFAULT SAMPR_22
+/* because the samplerates don't match at each point, we must be able to
+ * tell PCM which set of rates to use. not needed if recording rates are
+ * a simple subset of playback rates and are equal values. */
+#define CONFIG_SAMPR_TYPES
+
/* Define bitmask of input sources - recordable bitmask can be defined
explicitly if different */
#define INPUT_SRC_CAPS (SRC_CAP_MIC | SRC_CAP_FMRADIO)
diff --git a/firmware/export/pcm.h b/firmware/export/pcm.h
index 02fa04cb7e..e388e29f0c 100644
--- a/firmware/export/pcm.h
+++ b/firmware/export/pcm.h
@@ -54,9 +54,16 @@ typedef void (*pcm_play_callback_type)(unsigned char **start,
size_t *size);
typedef void (*pcm_rec_callback_type)(int status, void **start, size_t *size);
-/* set the pcm frequency - use values in hw_sampr_list
- * use -1 for the default frequency
- */
+/* set the pcm frequency - use values in hw_sampr_list
+ * when CONFIG_SAMPR_TYPES is #defined, or-in SAMPR_TYPE_* fields with
+ * frequency value. SAMPR_TYPE_PLAY is 0 and the default if none is
+ * specified. */
+#ifdef CONFIG_SAMPR_TYPES
+#ifdef SAMPR_TYPE_REC
+unsigned int pcm_sampr_type_rec_to_play(unsigned int samplerate);
+#endif
+#endif /* CONFIG_SAMPR_TYPES */
+
void pcm_set_frequency(unsigned int samplerate);
/* apply settings to hardware immediately */
void pcm_apply_settings(void);
diff --git a/firmware/export/pcm_sampr.h b/firmware/export/pcm_sampr.h
index 2204b9c059..54db8a1dfb 100644
--- a/firmware/export/pcm_sampr.h
+++ b/firmware/export/pcm_sampr.h
@@ -312,4 +312,24 @@ enum rec_freq_indexes
extern const unsigned long rec_freq_sampr[REC_NUM_FREQ];
#endif /* HAVE_RECORDING */
+#ifdef CONFIG_SAMPR_TYPES
+
+#define SAMPR_TYPE_MASK (0xff << 24)
+#define SAMPR_TYPE_PLAY (0x00 << 24)
+#ifdef HAVE_RECORDING
+#define SAMPR_TYPE_REC (0x01 << 24)
+#endif
+
+unsigned int sampr_type_rec_to_play(unsigned int samplerate);
+
+#else /* ndef CONFIG_SAMPR_TYPES */
+
+/* Types are ignored and == 0 */
+#define SAMPR_TYPE_PLAY 0
+#ifdef HAVE_RECORDING
+#define SAMPR_TYPE_REC 0
+#endif
+
+#endif /* CONFIG_SAMPR_TYPES */
+
#endif /* PCM_SAMPR_H */