1
0
Fork 0
forked from len0rd/rockbox

Backlight handling: * Added 'Caption Backlight' and 'Backlight On When Charging' for the iriver remote LCD. * Enabled the backlight code for the simulator, and prepared backlight simulation. It's only a stub atm, writing messages to the console window. * Added tick task handling to the simulators for this to work. * Code cleanup in backlight.c, less dead code.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8034 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jens Arnold 2005-11-21 23:55:39 +00:00
parent e68680ac31
commit b51f7dfc9b
29 changed files with 416 additions and 231 deletions

View file

@ -22,12 +22,15 @@
#include "kernel.h"
#include "thread-win32.h"
#include "thread.h"
#include "debug.h"
/* (Daniel 2002-10-31) Mingw32 requires this errno variable to be present.
I'm not quite sure why and I don't know if this breaks the MSVC compile.
If it does, we should put this within #ifdef __MINGW32__ */
int errno;
static void (*tick_funcs[MAX_NUM_TICK_TASKS])(void);
int set_irq_level (int level)
{
static int _lv = 0;
@ -99,6 +102,54 @@ void switch_thread (void)
yield ();
}
void sim_tick_tasks(void)
{
int i;
/* Run through the list of tick tasks */
for(i = 0;i < MAX_NUM_TICK_TASKS;i++)
{
if(tick_funcs[i])
{
tick_funcs[i]();
}
}
}
int tick_add_task(void (*f)(void))
{
int i;
/* Add a task if there is room */
for(i = 0;i < MAX_NUM_TICK_TASKS;i++)
{
if(tick_funcs[i] == NULL)
{
tick_funcs[i] = f;
return 0;
}
}
DEBUGF("Error! tick_add_task(): out of tasks");
return -1;
}
int tick_remove_task(void (*f)(void))
{
int i;
/* Remove a task if it is there */
for(i = 0;i < MAX_NUM_TICK_TASKS;i++)
{
if(tick_funcs[i] == f)
{
tick_funcs[i] = NULL;
return 0;
}
}
return -1;
}
/* TODO: Implement mutexes for win32 */
void mutex_init(struct mutex *m)
{