forked from len0rd/rockbox
remove runtime detection of h1x0 series RTC MOD, but leave driver code
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12554 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
909b9462da
commit
ae08eeb4ff
11 changed files with 11 additions and 120 deletions
|
@ -23,9 +23,7 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include "system.h"
|
#include "system.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
#ifdef CONFIG_RTC
|
|
||||||
#include "rtc.h"
|
#include "rtc.h"
|
||||||
#endif
|
|
||||||
#include "audio.h"
|
#include "audio.h"
|
||||||
#include "status.h"
|
#include "status.h"
|
||||||
#include "power.h"
|
#include "power.h"
|
||||||
|
@ -974,11 +972,6 @@ static char* get_tag(struct wps_data* wps_data,
|
||||||
#ifdef CONFIG_RTC
|
#ifdef CONFIG_RTC
|
||||||
case 'c': /* Real Time Clock display */
|
case 'c': /* Real Time Clock display */
|
||||||
*flags |= WPS_REFRESH_DYNAMIC;
|
*flags |= WPS_REFRESH_DYNAMIC;
|
||||||
#if CONFIG_RTC == RTC_DS1339_DS3231
|
|
||||||
if(!rtc_detected)
|
|
||||||
return NULL;
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
int value;
|
int value;
|
||||||
char *format = 0;
|
char *format = 0;
|
||||||
|
|
|
@ -28,9 +28,6 @@
|
||||||
#include "powermgmt.h"
|
#include "powermgmt.h"
|
||||||
#include "usb.h"
|
#include "usb.h"
|
||||||
#include "led.h"
|
#include "led.h"
|
||||||
#ifdef CONFIG_RTC
|
|
||||||
#include "rtc.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "status.h" /* needed for battery_state global var */
|
#include "status.h" /* needed for battery_state global var */
|
||||||
#include "action.h" /* for keys_locked */
|
#include "action.h" /* for keys_locked */
|
||||||
|
@ -242,9 +239,6 @@ void gui_statusbar_draw(struct gui_statusbar * bar, bool force_redraw)
|
||||||
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
|
#ifdef CONFIG_RTC
|
||||||
#if CONFIG_RTC == RTC_DS1339_DS3231
|
|
||||||
if(rtc_detected)
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
struct tm* tm = get_time();
|
struct tm* tm = get_time();
|
||||||
bar->info.hour = tm->tm_hour;
|
bar->info.hour = tm->tm_hour;
|
||||||
|
@ -330,9 +324,6 @@ void gui_statusbar_draw(struct gui_statusbar * bar, bool force_redraw)
|
||||||
gui_statusbar_icon_lock_remote(display);
|
gui_statusbar_icon_lock_remote(display);
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_RTC
|
#ifdef CONFIG_RTC
|
||||||
#if CONFIG_RTC == RTC_DS1339_DS3231
|
|
||||||
if(rtc_detected)
|
|
||||||
#endif
|
|
||||||
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)
|
||||||
|
|
|
@ -38,12 +38,6 @@
|
||||||
#ifdef HAVE_RTC_ALARM
|
#ifdef HAVE_RTC_ALARM
|
||||||
#include "alarm_menu.h"
|
#include "alarm_menu.h"
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_RTC
|
|
||||||
#include "rtc.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* callback to display rtc menus dynamically */
|
|
||||||
int rtc_detect_callback(int action,const struct menu_item_ex *this_item);
|
|
||||||
|
|
||||||
/***********************************/
|
/***********************************/
|
||||||
/* TAGCACHE MENU */
|
/* TAGCACHE MENU */
|
||||||
|
@ -208,7 +202,7 @@ static int timedate_set(void)
|
||||||
|
|
||||||
MENUITEM_FUNCTION(time_set, ID2P(LANG_TIME), timedate_set, NULL, NOICON);
|
MENUITEM_FUNCTION(time_set, ID2P(LANG_TIME), timedate_set, NULL, NOICON);
|
||||||
MENUITEM_SETTING(timeformat, &global_settings.timeformat, NULL);
|
MENUITEM_SETTING(timeformat, &global_settings.timeformat, NULL);
|
||||||
MAKE_MENU(time_menu, ID2P(LANG_TIME_MENU), rtc_detect_callback, NOICON, &time_set, &timeformat);
|
MAKE_MENU(time_menu, ID2P(LANG_TIME_MENU), 0, NOICON, &time_set, &timeformat);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* System menu */
|
/* System menu */
|
||||||
|
@ -216,7 +210,7 @@ MENUITEM_SETTING(poweroff, &global_settings.poweroff, NULL);
|
||||||
|
|
||||||
#ifdef HAVE_RTC_ALARM
|
#ifdef HAVE_RTC_ALARM
|
||||||
MENUITEM_FUNCTION(alarm_screen_call, ID2P(LANG_ALARM_MOD_ALARM_MENU),
|
MENUITEM_FUNCTION(alarm_screen_call, ID2P(LANG_ALARM_MOD_ALARM_MENU),
|
||||||
(menu_function)alarm_screen, rtc_detect_callback, NOICON);
|
(menu_function)alarm_screen, NULL, NOICON);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Limits menu */
|
/* Limits menu */
|
||||||
|
@ -358,23 +352,3 @@ MAKE_MENU(settings_menu_item, ID2P(LANG_GENERAL_SETTINGS), 0,
|
||||||
&bookmark_settings_menu, &browse_langs, &voice_settings_menu );
|
&bookmark_settings_menu, &browse_langs, &voice_settings_menu );
|
||||||
/* SETTINGS MENU */
|
/* SETTINGS MENU */
|
||||||
/***********************************/
|
/***********************************/
|
||||||
|
|
||||||
/* callback to display rtc menus dynamically */
|
|
||||||
int rtc_detect_callback(int action,const struct menu_item_ex *this_item)
|
|
||||||
{
|
|
||||||
if (action != ACTION_REQUEST_MENUITEM)
|
|
||||||
return action;
|
|
||||||
|
|
||||||
#if defined(CONFIG_RTC) && CONFIG_RTC == RTC_DS1339_DS3231
|
|
||||||
if ((this_item == &time_menu) ||
|
|
||||||
(this_item == &alarm_screen_call))
|
|
||||||
{
|
|
||||||
if (!rtc_detected)
|
|
||||||
return ACTION_EXIT_MENUITEM;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
(void)this_item;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return action;
|
|
||||||
}
|
|
||||||
|
|
|
@ -60,7 +60,6 @@
|
||||||
#include "gui/gwps-common.h"
|
#include "gui/gwps-common.h"
|
||||||
|
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
#include "rtc.h"
|
|
||||||
|
|
||||||
/* Format a large-range value for output, using the appropriate unit so that
|
/* Format a large-range value for output, using the appropriate unit so that
|
||||||
* the displayed value is in the range 1 <= display < 1000 (1024 for "binary"
|
* the displayed value is in the range 1 <= display < 1000 (1024 for "binary"
|
||||||
|
@ -415,12 +414,6 @@ void screen_dump(void)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_RTC
|
#ifdef CONFIG_RTC
|
||||||
#if CONFIG_RTC == RTC_DS1339_DS3231
|
|
||||||
if(!rtc_detected)
|
|
||||||
create_numbered_filename(filename, "", "dump_", ".bmp", 4
|
|
||||||
IF_CNFN_NUM_(, NULL));
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
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
|
||||||
|
|
|
@ -68,9 +68,6 @@
|
||||||
#include "screen_access.h"
|
#include "screen_access.h"
|
||||||
#include "action.h"
|
#include "action.h"
|
||||||
#include "radio.h"
|
#include "radio.h"
|
||||||
#ifdef CONFIG_RTC
|
|
||||||
#include "rtc.h"
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_RECORDING
|
#ifdef HAVE_RECORDING
|
||||||
|
|
||||||
static bool in_screen = false;
|
static bool in_screen = false;
|
||||||
|
@ -524,12 +521,6 @@ char *rec_create_filename(char *buffer)
|
||||||
#ifdef CONFIG_RTC
|
#ifdef 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 */
|
||||||
#if CONFIG_RTC == RTC_DS1339_DS3231
|
|
||||||
if(!rtc_detected)
|
|
||||||
return create_numbered_filename(buffer, buffer, "rec_", ext, 4
|
|
||||||
IF_CNFN_NUM_(, &file_number));
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
return create_datetime_filename(buffer, buffer, "R", ext, true);
|
return create_datetime_filename(buffer, buffer, "R", ext, true);
|
||||||
#else
|
#else
|
||||||
return create_numbered_filename(buffer, buffer, "rec_", ext, 4
|
return create_numbered_filename(buffer, buffer, "rec_", ext, 4
|
||||||
|
|
|
@ -35,7 +35,6 @@ http://www.audioscrobbler.net/wiki/Portable_Player_Logging
|
||||||
#ifdef CONFIG_RTC
|
#ifdef CONFIG_RTC
|
||||||
#include "time.h"
|
#include "time.h"
|
||||||
#include "timefuncs.h"
|
#include "timefuncs.h"
|
||||||
#include "rtc.h"
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "scrobbler.h"
|
#include "scrobbler.h"
|
||||||
|
@ -209,11 +208,6 @@ 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
|
#ifdef CONFIG_RTC
|
||||||
#if CONFIG_RTC == RTC_DS1339_DS3231
|
|
||||||
if(!rtc_detected)
|
|
||||||
timestamp = 0;
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
timestamp = mktime(get_time());
|
timestamp = mktime(get_time());
|
||||||
#else
|
#else
|
||||||
timestamp = 0;
|
timestamp = 0;
|
||||||
|
|
|
@ -49,19 +49,6 @@ struct tm *get_time(void)
|
||||||
#ifdef CONFIG_RTC
|
#ifdef CONFIG_RTC
|
||||||
static long timeout = 0;
|
static long timeout = 0;
|
||||||
|
|
||||||
#if CONFIG_RTC == RTC_DS1339_DS3231
|
|
||||||
if(!rtc_detected) {
|
|
||||||
tm.tm_sec = 0;
|
|
||||||
tm.tm_min = 0;
|
|
||||||
tm.tm_hour = 0;
|
|
||||||
tm.tm_mday = 1;
|
|
||||||
tm.tm_mon = 0;
|
|
||||||
tm.tm_year = 70;
|
|
||||||
tm.tm_wday = 1;
|
|
||||||
tm.tm_yday = 0; /* Not implemented for now */
|
|
||||||
tm.tm_isdst = -1; /* Not implemented for now */
|
|
||||||
} else
|
|
||||||
#endif
|
|
||||||
/* Don't read the RTC more than once per second */
|
/* Don't read the RTC more than once per second */
|
||||||
if (current_tick > timeout) {
|
if (current_tick > timeout) {
|
||||||
char rtcbuf[7];
|
char rtcbuf[7];
|
||||||
|
|
|
@ -31,9 +31,6 @@
|
||||||
#include "rbunicode.h"
|
#include "rbunicode.h"
|
||||||
#include "logf.h"
|
#include "logf.h"
|
||||||
#include "atoi.h"
|
#include "atoi.h"
|
||||||
#ifdef CONFIG_RTC
|
|
||||||
#include "rtc.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define BYTES2INT16(array,pos) \
|
#define BYTES2INT16(array,pos) \
|
||||||
(array[pos] | (array[pos+1] << 8 ))
|
(array[pos] | (array[pos+1] << 8 ))
|
||||||
|
@ -948,10 +945,6 @@ static void fat_time(unsigned short* date,
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_RTC
|
#ifdef CONFIG_RTC
|
||||||
struct tm* tm = get_time();
|
struct tm* tm = get_time();
|
||||||
#if CONFIG_RTC == RTC_DS1339_DS3231
|
|
||||||
if(rtc_detected)
|
|
||||||
{
|
|
||||||
#endif /* CONFIG_RTC == RTC_DS1339_DS3231 */
|
|
||||||
|
|
||||||
if (date)
|
if (date)
|
||||||
*date = ((tm->tm_year - 80) << 9) |
|
*date = ((tm->tm_year - 80) << 9) |
|
||||||
|
@ -965,14 +958,7 @@ static void fat_time(unsigned short* date,
|
||||||
|
|
||||||
if (tenth)
|
if (tenth)
|
||||||
*tenth = (tm->tm_sec & 1) * 100;
|
*tenth = (tm->tm_sec & 1) * 100;
|
||||||
|
#else
|
||||||
#if CONFIG_RTC == RTC_DS1339_DS3231
|
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif /* CONFIG_RTC == RTC_DS1339_DS3231 */
|
|
||||||
#endif /* CONFIG_RTC */
|
|
||||||
#if !defined(CONFIG_RTC) || CONFIG_RTC == RTC_DS1339_DS3231
|
|
||||||
{
|
|
||||||
/* non-RTC version returns an increment from the supplied time, or a
|
/* non-RTC version returns an increment from the supplied time, or a
|
||||||
* fixed standard time/date if no time given as input */
|
* fixed standard time/date if no time given as input */
|
||||||
bool next_day = false;
|
bool next_day = false;
|
||||||
|
@ -1039,9 +1025,9 @@ static void fat_time(unsigned short* date,
|
||||||
}
|
}
|
||||||
if (tenth)
|
if (tenth)
|
||||||
*tenth = 0;
|
*tenth = 0;
|
||||||
|
#endif /* CONFIG_RTC */
|
||||||
}
|
}
|
||||||
#endif /* !defined(CONFIG_RTC) || CONFIG_RTC == RTC_DS1339_DS3231 */
|
|
||||||
}
|
|
||||||
static int write_long_name(struct fat_file* file,
|
static int write_long_name(struct fat_file* file,
|
||||||
unsigned int firstentry,
|
unsigned int firstentry,
|
||||||
unsigned int numentries,
|
unsigned int numentries,
|
||||||
|
|
|
@ -22,17 +22,10 @@
|
||||||
|
|
||||||
#define RTC_ADDR 0xD0
|
#define RTC_ADDR 0xD0
|
||||||
|
|
||||||
bool rtc_detected = false;
|
|
||||||
|
|
||||||
void rtc_init(void)
|
void rtc_init(void)
|
||||||
{
|
{
|
||||||
char byte;
|
|
||||||
|
|
||||||
sw_i2c_init();
|
sw_i2c_init();
|
||||||
|
|
||||||
/* read one byte from RTC; 0 on success */
|
|
||||||
rtc_detected = !sw_i2c_read(RTC_ADDR, 0, &byte, 1);
|
|
||||||
|
|
||||||
#ifdef HAVE_RTC_ALARM
|
#ifdef HAVE_RTC_ALARM
|
||||||
/* Check + save alarm bit first, before the power thread starts watching */
|
/* Check + save alarm bit first, before the power thread starts watching */
|
||||||
rtc_check_alarm_started(false);
|
rtc_check_alarm_started(false);
|
||||||
|
@ -72,7 +65,8 @@ bool rtc_check_alarm_flag(void)
|
||||||
sw_i2c_read(RTC_ADDR, 0x0f, buf, 1);
|
sw_i2c_read(RTC_ADDR, 0x0f, buf, 1);
|
||||||
if (buf[0] & 0x02) flag = true;
|
if (buf[0] & 0x02) flag = true;
|
||||||
|
|
||||||
rtc_enable_alarm(false);
|
buf[0] = 0x00;
|
||||||
|
sw_i2c_write(RTC_ADDR, 0x0f, buf, 1);
|
||||||
|
|
||||||
return flag;
|
return flag;
|
||||||
}
|
}
|
||||||
|
@ -109,7 +103,7 @@ bool rtc_enable_alarm(bool enable)
|
||||||
{
|
{
|
||||||
unsigned char buf[2];
|
unsigned char buf[2];
|
||||||
|
|
||||||
buf[0] = enable ? 0x26 : 0x04; /* BBSQI INTCN A2IE vs INTCH only */
|
buf[0] = enable ? 0x26 : 0x24; /* BBSQI INTCN A2IE vs INTCH only */
|
||||||
buf[1] = 0x00; /* reset alarm flags (and OSF for good measure) */
|
buf[1] = 0x00; /* reset alarm flags (and OSF for good measure) */
|
||||||
|
|
||||||
sw_i2c_write(RTC_ADDR, 0x0e, buf, 2);
|
sw_i2c_write(RTC_ADDR, 0x0e, buf, 2);
|
||||||
|
|
|
@ -45,15 +45,6 @@
|
||||||
/* Define this if you do software codec */
|
/* Define this if you do software codec */
|
||||||
#define CONFIG_CODEC SWCODEC
|
#define CONFIG_CODEC SWCODEC
|
||||||
|
|
||||||
/* Set to 1 if you want to build with RTC support */
|
|
||||||
#if 0
|
|
||||||
#ifndef SIMULATOR
|
|
||||||
/* RTC is autodetected on target only */
|
|
||||||
#define CONFIG_RTC RTC_DS1339_DS3231
|
|
||||||
#define HAVE_RTC_ALARM
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Define this if you have an remote lcd */
|
/* Define this if you have an remote lcd */
|
||||||
#define HAVE_REMOTE_LCD
|
#define HAVE_REMOTE_LCD
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,8 @@
|
||||||
#define _RTC_H_
|
#define _RTC_H_
|
||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <system.h>
|
#include "system.h"
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
#ifdef CONFIG_RTC
|
#ifdef CONFIG_RTC
|
||||||
|
|
||||||
|
@ -28,10 +29,6 @@ extern const int dayname[];
|
||||||
|
|
||||||
extern const int monthname[];
|
extern const int monthname[];
|
||||||
|
|
||||||
#if CONFIG_RTC == RTC_DS1339_DS3231
|
|
||||||
extern bool rtc_detected;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Common functions for all targets */
|
/* Common functions for all targets */
|
||||||
void rtc_init(void);
|
void rtc_init(void);
|
||||||
int rtc_read_datetime(unsigned char* buf);
|
int rtc_read_datetime(unsigned char* buf);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue