From 2c7b127dd77564a8ca8c384d7d1abed441efe110 Mon Sep 17 00:00:00 2001 From: Jens Arnold Date: Fri, 16 Mar 2007 23:47:03 +0000 Subject: Set CONFIG_RTC to 0 for non-RTC targets, and check with #if to profit from -Wundef. No code change. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12811 a1c6a512-1295-4272-9138-f99709370657 --- apps/gui/gwps-common.c | 2 +- apps/gui/statusbar.c | 8 ++++---- apps/gui/statusbar.h | 2 +- apps/main.c | 2 +- apps/menus/main_menu.c | 2 +- apps/menus/settings_menu.c | 4 ++-- apps/misc.c | 4 ++-- apps/misc.h | 4 ++-- apps/plugins/SOURCES | 2 +- apps/plugins/bounce.c | 8 ++++---- apps/plugins/calendar.c | 6 +++--- apps/recorder/icons.h | 2 +- apps/recorder/recording.c | 2 +- apps/screens.c | 4 ++-- apps/screens.h | 2 +- apps/scrobbler.c | 10 +++++----- apps/status.c | 2 +- firmware/common/timefuncs.c | 4 ++-- firmware/drivers/fat.c | 4 ++-- firmware/export/config.h | 4 ++++ firmware/export/rtc.h | 2 +- 21 files changed, 42 insertions(+), 38 deletions(-) diff --git a/apps/gui/gwps-common.c b/apps/gui/gwps-common.c index 24ecd8b051..16dfe59ff2 100644 --- a/apps/gui/gwps-common.c +++ b/apps/gui/gwps-common.c @@ -970,7 +970,7 @@ static char* get_tag(struct wps_data* wps_data, #endif } break; -#ifdef CONFIG_RTC +#if CONFIG_RTC case 'c': /* Real Time Clock display */ *flags |= WPS_REFRESH_DYNAMIC; { diff --git a/apps/gui/statusbar.c b/apps/gui/statusbar.c index fbd8943315..e93fc9649e 100644 --- a/apps/gui/statusbar.c +++ b/apps/gui/statusbar.c @@ -141,7 +141,7 @@ static void gui_statusbar_led(struct screen * display); #ifdef HAVE_RECORDING static void gui_statusbar_icon_recording_info(struct screen * display); #endif -#ifdef CONFIG_RTC +#if CONFIG_RTC static void gui_statusbar_time(struct screen * display, int hour, int minute); #endif #endif @@ -238,7 +238,7 @@ void gui_statusbar_draw(struct gui_statusbar * bar, bool force_redraw) if(!display->has_disk_led) bar->info.led = led_read(HZ/2); /* delay should match polling interval */ #endif -#ifdef CONFIG_RTC +#if CONFIG_RTC { struct tm* tm = get_time(); bar->info.hour = tm->tm_hour; @@ -323,7 +323,7 @@ void gui_statusbar_draw(struct gui_statusbar * bar, bool force_redraw) if (bar->info.keylockremote) gui_statusbar_icon_lock_remote(display); #endif -#ifdef CONFIG_RTC +#if CONFIG_RTC gui_statusbar_time(display, bar->info.hour, bar->info.minute); #endif /* CONFIG_RTC */ #if (CONFIG_LED == LED_VIRTUAL) || defined(HAVE_REMOTE_LCD) @@ -580,7 +580,7 @@ static void gui_statusbar_led(struct screen * display) } #endif -#ifdef CONFIG_RTC +#if CONFIG_RTC /* * Print time to status bar */ diff --git a/apps/gui/statusbar.h b/apps/gui/statusbar.h index 11b8765b77..21f98336d0 100644 --- a/apps/gui/statusbar.h +++ b/apps/gui/statusbar.h @@ -33,7 +33,7 @@ struct status_info { int volume; int playmode; int repeat; -#ifdef CONFIG_RTC +#if CONFIG_RTC int hour; int minute; #endif diff --git a/apps/main.c b/apps/main.c index 916720a5d3..c1f818be7f 100644 --- a/apps/main.c +++ b/apps/main.c @@ -341,7 +341,7 @@ static void init(void) i2c_init(); -#ifdef CONFIG_RTC +#if CONFIG_RTC rtc_init(); #endif #ifdef HAVE_RTC_RAM diff --git a/apps/menus/main_menu.c b/apps/menus/main_menu.c index 2e034162e5..bd7b35dea2 100644 --- a/apps/menus/main_menu.c +++ b/apps/menus/main_menu.c @@ -199,7 +199,7 @@ static bool show_info(void) output_dyn_value(NULL, 0, free, kbyte_units, true); #endif -#ifdef CONFIG_RTC +#if CONFIG_RTC { struct tm* tm = get_time(); talk_id(VOICE_CURRENT_TIME, true); diff --git a/apps/menus/settings_menu.c b/apps/menus/settings_menu.c index 27d44fd1cf..d150aac148 100644 --- a/apps/menus/settings_menu.c +++ b/apps/menus/settings_menu.c @@ -185,7 +185,7 @@ MAKE_MENU(disk_menu, ID2P(LANG_DISK_MENU), 0, Icon_NOICON, #endif /* Time & Date */ -#ifdef CONFIG_RTC +#if CONFIG_RTC static int timedate_set(void) { struct tm tm; @@ -317,7 +317,7 @@ MAKE_MENU(system_menu, ID2P(LANG_SYSTEM), #ifndef HAVE_MMC &disk_menu, #endif -#ifdef CONFIG_RTC +#if CONFIG_RTC &time_menu, #endif &poweroff, diff --git a/apps/misc.c b/apps/misc.c index 57599de456..d4be4dd72d 100644 --- a/apps/misc.c +++ b/apps/misc.c @@ -207,7 +207,7 @@ void format_time(char* buf, int buf_size, long t) } } -#ifdef CONFIG_RTC +#if CONFIG_RTC /* Create a filename with a date+time part. It is allowed that buffer and path point to the same memory location, saving a strcpy(). Path must always be given without trailing slash. @@ -413,7 +413,7 @@ void screen_dump(void) static unsigned short line_block[BMP_LINESIZE/2]; #endif -#ifdef CONFIG_RTC +#if CONFIG_RTC create_datetime_filename(filename, "", "dump ", ".bmp", false); #else create_numbered_filename(filename, "", "dump_", ".bmp", 4 diff --git a/apps/misc.h b/apps/misc.h index f127d6acbf..02a4bd822c 100644 --- a/apps/misc.h +++ b/apps/misc.h @@ -38,7 +38,7 @@ char *output_dyn_value(char *buf, int buf_size, int value, * less than zero to number automatically. The final number used will also * be returned in *num. If *num is >= 0 then *num will be incremented by * one. */ -#if CONFIG_CODEC == SWCODEC && defined(HAVE_RECORDING) && !defined(CONFIG_RTC) +#if CONFIG_CODEC == SWCODEC && defined(HAVE_RECORDING) && (CONFIG_RTC == 0) /* this feature is needed by SWCODEC recording without a RTC to prevent disk access when changing files */ #define IF_CNFN_NUM_(...) __VA_ARGS__ @@ -58,7 +58,7 @@ char *create_numbered_filename(char *buffer, const char *path, */ void format_time(char* buf, int buf_size, long t); -#ifdef CONFIG_RTC +#if CONFIG_RTC /* Create a filename with a date+time part. It is allowed that buffer and path point to the same memory location, saving a strcpy(). Path must always be given without trailing slash. diff --git a/apps/plugins/SOURCES b/apps/plugins/SOURCES index 56f845a6dd..b5ec302c23 100644 --- a/apps/plugins/SOURCES +++ b/apps/plugins/SOURCES @@ -76,7 +76,7 @@ video.c vu_meter.c wormlet.c -#ifdef CONFIG_RTC +#if CONFIG_RTC clock.c #if CONFIG_KEYPAD == RECORDER_PAD /* Recorder models only for now */ calendar.c diff --git a/apps/plugins/bounce.c b/apps/plugins/bounce.c index 46d9d88b21..c5c9dad83c 100644 --- a/apps/plugins/bounce.c +++ b/apps/plugins/bounce.c @@ -271,7 +271,7 @@ struct counter values[]={ {"ydist", -6}, }; -#ifdef CONFIG_RTC +#if CONFIG_RTC #define CLOCK_STEP (0xffffffff/60) #define CLOCK_FRAC (0xffffffff%60) @@ -382,7 +382,7 @@ static int scrollit(void) return -1; } rb->lcd_clear_display(); -#ifdef CONFIG_RTC +#if CONFIG_RTC addclock(); #endif @@ -451,7 +451,7 @@ static int loopit(void) x+= speed[xsanke&15] + values[NUM_XADD].num; rb->lcd_clear_display(); -#ifdef CONFIG_RTC +#if CONFIG_RTC addclock(); #endif if(timeout) { @@ -516,7 +516,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) rb->sleep(HZ); rb->lcd_set_drawmode(DRMODE_FG); init_tables(); -#ifdef CONFIG_RTC +#if CONFIG_RTC init_clock(); #endif diff --git a/apps/plugins/calendar.c b/apps/plugins/calendar.c index 34af4746a9..8c0b6af5b9 100644 --- a/apps/plugins/calendar.c +++ b/apps/plugins/calendar.c @@ -19,7 +19,7 @@ ****************************************************************************/ #include "plugin.h" -#if defined(HAVE_LCD_BITMAP) && defined(CONFIG_RTC) +#if defined(HAVE_LCD_BITMAP) && (CONFIG_RTC != 0) #include @@ -71,7 +71,7 @@ static int calc_weekday( struct shown *shown ) static void calendar_init(struct today *today, struct shown *shown) { int w,h; -#ifdef CONFIG_RTC +#if CONFIG_RTC struct tm *tm; #else (void)today; @@ -83,7 +83,7 @@ static void calendar_init(struct today *today, struct shown *shown) use_system_font = true; } rb->lcd_clear_display(); -#ifdef CONFIG_RTC +#if CONFIG_RTC tm = rb->get_time(); today->mon = tm->tm_mon +1; today->year = 2000+tm->tm_year%100; diff --git a/apps/recorder/icons.h b/apps/recorder/icons.h index 7b1d69de1b..7682d44733 100644 --- a/apps/recorder/icons.h +++ b/apps/recorder/icons.h @@ -177,7 +177,7 @@ extern void statusbar_icon_play_state(int state); extern void statusbar_icon_play_mode(int mode); extern void statusbar_icon_shuffle(void); extern void statusbar_icon_lock(void); -#ifdef CONFIG_RTC +#if CONFIG_RTC extern void statusbar_time(int hour, int minute); #endif #if (CONFIG_LED == LED_VIRTUAL) diff --git a/apps/recorder/recording.c b/apps/recorder/recording.c index ffde856612..025480cf91 100644 --- a/apps/recorder/recording.c +++ b/apps/recorder/recording.c @@ -518,7 +518,7 @@ char *rec_create_filename(char *buffer) snprintf(ext, sizeof(ext), ".%s", REC_FILE_ENDING(global_settings.rec_format)); -#ifdef CONFIG_RTC +#if CONFIG_RTC /* We'll wait at least up to the start of the next second so no duplicate names are created */ return create_datetime_filename(buffer, buffer, "R", ext, true); diff --git a/apps/screens.c b/apps/screens.c index b078f735af..df1d59109b 100644 --- a/apps/screens.c +++ b/apps/screens.c @@ -784,7 +784,7 @@ void charging_splash(void) #endif -#if defined(HAVE_LCD_BITMAP) && defined (CONFIG_RTC) +#if defined(HAVE_LCD_BITMAP) && (CONFIG_RTC != 0) const int dayname[] = { LANG_WEEKDAY_SUNDAY, @@ -1081,7 +1081,7 @@ bool set_time_screen(const char* string, struct tm *tm) lcd_set_drawmode(lastmode); return false; } -#endif /* defined(HAVE_LCD_BITMAP) && defined (CONFIG_RTC) */ +#endif /* defined(HAVE_LCD_BITMAP) && (CONFIG_RTC != 0) */ #if (CONFIG_KEYPAD == RECORDER_PAD) && !defined(HAVE_SW_POWEROFF) bool shutdown_screen(void) diff --git a/apps/screens.h b/apps/screens.h index 3015652a5c..ce174e1e58 100644 --- a/apps/screens.h +++ b/apps/screens.h @@ -42,7 +42,7 @@ extern bool quick_screen_f3(int button_enter); #endif extern bool quick_screen_quick(int button_enter); -#ifdef CONFIG_RTC +#if CONFIG_RTC bool set_time_screen(const char* string, struct tm *tm); #endif diff --git a/apps/scrobbler.c b/apps/scrobbler.c index a339429cab..07ba016a51 100644 --- a/apps/scrobbler.c +++ b/apps/scrobbler.c @@ -32,7 +32,7 @@ http://www.audioscrobbler.net/wiki/Portable_Player_Logging #include "settings.h" #include "ata_idle_notify.h" -#ifdef CONFIG_RTC +#if CONFIG_RTC #include "time.h" #include "timefuncs.h" #endif @@ -41,7 +41,7 @@ http://www.audioscrobbler.net/wiki/Portable_Player_Logging #define SCROBBLER_VERSION "1.0" -#ifdef CONFIG_RTC +#if CONFIG_RTC #define SCROBBLER_FILE "/.scrobbler.log" #else #define SCROBBLER_FILE "/.scrobbler-timeless.log" @@ -62,7 +62,7 @@ static struct mp3entry scrobbler_entry; static bool pending = false; static bool scrobbler_initialised = false; static bool scrobbler_ata_callback = false; -#ifdef CONFIG_RTC +#if CONFIG_RTC static time_t timestamp; #else static unsigned long timestamp; @@ -92,7 +92,7 @@ static void write_cache(void) { fdprintf(scrobbler_fd, "#AUDIOSCROBBLER/%s\n", SCROBBLER_VERSION); fdprintf(scrobbler_fd, "#TZ/UNKNOWN\n"); -#ifdef CONFIG_RTC +#if CONFIG_RTC fdprintf(scrobbler_fd, "#CLIENT/Rockbox " TARGET_NAME SCROBBLER_REVISION "\n"); #else @@ -207,7 +207,7 @@ void scrobbler_change_event(struct mp3entry *id) { logf("SCROBBLER: add pending"); copy_mp3entry(&scrobbler_entry, id); -#ifdef CONFIG_RTC +#if CONFIG_RTC timestamp = mktime(get_time()); #else timestamp = 0; diff --git a/apps/status.c b/apps/status.c index 1551f77d53..468ca19c13 100644 --- a/apps/status.c +++ b/apps/status.c @@ -29,7 +29,7 @@ #include "gwps.h" #include "abrepeat.h" #include "statusbar.h" -#ifdef CONFIG_RTC +#if CONFIG_RTC #include "timefuncs.h" #endif #ifdef HAVE_LCD_BITMAP diff --git a/firmware/common/timefuncs.c b/firmware/common/timefuncs.c index e48aadd0a2..d073ec819c 100644 --- a/firmware/common/timefuncs.c +++ b/firmware/common/timefuncs.c @@ -46,7 +46,7 @@ bool valid_time(const struct tm *tm) struct tm *get_time(void) { #ifndef SIMULATOR -#ifdef CONFIG_RTC +#if CONFIG_RTC static long timeout = 0; /* Don't read the RTC more than once per second */ @@ -95,7 +95,7 @@ struct tm *get_time(void) int set_time(const struct tm *tm) { -#ifdef CONFIG_RTC +#if CONFIG_RTC int rc; char rtcbuf[7]; diff --git a/firmware/drivers/fat.c b/firmware/drivers/fat.c index e3e1a755cb..142d750bde 100644 --- a/firmware/drivers/fat.c +++ b/firmware/drivers/fat.c @@ -943,7 +943,7 @@ static void fat_time(unsigned short* date, unsigned short* time, unsigned short* tenth ) { -#ifdef CONFIG_RTC +#if CONFIG_RTC struct tm* tm = get_time(); if (date) @@ -1506,7 +1506,7 @@ static int update_short_entry( struct fat_file* file, long size, int attr ) *sizeptr = htole32(size); { -#ifdef CONFIG_RTC +#if CONFIG_RTC unsigned short time = 0; unsigned short date = 0; #else diff --git a/firmware/export/config.h b/firmware/export/config.h index ae1ce5b283..c935ac466f 100644 --- a/firmware/export/config.h +++ b/firmware/export/config.h @@ -242,6 +242,10 @@ #define CONFIG_CHARGING 0 #endif +#ifndef CONFIG_RTC +#define CONFIG_RTC 0 +#endif + /* Enable the directory cache and tagcache in RAM if we have * plenty of RAM. Both features can be enabled independently. */ #if ((defined(MEMORYSIZE) && (MEMORYSIZE > 8)) || MEM > 8) && \ diff --git a/firmware/export/rtc.h b/firmware/export/rtc.h index eea83d85bb..3d7a6d6ead 100644 --- a/firmware/export/rtc.h +++ b/firmware/export/rtc.h @@ -23,7 +23,7 @@ #include "system.h" #include "config.h" -#ifdef CONFIG_RTC +#if CONFIG_RTC extern const int dayname[]; -- cgit v1.2.3