diff options
author | Rob Purchase <shotofadds@rockbox.org> | 2008-02-13 23:50:44 +0000 |
---|---|---|
committer | Rob Purchase <shotofadds@rockbox.org> | 2008-02-13 23:50:44 +0000 |
commit | addb5228ece29ce1a17591aa3c8078566ce1dbe6 (patch) | |
tree | 9c2a5870546ac6efbd272f9e8847b9cb0efee4de /bootloader | |
parent | e319f68a814b902bc01cb2f61059d12b9939774a (diff) | |
download | rockbox-addb5228ece29ce1a17591aa3c8078566ce1dbe6.tar.gz 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')
-rw-r--r-- | bootloader/telechips.c | 74 |
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) | |||
54 | int button; | 54 | int button; |
55 | int power_count = 0; | 55 | int power_count = 0; |
56 | int count = 0; | 56 | int count = 0; |
57 | int i; | ||
58 | bool do_power_off = false; | 57 | bool do_power_off = false; |
58 | |||
59 | #if defined(COWON_D2) | ||
60 | int i,rc,fd,len; | ||
61 | int* buf = (int*)0x21000000; /* Unused DRAM */ | ||
62 | #endif | ||
59 | 63 | ||
64 | power_init(); | ||
65 | lcd_init(); | ||
60 | system_init(); | 66 | system_init(); |
67 | |||
68 | #if defined(COWON_D2) | ||
69 | kernel_init(); | ||
70 | #endif | ||
71 | |||
61 | adc_init(); | 72 | adc_init(); |
62 | lcd_init(); | 73 | button_init(); |
74 | backlight_init(); | ||
75 | |||
63 | font_init(); | 76 | font_init(); |
64 | 77 | ||
78 | lcd_setfont(FONT_SYSFIXED); | ||
79 | |||
65 | #if defined(COWON_D2) | 80 | #if defined(COWON_D2) |
66 | lcd_enable(true); | 81 | lcd_enable(true); |
67 | #endif | 82 | #endif |
@@ -69,7 +84,50 @@ void* main(void) | |||
69 | _backlight_on(); | 84 | _backlight_on(); |
70 | 85 | ||
71 | #if defined(COWON_D2) | 86 | #if defined(COWON_D2) |
72 | ata_init(); | 87 | printf("ATA"); |
88 | rc = ata_init(); | ||
89 | if(rc) | ||
90 | { | ||
91 | reset_screen(); | ||
92 | error(EATA, rc); | ||
93 | } | ||
94 | |||
95 | printf("mount"); | ||
96 | rc = disk_mount_all(); | ||
97 | if (rc<=0) | ||
98 | { | ||
99 | error(EDISK,rc); | ||
100 | } | ||
101 | |||
102 | #if 0 | ||
103 | printf("opening test file..."); | ||
104 | |||
105 | fd = open("/test.bin", O_RDONLY); | ||
106 | if (fd < 0) panicf("could not open test file"); | ||
107 | |||
108 | len = filesize(fd); | ||
109 | printf("Length: %x", len); | ||
110 | |||
111 | lseek(fd, 0, SEEK_SET); | ||
112 | read(fd, buf, len); | ||
113 | close(fd); | ||
114 | |||
115 | printf("testing contents..."); | ||
116 | |||
117 | i = 0; | ||
118 | while (buf[i] == i && i<(len/4)) { i++; } | ||
119 | |||
120 | if (i < len/4) | ||
121 | { | ||
122 | printf("mismatch at %x [0x%x]", i, buf[i]); | ||
123 | } | ||
124 | else | ||
125 | { | ||
126 | printf("passed!"); | ||
127 | } | ||
128 | while (!button_read_device()) {}; | ||
129 | while (button_read_device()) {}; | ||
130 | #endif | ||
73 | #endif | 131 | #endif |
74 | 132 | ||
75 | while(!do_power_off) { | 133 | while(!do_power_off) { |
@@ -103,8 +161,9 @@ void* main(void) | |||
103 | printf("ADC%d: 0x%04x",i,adc_read(i)); | 161 | printf("ADC%d: 0x%04x",i,adc_read(i)); |
104 | } | 162 | } |
105 | 163 | ||
106 | /* TODO: Establish how the touchscreen driver is going to work. | 164 | /* TODO: Move this stuff out to a touchscreen driver and establish |
107 | Since it needs I2C read/write, it can't easily go on a tick task */ | 165 | how such a beast is going to work. Since it needs I2C read/write, |
166 | it can't easily go on an interrupt-based tick task. */ | ||
108 | { | 167 | { |
109 | unsigned char buf[] = { 0x2f, (0xE<<1) | 1, /* ADC start for X+Y */ | 168 | unsigned char buf[] = { 0x2f, (0xE<<1) | 1, /* ADC start for X+Y */ |
110 | 0, 0, 0 }; | 169 | 0, 0, 0 }; |
@@ -115,6 +174,11 @@ void* main(void) | |||
115 | y = (buf[4] << 2) | ((buf[3] & 0xC) >> 2); | 174 | y = (buf[4] << 2) | ((buf[3] & 0xC) >> 2); |
116 | printf("X: 0x%03x Y: 0x%03x",x,y); | 175 | printf("X: 0x%03x Y: 0x%03x",x,y); |
117 | 176 | ||
177 | x = (x*LCD_WIDTH) / 1024; | ||
178 | y = (y*LCD_HEIGHT) / 1024; | ||
179 | lcd_hline(x-5, x+5, y); | ||
180 | lcd_vline(x, y-5, y+5); | ||
181 | |||
118 | buf[0] = 0x2f; | 182 | buf[0] = 0x2f; |
119 | buf[1] = (0xF<<1) | 1; /* ADC start for P1+P2 */ | 183 | buf[1] = (0xF<<1) | 1; /* ADC start for P1+P2 */ |
120 | i2c_write(0x10, buf, 2); | 184 | i2c_write(0x10, buf, 2); |