Rev 1928 | Rev 1934 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1928 | Rev 1932 | ||
---|---|---|---|
1 | /* |
1 | /* |
2 | * Copyright (C) 2006 Martin Decky |
2 | * Copyright (C) 2006 Martin Decky |
3 | * All rights reserved. |
3 | * All rights reserved. |
4 | * |
4 | * |
5 | * Redistribution and use in source and binary forms, with or without |
5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions |
6 | * modification, are permitted provided that the following conditions |
7 | * are met: |
7 | * are met: |
8 | * |
8 | * |
9 | * - Redistributions of source code must retain the above copyright |
9 | * - Redistributions of source code must retain the above copyright |
10 | * notice, this list of conditions and the following disclaimer. |
10 | * notice, this list of conditions and the following disclaimer. |
11 | * - Redistributions in binary form must reproduce the above copyright |
11 | * - Redistributions in binary form must reproduce the above copyright |
12 | * notice, this list of conditions and the following disclaimer in the |
12 | * notice, this list of conditions and the following disclaimer in the |
13 | * documentation and/or other materials provided with the distribution. |
13 | * documentation and/or other materials provided with the distribution. |
14 | * - The name of the author may not be used to endorse or promote products |
14 | * - The name of the author may not be used to endorse or promote products |
15 | * derived from this software without specific prior written permission. |
15 | * derived from this software without specific prior written permission. |
16 | * |
16 | * |
17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | */ |
27 | */ |
28 | 28 | ||
29 | /** @addtogroup ppc32 |
29 | /** @addtogroup ppc32 |
30 | * @{ |
30 | * @{ |
31 | */ |
31 | */ |
32 | /** @file |
32 | /** @file |
33 | */ |
33 | */ |
34 | 34 | ||
35 | #include <arch/drivers/cuda.h> |
35 | #include <arch/drivers/cuda.h> |
36 | #include <ddi/irq.h> |
36 | #include <ddi/irq.h> |
37 | #include <arch/asm.h> |
37 | #include <arch/asm.h> |
38 | #include <console/console.h> |
38 | #include <console/console.h> |
39 | #include <console/chardev.h> |
39 | #include <console/chardev.h> |
40 | #include <arch/drivers/pic.h> |
40 | #include <arch/drivers/pic.h> |
41 | #include <sysinfo/sysinfo.h> |
41 | #include <sysinfo/sysinfo.h> |
42 | #include <interrupt.h> |
42 | #include <interrupt.h> |
43 | #include <stdarg.h> |
43 | #include <stdarg.h> |
44 | 44 | ||
45 | #define CUDA_IRQ 10 |
45 | #define CUDA_IRQ 10 |
46 | #define SPECIAL '?' |
46 | #define SPECIAL '?' |
47 | 47 | ||
48 | #define PACKET_ADB 0x00 |
48 | #define PACKET_ADB 0x00 |
49 | #define PACKET_CUDA 0x01 |
49 | #define PACKET_CUDA 0x01 |
50 | 50 | ||
51 | #define CUDA_POWERDOWN 0x0a |
51 | #define CUDA_POWERDOWN 0x0a |
52 | 52 | ||
53 | #define RS 0x200 |
53 | #define RS 0x200 |
54 | #define B (0 * RS) |
54 | #define B (0 * RS) |
55 | #define A (1 * RS) |
55 | #define A (1 * RS) |
56 | #define SR (10 * RS) |
56 | #define SR (10 * RS) |
57 | #define ACR (11 * RS) |
57 | #define ACR (11 * RS) |
58 | 58 | ||
59 | #define SR_OUT 0x10 |
59 | #define SR_OUT 0x10 |
60 | #define TACK 0x10 |
60 | #define TACK 0x10 |
61 | #define TIP 0x20 |
61 | #define TIP 0x20 |
62 | 62 | ||
63 | 63 | ||
64 | static volatile uint8_t *cuda = NULL; |
64 | static volatile uint8_t *cuda = NULL; |
65 | static irq_t cuda_irq; /**< Cuda's IRQ. */ |
65 | static irq_t cuda_irq; /**< Cuda's IRQ. */ |
66 | 66 | ||
67 | static ipc_notif_cfg_t saved_notif_cfg; |
- | |
68 | - | ||
69 | - | ||
70 | static char lchars[0x80] = { |
67 | static char lchars[0x80] = { |
71 | 'a', |
68 | 'a', |
72 | 's', |
69 | 's', |
73 | 'd', |
70 | 'd', |
74 | 'f', |
71 | 'f', |
75 | 'h', |
72 | 'h', |
76 | 'g', |
73 | 'g', |
77 | 'z', |
74 | 'z', |
78 | 'x', |
75 | 'x', |
79 | 'c', |
76 | 'c', |
80 | 'v', |
77 | 'v', |
81 | SPECIAL, |
78 | SPECIAL, |
82 | 'b', |
79 | 'b', |
83 | 'q', |
80 | 'q', |
84 | 'w', |
81 | 'w', |
85 | 'e', |
82 | 'e', |
86 | 'r', |
83 | 'r', |
87 | 'y', |
84 | 'y', |
88 | 't', |
85 | 't', |
89 | '1', |
86 | '1', |
90 | '2', |
87 | '2', |
91 | '3', |
88 | '3', |
92 | '4', |
89 | '4', |
93 | '6', |
90 | '6', |
94 | '5', |
91 | '5', |
95 | '=', |
92 | '=', |
96 | '9', |
93 | '9', |
97 | '7', |
94 | '7', |
98 | '-', |
95 | '-', |
99 | '8', |
96 | '8', |
100 | '0', |
97 | '0', |
101 | ']', |
98 | ']', |
102 | 'o', |
99 | 'o', |
103 | 'u', |
100 | 'u', |
104 | '[', |
101 | '[', |
105 | 'i', |
102 | 'i', |
106 | 'p', |
103 | 'p', |
107 | '\n', /* Enter */ |
104 | '\n', /* Enter */ |
108 | 'l', |
105 | 'l', |
109 | 'j', |
106 | 'j', |
110 | '\'', |
107 | '\'', |
111 | 'k', |
108 | 'k', |
112 | ';', |
109 | ';', |
113 | '\\', |
110 | '\\', |
114 | ',', |
111 | ',', |
115 | '/', |
112 | '/', |
116 | 'n', |
113 | 'n', |
117 | 'm', |
114 | 'm', |
118 | '.', |
115 | '.', |
119 | '\t', /* Tab */ |
116 | '\t', /* Tab */ |
120 | ' ', |
117 | ' ', |
121 | '`', |
118 | '`', |
122 | '\b', /* Backspace */ |
119 | '\b', /* Backspace */ |
123 | SPECIAL, |
120 | SPECIAL, |
124 | SPECIAL, /* Escape */ |
121 | SPECIAL, /* Escape */ |
125 | SPECIAL, /* Ctrl */ |
122 | SPECIAL, /* Ctrl */ |
126 | SPECIAL, /* Alt */ |
123 | SPECIAL, /* Alt */ |
127 | SPECIAL, /* Shift */ |
124 | SPECIAL, /* Shift */ |
128 | SPECIAL, /* Caps-Lock */ |
125 | SPECIAL, /* Caps-Lock */ |
129 | SPECIAL, /* RAlt */ |
126 | SPECIAL, /* RAlt */ |
130 | SPECIAL, /* Left */ |
127 | SPECIAL, /* Left */ |
131 | SPECIAL, /* Right */ |
128 | SPECIAL, /* Right */ |
132 | SPECIAL, /* Down */ |
129 | SPECIAL, /* Down */ |
133 | SPECIAL, /* Up */ |
130 | SPECIAL, /* Up */ |
134 | SPECIAL, |
131 | SPECIAL, |
135 | SPECIAL, |
132 | SPECIAL, |
136 | '.', /* Keypad . */ |
133 | '.', /* Keypad . */ |
137 | SPECIAL, |
134 | SPECIAL, |
138 | '*', /* Keypad * */ |
135 | '*', /* Keypad * */ |
139 | SPECIAL, |
136 | SPECIAL, |
140 | '+', /* Keypad + */ |
137 | '+', /* Keypad + */ |
141 | SPECIAL, |
138 | SPECIAL, |
142 | SPECIAL, /* NumLock */ |
139 | SPECIAL, /* NumLock */ |
143 | SPECIAL, |
140 | SPECIAL, |
144 | SPECIAL, |
141 | SPECIAL, |
145 | SPECIAL, |
142 | SPECIAL, |
146 | '/', /* Keypad / */ |
143 | '/', /* Keypad / */ |
147 | '\n', /* Keypad Enter */ |
144 | '\n', /* Keypad Enter */ |
148 | SPECIAL, |
145 | SPECIAL, |
149 | '-', /* Keypad - */ |
146 | '-', /* Keypad - */ |
150 | SPECIAL, |
147 | SPECIAL, |
151 | SPECIAL, |
148 | SPECIAL, |
152 | SPECIAL, |
149 | SPECIAL, |
153 | '0', /* Keypad 0 */ |
150 | '0', /* Keypad 0 */ |
154 | '1', /* Keypad 1 */ |
151 | '1', /* Keypad 1 */ |
155 | '2', /* Keypad 2 */ |
152 | '2', /* Keypad 2 */ |
156 | '3', /* Keypad 3 */ |
153 | '3', /* Keypad 3 */ |
157 | '4', /* Keypad 4 */ |
154 | '4', /* Keypad 4 */ |
158 | '5', /* Keypad 5 */ |
155 | '5', /* Keypad 5 */ |
159 | '6', /* Keypad 6 */ |
156 | '6', /* Keypad 6 */ |
160 | '7', /* Keypad 7 */ |
157 | '7', /* Keypad 7 */ |
161 | SPECIAL, |
158 | SPECIAL, |
162 | '8', /* Keypad 8 */ |
159 | '8', /* Keypad 8 */ |
163 | '9', /* Keypad 9 */ |
160 | '9', /* Keypad 9 */ |
164 | SPECIAL, |
161 | SPECIAL, |
165 | SPECIAL, |
162 | SPECIAL, |
166 | SPECIAL, |
163 | SPECIAL, |
167 | SPECIAL, /* F5 */ |
164 | SPECIAL, /* F5 */ |
168 | SPECIAL, /* F6 */ |
165 | SPECIAL, /* F6 */ |
169 | SPECIAL, /* F7 */ |
166 | SPECIAL, /* F7 */ |
170 | SPECIAL, /* F3 */ |
167 | SPECIAL, /* F3 */ |
171 | SPECIAL, /* F8 */ |
168 | SPECIAL, /* F8 */ |
172 | SPECIAL, /* F9 */ |
169 | SPECIAL, /* F9 */ |
173 | SPECIAL, |
170 | SPECIAL, |
174 | SPECIAL, /* F11 */ |
171 | SPECIAL, /* F11 */ |
175 | SPECIAL, |
172 | SPECIAL, |
176 | SPECIAL, /* F13 */ |
173 | SPECIAL, /* F13 */ |
177 | SPECIAL, |
174 | SPECIAL, |
178 | SPECIAL, /* ScrollLock */ |
175 | SPECIAL, /* ScrollLock */ |
179 | SPECIAL, |
176 | SPECIAL, |
180 | SPECIAL, /* F10 */ |
177 | SPECIAL, /* F10 */ |
181 | SPECIAL, |
178 | SPECIAL, |
182 | SPECIAL, /* F12 */ |
179 | SPECIAL, /* F12 */ |
183 | SPECIAL, |
180 | SPECIAL, |
184 | SPECIAL, /* Pause */ |
181 | SPECIAL, /* Pause */ |
185 | SPECIAL, /* Insert */ |
182 | SPECIAL, /* Insert */ |
186 | SPECIAL, /* Home */ |
183 | SPECIAL, /* Home */ |
187 | SPECIAL, /* PageUp */ |
184 | SPECIAL, /* PageUp */ |
188 | SPECIAL, /* Delete */ |
185 | SPECIAL, /* Delete */ |
189 | SPECIAL, /* F4 */ |
186 | SPECIAL, /* F4 */ |
190 | SPECIAL, /* End */ |
187 | SPECIAL, /* End */ |
191 | SPECIAL, /* F2 */ |
188 | SPECIAL, /* F2 */ |
192 | SPECIAL, /* PageDown */ |
189 | SPECIAL, /* PageDown */ |
193 | SPECIAL /* F1 */ |
190 | SPECIAL /* F1 */ |
194 | }; |
191 | }; |
195 | 192 | ||
196 | 193 | ||
197 | void send_packet(const uint8_t kind, index_t count, ...); |
194 | void send_packet(const uint8_t kind, index_t count, ...); |
198 | 195 | ||
199 | 196 | ||
200 | static void receive_packet(uint8_t *kind, index_t count, uint8_t data[]) |
197 | static void receive_packet(uint8_t *kind, index_t count, uint8_t data[]) |
201 | { |
198 | { |
202 | cuda[B] = cuda[B] & ~TIP; |
199 | cuda[B] = cuda[B] & ~TIP; |
203 | *kind = cuda[SR]; |
200 | *kind = cuda[SR]; |
204 | 201 | ||
205 | index_t i; |
202 | index_t i; |
206 | for (i = 0; i < count; i++) |
203 | for (i = 0; i < count; i++) |
207 | data[i] = cuda[SR]; |
204 | data[i] = cuda[SR]; |
208 | 205 | ||
209 | cuda[B] = cuda[B] | TIP; |
206 | cuda[B] = cuda[B] | TIP; |
210 | } |
207 | } |
211 | 208 | ||
212 | 209 | ||
213 | /* Called from getc(). */ |
210 | /* Called from getc(). */ |
214 | static void cuda_resume(chardev_t *d) |
211 | static void cuda_resume(chardev_t *d) |
215 | { |
212 | { |
216 | } |
213 | } |
217 | 214 | ||
218 | 215 | ||
219 | /* Called from getc(). */ |
216 | /* Called from getc(). */ |
220 | static void cuda_suspend(chardev_t *d) |
217 | static void cuda_suspend(chardev_t *d) |
221 | { |
218 | { |
222 | } |
219 | } |
223 | 220 | ||
224 | 221 | ||
225 | static char key_read(chardev_t *d) |
222 | static char key_read(chardev_t *d) |
226 | { |
223 | { |
227 | char ch; |
224 | char ch; |
228 | 225 | ||
229 | ch = 0; |
226 | ch = 0; |
230 | return ch; |
227 | return ch; |
231 | } |
228 | } |
232 | 229 | ||
233 | 230 | ||
234 | static chardev_t kbrd; |
231 | static chardev_t kbrd; |
235 | static chardev_operations_t ops = { |
232 | static chardev_operations_t ops = { |
236 | .suspend = cuda_suspend, |
233 | .suspend = cuda_suspend, |
237 | .resume = cuda_resume, |
234 | .resume = cuda_resume, |
238 | .read = key_read |
235 | .read = key_read |
239 | }; |
236 | }; |
240 | 237 | ||
241 | 238 | ||
242 | int cuda_get_scancode(void) |
239 | int cuda_get_scancode(void) |
243 | { |
240 | { |
244 | uint8_t kind; |
241 | uint8_t kind; |
245 | uint8_t data[4]; |
242 | uint8_t data[4]; |
246 | 243 | ||
247 | receive_packet(&kind, 4, data); |
244 | receive_packet(&kind, 4, data); |
248 | 245 | ||
249 | if ((kind == PACKET_ADB) && (data[0] == 0x40) && (data[1] == 0x2c)) |
246 | if ((kind == PACKET_ADB) && (data[0] == 0x40) && (data[1] == 0x2c)) |
250 | return data[2]; |
247 | return data[2]; |
251 | 248 | ||
252 | return -1; |
249 | return -1; |
253 | } |
250 | } |
254 | 251 | ||
255 | static void cuda_irq_handler(irq_t *irq, void *arg, ...) |
252 | static void cuda_irq_handler(irq_t *irq, void *arg, ...) |
256 | { |
253 | { |
257 | if (irq->notif_cfg.answerbox) |
254 | if (irq->notif_cfg.notify && irq->notif_cfg.answerbox) |
258 | ipc_irq_send_notif(irq); |
255 | ipc_irq_send_notif(irq); |
259 | else { |
256 | else { |
260 | int scan_code = cuda_get_scancode(); |
257 | int scan_code = cuda_get_scancode(); |
261 | 258 | ||
262 | if (scan_code != -1) { |
259 | if (scan_code != -1) { |
263 | uint8_t scancode = (uint8_t) scan_code; |
260 | uint8_t scancode = (uint8_t) scan_code; |
264 | if ((scancode & 0x80) != 0x80) |
261 | if ((scancode & 0x80) != 0x80) |
265 | chardev_push_character(&kbrd, lchars[scancode & 0x7f]); |
262 | chardev_push_character(&kbrd, lchars[scancode & 0x7f]); |
266 | } |
263 | } |
267 | } |
264 | } |
268 | } |
265 | } |
269 | 266 | ||
270 | static irq_ownership_t cuda_claim(void) |
267 | static irq_ownership_t cuda_claim(void) |
271 | { |
268 | { |
272 | return IRQ_ACCEPT; |
269 | return IRQ_ACCEPT; |
273 | } |
270 | } |
274 | 271 | ||
275 | 272 | ||
276 | /** Initialize keyboard and service interrupts using kernel routine */ |
273 | /** Initialize keyboard and service interrupts using kernel routine */ |
277 | void cuda_grab(void) |
274 | void cuda_grab(void) |
278 | { |
275 | { |
279 | if (cuda_irq.notif_cfg.answerbox) { |
- | |
280 | saved_notif_cfg = cuda_irq.notif_cfg; |
- | |
281 | cuda_irq.notif_cfg.answerbox = NULL; |
- | |
282 | cuda_irq.notif_cfg.code = NULL; |
276 | cuda_irq.notif_cfg.notify = false; |
283 | cuda_irq.notif_cfg.method = 0; |
- | |
284 | cuda_irq.notif_cfg.counter = 0; |
- | |
285 | } |
- | |
286 | } |
277 | } |
287 | 278 | ||
288 | 279 | ||
289 | /** Resume the former interrupt vector */ |
280 | /** Resume the former interrupt vector */ |
290 | void cuda_release(void) |
281 | void cuda_release(void) |
291 | { |
282 | { |
292 | if (saved_notif_cfg.answerbox) |
283 | if (cuda_irq.notif_cfg.answerbox) |
293 | cuda_irq.notif_cfg = saved_notif_cfg; |
284 | cuda_irq.notif_cfg.notify = true; |
294 | } |
285 | } |
295 | 286 | ||
296 | 287 | ||
297 | void cuda_init(devno_t devno, uintptr_t base, size_t size) |
288 | void cuda_init(devno_t devno, uintptr_t base, size_t size) |
298 | { |
289 | { |
299 | cuda = (uint8_t *) hw_map(base, size); |
290 | cuda = (uint8_t *) hw_map(base, size); |
300 | 291 | ||
301 | chardev_initialize("cuda_kbd", &kbrd, &ops); |
292 | chardev_initialize("cuda_kbd", &kbrd, &ops); |
302 | stdin = &kbrd; |
293 | stdin = &kbrd; |
303 | 294 | ||
304 | irq_initialize(&cuda_irq); |
295 | irq_initialize(&cuda_irq); |
305 | cuda_irq.devno = devno; |
296 | cuda_irq.devno = devno; |
306 | cuda_irq.inr = CUDA_IRQ; |
297 | cuda_irq.inr = CUDA_IRQ; |
307 | cuda_irq.claim = cuda_claim; |
298 | cuda_irq.claim = cuda_claim; |
308 | cuda_irq.handler = cuda_irq_handler; |
299 | cuda_irq.handler = cuda_irq_handler; |
309 | irq_register(&cuda_irq); |
300 | irq_register(&cuda_irq); |
310 | 301 | ||
311 | pic_enable_interrupt(CUDA_IRQ); |
302 | pic_enable_interrupt(CUDA_IRQ); |
312 | 303 | ||
313 | sysinfo_set_item_val("kbd", NULL, true); |
304 | sysinfo_set_item_val("kbd", NULL, true); |
314 | sysinfo_set_item_val("kbd.devno", NULL, devno); |
305 | sysinfo_set_item_val("kbd.devno", NULL, devno); |
315 | sysinfo_set_item_val("kbd.inr", NULL, CUDA_IRQ); |
306 | sysinfo_set_item_val("kbd.inr", NULL, CUDA_IRQ); |
316 | sysinfo_set_item_val("kbd.address.virtual", NULL, base); |
307 | sysinfo_set_item_val("kbd.address.virtual", NULL, base); |
317 | 308 | ||
318 | cuda_grab(); |
309 | cuda_grab(); |
319 | } |
310 | } |
320 | 311 | ||
321 | 312 | ||
322 | void send_packet(const uint8_t kind, index_t count, ...) |
313 | void send_packet(const uint8_t kind, index_t count, ...) |
323 | { |
314 | { |
324 | index_t i; |
315 | index_t i; |
325 | va_list va; |
316 | va_list va; |
326 | 317 | ||
327 | cuda[B] = cuda[B] | TIP; |
318 | cuda[B] = cuda[B] | TIP; |
328 | cuda[ACR] = cuda[ACR] | SR_OUT; |
319 | cuda[ACR] = cuda[ACR] | SR_OUT; |
329 | cuda[SR] = kind; |
320 | cuda[SR] = kind; |
330 | cuda[B] = cuda[B] & ~TIP; |
321 | cuda[B] = cuda[B] & ~TIP; |
331 | 322 | ||
332 | va_start(va, count); |
323 | va_start(va, count); |
333 | 324 | ||
334 | for (i = 0; i < count; i++) { |
325 | for (i = 0; i < count; i++) { |
335 | cuda[ACR] = cuda[ACR] | SR_OUT; |
326 | cuda[ACR] = cuda[ACR] | SR_OUT; |
336 | cuda[SR] = va_arg(va, int); |
327 | cuda[SR] = va_arg(va, int); |
337 | cuda[B] = cuda[B] | TACK; |
328 | cuda[B] = cuda[B] | TACK; |
338 | } |
329 | } |
339 | 330 | ||
340 | va_end(va); |
331 | va_end(va); |
341 | 332 | ||
342 | cuda[B] = cuda[B] | TIP; |
333 | cuda[B] = cuda[B] | TIP; |
343 | } |
334 | } |
344 | 335 | ||
345 | 336 | ||
346 | void cpu_halt(void) { |
337 | void cpu_halt(void) { |
347 | #ifdef CONFIG_POWEROFF |
338 | #ifdef CONFIG_POWEROFF |
348 | send_packet(PACKET_CUDA, 1, CUDA_POWERDOWN); |
339 | send_packet(PACKET_CUDA, 1, CUDA_POWERDOWN); |
349 | #endif |
340 | #endif |
350 | asm volatile ( |
341 | asm volatile ( |
351 | "b 0\n" |
342 | "b 0\n" |
352 | ); |
343 | ); |
353 | } |
344 | } |
354 | 345 | ||
355 | /** @} |
346 | /** @} |
356 | */ |
347 | */ |
357 | 348 |