summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHristo Kovachev <bger@rockbox.org>2006-01-25 18:29:56 +0000
committerHristo Kovachev <bger@rockbox.org>2006-01-25 18:29:56 +0000
commit495c63f867a35ac2e6aab92a530a46b3ef5143b1 (patch)
tree24c4188728a3e1c5196506eab29978f5e5c4ac49
parent4781f1461fd7d3f91bea4ff84ca20b5e58ff53e3 (diff)
downloadrockbox-495c63f867a35ac2e6aab92a530a46b3ef5143b1.zip
rockbox-495c63f867a35ac2e6aab92a530a46b3ef5143b1.tar.gz
rockbox-495c63f867a35ac2e6aab92a530a46b3ef5143b1.tar.bz2
rockbox-495c63f867a35ac2e6aab92a530a46b3ef5143b1.tar.xz
New "battery benchmark" plugin by Alexander Spyridakis, modified a bit by me
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8451 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/plugin.c12
-rw-r--r--apps/plugin.h15
-rw-r--r--apps/plugins/SOURCES1
-rw-r--r--firmware/export/powermgmt.h2
-rw-r--r--firmware/powermgmt.c5
5 files changed, 32 insertions, 3 deletions
diff --git a/apps/plugin.c b/apps/plugin.c
index b907604..8b47af7 100644
--- a/apps/plugin.c
+++ b/apps/plugin.c
@@ -28,6 +28,7 @@
#include "dir.h"
#include "file.h"
#include "kernel.h"
+#include "usb.h"
#include "sprintf.h"
#include "logf.h"
#include "screens.h"
@@ -369,7 +370,16 @@ static const struct plugin_api rockbox_api = {
profile_func_enter,
profile_func_exit,
#endif
-
+ battery_time,
+#ifndef SIMULATOR
+ ata_disk_is_active,
+ battery_voltage,
+#endif
+ queue_init,
+ queue_delete,
+ queue_post,
+ queue_wait_w_tmo,
+ usb_acknowledge,
};
int plugin_load(const char* plugin, void* parameter)
diff --git a/apps/plugin.h b/apps/plugin.h
index 157831b..747c9e0 100644
--- a/apps/plugin.h
+++ b/apps/plugin.h
@@ -37,6 +37,7 @@
#include "dir.h"
#include "kernel.h"
#include "button.h"
+#include "usb.h"
#include "font.h"
#include "system.h"
#include "lcd.h"
@@ -96,7 +97,7 @@
#define PLUGIN_MAGIC 0x526F634B /* RocK */
/* increase this every time the api struct changes */
-#define PLUGIN_API_VERSION 2
+#define PLUGIN_API_VERSION 3
/* update this to latest version if a change to the api struct breaks
backwards compatibility (and please take the opportunity to sort in any
@@ -427,13 +428,23 @@ struct plugin_api {
/* new stuff at the end, sort into place next time
the API gets incompatible */
+
#ifdef RB_PROFILE
void (*profile_thread)(void);
void (*profstop)(void);
void (*profile_func_enter)(void *this_fn, void *call_site);
void (*profile_func_exit)(void *this_fn, void *call_site);
#endif
-
+ int (*battery_time)(void);
+#ifndef SIMULATOR
+ bool (*ata_disk_is_active)(void);
+ unsigned int (*battery_voltage)(void);
+#endif
+ void (*queue_init)(struct event_queue *q);
+ void (*queue_delete)(struct event_queue *q);
+ void (*queue_post)(struct event_queue *q, long id, void *data);
+ void (*queue_wait_w_tmo)(struct event_queue *q, struct event *ev, int ticks);
+ void (*usb_acknowledge)(long id);
};
/* plugin header */
diff --git a/apps/plugins/SOURCES b/apps/plugins/SOURCES
index 0b9f68b..4da1d5e 100644
--- a/apps/plugins/SOURCES
+++ b/apps/plugins/SOURCES
@@ -1,4 +1,5 @@
/* plugins common to all models */
+battery_bench.c
battery_test.c
chessclock.c
credits.c
diff --git a/firmware/export/powermgmt.h b/firmware/export/powermgmt.h
index 377ce1a..a5dbcd1 100644
--- a/firmware/export/powermgmt.h
+++ b/firmware/export/powermgmt.h
@@ -144,6 +144,8 @@ void powermgmt_init(void);
int battery_level(void);
int battery_time(void); /* minutes */
+unsigned int battery_voltage(void); /* filtered batt. voltage in centivolts */
+
/* Tells if the battery level is safe for disk writes */
bool battery_level_safe(void);
diff --git a/firmware/powermgmt.c b/firmware/powermgmt.c
index 7bf2d58..a9aa839 100644
--- a/firmware/powermgmt.c
+++ b/firmware/powermgmt.c
@@ -218,6 +218,11 @@ static long last_event_tick;
static void battery_status_update(void);
static int runcurrent(void);
+unsigned int battery_voltage(void)
+{
+ return battery_centivolts;
+}
+
void reset_poweroff_timer(void)
{
last_event_tick = current_tick;