1
0
Fork 0
forked from len0rd/rockbox

Idle CPU directly; minor cleanup

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12002 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Greg White 2007-01-14 03:28:31 +00:00
parent d4afc4b9b9
commit b26f4720c8
2 changed files with 12 additions and 11 deletions

View file

@ -127,7 +127,7 @@ bool __backlight_init(void)
initial_tick_delay = 400; initial_tick_delay = 400;
/* put the led control on the tick list */ /* put the led control on the tick list */
tick_add_task(led_control_service); tick_add_task(led_control_service);
return true; return true;
} }

View file

@ -82,10 +82,10 @@ void lcd_update_rect(int x, int y, int width, int height)
{ {
/* Wait for this controller to stop pending transfer */ /* Wait for this controller to stop pending transfer */
while((DSTAT1 & 0x000fffff)) while((DSTAT1 & 0x000fffff))
yield(); CLKCON |= (1 << 2); /* set IDLE bit */
/* Flush DCache */ /* Flush DCache */
invalidate_dcache_range((void *)(((int) &lcd_framebuffer)+(y * sizeof(fb_data) * LCD_WIDTH)), (height * sizeof(fb_data) * LCD_WIDTH)); invalidate_dcache_range((void *)(((int) &lcd_framebuffer[0][0])+(y * sizeof(fb_data) * LCD_WIDTH)), (height * sizeof(fb_data) * LCD_WIDTH));
/* set DMA dest */ /* set DMA dest */
DIDST1 = ((int) FRAME) + (y * sizeof(fb_data) * LCD_WIDTH); DIDST1 = ((int) FRAME) + (y * sizeof(fb_data) * LCD_WIDTH);
@ -96,7 +96,7 @@ void lcd_update_rect(int x, int y, int width, int height)
DCON1 = ((1<<30) | (1<<28) | (1<<27) | (1<<22) | (2<<20)) | ((height * sizeof(fb_data) * LCD_WIDTH) >> 4); DCON1 = ((1<<30) | (1<<28) | (1<<27) | (1<<22) | (2<<20)) | ((height * sizeof(fb_data) * LCD_WIDTH) >> 4);
/* set DMA source */ /* set DMA source */
DISRC1 = ((int) &lcd_framebuffer) + (y * sizeof(fb_data) * LCD_WIDTH) + 0x30000000; DISRC1 = ((int) &lcd_framebuffer[0][0]) + (y * sizeof(fb_data) * LCD_WIDTH) + 0x30000000;
/* memory is on AHB bus, increment addresses */ /* memory is on AHB bus, increment addresses */
DISRCC1 = 0x00; DISRCC1 = 0x00;
@ -108,7 +108,7 @@ void lcd_update_rect(int x, int y, int width, int height)
/* Wait for transfer to complete */ /* Wait for transfer to complete */
while((DSTAT1 & 0x000fffff)) while((DSTAT1 & 0x000fffff))
yield(); CLKCON |= (1 << 2); /* set IDLE bit */
} }
else else
memcpy(((char*)FRAME) + (y * sizeof(fb_data) * LCD_WIDTH), ((char *)&lcd_framebuffer) + (y * sizeof(fb_data) * LCD_WIDTH), ((height * sizeof(fb_data) * LCD_WIDTH))); memcpy(((char*)FRAME) + (y * sizeof(fb_data) * LCD_WIDTH), ((char *)&lcd_framebuffer) + (y * sizeof(fb_data) * LCD_WIDTH), ((height * sizeof(fb_data) * LCD_WIDTH)));
@ -159,8 +159,9 @@ void lcd_clear_display_dma(void)
void *src; void *src;
bool inc = false; bool inc = false;
if(!lcd_on) if(!lcd_on) {
yield(); sleep(200);
}
if (lcd_get_drawmode() & DRMODE_INVERSEVID) if (lcd_get_drawmode() & DRMODE_INVERSEVID)
src = fg_pattern_blit; src = fg_pattern_blit;
else else
@ -177,16 +178,16 @@ void lcd_clear_display_dma(void)
} }
/* Wait for any pending transfer to complete */ /* Wait for any pending transfer to complete */
while((DSTAT3 & 0x000fffff)) while((DSTAT3 & 0x000fffff))
yield(); CLKCON |= (1 << 2); /* set IDLE bit */
DMASKTRIG3 |= 0x4; /* Stop controller */ DMASKTRIG3 |= 0x4; /* Stop controller */
DIDST3 = ((int) lcd_framebuffer) + 0x30000000; /* set DMA dest, physical address */ DIDST3 = ((int) &lcd_framebuffer[0][0]) + 0x30000000; /* set DMA dest, physical address */
DIDSTC3 = 0; /* Dest on AHB, increment */ DIDSTC3 = 0; /* Dest on AHB, increment */
DISRC3 = ((int) src) + 0x30000000; /* Set source, in physical space */ DISRC3 = ((int) src) + 0x30000000; /* Set source, in physical space */
DISRCC3 = inc ? 0x00 : 0x01; /* memory is on AHB bus, increment addresses based on backdrop */ DISRCC3 = inc ? 0x00 : 0x01; /* memory is on AHB bus, increment addresses based on backdrop */
/* Handshake on AHB, Burst mode, whole service mode, no reload, move 32-bits */ /* Handshake on AHB, Burst mode, whole service mode, no reload, move 32-bits */
DCON3 = ((1<<30) | (1<<28) | (1<<27) | (1<<22) | (2<<20)) | (sizeof(lcd_framebuffer) >> 4); DCON3 = ((1<<30) | (1<<28) | (1<<27) | (1<<22) | (2<<20)) | ((LCD_WIDTH*LCD_HEIGHT*sizeof(fb_data)) >> 4);
/* Dump DCache for dest, we are about to overwrite it with DMA */ /* Dump DCache for dest, we are about to overwrite it with DMA */
invalidate_dcache_range((void *)lcd_framebuffer, sizeof(lcd_framebuffer)); invalidate_dcache_range((void *)lcd_framebuffer, sizeof(lcd_framebuffer));
@ -197,7 +198,7 @@ void lcd_clear_display_dma(void)
/* Wait for transfer to complete */ /* Wait for transfer to complete */
while((DSTAT3 & 0x000fffff)) while((DSTAT3 & 0x000fffff))
yield(); CLKCON |= (1 << 2); /* set IDLE bit */
} }
void lcd_clear_display(void) void lcd_clear_display(void)