mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-09 05:05:20 -05:00
Convert lcd_activation callbacks to use the event system to allow for multiple parallel callbacks (for custom statusbar).
Increase maximum event count as we need more (I actually had a report about it during custom statusbar testing). Removed corresponding functions from the core and plugin api. Bump min version and sort. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23302 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
774bacc692
commit
d85c3ec410
32 changed files with 57 additions and 117 deletions
|
|
@ -75,27 +75,6 @@ static struct viewport* current_vp IDATA_ATTR = &default_vp;
|
|||
struct viewport* current_vp IDATA_ATTR = &default_vp;
|
||||
#endif
|
||||
|
||||
|
||||
/*** Helpers - consolidate optional code ***/
|
||||
#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP)
|
||||
static void (*lcd_activation_hook)(void) = NULL;
|
||||
|
||||
void lcd_activation_set_hook(void (*func)(void))
|
||||
{
|
||||
lcd_activation_hook = func;
|
||||
}
|
||||
|
||||
/* To be called by target driver after enabling display and refreshing it */
|
||||
void lcd_activation_call_hook(void)
|
||||
{
|
||||
void (*func)(void) = lcd_activation_hook;
|
||||
|
||||
if (func != NULL)
|
||||
func();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* LCD init */
|
||||
void lcd_init(void)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -74,27 +74,6 @@ static struct viewport* current_vp IDATA_ATTR = &default_vp;
|
|||
struct viewport* current_vp IDATA_ATTR = &default_vp;
|
||||
#endif
|
||||
|
||||
|
||||
/*** Helpers - consolidate optional code ***/
|
||||
#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP)
|
||||
static void (*lcd_activation_hook)(void) = NULL;
|
||||
|
||||
void lcd_activation_set_hook(void (*func)(void))
|
||||
{
|
||||
lcd_activation_hook = func;
|
||||
}
|
||||
|
||||
/* To be called by target driver after enabling display and refreshing it */
|
||||
void lcd_activation_call_hook(void)
|
||||
{
|
||||
void (*func)(void) = lcd_activation_hook;
|
||||
|
||||
if (func != NULL)
|
||||
func();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* LCD init */
|
||||
void lcd_init(void)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -91,25 +91,6 @@ void LCDFN(init)(void)
|
|||
#endif
|
||||
}
|
||||
|
||||
#ifdef MAIN_LCD
|
||||
#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP)
|
||||
static void (*lcd_activation_hook)(void) = NULL;
|
||||
|
||||
void lcd_activation_set_hook(void (*func)(void))
|
||||
{
|
||||
lcd_activation_hook = func;
|
||||
}
|
||||
|
||||
void lcd_activation_call_hook(void)
|
||||
{
|
||||
void (*func)(void) = lcd_activation_hook;
|
||||
|
||||
if (func != NULL)
|
||||
func();
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*** parameter handling ***/
|
||||
|
||||
void LCDFN(set_drawmode)(int mode)
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
#include "events.h"
|
||||
#include "panic.h"
|
||||
|
||||
#define MAX_SYS_EVENTS 20
|
||||
#define MAX_SYS_EVENTS 28
|
||||
|
||||
struct sysevent {
|
||||
unsigned short id;
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@
|
|||
#define EVENT_CLASS_PLAYBACK 0x0200
|
||||
#define EVENT_CLASS_BUFFERING 0x0400
|
||||
#define EVENT_CLASS_GUI 0x0800
|
||||
#define EVENT_CLASS_LCD 0xf000
|
||||
|
||||
bool add_event(unsigned short id, bool oneshot, void (*handler)(void *data));
|
||||
void remove_event(unsigned short id, void (*handler)(void *data));
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
#include <stdbool.h>
|
||||
#include "cpu.h"
|
||||
#include "config.h"
|
||||
#include "events.h"
|
||||
|
||||
#define VP_FLAG_ALIGN_RIGHT 0x01
|
||||
#define VP_FLAG_ALIGN_CENTER 0x02
|
||||
|
|
@ -426,13 +427,16 @@ extern void lcd_sleep(void);
|
|||
* framebuffer data is synchronized */
|
||||
/* Sansa Clip has these function in it's lcd driver, since it's the only
|
||||
* 1-bit display featuring lcd_active, so far */
|
||||
|
||||
enum {
|
||||
LCD_EVENT_ACTIVATION = (EVENT_CLASS_LCD|1),
|
||||
};
|
||||
|
||||
extern bool lcd_active(void);
|
||||
extern void lcd_activation_set_hook(void (*enable_hook)(void));
|
||||
extern void lcd_activation_call_hook(void);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LCD_SHUTDOWN
|
||||
void lcd_shutdown(void);
|
||||
extern void lcd_shutdown(void);
|
||||
#endif
|
||||
|
||||
/* Bitmap formats */
|
||||
|
|
|
|||
|
|
@ -172,7 +172,7 @@ void lcd_enable(bool enable)
|
|||
ascodec_write(AS3514_DCDC15, 1);
|
||||
|
||||
lcd_write_command(LCD_SET_DISPLAY_ON);
|
||||
lcd_activation_call_hook();
|
||||
send_event(LCD_EVENT_ACTIVATION, NULL);
|
||||
}
|
||||
else {
|
||||
lcd_write_command(LCD_SET_DISPLAY_OFF);
|
||||
|
|
|
|||
|
|
@ -372,7 +372,7 @@ void lcd_enable(bool on)
|
|||
if(on)
|
||||
{
|
||||
_display_on();
|
||||
lcd_activation_call_hook();
|
||||
send_event(LCD_EVENT_ACTIVATION, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -217,7 +217,7 @@ void lcd_enable(bool on)
|
|||
lcd_write_reg(0x07, 0x17);
|
||||
display_on = true;
|
||||
lcd_update(); /* Resync display */
|
||||
lcd_activation_call_hook();
|
||||
send_event(LCD_EVENT_ACTIVATION, NULL);
|
||||
sleep(0);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ void lcd_enable(bool state)
|
|||
lcd_powered = true;
|
||||
lcd_on = true;
|
||||
lcd_update();
|
||||
lcd_activation_call_hook();
|
||||
send_event(LCD_EVENT_ACTIVATION, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -618,7 +618,7 @@ void lcd_awake(void)
|
|||
tick_add_task(&lcd_tick);
|
||||
wakeup_wait(&(lcd_state.initwakeup), TIMEOUT_BLOCK);
|
||||
|
||||
lcd_activation_call_hook();
|
||||
send_event(LCD_EVENT_ACTIVATION, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -380,7 +380,7 @@ void lcd_enable(bool on)
|
|||
/* Probably out of sync and we don't wanna pepper the code with
|
||||
lcd_update() calls for this. */
|
||||
lcd_update();
|
||||
lcd_activation_call_hook();
|
||||
send_event(LCD_EVENT_ACTIVATION, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -320,7 +320,7 @@ void lcd_enable(bool yesno)
|
|||
{
|
||||
lcd_send_command(R_STANDBY_OFF, 0);
|
||||
lcd_send_command(R_DISPLAY_ON, 0);
|
||||
lcd_activation_call_hook();
|
||||
send_event(LCD_EVENT_ACTIVATION, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -339,7 +339,7 @@ void lcd_enable(bool on)
|
|||
/* Probably out of sync and we don't wanna pepper the code with
|
||||
lcd_update() calls for this. */
|
||||
lcd_update();
|
||||
lcd_activation_call_hook();
|
||||
send_event(LCD_EVENT_ACTIVATION, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -323,7 +323,7 @@ void lcd_enable(bool state)
|
|||
|
||||
lcd_on = true;
|
||||
lcd_update();
|
||||
lcd_activation_call_hook();
|
||||
send_event(LCD_EVENT_ACTIVATION, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -226,7 +226,7 @@ void lcd_enable(bool yesno)
|
|||
{
|
||||
lcd_send_command(R_STANDBY_OFF);
|
||||
lcd_send_command(R_DISPLAY_ON);
|
||||
lcd_activation_call_hook();
|
||||
send_event(LCD_EVENT_ACTIVATION, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -492,7 +492,7 @@ void lcd_enable(bool on)
|
|||
/* Probably out of sync and we don't wanna pepper the code with
|
||||
lcd_update() calls for this. */
|
||||
lcd_update();
|
||||
lcd_activation_call_hook();
|
||||
send_event(LCD_EVENT_ACTIVATION, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -448,7 +448,7 @@ void lcd_enable(bool on)
|
|||
DEV_EN |= DEV_LCD; /* Enable LCD controller */
|
||||
lcd_display_on(); /* Turn on display */
|
||||
lcd_update(); /* Resync display */
|
||||
lcd_activation_call_hook();
|
||||
send_event(LCD_EVENT_ACTIVATION, NULL);
|
||||
LCD_REG_6 |= 1; /* Restart DMA */
|
||||
sleep(HZ/50); /* Wait for a frame to be written */
|
||||
}
|
||||
|
|
|
|||
|
|
@ -143,7 +143,7 @@ void lcd_enable(bool on)
|
|||
|
||||
if (on) {
|
||||
_display_on();
|
||||
lcd_activation_call_hook();
|
||||
send_event(LCD_EVENT_ACTIVATION, NULL);
|
||||
} else {
|
||||
/** Off sequence according to datasheet, p. 130 **/
|
||||
lcd_write_reg(R_FRAME_CYCLE_CONTROL, 0x0002); /* EQ=0, 18 clks/line */
|
||||
|
|
|
|||
|
|
@ -209,7 +209,7 @@ void lcd_enable(bool on)
|
|||
lcd_display_on();
|
||||
LCDC_CTRL |= 1; /* controller enable */
|
||||
lcd_update(); /* Resync display */
|
||||
lcd_activation_call_hook();
|
||||
send_event(LCD_EVENT_ACTIVATION, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -237,7 +237,7 @@ return;
|
|||
{
|
||||
lcd_display_on(false); /* Turn on display */
|
||||
lcd_update(); /* Resync display */
|
||||
lcd_activation_call_hook();
|
||||
send_event(LCD_EVENT_ACTIVATION, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ void lcd_awake(void)
|
|||
sleep(HZ/10);
|
||||
|
||||
|
||||
lcd_activation_call_hook();
|
||||
send_event(LCD_EVENT_ACTIVATION, NULL);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -397,7 +397,7 @@ void lcd_enable(bool on)
|
|||
/* Probably out of sync and we don't wanna pepper the code with
|
||||
lcd_update() calls for this. */
|
||||
lcd_update();
|
||||
lcd_activation_call_hook();
|
||||
send_event(LCD_EVENT_ACTIVATION, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -280,7 +280,7 @@ void lcd_enable(bool on)
|
|||
if (on)
|
||||
{
|
||||
_display_on();
|
||||
lcd_activation_call_hook();
|
||||
send_event(LCD_EVENT_ACTIVATION, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ void lcd_enable(bool state)
|
|||
{
|
||||
lcd_on();
|
||||
#ifdef HAVE_LCD_ENABLE
|
||||
lcd_activation_call_hook();
|
||||
send_event(LCD_EVENT_ACTIVATION, NULL);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue