mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-14 02:27:39 -04:00
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
This commit is contained in:
parent
2c3517d67a
commit
3e67e3b1f0
7 changed files with 103 additions and 15 deletions
|
@ -112,6 +112,7 @@
|
||||||
#include "cuesheet.h"
|
#include "cuesheet.h"
|
||||||
|
|
||||||
#ifdef SIMULATOR
|
#ifdef SIMULATOR
|
||||||
|
#include "sim_tasks.h"
|
||||||
#include "system-sdl.h"
|
#include "system-sdl.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -294,6 +295,7 @@ static void init(void)
|
||||||
show_logo();
|
show_logo();
|
||||||
button_init();
|
button_init();
|
||||||
backlight_init();
|
backlight_init();
|
||||||
|
sim_tasks_init();
|
||||||
lang_init();
|
lang_init();
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
debug_init();
|
debug_init();
|
||||||
|
|
|
@ -597,16 +597,6 @@ void backlight_thread(void)
|
||||||
break;
|
break;
|
||||||
#endif /* HAVE_REMOTE_LCD/ HAVE_REMOTE_LCD_AS_MAIN */
|
#endif /* HAVE_REMOTE_LCD/ HAVE_REMOTE_LCD_AS_MAIN */
|
||||||
#endif /* !SIMULATOR */
|
#endif /* !SIMULATOR */
|
||||||
#ifdef SIMULATOR
|
|
||||||
/* TODO: find a better way to do it but we need
|
|
||||||
* a kernel thread somewhere to handle this */
|
|
||||||
case SYS_SCREENDUMP:
|
|
||||||
screen_dump();
|
|
||||||
#ifdef HAVE_REMOTE_LCD
|
|
||||||
remote_screen_dump();
|
|
||||||
#endif
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
case SYS_USB_CONNECTED:
|
case SYS_USB_CONNECTED:
|
||||||
/* Tell the USB thread that we are safe */
|
/* Tell the USB thread that we are safe */
|
||||||
DEBUGF("backlight_thread got SYS_USB_CONNECTED\n");
|
DEBUGF("backlight_thread got SYS_USB_CONNECTED\n");
|
||||||
|
|
|
@ -76,10 +76,9 @@
|
||||||
#define SYS_PHONE_UNPLUGGED MAKE_SYS_EVENT(SYS_EVENT_CLS_PLUG, 3)
|
#define SYS_PHONE_UNPLUGGED MAKE_SYS_EVENT(SYS_EVENT_CLS_PLUG, 3)
|
||||||
#define SYS_REMOTE_PLUGGED MAKE_SYS_EVENT(SYS_EVENT_CLS_PLUG, 4)
|
#define SYS_REMOTE_PLUGGED MAKE_SYS_EVENT(SYS_EVENT_CLS_PLUG, 4)
|
||||||
#define SYS_REMOTE_UNPLUGGED MAKE_SYS_EVENT(SYS_EVENT_CLS_PLUG, 5)
|
#define SYS_REMOTE_UNPLUGGED MAKE_SYS_EVENT(SYS_EVENT_CLS_PLUG, 5)
|
||||||
#define SYS_SCREENDUMP MAKE_SYS_EVENT(SYS_EVENT_CLS_MISC, 0)
|
#define SYS_CAR_ADAPTER_RESUME MAKE_SYS_EVENT(SYS_EVENT_CLS_MISC, 0)
|
||||||
#define SYS_CAR_ADAPTER_RESUME MAKE_SYS_EVENT(SYS_EVENT_CLS_MISC, 1)
|
#define SYS_IAP_PERIODIC MAKE_SYS_EVENT(SYS_EVENT_CLS_MISC, 1)
|
||||||
#define SYS_IAP_PERIODIC MAKE_SYS_EVENT(SYS_EVENT_CLS_MISC, 2)
|
#define SYS_IAP_HANDLEPKT MAKE_SYS_EVENT(SYS_EVENT_CLS_MISC, 2)
|
||||||
#define SYS_IAP_HANDLEPKT MAKE_SYS_EVENT(SYS_EVENT_CLS_MISC, 3)
|
|
||||||
|
|
||||||
#define IS_SYSEVENT(ev) ((ev & SYS_EVENT) == SYS_EVENT)
|
#define IS_SYSEVENT(ev) ((ev & SYS_EVENT) == SYS_EVENT)
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@ font-player.c
|
||||||
lcd-playersim.c
|
lcd-playersim.c
|
||||||
#endif
|
#endif
|
||||||
sim_icons.c
|
sim_icons.c
|
||||||
|
sim_tasks.c
|
||||||
stubs.c
|
stubs.c
|
||||||
powermgmt-sim.c
|
powermgmt-sim.c
|
||||||
|
|
||||||
|
|
70
uisimulator/common/sim_tasks.c
Normal file
70
uisimulator/common/sim_tasks.c
Normal file
|
@ -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);
|
||||||
|
}
|
25
uisimulator/common/sim_tasks.h
Normal file
25
uisimulator/common/sim_tasks.h
Normal file
|
@ -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);
|
|
@ -27,6 +27,7 @@
|
||||||
#include "kernel.h"
|
#include "kernel.h"
|
||||||
#include "backlight.h"
|
#include "backlight.h"
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
|
#include "sim_tasks.h"
|
||||||
|
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
|
||||||
|
@ -1097,7 +1098,7 @@ void button_event(int key, bool pressed)
|
||||||
case SDLK_F5:
|
case SDLK_F5:
|
||||||
if(pressed)
|
if(pressed)
|
||||||
{
|
{
|
||||||
queue_broadcast(SYS_SCREENDUMP, 0);
|
sim_trigger_screendump();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue