diff options
author | Linus Nielsen Feltzing <linus@haxx.se> | 2005-08-16 06:50:25 +0000 |
---|---|---|
committer | Linus Nielsen Feltzing <linus@haxx.se> | 2005-08-16 06:50:25 +0000 |
commit | d3fde76fc7842f231888cf7d4e7ba11251c5f13d (patch) | |
tree | f740f85a877f0a2cd3ebfadac2fd680a971e1207 /uisimulator | |
parent | 1d4a6c0cc3f45925085356e8a049832167c1203f (diff) | |
download | rockbox-d3fde76fc7842f231888cf7d4e7ba11251c5f13d.tar.gz 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')
-rw-r--r-- | uisimulator/common/fmradio.c | 62 |
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 @@ | |||
16 | * KIND, either express or implied. | 16 | * KIND, either express or implied. |
17 | * | 17 | * |
18 | ****************************************************************************/ | 18 | ****************************************************************************/ |
19 | #include <stdbool.h> | ||
20 | #include "config.h" | ||
19 | #include "debug.h" | 21 | #include "debug.h" |
22 | #include "tuner.h" | ||
20 | 23 | ||
21 | #ifdef CONFIG_TUNER | 24 | #ifdef CONFIG_TUNER |
22 | 25 | ||
23 | static int fmstatus = 0; | 26 | static int frequency = 0; |
27 | static bool mono = false; | ||
24 | 28 | ||
25 | static int fmradio_reg[3]; | 29 | void radio_set(int setting, int value) |
26 | |||
27 | int fmradio_read(int addr) | ||
28 | { | 30 | { |
29 | if(addr == 0) | 31 | switch(setting) |
30 | return fmradio_reg[2]; /* To please the hardware detection */ | ||
31 | else | ||
32 | { | 32 | { |
33 | if(addr == 3) | 33 | case RADIO_SLEEP: |
34 | { | 34 | break; |
35 | /* Fake a good radio station at 99.4MHz */ | 35 | |
36 | if(((fmradio_reg[1] >> 3) & 0xffff) == 11010) | 36 | case RADIO_FREQUENCY: |
37 | return 0x100000 | 85600; | 37 | frequency = value; |
38 | } | 38 | break; |
39 | |||
40 | case RADIO_MUTE: | ||
41 | break; | ||
42 | |||
43 | case RADIO_FORCE_MONO: | ||
44 | mono = value?true:false; | ||
45 | break; | ||
46 | |||
47 | default: | ||
48 | return; | ||
39 | } | 49 | } |
40 | return 0; | ||
41 | } | 50 | } |
42 | 51 | ||
43 | void fmradio_set(int addr, int data) | 52 | int radio_get(int setting) |
44 | { | 53 | { |
45 | fmradio_reg[addr] = data; | 54 | int val = 0; |
55 | |||
56 | switch(setting) | ||
57 | { | ||
58 | case RADIO_PRESENT: | ||
59 | val = 1; /* true */ | ||
60 | break; | ||
61 | |||
62 | case RADIO_TUNED: | ||
63 | if(frequency == 99500000) | ||
64 | val = 1; | ||
65 | break; | ||
66 | |||
67 | case RADIO_STEREO: | ||
68 | if(frequency == 99500000) | ||
69 | val = mono?0:1; | ||
70 | break; | ||
71 | |||
72 | case RADIO_ALL: /* debug query */ | ||
73 | break; | ||
74 | } | ||
75 | return val; | ||
46 | } | 76 | } |
47 | 77 | ||
48 | #endif | 78 | #endif |