diff options
-rw-r--r-- | apps/recorder/radio.c | 18 | ||||
-rw-r--r-- | uisimulator/common/fmradio.c | 58 | ||||
-rw-r--r-- | uisimulator/win32/Makefile | 15 | ||||
-rw-r--r-- | uisimulator/x11/Makefile | 12 |
4 files changed, 95 insertions, 8 deletions
diff --git a/apps/recorder/radio.c b/apps/recorder/radio.c index d6a0b82cc9..f75387739a 100644 --- a/apps/recorder/radio.c +++ b/apps/recorder/radio.c | |||
@@ -130,7 +130,7 @@ bool radio_screen(void) | |||
130 | bool stereo = false; | 130 | bool stereo = false; |
131 | int search_dir = 0; | 131 | int search_dir = 0; |
132 | int fw, fh; | 132 | int fw, fh; |
133 | int last_stereo_status = false; | 133 | bool last_stereo_status = false; |
134 | int top_of_screen = 0; | 134 | int top_of_screen = 0; |
135 | bool update_screen = true; | 135 | bool update_screen = true; |
136 | int timeout = current_tick + HZ/10; | 136 | int timeout = current_tick + HZ/10; |
@@ -155,6 +155,7 @@ bool radio_screen(void) | |||
155 | 155 | ||
156 | radio_load_presets(); | 156 | radio_load_presets(); |
157 | 157 | ||
158 | #ifndef SIMULATOR | ||
158 | if(rec_create_directory() > 0) | 159 | if(rec_create_directory() > 0) |
159 | have_recorded = true; | 160 | have_recorded = true; |
160 | 161 | ||
@@ -189,6 +190,7 @@ bool radio_screen(void) | |||
189 | 190 | ||
190 | mpeg_set_recording_gain(mpeg_sound_default(SOUND_LEFT_GAIN), | 191 | mpeg_set_recording_gain(mpeg_sound_default(SOUND_LEFT_GAIN), |
191 | mpeg_sound_default(SOUND_RIGHT_GAIN), false); | 192 | mpeg_sound_default(SOUND_RIGHT_GAIN), false); |
193 | #endif | ||
192 | 194 | ||
193 | fmradio_set(2, 0x140884); /* 5kHz, 7.2MHz crystal */ | 195 | fmradio_set(2, 0x140884); /* 5kHz, 7.2MHz crystal */ |
194 | radio_set_frequency(curr_freq); | 196 | radio_set_frequency(curr_freq); |
@@ -236,11 +238,13 @@ bool radio_screen(void) | |||
236 | switch(button) | 238 | switch(button) |
237 | { | 239 | { |
238 | case BUTTON_OFF: | 240 | case BUTTON_OFF: |
241 | #ifndef SIMULATOR | ||
239 | if(mpeg_status() == MPEG_STATUS_RECORD) | 242 | if(mpeg_status() == MPEG_STATUS_RECORD) |
240 | { | 243 | { |
241 | mpeg_stop(); | 244 | mpeg_stop(); |
242 | } | 245 | } |
243 | else | 246 | else |
247 | #endif | ||
244 | { | 248 | { |
245 | radio_stop(); | 249 | radio_stop(); |
246 | done = true; | 250 | done = true; |
@@ -249,6 +253,7 @@ bool radio_screen(void) | |||
249 | break; | 253 | break; |
250 | 254 | ||
251 | case BUTTON_F3: | 255 | case BUTTON_F3: |
256 | #ifndef SIMULATOR | ||
252 | if(mpeg_status() == MPEG_STATUS_RECORD) | 257 | if(mpeg_status() == MPEG_STATUS_RECORD) |
253 | { | 258 | { |
254 | mpeg_new_file(rec_create_filename(buf)); | 259 | mpeg_new_file(rec_create_filename(buf)); |
@@ -261,6 +266,7 @@ bool radio_screen(void) | |||
261 | mpeg_record(rec_create_filename(buf)); | 266 | mpeg_record(rec_create_filename(buf)); |
262 | update_screen = true; | 267 | update_screen = true; |
263 | } | 268 | } |
269 | #endif | ||
264 | last_seconds = 0; | 270 | last_seconds = 0; |
265 | break; | 271 | break; |
266 | 272 | ||
@@ -395,7 +401,9 @@ bool radio_screen(void) | |||
395 | } | 401 | } |
396 | } | 402 | } |
397 | 403 | ||
404 | #ifndef SIMULATOR | ||
398 | seconds = mpeg_recorded_time() / HZ; | 405 | seconds = mpeg_recorded_time() / HZ; |
406 | #endif | ||
399 | 407 | ||
400 | if(update_screen || seconds > last_seconds) | 408 | if(update_screen || seconds > last_seconds) |
401 | { | 409 | { |
@@ -455,7 +463,7 @@ bool radio_screen(void) | |||
455 | } | 463 | } |
456 | } | 464 | } |
457 | 465 | ||
458 | 466 | #ifndef SIMULATOR | |
459 | if(mpeg_status() & MPEG_STATUS_ERROR) | 467 | if(mpeg_status() & MPEG_STATUS_ERROR) |
460 | { | 468 | { |
461 | splash(0, true, str(LANG_DISK_FULL)); | 469 | splash(0, true, str(LANG_DISK_FULL)); |
@@ -491,6 +499,7 @@ bool radio_screen(void) | |||
491 | mpeg_sound_default(SOUND_RIGHT_GAIN), false); | 499 | mpeg_sound_default(SOUND_RIGHT_GAIN), false); |
492 | mas_codec_writereg(6, 0x4000); | 500 | mas_codec_writereg(6, 0x4000); |
493 | } | 501 | } |
502 | #endif | ||
494 | return have_recorded; | 503 | return have_recorded; |
495 | } | 504 | } |
496 | 505 | ||
@@ -696,6 +705,7 @@ bool radio_delete_preset(void) | |||
696 | return reload_dir; | 705 | return reload_dir; |
697 | } | 706 | } |
698 | 707 | ||
708 | #ifndef SIMULATOR | ||
699 | static bool fm_recording_settings(void) | 709 | static bool fm_recording_settings(void) |
700 | { | 710 | { |
701 | bool ret; | 711 | bool ret; |
@@ -715,14 +725,16 @@ static bool fm_recording_settings(void) | |||
715 | } | 725 | } |
716 | return ret; | 726 | return ret; |
717 | } | 727 | } |
718 | 728 | #endif | |
719 | bool radio_menu(void) | 729 | bool radio_menu(void) |
720 | { | 730 | { |
721 | struct menu_item radio_menu_items[] = { | 731 | struct menu_item radio_menu_items[] = { |
722 | { STR(LANG_FM_SAVE_PRESET), radio_add_preset }, | 732 | { STR(LANG_FM_SAVE_PRESET), radio_add_preset }, |
723 | { STR(LANG_FM_DELETE_PRESET), radio_delete_preset }, | 733 | { STR(LANG_FM_DELETE_PRESET), radio_delete_preset }, |
724 | { STR(LANG_SOUND_SETTINGS), sound_menu }, | 734 | { STR(LANG_SOUND_SETTINGS), sound_menu }, |
735 | #ifndef SIMULATOR | ||
725 | { STR(LANG_RECORDING_SETTINGS), fm_recording_settings } | 736 | { STR(LANG_RECORDING_SETTINGS), fm_recording_settings } |
737 | #endif | ||
726 | }; | 738 | }; |
727 | int m; | 739 | int m; |
728 | bool result; | 740 | bool result; |
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 | |||
23 | static int fmstatus = 0; | ||
24 | |||
25 | static int fmradio_reg[3]; | ||
26 | |||
27 | int 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 | |||
43 | void fmradio_set(int addr, int data) | ||
44 | { | ||
45 | fmradio_reg[addr] = data; | ||
46 | } | ||
47 | |||
48 | void fmradio_set_status(int status) | ||
49 | { | ||
50 | fmstatus = status; | ||
51 | } | ||
52 | |||
53 | int 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 | ||
30 | else | 32 | else |
31 | MACHINEDIR = $(PLAYDIR) | 33 | MACHINEDIR = $(PLAYDIR) |
32 | endif | 34 | endif |
@@ -53,7 +55,8 @@ LANGUAGE = english | |||
53 | TARGET = $(OBJDIR)/uisw32.exe | 55 | TARGET = $(OBJDIR)/uisw32.exe |
54 | 56 | ||
55 | DEFINES = -DHAVE_CONFIG_H -DGETTIMEOFDAY_TWO_ARGS -DSIMULATOR \ | 57 | DEFINES = -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 | ||
58 | LDFLAGS = -lgdi32 -luser32 | 61 | LDFLAGS = -lgdi32 -luser32 |
59 | 62 | ||
@@ -110,12 +113,12 @@ APPS = main.c tree.c menu.c credits.c main_menu.c icons.c language.c \ | |||
110 | MENUS = settings_menu.c sound_menu.c playlist_menu.c | 113 | MENUS = settings_menu.c sound_menu.c playlist_menu.c |
111 | 114 | ||
112 | ifeq ($(DISPLAY),-DHAVE_LCD_BITMAP) | 115 | ifeq ($(DISPLAY),-DHAVE_LCD_BITMAP) |
113 | APPS += bmp.c widgets.c | 116 | APPS += bmp.c widgets.c radio.c |
114 | endif | 117 | endif |
115 | 118 | ||
116 | SRCS = button.c lcd-win32.c panic-win32.c thread-win32.c \ | 119 | SRCS = 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 | ||
120 | OBJS := $(OBJDIR)/lang.o $(SRCS:%.c=$(OBJDIR)/%.o) $(OBJDIR)/uisw32-res.o | 123 | OBJS := $(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 | ||
29 | else | 31 | else |
30 | MACHINEDIR = $(PLAYDIR) | 32 | MACHINEDIR = $(PLAYDIR) |
31 | endif | 33 | endif |
@@ -110,12 +112,12 @@ APPS = main.c tree.c menu.c credits.c main_menu.c language.c\ | |||
110 | MENUS = settings_menu.c sound_menu.c playlist_menu.c | 112 | MENUS = settings_menu.c sound_menu.c playlist_menu.c |
111 | 113 | ||
112 | ifeq ($(DISPLAY),-DHAVE_LCD_BITMAP) | 114 | ifeq ($(DISPLAY),-DHAVE_LCD_BITMAP) |
113 | APPS += bmp.c widgets.c | 115 | APPS += bmp.c widgets.c radio.c |
114 | endif | 116 | endif |
115 | 117 | ||
116 | SRCS = screenhack.c uibasic.c resources.c visual.c lcd-x11.c stubs.c \ | 118 | SRCS = 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 | ||
120 | ROCKSRC := $(wildcard $(APPDIR)/plugins/*.c) | 122 | ROCKSRC := $(wildcard $(APPDIR)/plugins/*.c) |
121 | ROCKS := $(ROCKSRC:$(APPDIR)/plugins/%.c=$(OBJDIR)/%.rock) | 123 | ROCKS := $(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 |