summaryrefslogtreecommitdiffstats
path: root/uisimulator
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2009-02-20 17:13:08 +0000
committerJens Arnold <amiconn@rockbox.org>2009-02-20 17:13:08 +0000
commit3e67e3b1f06488f67d2ebbf844ff40893cc16bf0 (patch)
treea066891b9a91f8eaf84b2eb0501ce0a09000b765 /uisimulator
parent2c3517d67a5387f422c7fcccf3c70f43a386b729 (diff)
downloadrockbox-3e67e3b1f06488f67d2ebbf844ff40893cc16bf0.tar.gz
rockbox-3e67e3b1f06488f67d2ebbf844ff40893cc16bf0.tar.bz2
rockbox-3e67e3b1f06488f67d2ebbf844ff40893cc16bf0.zip
Add a rockbox kernel thread for simulator specific tasks, and use that for calling the screendump function(s). Fixes screendump in simulators for backlight-less targets (Ondio), and reduces mixing of unrelated functionality a bit (screendump was called from backlight thread, triggered by a sim-only system wide event).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20065 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'uisimulator')
-rw-r--r--uisimulator/common/SOURCES1
-rw-r--r--uisimulator/common/sim_tasks.c70
-rw-r--r--uisimulator/common/sim_tasks.h25
-rw-r--r--uisimulator/sdl/button.c3
4 files changed, 98 insertions, 1 deletions
diff --git a/uisimulator/common/SOURCES b/uisimulator/common/SOURCES
index 881049ec59..bda79b66b9 100644
--- a/uisimulator/common/SOURCES
+++ b/uisimulator/common/SOURCES
@@ -6,6 +6,7 @@ font-player.c
lcd-playersim.c
#endif
sim_icons.c
+sim_tasks.c
stubs.c
powermgmt-sim.c
diff --git a/uisimulator/common/sim_tasks.c b/uisimulator/common/sim_tasks.c
new file mode 100644
index 0000000000..2fc887cc37
--- /dev/null
+++ b/uisimulator/common/sim_tasks.c
@@ -0,0 +1,70 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2009 by Jens Arnold
+ *
+ * Rockbox simulator specific tasks
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+
+#include "config.h"
+#include "kernel.h"
+#include "screendump.h"
+#include "thread.h"
+
+static void sim_thread(void);
+static long sim_thread_stack[DEFAULT_STACK_SIZE/sizeof(long)];
+ /* stack isn't actually used in the sim */
+static const char sim_thread_name[] = "sim";
+static struct event_queue sim_queue;
+
+/* possible events for the sim thread */
+enum {
+ SIM_SCREENDUMP,
+};
+
+void sim_thread(void)
+{
+ struct queue_event ev;
+
+ while (1)
+ {
+ queue_wait(&sim_queue, &ev);
+ switch(ev.id)
+ {
+ case SIM_SCREENDUMP:
+ screen_dump();
+#ifdef HAVE_REMOTE_LCD
+ remote_screen_dump();
+#endif
+ break;
+ }
+ }
+}
+
+void sim_tasks_init(void)
+{
+ queue_init(&sim_queue, false);
+
+ create_thread(sim_thread, sim_thread_stack, sizeof(sim_thread_stack), 0,
+ sim_thread_name IF_PRIO(,PRIORITY_BACKGROUND) IF_COP(,CPU));
+}
+
+void sim_trigger_screendump(void)
+{
+ queue_post(&sim_queue, SIM_SCREENDUMP, 0);
+}
diff --git a/uisimulator/common/sim_tasks.h b/uisimulator/common/sim_tasks.h
new file mode 100644
index 0000000000..fe42deeb97
--- /dev/null
+++ b/uisimulator/common/sim_tasks.h
@@ -0,0 +1,25 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2009 by Jens Arnold
+ *
+ * Rockbox simulator specific tasks
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+
+void sim_tasks_init(void);
+void sim_trigger_screendump(void);
diff --git a/uisimulator/sdl/button.c b/uisimulator/sdl/button.c
index 765bc0608e..6402c75d55 100644
--- a/uisimulator/sdl/button.c
+++ b/uisimulator/sdl/button.c
@@ -27,6 +27,7 @@
#include "kernel.h"
#include "backlight.h"
#include "misc.h"
+#include "sim_tasks.h"
#include "debug.h"
@@ -1097,7 +1098,7 @@ void button_event(int key, bool pressed)
case SDLK_F5:
if(pressed)
{
- queue_broadcast(SYS_SCREENDUMP, 0);
+ sim_trigger_screendump();
return;
}
break;