summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bootloader/ondavx747.c59
-rw-r--r--firmware/export/r61509.h10
-rw-r--r--firmware/target/mips/ingenic_jz47xx/ata-nand-jz4740.c24
-rw-r--r--firmware/target/mips/ingenic_jz47xx/lcd-jz4740.c13
-rw-r--r--firmware/target/mips/ingenic_jz47xx/onda_vx747/lcd-onda_vx747.c13
-rw-r--r--firmware/target/mips/ingenic_jz47xx/system-jz4740.c2
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 @@
#include "button.h"
#include "timefuncs.h"
#include "rtc.h"
-
-int _line = 1;
-char _printfbuf[256];
-
-/* This is all rather hacky, but it works... */
-void _printf(const char *format, ...)
-{
- int len;
- unsigned char *ptr;
- va_list ap;
- va_start(ap, format);
-
- ptr = _printfbuf;
- len = vsnprintf(ptr, sizeof(_printfbuf), format, ap);
- va_end(ap);
-
- int i;
- for(i=0; i<1; i++)
- {
- lcd_puts(0, _line++, ptr);
- lcd_update();
- }
- if(_line >= LCD_HEIGHT/SYSFONT_HEIGHT)
- _line = 1;
-}
+#include "common.h"
static void audiotest(void)
{
@@ -101,7 +77,7 @@ static void jz_nand_scan_id(void)
dwNandID = ((cData[0] & 0xff) << 8) | (cData[1] & 0xff);
- _printf("NAND Flash 1: 0x%x is found [0x%x 0x%x 0x%x]", dwNandID, cData[2], cData[3], cData[4]);
+ printf("NAND Flash 1: 0x%x is found [0x%x 0x%x 0x%x]", dwNandID, cData[2], cData[3], cData[4]);
JZ_NAND_SELECT(2);
REG_NAND_CMD = NAND_CMD_READ_ID1;
@@ -115,7 +91,7 @@ static void jz_nand_scan_id(void)
dwNandID = ((cData[0] & 0xff) << 8) | (cData[1] & 0xff);
- _printf("NAND Flash 2: 0x%x is found [0x%x 0x%x 0x%x]", dwNandID, cData[2], cData[3], cData[4]);
+ printf("NAND Flash 2: 0x%x is found [0x%x 0x%x 0x%x]", dwNandID, cData[2], cData[3], cData[4]);
JZ_NAND_SELECT(3);
@@ -130,7 +106,7 @@ static void jz_nand_scan_id(void)
dwNandID = ((cData[0] & 0xff) << 8) | (cData[1] & 0xff);
- _printf("NAND Flash 3: 0x%x is found [0x%x 0x%x 0x%x]", dwNandID, cData[2], cData[3], cData[4]);
+ printf("NAND Flash 3: 0x%x is found [0x%x 0x%x 0x%x]", dwNandID, cData[2], cData[3], cData[4]);
JZ_NAND_SELECT(4);
REG_NAND_CMD = NAND_CMD_READ_ID1;
@@ -144,7 +120,7 @@ static void jz_nand_scan_id(void)
dwNandID = ((cData[0] & 0xff) << 8) | (cData[1] & 0xff);
- _printf("NAND Flash 4: 0x%x is found [0x%x 0x%x 0x%x]", dwNandID, cData[2], cData[3], cData[4]);
+ printf("NAND Flash 4: 0x%x is found [0x%x 0x%x 0x%x]", dwNandID, cData[2], cData[3], cData[4]);
}
static void jz_store_icache(void)
@@ -190,24 +166,33 @@ int main(void)
int touch, btn;
lcd_clear_display();
- _printf("Rockbox bootloader v0.000001");
+ printf("Rockbox bootloader v0.000001");
jz_nand_scan_id();
- _printf("Test");
+ printf("REG_EMC_SACR0: 0x%x", REG_EMC_SACR0 >> EMC_SACR_BASE_BIT);
+ printf("REG_EMC_SACR1: 0x%x", REG_EMC_SACR1 >> EMC_SACR_BASE_BIT);
+ printf("REG_EMC_SACR2: 0x%x", REG_EMC_SACR2 >> EMC_SACR_BASE_BIT);
+ printf("REG_EMC_SACR3: 0x%x", REG_EMC_SACR3 >> EMC_SACR_BASE_BIT);
+ printf("REG_EMC_SACR4: 0x%x", REG_EMC_SACR4 >> EMC_SACR_BASE_BIT);
+ printf("REG_EMC_DMAR0: 0x%x", REG_EMC_DMAR0 >> EMC_DMAR_BASE_BIT);
while(1)
{
btn = button_read_device(&touch);
if(btn & BUTTON_VOL_DOWN)
- _printf("BUTTON_VOL_DOWN");
+ printf("BUTTON_VOL_DOWN");
if(btn & BUTTON_MENU)
- _printf("BUTTON_MENU");
+ printf("BUTTON_MENU");
if(btn & BUTTON_VOL_UP)
- _printf("BUTTON_VOL_UP");
+ printf("BUTTON_VOL_UP");
if(btn & BUTTON_POWER)
- _printf("BUTTON_POWER");
+ printf("BUTTON_POWER");
if(button_hold())
- _printf("BUTTON_HOLD");
+ printf("BUTTON_HOLD");
if(touch != 0)
- _printf("X: %d Y: %d", touch>>16, touch&0xFFFF);
+ {
+ lcd_set_foreground(LCD_RGBPACK(touch & 0xFF, (touch >> 8)&0xFF, (touch >> 16)&0xFF));
+ lcd_fillrect((touch>>16)-10, (touch&0xFFFF)-10, 20, 20);
+ lcd_update();
+ }
/*_printf("%02d/%02d/%04d %02d:%02d:%02d", get_time()->tm_mday, get_time()->tm_mon, get_time()->tm_year,
get_time()->tm_hour, get_time()->tm_min, get_time()->tm_sec);*/
}
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 @@
#define REG_DRIVER_OUTPUT 0x001
#define REG_LCD_DR_WAVE_CTRL 0x002
#define REG_ENTRY_MODE 0x003
+#define REG_OUTL_SHARP_CTRL 0x006
#define REG_DISP_CTRL1 0x007
#define REG_DISP_CTRL2 0x008
#define REG_DISP_CTRL3 0x009
@@ -106,6 +107,12 @@
#define ENTRY_MODE_AM (1 << 3)
#define ENTRY_MODE_EPF(n) (n & 3)
+#define OUTL_SHARP_CTRL_EGMODE (1 << 15)
+#define OUTL_SHARP_CTRL_AVST(n) ((n & 7) << 7)
+#define OUTL_SHARP_CTRL_ADST(n) ((n & 7) << 4)
+#define OUTL_SHARP_CTRL_DTHU(n) ((n & 3) << 2)
+#define OUTL_SHARP_CTRL_DTHL(n) (n & 3)
+
#define DISP_CTRL1_PTDE(n) ((n & 4) << 12)
#define DISP_CTRL1_BASEE (1 << 8)
#define DISP_CTRL1_VON (1 << 6)
@@ -123,7 +130,4 @@
#define SOFT_RESET(n) (n << 0)
-#define ENDIAN_CTRL_BIG
-#define ENDIAN_CTRL_LITTLE
-
#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
(void)buf;
return 0;
}
+
+static int jz_device_ready(void)
+{
+ int ready, wait = 10;
+ while (wait--);
+ ready = __gpio_get_pin(32*2+30);
+ return ready;
+}
+
+int ata_init(void)
+{
+ /*
+ * EMC setup
+ */
+
+ /* Set NFE bit */
+ REG_EMC_NFCSR |= EMC_NFCSR_NFE1;
+
+ /* Read/Write timings */
+ REG_EMC_SMCR1 = (EMC_SMCR_BL_4 | EMC_SMCR_BW_8BIT | 4 << EMC_SMCR_TAS_BIT
+ | 4 << EMC_SMCR_TAH_BIT | 4 << EMC_SMCR_TBP_BIT | 4 << EMC_SMCR_TAW_BIT
+ | 4 << EMC_SMCR_STRV_BIT);
+ return 0;
+}
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)
return _lcd_on;
}
+void lcd_copy_buffer_rect(fb_data* dest, fb_data* src, int width, int height)
+{
+ int i;
+ for(i=0; i<width*height; i++)
+ *dest++ = *src++;
+}
+
#define LCDADDR(x, y) ((unsigned int)&lcd_framebuffer[(y)][(x)])
#define LCD_UNCACHED(addr) ((unsigned int)(addr) | 0xA0000000)
@@ -57,11 +64,12 @@ void lcd_update_rect(int x, int y, int width, int height)
{
/* HACKY... */
x=0; y=0; width=400; height=240;
+
lcd_set_target(x, y, width-1, height-1);
REG_DMAC_DCCSR(0) = 0;
REG_DMAC_DRSR(0) = DMAC_DRSR_RS_SLCD; /* source = SLCD */
- REG_DMAC_DSAR(0) = LCDADDR(x,y) & 0x1FFFFFFF;
+ REG_DMAC_DSAR(0) = LCDADDR(x, y) & 0x1FFFFFFF;
#if 0
REG_DMAC_DTAR(0) = LCD_UNCACHED(SLCD_FIFO);
#else
@@ -73,13 +81,12 @@ void lcd_update_rect(int x, int y, int width, int height)
| 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) */
- jz_flush_icache();
+ jz_flush_dcache();
REG_DMAC_DMACR = DMAC_DMACR_DMAE;
while( !(REG_DMAC_DCCSR(0) & DMAC_DCCSR_TT) )
asm("nop");
-
//REG_DMAC_DCCSR(0) &= ~DMAC_DCCSR_TT;
}
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)
SLCD_SEND_COMMAND(REG_DRIVER_OUTPUT, 0x100);
SLCD_SEND_COMMAND(REG_LCD_DR_WAVE_CTRL, 0x100);
- SLCD_SEND_COMMAND(REG_ENTRY_MODE, (ENTRY_MODE_BGR | ENTRY_MODE_VID | ENTRY_MODE_HID));
+#if CONFIG_ORIENTATION == SCREEN_PORTRAIT
+ SLCD_SEND_COMMAND(REG_ENTRY_MODE, (ENTRY_MODE_BGR | ENTRY_MODE_VID | ENTRY_MODE_HID | ENTRY_MODE_HWM));
+#else
+ SLCD_SEND_COMMAND(REG_ENTRY_MODE, (ENTRY_MODE_BGR | ENTRY_MODE_VID | ENTRY_MODE_AM | ENTRY_MODE_HWM));
+#endif
SLCD_SEND_COMMAND(REG_DISP_CTRL2, 0x503);
SLCD_SEND_COMMAND(REG_DISP_CTRL3, 1);
SLCD_SEND_COMMAND(REG_LPCTRL, 0x10);
@@ -193,15 +197,12 @@ static void _set_lcd_clock(void)
int pll_div;
__cpm_stop_lcd();
- pll_div = ( REG_CPM_CPCCR & CPM_CPCCR_PCS ); /* clock source,0:pllout/2 1: pllout */
+ pll_div = ( REG_CPM_CPCCR & CPM_CPCCR_PCS ); /* clock source, 0:pllout/2 1: pllout */
pll_div = pll_div ? 1 : 2 ;
val = ( __cpm_get_pllout()/pll_div ) / 336000000;
val--;
if ( val > 0x1ff )
- {
- //printf("CPM_LPCDR too large, set it to 0x1ff\n");
- val = 0x1ff;
- }
+ val = 0x1ff; /* CPM_LPCDR is too large, set it to 0x1ff */
__cpm_set_pixdiv(val);
__cpm_start_lcd();
}
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 @@
void intr_handler(void)
{
- _printf("Interrupt!");
+ //printf("Interrupt!");
return;
}