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
This commit is contained in:
Jens Arnold 2007-03-16 23:47:03 +00:00
parent c0351ca633
commit 2c7b127dd7
21 changed files with 42 additions and 38 deletions

View file

@ -970,7 +970,7 @@ static char* get_tag(struct wps_data* wps_data,
#endif #endif
} }
break; break;
#ifdef CONFIG_RTC #if CONFIG_RTC
case 'c': /* Real Time Clock display */ case 'c': /* Real Time Clock display */
*flags |= WPS_REFRESH_DYNAMIC; *flags |= WPS_REFRESH_DYNAMIC;
{ {

View file

@ -141,7 +141,7 @@ static void gui_statusbar_led(struct screen * display);
#ifdef HAVE_RECORDING #ifdef HAVE_RECORDING
static void gui_statusbar_icon_recording_info(struct screen * display); static void gui_statusbar_icon_recording_info(struct screen * display);
#endif #endif
#ifdef CONFIG_RTC #if CONFIG_RTC
static void gui_statusbar_time(struct screen * display, int hour, int minute); static void gui_statusbar_time(struct screen * display, int hour, int minute);
#endif #endif
#endif #endif
@ -238,7 +238,7 @@ void gui_statusbar_draw(struct gui_statusbar * bar, bool force_redraw)
if(!display->has_disk_led) if(!display->has_disk_led)
bar->info.led = led_read(HZ/2); /* delay should match polling interval */ bar->info.led = led_read(HZ/2); /* delay should match polling interval */
#endif #endif
#ifdef CONFIG_RTC #if CONFIG_RTC
{ {
struct tm* tm = get_time(); struct tm* tm = get_time();
bar->info.hour = tm->tm_hour; 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) if (bar->info.keylockremote)
gui_statusbar_icon_lock_remote(display); gui_statusbar_icon_lock_remote(display);
#endif #endif
#ifdef CONFIG_RTC #if CONFIG_RTC
gui_statusbar_time(display, bar->info.hour, bar->info.minute); gui_statusbar_time(display, bar->info.hour, bar->info.minute);
#endif /* CONFIG_RTC */ #endif /* CONFIG_RTC */
#if (CONFIG_LED == LED_VIRTUAL) || defined(HAVE_REMOTE_LCD) #if (CONFIG_LED == LED_VIRTUAL) || defined(HAVE_REMOTE_LCD)
@ -580,7 +580,7 @@ static void gui_statusbar_led(struct screen * display)
} }
#endif #endif
#ifdef CONFIG_RTC #if CONFIG_RTC
/* /*
* Print time to status bar * Print time to status bar
*/ */

View file

@ -33,7 +33,7 @@ struct status_info {
int volume; int volume;
int playmode; int playmode;
int repeat; int repeat;
#ifdef CONFIG_RTC #if CONFIG_RTC
int hour; int hour;
int minute; int minute;
#endif #endif

View file

@ -341,7 +341,7 @@ static void init(void)
i2c_init(); i2c_init();
#ifdef CONFIG_RTC #if CONFIG_RTC
rtc_init(); rtc_init();
#endif #endif
#ifdef HAVE_RTC_RAM #ifdef HAVE_RTC_RAM

View file

@ -199,7 +199,7 @@ static bool show_info(void)
output_dyn_value(NULL, 0, free, kbyte_units, true); output_dyn_value(NULL, 0, free, kbyte_units, true);
#endif #endif
#ifdef CONFIG_RTC #if CONFIG_RTC
{ {
struct tm* tm = get_time(); struct tm* tm = get_time();
talk_id(VOICE_CURRENT_TIME, true); talk_id(VOICE_CURRENT_TIME, true);

View file

@ -185,7 +185,7 @@ MAKE_MENU(disk_menu, ID2P(LANG_DISK_MENU), 0, Icon_NOICON,
#endif #endif
/* Time & Date */ /* Time & Date */
#ifdef CONFIG_RTC #if CONFIG_RTC
static int timedate_set(void) static int timedate_set(void)
{ {
struct tm tm; struct tm tm;
@ -317,7 +317,7 @@ MAKE_MENU(system_menu, ID2P(LANG_SYSTEM),
#ifndef HAVE_MMC #ifndef HAVE_MMC
&disk_menu, &disk_menu,
#endif #endif
#ifdef CONFIG_RTC #if CONFIG_RTC
&time_menu, &time_menu,
#endif #endif
&poweroff, &poweroff,

View file

@ -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. /* Create a filename with a date+time part.
It is allowed that buffer and path point to the same memory location, It is allowed that buffer and path point to the same memory location,
saving a strcpy(). Path must always be given without trailing slash. 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]; static unsigned short line_block[BMP_LINESIZE/2];
#endif #endif
#ifdef CONFIG_RTC #if CONFIG_RTC
create_datetime_filename(filename, "", "dump ", ".bmp", false); create_datetime_filename(filename, "", "dump ", ".bmp", false);
#else #else
create_numbered_filename(filename, "", "dump_", ".bmp", 4 create_numbered_filename(filename, "", "dump_", ".bmp", 4

View file

@ -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 * 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 * be returned in *num. If *num is >= 0 then *num will be incremented by
* one. */ * 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 /* this feature is needed by SWCODEC recording without a RTC to prevent
disk access when changing files */ disk access when changing files */
#define IF_CNFN_NUM_(...) __VA_ARGS__ #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); void format_time(char* buf, int buf_size, long t);
#ifdef CONFIG_RTC #if CONFIG_RTC
/* Create a filename with a date+time part. /* Create a filename with a date+time part.
It is allowed that buffer and path point to the same memory location, It is allowed that buffer and path point to the same memory location,
saving a strcpy(). Path must always be given without trailing slash. saving a strcpy(). Path must always be given without trailing slash.

View file

@ -76,7 +76,7 @@ video.c
vu_meter.c vu_meter.c
wormlet.c wormlet.c
#ifdef CONFIG_RTC #if CONFIG_RTC
clock.c clock.c
#if CONFIG_KEYPAD == RECORDER_PAD /* Recorder models only for now */ #if CONFIG_KEYPAD == RECORDER_PAD /* Recorder models only for now */
calendar.c calendar.c

View file

@ -271,7 +271,7 @@ struct counter values[]={
{"ydist", -6}, {"ydist", -6},
}; };
#ifdef CONFIG_RTC #if CONFIG_RTC
#define CLOCK_STEP (0xffffffff/60) #define CLOCK_STEP (0xffffffff/60)
#define CLOCK_FRAC (0xffffffff%60) #define CLOCK_FRAC (0xffffffff%60)
@ -382,7 +382,7 @@ static int scrollit(void)
return -1; return -1;
} }
rb->lcd_clear_display(); rb->lcd_clear_display();
#ifdef CONFIG_RTC #if CONFIG_RTC
addclock(); addclock();
#endif #endif
@ -451,7 +451,7 @@ static int loopit(void)
x+= speed[xsanke&15] + values[NUM_XADD].num; x+= speed[xsanke&15] + values[NUM_XADD].num;
rb->lcd_clear_display(); rb->lcd_clear_display();
#ifdef CONFIG_RTC #if CONFIG_RTC
addclock(); addclock();
#endif #endif
if(timeout) { if(timeout) {
@ -516,7 +516,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
rb->sleep(HZ); rb->sleep(HZ);
rb->lcd_set_drawmode(DRMODE_FG); rb->lcd_set_drawmode(DRMODE_FG);
init_tables(); init_tables();
#ifdef CONFIG_RTC #if CONFIG_RTC
init_clock(); init_clock();
#endif #endif

View file

@ -19,7 +19,7 @@
****************************************************************************/ ****************************************************************************/
#include "plugin.h" #include "plugin.h"
#if defined(HAVE_LCD_BITMAP) && defined(CONFIG_RTC) #if defined(HAVE_LCD_BITMAP) && (CONFIG_RTC != 0)
#include <timefuncs.h> #include <timefuncs.h>
@ -71,7 +71,7 @@ static int calc_weekday( struct shown *shown )
static void calendar_init(struct today *today, struct shown *shown) static void calendar_init(struct today *today, struct shown *shown)
{ {
int w,h; int w,h;
#ifdef CONFIG_RTC #if CONFIG_RTC
struct tm *tm; struct tm *tm;
#else #else
(void)today; (void)today;
@ -83,7 +83,7 @@ static void calendar_init(struct today *today, struct shown *shown)
use_system_font = true; use_system_font = true;
} }
rb->lcd_clear_display(); rb->lcd_clear_display();
#ifdef CONFIG_RTC #if CONFIG_RTC
tm = rb->get_time(); tm = rb->get_time();
today->mon = tm->tm_mon +1; today->mon = tm->tm_mon +1;
today->year = 2000+tm->tm_year%100; today->year = 2000+tm->tm_year%100;

View file

@ -177,7 +177,7 @@ extern void statusbar_icon_play_state(int state);
extern void statusbar_icon_play_mode(int mode); extern void statusbar_icon_play_mode(int mode);
extern void statusbar_icon_shuffle(void); extern void statusbar_icon_shuffle(void);
extern void statusbar_icon_lock(void); extern void statusbar_icon_lock(void);
#ifdef CONFIG_RTC #if CONFIG_RTC
extern void statusbar_time(int hour, int minute); extern void statusbar_time(int hour, int minute);
#endif #endif
#if (CONFIG_LED == LED_VIRTUAL) #if (CONFIG_LED == LED_VIRTUAL)

View file

@ -518,7 +518,7 @@ char *rec_create_filename(char *buffer)
snprintf(ext, sizeof(ext), ".%s", snprintf(ext, sizeof(ext), ".%s",
REC_FILE_ENDING(global_settings.rec_format)); 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 /* We'll wait at least up to the start of the next second so no duplicate
names are created */ names are created */
return create_datetime_filename(buffer, buffer, "R", ext, true); return create_datetime_filename(buffer, buffer, "R", ext, true);

View file

@ -784,7 +784,7 @@ void charging_splash(void)
#endif #endif
#if defined(HAVE_LCD_BITMAP) && defined (CONFIG_RTC) #if defined(HAVE_LCD_BITMAP) && (CONFIG_RTC != 0)
const int dayname[] = { const int dayname[] = {
LANG_WEEKDAY_SUNDAY, LANG_WEEKDAY_SUNDAY,
@ -1081,7 +1081,7 @@ bool set_time_screen(const char* string, struct tm *tm)
lcd_set_drawmode(lastmode); lcd_set_drawmode(lastmode);
return false; 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) #if (CONFIG_KEYPAD == RECORDER_PAD) && !defined(HAVE_SW_POWEROFF)
bool shutdown_screen(void) bool shutdown_screen(void)

View file

@ -42,7 +42,7 @@ extern bool quick_screen_f3(int button_enter);
#endif #endif
extern bool quick_screen_quick(int button_enter); extern bool quick_screen_quick(int button_enter);
#ifdef CONFIG_RTC #if CONFIG_RTC
bool set_time_screen(const char* string, struct tm *tm); bool set_time_screen(const char* string, struct tm *tm);
#endif #endif

View file

@ -32,7 +32,7 @@ http://www.audioscrobbler.net/wiki/Portable_Player_Logging
#include "settings.h" #include "settings.h"
#include "ata_idle_notify.h" #include "ata_idle_notify.h"
#ifdef CONFIG_RTC #if CONFIG_RTC
#include "time.h" #include "time.h"
#include "timefuncs.h" #include "timefuncs.h"
#endif #endif
@ -41,7 +41,7 @@ http://www.audioscrobbler.net/wiki/Portable_Player_Logging
#define SCROBBLER_VERSION "1.0" #define SCROBBLER_VERSION "1.0"
#ifdef CONFIG_RTC #if CONFIG_RTC
#define SCROBBLER_FILE "/.scrobbler.log" #define SCROBBLER_FILE "/.scrobbler.log"
#else #else
#define SCROBBLER_FILE "/.scrobbler-timeless.log" #define SCROBBLER_FILE "/.scrobbler-timeless.log"
@ -62,7 +62,7 @@ static struct mp3entry scrobbler_entry;
static bool pending = false; static bool pending = false;
static bool scrobbler_initialised = false; static bool scrobbler_initialised = false;
static bool scrobbler_ata_callback = false; static bool scrobbler_ata_callback = false;
#ifdef CONFIG_RTC #if CONFIG_RTC
static time_t timestamp; static time_t timestamp;
#else #else
static unsigned long timestamp; static unsigned long timestamp;
@ -92,7 +92,7 @@ static void write_cache(void)
{ {
fdprintf(scrobbler_fd, "#AUDIOSCROBBLER/%s\n", SCROBBLER_VERSION); fdprintf(scrobbler_fd, "#AUDIOSCROBBLER/%s\n", SCROBBLER_VERSION);
fdprintf(scrobbler_fd, "#TZ/UNKNOWN\n"); fdprintf(scrobbler_fd, "#TZ/UNKNOWN\n");
#ifdef CONFIG_RTC #if CONFIG_RTC
fdprintf(scrobbler_fd, fdprintf(scrobbler_fd,
"#CLIENT/Rockbox " TARGET_NAME SCROBBLER_REVISION "\n"); "#CLIENT/Rockbox " TARGET_NAME SCROBBLER_REVISION "\n");
#else #else
@ -207,7 +207,7 @@ void scrobbler_change_event(struct mp3entry *id)
{ {
logf("SCROBBLER: add pending"); logf("SCROBBLER: add pending");
copy_mp3entry(&scrobbler_entry, id); copy_mp3entry(&scrobbler_entry, id);
#ifdef CONFIG_RTC #if CONFIG_RTC
timestamp = mktime(get_time()); timestamp = mktime(get_time());
#else #else
timestamp = 0; timestamp = 0;

View file

@ -29,7 +29,7 @@
#include "gwps.h" #include "gwps.h"
#include "abrepeat.h" #include "abrepeat.h"
#include "statusbar.h" #include "statusbar.h"
#ifdef CONFIG_RTC #if CONFIG_RTC
#include "timefuncs.h" #include "timefuncs.h"
#endif #endif
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP

View file

@ -46,7 +46,7 @@ bool valid_time(const struct tm *tm)
struct tm *get_time(void) struct tm *get_time(void)
{ {
#ifndef SIMULATOR #ifndef SIMULATOR
#ifdef CONFIG_RTC #if CONFIG_RTC
static long timeout = 0; static long timeout = 0;
/* Don't read the RTC more than once per second */ /* 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) int set_time(const struct tm *tm)
{ {
#ifdef CONFIG_RTC #if CONFIG_RTC
int rc; int rc;
char rtcbuf[7]; char rtcbuf[7];

View file

@ -943,7 +943,7 @@ static void fat_time(unsigned short* date,
unsigned short* time, unsigned short* time,
unsigned short* tenth ) unsigned short* tenth )
{ {
#ifdef CONFIG_RTC #if CONFIG_RTC
struct tm* tm = get_time(); struct tm* tm = get_time();
if (date) if (date)
@ -1506,7 +1506,7 @@ static int update_short_entry( struct fat_file* file, long size, int attr )
*sizeptr = htole32(size); *sizeptr = htole32(size);
{ {
#ifdef CONFIG_RTC #if CONFIG_RTC
unsigned short time = 0; unsigned short time = 0;
unsigned short date = 0; unsigned short date = 0;
#else #else

View file

@ -242,6 +242,10 @@
#define CONFIG_CHARGING 0 #define CONFIG_CHARGING 0
#endif #endif
#ifndef CONFIG_RTC
#define CONFIG_RTC 0
#endif
/* Enable the directory cache and tagcache in RAM if we have /* Enable the directory cache and tagcache in RAM if we have
* plenty of RAM. Both features can be enabled independently. */ * plenty of RAM. Both features can be enabled independently. */
#if ((defined(MEMORYSIZE) && (MEMORYSIZE > 8)) || MEM > 8) && \ #if ((defined(MEMORYSIZE) && (MEMORYSIZE > 8)) || MEM > 8) && \

View file

@ -23,7 +23,7 @@
#include "system.h" #include "system.h"
#include "config.h" #include "config.h"
#ifdef CONFIG_RTC #if CONFIG_RTC
extern const int dayname[]; extern const int dayname[];