summaryrefslogtreecommitdiffstats
path: root/bootloader/telechips.c
diff options
context:
space:
mode:
authorRob Purchase <shotofadds@rockbox.org>2008-02-13 23:50:44 +0000
committerRob Purchase <shotofadds@rockbox.org>2008-02-13 23:50:44 +0000
commitaddb5228ece29ce1a17591aa3c8078566ce1dbe6 (patch)
tree9c2a5870546ac6efbd272f9e8847b9cb0efee4de /bootloader/telechips.c
parente319f68a814b902bc01cb2f61059d12b9939774a (diff)
downloadrockbox-addb5228ece29ce1a17591aa3c8078566ce1dbe6.tar.gz
rockbox-addb5228ece29ce1a17591aa3c8078566ce1dbe6.tar.bz2
rockbox-addb5228ece29ce1a17591aa3c8078566ce1dbe6.zip
D2: Further work-in-progress on the NAND driver.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16308 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'bootloader/telechips.c')
-rw-r--r--bootloader/telechips.c74
1 files changed, 69 insertions, 5 deletions
diff --git a/bootloader/telechips.c b/bootloader/telechips.c
index f5669d0bbf..1918465aa2 100644
--- a/bootloader/telechips.c
+++ b/bootloader/telechips.c
@@ -54,14 +54,29 @@ void* main(void)
int button;
int power_count = 0;
int count = 0;
- int i;
bool do_power_off = false;
+
+#if defined(COWON_D2)
+ int i,rc,fd,len;
+ int* buf = (int*)0x21000000; /* Unused DRAM */
+#endif
+ power_init();
+ lcd_init();
system_init();
+
+#if defined(COWON_D2)
+ kernel_init();
+#endif
+
adc_init();
- lcd_init();
+ button_init();
+ backlight_init();
+
font_init();
+ lcd_setfont(FONT_SYSFIXED);
+
#if defined(COWON_D2)
lcd_enable(true);
#endif
@@ -69,7 +84,50 @@ void* main(void)
_backlight_on();
#if defined(COWON_D2)
- ata_init();
+ printf("ATA");
+ rc = ata_init();
+ if(rc)
+ {
+ reset_screen();
+ error(EATA, rc);
+ }
+
+ printf("mount");
+ rc = disk_mount_all();
+ if (rc<=0)
+ {
+ error(EDISK,rc);
+ }
+
+#if 0
+ printf("opening test file...");
+
+ fd = open("/test.bin", O_RDONLY);
+ if (fd < 0) panicf("could not open test file");
+
+ len = filesize(fd);
+ printf("Length: %x", len);
+
+ lseek(fd, 0, SEEK_SET);
+ read(fd, buf, len);
+ close(fd);
+
+ printf("testing contents...");
+
+ i = 0;
+ while (buf[i] == i && i<(len/4)) { i++; }
+
+ if (i < len/4)
+ {
+ printf("mismatch at %x [0x%x]", i, buf[i]);
+ }
+ else
+ {
+ printf("passed!");
+ }
+ while (!button_read_device()) {};
+ while (button_read_device()) {};
+#endif
#endif
while(!do_power_off) {
@@ -103,8 +161,9 @@ void* main(void)
printf("ADC%d: 0x%04x",i,adc_read(i));
}
- /* TODO: Establish how the touchscreen driver is going to work.
- Since it needs I2C read/write, it can't easily go on a tick task */
+ /* TODO: Move this stuff out to a touchscreen driver and establish
+ how such a beast is going to work. Since it needs I2C read/write,
+ it can't easily go on an interrupt-based tick task. */
{
unsigned char buf[] = { 0x2f, (0xE<<1) | 1, /* ADC start for X+Y */
0, 0, 0 };
@@ -115,6 +174,11 @@ void* main(void)
y = (buf[4] << 2) | ((buf[3] & 0xC) >> 2);
printf("X: 0x%03x Y: 0x%03x",x,y);
+ x = (x*LCD_WIDTH) / 1024;
+ y = (y*LCD_HEIGHT) / 1024;
+ lcd_hline(x-5, x+5, y);
+ lcd_vline(x, y-5, y+5);
+
buf[0] = 0x2f;
buf[1] = (0xF<<1) | 1; /* ADC start for P1+P2 */
i2c_write(0x10, buf, 2);