summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/plugins/battery_bench.c25
1 files changed, 4 insertions, 21 deletions
diff --git a/apps/plugins/battery_bench.c b/apps/plugins/battery_bench.c
index 6c477cbd09..53931d1930 100644
--- a/apps/plugins/battery_bench.c
+++ b/apps/plugins/battery_bench.c
@@ -30,7 +30,7 @@
30#define EV_EXIT 1337 30#define EV_EXIT 1337
31 31
32/* seems to work with 1300, but who knows... */ 32/* seems to work with 1300, but who knows... */
33#define MIN_THREAD_STACK_SIZE DEFAULT_STACK_SIZE + 0x200 33#define THREAD_STACK_SIZE 4*DEFAULT_STACK_SIZE
34 34
35#if (CONFIG_KEYPAD == IRIVER_H100_PAD) || \ 35#if (CONFIG_KEYPAD == IRIVER_H100_PAD) || \
36 (CONFIG_KEYPAD == IRIVER_H300_PAD) 36 (CONFIG_KEYPAD == IRIVER_H300_PAD)
@@ -279,8 +279,7 @@ static struct batt_info
279static struct 279static struct
280{ 280{
281 unsigned int id; /* worker thread id */ 281 unsigned int id; /* worker thread id */
282 long *stack; 282 long stack[THREAD_STACK_SIZE / sizeof(long)];
283 ssize_t stacksize;
284} gThread; 283} gThread;
285 284
286static struct event_queue thread_q SHAREDBSS_ATTR; 285static struct event_queue thread_q SHAREDBSS_ATTR;
@@ -607,25 +606,9 @@ enum plugin_status plugin_start(const void* parameter)
607 } 606 }
608 607
609 rb->memset(&gThread, 0, sizeof(gThread)); 608 rb->memset(&gThread, 0, sizeof(gThread));
610 void *buf;
611 size_t buf_size;
612 buf = rb->plugin_get_buffer(&buf_size);
613 ALIGN_BUFFER(buf, buf_size, sizeof(long));
614 rb->memset(buf, 0, buf_size);
615
616 gThread.stacksize = buf_size;
617 gThread.stack = (long *) buf;
618
619 if (gThread.stacksize < MIN_THREAD_STACK_SIZE)
620 {
621 rb->splash(HZ*2, "Out of memory");
622 gThread.id = UINT_MAX;
623 return PLUGIN_ERROR;
624 }
625
626 rb->queue_init(&thread_q, true); /* put the thread's queue in the bcast list */ 609 rb->queue_init(&thread_q, true); /* put the thread's queue in the bcast list */
627 gThread.id = rb->create_thread(thread, gThread.stack, 610 gThread.id = rb->create_thread(thread, gThread.stack, sizeof(gThread.stack),
628 gThread.stacksize, 0, "Battery Benchmark" 611 0, "Battery Benchmark"
629 IF_PRIO(, PRIORITY_BACKGROUND) 612 IF_PRIO(, PRIORITY_BACKGROUND)
630 IF_COP(, CPU)); 613 IF_COP(, CPU));
631 614