summaryrefslogtreecommitdiff
path: root/firmware/export
diff options
context:
space:
mode:
authorLaurent Gautier <creposucre@rockbox.org>2009-12-01 17:54:40 +0000
committerLaurent Gautier <creposucre@rockbox.org>2009-12-01 17:54:40 +0000
commit0260852771aef7a6e9045684f0c3d0d7e01909f7 (patch)
tree6fa4b42230d1289857f84405defad94cc2de86b8 /firmware/export
parent63d79148fd07aebd2b425c0414b7b9622b312399 (diff)
downloadrockbox-0260852771aef7a6e9045684f0c3d0d7e01909f7.zip
rockbox-0260852771aef7a6e9045684f0c3d0d7e01909f7.tar.gz
rockbox-0260852771aef7a6e9045684f0c3d0d7e01909f7.tar.bz2
rockbox-0260852771aef7a6e9045684f0c3d0d7e01909f7.tar.xz
Add support for the ipod FM remote to the 4G, Color, 5G, nano 1G with RDS
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23805 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/export')
-rw-r--r--firmware/export/config-ipod4g.h6
-rw-r--r--firmware/export/config-ipodcolor.h6
-rw-r--r--firmware/export/config-ipodnano.h6
-rw-r--r--firmware/export/config-ipodvideo.h6
-rw-r--r--firmware/export/config.h1
-rw-r--r--firmware/export/iap.h5
-rw-r--r--firmware/export/ipod_remote_tuner.h75
-rw-r--r--firmware/export/tuner.h21
8 files changed, 121 insertions, 5 deletions
diff --git a/firmware/export/config-ipod4g.h b/firmware/export/config-ipod4g.h
index c00a678..e6bdc35 100644
--- a/firmware/export/config-ipod4g.h
+++ b/firmware/export/config-ipod4g.h
@@ -18,7 +18,7 @@
/* Define bitmask of input sources - recordable bitmask can be defined
explicitly if different */
-#define INPUT_SRC_CAPS (SRC_CAP_MIC | SRC_CAP_LINEIN)
+#define INPUT_SRC_CAPS (SRC_CAP_MIC | SRC_CAP_LINEIN | SRC_CAP_FMRADIO)
/* define the bitmask of hardware sample rates */
#define HW_SAMPR_CAPS (SAMPR_CAP_44)
@@ -144,6 +144,10 @@
#define CURRENT_RECORD 35 /* FIXME: this needs adjusting */
#endif
+/* Define Apple remote tuner */
+#define CONFIG_TUNER IPOD_REMOTE_TUNER
+#define HAVE_RDS_CAP
+
/* Define this if you have a PortalPlayer PP5020 */
#define CONFIG_CPU PP5020
diff --git a/firmware/export/config-ipodcolor.h b/firmware/export/config-ipodcolor.h
index 751522d..0f1de4f 100644
--- a/firmware/export/config-ipodcolor.h
+++ b/firmware/export/config-ipodcolor.h
@@ -18,7 +18,7 @@
/* Define bitmask of input sources - recordable bitmask can be defined
explicitly if different */
-#define INPUT_SRC_CAPS (SRC_CAP_MIC | SRC_CAP_LINEIN)
+#define INPUT_SRC_CAPS (SRC_CAP_MIC | SRC_CAP_LINEIN | SRC_CAP_FMRADIO)
/* define the bitmask of hardware sample rates */
#define HW_SAMPR_CAPS (SAMPR_CAP_44)
@@ -121,6 +121,10 @@
/* define this if the unit can be powered or charged via USB */
#define HAVE_USB_POWER
+/* Define Apple remote tuner */
+#define CONFIG_TUNER IPOD_REMOTE_TUNER
+#define HAVE_RDS_CAP
+
/* Define this if you have a PortalPlayer PP5020 */
#define CONFIG_CPU PP5020
diff --git a/firmware/export/config-ipodnano.h b/firmware/export/config-ipodnano.h
index 68ed152..e1ec1af 100644
--- a/firmware/export/config-ipodnano.h
+++ b/firmware/export/config-ipodnano.h
@@ -18,7 +18,7 @@
/* Define bitmask of input sources - recordable bitmask can be defined
explicitly if different */
-#define INPUT_SRC_CAPS (SRC_CAP_MIC | SRC_CAP_LINEIN)
+#define INPUT_SRC_CAPS (SRC_CAP_MIC | SRC_CAP_LINEIN | SRC_CAP_FMRADIO)
/* define the bitmask of hardware sample rates */
#define HW_SAMPR_CAPS (SAMPR_CAP_44)
@@ -134,6 +134,10 @@
#define CURRENT_RECORD 35 /* FIXME: this needs adjusting */
#endif
+/* Define Apple remote tuner */
+#define CONFIG_TUNER IPOD_REMOTE_TUNER
+#define HAVE_RDS_CAP
+
/* Define this if you have a PortalPlayer PP5022 */
#define CONFIG_CPU PP5022
diff --git a/firmware/export/config-ipodvideo.h b/firmware/export/config-ipodvideo.h
index f00de9c..59ac646 100644
--- a/firmware/export/config-ipodvideo.h
+++ b/firmware/export/config-ipodvideo.h
@@ -18,7 +18,7 @@
/* Define bitmask of input sources - recordable bitmask can be defined
explicitly if different */
-#define INPUT_SRC_CAPS (SRC_CAP_MIC | SRC_CAP_LINEIN)
+#define INPUT_SRC_CAPS (SRC_CAP_MIC | SRC_CAP_LINEIN | SRC_CAP_FMRADIO)
/* define the bitmask of hardware sample rates */
#define HW_SAMPR_CAPS (SAMPR_CAP_48 | SAMPR_CAP_44 | SAMPR_CAP_32 | \
@@ -155,6 +155,10 @@
#define CURRENT_RECORD 35 /* FIXME: this needs adjusting */
#endif
+/* Define Apple remote tuner */
+#define CONFIG_TUNER IPOD_REMOTE_TUNER
+#define HAVE_RDS_CAP
+
/* Define this if you have a PortalPlayer PP5022 */
#define CONFIG_CPU PP5022
diff --git a/firmware/export/config.h b/firmware/export/config.h
index 9c7beca..088cab7 100644
--- a/firmware/export/config.h
+++ b/firmware/export/config.h
@@ -40,6 +40,7 @@
#define SI4700 0x08 /* Silicon Labs */
#define TEA5760 0x10 /* Philips */
#define LV240000 0x20 /* Sanyo */
+#define IPOD_REMOTE_TUNER 0x40 /* Apple */
/* CONFIG_CODEC */
#define MAS3587F 3587
diff --git a/firmware/export/iap.h b/firmware/export/iap.h
index e945d0c..d00e5f3 100644
--- a/firmware/export/iap.h
+++ b/firmware/export/iap.h
@@ -20,6 +20,9 @@
#ifndef __IAP_H__
#define __IAP_H__
+#define RX_BUFLEN 260
+#define TX_BUFLEN 128
+
extern int iap_getc(unsigned char x);
extern void iap_write_pkt(unsigned char data, int len);
extern void iap_setup(int ratenum);
@@ -27,5 +30,7 @@ extern void iap_bitrate_set(int ratenum);
extern void iap_periodic(void);
extern void iap_handlepkt(void);
extern void iap_track_changed(void *ignored);
+extern void iap_send_pkt(const unsigned char * data, int len);
+extern unsigned char serbuf[RX_BUFLEN];
#endif
diff --git a/firmware/export/ipod_remote_tuner.h b/firmware/export/ipod_remote_tuner.h
new file mode 100644
index 0000000..28fcfe1
--- /dev/null
+++ b/firmware/export/ipod_remote_tuner.h
@@ -0,0 +1,75 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id: ipod_remote_tuner.h
+ * Tuner header for the ipod remote tuner and others remote tuners
+ *
+ * Copyright (C) 2009 Laurent Gautier
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+
+#ifndef _IPOD_REMOTE_TUNER_H_
+#define _IPOD_REMOTE_TUNER_H_
+
+#define HAVE_RADIO_REGION
+#define TIMEOUT_VALUE 20
+
+extern int radio_present;
+extern int tuner_frequency;
+extern int tuner_signal_power;
+extern int radio_tuned;
+
+/* update tuner state: plugged or unplugged when in radio mode */
+extern void rmt_tuner_region(int region);
+extern void rmt_tuner_set_freq(int curr_freq);
+extern void rmt_tuner_freq(void);
+extern void rmt_tuner_scan(int direction);
+
+/* tuner mode state: ON or OFF */
+extern void rmt_tuner_sleep(int state);
+
+/* parameters are stereo/mono, deemphasis, delta freq... */
+extern void rmt_tuner_set_param(unsigned char tuner_param);
+
+extern void rmt_tuner_mute(int value);
+extern void rmt_tuner_signal_power(unsigned char value);
+
+extern void rmt_tuner_rds_data(void);
+
+struct rmt_tuner_region_data
+{
+ /* 0: 50us, 1: 75us */
+ unsigned char deemphasis;
+ /* 0: europe, 1: japan (BL in TEA spec)*/
+ unsigned char band;
+ /* 0: us/australia (200kHz), 1: europe/japan (100kHz), 2: (50kHz) */
+ unsigned char spacing;
+} __attribute__((packed));
+
+extern const struct rmt_tuner_region_data
+ rmt_tuner_region_data[TUNER_NUM_REGIONS];
+
+int ipod_rmt_tuner_set(int setting, int value);
+int ipod_rmt_tuner_get(int setting);
+char* ipod_get_rds_info(int setting);
+
+
+#ifndef CONFIG_TUNER_MULTI
+#define tuner_set ipod_rmt_tuner_set
+#define tuner_get ipod_rmt_tuner_get
+#define tuner_get_rds_info ipod_get_rds_info
+#endif
+
+#endif /* _IPOD_REMOTE_TUNER_H_ */
diff --git a/firmware/export/tuner.h b/firmware/export/tuner.h
index b27e660..6339216 100644
--- a/firmware/export/tuner.h
+++ b/firmware/export/tuner.h
@@ -33,7 +33,7 @@ enum
RADIO_MUTE,
RADIO_FORCE_MONO,
RADIO_SCAN_FREQUENCY,
-
+
/* Put new general-purpose settings above this line */
__RADIO_SET_STANDARD_LAST
};
@@ -44,11 +44,25 @@ enum
RADIO_PRESENT = 0,
RADIO_TUNED,
RADIO_STEREO,
+ /* RADIO_EVENT is an event that requests a screen update */
+ RADIO_EVENT,
/* Put new general-purpose readback values above this line */
__RADIO_GET_STANDARD_LAST
};
+#ifdef HAVE_RDS_CAP
+/** Readback from the tuner RDS layer **/
+enum
+{
+ RADIO_RDS_NAME,
+ RADIO_RDS_TEXT,
+
+ /* Put new general-purpose readback values above this line */
+ __RADIO_GET_RDS_INFO_STANDARD_LAST
+};
+#endif
+
/** Tuner regions **/
/* Basic region information */
@@ -114,6 +128,11 @@ extern int (*tuner_get)(int setting);
#include "si4700.h"
#endif
+/* Apple remote tuner */
+#if (CONFIG_TUNER & IPOD_REMOTE_TUNER)
+#include "ipod_remote_tuner.h"
+#endif
+
#endif /* SIMULATOR */
/* Additional messages that get enumerated after tuner driver headers */