Coldfire strlen, slight optimization pointed out by amiconn, eliminate some unconditi...
[kugel-rb.git] / firmware / target / arm / as3525 / powermgmt-target.h
blob50736b1e56b23784fcfda46caac8fa5b2753fd05
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2009 by Michael Sevakis
11 * Copyright (C) 2008 by Bertrik Sikken
13 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License
15 * as published by the Free Software Foundation; either version 2
16 * of the License, or (at your option) any later version.
18 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19 * KIND, either express or implied.
21 ****************************************************************************/
22 #ifndef POWERMGMT_TARGET_H
23 #define POWERMGMT_TARGET_H
25 #include "config.h"
27 #if defined(SANSA_CLIP) \
28 || defined(SANSA_CLIPV2) /* FIXME */ \
29 || defined(SANSA_CLIPPLUS) /* FIXME */
31 /* Check if topped-off and monitor voltage while plugged. */
32 #define BATT_FULL_VOLTAGE 4160
33 #define BATT_VAUTO_RECHARGE 4100
34 #define BATT_CHG_V CHG_V_4_20V
35 #define BATT_CHG_I CHG_I_100MA
36 #define CHARGER_TOTAL_TIMER (6*3600*2) /* about 1.5 * capacity / current */
38 #elif defined(SANSA_E200V2)
40 /* Check if topped-off and monitor voltage while plugged. */
41 #define BATT_FULL_VOLTAGE 4160
42 #define BATT_VAUTO_RECHARGE 4100
43 #define BATT_CHG_V CHG_V_4_20V
44 #define BATT_CHG_I CHG_I_300MA
45 #define CHARGER_TOTAL_TIMER (4*3600*2)
47 #elif defined(SANSA_FUZE) || defined(SANSA_FUZEV2) /* FIXME */
49 /* Check if topped-off and monitor voltage while plugged. */
50 #define BATT_FULL_VOLTAGE 4160
51 #define BATT_VAUTO_RECHARGE 4100
52 #define BATT_CHG_V CHG_V_4_20V
53 #define BATT_CHG_I CHG_I_200MA
54 #define CHARGER_TOTAL_TIMER (4*3600*2)
56 #elif defined(SANSA_C200V2)
58 /* Check if topped-off and monitor voltage while plugged. */
59 #define BATT_FULL_VOLTAGE 4160
60 #define BATT_VAUTO_RECHARGE 4100
61 #define BATT_CHG_V CHG_V_4_20V
62 #define BATT_CHG_I CHG_I_200MA
63 #define CHARGER_TOTAL_TIMER (4*3600*2)
65 #else
66 #error "Charger settings not defined!"
67 #endif
69 void powermgmt_init_target(void);
70 void charging_algorithm_step(void);
71 void charging_algorithm_close(void);
73 /* We want to be able to reset the averaging filter */
74 #define HAVE_RESET_BATTERY_FILTER
76 #define BATT_AVE_SAMPLES 32
78 #if CONFIG_CPU == AS3525
79 #define ADC_BATTERY ADC_BVDD
80 #else /* AS3525v2 */
81 /* ADC_CHG_IN seems to represent battery voltage better than ADC_BVDD during
82 * charging (ADC_BVDD is way too high) and appears the same in normal use.
83 * Note that when charging some models do not give an accurate reading but jump
84 * between 2 values. */
85 #define ADC_BATTERY ADC_CHG_IN
86 #endif /* CONFIG_CPU */
88 #endif /* POWERMGMT_TARGET_H */