h300, Others Bugfix Bootloader backlight_init()
backlight_init needs to be called after lcd_init when using lcd_enable() Change-Id: Id034835c903801fea49e2b972c110c1ec5106976
This commit is contained in:
parent
8ac46f844f
commit
f65fb2a64a
6 changed files with 46 additions and 66 deletions
|
@ -57,8 +57,8 @@ void main(void)
|
||||||
/* Now enable interrupts */
|
/* Now enable interrupts */
|
||||||
set_irq_level(IRQ_ENABLED);
|
set_irq_level(IRQ_ENABLED);
|
||||||
set_fiq_status(FIQ_ENABLED);
|
set_fiq_status(FIQ_ENABLED);
|
||||||
backlight_init();
|
|
||||||
lcd_init();
|
lcd_init();
|
||||||
|
backlight_init(); /* BUGFIX backlight_init MUST BE AFTER lcd_init */
|
||||||
font_init();
|
font_init();
|
||||||
button_init();
|
button_init();
|
||||||
usb_init();
|
usb_init();
|
||||||
|
|
|
@ -202,14 +202,14 @@ void main(void)
|
||||||
adc_init();
|
adc_init();
|
||||||
button_init();
|
button_init();
|
||||||
|
|
||||||
backlight_init();
|
|
||||||
|
|
||||||
lcd_init();
|
lcd_init();
|
||||||
lcd_remote_init();
|
lcd_remote_init();
|
||||||
font_init();
|
font_init();
|
||||||
|
|
||||||
lcd_setfont(FONT_SYSFIXED);
|
lcd_setfont(FONT_SYSFIXED);
|
||||||
|
|
||||||
|
backlight_init(); /* BUGFIX backlight_init MUST BE AFTER lcd_init */
|
||||||
|
|
||||||
printf("Rockbox boot loader");
|
printf("Rockbox boot loader");
|
||||||
printf("Version %s", rbversion);
|
printf("Version %s", rbversion);
|
||||||
|
|
||||||
|
|
|
@ -147,8 +147,8 @@ void main(void)
|
||||||
system_init();
|
system_init();
|
||||||
kernel_init();
|
kernel_init();
|
||||||
|
|
||||||
backlight_init();
|
|
||||||
lcd_init();
|
lcd_init();
|
||||||
|
backlight_init(); /* BUGFIX backlight_init MUST BE AFTER lcd_init */
|
||||||
lcd_update();
|
lcd_update();
|
||||||
|
|
||||||
i2c_init();
|
i2c_init();
|
||||||
|
|
|
@ -62,8 +62,8 @@ int main(void)
|
||||||
/* system_init(); */
|
/* system_init(); */
|
||||||
kernel_init();
|
kernel_init();
|
||||||
/* enable_interrupt(IRQ_FIQ_STATUS); */
|
/* enable_interrupt(IRQ_FIQ_STATUS); */
|
||||||
backlight_init();
|
|
||||||
lcd_init();
|
lcd_init();
|
||||||
|
backlight_init(); /* BUGFIX backlight_init MUST BE AFTER lcd_init */
|
||||||
lcd_setfont(FONT_SYSFIXED);
|
lcd_setfont(FONT_SYSFIXED);
|
||||||
button_init();
|
button_init();
|
||||||
dma_init();
|
dma_init();
|
||||||
|
|
|
@ -52,8 +52,8 @@ void main(void)
|
||||||
/* Now enable interrupts */
|
/* Now enable interrupts */
|
||||||
set_irq_level(IRQ_ENABLED);
|
set_irq_level(IRQ_ENABLED);
|
||||||
set_fiq_status(FIQ_ENABLED);
|
set_fiq_status(FIQ_ENABLED);
|
||||||
backlight_init();
|
|
||||||
lcd_init();
|
lcd_init();
|
||||||
|
backlight_init(); /* BUGFIX backlight_init MUST BE AFTER lcd_init */
|
||||||
font_init();
|
font_init();
|
||||||
button_init();
|
button_init();
|
||||||
|
|
||||||
|
|
|
@ -32,16 +32,23 @@
|
||||||
#include "font.h"
|
#include "font.h"
|
||||||
#include "bidi.h"
|
#include "bidi.h"
|
||||||
|
|
||||||
static bool display_on = false; /* Is the display turned on? */
|
|
||||||
static bool display_flipped = false;
|
|
||||||
static int xoffset = 0; /* Needed for flip */
|
|
||||||
#ifndef BOOTLOADER
|
#ifndef BOOTLOADER
|
||||||
|
#define LCD_MUTEX_INIT() mutex_init(&lcd_mtx)
|
||||||
|
#define LCD_MUTEX_LOCK() mutex_lock(&lcd_mtx)
|
||||||
|
#define LCD_MUTEX_UNLOCK() mutex_unlock(&lcd_mtx)
|
||||||
static struct mutex lcd_mtx; /* The update functions use DMA and yield */
|
static struct mutex lcd_mtx; /* The update functions use DMA and yield */
|
||||||
|
|
||||||
unsigned long dma_addr IBSS_ATTR;
|
unsigned long dma_addr IBSS_ATTR;
|
||||||
unsigned int dma_len IBSS_ATTR;
|
unsigned int dma_len IBSS_ATTR;
|
||||||
volatile int dma_count IBSS_ATTR;
|
volatile int dma_count IBSS_ATTR;
|
||||||
#endif
|
#else
|
||||||
|
#define LCD_MUTEX_INIT()
|
||||||
|
#define LCD_MUTEX_LOCK()
|
||||||
|
#define LCD_MUTEX_UNLOCK()
|
||||||
|
#endif /* def BOOTLOADER */
|
||||||
|
|
||||||
|
static bool display_on = false; /* Is the display turned on? */
|
||||||
|
static bool display_flipped = false;
|
||||||
|
static int xoffset = 0; /* Needed for flip */
|
||||||
|
|
||||||
/* register defines */
|
/* register defines */
|
||||||
#define R_START_OSC 0x00
|
#define R_START_OSC 0x00
|
||||||
|
@ -141,13 +148,9 @@ void lcd_set_flip(bool yesno)
|
||||||
|
|
||||||
if (display_on)
|
if (display_on)
|
||||||
{
|
{
|
||||||
#ifndef BOOTLOADER
|
LCD_MUTEX_LOCK();
|
||||||
mutex_lock(&lcd_mtx);
|
|
||||||
#endif
|
|
||||||
flip_lcd(yesno);
|
flip_lcd(yesno);
|
||||||
#ifndef BOOTLOADER
|
LCD_MUTEX_UNLOCK();
|
||||||
mutex_unlock(&lcd_mtx);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -270,13 +273,12 @@ void lcd_init_device(void)
|
||||||
|
|
||||||
#ifndef BOOTLOADER
|
#ifndef BOOTLOADER
|
||||||
DAR3 = 0xf0000002; /* Configure DMA channel 3 */
|
DAR3 = 0xf0000002; /* Configure DMA channel 3 */
|
||||||
DSR3 = 1;
|
DSR3 = 1; /* Clear all bits in the status register */
|
||||||
DIVR3 = 57; /* DMA3 is mapped into vector 57 in system.c */
|
DIVR3 = 57; /* DMA3 is mapped into vector 57 in system.c */
|
||||||
ICR9 = (6 << 2); /* Enable DMA3 interrupt at level 6, priority 0 */
|
ICR9 = (6 << 2); /* Enable DMA3 interrupt at level 6, priority 0 */
|
||||||
coldfire_imr_mod(0, 1 << 17);
|
coldfire_imr_mod(0, 1 << 17);
|
||||||
|
|
||||||
mutex_init(&lcd_mtx);
|
|
||||||
#endif
|
#endif
|
||||||
|
LCD_MUTEX_INIT();
|
||||||
_display_on();
|
_display_on();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -284,9 +286,7 @@ void lcd_enable(bool on)
|
||||||
{
|
{
|
||||||
if (display_on != on)
|
if (display_on != on)
|
||||||
{
|
{
|
||||||
#ifndef BOOTLOADER
|
LCD_MUTEX_LOCK();
|
||||||
mutex_lock(&lcd_mtx);
|
|
||||||
#endif
|
|
||||||
if (on)
|
if (on)
|
||||||
{
|
{
|
||||||
_display_on();
|
_display_on();
|
||||||
|
@ -314,9 +314,7 @@ void lcd_enable(bool on)
|
||||||
|
|
||||||
display_on=false;
|
display_on=false;
|
||||||
}
|
}
|
||||||
#ifndef BOOTLOADER
|
LCD_MUTEX_UNLOCK();
|
||||||
mutex_unlock(&lcd_mtx);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -352,9 +350,7 @@ void lcd_blit_yuv(unsigned char * const src[3],
|
||||||
if (!display_on)
|
if (!display_on)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#ifndef BOOTLOADER
|
LCD_MUTEX_LOCK();
|
||||||
mutex_lock(&lcd_mtx);
|
|
||||||
#endif
|
|
||||||
width &= ~1; /* stay on the safe side */
|
width &= ~1; /* stay on the safe side */
|
||||||
height &= ~1;
|
height &= ~1;
|
||||||
|
|
||||||
|
@ -385,10 +381,9 @@ void lcd_blit_yuv(unsigned char * const src[3],
|
||||||
usrc += stride >> 1;
|
usrc += stride >> 1;
|
||||||
vsrc += stride >> 1;
|
vsrc += stride >> 1;
|
||||||
}
|
}
|
||||||
while (ysrc < ysrc_max);
|
while (ysrc < ysrc_max)
|
||||||
#ifndef BOOTLOADER
|
;;
|
||||||
mutex_unlock(&lcd_mtx);
|
LCD_MUTEX_UNLOCK();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef BOOTLOADER
|
#ifndef BOOTLOADER
|
||||||
|
@ -396,7 +391,7 @@ void lcd_blit_yuv(unsigned char * const src[3],
|
||||||
void DMA3(void) __attribute__ ((interrupt_handler, section(".icode")));
|
void DMA3(void) __attribute__ ((interrupt_handler, section(".icode")));
|
||||||
void DMA3(void)
|
void DMA3(void)
|
||||||
{
|
{
|
||||||
DSR3 = 1;
|
DSR3 = 1; /* Clear all bits in the status register */
|
||||||
if (--dma_count > 0)
|
if (--dma_count > 0)
|
||||||
{
|
{
|
||||||
dma_addr += LCD_WIDTH*sizeof(fb_data);
|
dma_addr += LCD_WIDTH*sizeof(fb_data);
|
||||||
|
@ -415,9 +410,7 @@ void lcd_update(void)
|
||||||
{
|
{
|
||||||
if (display_on)
|
if (display_on)
|
||||||
{
|
{
|
||||||
#ifndef BOOTLOADER
|
LCD_MUTEX_LOCK();
|
||||||
mutex_lock(&lcd_mtx);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
lcd_write_reg(R_ENTRY_MODE, R_ENTRY_MODE_VERT);
|
lcd_write_reg(R_ENTRY_MODE, R_ENTRY_MODE_VERT);
|
||||||
/* set start position window */
|
/* set start position window */
|
||||||
|
@ -437,25 +430,33 @@ void lcd_update(void)
|
||||||
|
|
||||||
while (dma_count > 0)
|
while (dma_count > 0)
|
||||||
yield();
|
yield();
|
||||||
|
|
||||||
mutex_unlock(&lcd_mtx);
|
|
||||||
#else
|
#else
|
||||||
DAR3 = 0xf0000002;
|
DAR3 = 0xf0000002;
|
||||||
|
DSR3 = 1; /* Clear all bits in the status register */
|
||||||
SAR3 = (unsigned long)FBADDR(0, 0);
|
SAR3 = (unsigned long)FBADDR(0, 0);
|
||||||
BCR3 = LCD_WIDTH*LCD_HEIGHT*sizeof(fb_data);
|
BCR3 = LCD_WIDTH*LCD_HEIGHT*sizeof(fb_data);
|
||||||
DCR3 = DMA_AA | DMA_BWC(1)
|
DCR3 = DMA_AA | DMA_BWC(1)
|
||||||
| DMA_SINC | DMA_SSIZE(DMA_SIZE_LINE)
|
| DMA_SINC | DMA_SSIZE(DMA_SIZE_LINE)
|
||||||
| DMA_DSIZE(DMA_SIZE_WORD) | DMA_START;
|
| DMA_DSIZE(DMA_SIZE_WORD) | DMA_START;
|
||||||
|
|
||||||
while (!(DSR3 & 1));
|
while (!(DSR3 & 1))
|
||||||
DSR3 = 1;
|
;;
|
||||||
|
DSR3 = 1; /* Clear all bits in the status register */
|
||||||
#endif
|
#endif
|
||||||
|
LCD_MUTEX_UNLOCK();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Update a fraction of the display. */
|
/* Update a fraction of the display. */
|
||||||
void lcd_update_rect(int x, int y, int width, int height)
|
void lcd_update_rect(int x, int y, int width, int height)
|
||||||
{
|
{
|
||||||
|
#ifdef BOOTLOADER
|
||||||
|
(void)x;
|
||||||
|
(void)y;
|
||||||
|
(void)width;
|
||||||
|
(void)height;
|
||||||
|
lcd_update(); /* in bootloader -- all or nothing */
|
||||||
|
#else
|
||||||
if (display_on)
|
if (display_on)
|
||||||
{
|
{
|
||||||
if (x + width > LCD_WIDTH)
|
if (x + width > LCD_WIDTH)
|
||||||
|
@ -466,9 +467,7 @@ void lcd_update_rect(int x, int y, int width, int height)
|
||||||
if (width <= 0 || height <= 0) /* nothing to do */
|
if (width <= 0 || height <= 0) /* nothing to do */
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#ifndef BOOTLOADER
|
LCD_MUTEX_LOCK();
|
||||||
mutex_lock(&lcd_mtx);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
lcd_write_reg(R_ENTRY_MODE, R_ENTRY_MODE_VERT);
|
lcd_write_reg(R_ENTRY_MODE, R_ENTRY_MODE_VERT);
|
||||||
/* set update window */
|
/* set update window */
|
||||||
|
@ -477,8 +476,7 @@ void lcd_update_rect(int x, int y, int width, int height)
|
||||||
lcd_write_reg(R_RAM_ADDR_SET, ((x+xoffset) << 8) | y);
|
lcd_write_reg(R_RAM_ADDR_SET, ((x+xoffset) << 8) | y);
|
||||||
|
|
||||||
lcd_begin_write_gram();
|
lcd_begin_write_gram();
|
||||||
|
|
||||||
#ifndef BOOTLOADER
|
|
||||||
if (width == LCD_WIDTH)
|
if (width == LCD_WIDTH)
|
||||||
{
|
{
|
||||||
dma_count = 1;
|
dma_count = 1;
|
||||||
|
@ -498,25 +496,7 @@ void lcd_update_rect(int x, int y, int width, int height)
|
||||||
while (dma_count > 0)
|
while (dma_count > 0)
|
||||||
yield();
|
yield();
|
||||||
|
|
||||||
mutex_unlock(&lcd_mtx);
|
LCD_MUTEX_UNLOCK();
|
||||||
#else
|
|
||||||
DAR3 = 0xf0000002;
|
|
||||||
unsigned long dma_addr = (unsigned long)FBADDR(x, y);
|
|
||||||
width *= sizeof(fb_data);
|
|
||||||
|
|
||||||
for (; height > 0; height--)
|
|
||||||
{
|
|
||||||
SAR3 = dma_addr;
|
|
||||||
BCR3 = width;
|
|
||||||
DCR3 = DMA_AA | DMA_BWC(1)
|
|
||||||
| DMA_SINC | DMA_SSIZE(DMA_SIZE_LINE)
|
|
||||||
| DMA_DSIZE(DMA_SIZE_WORD) | DMA_START;
|
|
||||||
|
|
||||||
dma_addr += LCD_WIDTH*sizeof(fb_data);
|
|
||||||
|
|
||||||
while (!(DSR3 & 1));
|
|
||||||
DSR3 = 1;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#endif /* ndef BOOTLOADER */
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue