diff options
author | Maurus Cuelenaere <mcuelenaere@gmail.com> | 2008-07-16 15:25:35 +0000 |
---|---|---|
committer | Maurus Cuelenaere <mcuelenaere@gmail.com> | 2008-07-16 15:25:35 +0000 |
commit | 975261f003ab7c8bc917a932f5c6fc657ea78143 (patch) | |
tree | 750fca11be2e1a839607cd6698754d64e1630a78 | |
parent | 753cac37b791ce4f744404cd82f4eab98dc56d82 (diff) | |
download | rockbox-975261f003ab7c8bc917a932f5c6fc657ea78143.tar.gz rockbox-975261f003ab7c8bc917a932f5c6fc657ea78143.zip |
Fix the LCD bug!
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18071 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | bootloader/ondavx747.c | 59 | ||||
-rw-r--r-- | firmware/export/r61509.h | 10 | ||||
-rw-r--r-- | firmware/target/mips/ingenic_jz47xx/ata-nand-jz4740.c | 24 | ||||
-rw-r--r-- | firmware/target/mips/ingenic_jz47xx/lcd-jz4740.c | 13 | ||||
-rw-r--r-- | firmware/target/mips/ingenic_jz47xx/onda_vx747/lcd-onda_vx747.c | 13 | ||||
-rw-r--r-- | firmware/target/mips/ingenic_jz47xx/system-jz4740.c | 2 |
6 files changed, 71 insertions, 50 deletions
diff --git a/bootloader/ondavx747.c b/bootloader/ondavx747.c index 5333ac3b1f..96c4c6cfb7 100644 --- a/bootloader/ondavx747.c +++ b/bootloader/ondavx747.c | |||
@@ -32,31 +32,7 @@ | |||
32 | #include "button.h" | 32 | #include "button.h" |
33 | #include "timefuncs.h" | 33 | #include "timefuncs.h" |
34 | #include "rtc.h" | 34 | #include "rtc.h" |
35 | 35 | #include "common.h" | |
36 | int _line = 1; | ||
37 | char _printfbuf[256]; | ||
38 | |||
39 | /* This is all rather hacky, but it works... */ | ||
40 | void _printf(const char *format, ...) | ||
41 | { | ||
42 | int len; | ||
43 | unsigned char *ptr; | ||
44 | va_list ap; | ||
45 | va_start(ap, format); | ||
46 | |||
47 | ptr = _printfbuf; | ||
48 | len = vsnprintf(ptr, sizeof(_printfbuf), format, ap); | ||
49 | va_end(ap); | ||
50 | |||
51 | int i; | ||
52 | for(i=0; i<1; i++) | ||
53 | { | ||
54 | lcd_puts(0, _line++, ptr); | ||
55 | lcd_update(); | ||
56 | } | ||
57 | if(_line >= LCD_HEIGHT/SYSFONT_HEIGHT) | ||
58 | _line = 1; | ||
59 | } | ||
60 | 36 | ||
61 | static void audiotest(void) | 37 | static void audiotest(void) |
62 | { | 38 | { |
@@ -101,7 +77,7 @@ static void jz_nand_scan_id(void) | |||
101 | 77 | ||
102 | dwNandID = ((cData[0] & 0xff) << 8) | (cData[1] & 0xff); | 78 | dwNandID = ((cData[0] & 0xff) << 8) | (cData[1] & 0xff); |
103 | 79 | ||
104 | _printf("NAND Flash 1: 0x%x is found [0x%x 0x%x 0x%x]", dwNandID, cData[2], cData[3], cData[4]); | 80 | printf("NAND Flash 1: 0x%x is found [0x%x 0x%x 0x%x]", dwNandID, cData[2], cData[3], cData[4]); |
105 | 81 | ||
106 | JZ_NAND_SELECT(2); | 82 | JZ_NAND_SELECT(2); |
107 | REG_NAND_CMD = NAND_CMD_READ_ID1; | 83 | REG_NAND_CMD = NAND_CMD_READ_ID1; |
@@ -115,7 +91,7 @@ static void jz_nand_scan_id(void) | |||
115 | 91 | ||
116 | dwNandID = ((cData[0] & 0xff) << 8) | (cData[1] & 0xff); | 92 | dwNandID = ((cData[0] & 0xff) << 8) | (cData[1] & 0xff); |
117 | 93 | ||
118 | _printf("NAND Flash 2: 0x%x is found [0x%x 0x%x 0x%x]", dwNandID, cData[2], cData[3], cData[4]); | 94 | printf("NAND Flash 2: 0x%x is found [0x%x 0x%x 0x%x]", dwNandID, cData[2], cData[3], cData[4]); |
119 | 95 | ||
120 | 96 | ||
121 | JZ_NAND_SELECT(3); | 97 | JZ_NAND_SELECT(3); |
@@ -130,7 +106,7 @@ static void jz_nand_scan_id(void) | |||
130 | 106 | ||
131 | dwNandID = ((cData[0] & 0xff) << 8) | (cData[1] & 0xff); | 107 | dwNandID = ((cData[0] & 0xff) << 8) | (cData[1] & 0xff); |
132 | 108 | ||
133 | _printf("NAND Flash 3: 0x%x is found [0x%x 0x%x 0x%x]", dwNandID, cData[2], cData[3], cData[4]); | 109 | printf("NAND Flash 3: 0x%x is found [0x%x 0x%x 0x%x]", dwNandID, cData[2], cData[3], cData[4]); |
134 | 110 | ||
135 | JZ_NAND_SELECT(4); | 111 | JZ_NAND_SELECT(4); |
136 | REG_NAND_CMD = NAND_CMD_READ_ID1; | 112 | REG_NAND_CMD = NAND_CMD_READ_ID1; |
@@ -144,7 +120,7 @@ static void jz_nand_scan_id(void) | |||
144 | 120 | ||
145 | dwNandID = ((cData[0] & 0xff) << 8) | (cData[1] & 0xff); | 121 | dwNandID = ((cData[0] & 0xff) << 8) | (cData[1] & 0xff); |
146 | 122 | ||
147 | _printf("NAND Flash 4: 0x%x is found [0x%x 0x%x 0x%x]", dwNandID, cData[2], cData[3], cData[4]); | 123 | printf("NAND Flash 4: 0x%x is found [0x%x 0x%x 0x%x]", dwNandID, cData[2], cData[3], cData[4]); |
148 | } | 124 | } |
149 | 125 | ||
150 | static void jz_store_icache(void) | 126 | static void jz_store_icache(void) |
@@ -190,24 +166,33 @@ int main(void) | |||
190 | 166 | ||
191 | int touch, btn; | 167 | int touch, btn; |
192 | lcd_clear_display(); | 168 | lcd_clear_display(); |
193 | _printf("Rockbox bootloader v0.000001"); | 169 | printf("Rockbox bootloader v0.000001"); |
194 | jz_nand_scan_id(); | 170 | jz_nand_scan_id(); |
195 | _printf("Test"); | 171 | printf("REG_EMC_SACR0: 0x%x", REG_EMC_SACR0 >> EMC_SACR_BASE_BIT); |
172 | printf("REG_EMC_SACR1: 0x%x", REG_EMC_SACR1 >> EMC_SACR_BASE_BIT); | ||
173 | printf("REG_EMC_SACR2: 0x%x", REG_EMC_SACR2 >> EMC_SACR_BASE_BIT); | ||
174 | printf("REG_EMC_SACR3: 0x%x", REG_EMC_SACR3 >> EMC_SACR_BASE_BIT); | ||
175 | printf("REG_EMC_SACR4: 0x%x", REG_EMC_SACR4 >> EMC_SACR_BASE_BIT); | ||
176 | printf("REG_EMC_DMAR0: 0x%x", REG_EMC_DMAR0 >> EMC_DMAR_BASE_BIT); | ||
196 | while(1) | 177 | while(1) |
197 | { | 178 | { |
198 | btn = button_read_device(&touch); | 179 | btn = button_read_device(&touch); |
199 | if(btn & BUTTON_VOL_DOWN) | 180 | if(btn & BUTTON_VOL_DOWN) |
200 | _printf("BUTTON_VOL_DOWN"); | 181 | printf("BUTTON_VOL_DOWN"); |
201 | if(btn & BUTTON_MENU) | 182 | if(btn & BUTTON_MENU) |
202 | _printf("BUTTON_MENU"); | 183 | printf("BUTTON_MENU"); |
203 | if(btn & BUTTON_VOL_UP) | 184 | if(btn & BUTTON_VOL_UP) |
204 | _printf("BUTTON_VOL_UP"); | 185 | printf("BUTTON_VOL_UP"); |
205 | if(btn & BUTTON_POWER) | 186 | if(btn & BUTTON_POWER) |
206 | _printf("BUTTON_POWER"); | 187 | printf("BUTTON_POWER"); |
207 | if(button_hold()) | 188 | if(button_hold()) |
208 | _printf("BUTTON_HOLD"); | 189 | printf("BUTTON_HOLD"); |
209 | if(touch != 0) | 190 | if(touch != 0) |
210 | _printf("X: %d Y: %d", touch>>16, touch&0xFFFF); | 191 | { |
192 | lcd_set_foreground(LCD_RGBPACK(touch & 0xFF, (touch >> 8)&0xFF, (touch >> 16)&0xFF)); | ||
193 | lcd_fillrect((touch>>16)-10, (touch&0xFFFF)-10, 20, 20); | ||
194 | lcd_update(); | ||
195 | } | ||
211 | /*_printf("%02d/%02d/%04d %02d:%02d:%02d", get_time()->tm_mday, get_time()->tm_mon, get_time()->tm_year, | 196 | /*_printf("%02d/%02d/%04d %02d:%02d:%02d", get_time()->tm_mday, get_time()->tm_mon, get_time()->tm_year, |
212 | get_time()->tm_hour, get_time()->tm_min, get_time()->tm_sec);*/ | 197 | get_time()->tm_hour, get_time()->tm_min, get_time()->tm_sec);*/ |
213 | } | 198 | } |
diff --git a/firmware/export/r61509.h b/firmware/export/r61509.h index 519ad3ec86..53f0440742 100644 --- a/firmware/export/r61509.h +++ b/firmware/export/r61509.h | |||
@@ -29,6 +29,7 @@ | |||
29 | #define REG_DRIVER_OUTPUT 0x001 | 29 | #define REG_DRIVER_OUTPUT 0x001 |
30 | #define REG_LCD_DR_WAVE_CTRL 0x002 | 30 | #define REG_LCD_DR_WAVE_CTRL 0x002 |
31 | #define REG_ENTRY_MODE 0x003 | 31 | #define REG_ENTRY_MODE 0x003 |
32 | #define REG_OUTL_SHARP_CTRL 0x006 | ||
32 | #define REG_DISP_CTRL1 0x007 | 33 | #define REG_DISP_CTRL1 0x007 |
33 | #define REG_DISP_CTRL2 0x008 | 34 | #define REG_DISP_CTRL2 0x008 |
34 | #define REG_DISP_CTRL3 0x009 | 35 | #define REG_DISP_CTRL3 0x009 |
@@ -106,6 +107,12 @@ | |||
106 | #define ENTRY_MODE_AM (1 << 3) | 107 | #define ENTRY_MODE_AM (1 << 3) |
107 | #define ENTRY_MODE_EPF(n) (n & 3) | 108 | #define ENTRY_MODE_EPF(n) (n & 3) |
108 | 109 | ||
110 | #define OUTL_SHARP_CTRL_EGMODE (1 << 15) | ||
111 | #define OUTL_SHARP_CTRL_AVST(n) ((n & 7) << 7) | ||
112 | #define OUTL_SHARP_CTRL_ADST(n) ((n & 7) << 4) | ||
113 | #define OUTL_SHARP_CTRL_DTHU(n) ((n & 3) << 2) | ||
114 | #define OUTL_SHARP_CTRL_DTHL(n) (n & 3) | ||
115 | |||
109 | #define DISP_CTRL1_PTDE(n) ((n & 4) << 12) | 116 | #define DISP_CTRL1_PTDE(n) ((n & 4) << 12) |
110 | #define DISP_CTRL1_BASEE (1 << 8) | 117 | #define DISP_CTRL1_BASEE (1 << 8) |
111 | #define DISP_CTRL1_VON (1 << 6) | 118 | #define DISP_CTRL1_VON (1 << 6) |
@@ -123,7 +130,4 @@ | |||
123 | 130 | ||
124 | #define SOFT_RESET(n) (n << 0) | 131 | #define SOFT_RESET(n) (n << 0) |
125 | 132 | ||
126 | #define ENDIAN_CTRL_BIG | ||
127 | #define ENDIAN_CTRL_LITTLE | ||
128 | |||
129 | #endif /* __R61509_H */ | 133 | #endif /* __R61509_H */ |
diff --git a/firmware/target/mips/ingenic_jz47xx/ata-nand-jz4740.c b/firmware/target/mips/ingenic_jz47xx/ata-nand-jz4740.c index ad053c7deb..00165b2d2d 100644 --- a/firmware/target/mips/ingenic_jz47xx/ata-nand-jz4740.c +++ b/firmware/target/mips/ingenic_jz47xx/ata-nand-jz4740.c | |||
@@ -66,3 +66,27 @@ int ata_write_sectors(IF_MV2(int drive,) unsigned long start, int count, const v | |||
66 | (void)buf; | 66 | (void)buf; |
67 | return 0; | 67 | return 0; |
68 | } | 68 | } |
69 | |||
70 | static int jz_device_ready(void) | ||
71 | { | ||
72 | int ready, wait = 10; | ||
73 | while (wait--); | ||
74 | ready = __gpio_get_pin(32*2+30); | ||
75 | return ready; | ||
76 | } | ||
77 | |||
78 | int ata_init(void) | ||
79 | { | ||
80 | /* | ||
81 | * EMC setup | ||
82 | */ | ||
83 | |||
84 | /* Set NFE bit */ | ||
85 | REG_EMC_NFCSR |= EMC_NFCSR_NFE1; | ||
86 | |||
87 | /* Read/Write timings */ | ||
88 | REG_EMC_SMCR1 = (EMC_SMCR_BL_4 | EMC_SMCR_BW_8BIT | 4 << EMC_SMCR_TAS_BIT | ||
89 | | 4 << EMC_SMCR_TAH_BIT | 4 << EMC_SMCR_TBP_BIT | 4 << EMC_SMCR_TAW_BIT | ||
90 | | 4 << EMC_SMCR_STRV_BIT); | ||
91 | return 0; | ||
92 | } | ||
diff --git a/firmware/target/mips/ingenic_jz47xx/lcd-jz4740.c b/firmware/target/mips/ingenic_jz47xx/lcd-jz4740.c index 429178aeee..907351c64e 100644 --- a/firmware/target/mips/ingenic_jz47xx/lcd-jz4740.c +++ b/firmware/target/mips/ingenic_jz47xx/lcd-jz4740.c | |||
@@ -49,6 +49,13 @@ bool lcd_enabled(void) | |||
49 | return _lcd_on; | 49 | return _lcd_on; |
50 | } | 50 | } |
51 | 51 | ||
52 | void lcd_copy_buffer_rect(fb_data* dest, fb_data* src, int width, int height) | ||
53 | { | ||
54 | int i; | ||
55 | for(i=0; i<width*height; i++) | ||
56 | *dest++ = *src++; | ||
57 | } | ||
58 | |||
52 | #define LCDADDR(x, y) ((unsigned int)&lcd_framebuffer[(y)][(x)]) | 59 | #define LCDADDR(x, y) ((unsigned int)&lcd_framebuffer[(y)][(x)]) |
53 | #define LCD_UNCACHED(addr) ((unsigned int)(addr) | 0xA0000000) | 60 | #define LCD_UNCACHED(addr) ((unsigned int)(addr) | 0xA0000000) |
54 | 61 | ||
@@ -57,11 +64,12 @@ void lcd_update_rect(int x, int y, int width, int height) | |||
57 | { | 64 | { |
58 | /* HACKY... */ | 65 | /* HACKY... */ |
59 | x=0; y=0; width=400; height=240; | 66 | x=0; y=0; width=400; height=240; |
67 | |||
60 | lcd_set_target(x, y, width-1, height-1); | 68 | lcd_set_target(x, y, width-1, height-1); |
61 | 69 | ||
62 | REG_DMAC_DCCSR(0) = 0; | 70 | REG_DMAC_DCCSR(0) = 0; |
63 | REG_DMAC_DRSR(0) = DMAC_DRSR_RS_SLCD; /* source = SLCD */ | 71 | REG_DMAC_DRSR(0) = DMAC_DRSR_RS_SLCD; /* source = SLCD */ |
64 | REG_DMAC_DSAR(0) = LCDADDR(x,y) & 0x1FFFFFFF; | 72 | REG_DMAC_DSAR(0) = LCDADDR(x, y) & 0x1FFFFFFF; |
65 | #if 0 | 73 | #if 0 |
66 | REG_DMAC_DTAR(0) = LCD_UNCACHED(SLCD_FIFO); | 74 | REG_DMAC_DTAR(0) = LCD_UNCACHED(SLCD_FIFO); |
67 | #else | 75 | #else |
@@ -73,13 +81,12 @@ void lcd_update_rect(int x, int y, int width, int height) | |||
73 | | DMAC_DCMD_DWDH_16 | DMAC_DCMD_DS_16BIT); /* | (2 << 12) | (3 << 8) */ | 81 | | DMAC_DCMD_DWDH_16 | DMAC_DCMD_DS_16BIT); /* | (2 << 12) | (3 << 8) */ |
74 | REG_DMAC_DCCSR(0) = (DMAC_DCCSR_NDES | DMAC_DCCSR_EN); /* (1 << 31) | (1 << 0) */ | 82 | REG_DMAC_DCCSR(0) = (DMAC_DCCSR_NDES | DMAC_DCCSR_EN); /* (1 << 31) | (1 << 0) */ |
75 | 83 | ||
76 | jz_flush_icache(); | 84 | jz_flush_dcache(); |
77 | 85 | ||
78 | REG_DMAC_DMACR = DMAC_DMACR_DMAE; | 86 | REG_DMAC_DMACR = DMAC_DMACR_DMAE; |
79 | 87 | ||
80 | while( !(REG_DMAC_DCCSR(0) & DMAC_DCCSR_TT) ) | 88 | while( !(REG_DMAC_DCCSR(0) & DMAC_DCCSR_TT) ) |
81 | asm("nop"); | 89 | asm("nop"); |
82 | |||
83 | //REG_DMAC_DCCSR(0) &= ~DMAC_DCCSR_TT; | 90 | //REG_DMAC_DCCSR(0) &= ~DMAC_DCCSR_TT; |
84 | } | 91 | } |
85 | 92 | ||
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 e99bc178f1..33809bb50f 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 | |||
@@ -69,7 +69,11 @@ static void _display_init(void) | |||
69 | 69 | ||
70 | SLCD_SEND_COMMAND(REG_DRIVER_OUTPUT, 0x100); | 70 | SLCD_SEND_COMMAND(REG_DRIVER_OUTPUT, 0x100); |
71 | SLCD_SEND_COMMAND(REG_LCD_DR_WAVE_CTRL, 0x100); | 71 | SLCD_SEND_COMMAND(REG_LCD_DR_WAVE_CTRL, 0x100); |
72 | SLCD_SEND_COMMAND(REG_ENTRY_MODE, (ENTRY_MODE_BGR | ENTRY_MODE_VID | ENTRY_MODE_HID)); | 72 | #if CONFIG_ORIENTATION == SCREEN_PORTRAIT |
73 | SLCD_SEND_COMMAND(REG_ENTRY_MODE, (ENTRY_MODE_BGR | ENTRY_MODE_VID | ENTRY_MODE_HID | ENTRY_MODE_HWM)); | ||
74 | #else | ||
75 | SLCD_SEND_COMMAND(REG_ENTRY_MODE, (ENTRY_MODE_BGR | ENTRY_MODE_VID | ENTRY_MODE_AM | ENTRY_MODE_HWM)); | ||
76 | #endif | ||
73 | SLCD_SEND_COMMAND(REG_DISP_CTRL2, 0x503); | 77 | SLCD_SEND_COMMAND(REG_DISP_CTRL2, 0x503); |
74 | SLCD_SEND_COMMAND(REG_DISP_CTRL3, 1); | 78 | SLCD_SEND_COMMAND(REG_DISP_CTRL3, 1); |
75 | SLCD_SEND_COMMAND(REG_LPCTRL, 0x10); | 79 | SLCD_SEND_COMMAND(REG_LPCTRL, 0x10); |
@@ -193,15 +197,12 @@ static void _set_lcd_clock(void) | |||
193 | int pll_div; | 197 | int pll_div; |
194 | 198 | ||
195 | __cpm_stop_lcd(); | 199 | __cpm_stop_lcd(); |
196 | pll_div = ( REG_CPM_CPCCR & CPM_CPCCR_PCS ); /* clock source,0:pllout/2 1: pllout */ | 200 | pll_div = ( REG_CPM_CPCCR & CPM_CPCCR_PCS ); /* clock source, 0:pllout/2 1: pllout */ |
197 | pll_div = pll_div ? 1 : 2 ; | 201 | pll_div = pll_div ? 1 : 2 ; |
198 | val = ( __cpm_get_pllout()/pll_div ) / 336000000; | 202 | val = ( __cpm_get_pllout()/pll_div ) / 336000000; |
199 | val--; | 203 | val--; |
200 | if ( val > 0x1ff ) | 204 | if ( val > 0x1ff ) |
201 | { | 205 | val = 0x1ff; /* CPM_LPCDR is too large, set it to 0x1ff */ |
202 | //printf("CPM_LPCDR too large, set it to 0x1ff\n"); | ||
203 | val = 0x1ff; | ||
204 | } | ||
205 | __cpm_set_pixdiv(val); | 206 | __cpm_set_pixdiv(val); |
206 | __cpm_start_lcd(); | 207 | __cpm_start_lcd(); |
207 | } | 208 | } |
diff --git a/firmware/target/mips/ingenic_jz47xx/system-jz4740.c b/firmware/target/mips/ingenic_jz47xx/system-jz4740.c index ee50520243..2dca4619c0 100644 --- a/firmware/target/mips/ingenic_jz47xx/system-jz4740.c +++ b/firmware/target/mips/ingenic_jz47xx/system-jz4740.c | |||
@@ -26,7 +26,7 @@ | |||
26 | 26 | ||
27 | void intr_handler(void) | 27 | void intr_handler(void) |
28 | { | 28 | { |
29 | _printf("Interrupt!"); | 29 | //printf("Interrupt!"); |
30 | return; | 30 | return; |
31 | } | 31 | } |
32 | 32 | ||