diff options
author | Rob Purchase <shotofadds@rockbox.org> | 2008-01-14 22:04:48 +0000 |
---|---|---|
committer | Rob Purchase <shotofadds@rockbox.org> | 2008-01-14 22:04:48 +0000 |
commit | 47ea030e2e68a51f91a2c2302b7ea4d3ee1a2a07 (patch) | |
tree | 0a48ce653e22ec9a2673474f718217d9659e0c6b /bootloader/telechips.c | |
parent | b30ca8ca5ab6c8ea27b8fe1f5fb38ebad09b7e62 (diff) | |
download | rockbox-47ea030e2e68a51f91a2c2302b7ea4d3ee1a2a07.tar.gz rockbox-47ea030e2e68a51f91a2c2302b7ea4d3ee1a2a07.zip |
Initial Cowon D2 commit:
* bootloader test program (basic LCD & button drivers, reads touchscreen)
* work-in-progress stubs for main build
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16090 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'bootloader/telechips.c')
-rw-r--r-- | bootloader/telechips.c | 49 |
1 files changed, 48 insertions, 1 deletions
diff --git a/bootloader/telechips.c b/bootloader/telechips.c index 6093701044..a51b6775a1 100644 --- a/bootloader/telechips.c +++ b/bootloader/telechips.c | |||
@@ -41,6 +41,10 @@ | |||
41 | #include "file.h" | 41 | #include "file.h" |
42 | #include "common.h" | 42 | #include "common.h" |
43 | 43 | ||
44 | #if defined(COWON_D2) | ||
45 | #include "i2c.h" | ||
46 | #endif | ||
47 | |||
44 | char version[] = APPSVERSION; | 48 | char version[] = APPSVERSION; |
45 | 49 | ||
46 | extern int line; | 50 | extern int line; |
@@ -50,6 +54,7 @@ void* main(void) | |||
50 | int button; | 54 | int button; |
51 | int power_count = 0; | 55 | int power_count = 0; |
52 | int count = 0; | 56 | int count = 0; |
57 | int i; | ||
53 | bool do_power_off = false; | 58 | bool do_power_off = false; |
54 | 59 | ||
55 | system_init(); | 60 | system_init(); |
@@ -57,6 +62,10 @@ void* main(void) | |||
57 | lcd_init(); | 62 | lcd_init(); |
58 | font_init(); | 63 | font_init(); |
59 | 64 | ||
65 | #if defined(COWON_D2) | ||
66 | lcd_enable(true); | ||
67 | #endif | ||
68 | |||
60 | _backlight_on(); | 69 | _backlight_on(); |
61 | 70 | ||
62 | while(!do_power_off) { | 71 | while(!do_power_off) { |
@@ -68,7 +77,7 @@ void* main(void) | |||
68 | /* Power-off if POWER button has been held for a long time | 77 | /* Power-off if POWER button has been held for a long time |
69 | This loop is currently running at about 100 iterations/second | 78 | This loop is currently running at about 100 iterations/second |
70 | */ | 79 | */ |
71 | if (button & BUTTON_POWERPLAY) { | 80 | if (button & POWEROFF_BUTTON) { |
72 | power_count++; | 81 | power_count++; |
73 | if (power_count > 200) | 82 | if (power_count > 200) |
74 | do_power_off = true; | 83 | do_power_off = true; |
@@ -78,6 +87,40 @@ void* main(void) | |||
78 | 87 | ||
79 | printf("Btn: 0x%08x",button); | 88 | printf("Btn: 0x%08x",button); |
80 | 89 | ||
90 | #if defined(COWON_D2) | ||
91 | printf("GPIOA: 0x%08x",GPIOA); | ||
92 | printf("GPIOB: 0x%08x",GPIOB); | ||
93 | printf("GPIOC: 0x%08x",GPIOC); | ||
94 | printf("GPIOD: 0x%08x",GPIOD); | ||
95 | printf("GPIOE: 0x%08x",GPIOE); | ||
96 | |||
97 | for (i = 0; i<4; i++) | ||
98 | { | ||
99 | printf("ADC%d: 0x%04x",i,adc_read(i)); | ||
100 | } | ||
101 | |||
102 | /* TODO: Establish how the touchscreen driver is going to work. | ||
103 | Since it needs I2C read/write, it can't easily go on a tick task */ | ||
104 | { | ||
105 | unsigned char buf[] = { 0x2f, (0xE<<1) | 1, /* ADC start for X+Y */ | ||
106 | 0, 0, 0 }; | ||
107 | int x,y; | ||
108 | i2c_write(0x10, buf, 2); | ||
109 | i2c_readmem(0x10, 0x2e, buf, 5); | ||
110 | x = (buf[2] << 2) | (buf[3] & 3); | ||
111 | y = (buf[4] << 2) | ((buf[3] & 0xC) >> 2); | ||
112 | printf("X: 0x%03x Y: 0x%03x",x,y); | ||
113 | |||
114 | buf[0] = 0x2f; | ||
115 | buf[1] = (0xF<<1) | 1; /* ADC start for P1+P2 */ | ||
116 | i2c_write(0x10, buf, 2); | ||
117 | i2c_readmem(0x10, 0x2e, buf, 5); | ||
118 | x = (buf[2] << 2) | (buf[3] & 3); | ||
119 | y = (buf[4] << 2) | ((buf[3] & 0xC) >> 2); | ||
120 | printf("P1: 0x%03x P2: 0x%03x",x,y); | ||
121 | } | ||
122 | #endif | ||
123 | |||
81 | count++; | 124 | count++; |
82 | printf("Count: %d",count); | 125 | printf("Count: %d",count); |
83 | } | 126 | } |
@@ -86,6 +129,10 @@ void* main(void) | |||
86 | line = 0; | 129 | line = 0; |
87 | printf("POWER-OFF"); | 130 | printf("POWER-OFF"); |
88 | 131 | ||
132 | #if defined(COWON_D2) | ||
133 | lcd_enable(false); | ||
134 | #endif | ||
135 | |||
89 | /* TODO: Power-off */ | 136 | /* TODO: Power-off */ |
90 | while(1); | 137 | while(1); |
91 | 138 | ||