summaryrefslogtreecommitdiff
path: root/firmware/export
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2009-01-11 10:07:22 +0000
committerMichael Sevakis <jethead71@rockbox.org>2009-01-11 10:07:22 +0000
commit7d7969114da36a99afc4d80576ff9b089cb09e50 (patch)
tree48c3c574e382d80454c28a6b77de64a64f3cedcd /firmware/export
parentb84fe020a5bc497cee9b88eb782c2d4a9b7be711 (diff)
downloadrockbox-7d7969114da36a99afc4d80576ff9b089cb09e50.tar.gz
rockbox-7d7969114da36a99afc4d80576ff9b089cb09e50.zip
c200v1/e200v1: Add battery charging. This should be usable on v2 players but those should be evaluated for current, endpoint voltage and whether or not accurate battery readings may always be obtained (which determines algorithm setup and behavior).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19748 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/export')
-rw-r--r--firmware/export/as3514.h33
-rw-r--r--firmware/export/config-c200.h5
-rw-r--r--firmware/export/config-e200.h5
-rw-r--r--firmware/export/powermgmt.h7
4 files changed, 42 insertions, 8 deletions
diff --git a/firmware/export/as3514.h b/firmware/export/as3514.h
index 07aa0ebfe2..9489d1ae0d 100644
--- a/firmware/export/as3514.h
+++ b/firmware/export/as3514.h
@@ -249,8 +249,37 @@ extern void audiohw_set_frequency(int fsel);
249#define ADC_I_MICSUP2 11 /* Current of MicSup2 for remote control detection */ 249#define ADC_I_MICSUP2 11 /* Current of MicSup2 for remote control detection */
250#define ADC_VBAT 12 /* Single cell battery voltage */ 250#define ADC_VBAT 12 /* Single cell battery voltage */
251 251
252#define ADC_UNREG_POWER ADC_BVDD /* For compatibility */ 252/* AS3514_CHARGER */
253 253#define TMPSUP_OFF (0x1 << 7)
254#define CHG_I (0x7 << 4)
255#define CHG_I_400MA (0x7 << 4)
256#define CHG_I_350MA (0x6 << 4)
257#define CHG_I_300MA (0x5 << 4)
258#define CHG_I_250MA (0x4 << 4)
259#define CHG_I_200MA (0x3 << 4)
260#define CHG_I_150MA (0x2 << 4)
261#define CHG_I_100MA (0x1 << 4)
262#define CHG_I_50MA (0x0 << 4)
263#define CHG_V (0x7 << 1)
264#define CHG_V_4_25V (0x7 << 1)
265#define CHG_V_4_20V (0x6 << 1)
266#define CHG_V_4_15V (0x5 << 1)
267#define CHG_V_4_10V (0x4 << 1)
268#define CHG_V_4_05V (0x3 << 1)
269#define CHG_V_4_00V (0x2 << 1)
270#define CHG_V_3_95V (0x1 << 1)
271#define CHG_V_3_90V (0x0 << 1)
272#define CHG_OFF (0x1 << 0)
273
274/* AS3514_IRQ_ENRD0 */
275#define CHG_TMPHIGH (0x1 << 7)
276#define CHG_ENDOFCH (0x1 << 6)
277#define CHG_STATUS (0x1 << 5)
278#define CHG_CHANGED (0x1 << 4)
279#define USB_STATUS (0x1 << 3)
280#define USB_CHANGED (0x1 << 2)
281#define RVDD_WASLOW (0x1 << 1)
282#define BVDD_ISLOW (0x1 << 0)
254 283
255#define AS3514_I2C_ADDR 0x46 284#define AS3514_I2C_ADDR 0x46
256 285
diff --git a/firmware/export/config-c200.h b/firmware/export/config-c200.h
index f4ab33fb56..d68d21455f 100644
--- a/firmware/export/config-c200.h
+++ b/firmware/export/config-c200.h
@@ -123,8 +123,9 @@
123#define BATTERY_CAPACITY_INC 0 /* capacity increment */ 123#define BATTERY_CAPACITY_INC 0 /* capacity increment */
124#define BATTERY_TYPES_COUNT 1 /* only one type */ 124#define BATTERY_TYPES_COUNT 1 /* only one type */
125 125
126/* Hardware controlled charging? FIXME */ 126/* Charging implemented in a target-specific algorithm */
127#define CONFIG_CHARGING CHARGING_SIMPLE 127#define CONFIG_CHARGING CHARGING_TARGET
128#define HAVE_POWEROFF_WHILE_CHARGING
128 129
129/* define this if the unit can be powered or charged via USB */ 130/* define this if the unit can be powered or charged via USB */
130#define HAVE_USB_POWER 131#define HAVE_USB_POWER
diff --git a/firmware/export/config-e200.h b/firmware/export/config-e200.h
index 602a84707c..2be64d95cc 100644
--- a/firmware/export/config-e200.h
+++ b/firmware/export/config-e200.h
@@ -120,8 +120,9 @@
120#define BATTERY_CAPACITY_INC 0 /* capacity increment */ 120#define BATTERY_CAPACITY_INC 0 /* capacity increment */
121#define BATTERY_TYPES_COUNT 1 /* only one type */ 121#define BATTERY_TYPES_COUNT 1 /* only one type */
122 122
123/* Hardware controlled charging? FIXME */ 123/* Charging implemented in a target-specific algorithm */
124#define CONFIG_CHARGING CHARGING_SIMPLE 124#define CONFIG_CHARGING CHARGING_TARGET
125#define HAVE_POWEROFF_WHILE_CHARGING
125 126
126/* define current usage levels */ 127/* define current usage levels */
127#define CURRENT_NORMAL 30 /* Toni's measurements in Nov 2008 */ 128#define CURRENT_NORMAL 30 /* Toni's measurements in Nov 2008 */
diff --git a/firmware/export/powermgmt.h b/firmware/export/powermgmt.h
index 5be3a39c1d..39e2e6eab9 100644
--- a/firmware/export/powermgmt.h
+++ b/firmware/export/powermgmt.h
@@ -27,7 +27,7 @@
27 27
28enum charge_state_type 28enum charge_state_type
29{ 29{
30 /* sorted by increasing charging current */ 30 /* sorted by increasing charging current (do not change!) */
31#if CONFIG_CHARGING >= CHARGING_MONITOR 31#if CONFIG_CHARGING >= CHARGING_MONITOR
32 CHARGE_STATE_DISABLED = -2, /* Disable charger use (safety measure) */ 32 CHARGE_STATE_DISABLED = -2, /* Disable charger use (safety measure) */
33 CHARGE_STATE_ERROR = -1, /* Some error occurred that should not allow 33 CHARGE_STATE_ERROR = -1, /* Some error occurred that should not allow
@@ -143,13 +143,16 @@ unsigned int battery_voltage(void); /* filtered batt. voltage in millivolts */
143 143
144#ifdef HAVE_BATTERY_SWITCH 144#ifdef HAVE_BATTERY_SWITCH
145unsigned int input_millivolts(void); /* voltage that device is running from */ 145unsigned int input_millivolts(void); /* voltage that device is running from */
146#endif /* HAVE_BATTERY_SWITCH */
146 147
148#if defined(HAVE_BATTERY_SWITCH) || defined(HAVE_RESET_BATTERY_FILTER)
147/* Set the filtered battery voltage (to adjust it before beginning a charge 149/* Set the filtered battery voltage (to adjust it before beginning a charge
148 * cycle for instance where old, loaded readings will likely be invalid). 150 * cycle for instance where old, loaded readings will likely be invalid).
149 * Also readjust when battery switch is opened or closed. 151 * Also readjust when battery switch is opened or closed.
150 */ 152 */
151void reset_battery_filter(int millivolts); 153void reset_battery_filter(int millivolts);
152#endif /* HAVE_BATTERY_SWITCH */ 154#endif /* HAVE_BATTERY_SWITCH || HAVE_RESET_BATTERY_FILTER */
155
153 156
154/* read unfiltered battery info */ 157/* read unfiltered battery info */
155void battery_read_info(int *voltage, int *level); 158void battery_read_info(int *voltage, int *level);