summaryrefslogtreecommitdiff
path: root/uisimulator/common/fmradio.c
diff options
context:
space:
mode:
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 @@
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