diff options
Diffstat (limited to 'bootloader/telechips.c')
-rw-r--r-- | bootloader/telechips.c | 65 |
1 files changed, 64 insertions, 1 deletions
diff --git a/bootloader/telechips.c b/bootloader/telechips.c index 666657565d..7563a18632 100644 --- a/bootloader/telechips.c +++ b/bootloader/telechips.c | |||
@@ -53,6 +53,64 @@ extern int line; | |||
53 | 53 | ||
54 | #define MAX_LOAD_SIZE (8*1024*1024) /* Arbitrary, but plenty. */ | 54 | #define MAX_LOAD_SIZE (8*1024*1024) /* Arbitrary, but plenty. */ |
55 | 55 | ||
56 | /* The following function is just test/development code */ | ||
57 | #ifdef CPU_TCC77X | ||
58 | void show_debug_screen(void) | ||
59 | { | ||
60 | int button; | ||
61 | int power_count = 0; | ||
62 | int count = 0; | ||
63 | bool do_power_off = false; | ||
64 | |||
65 | lcd_puts_scroll(0,0,"this is a very long line to test scrolling"); | ||
66 | while(!do_power_off) { | ||
67 | line = 1; | ||
68 | button = button_get(false); | ||
69 | |||
70 | /* Power-off if POWER button has been held for a long time | ||
71 | This loop is currently running at about 100 iterations/second | ||
72 | */ | ||
73 | if (button & POWEROFF_BUTTON) { | ||
74 | power_count++; | ||
75 | if (power_count > 200) | ||
76 | do_power_off = true; | ||
77 | } else { | ||
78 | power_count = 0; | ||
79 | } | ||
80 | |||
81 | printf("Btn: 0x%08x",button); | ||
82 | printf("Tick: %d",current_tick); | ||
83 | |||
84 | printf("GPIOA: 0x%08x",GPIOA); | ||
85 | printf("GPIOB: 0x%08x",GPIOB); | ||
86 | printf("GPIOC: 0x%08x",GPIOC); | ||
87 | printf("GPIOD: 0x%08x",GPIOD); | ||
88 | // printf("GPIOE: 0x%08x",GPIOE); | ||
89 | |||
90 | #if 0 | ||
91 | int i; | ||
92 | for (i = 0; i<4; i++) | ||
93 | { | ||
94 | printf("ADC%d: 0x%04x",i,adc_read(i)); | ||
95 | } | ||
96 | #endif | ||
97 | count++; | ||
98 | printf("Count: %d",count); | ||
99 | sleep(HZ/10); | ||
100 | |||
101 | } | ||
102 | |||
103 | lcd_clear_display(); | ||
104 | line = 0; | ||
105 | printf("POWER-OFF"); | ||
106 | |||
107 | /* Power-off */ | ||
108 | power_off(); | ||
109 | |||
110 | printf("(NOT) POWERED OFF"); | ||
111 | while (true); | ||
112 | } | ||
113 | #else /* !CPU_TCC77X */ | ||
56 | void show_debug_screen(void) | 114 | void show_debug_screen(void) |
57 | { | 115 | { |
58 | int button; | 116 | int button; |
@@ -100,7 +158,7 @@ void show_debug_screen(void) | |||
100 | printf("(NOT) POWERED OFF"); | 158 | printf("(NOT) POWERED OFF"); |
101 | while (true); | 159 | while (true); |
102 | } | 160 | } |
103 | 161 | #endif | |
104 | 162 | ||
105 | void* main(void) | 163 | void* main(void) |
106 | { | 164 | { |
@@ -111,6 +169,11 @@ void* main(void) | |||
111 | 169 | ||
112 | power_init(); | 170 | power_init(); |
113 | system_init(); | 171 | system_init(); |
172 | #ifndef COWON_D2 | ||
173 | /* The D2 doesn't enable threading or interrupts */ | ||
174 | kernel_init(); | ||
175 | enable_irq(); | ||
176 | #endif | ||
114 | lcd_init(); | 177 | lcd_init(); |
115 | 178 | ||
116 | adc_init(); | 179 | adc_init(); |