diff options
Diffstat (limited to 'bootloader/telechips.c')
-rw-r--r-- | bootloader/telechips.c | 57 |
1 files changed, 10 insertions, 47 deletions
diff --git a/bootloader/telechips.c b/bootloader/telechips.c index da04101922..666657565d 100644 --- a/bootloader/telechips.c +++ b/bootloader/telechips.c | |||
@@ -59,12 +59,19 @@ void show_debug_screen(void) | |||
59 | int power_count = 0; | 59 | int power_count = 0; |
60 | int count = 0; | 60 | int count = 0; |
61 | bool do_power_off = false; | 61 | bool do_power_off = false; |
62 | #ifdef HAVE_BUTTON_DATA | ||
63 | unsigned int data; | ||
64 | #endif | ||
62 | 65 | ||
63 | while(!do_power_off) { | 66 | while(!do_power_off) { |
64 | line = 0; | 67 | line = 0; |
65 | printf("Hello World!"); | 68 | printf("Hello World!"); |
66 | 69 | ||
70 | #ifdef HAVE_BUTTON_DATA | ||
71 | button = button_read_device(&data); | ||
72 | #else | ||
67 | button = button_read_device(); | 73 | button = button_read_device(); |
74 | #endif | ||
68 | 75 | ||
69 | /* Power-off if POWER button has been held for a long time | 76 | /* Power-off if POWER button has been held for a long time |
70 | This loop is currently running at about 100 iterations/second | 77 | This loop is currently running at about 100 iterations/second |
@@ -79,46 +86,6 @@ void show_debug_screen(void) | |||
79 | 86 | ||
80 | printf("Btn: 0x%08x",button); | 87 | printf("Btn: 0x%08x",button); |
81 | 88 | ||
82 | #if defined(COWON_D2) | ||
83 | int i; | ||
84 | |||
85 | printf("GPIOA: 0x%08x",GPIOA); | ||
86 | printf("GPIOB: 0x%08x",GPIOB); | ||
87 | printf("GPIOC: 0x%08x",GPIOC); | ||
88 | printf("GPIOD: 0x%08x",GPIOD); | ||
89 | printf("GPIOE: 0x%08x",GPIOE); | ||
90 | |||
91 | for (i = 0; i<4; i++) | ||
92 | { | ||
93 | printf("ADC%d: 0x%04x",i,adc_read(i)); | ||
94 | } | ||
95 | |||
96 | /* TODO: Move this stuff out to a touchscreen driver and establish | ||
97 | how such a beast is going to work. Since it needs I2C read/write, | ||
98 | it can't easily go on an interrupt-based tick task. */ | ||
99 | { | ||
100 | int x,y; | ||
101 | unsigned char buf[5]; | ||
102 | |||
103 | pcf50606_write(PCF5060X_ADCC2, (0xE<<1) | 1); /* ADC start X+Y */ | ||
104 | pcf50606_read_multiple(PCF5060X_ADCC1, buf, 5); | ||
105 | x = (buf[2] << 2) | (buf[3] & 3); | ||
106 | y = (buf[4] << 2) | ((buf[3] & 0xC) >> 2); | ||
107 | printf("X: 0x%03x Y: 0x%03x",x,y); | ||
108 | |||
109 | x = (x*LCD_WIDTH) / 1024; | ||
110 | y = (y*LCD_HEIGHT) / 1024; | ||
111 | lcd_hline(x-5, x+5, y); | ||
112 | lcd_vline(x, y-5, y+5); | ||
113 | |||
114 | pcf50606_write(PCF5060X_ADCC2, (0xF<<1) | 1); /* ADC start P1+P2 */ | ||
115 | pcf50606_read_multiple(PCF5060X_ADCC1, buf, 5); | ||
116 | x = (buf[2] << 2) | (buf[3] & 3); | ||
117 | y = (buf[4] << 2) | ((buf[3] & 0xC) >> 2); | ||
118 | printf("P1: 0x%03x P2: 0x%03x",x,y); | ||
119 | } | ||
120 | #endif | ||
121 | |||
122 | count++; | 89 | count++; |
123 | printf("Count: %d",count); | 90 | printf("Count: %d",count); |
124 | } | 91 | } |
@@ -186,16 +153,12 @@ void* main(void) | |||
186 | { | 153 | { |
187 | int(*kernel_entry)(void); | 154 | int(*kernel_entry)(void); |
188 | 155 | ||
189 | /* wait for hold release to allow debug statements to be read */ | ||
190 | while (button_hold()) {}; | ||
191 | |||
192 | kernel_entry = (void*) loadbuffer; | 156 | kernel_entry = (void*) loadbuffer; |
193 | 157 | rc = kernel_entry(); | |
194 | /* allow entry to the debug screen if still holding power */ | ||
195 | if (!(button_read_device() & POWEROFF_BUTTON)) rc = kernel_entry(); | ||
196 | } | 158 | } |
197 | #endif | 159 | #else |
198 | show_debug_screen(); | 160 | show_debug_screen(); |
161 | #endif | ||
199 | 162 | ||
200 | return 0; | 163 | return 0; |
201 | } | 164 | } |