summaryrefslogtreecommitdiff
path: root/uisimulator/common
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
parent4c895953bb54baa691d73aaf186d9b70366591c0 (diff)
downloadrockbox-afd7421a4c705cb928a5ecb0416d9f2f9c42c7b5.tar.gz
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')
-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 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2002 by Linus Nielsen Feltzing
11 *
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19#include "debug.h"
20
21#ifdef HAVE_FMRADIO
22
23static int fmstatus = 0;
24
25static int fmradio_reg[3];
26
27int fmradio_read(int addr)
28{
29 if(addr == 0)
30 return fmradio_reg[2]; /* To please the hardware detection */
31 else
32 {
33 if(addr == 3)
34 {
35 /* Fake a good radio station at 99.4MHz */
36 if(((fmradio_reg[1] >> 3) & 0xffff) == 11010)
37 return 0x100000 | 85600;
38 }
39 }
40 return 0;
41}
42
43void fmradio_set(int addr, int data)
44{
45 fmradio_reg[addr] = data;
46}
47
48void fmradio_set_status(int status)
49{
50 fmstatus = status;
51}
52
53int fmradio_get_status(void)
54{
55 return fmstatus;
56}
57
58#endif