diff options
Diffstat (limited to 'uisimulator/common')
-rw-r--r-- | uisimulator/common/SOURCES | 1 | ||||
-rw-r--r-- | uisimulator/common/sim_tasks.c | 70 | ||||
-rw-r--r-- | uisimulator/common/sim_tasks.h | 25 |
3 files changed, 96 insertions, 0 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 | |||
6 | lcd-playersim.c | 6 | lcd-playersim.c |
7 | #endif | 7 | #endif |
8 | sim_icons.c | 8 | sim_icons.c |
9 | sim_tasks.c | ||
9 | stubs.c | 10 | stubs.c |
10 | powermgmt-sim.c | 11 | powermgmt-sim.c |
11 | 12 | ||
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 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2009 by Jens Arnold | ||
11 | * | ||
12 | * Rockbox simulator specific tasks | ||
13 | * | ||
14 | * This program is free software; you can redistribute it and/or | ||
15 | * modify it under the terms of the GNU General Public License | ||
16 | * as published by the Free Software Foundation; either version 2 | ||
17 | * of the License, or (at your option) any later version. | ||
18 | * | ||
19 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
20 | * KIND, either express or implied. | ||
21 | * | ||
22 | ****************************************************************************/ | ||
23 | |||
24 | #include "config.h" | ||
25 | #include "kernel.h" | ||
26 | #include "screendump.h" | ||
27 | #include "thread.h" | ||
28 | |||
29 | static void sim_thread(void); | ||
30 | static long sim_thread_stack[DEFAULT_STACK_SIZE/sizeof(long)]; | ||
31 | /* stack isn't actually used in the sim */ | ||
32 | static const char sim_thread_name[] = "sim"; | ||
33 | static struct event_queue sim_queue; | ||
34 | |||
35 | /* possible events for the sim thread */ | ||
36 | enum { | ||
37 | SIM_SCREENDUMP, | ||
38 | }; | ||
39 | |||
40 | void sim_thread(void) | ||
41 | { | ||
42 | struct queue_event ev; | ||
43 | |||
44 | while (1) | ||
45 | { | ||
46 | queue_wait(&sim_queue, &ev); | ||
47 | switch(ev.id) | ||
48 | { | ||
49 | case SIM_SCREENDUMP: | ||
50 | screen_dump(); | ||
51 | #ifdef HAVE_REMOTE_LCD | ||
52 | remote_screen_dump(); | ||
53 | #endif | ||
54 | break; | ||
55 | } | ||
56 | } | ||
57 | } | ||
58 | |||
59 | void sim_tasks_init(void) | ||
60 | { | ||
61 | queue_init(&sim_queue, false); | ||
62 | |||
63 | create_thread(sim_thread, sim_thread_stack, sizeof(sim_thread_stack), 0, | ||
64 | sim_thread_name IF_PRIO(,PRIORITY_BACKGROUND) IF_COP(,CPU)); | ||
65 | } | ||
66 | |||
67 | void sim_trigger_screendump(void) | ||
68 | { | ||
69 | queue_post(&sim_queue, SIM_SCREENDUMP, 0); | ||
70 | } | ||
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 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2009 by Jens Arnold | ||
11 | * | ||
12 | * Rockbox simulator specific tasks | ||
13 | * | ||
14 | * This program is free software; you can redistribute it and/or | ||
15 | * modify it under the terms of the GNU General Public License | ||
16 | * as published by the Free Software Foundation; either version 2 | ||
17 | * of the License, or (at your option) any later version. | ||
18 | * | ||
19 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
20 | * KIND, either express or implied. | ||
21 | * | ||
22 | ****************************************************************************/ | ||
23 | |||
24 | void sim_tasks_init(void); | ||
25 | void sim_trigger_screendump(void); | ||