summaryrefslogtreecommitdiffstats
path: root/uisimulator/common/fmradio.c
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2005-08-16 06:50:25 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2005-08-16 06:50:25 +0000
commitd3fde76fc7842f231888cf7d4e7ba11251c5f13d (patch)
treef740f85a877f0a2cd3ebfadac2fd680a971e1207 /uisimulator/common/fmradio.c
parent1d4a6c0cc3f45925085356e8a049832167c1203f (diff)
downloadrockbox-d3fde76fc7842f231888cf7d4e7ba11251c5f13d.tar.gz
rockbox-d3fde76fc7842f231888cf7d4e7ba11251c5f13d.tar.bz2
rockbox-d3fde76fc7842f231888cf7d4e7ba11251c5f13d.zip
FM radio simulation working again
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7332 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'uisimulator/common/fmradio.c')
-rw-r--r--uisimulator/common/fmradio.c62
1 files changed, 46 insertions, 16 deletions
diff --git a/uisimulator/common/fmradio.c b/uisimulator/common/fmradio.c
index 49c7234e06..4ce4d66976 100644
--- a/uisimulator/common/fmradio.c
+++ b/uisimulator/common/fmradio.c
@@ -16,33 +16,63 @@
* KIND, either express or implied.
*
****************************************************************************/
+#include <stdbool.h>
+#include "config.h"
#include "debug.h"
+#include "tuner.h"
#ifdef CONFIG_TUNER
-static int fmstatus = 0;
+static int frequency = 0;
+static bool mono = false;
-static int fmradio_reg[3];
-
-int fmradio_read(int addr)
+void radio_set(int setting, int value)
{
- if(addr == 0)
- return fmradio_reg[2]; /* To please the hardware detection */
- else
+ switch(setting)
{
- if(addr == 3)
- {
- /* Fake a good radio station at 99.4MHz */
- if(((fmradio_reg[1] >> 3) & 0xffff) == 11010)
- return 0x100000 | 85600;
- }
+ case RADIO_SLEEP:
+ break;
+
+ case RADIO_FREQUENCY:
+ frequency = value;
+ break;
+
+ case RADIO_MUTE:
+ break;
+
+ case RADIO_FORCE_MONO:
+ mono = value?true:false;
+ break;
+
+ default:
+ return;
}
- return 0;
}
-void fmradio_set(int addr, int data)
+int radio_get(int setting)
{
- fmradio_reg[addr] = data;
+ int val = 0;
+
+ switch(setting)
+ {
+ case RADIO_PRESENT:
+ val = 1; /* true */
+ break;
+
+ case RADIO_TUNED:
+ if(frequency == 99500000)
+ val = 1;
+ break;
+
+ case RADIO_STEREO:
+ if(frequency == 99500000)
+ val = mono?0:1;
+ break;
+
+ case RADIO_ALL: /* debug query */
+ break;
+ }
+ return val;
}
#endif