diff options
author | Maurus Cuelenaere <mcuelenaere@gmail.com> | 2008-08-15 14:39:39 +0000 |
---|---|---|
committer | Maurus Cuelenaere <mcuelenaere@gmail.com> | 2008-08-15 14:39:39 +0000 |
commit | 57c0b6a4740d7a900dff7ff0230da1c7942a46b0 (patch) | |
tree | 9c32cb988e43886d3456e71044404cd7661edffb /firmware/target/mips | |
parent | bc712c9782adb5922a00cf85c71a081b0bbb4f6d (diff) |
Onda VX747:
* kill TABs in jz4740.h
* clean up LCD
* make CONFIG_ORIENTATION work in both ways
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18286 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/mips')
3 files changed, 35 insertions, 20 deletions
diff --git a/firmware/target/mips/ingenic_jz47xx/lcd-jz4740.c b/firmware/target/mips/ingenic_jz47xx/lcd-jz4740.c index f84d3a7deb..ca082781aa 100644 --- a/firmware/target/mips/ingenic_jz47xx/lcd-jz4740.c +++ b/firmware/target/mips/ingenic_jz47xx/lcd-jz4740.c @@ -23,6 +23,7 @@ #include "jz4740.h" #include "lcd.h" #include "lcd-target.h" +#include "system-target.h" static volatile bool _lcd_on = false; static volatile bool lcd_poweroff = false; @@ -55,26 +56,19 @@ bool lcd_enabled(void) /* Update a fraction of the display. */ void lcd_update_rect(int x, int y, int width, int height) { - /* STILL HACKY... */ - x=0; y=0; width=400; height=240; - - lcd_set_target(x, y, width-1, height-1); + lcd_set_target(x, y, width, height); REG_DMAC_DCCSR(0) = 0; REG_DMAC_DRSR(0) = DMAC_DRSR_RS_SLCD; /* source = SLCD */ REG_DMAC_DSAR(0) = ((unsigned int)&lcd_framebuffer[y][x]) & 0x1FFFFFFF; -#if 0 - REG_DMAC_DTAR(0) = UNCACHED_ADDRESS(SLCD_FIFO); -#else REG_DMAC_DTAR(0) = 0x130500B0; /* SLCD_FIFO */ -#endif - REG_DMAC_DTCR(0) = (width*height); + REG_DMAC_DTCR(0) = width*height; - REG_DMAC_DCMD(0) = (DMAC_DCMD_SAI | DMAC_DCMD_RDIL_IGN | DMAC_DCMD_SWDH_32 /* (1 << 23) | (0 << 16) | (0 << 14) */ + REG_DMAC_DCMD(0) = (DMAC_DCMD_SAI | DMAC_DCMD_RDIL_2 | DMAC_DCMD_SWDH_32 /* (1 << 23) | (0 << 16) | (0 << 14) */ | DMAC_DCMD_DWDH_16 | DMAC_DCMD_DS_16BIT); /* | (2 << 12) | (3 << 8) */ REG_DMAC_DCCSR(0) = (DMAC_DCCSR_NDES | DMAC_DCCSR_EN); /* (1 << 31) | (1 << 0) */ - __dcache_writeback_all(); + dma_cache_wback_inv((unsigned long)&lcd_framebuffer[y][x], width*height); REG_DMAC_DMACR = DMAC_DMACR_DMAE; diff --git a/firmware/target/mips/ingenic_jz47xx/onda_vx747/lcd-onda_vx747.c b/firmware/target/mips/ingenic_jz47xx/onda_vx747/lcd-onda_vx747.c index 33809bb50f..98fa8e7a20 100644 --- a/firmware/target/mips/ingenic_jz47xx/onda_vx747/lcd-onda_vx747.c +++ b/firmware/target/mips/ingenic_jz47xx/onda_vx747/lcd-onda_vx747.c @@ -95,10 +95,17 @@ static void _display_init(void) SLCD_SEND_COMMAND(REG_PWR_CTRL6, 1); SLCD_SEND_COMMAND(REG_RAM_HADDR_SET, 0); /* set cursor at x_start */ SLCD_SEND_COMMAND(REG_RAM_VADDR_SET, 0); /* set cursor at y_start */ +#if CONFIG_ORIENTATION == SCREEN_PORTRAIT SLCD_SEND_COMMAND(REG_RAM_HADDR_START, 0); /* y_start*/ SLCD_SEND_COMMAND(REG_RAM_HADDR_END, 239); /* y_end */ SLCD_SEND_COMMAND(REG_RAM_VADDR_START, 0); /* x_start */ SLCD_SEND_COMMAND(REG_RAM_VADDR_END, 399); /* x_end */ +#else + SLCD_SEND_COMMAND(REG_RAM_HADDR_START, 0); /* y_start*/ + SLCD_SEND_COMMAND(REG_RAM_HADDR_END, 399); /* y_end */ + SLCD_SEND_COMMAND(REG_RAM_VADDR_START, 0); /* x_start */ + SLCD_SEND_COMMAND(REG_RAM_VADDR_END, 239); /* x_end */ +#endif SLCD_SEND_COMMAND(REG_RW_NVM, 0); SLCD_SEND_COMMAND(REG_VCOM_HVOLTAGE1, 6); SLCD_SEND_COMMAND(REG_VCOM_HVOLTAGE2, 0); @@ -219,10 +226,17 @@ void lcd_init_controller(void) void lcd_set_target(short x, short y, short width, short height) { +#if CONFIG_ORIENTATION == SCREEN_PORTRAIT SLCD_SEND_COMMAND(REG_RAM_HADDR_START, y); /* y_start */ - SLCD_SEND_COMMAND(REG_RAM_HADDR_END, y+height); /* y_end */ + SLCD_SEND_COMMAND(REG_RAM_HADDR_END, y+width-1); /* y_end */ SLCD_SEND_COMMAND(REG_RAM_VADDR_START, x); /* x_start */ - SLCD_SEND_COMMAND(REG_RAM_VADDR_END, x+width); /* x_end */ + SLCD_SEND_COMMAND(REG_RAM_VADDR_END, x+height-1); /* x_end */ +#else + SLCD_SEND_COMMAND(REG_RAM_HADDR_START, y); /* y_start */ + SLCD_SEND_COMMAND(REG_RAM_HADDR_END, y+height-1); /* y_end */ + SLCD_SEND_COMMAND(REG_RAM_VADDR_START, x); /* x_start */ + SLCD_SEND_COMMAND(REG_RAM_VADDR_END, x+width-1); /* x_end */ +#endif SLCD_SEND_COMMAND(REG_RAM_HADDR_SET, x); /* set cursor at x_start */ SLCD_SEND_COMMAND(REG_RAM_VADDR_SET, y); /* set cursor at y_start */ SLCD_SET_COMMAND(REG_RW_GRAM); /* write data to GRAM */ diff --git a/firmware/target/mips/ingenic_jz47xx/onda_vx747/sadc-onda_vx747.c b/firmware/target/mips/ingenic_jz47xx/onda_vx747/sadc-onda_vx747.c index b5c817c367..e937c90bd3 100644 --- a/firmware/target/mips/ingenic_jz47xx/onda_vx747/sadc-onda_vx747.c +++ b/firmware/target/mips/ingenic_jz47xx/onda_vx747/sadc-onda_vx747.c @@ -66,10 +66,10 @@ void button_init_device(void) system_enable_irq(IRQ_SADC); REG_SADC_SAMETIME = 350; - REG_SADC_WAITTIME = 100; /* per 10 HZ */ + REG_SADC_WAITTIME = 100; REG_SADC_STATE &= (~REG_SADC_STATE); REG_SADC_CTRL &= (~(SADC_CTRL_PENDM | SADC_CTRL_PENUM | SADC_CTRL_TSRDYM)); - REG_SADC_ENA = (SADC_ENA_TSEN | REG_SADC_ENA); //| SADC_ENA_PBATEN | SADC_ENA_SADCINEN); + REG_SADC_ENA = SADC_ENA_TSEN; //| SADC_ENA_PBATEN | SADC_ENA_SADCINEN); __gpio_port_as_input(3, 29); __gpio_port_as_input(3, 27); @@ -78,21 +78,28 @@ void button_init_device(void) __gpio_port_as_input(3, 0); } -//static unsigned short touchdivider[2] = {14.5833*1000, 9*1000}; static int touch_to_pixels(short x, short y) { /* X:300 -> 3800 Y:300->3900 */ x -= 300; y -= 300; +#if CONFIG_ORIENTATION == SCREEN_PORTRAIT x /= 3200 / LCD_WIDTH; y /= 3600 / LCD_HEIGHT; - //x /= touchdivider[0]; - //y /= touchdivider[1]; - + y = LCD_HEIGHT - y; return (x << 16) | y; +#else + x /= 3200 / LCD_HEIGHT; + y /= 3600 / LCD_WIDTH; + + y = LCD_WIDTH - y; + x = LCD_HEIGHT - x; + + return (y << 16) | x; +#endif } int button_read_device(int *data) @@ -144,7 +151,7 @@ void SADC(void) { /* Pen down IRQ */ REG_SADC_CTRL &= (~(SADC_CTRL_PENUM | SADC_CTRL_TSRDYM)); - REG_SADC_CTRL |= (SADC_CTRL_PENDM);// | SADC_CTRL_TSRDYM); + REG_SADC_CTRL |= (SADC_CTRL_PENDM); pendown_flag = true; } if(state & SADC_CTRL_PENUM) |