summaryrefslogtreecommitdiffstats
path: root/bootloader
diff options
context:
space:
mode:
authorDaniel Ankers <dan@weirdo.org.uk>2006-10-16 17:21:36 +0000
committerDaniel Ankers <dan@weirdo.org.uk>2006-10-16 17:21:36 +0000
commitd8ef7c58d83591bb0660fc4965cf2319fb5a4718 (patch)
treea71d3d9909cec32d3a8d22b10017a1e8959cfc16 /bootloader
parent55d1675ada5273a815966057b811605462e1f7bd (diff)
downloadrockbox-d8ef7c58d83591bb0660fc4965cf2319fb5a4718.tar.gz
rockbox-d8ef7c58d83591bb0660fc4965cf2319fb5a4718.tar.bz2
rockbox-d8ef7c58d83591bb0660fc4965cf2319fb5a4718.zip
Big Sansa update: Go back to using the common crt0-pp.S. Add LCD driver. Add ADC driver (may not be needed). Fix a bug in the button driver.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11237 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'bootloader')
-rw-r--r--bootloader/e200.c131
1 files changed, 112 insertions, 19 deletions
diff --git a/bootloader/e200.c b/bootloader/e200.c
index 91217f5c70..27b1118a1c 100644
--- a/bootloader/e200.c
+++ b/bootloader/e200.c
@@ -36,33 +36,61 @@
#include "power.h"
#include "file.h"
-void main(void)
+static inline void blink(void)
{
volatile unsigned int* ptr;
int i;
+ ptr = (volatile unsigned int*)0x70000020;
- while(1)
+ *ptr &= ~(1 << 13);
+ for(i = 0; i < 0xfffff; i++)
+ {
+ }
+ *ptr |= (1 << 13);
+ for(i = 0; i < 0xfffff; i++)
{
- // blink wheel backlight
- ptr = (volatile unsigned int*)0x70000020;
- if((*ptr) & (1 << 13))
- {
- *ptr = (*ptr) & ~(1 << 13);
-
- }
- else
- {
- *ptr = (*ptr) | (1 << 13);
- }
-
- // wait a while
- for(i = 0; i < 0xfffff; i++)
- {
- }
+ }
+}
+static inline void slow_blink(void)
+{
+ volatile unsigned int* ptr;
+ int i;
+ ptr = (volatile unsigned int*)0x70000020;
+
+ *ptr &= ~(1 << 13);
+ for(i = 0; i < (0xfffff); i++)
+ {
+ }
+ for(i = 0; i < (0xfffff); i++)
+ {
+ }
+ for(i = 0; i < (0xfffff); i++)
+ {
+ }
+
+ *ptr |= (1 << 13);
+ for(i = 0; i < (0xfffff); i++)
+ {
+ }
+ for(i = 0; i < (0xfffff); i++)
+ {
+ }
+ for(i = 0; i < (0xfffff); i++)
+ {
}
}
+static inline unsigned long get_pc(void)
+{
+ unsigned long pc;
+ asm volatile (
+ "mov %0, pc\n"
+ : "=r"(pc)
+ );
+ return pc;
+}
+
/* These functions are present in the firmware library, but we reimplement
them here because the originals do a lot more than we want */
@@ -72,7 +100,62 @@ void reset_poweroff_timer(void)
int dbg_ports(void)
{
- return 0;
+ unsigned int gpio_a, gpio_b, gpio_c, gpio_d;
+ unsigned int gpio_e, gpio_f, gpio_g, gpio_h;
+ unsigned int gpio_i, gpio_j, gpio_k, gpio_l;
+
+ char buf[128];
+ int line;
+
+ lcd_setmargins(0, 0);
+ lcd_clear_display();
+ lcd_setfont(FONT_SYSFIXED);
+
+ while(1)
+ {
+ gpio_a = GPIOA_INPUT_VAL;
+ gpio_b = GPIOB_INPUT_VAL;
+ gpio_c = GPIOC_INPUT_VAL;
+
+ gpio_g = GPIOG_INPUT_VAL;
+ gpio_h = GPIOH_INPUT_VAL;
+ gpio_i = GPIOI_INPUT_VAL;
+
+ line = 0;
+ snprintf(buf, sizeof(buf), "GPIO_A: %02x GPIO_G: %02x", gpio_a, gpio_g);
+ lcd_puts(0, line++, buf);
+ snprintf(buf, sizeof(buf), "GPIO_B: %02x GPIO_H: %02x", gpio_b, gpio_h);
+ lcd_puts(0, line++, buf);
+ snprintf(buf, sizeof(buf), "GPIO_C: %02x GPIO_I: %02x", gpio_c, gpio_i);
+ lcd_puts(0, line++, buf);
+ line++;
+
+ gpio_d = GPIOD_INPUT_VAL;
+ gpio_e = GPIOE_INPUT_VAL;
+ gpio_f = GPIOF_INPUT_VAL;
+
+ gpio_j = GPIOJ_INPUT_VAL;
+ gpio_k = GPIOK_INPUT_VAL;
+ gpio_l = GPIOL_INPUT_VAL;
+
+ snprintf(buf, sizeof(buf), "GPIO_D: %02x GPIO_J: %02x", gpio_d, gpio_j);
+ lcd_puts(0, line++, buf);
+ snprintf(buf, sizeof(buf), "GPIO_E: %02x GPIO_K: %02x", gpio_e, gpio_k);
+ lcd_puts(0, line++, buf);
+ snprintf(buf, sizeof(buf), "GPIO_F: %02x GPIO_L: %02x", gpio_f, gpio_l);
+ lcd_puts(0, line++, buf);
+ line++;
+ snprintf(buf, sizeof(buf), "ADC_1: %02x", adc_read(ADC_0));
+ lcd_puts(0, line++, buf);
+ snprintf(buf, sizeof(buf), "ADC_2: %02x", adc_read(ADC_1));
+ lcd_puts(0, line++, buf);
+ snprintf(buf, sizeof(buf), "ADC_3: %02x", adc_read(ADC_2));
+ lcd_puts(0, line++, buf);
+ snprintf(buf, sizeof(buf), "ADC_4: %02x", adc_read(ADC_3));
+ lcd_puts(0, line++, buf);
+ lcd_update();
+ }
+ return 0;
}
void mpeg_stop(void)
@@ -95,3 +178,13 @@ void system_reboot(void)
{
}
+
+void main(void)
+{
+ kernel_init();
+ adc_init();
+ lcd_init_device();
+
+ dbg_ports();
+}
+