summaryrefslogtreecommitdiff
path: root/bootloader
diff options
context:
space:
mode:
Diffstat (limited to 'bootloader')
-rw-r--r--bootloader/telechips.c65
1 files changed, 64 insertions, 1 deletions
diff --git a/bootloader/telechips.c b/bootloader/telechips.c
index 6666575..7563a18 100644
--- a/bootloader/telechips.c
+++ b/bootloader/telechips.c
@@ -53,6 +53,64 @@ extern int line;
#define MAX_LOAD_SIZE (8*1024*1024) /* Arbitrary, but plenty. */
+/* The following function is just test/development code */
+#ifdef CPU_TCC77X
+void show_debug_screen(void)
+{
+ int button;
+ int power_count = 0;
+ int count = 0;
+ bool do_power_off = false;
+
+ lcd_puts_scroll(0,0,"this is a very long line to test scrolling");
+ while(!do_power_off) {
+ line = 1;
+ button = button_get(false);
+
+ /* Power-off if POWER button has been held for a long time
+ This loop is currently running at about 100 iterations/second
+ */
+ if (button & POWEROFF_BUTTON) {
+ power_count++;
+ if (power_count > 200)
+ do_power_off = true;
+ } else {
+ power_count = 0;
+ }
+
+ printf("Btn: 0x%08x",button);
+ printf("Tick: %d",current_tick);
+
+ printf("GPIOA: 0x%08x",GPIOA);
+ printf("GPIOB: 0x%08x",GPIOB);
+ printf("GPIOC: 0x%08x",GPIOC);
+ printf("GPIOD: 0x%08x",GPIOD);
+// printf("GPIOE: 0x%08x",GPIOE);
+
+#if 0
+ int i;
+ for (i = 0; i<4; i++)
+ {
+ printf("ADC%d: 0x%04x",i,adc_read(i));
+ }
+#endif
+ count++;
+ printf("Count: %d",count);
+ sleep(HZ/10);
+
+ }
+
+ lcd_clear_display();
+ line = 0;
+ printf("POWER-OFF");
+
+ /* Power-off */
+ power_off();
+
+ printf("(NOT) POWERED OFF");
+ while (true);
+}
+#else /* !CPU_TCC77X */
void show_debug_screen(void)
{
int button;
@@ -100,7 +158,7 @@ void show_debug_screen(void)
printf("(NOT) POWERED OFF");
while (true);
}
-
+#endif
void* main(void)
{
@@ -111,6 +169,11 @@ void* main(void)
power_init();
system_init();
+#ifndef COWON_D2
+ /* The D2 doesn't enable threading or interrupts */
+ kernel_init();
+ enable_irq();
+#endif
lcd_init();
adc_init();