diff options
-rw-r--r-- | apps/plugin.c | 12 | ||||
-rw-r--r-- | apps/plugin.h | 15 | ||||
-rw-r--r-- | apps/plugins/SOURCES | 1 | ||||
-rw-r--r-- | firmware/export/powermgmt.h | 2 | ||||
-rw-r--r-- | firmware/powermgmt.c | 5 |
5 files changed, 32 insertions, 3 deletions
diff --git a/apps/plugin.c b/apps/plugin.c index b907604528..8b47af7e02 100644 --- a/apps/plugin.c +++ b/apps/plugin.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include "dir.h" | 28 | #include "dir.h" |
29 | #include "file.h" | 29 | #include "file.h" |
30 | #include "kernel.h" | 30 | #include "kernel.h" |
31 | #include "usb.h" | ||
31 | #include "sprintf.h" | 32 | #include "sprintf.h" |
32 | #include "logf.h" | 33 | #include "logf.h" |
33 | #include "screens.h" | 34 | #include "screens.h" |
@@ -369,7 +370,16 @@ static const struct plugin_api rockbox_api = { | |||
369 | profile_func_enter, | 370 | profile_func_enter, |
370 | profile_func_exit, | 371 | profile_func_exit, |
371 | #endif | 372 | #endif |
372 | 373 | battery_time, | |
374 | #ifndef SIMULATOR | ||
375 | ata_disk_is_active, | ||
376 | battery_voltage, | ||
377 | #endif | ||
378 | queue_init, | ||
379 | queue_delete, | ||
380 | queue_post, | ||
381 | queue_wait_w_tmo, | ||
382 | usb_acknowledge, | ||
373 | }; | 383 | }; |
374 | 384 | ||
375 | int plugin_load(const char* plugin, void* parameter) | 385 | int plugin_load(const char* plugin, void* parameter) |
diff --git a/apps/plugin.h b/apps/plugin.h index 157831bf19..747c9e099a 100644 --- a/apps/plugin.h +++ b/apps/plugin.h | |||
@@ -37,6 +37,7 @@ | |||
37 | #include "dir.h" | 37 | #include "dir.h" |
38 | #include "kernel.h" | 38 | #include "kernel.h" |
39 | #include "button.h" | 39 | #include "button.h" |
40 | #include "usb.h" | ||
40 | #include "font.h" | 41 | #include "font.h" |
41 | #include "system.h" | 42 | #include "system.h" |
42 | #include "lcd.h" | 43 | #include "lcd.h" |
@@ -96,7 +97,7 @@ | |||
96 | #define PLUGIN_MAGIC 0x526F634B /* RocK */ | 97 | #define PLUGIN_MAGIC 0x526F634B /* RocK */ |
97 | 98 | ||
98 | /* increase this every time the api struct changes */ | 99 | /* increase this every time the api struct changes */ |
99 | #define PLUGIN_API_VERSION 2 | 100 | #define PLUGIN_API_VERSION 3 |
100 | 101 | ||
101 | /* update this to latest version if a change to the api struct breaks | 102 | /* update this to latest version if a change to the api struct breaks |
102 | backwards compatibility (and please take the opportunity to sort in any | 103 | backwards compatibility (and please take the opportunity to sort in any |
@@ -427,13 +428,23 @@ struct plugin_api { | |||
427 | 428 | ||
428 | /* new stuff at the end, sort into place next time | 429 | /* new stuff at the end, sort into place next time |
429 | the API gets incompatible */ | 430 | the API gets incompatible */ |
431 | |||
430 | #ifdef RB_PROFILE | 432 | #ifdef RB_PROFILE |
431 | void (*profile_thread)(void); | 433 | void (*profile_thread)(void); |
432 | void (*profstop)(void); | 434 | void (*profstop)(void); |
433 | void (*profile_func_enter)(void *this_fn, void *call_site); | 435 | void (*profile_func_enter)(void *this_fn, void *call_site); |
434 | void (*profile_func_exit)(void *this_fn, void *call_site); | 436 | void (*profile_func_exit)(void *this_fn, void *call_site); |
435 | #endif | 437 | #endif |
436 | 438 | int (*battery_time)(void); | |
439 | #ifndef SIMULATOR | ||
440 | bool (*ata_disk_is_active)(void); | ||
441 | unsigned int (*battery_voltage)(void); | ||
442 | #endif | ||
443 | void (*queue_init)(struct event_queue *q); | ||
444 | void (*queue_delete)(struct event_queue *q); | ||
445 | void (*queue_post)(struct event_queue *q, long id, void *data); | ||
446 | void (*queue_wait_w_tmo)(struct event_queue *q, struct event *ev, int ticks); | ||
447 | void (*usb_acknowledge)(long id); | ||
437 | }; | 448 | }; |
438 | 449 | ||
439 | /* plugin header */ | 450 | /* plugin header */ |
diff --git a/apps/plugins/SOURCES b/apps/plugins/SOURCES index 0b9f68bc0b..4da1d5ee6f 100644 --- a/apps/plugins/SOURCES +++ b/apps/plugins/SOURCES | |||
@@ -1,4 +1,5 @@ | |||
1 | /* plugins common to all models */ | 1 | /* plugins common to all models */ |
2 | battery_bench.c | ||
2 | battery_test.c | 3 | battery_test.c |
3 | chessclock.c | 4 | chessclock.c |
4 | credits.c | 5 | credits.c |
diff --git a/firmware/export/powermgmt.h b/firmware/export/powermgmt.h index 377ce1ab71..a5dbcd10bd 100644 --- a/firmware/export/powermgmt.h +++ b/firmware/export/powermgmt.h | |||
@@ -144,6 +144,8 @@ void powermgmt_init(void); | |||
144 | int battery_level(void); | 144 | int battery_level(void); |
145 | int battery_time(void); /* minutes */ | 145 | int battery_time(void); /* minutes */ |
146 | 146 | ||
147 | unsigned int battery_voltage(void); /* filtered batt. voltage in centivolts */ | ||
148 | |||
147 | /* Tells if the battery level is safe for disk writes */ | 149 | /* Tells if the battery level is safe for disk writes */ |
148 | bool battery_level_safe(void); | 150 | bool battery_level_safe(void); |
149 | 151 | ||
diff --git a/firmware/powermgmt.c b/firmware/powermgmt.c index 7bf2d58284..a9aa83979e 100644 --- a/firmware/powermgmt.c +++ b/firmware/powermgmt.c | |||
@@ -218,6 +218,11 @@ static long last_event_tick; | |||
218 | static void battery_status_update(void); | 218 | static void battery_status_update(void); |
219 | static int runcurrent(void); | 219 | static int runcurrent(void); |
220 | 220 | ||
221 | unsigned int battery_voltage(void) | ||
222 | { | ||
223 | return battery_centivolts; | ||
224 | } | ||
225 | |||
221 | void reset_poweroff_timer(void) | 226 | void reset_poweroff_timer(void) |
222 | { | 227 | { |
223 | last_event_tick = current_tick; | 228 | last_event_tick = current_tick; |