Slightly more correct initialization of the power/charging code
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3940 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
71316085de
commit
53ee344743
5 changed files with 15 additions and 4 deletions
|
@ -146,7 +146,7 @@ void init(void)
|
|||
|
||||
button_init();
|
||||
|
||||
power_init(); /* moved up from below mpeg_init, hope that's not harmful */
|
||||
powermgmt_init();
|
||||
|
||||
if (coldstart && charger_inserted())
|
||||
{
|
||||
|
|
|
@ -24,11 +24,19 @@
|
|||
#include "power.h"
|
||||
|
||||
#ifdef HAVE_CHARGE_CTRL
|
||||
bool charger_enabled = 0;
|
||||
bool charger_enabled;
|
||||
#endif
|
||||
|
||||
#ifndef SIMULATOR
|
||||
|
||||
void power_init(void)
|
||||
{
|
||||
#ifdef HAVE_CHARGE_CTRL
|
||||
PBIOR |= 0x20; /* Set charging control bit to output */
|
||||
charger_enable(false); /* Default to charger OFF */
|
||||
#endif
|
||||
}
|
||||
|
||||
bool charger_inserted(void)
|
||||
{
|
||||
#ifdef HAVE_CHARGE_CTRL
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
extern bool charger_enabled;
|
||||
#endif
|
||||
|
||||
void power_init(void);
|
||||
bool charger_inserted(void);
|
||||
void charger_enable(bool on);
|
||||
void ide_power_enable(bool on);
|
||||
|
|
|
@ -80,7 +80,7 @@ extern int charge_state; /* tells what the charger is doing (for info di
|
|||
extern unsigned short power_history[POWER_HISTORY_LEN];
|
||||
|
||||
/* Start up power management thread */
|
||||
void power_init(void);
|
||||
void powermgmt_init(void);
|
||||
|
||||
#endif /* SIMULATOR */
|
||||
|
||||
|
|
|
@ -685,8 +685,10 @@ static void power_thread(void)
|
|||
}
|
||||
}
|
||||
|
||||
void power_init(void)
|
||||
void powermgmt_init(void)
|
||||
{
|
||||
power_init();
|
||||
|
||||
/* init history to 0 */
|
||||
memset(power_history, 0x00, sizeof(power_history));
|
||||
/* initialize the history with a single sample to prevent level
|
||||
|
|
Loading…
Reference in a new issue