diff options
author | William Wilgus <wilgus.william@gmail.com> | 2020-11-13 12:41:13 -0500 |
---|---|---|
committer | William Wilgus <me.theuser@yahoo.com> | 2020-11-13 18:08:01 +0000 |
commit | f65fb2a64abaf66b4d695be7fb3e114febea6bd1 (patch) | |
tree | 44fb913004ef2c82f5d56a7a6acc4ec4af319a79 | |
parent | 8ac46f844f437a31f72d73a41a6d3852d8b96143 (diff) |
h300, Others Bugfix Bootloader backlight_init()
backlight_init needs to be called after lcd_init when using
lcd_enable()
Change-Id: Id034835c903801fea49e2b972c110c1ec5106976
-rw-r--r-- | bootloader/creativezvm.c | 2 | ||||
-rw-r--r-- | bootloader/iriver_h300.c | 4 | ||||
-rw-r--r-- | bootloader/meizu_m3.c | 2 | ||||
-rw-r--r-- | bootloader/mini2440.c | 2 | ||||
-rw-r--r-- | bootloader/sansaconnect.c | 2 | ||||
-rw-r--r-- | firmware/target/coldfire/iriver/h300/lcd-h300.c | 100 |
6 files changed, 46 insertions, 66 deletions
diff --git a/bootloader/creativezvm.c b/bootloader/creativezvm.c index 6597448193..415cab1ea3 100644 --- a/bootloader/creativezvm.c +++ b/bootloader/creativezvm.c @@ -57,8 +57,8 @@ void main(void) /* Now enable interrupts */ set_irq_level(IRQ_ENABLED); set_fiq_status(FIQ_ENABLED); - backlight_init(); lcd_init(); + backlight_init(); /* BUGFIX backlight_init MUST BE AFTER lcd_init */ font_init(); button_init(); usb_init(); diff --git a/bootloader/iriver_h300.c b/bootloader/iriver_h300.c index ca5c630e30..04eabcaec2 100644 --- a/bootloader/iriver_h300.c +++ b/bootloader/iriver_h300.c @@ -202,14 +202,14 @@ void main(void) adc_init(); button_init(); - backlight_init(); - lcd_init(); lcd_remote_init(); font_init(); lcd_setfont(FONT_SYSFIXED); + backlight_init(); /* BUGFIX backlight_init MUST BE AFTER lcd_init */ + printf("Rockbox boot loader"); printf("Version %s", rbversion); diff --git a/bootloader/meizu_m3.c b/bootloader/meizu_m3.c index 61308349f6..bbe3d77deb 100644 --- a/bootloader/meizu_m3.c +++ b/bootloader/meizu_m3.c @@ -147,8 +147,8 @@ void main(void) system_init(); kernel_init(); - backlight_init(); lcd_init(); + backlight_init(); /* BUGFIX backlight_init MUST BE AFTER lcd_init */ lcd_update(); i2c_init(); diff --git a/bootloader/mini2440.c b/bootloader/mini2440.c index 2bdd1a0f41..3556fb0633 100644 --- a/bootloader/mini2440.c +++ b/bootloader/mini2440.c @@ -62,8 +62,8 @@ int main(void) /* system_init(); */ kernel_init(); /* enable_interrupt(IRQ_FIQ_STATUS); */ - backlight_init(); lcd_init(); + backlight_init(); /* BUGFIX backlight_init MUST BE AFTER lcd_init */ lcd_setfont(FONT_SYSFIXED); button_init(); dma_init(); diff --git a/bootloader/sansaconnect.c b/bootloader/sansaconnect.c index 5bd59b3ac4..a6559fee55 100644 --- a/bootloader/sansaconnect.c +++ b/bootloader/sansaconnect.c @@ -52,8 +52,8 @@ void main(void) /* Now enable interrupts */ set_irq_level(IRQ_ENABLED); set_fiq_status(FIQ_ENABLED); - backlight_init(); lcd_init(); + backlight_init(); /* BUGFIX backlight_init MUST BE AFTER lcd_init */ font_init(); button_init(); diff --git a/firmware/target/coldfire/iriver/h300/lcd-h300.c b/firmware/target/coldfire/iriver/h300/lcd-h300.c index c415ed6c37..7e73ea3905 100644 --- a/firmware/target/coldfire/iriver/h300/lcd-h300.c +++ b/firmware/target/coldfire/iriver/h300/lcd-h300.c @@ -32,16 +32,23 @@ #include "font.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 +#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 */ - unsigned long dma_addr IBSS_ATTR; unsigned int dma_len 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 */ #define R_START_OSC 0x00 @@ -141,13 +148,9 @@ void lcd_set_flip(bool yesno) if (display_on) { -#ifndef BOOTLOADER - mutex_lock(&lcd_mtx); -#endif + LCD_MUTEX_LOCK(); flip_lcd(yesno); -#ifndef BOOTLOADER - mutex_unlock(&lcd_mtx); -#endif + LCD_MUTEX_UNLOCK(); } } @@ -270,13 +273,12 @@ void lcd_init_device(void) #ifndef BOOTLOADER 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 */ ICR9 = (6 << 2); /* Enable DMA3 interrupt at level 6, priority 0 */ coldfire_imr_mod(0, 1 << 17); - - mutex_init(&lcd_mtx); #endif + LCD_MUTEX_INIT(); _display_on(); } @@ -284,9 +286,7 @@ void lcd_enable(bool on) { if (display_on != on) { -#ifndef BOOTLOADER - mutex_lock(&lcd_mtx); -#endif + LCD_MUTEX_LOCK(); if (on) { _display_on(); @@ -314,9 +314,7 @@ void lcd_enable(bool on) display_on=false; } -#ifndef BOOTLOADER - mutex_unlock(&lcd_mtx); -#endif + LCD_MUTEX_UNLOCK(); } } @@ -352,9 +350,7 @@ void lcd_blit_yuv(unsigned char * const src[3], if (!display_on) return; -#ifndef BOOTLOADER - mutex_lock(&lcd_mtx); -#endif + LCD_MUTEX_LOCK(); width &= ~1; /* stay on the safe side */ height &= ~1; @@ -385,10 +381,9 @@ void lcd_blit_yuv(unsigned char * const src[3], usrc += stride >> 1; vsrc += stride >> 1; } - while (ysrc < ysrc_max); -#ifndef BOOTLOADER - mutex_unlock(&lcd_mtx); -#endif + while (ysrc < ysrc_max) + ;; + LCD_MUTEX_UNLOCK(); } #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) { - DSR3 = 1; + DSR3 = 1; /* Clear all bits in the status register */ if (--dma_count > 0) { dma_addr += LCD_WIDTH*sizeof(fb_data); @@ -415,9 +410,7 @@ void lcd_update(void) { if (display_on) { -#ifndef BOOTLOADER - mutex_lock(&lcd_mtx); -#endif + LCD_MUTEX_LOCK(); lcd_write_reg(R_ENTRY_MODE, R_ENTRY_MODE_VERT); /* set start position window */ @@ -437,25 +430,33 @@ void lcd_update(void) while (dma_count > 0) yield(); - - mutex_unlock(&lcd_mtx); #else DAR3 = 0xf0000002; + DSR3 = 1; /* Clear all bits in the status register */ SAR3 = (unsigned long)FBADDR(0, 0); BCR3 = LCD_WIDTH*LCD_HEIGHT*sizeof(fb_data); DCR3 = DMA_AA | DMA_BWC(1) | DMA_SINC | DMA_SSIZE(DMA_SIZE_LINE) | DMA_DSIZE(DMA_SIZE_WORD) | DMA_START; - while (!(DSR3 & 1)); - DSR3 = 1; + while (!(DSR3 & 1)) + ;; + DSR3 = 1; /* Clear all bits in the status register */ #endif + LCD_MUTEX_UNLOCK(); } } /* Update a fraction of the display. */ 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 (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 */ return; -#ifndef BOOTLOADER - mutex_lock(&lcd_mtx); -#endif + LCD_MUTEX_LOCK(); lcd_write_reg(R_ENTRY_MODE, R_ENTRY_MODE_VERT); /* 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_begin_write_gram(); - -#ifndef BOOTLOADER + if (width == LCD_WIDTH) { dma_count = 1; @@ -498,25 +496,7 @@ void lcd_update_rect(int x, int y, int width, int height) while (dma_count > 0) yield(); - mutex_unlock(&lcd_mtx); -#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 + LCD_MUTEX_UNLOCK(); } +#endif /* ndef BOOTLOADER */ } |