diff options
Diffstat (limited to 'firmware/export')
-rw-r--r-- | firmware/export/config-h300.h | 3 | ||||
-rw-r--r-- | firmware/export/power.h | 1 | ||||
-rw-r--r-- | firmware/export/powermgmt.h | 30 |
3 files changed, 31 insertions, 3 deletions
diff --git a/firmware/export/config-h300.h b/firmware/export/config-h300.h index 806ae0a079..ded20c9129 100644 --- a/firmware/export/config-h300.h +++ b/firmware/export/config-h300.h | |||
@@ -72,6 +72,9 @@ | |||
72 | /* Define this if the platform can charge batteries */ | 72 | /* Define this if the platform can charge batteries */ |
73 | #define HAVE_CHARGING 1 | 73 | #define HAVE_CHARGING 1 |
74 | 74 | ||
75 | /* For units with a hardware charger that reports charge state */ | ||
76 | #define HAVE_CHARGE_STATE 1 | ||
77 | |||
75 | /* define this if the hardware can be powered off while charging */ | 78 | /* define this if the hardware can be powered off while charging */ |
76 | #define HAVE_POWEROFF_WHILE_CHARGING | 79 | #define HAVE_POWEROFF_WHILE_CHARGING |
77 | 80 | ||
diff --git a/firmware/export/power.h b/firmware/export/power.h index bf645522ef..9f91e25f15 100644 --- a/firmware/export/power.h +++ b/firmware/export/power.h | |||
@@ -25,6 +25,7 @@ extern bool charger_enabled; | |||
25 | 25 | ||
26 | void power_init(void); | 26 | void power_init(void); |
27 | bool charger_inserted(void); | 27 | bool charger_inserted(void); |
28 | bool charging_state(void); | ||
28 | void charger_enable(bool on); | 29 | void charger_enable(bool on); |
29 | void ide_power_enable(bool on); | 30 | void ide_power_enable(bool on); |
30 | bool ide_powered(void); | 31 | bool ide_powered(void); |
diff --git a/firmware/export/powermgmt.h b/firmware/export/powermgmt.h index 3c4a61fb87..25c18eabad 100644 --- a/firmware/export/powermgmt.h +++ b/firmware/export/powermgmt.h | |||
@@ -79,18 +79,38 @@ extern int trickle_sec; /* trickle charge: How many seconds per minute | |||
79 | 79 | ||
80 | #endif /* HAVE_CHARGE_CTRL */ | 80 | #endif /* HAVE_CHARGE_CTRL */ |
81 | 81 | ||
82 | #if defined(HAVE_CHARGE_CTRL) || (CONFIG_BATTERY == BATT_LIION2200) | 82 | #if defined(HAVE_CHARGE_CTRL) || \ |
83 | (CONFIG_BATTERY == BATT_LIION2200) || \ | ||
84 | defined(HAVE_CHARGE_STATE) | ||
83 | typedef enum { | 85 | typedef enum { |
84 | DISCHARGING, | 86 | DISCHARGING, |
85 | CHARGING, | 87 | CHARGING, |
88 | #ifdef HAVE_CHARGE_CTRL | ||
86 | TOPOFF, | 89 | TOPOFF, |
87 | TRICKLE | 90 | TRICKLE |
91 | #endif | ||
88 | } charge_state_type; | 92 | } charge_state_type; |
89 | 93 | ||
90 | /* tells what the charger is doing */ | 94 | /* tells what the charger is doing */ |
91 | extern charge_state_type charge_state; | 95 | extern charge_state_type charge_state; |
92 | #endif /* defined(HAVE_CHARGE_CTRL) || (CONFIG_BATTERY == BATT_LIION2200) */ | 96 | #endif /* defined(HAVE_CHARGE_CTRL) || (CONFIG_BATTERY == BATT_LIION2200) */ |
93 | 97 | ||
98 | #ifdef HAVE_CHARGING | ||
99 | /* | ||
100 | * Flag that the charger has been plugged in/removed: this is set for exactly | ||
101 | * one time through the power loop when the charger has been plugged in. | ||
102 | */ | ||
103 | typedef enum { | ||
104 | NO_CHARGER, | ||
105 | CHARGER_UNPLUGGED, /* transient state */ | ||
106 | CHARGER_PLUGGED, /* transient state */ | ||
107 | CHARGER | ||
108 | } charger_input_state_type; | ||
109 | |||
110 | /* tells the state of the charge input */ | ||
111 | extern charger_input_state_type charger_input_state; | ||
112 | #endif | ||
113 | |||
94 | #ifdef HAVE_MMC /* Values for Ondio */ | 114 | #ifdef HAVE_MMC /* Values for Ondio */ |
95 | # define CURRENT_NORMAL 95 /* average, nearly proportional to 1/U */ | 115 | # define CURRENT_NORMAL 95 /* average, nearly proportional to 1/U */ |
96 | # define CURRENT_USB 1 /* host powered in USB mode; avoid zero-div */ | 116 | # define CURRENT_USB 1 /* host powered in USB mode; avoid zero-div */ |
@@ -106,9 +126,13 @@ extern charge_state_type charge_state; | |||
106 | 126 | ||
107 | # define CURRENT_MIN_CHG 70 /* minimum charge current */ | 127 | # define CURRENT_MIN_CHG 70 /* minimum charge current */ |
108 | # define MIN_CHG_V 8500 /* at 8.5v charger voltage get CURRENT_MIN_CHG */ | 128 | # define MIN_CHG_V 8500 /* at 8.5v charger voltage get CURRENT_MIN_CHG */ |
109 | # define CURRENT_MAX_CHG 350 /* maximum charging current */ | 129 | # ifdef IRIVER_H300_SERIES |
130 | # define CURRENT_MAX_CHG 650 /* maximum charging current */ | ||
131 | # else | ||
132 | # define CURRENT_MAX_CHG 350 /* maximum charging current */ | ||
133 | # endif | ||
110 | # define MAX_CHG_V 10250 /* anything over 10.25v gives CURRENT_MAX_CHG */ | 134 | # define MAX_CHG_V 10250 /* anything over 10.25v gives CURRENT_MAX_CHG */ |
111 | #endif /* HAVE_MMC */ | 135 | #endif /* not HAVE_MMC */ |
112 | 136 | ||
113 | extern unsigned int bat; /* filtered battery voltage, centivolts */ | 137 | extern unsigned int bat; /* filtered battery voltage, centivolts */ |
114 | extern unsigned short power_history[POWER_HISTORY_LEN]; | 138 | extern unsigned short power_history[POWER_HISTORY_LEN]; |