summaryrefslogtreecommitdiff
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
parent1d4a6c0cc3f45925085356e8a049832167c1203f (diff)
downloadrockbox-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
-rw-r--r--apps/recorder/radio.c7
-rw-r--r--firmware/export/config-fmrecorder.h6
-rw-r--r--firmware/export/config-h100.h4
-rw-r--r--firmware/export/config-h120.h4
-rw-r--r--firmware/export/config-ondiofm.h8
-rw-r--r--uisimulator/common/fmradio.c62
6 files changed, 64 insertions, 27 deletions
diff --git a/apps/recorder/radio.c b/apps/recorder/radio.c
index 7554beb75e..633b591d50 100644
--- a/apps/recorder/radio.c
+++ b/apps/recorder/radio.c
@@ -102,6 +102,10 @@ bool handle_radio_presets(void);
102bool radio_menu(void); 102bool radio_menu(void);
103bool radio_add_preset(void); 103bool radio_add_preset(void);
104 104
105#ifdef SIMULATOR
106void radio_set(int setting, int value);
107int radio_get(int setting);
108#else
105#if CONFIG_TUNER == S1A0903X01 /* FM recorder */ 109#if CONFIG_TUNER == S1A0903X01 /* FM recorder */
106#define radio_set samsung_set 110#define radio_set samsung_set
107#define radio_get samsung_get 111#define radio_get samsung_get
@@ -112,9 +116,11 @@ bool radio_add_preset(void);
112void (*radio_set)(int setting, int value); 116void (*radio_set)(int setting, int value);
113int (*radio_get)(int setting); 117int (*radio_get)(int setting);
114#endif 118#endif
119#endif
115 120
116void radio_init(void) 121void radio_init(void)
117{ 122{
123#ifndef SIMULATOR
118#if CONFIG_TUNER == (S1A0903X01 | TEA5767) 124#if CONFIG_TUNER == (S1A0903X01 | TEA5767)
119 if (read_hw_mask() & TUNER_MODEL) 125 if (read_hw_mask() & TUNER_MODEL)
120 { 126 {
@@ -127,6 +133,7 @@ void radio_init(void)
127 radio_get = samsung_get; 133 radio_get = samsung_get;
128 } 134 }
129#endif 135#endif
136#endif
130 radio_stop(); 137 radio_stop();
131} 138}
132 139
diff --git a/firmware/export/config-fmrecorder.h b/firmware/export/config-fmrecorder.h
index b54d963c5c..40ba404a82 100644
--- a/firmware/export/config-fmrecorder.h
+++ b/firmware/export/config-fmrecorder.h
@@ -21,6 +21,9 @@
21/* The number of bytes reserved for loadable plugins */ 21/* The number of bytes reserved for loadable plugins */
22#define PLUGIN_BUFFER_SIZE 0x8000 22#define PLUGIN_BUFFER_SIZE 0x8000
23 23
24/* Define this if you have an FM Radio */
25#define CONFIG_TUNER S1A0903X01
26
24#ifndef SIMULATOR 27#ifndef SIMULATOR
25 28
26/* Define this if you have a MAS3587F */ 29/* Define this if you have a MAS3587F */
@@ -62,9 +65,6 @@
62/* FM recorders can wake up from RTC alarm */ 65/* FM recorders can wake up from RTC alarm */
63#define HAVE_ALARM_MOD 1 66#define HAVE_ALARM_MOD 1
64 67
65/* Define this if you have an FM Radio */
66#define CONFIG_TUNER S1A0903X01
67
68/* How to detect USB */ 68/* How to detect USB */
69#define USB_FMRECORDERSTYLE 1 69#define USB_FMRECORDERSTYLE 1
70 70
diff --git a/firmware/export/config-h100.h b/firmware/export/config-h100.h
index db6ecbf8ea..1fd73c25d3 100644
--- a/firmware/export/config-h100.h
+++ b/firmware/export/config-h100.h
@@ -47,11 +47,11 @@
47/* The number of bytes reserved for loadable plugins */ 47/* The number of bytes reserved for loadable plugins */
48#define PLUGIN_BUFFER_SIZE 0xC0000 48#define PLUGIN_BUFFER_SIZE 0xC0000
49 49
50#ifndef SIMULATOR
51
52#define CONFIG_TUNER TEA5767 50#define CONFIG_TUNER TEA5767
53#define CONFIG_TUNER_XTAL 32768000 51#define CONFIG_TUNER_XTAL 32768000
54 52
53#ifndef SIMULATOR
54
55/* Define this if you have a Motorola SCF5249 */ 55/* Define this if you have a Motorola SCF5249 */
56#define CONFIG_CPU MCF5249 56#define CONFIG_CPU MCF5249
57 57
diff --git a/firmware/export/config-h120.h b/firmware/export/config-h120.h
index 0d374c3947..a1828efad2 100644
--- a/firmware/export/config-h120.h
+++ b/firmware/export/config-h120.h
@@ -43,11 +43,11 @@
43/* The number of bytes reserved for loadable plugins */ 43/* The number of bytes reserved for loadable plugins */
44#define PLUGIN_BUFFER_SIZE 0xC0000 44#define PLUGIN_BUFFER_SIZE 0xC0000
45 45
46#ifndef SIMULATOR
47
48#define CONFIG_TUNER TEA5767 46#define CONFIG_TUNER TEA5767
49#define CONFIG_TUNER_XTAL 32768000 47#define CONFIG_TUNER_XTAL 32768000
50 48
49#ifndef SIMULATOR
50
51/* Define this if you have a Motorola SCF5249 */ 51/* Define this if you have a Motorola SCF5249 */
52#define CONFIG_CPU MCF5249 52#define CONFIG_CPU MCF5249
53 53
diff --git a/firmware/export/config-ondiofm.h b/firmware/export/config-ondiofm.h
index 0b15b39294..1b2857668a 100644
--- a/firmware/export/config-ondiofm.h
+++ b/firmware/export/config-ondiofm.h
@@ -18,6 +18,10 @@
18/* The number of bytes reserved for loadable plugins */ 18/* The number of bytes reserved for loadable plugins */
19#define PLUGIN_BUFFER_SIZE 0x8000 19#define PLUGIN_BUFFER_SIZE 0x8000
20 20
21/* Define this if you have an FM Radio */
22#define CONFIG_TUNER (S1A0903X01 | TEA5767) /* to be decided at runtime */
23#define CONFIG_TUNER_XTAL 13000000
24
21#ifndef SIMULATOR 25#ifndef SIMULATOR
22 26
23/* Define this if you have a SH7034 */ 27/* Define this if you have a SH7034 */
@@ -50,10 +54,6 @@
50/* Offset ( in the firmware file's header ) to the real data */ 54/* Offset ( in the firmware file's header ) to the real data */
51#define FIRMWARE_OFFSET_FILE_DATA 24 55#define FIRMWARE_OFFSET_FILE_DATA 24
52 56
53/* Define this if you have an FM Radio */
54#define CONFIG_TUNER (S1A0903X01 | TEA5767) /* to be decided at runtime */
55#define CONFIG_TUNER_XTAL 13000000
56
57/* Define this if the tuner is switched on by software */ 57/* Define this if the tuner is switched on by software */
58#define HAVE_TUNER_PWR_CTRL 58#define HAVE_TUNER_PWR_CTRL
59 59
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
23static int fmstatus = 0; 26static int frequency = 0;
27static bool mono = false;
24 28
25static int fmradio_reg[3]; 29void radio_set(int setting, int value)
26
27int 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
43void fmradio_set(int addr, int data) 52int 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