1
0
Fork 0
forked from len0rd/rockbox

CONFIG_CHARGING

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12384 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jonathan Gordon 2007-02-18 05:32:06 +00:00
parent bd47d48c21
commit 9a6f419775
25 changed files with 72 additions and 68 deletions

View file

@ -1411,7 +1411,7 @@ static bool view_battery(void)
snprintf(buf, 30, "External: %d.%02d V", y / 100, y % 100); snprintf(buf, 30, "External: %d.%02d V", y / 100, y % 100);
lcd_puts(0, 2, buf); lcd_puts(0, 2, buf);
#endif #endif
#ifdef CONFIG_CHARGING #if CONFIG_CHARGING
#if CONFIG_CHARGING == CHARGING_CONTROL #if CONFIG_CHARGING == CHARGING_CONTROL
snprintf(buf, 30, "Chgr: %s %s", snprintf(buf, 30, "Chgr: %s %s",
charger_inserted() ? "present" : "absent", charger_inserted() ? "present" : "absent",

View file

@ -823,7 +823,7 @@ static char* get_tag(struct wps_data* wps_data,
} }
} }
#ifdef CONFIG_CHARGING #if CONFIG_CHARGING
case 'p': /* External power plugged in? */ case 'p': /* External power plugged in? */
{ {
if(charger_input_state==CHARGER) if(charger_input_state==CHARGER)

View file

@ -146,7 +146,7 @@ void gui_statusbar_draw(struct gui_statusbar * bar, bool force_redraw)
#ifdef HAVE_USB_POWER #ifdef HAVE_USB_POWER
bar->info.usb_inserted = usb_inserted(); bar->info.usb_inserted = usb_inserted();
#endif #endif
#ifdef CONFIG_CHARGING #if CONFIG_CHARGING
bar->info.inserted = (charger_input_state == CHARGER); bar->info.inserted = (charger_input_state == CHARGER);
if (bar->info.inserted) if (bar->info.inserted)
{ {
@ -245,7 +245,7 @@ void gui_statusbar_draw(struct gui_statusbar * bar, bool force_redraw)
STATUSBAR_Y_POS, STATUSBAR_PLUG_WIDTH, STATUSBAR_Y_POS, STATUSBAR_PLUG_WIDTH,
STATUSBAR_HEIGHT); STATUSBAR_HEIGHT);
#endif /* HAVE_USB_POWER */ #endif /* HAVE_USB_POWER */
#ifdef CONFIG_CHARGING #if CONFIG_CHARGING
#ifdef HAVE_USB_POWER #ifdef HAVE_USB_POWER
else else
#endif #endif
@ -358,7 +358,7 @@ void gui_statusbar_icon_battery(struct screen * display, int percent,
unsigned int prevfg = 0; unsigned int prevfg = 0;
#endif #endif
#ifdef CONFIG_CHARGING #if CONFIG_CHARGING
if (batt_charge_step >= 0) if (batt_charge_step >= 0)
{ {
fill = percent * (STATUSBAR_BATTERY_WIDTH-3) / 100; fill = percent * (STATUSBAR_BATTERY_WIDTH-3) / 100;

View file

@ -40,7 +40,7 @@ struct status_info {
int minute; int minute;
#endif #endif
#ifdef CONFIG_CHARGING #if CONFIG_CHARGING
bool inserted; bool inserted;
#endif #endif
#ifdef HAVE_USB_POWER #ifdef HAVE_USB_POWER

View file

@ -293,7 +293,7 @@ static void init(void)
{ {
int rc; int rc;
bool mounted = false; bool mounted = false;
#if defined(CONFIG_CHARGING) && (CONFIG_CPU == SH7034) #if CONFIG_CHARGING && (CONFIG_CPU == SH7034)
/* if nobody initialized ATA before, I consider this a cold start */ /* if nobody initialized ATA before, I consider this a cold start */
bool coldstart = (PACR2 & 0x4000) != 0; /* starting from Flash */ bool coldstart = (PACR2 & 0x4000) != 0; /* starting from Flash */
#endif #endif
@ -372,7 +372,7 @@ static void init(void)
screen_access_init(); screen_access_init();
gui_syncstatusbar_init(&statusbars); gui_syncstatusbar_init(&statusbars);
#if defined(CONFIG_CHARGING) && (CONFIG_CPU == SH7034) #if CONFIG_CHARGING && (CONFIG_CPU == SH7034)
if (coldstart && charger_inserted() if (coldstart && charger_inserted()
&& !global_settings.car_adapter_mode && !global_settings.car_adapter_mode
#ifdef ATA_POWER_PLAYERSTYLE #ifdef ATA_POWER_PLAYERSTYLE
@ -536,7 +536,7 @@ static void init(void)
} }
#endif /* #ifdef AUTOROCK */ #endif /* #ifdef AUTOROCK */
#ifdef CONFIG_CHARGING #if CONFIG_CHARGING
car_adapter_mode_init(); car_adapter_mode_init();
#endif #endif
} }

View file

@ -79,7 +79,7 @@ int flipdisplay_callback(int action,const struct menu_item_ex *this_item)
/* LCD MENU */ /* LCD MENU */
#ifdef CONFIG_BACKLIGHT #ifdef CONFIG_BACKLIGHT
MENUITEM_SETTING(backlight_timeout, &global_settings.backlight_timeout, NULL); MENUITEM_SETTING(backlight_timeout, &global_settings.backlight_timeout, NULL);
#ifdef CONFIG_CHARGING #if CONFIG_CHARGING
MENUITEM_SETTING(backlight_timeout_plugged, MENUITEM_SETTING(backlight_timeout_plugged,
&global_settings.backlight_timeout_plugged, NULL); &global_settings.backlight_timeout_plugged, NULL);
#endif #endif
@ -174,7 +174,7 @@ MAKE_MENU(lcd_settings,ID2P(LANG_LCD_MENU),
NULL, bitmap_icons_6x8[Icon_Display_menu] NULL, bitmap_icons_6x8[Icon_Display_menu]
#ifdef CONFIG_BACKLIGHT #ifdef CONFIG_BACKLIGHT
,&backlight_timeout ,&backlight_timeout
# ifdef CONFIG_CHARGING # if CONFIG_CHARGING
,&backlight_timeout_plugged ,&backlight_timeout_plugged
# endif # endif
# ifdef HAS_BUTTON_HOLD # ifdef HAS_BUTTON_HOLD
@ -218,7 +218,7 @@ MAKE_MENU(lcd_settings,ID2P(LANG_LCD_MENU),
MENUITEM_SETTING(remote_backlight_timeout, MENUITEM_SETTING(remote_backlight_timeout,
&global_settings.remote_backlight_timeout, NULL); &global_settings.remote_backlight_timeout, NULL);
#ifdef CONFIG_CHARGING #if CONFIG_CHARGING
MENUITEM_SETTING(remote_backlight_timeout_plugged, MENUITEM_SETTING(remote_backlight_timeout_plugged,
&global_settings.remote_backlight_timeout_plugged, NULL); &global_settings.remote_backlight_timeout_plugged, NULL);
#endif #endif
@ -260,7 +260,7 @@ MENUITEM_SETTING(remote_reduce_ticking,
MAKE_MENU(lcd_remote_settings, ID2P(LANG_LCD_REMOTE_MENU), MAKE_MENU(lcd_remote_settings, ID2P(LANG_LCD_REMOTE_MENU),
NULL, bitmap_icons_6x8[Icon_Remote_Display_menu], NULL, bitmap_icons_6x8[Icon_Remote_Display_menu],
&remote_backlight_timeout, &remote_backlight_timeout,
#ifdef CONFIG_CHARGING #if CONFIG_CHARGING
&remote_backlight_timeout_plugged, &remote_backlight_timeout_plugged,
#endif #endif
#ifdef HAS_REMOTE_BUTTON_HOLD #ifdef HAS_REMOTE_BUTTON_HOLD

View file

@ -110,7 +110,7 @@ MAKE_MENU(file_menu, ID2P(LANG_FILE), 0, NOICON,
MENUITEM_SETTING(battery_capacity, &global_settings.battery_capacity, NULL); MENUITEM_SETTING(battery_capacity, &global_settings.battery_capacity, NULL);
MENUITEM_SETTING(battery_type, &global_settings.battery_type, NULL); MENUITEM_SETTING(battery_type, &global_settings.battery_type, NULL);
#ifdef HAVE_USB_POWER #ifdef HAVE_USB_POWER
#ifdef CONFIG_CHARGING #if CONFIG_CHARGING
static int usbcharging_callback(int action,const struct menu_item_ex *this_item) static int usbcharging_callback(int action,const struct menu_item_ex *this_item)
{ {
(void)this_item; (void)this_item;
@ -131,7 +131,7 @@ MAKE_MENU(battery_menu, ID2P(LANG_BATTERY_MENU), 0, NOICON,
&battery_type, &battery_type,
#endif #endif
#ifdef HAVE_USB_POWER #ifdef HAVE_USB_POWER
#ifdef CONFIG_CHARGING #if CONFIG_CHARGING
&usb_charging, &usb_charging,
#endif #endif
#endif #endif
@ -272,7 +272,7 @@ static int linein_callback(int action,const struct menu_item_ex *this_item)
} }
MENUITEM_SETTING(line_in, &global_settings.line_in, linein_callback); MENUITEM_SETTING(line_in, &global_settings.line_in, linein_callback);
#endif #endif
#ifdef CONFIG_CHARGING #if CONFIG_CHARGING
MENUITEM_SETTING(car_adapter_mode, &global_settings.car_adapter_mode, NULL); MENUITEM_SETTING(car_adapter_mode, &global_settings.car_adapter_mode, NULL);
#endif #endif
@ -296,7 +296,7 @@ MAKE_MENU(system_menu, ID2P(LANG_SYSTEM),
#if CONFIG_CODEC == MAS3507D #if CONFIG_CODEC == MAS3507D
&line_in, &line_in,
#endif #endif
#ifdef CONFIG_CHARGING #if CONFIG_CHARGING
&car_adapter_mode, &car_adapter_mode,
#endif #endif
); );

View file

@ -595,7 +595,7 @@ static bool clean_shutdown(void (*callback)(void *), void *parameter)
#else #else
int i; int i;
#if defined(CONFIG_CHARGING) && !defined(HAVE_POWEROFF_WHILE_CHARGING) #if CONFIG_CHARGING && !defined(HAVE_POWEROFF_WHILE_CHARGING)
if(!charger_inserted()) if(!charger_inserted())
#endif #endif
{ {
@ -668,7 +668,7 @@ static bool clean_shutdown(void (*callback)(void *), void *parameter)
return false; return false;
} }
#ifdef CONFIG_CHARGING #if CONFIG_CHARGING
static bool waiting_to_resume_play = false; static bool waiting_to_resume_play = false;
static long play_resume_tick; static long play_resume_tick;
@ -774,7 +774,7 @@ long default_event_handler_ex(long event, void (*callback)(void *), void *parame
if (!clean_shutdown(callback, parameter)) if (!clean_shutdown(callback, parameter))
return SYS_POWEROFF; return SYS_POWEROFF;
break; break;
#ifdef CONFIG_CHARGING #if CONFIG_CHARGING
case SYS_CHARGER_CONNECTED: case SYS_CHARGER_CONNECTED:
car_adapter_mode_processing(true); car_adapter_mode_processing(true);
return SYS_CHARGER_CONNECTED; return SYS_CHARGER_CONNECTED;

View file

@ -33,7 +33,7 @@
#include "splash.h" #include "splash.h"
#include "logf.h" #include "logf.h"
#ifdef CONFIG_CHARGING #if CONFIG_CHARGING
#include "power.h" #include "power.h"
#endif #endif
@ -406,7 +406,7 @@ static const struct plugin_api rockbox_api = {
#ifndef SIMULATOR #ifndef SIMULATOR
battery_voltage, battery_voltage,
#endif #endif
#ifdef CONFIG_CHARGING #if CONFIG_CHARGING
charger_inserted, charger_inserted,
# if CONFIG_CHARGING == CHARGING_MONITOR # if CONFIG_CHARGING == CHARGING_MONITOR
charging_state, charging_state,

View file

@ -510,7 +510,7 @@ struct plugin_api {
#ifndef SIMULATOR #ifndef SIMULATOR
unsigned int (*battery_voltage)(void); unsigned int (*battery_voltage)(void);
#endif #endif
#ifdef CONFIG_CHARGING #if CONFIG_CHARGING
bool (*charger_inserted)(void); bool (*charger_inserted)(void);
# if CONFIG_CHARGING == CHARGING_MONITOR # if CONFIG_CHARGING == CHARGING_MONITOR
bool (*charging_state)(void); bool (*charging_state)(void);

View file

@ -156,11 +156,11 @@ bool exit_tsr(bool reenter)
/* use long for aligning */ /* use long for aligning */
unsigned long thread_stack[THREAD_STACK_SIZE/sizeof(long)]; unsigned long thread_stack[THREAD_STACK_SIZE/sizeof(long)];
#if defined(CONFIG_CHARGING) || defined(HAVE_USB_POWER) #if CONFIG_CHARGING || defined(HAVE_USB_POWER)
unsigned int charge_state(void) unsigned int charge_state(void)
{ {
unsigned int ret = 0; unsigned int ret = 0;
#ifdef CONFIG_CHARGING #if CONFIG_CHARGING
if(rb->charger_inserted()) if(rb->charger_inserted())
ret = BIT_CHARGER; ret = BIT_CHARGER;
#if CONFIG_CHARGING == CHARGING_MONITOR #if CONFIG_CHARGING == CHARGING_MONITOR
@ -182,7 +182,7 @@ void thread(void)
int fd, buffelements, tick = 1, i = 0, skipped = 0, exit = 0; int fd, buffelements, tick = 1, i = 0, skipped = 0, exit = 0;
int fst = 0, lst = 0; /* first and last skipped tick */ int fst = 0, lst = 0; /* first and last skipped tick */
unsigned int last_voltage = 0; unsigned int last_voltage = 0;
#if defined(CONFIG_CHARGING) || defined(HAVE_USB_POWER) #if CONFIG_CHARGING || defined(HAVE_USB_POWER)
unsigned int last_state = 0; unsigned int last_state = 0;
#endif #endif
long sleep_time; long sleep_time;
@ -230,7 +230,7 @@ void thread(void)
rb->fdprintf(fd, rb->fdprintf(fd,
"%02d:%02d:%02d, %05d, %03d%%, " "%02d:%02d:%02d, %05d, %03d%%, "
"%02d:%02d, %04d, %04d" "%02d:%02d, %04d, %04d"
#ifdef CONFIG_CHARGING #if CONFIG_CHARGING
", %c" ", %c"
#if CONFIG_CHARGING == CHARGING_MONITOR #if CONFIG_CHARGING == CHARGING_MONITOR
", %c" ", %c"
@ -243,7 +243,7 @@ void thread(void)
HMS(secs), secs, bat[j].level, HMS(secs), secs, bat[j].level,
bat[j].eta / 60, bat[j].eta % 60, bat[j].eta / 60, bat[j].eta % 60,
#if defined(CONFIG_CHARGING) || defined(HAVE_USB_POWER) #if CONFIG_CHARGING || defined(HAVE_USB_POWER)
(bat[j].voltage & (bat[j].voltage &
(~(BIT_CHARGER|BIT_CHARGING|BIT_USB_POWER))) (~(BIT_CHARGER|BIT_CHARGING|BIT_USB_POWER)))
*10, *10,
@ -251,7 +251,7 @@ void thread(void)
bat[j].voltage * 10, bat[j].voltage * 10,
#endif #endif
temp + 1 + (j-i) temp + 1 + (j-i)
#ifdef CONFIG_CHARGING #if CONFIG_CHARGING
,(bat[j].voltage & BIT_CHARGER)?'A':'-' ,(bat[j].voltage & BIT_CHARGER)?'A':'-'
#if CONFIG_CHARGING == CHARGING_MONITOR #if CONFIG_CHARGING == CHARGING_MONITOR
,(bat[j].voltage & BIT_CHARGING)?'C':'-' ,(bat[j].voltage & BIT_CHARGING)?'C':'-'
@ -288,7 +288,7 @@ void thread(void)
timeflag = true; timeflag = true;
if(last_voltage != (current_voltage=rb->battery_voltage()) if(last_voltage != (current_voltage=rb->battery_voltage())
#if defined(CONFIG_CHARGING) || defined(HAVE_USB_POWER) #if CONFIG_CHARGING || defined(HAVE_USB_POWER)
|| last_state != charge_state() || last_state != charge_state()
#endif #endif
) )
@ -308,7 +308,7 @@ void thread(void)
bat[i].level = rb->battery_level(); bat[i].level = rb->battery_level();
bat[i].eta = rb->battery_time(); bat[i].eta = rb->battery_time();
last_voltage = bat[i].voltage = current_voltage; last_voltage = bat[i].voltage = current_voltage;
#if defined(CONFIG_CHARGING) || defined(HAVE_USB_POWER) #if CONFIG_CHARGING || defined(HAVE_USB_POWER)
bat[i].voltage |= last_state = charge_state(); bat[i].voltage |= last_state = charge_state();
#endif #endif
i++; i++;
@ -448,7 +448,7 @@ int main(void)
"Battery type: %d mAh Buffer Entries: %d\n" "Battery type: %d mAh Buffer Entries: %d\n"
" Time:, Seconds:, Level:, Time Left:, Voltage[mV]:," " Time:, Seconds:, Level:, Time Left:, Voltage[mV]:,"
" M/DA:" " M/DA:"
#ifdef CONFIG_CHARGING #if CONFIG_CHARGING
", C:" ", C:"
#endif #endif
#if CONFIG_CHARGING == CHARGING_MONITOR #if CONFIG_CHARGING == CHARGING_MONITOR

View file

@ -171,7 +171,7 @@ int mmc_remove_request(void)
} }
#endif #endif
#if defined(CONFIG_CHARGING) && !defined(HAVE_POWEROFF_WHILE_CHARGING) #if CONFIG_CHARGING && !defined(HAVE_POWEROFF_WHILE_CHARGING)
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
static void charging_display_info(bool animate) static void charging_display_info(bool animate)
@ -778,7 +778,7 @@ bool quick_screen_f3(int button_enter)
#endif /* BUTTON_F3 */ #endif /* BUTTON_F3 */
#endif /* CONFIG_KEYPAD in (RECORDER_PAD |IRIVER_H100_PAD | IRIVER_H300_PAD) */ #endif /* CONFIG_KEYPAD in (RECORDER_PAD |IRIVER_H100_PAD | IRIVER_H300_PAD) */
#if defined(CONFIG_CHARGING) || defined(SIMULATOR) #if CONFIG_CHARGING || defined(SIMULATOR)
void charging_splash(void) void charging_splash(void)
{ {
gui_syncsplash(2*HZ, true, (unsigned char *)str(LANG_BATTERY_CHARGE)); gui_syncsplash(2*HZ, true, (unsigned char *)str(LANG_BATTERY_CHARGE));
@ -1342,7 +1342,7 @@ bool view_runtime(void)
} }
if (state & 1) { if (state & 1) {
#ifdef CONFIG_CHARGING #if CONFIG_CHARGING
if (charger_inserted() if (charger_inserted()
#ifdef HAVE_USB_POWER #ifdef HAVE_USB_POWER
|| usb_powered() || usb_powered()

View file

@ -665,7 +665,7 @@ void sound_settings_apply(void)
#endif #endif
#ifdef HAVE_USB_POWER #ifdef HAVE_USB_POWER
#ifdef CONFIG_CHARGING #if CONFIG_CHARGING
usb_charging_enable(global_settings.usb_charging); usb_charging_enable(global_settings.usb_charging);
#endif #endif
#endif #endif
@ -699,7 +699,7 @@ void settings_apply(void)
lcd_remote_emireduce(global_settings.remote_reduce_ticking); lcd_remote_emireduce(global_settings.remote_reduce_ticking);
#endif #endif
remote_backlight_set_timeout(global_settings.remote_backlight_timeout); remote_backlight_set_timeout(global_settings.remote_backlight_timeout);
#ifdef CONFIG_CHARGING #if CONFIG_CHARGING
remote_backlight_set_timeout_plugged(global_settings.remote_backlight_timeout_plugged); remote_backlight_set_timeout_plugged(global_settings.remote_backlight_timeout_plugged);
#endif #endif
#ifdef HAS_REMOTE_BUTTON_HOLD #ifdef HAS_REMOTE_BUTTON_HOLD
@ -708,7 +708,7 @@ void settings_apply(void)
#endif /* HAVE_REMOTE_LCD */ #endif /* HAVE_REMOTE_LCD */
#ifdef CONFIG_BACKLIGHT #ifdef CONFIG_BACKLIGHT
backlight_set_timeout(global_settings.backlight_timeout); backlight_set_timeout(global_settings.backlight_timeout);
#ifdef CONFIG_CHARGING #if CONFIG_CHARGING
backlight_set_timeout_plugged(global_settings.backlight_timeout_plugged); backlight_set_timeout_plugged(global_settings.backlight_timeout_plugged);
#endif #endif
#if defined(HAVE_BACKLIGHT_PWM_FADING) && !defined(SIMULATOR) #if defined(HAVE_BACKLIGHT_PWM_FADING) && !defined(SIMULATOR)

View file

@ -629,7 +629,7 @@ struct user_settings
#endif #endif
#ifdef HAVE_USB_POWER #ifdef HAVE_USB_POWER
#ifdef CONFIG_CHARGING #if CONFIG_CHARGING
bool usb_charging; bool usb_charging;
#endif #endif
#endif #endif

View file

@ -415,7 +415,7 @@ const struct settings_list settings[] = {
"backlight timeout", backlight_times_conf, UNIT_SEC, "backlight timeout", backlight_times_conf, UNIT_SEC,
0, 18, 1, backlight_formatter, backlight_getlang, 0, 18, 1, backlight_formatter, backlight_getlang,
backlight_set_timeout), backlight_set_timeout),
#ifdef CONFIG_CHARGING #if CONFIG_CHARGING
INT_SETTING_W_CFGVALS(0, backlight_timeout_plugged, INT_SETTING_W_CFGVALS(0, backlight_timeout_plugged,
LANG_BACKLIGHT_ON_WHEN_CHARGING, 11, LANG_BACKLIGHT_ON_WHEN_CHARGING, 11,
"backlight timeout plugged", backlight_times_conf, UNIT_SEC, "backlight timeout plugged", backlight_times_conf, UNIT_SEC,
@ -475,7 +475,7 @@ const struct settings_list settings[] = {
BATTERY_CAPACITY_MIN, BATTERY_CAPACITY_MAX, BATTERY_CAPACITY_INC, BATTERY_CAPACITY_MIN, BATTERY_CAPACITY_MAX, BATTERY_CAPACITY_INC,
NULL, NULL, NULL), NULL, NULL, NULL),
#endif #endif
#ifdef CONFIG_CHARGING #if CONFIG_CHARGING
OFFON_SETTING(NVRAM(1), car_adapter_mode, OFFON_SETTING(NVRAM(1), car_adapter_mode,
LANG_CAR_ADAPTER_MODE, false, "car adapter mode", NULL), LANG_CAR_ADAPTER_MODE, false, "car adapter mode", NULL),
#endif #endif
@ -504,7 +504,7 @@ const struct settings_list settings[] = {
"remote backlight timeout", backlight_times_conf, UNIT_SEC, "remote backlight timeout", backlight_times_conf, UNIT_SEC,
0, 18, 1, backlight_formatter, backlight_getlang, 0, 18, 1, backlight_formatter, backlight_getlang,
remote_backlight_set_timeout), remote_backlight_set_timeout),
#ifdef CONFIG_CHARGING #if CONFIG_CHARGING
INT_SETTING_W_CFGVALS(0, remote_backlight_timeout_plugged, LANG_BACKLIGHT, 11, INT_SETTING_W_CFGVALS(0, remote_backlight_timeout_plugged, LANG_BACKLIGHT, 11,
"remote backlight timeout plugged", backlight_times_conf, UNIT_SEC, "remote backlight timeout plugged", backlight_times_conf, UNIT_SEC,
0, 18, 1, backlight_formatter, backlight_getlang, 0, 18, 1, backlight_formatter, backlight_getlang,
@ -1057,7 +1057,7 @@ const struct settings_list settings[] = {
FILENAME_SETTING(0,kbd_file,"kbd","",ROCKBOX_DIR "/",".kbd",MAX_FILENAME+1), FILENAME_SETTING(0,kbd_file,"kbd","",ROCKBOX_DIR "/",".kbd",MAX_FILENAME+1),
#endif #endif
#ifdef HAVE_USB_POWER #ifdef HAVE_USB_POWER
#ifdef CONFIG_CHARGING #if CONFIG_CHARGING
OFFON_SETTING(0,usb_charging,LANG_USB_CHARGING,false,"usb charging",NULL), OFFON_SETTING(0,usb_charging,LANG_USB_CHARGING,false,"usb charging",NULL),
#endif #endif
#endif #endif

View file

@ -742,7 +742,7 @@ static bool dirbrowse(void)
audio_stop(); audio_stop();
} }
} }
#if defined(CONFIG_CHARGING) && \ #if CONFIG_CHARGING && \
(CONFIG_KEYPAD == RECORDER_PAD) && !defined(HAVE_SW_POWEROFF) (CONFIG_KEYPAD == RECORDER_PAD) && !defined(HAVE_SW_POWEROFF)
else { else {
if (!charger_inserted()) { if (!charger_inserted()) {
@ -755,7 +755,7 @@ static bool dirbrowse(void)
} }
#endif #endif
} }
#if defined(CONFIG_CHARGING) && !defined(HAVE_POWEROFF_WHILE_CHARGING) #if CONFIG_CHARGING && !defined(HAVE_POWEROFF_WHILE_CHARGING)
{ {
static int last_off = 0; static int last_off = 0;
if (current_tick - last_off < 50) { if (current_tick - last_off < 50) {

View file

@ -116,7 +116,7 @@ static struct event_queue backlight_queue;
static int backlight_timer; static int backlight_timer;
static int backlight_timeout = 5*HZ; static int backlight_timeout = 5*HZ;
#ifdef CONFIG_CHARGING #if CONFIG_CHARGING
static int backlight_timeout_plugged = 5*HZ; static int backlight_timeout_plugged = 5*HZ;
#endif #endif
#ifdef HAS_BUTTON_HOLD #ifdef HAS_BUTTON_HOLD
@ -126,7 +126,7 @@ static int backlight_on_button_hold = 0;
#ifdef HAVE_REMOTE_LCD #ifdef HAVE_REMOTE_LCD
static int remote_backlight_timer; static int remote_backlight_timer;
static int remote_backlight_timeout = 5*HZ; static int remote_backlight_timeout = 5*HZ;
#ifdef CONFIG_CHARGING #if CONFIG_CHARGING
static int remote_backlight_timeout_plugged = 5*HZ; static int remote_backlight_timeout_plugged = 5*HZ;
#endif #endif
#ifdef HAS_REMOTE_BUTTON_HOLD #ifdef HAS_REMOTE_BUTTON_HOLD
@ -347,7 +347,7 @@ static void __remote_backlight_off(void)
/* Update state of backlight according to timeout setting */ /* Update state of backlight according to timeout setting */
static void backlight_update_state(void) static void backlight_update_state(void)
{ {
#ifdef CONFIG_CHARGING #if CONFIG_CHARGING
if (charger_inserted() if (charger_inserted()
#ifdef HAVE_USB_POWER #ifdef HAVE_USB_POWER
|| usb_powered() || usb_powered()
@ -386,7 +386,7 @@ static void backlight_update_state(void)
/* Update state of remote backlight according to timeout setting */ /* Update state of remote backlight according to timeout setting */
static void remote_backlight_update_state(void) static void remote_backlight_update_state(void)
{ {
#ifdef CONFIG_CHARGING #if CONFIG_CHARGING
if (charger_inserted() if (charger_inserted()
#ifdef HAVE_USB_POWER #ifdef HAVE_USB_POWER
|| usb_powered() || usb_powered()
@ -503,7 +503,7 @@ void backlight_thread(void)
static void backlight_tick(void) static void backlight_tick(void)
{ {
#ifdef CONFIG_CHARGING #if CONFIG_CHARGING
static bool charger_was_inserted = false; static bool charger_was_inserted = false;
bool charger_is_inserted = charger_inserted() bool charger_is_inserted = charger_inserted()
#ifdef HAVE_USB_POWER #ifdef HAVE_USB_POWER
@ -622,7 +622,7 @@ bool is_backlight_on(void)
/* return value in ticks; 0 means always on, <0 means always off */ /* return value in ticks; 0 means always on, <0 means always off */
int backlight_get_current_timeout(void) int backlight_get_current_timeout(void)
{ {
#ifdef CONFIG_CHARGING #if CONFIG_CHARGING
if (charger_inserted() if (charger_inserted()
#ifdef HAVE_USB_POWER #ifdef HAVE_USB_POWER
|| usb_powered() || usb_powered()
@ -645,7 +645,7 @@ void backlight_set_timeout(int index)
backlight_update_state(); backlight_update_state();
} }
#ifdef CONFIG_CHARGING #if CONFIG_CHARGING
void backlight_set_timeout_plugged(int index) void backlight_set_timeout_plugged(int index)
{ {
if((unsigned)index >= sizeof(backlight_timeout_value)) if((unsigned)index >= sizeof(backlight_timeout_value))
@ -724,7 +724,7 @@ void remote_backlight_set_timeout(int index)
remote_backlight_update_state(); remote_backlight_update_state();
} }
#ifdef CONFIG_CHARGING #if CONFIG_CHARGING
void remote_backlight_set_timeout_plugged(int index) void remote_backlight_set_timeout_plugged(int index)
{ {
if((unsigned)index >= sizeof(backlight_timeout_value)) if((unsigned)index >= sizeof(backlight_timeout_value))
@ -766,7 +766,7 @@ void remote_backlight_set_on_button_hold(int index)
/* return value in ticks; 0 means always on, <0 means always off */ /* return value in ticks; 0 means always on, <0 means always off */
int remote_backlight_get_current_timeout(void) int remote_backlight_get_current_timeout(void)
{ {
#ifdef CONFIG_CHARGING #if CONFIG_CHARGING
if (charger_inserted() if (charger_inserted()
#ifdef HAVE_USB_POWER #ifdef HAVE_USB_POWER
|| usb_powered() || usb_powered()

View file

@ -164,7 +164,7 @@ static void button_tick(void)
|| btn == RC_POWEROFF_BUTTON || btn == RC_POWEROFF_BUTTON
#endif #endif
) && ) &&
#if defined(CONFIG_CHARGING) && !defined(HAVE_POWEROFF_WHILE_CHARGING) #if CONFIG_CHARGING && !defined(HAVE_POWEROFF_WHILE_CHARGING)
!charger_inserted() && !charger_inserted() &&
#endif #endif
repeat_count > POWEROFF_COUNT) repeat_count > POWEROFF_COUNT)

View file

@ -83,7 +83,7 @@ void power_init(void)
} }
#ifdef CONFIG_CHARGING #if CONFIG_CHARGING
bool charger_inserted(void) bool charger_inserted(void)
{ {
#if CONFIG_CHARGING == CHARGING_CONTROL #if CONFIG_CHARGING == CHARGING_CONTROL

View file

@ -230,6 +230,10 @@
#define CONFIG_LED 0 #define CONFIG_LED 0
#endif #endif
#ifndef CONFIG_CHARGING
#define CONFIG_CHARGING 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

@ -24,7 +24,7 @@ extern bool charger_enabled;
void charger_enable(bool on); void charger_enable(bool on);
#endif #endif
#ifdef CONFIG_CHARGING #if CONFIG_CHARGING
bool charger_inserted(void); bool charger_inserted(void);
#endif #endif

View file

@ -266,7 +266,7 @@ static const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] =
#endif #endif
}; };
#ifdef CONFIG_CHARGING #if CONFIG_CHARGING
charger_input_state_type charger_input_state IDATA_ATTR; charger_input_state_type charger_input_state IDATA_ATTR;
@ -545,7 +545,7 @@ static void battery_status_update(void)
/ 100 / (CURRENT_MAX_CHG - runcurrent()); / 100 / (CURRENT_MAX_CHG - runcurrent());
} }
else else
#elif defined(CONFIG_CHARGING) && CONFIG_BATTERY == BATT_LIPOL1300 #elif CONFIG_CHARGING && CONFIG_BATTERY == BATT_LIPOL1300
if (charger_inserted()) { if (charger_inserted()) {
#ifdef IRIVER_H300_SERIES #ifdef IRIVER_H300_SERIES
/* H300_SERIES use CURRENT_MAX_CHG for basic charge time (80%) /* H300_SERIES use CURRENT_MAX_CHG for basic charge time (80%)
@ -612,7 +612,7 @@ static void handle_auto_poweroff(void)
long timeout = poweroff_idle_timeout_value[poweroff_timeout]*60*HZ; long timeout = poweroff_idle_timeout_value[poweroff_timeout]*60*HZ;
int audio_stat = audio_status(); int audio_stat = audio_status();
#ifdef CONFIG_CHARGING #if CONFIG_CHARGING
/* /*
* Inhibit shutdown as long as the charger is plugged in. If it is * Inhibit shutdown as long as the charger is plugged in. If it is
* unplugged, wait for a timeout period and then shut down. * unplugged, wait for a timeout period and then shut down.
@ -656,7 +656,7 @@ static void handle_auto_poweroff(void)
if(TIME_AFTER(current_tick, sleeptimer_endtick)) if(TIME_AFTER(current_tick, sleeptimer_endtick))
{ {
audio_stop(); audio_stop();
#if defined(CONFIG_CHARGING) && !defined(HAVE_POWEROFF_WHILE_CHARGING) #if CONFIG_CHARGING && !defined(HAVE_POWEROFF_WHILE_CHARGING)
if((charger_input_state == CHARGER) || if((charger_input_state == CHARGER) ||
(charger_input_state == CHARGER_PLUGGED)) (charger_input_state == CHARGER_PLUGGED))
{ {
@ -751,7 +751,7 @@ static void power_thread_sleep(int ticks)
while (ticks > 0) { while (ticks > 0) {
#ifdef CONFIG_CHARGING #if CONFIG_CHARGING
/* /*
* Detect charger plugged/unplugged transitions. On a plugged or * Detect charger plugged/unplugged transitions. On a plugged or
* unplugged event, we return immediately, run once through the main * unplugged event, we return immediately, run once through the main
@ -761,7 +761,7 @@ static void power_thread_sleep(int ticks)
if(charger_inserted() if(charger_inserted()
#ifdef HAVE_USB_POWER /* USB powered or USB inserted both provide power */ #ifdef HAVE_USB_POWER /* USB powered or USB inserted both provide power */
|| usb_powered() || usb_powered()
#ifdef CONFIG_CHARGING #if CONFIG_CHARGING
|| (usb_inserted() && usb_charging_enabled()) || (usb_inserted() && usb_charging_enabled())
#endif #endif
#endif #endif
@ -924,7 +924,7 @@ static void power_thread(void)
avgbat = avgbat * BATT_AVE_SAMPLES; avgbat = avgbat * BATT_AVE_SAMPLES;
battery_centivolts = avgbat / BATT_AVE_SAMPLES / 10000; battery_centivolts = avgbat / BATT_AVE_SAMPLES / 10000;
#ifdef CONFIG_CHARGING #if CONFIG_CHARGING
if(charger_inserted()) { if(charger_inserted()) {
battery_percent = voltage_to_percent(battery_centivolts, battery_percent = voltage_to_percent(battery_centivolts,
percent_to_volt_charge); percent_to_volt_charge);

View file

@ -61,7 +61,7 @@ void power_init(void)
} }
#ifdef CONFIG_CHARGING #if CONFIG_CHARGING
bool charger_inserted(void) bool charger_inserted(void)
{ {
return (GPIO1_READ & 0x00400000)?true:false; return (GPIO1_READ & 0x00400000)?true:false;

View file

@ -492,7 +492,7 @@ bool usb_powered(void)
return usb_state == USB_POWERED; return usb_state == USB_POWERED;
} }
#ifdef CONFIG_CHARGING #if CONFIG_CHARGING
bool usb_charging_enable(bool on) bool usb_charging_enable(bool on)
{ {
bool rc = false; bool rc = false;

View file

@ -65,7 +65,7 @@ int show_logo(void)
return 0; return 0;
} }
#ifdef CONFIG_CHARGING #if CONFIG_CHARGING
/* /*
bool backlight_get_on_when_charging(void) bool backlight_get_on_when_charging(void)
{ {
@ -167,7 +167,7 @@ void main(void)
button_init(); button_init();
powermgmt_init(); powermgmt_init();
#if defined(CONFIG_CHARGING) && (CONFIG_CPU == SH7034) #if CONFIG_CHARGING && (CONFIG_CPU == SH7034)
if (charger_inserted() if (charger_inserted()
#ifdef ATA_POWER_PLAYERSTYLE #ifdef ATA_POWER_PLAYERSTYLE
&& !ide_powered() /* relies on probing result from bootloader */ && !ide_powered() /* relies on probing result from bootloader */