Index: emcore/trunk/target/ipodnano2g/clickwheel.c |
— | — | @@ -137,21 +137,22 @@ |
138 | 138 | lastpacket = 0;
|
139 | 139 | collect = 0;
|
140 | 140 | lastdiff = 0;
|
141 | | - INTMSK |= 1 << IRQ_WHEEL;
|
142 | 141 | PWRCON(1) &= ~1;
|
143 | 142 | PCON15 = (PCON15 & ~0xFFFF0000) | 0x22220000;
|
144 | 143 | PUNK15 = 0xF0;
|
| 144 | + PCON10 = (PCON10 & ~0xFF0) | 0x10;
|
| 145 | + WHEELINT = 7;
|
| 146 | + WHEEL10 = 1;
|
| 147 | + INTMSK |= 1 << IRQ_WHEEL;
|
145 | 148 | WHEEL08 = 0x3A980;
|
146 | 149 | WHEEL00 = 0x280000;
|
147 | | - WHEEL10 = 3;
|
148 | | - PCON10 = (PCON10 & ~0xFF0) | 0x10;
|
| 150 | + while (WHEEL0C & 4) yield();
|
149 | 151 | PDAT10 |= 2;
|
150 | 152 | WHEELTX = 0x8000023A;
|
151 | 153 | WHEEL04 |= 1;
|
152 | 154 | PDAT10 &= ~2;
|
153 | | - thread_create(&clickwheel_thread_handle, "Clickwheel dispatcher",
|
154 | | - clickwheel_thread, clickwheel_stack,
|
155 | | - sizeof(clickwheel_stack), OS_THREAD, 200, true,
|
| 155 | + thread_create(&clickwheel_thread_handle, "Clickwheel dispatcher", clickwheel_thread,
|
| 156 | + clickwheel_stack, sizeof(clickwheel_stack), OS_THREAD, 200, true,
|
156 | 157 | NULL, NULL, NULL, NULL);
|
157 | 158 | }
|
158 | 159 |
|
— | — | @@ -159,14 +160,12 @@ |
160 | 161 | void INT_WHEEL()
|
161 | 162 | {
|
162 | 163 | uint32_t events = WHEELINT;
|
163 | | - if (events & 4) WHEELINT = 4;
|
164 | | - if (events & 2) WHEELINT = 2;
|
165 | 164 | if (events & 1)
|
166 | 165 | {
|
167 | 166 | clickwheel_packet = WHEELRX;
|
168 | 167 | wakeup_signal(&clickwheel_wakeup);
|
169 | | - WHEELINT = 1;
|
170 | 168 | }
|
| 169 | + WHEELINT = events;
|
171 | 170 | }
|
172 | 171 |
|
173 | 172 | uint32_t clickwheel_get_state()
|
Index: emcore/trunk/target/ipodnano3g/clickwheel.c |
— | — | @@ -137,24 +137,18 @@ |
138 | 138 | lastpacket = 0;
|
139 | 139 | collect = 0;
|
140 | 140 | lastdiff = 0;
|
141 | | - interrupt_enable(IRQ_WHEEL, true);
|
| 141 | + PCON(14) = (PCON(14) & ~0xffff0000) | 0x22220000;
|
142 | 142 | PUNA(2) &= ~2;
|
143 | | - PCON(14) = (PCON(14) & ~0xffff0000) | 0x22220000;
|
144 | 143 | WHEELINT = 7;
|
145 | | - WHEEL10 = 7;
|
| 144 | + WHEEL10 = 1;
|
| 145 | + interrupt_enable(IRQ_WHEEL, true);
|
| 146 | + WHEEL08 = 0x20000;
|
146 | 147 | WHEEL00 = 0x380000;
|
147 | | - WHEEL08 = 0x20000;
|
148 | | - do
|
149 | | - {
|
150 | | - WHEELTX = 0x8001052A;
|
151 | | - while (WHEEL0C & 4) yield();
|
152 | | - WHEEL04 = 1;
|
153 | | - sleep(20000);
|
154 | | - }
|
155 | | - while (WHEEL0C & 4);
|
156 | | - thread_create(&clickwheel_thread_handle, "Clickwheel dispatcher",
|
157 | | - clickwheel_thread, clickwheel_stack,
|
158 | | - sizeof(clickwheel_stack), OS_THREAD, 200, true,
|
| 148 | + while (WHEEL0C & 4) yield();
|
| 149 | + WHEELTX = 0x8000023A;
|
| 150 | + WHEEL04 |= 1;
|
| 151 | + thread_create(&clickwheel_thread_handle, "Clickwheel dispatcher", clickwheel_thread,
|
| 152 | + clickwheel_stack, sizeof(clickwheel_stack), OS_THREAD, 200, true,
|
159 | 153 | NULL, NULL, NULL, NULL);
|
160 | 154 | }
|
161 | 155 |
|
— | — | @@ -162,14 +156,12 @@ |
163 | 157 | void INT_WHEEL()
|
164 | 158 | {
|
165 | 159 | uint32_t events = WHEELINT;
|
166 | | - if (events & 4) WHEELINT = 4;
|
167 | | - if (events & 2) WHEELINT = 2;
|
168 | 160 | if (events & 1)
|
169 | 161 | {
|
170 | 162 | clickwheel_packet = WHEELRX;
|
171 | 163 | wakeup_signal(&clickwheel_wakeup);
|
172 | | - WHEELINT = 1;
|
173 | 164 | }
|
| 165 | + WHEELINT = events;
|
174 | 166 | }
|
175 | 167 |
|
176 | 168 | uint32_t clickwheel_get_state()
|