summaryrefslogtreecommitdiffstats
path: root/uisimulator/common/fmradio.c
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2004-07-02 07:43:49 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2004-07-02 07:43:49 +0000
commitafd7421a4c705cb928a5ecb0416d9f2f9c42c7b5 (patch)
treef1571264ca26d918788479cf924f638d183a9a02 /uisimulator/common/fmradio.c
parent4c895953bb54baa691d73aaf186d9b70366591c0 (diff)
downloadrockbox-afd7421a4c705cb928a5ecb0416d9f2f9c42c7b5.tar.gz
rockbox-afd7421a4c705cb928a5ecb0416d9f2f9c42c7b5.tar.bz2
rockbox-afd7421a4c705cb928a5ecb0416d9f2f9c42c7b5.zip
Added FM radio simulation, with a good station at 99.4MHz
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4823 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'uisimulator/common/fmradio.c')
-rw-r--r--uisimulator/common/fmradio.c58
1 files changed, 58 insertions, 0 deletions
diff --git a/uisimulator/common/fmradio.c b/uisimulator/common/fmradio.c
new file mode 100644
index 0000000000..280a963f5a
--- /dev/null
+++ b/uisimulator/common/fmradio.c
@@ -0,0 +1,58 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2002 by Linus Nielsen Feltzing
+ *
+ * All files in this archive are subject to the GNU General Public License.
+ * See the file COPYING in the source tree root for full license agreement.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+#include "debug.h"
+
+#ifdef HAVE_FMRADIO
+
+static int fmstatus = 0;
+
+static int fmradio_reg[3];
+
+int fmradio_read(int addr)
+{
+ if(addr == 0)
+ return fmradio_reg[2]; /* To please the hardware detection */
+ else
+ {
+ if(addr == 3)
+ {
+ /* Fake a good radio station at 99.4MHz */
+ if(((fmradio_reg[1] >> 3) & 0xffff) == 11010)
+ return 0x100000 | 85600;
+ }
+ }
+ return 0;
+}
+
+void fmradio_set(int addr, int data)
+{
+ fmradio_reg[addr] = data;
+}
+
+void fmradio_set_status(int status)
+{
+ fmstatus = status;
+}
+
+int fmradio_get_status(void)
+{
+ return fmstatus;
+}
+
+#endif