summaryrefslogtreecommitdiff
path: root/uisimulator
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
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')
-rw-r--r--uisimulator/common/fmradio.c58
-rw-r--r--uisimulator/win32/Makefile15
-rw-r--r--uisimulator/x11/Makefile12
3 files changed, 80 insertions, 5 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
diff --git a/uisimulator/win32/Makefile b/uisimulator/win32/Makefile
index 59949b951c..f9c363e17b 100644
--- a/uisimulator/win32/Makefile
+++ b/uisimulator/win32/Makefile
@@ -27,6 +27,8 @@ ifeq ($(DISPLAY),-DHAVE_LCD_BITMAP)
27 MACHINEDIR = $(RECDIR) 27 MACHINEDIR = $(RECDIR)
28 # not very nice to set RTC like this, but... 28 # not very nice to set RTC like this, but...
29 RTC += -DHAVE_RTC 29 RTC += -DHAVE_RTC
30 # not very nice to set RADIO like this, but...
31 RADIO += -DHAVE_FMRADIO
30else 32else
31 MACHINEDIR = $(PLAYDIR) 33 MACHINEDIR = $(PLAYDIR)
32endif 34endif
@@ -53,7 +55,8 @@ LANGUAGE = english
53TARGET = $(OBJDIR)/uisw32.exe 55TARGET = $(OBJDIR)/uisw32.exe
54 56
55DEFINES = -DHAVE_CONFIG_H -DGETTIMEOFDAY_TWO_ARGS -DSIMULATOR \ 57DEFINES = -DHAVE_CONFIG_H -DGETTIMEOFDAY_TWO_ARGS -DSIMULATOR \
56$(KEYPAD) $(DISPLAY) -DAPPSVERSION=\"$(VERSION)\" $(EXTRA_DEFINES) $(RTC) 58$(KEYPAD) $(DISPLAY) -DAPPSVERSION=\"$(VERSION)\" $(EXTRA_DEFINES) \
59$(RTC) $(RADIO)
57 60
58LDFLAGS = -lgdi32 -luser32 61LDFLAGS = -lgdi32 -luser32
59 62
@@ -110,12 +113,12 @@ APPS = main.c tree.c menu.c credits.c main_menu.c icons.c language.c \
110MENUS = settings_menu.c sound_menu.c playlist_menu.c 113MENUS = settings_menu.c sound_menu.c playlist_menu.c
111 114
112ifeq ($(DISPLAY),-DHAVE_LCD_BITMAP) 115ifeq ($(DISPLAY),-DHAVE_LCD_BITMAP)
113 APPS += bmp.c widgets.c 116 APPS += bmp.c widgets.c radio.c
114endif 117endif
115 118
116SRCS = button.c lcd-win32.c panic-win32.c thread-win32.c \ 119SRCS = button.c lcd-win32.c panic-win32.c thread-win32.c \
117 debug-win32.c kernel.c string-win32.c uisw32.c stubs.c \ 120 debug-win32.c kernel.c string-win32.c uisw32.c stubs.c \
118 $(APPS) $(MENUS) $(FIRMSRCS) $(COMMONSRCS) sim_icons.c 121 $(APPS) $(MENUS) $(FIRMSRCS) $(COMMONSRCS) sim_icons.c fmradio.c
119 122
120OBJS := $(OBJDIR)/lang.o $(SRCS:%.c=$(OBJDIR)/%.o) $(OBJDIR)/uisw32-res.o 123OBJS := $(OBJDIR)/lang.o $(SRCS:%.c=$(OBJDIR)/%.o) $(OBJDIR)/uisw32-res.o
121 124
@@ -315,9 +318,15 @@ $(OBJDIR)/io.o: $(SIMCOMMON)/io.c
315$(OBJDIR)/lcd-playersim.o: $(SIMCOMMON)/lcd-playersim.c 318$(OBJDIR)/lcd-playersim.o: $(SIMCOMMON)/lcd-playersim.c
316 $(CC) $(CFLAGS) -c $< -o $@ 319 $(CC) $(CFLAGS) -c $< -o $@
317 320
321$(OBJDIR)/fmradio.o: $(SIMCOMMON)/fmradio.c
322 $(CC) $(CFLAGS) -c $< -o $@
323
318$(OBJDIR)/lcd-player.o: $(DRIVERS)/lcd-player.c 324$(OBJDIR)/lcd-player.o: $(DRIVERS)/lcd-player.c
319 $(CC) $(CFLAGS) -c $< -o $@ 325 $(CC) $(CFLAGS) -c $< -o $@
320 326
327$(OBJDIR)/radio.o: $(RECDIR)/radio.c
328 $(CC) $(APPCFLAGS) -c $< -o $@
329
321# these ones are simulator-specific 330# these ones are simulator-specific
322 331
323$(OBJDIR)/%.o: %.c 332$(OBJDIR)/%.o: %.c
diff --git a/uisimulator/x11/Makefile b/uisimulator/x11/Makefile
index 38983eac47..6283989776 100644
--- a/uisimulator/x11/Makefile
+++ b/uisimulator/x11/Makefile
@@ -26,6 +26,8 @@ ifeq ($(DISPLAY),-DHAVE_LCD_BITMAP)
26 MACHINEDIR = $(RECDIR) 26 MACHINEDIR = $(RECDIR)
27 # not very nice to set RTC like this, but... 27 # not very nice to set RTC like this, but...
28 RTC += -DHAVE_RTC 28 RTC += -DHAVE_RTC
29 # not very nice to set RADIO like this, but...
30 RADIO += -DHAVE_FMRADIO
29else 31else
30 MACHINEDIR = $(PLAYDIR) 32 MACHINEDIR = $(PLAYDIR)
31endif 33endif
@@ -110,12 +112,12 @@ APPS = main.c tree.c menu.c credits.c main_menu.c language.c\
110MENUS = settings_menu.c sound_menu.c playlist_menu.c 112MENUS = settings_menu.c sound_menu.c playlist_menu.c
111 113
112ifeq ($(DISPLAY),-DHAVE_LCD_BITMAP) 114ifeq ($(DISPLAY),-DHAVE_LCD_BITMAP)
113 APPS += bmp.c widgets.c 115 APPS += bmp.c widgets.c radio.c
114endif 116endif
115 117
116SRCS = screenhack.c uibasic.c resources.c visual.c lcd-x11.c stubs.c \ 118SRCS = screenhack.c uibasic.c resources.c visual.c lcd-x11.c stubs.c \
117 button-x11.c thread.c sim_icons.c $(APPS) $(MENUS) $(FIRMSRCS) \ 119 button-x11.c thread.c sim_icons.c $(APPS) $(MENUS) $(FIRMSRCS) \
118 $(COMMONSRCS) lcd-common.c 120 $(COMMONSRCS) lcd-common.c fmradio.c
119 121
120ROCKSRC := $(wildcard $(APPDIR)/plugins/*.c) 122ROCKSRC := $(wildcard $(APPDIR)/plugins/*.c)
121ROCKS := $(ROCKSRC:$(APPDIR)/plugins/%.c=$(OBJDIR)/%.rock) 123ROCKS := $(ROCKSRC:$(APPDIR)/plugins/%.c=$(OBJDIR)/%.rock)
@@ -307,12 +309,18 @@ $(OBJDIR)/lcd-player-charset.o: $(DRIVERS)/lcd-player-charset.c
307$(OBJDIR)/lcd-playersim.o: $(SIMCOMMON)/lcd-playersim.c 309$(OBJDIR)/lcd-playersim.o: $(SIMCOMMON)/lcd-playersim.c
308 $(CC) $(CFLAGS) -c $< -o $@ 310 $(CC) $(CFLAGS) -c $< -o $@
309 311
312$(OBJDIR)/fmradio.o: $(SIMCOMMON)/fmradio.c
313 $(CC) $(CFLAGS) -c $< -o $@
314
310$(OBJDIR)/font-player.o: $(SIMCOMMON)/font-player.c 315$(OBJDIR)/font-player.o: $(SIMCOMMON)/font-player.c
311 $(CC) $(CFLAGS) -c $< -o $@ 316 $(CC) $(CFLAGS) -c $< -o $@
312 317
313$(OBJDIR)/lcd-player.o: $(DRIVERS)/lcd-player.c 318$(OBJDIR)/lcd-player.o: $(DRIVERS)/lcd-player.c
314 $(CC) $(CFLAGS) -c $< -o $@ 319 $(CC) $(CFLAGS) -c $< -o $@
315 320
321$(OBJDIR)/radio.o: $(RECDIR)/radio.c
322 $(CC) $(APPCFLAGS) -c $< -o $@
323
316# these ones are simulator-specific 324# these ones are simulator-specific
317 325
318$(OBJDIR)/%.o: %.c 326$(OBJDIR)/%.o: %.c