summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
Diffstat (limited to 'firmware')
-rw-r--r--firmware/export/config-fmrecorder.h8
-rw-r--r--firmware/export/config-h100.h5
-rw-r--r--firmware/export/config-ondiofm.h3
-rw-r--r--firmware/export/config-ondiosp.h3
-rw-r--r--firmware/export/config-player.h5
-rw-r--r--firmware/export/config-recorder.h5
-rw-r--r--firmware/export/config-recorderv2.h8
-rw-r--r--firmware/export/config.h5
-rw-r--r--firmware/export/powermgmt.h4
-rw-r--r--firmware/powermgmt.c10
10 files changed, 38 insertions, 18 deletions
diff --git a/firmware/export/config-fmrecorder.h b/firmware/export/config-fmrecorder.h
index af7ca91315..8d3f1a1051 100644
--- a/firmware/export/config-fmrecorder.h
+++ b/firmware/export/config-fmrecorder.h
@@ -25,9 +25,6 @@
25/* Define this if you have a FM Recorder key system */ 25/* Define this if you have a FM Recorder key system */
26#define HAVE_FMADC 1 26#define HAVE_FMADC 1
27 27
28/* Define this if you have a LiIon battery */
29#define HAVE_LIION
30
31/* Define this if you need to power on ATA */ 28/* Define this if you need to power on ATA */
32#define NEEDS_ATA_POWER_ON 29#define NEEDS_ATA_POWER_ON
33 30
@@ -37,6 +34,9 @@
37/* Define this to the CPU frequency */ 34/* Define this to the CPU frequency */
38#define CPU_FREQ 11059200 35#define CPU_FREQ 11059200
39 36
37/* Type of mobile power */
38#define CONFIG_BATTERY BATT_LIION2200
39
40/* Battery scale factor (guessed, seems to be 1,25 * value from recorder) */ 40/* Battery scale factor (guessed, seems to be 1,25 * value from recorder) */
41#define BATTERY_SCALE_FACTOR 8081 41#define BATTERY_SCALE_FACTOR 8081
42 42
@@ -61,7 +61,7 @@
61/* How to detect USB */ 61/* How to detect USB */
62#define USB_FMRECORDERSTYLE 1 62#define USB_FMRECORDERSTYLE 1
63 63
64/* Define this if the platform has batteries */ 64/* Define this if the platform can charge batteries */
65#define HAVE_BATTERIES 1 65#define HAVE_BATTERIES 1
66 66
67/* The start address index for ROM builds */ 67/* The start address index for ROM builds */
diff --git a/firmware/export/config-h100.h b/firmware/export/config-h100.h
index 343fc89b42..a3e982a062 100644
--- a/firmware/export/config-h100.h
+++ b/firmware/export/config-h100.h
@@ -16,7 +16,10 @@
16/* Define this if you have a Motorola SCF5249 */ 16/* Define this if you have a Motorola SCF5249 */
17#define CONFIG_CPU MCF5249 17#define CONFIG_CPU MCF5249
18 18
19/* Define this if the platform has batteries */ 19/* Type of mobile power, FIXME: probably different, make new type */
20#define CONFIG_BATTERY BATT_LIION2200
21
22/* Define this if the platform can charge batteries */
20#define HAVE_BATTERIES 1 23#define HAVE_BATTERIES 1
21 24
22/* The start address index for ROM builds */ 25/* The start address index for ROM builds */
diff --git a/firmware/export/config-ondiofm.h b/firmware/export/config-ondiofm.h
index f7d9a8f33f..f7cff94f5e 100644
--- a/firmware/export/config-ondiofm.h
+++ b/firmware/export/config-ondiofm.h
@@ -22,6 +22,9 @@
22/* Define this to the CPU frequency */ 22/* Define this to the CPU frequency */
23#define CPU_FREQ 12000000 23#define CPU_FREQ 12000000
24 24
25/* Type of mobile power */
26#define CONFIG_BATTERY BATT_3AAA_ALKALINE
27
25/* Battery scale factor (measured from Jörg's FM) */ 28/* Battery scale factor (measured from Jörg's FM) */
26#define BATTERY_SCALE_FACTOR 4785 /* 4.890V read as 0x3FE */ 29#define BATTERY_SCALE_FACTOR 4785 /* 4.890V read as 0x3FE */
27 30
diff --git a/firmware/export/config-ondiosp.h b/firmware/export/config-ondiosp.h
index b4c9f0d572..111787ffc9 100644
--- a/firmware/export/config-ondiosp.h
+++ b/firmware/export/config-ondiosp.h
@@ -19,6 +19,9 @@
19/* Define this to the CPU frequency */ 19/* Define this to the CPU frequency */
20#define CPU_FREQ 12000000 20#define CPU_FREQ 12000000
21 21
22/* Type of mobile power */
23#define CONFIG_BATTERY BATT_3AAA_ALKALINE
24
22/* Battery scale factor (measured from Jörg's FM) */ 25/* Battery scale factor (measured from Jörg's FM) */
23#define BATTERY_SCALE_FACTOR 4785 /* 4.890V read as 0x3FE */ 26#define BATTERY_SCALE_FACTOR 4785 /* 4.890V read as 0x3FE */
24 27
diff --git a/firmware/export/config-player.h b/firmware/export/config-player.h
index 8bd63c42e6..d457ef40fd 100644
--- a/firmware/export/config-player.h
+++ b/firmware/export/config-player.h
@@ -22,6 +22,9 @@
22/* Define this to the CPU frequency */ 22/* Define this to the CPU frequency */
23#define CPU_FREQ 12000000 /* cycle time ~83.3ns */ 23#define CPU_FREQ 12000000 /* cycle time ~83.3ns */
24 24
25/* Type of mobile power */
26#define CONFIG_BATTERY BATT_4AA_NIMH
27
25/* Battery scale factor (?) */ 28/* Battery scale factor (?) */
26#define BATTERY_SCALE_FACTOR 6546 29#define BATTERY_SCALE_FACTOR 6546
27 30
@@ -44,7 +47,7 @@
44/* How to detect USB */ 47/* How to detect USB */
45#define USB_PLAYERSTYLE 1 48#define USB_PLAYERSTYLE 1
46 49
47/* Define this if the platform has batteries */ 50/* Define this if the platform can charge batteries */
48#define HAVE_BATTERIES 1 51#define HAVE_BATTERIES 1
49 52
50/* Define this for programmable LED available */ 53/* Define this for programmable LED available */
diff --git a/firmware/export/config-recorder.h b/firmware/export/config-recorder.h
index 89e19f32f6..1e90a05248 100644
--- a/firmware/export/config-recorder.h
+++ b/firmware/export/config-recorder.h
@@ -34,6 +34,9 @@
34/* Define this to the CPU frequency */ 34/* Define this to the CPU frequency */
35#define CPU_FREQ 11059200 35#define CPU_FREQ 11059200
36 36
37/* Type of mobile power */
38#define CONFIG_BATTERY BATT_4AA_NIMH
39
37/* Battery scale factor (?) */ 40/* Battery scale factor (?) */
38#define BATTERY_SCALE_FACTOR 6465 41#define BATTERY_SCALE_FACTOR 6465
39 42
@@ -52,7 +55,7 @@
52/* How to detect USB */ 55/* How to detect USB */
53#define USB_RECORDERSTYLE 1 56#define USB_RECORDERSTYLE 1
54 57
55/* Define this if the platform has batteries */ 58/* Define this if the platform can charge batteries */
56#define HAVE_BATTERIES 1 59#define HAVE_BATTERIES 1
57 60
58/* The start address index for ROM builds */ 61/* The start address index for ROM builds */
diff --git a/firmware/export/config-recorderv2.h b/firmware/export/config-recorderv2.h
index 56967cfa10..b676a180ed 100644
--- a/firmware/export/config-recorderv2.h
+++ b/firmware/export/config-recorderv2.h
@@ -25,9 +25,6 @@
25/* Define this if you have a FM Recorder key system */ 25/* Define this if you have a FM Recorder key system */
26#define HAVE_FMADC 1 26#define HAVE_FMADC 1
27 27
28/* Define this if you have a LiIon battery */
29#define HAVE_LIION
30
31/* Define this if you need to power on ATA */ 28/* Define this if you need to power on ATA */
32#define NEEDS_ATA_POWER_ON 29#define NEEDS_ATA_POWER_ON
33 30
@@ -37,6 +34,9 @@
37/* Define this to the CPU frequency */ 34/* Define this to the CPU frequency */
38#define CPU_FREQ 11059200 35#define CPU_FREQ 11059200
39 36
37/* Type of mobile power */
38#define CONFIG_BATTERY BATT_LIION2200
39
40/* Battery scale factor (guessed, seems to be 1,25 * value from recorder) */ 40/* Battery scale factor (guessed, seems to be 1,25 * value from recorder) */
41#define BATTERY_SCALE_FACTOR 8081 41#define BATTERY_SCALE_FACTOR 8081
42 42
@@ -61,7 +61,7 @@
61/* How to detect USB */ 61/* How to detect USB */
62#define USB_FMRECORDERSTYLE 1 62#define USB_FMRECORDERSTYLE 1
63 63
64/* Define this if the platform has batteries */ 64/* Define this if the platform can charge batteries */
65#define HAVE_BATTERIES 1 65#define HAVE_BATTERIES 1
66 66
67/* The start address index for ROM builds */ 67/* The start address index for ROM builds */
diff --git a/firmware/export/config.h b/firmware/export/config.h
index fd757b1ab1..76a2bd9316 100644
--- a/firmware/export/config.h
+++ b/firmware/export/config.h
@@ -40,6 +40,11 @@
40#define RECORDER_PAD 1 40#define RECORDER_PAD 1
41#define ONDIO_PAD 2 41#define ONDIO_PAD 2
42 42
43/* CONFIG_BATTERY */
44#define BATT_LIION2200 2200 /* FM/V2 recorder type */
45#define BATT_4AA_NIMH 1500
46#define BATT_3AAA_ALKALINE 1000
47
43/* now go and pick yours */ 48/* now go and pick yours */
44#if defined(ARCHOS_PLAYER) 49#if defined(ARCHOS_PLAYER)
45#include "config-player.h" 50#include "config-player.h"
diff --git a/firmware/export/powermgmt.h b/firmware/export/powermgmt.h
index eb0ba29f28..1a54006a7d 100644
--- a/firmware/export/powermgmt.h
+++ b/firmware/export/powermgmt.h
@@ -19,7 +19,7 @@
19#ifndef _POWERMGMT_H_ 19#ifndef _POWERMGMT_H_
20#define _POWERMGMT_H_ 20#define _POWERMGMT_H_
21 21
22#ifdef HAVE_LIION /* FM Recorder, LiIon */ 22#if CONFIG_BATTERY == BATT_LIION2200 /* FM Recorder, LiIon */
23#define BATTERY_LEVEL_SHUTDOWN 260 /* 2.60V */ 23#define BATTERY_LEVEL_SHUTDOWN 260 /* 2.60V */
24#define BATTERY_LEVEL_EMPTY 265 /* 2.65V */ 24#define BATTERY_LEVEL_EMPTY 265 /* 2.65V */
25#define BATTERY_LEVEL_DANGEROUS 280 /* 2.80V */ 25#define BATTERY_LEVEL_DANGEROUS 280 /* 2.80V */
@@ -71,7 +71,7 @@ extern int trickle_sec; /* trickle charge: How many seconds per minute
71 71
72#endif /* HAVE_CHARGE_CTRL */ 72#endif /* HAVE_CHARGE_CTRL */
73 73
74#if defined(HAVE_CHARGE_CTRL) || defined(HAVE_LIION) 74#if defined(HAVE_CHARGE_CTRL) || CONFIG_BATTERY == BATT_LIION2200
75extern int charge_state; /* tells what the charger is doing (for info display): 0: decharging/charger off, 1: charge, 2: top-off, 3: trickle */ 75extern int charge_state; /* tells what the charger is doing (for info display): 0: decharging/charger off, 1: charge, 2: top-off, 3: trickle */
76#endif 76#endif
77 77
diff --git a/firmware/powermgmt.c b/firmware/powermgmt.c
index 155d11e609..e7486635d0 100644
--- a/firmware/powermgmt.c
+++ b/firmware/powermgmt.c
@@ -92,7 +92,7 @@ static const int poweroff_idle_timeout_value[15] =
92static const int percent_to_volt_decharge[11] = 92static const int percent_to_volt_decharge[11] =
93/* voltages (centivolt) of 0%, 10%, ... 100% when charging disabled */ 93/* voltages (centivolt) of 0%, 10%, ... 100% when charging disabled */
94{ 94{
95#ifdef HAVE_LIION 95#if CONFIG_BATTERY == BATT_LIION2200
96 /* measured values */ 96 /* measured values */
97 260, 285, 295, 303, 311, 320, 330, 345, 360, 380, 400 97 260, 285, 295, 303, 311, 320, 330, 345, 360, 380, 400
98#else /* NiMH */ 98#else /* NiMH */
@@ -112,7 +112,7 @@ void set_battery_capacity(int capacity)
112 battery_capacity = 1500; 112 battery_capacity = 1500;
113} 113}
114 114
115#if defined(HAVE_CHARGE_CTRL) || defined(HAVE_LIION) 115#if defined(HAVE_CHARGE_CTRL) || CONFIG_BATTERY == BATT_LIION2200
116int charge_state = 0; /* at the beginning, the 116int charge_state = 0; /* at the beginning, the
117 charger does nothing */ 117 charger does nothing */
118#endif 118#endif
@@ -443,7 +443,7 @@ static void power_thread(void)
443 int i; 443 int i;
444 int avg, ok_samples, spin_samples; 444 int avg, ok_samples, spin_samples;
445 int current = 0; 445 int current = 0;
446#ifdef HAVE_LIION 446#if CONFIG_BATTERY == BATT_LIION2200
447 int charging_current; 447 int charging_current;
448#endif 448#endif
449#ifdef HAVE_CHARGE_CTRL 449#ifdef HAVE_CHARGE_CTRL
@@ -535,7 +535,7 @@ static void power_thread(void)
535#endif /* MEM == 8 */ 535#endif /* MEM == 8 */
536#endif /* HAVE_CHARGE_CONTROL */ 536#endif /* HAVE_CHARGE_CONTROL */
537 537
538#ifdef HAVE_LIION 538#if CONFIG_BATTERY == BATT_LIION2200
539 /* We use the information from the ADC_EXT_POWER ADC channel, which 539 /* We use the information from the ADC_EXT_POWER ADC channel, which
540 tells us the charging current from the LTC1734. When DC is 540 tells us the charging current from the LTC1734. When DC is
541 connected (either via the external adapter, or via USB), we try 541 connected (either via the external adapter, or via USB), we try
@@ -790,7 +790,7 @@ static void power_thread(void)
790 powermgmt_last_cycle_startstop_min++; 790 powermgmt_last_cycle_startstop_min++;
791 791
792#endif /* HAVE_CHARGE_CTRL*/ 792#endif /* HAVE_CHARGE_CTRL*/
793#endif /* HAVE_LIION */ 793#endif /* # if CONFIG_BATTERY == BATT_LIION2200 */
794 794
795 /* sleep for roughly a minute */ 795 /* sleep for roughly a minute */
796#ifdef HAVE_CHARGE_CTRL 796#ifdef HAVE_CHARGE_CTRL