Changeset f5e39a32 in mainline for kernel/arch/ppc32/src/drivers/cuda.c
- Timestamp:
- 2006-10-17T15:19:16Z (18 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 79f30e4f
- Parents:
- 58a6d997
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/ppc32/src/drivers/cuda.c
r58a6d997 rf5e39a32 34 34 35 35 #include <arch/drivers/cuda.h> 36 #include <ddi/irq.h> 36 37 #include <arch/asm.h> 37 38 #include <console/console.h> … … 42 43 #include <stdarg.h> 43 44 45 #define CUDA_IRQ 10 44 46 #define SPECIAL '?' 45 47 … … 61 63 62 64 static volatile uint8_t *cuda = NULL; 63 static iroutine vector; 65 static irq_t cuda_irq; /**< Cuda's IRQ. */ 66 67 static ipc_notif_cfg_t saved_notif_cfg; 64 68 65 69 … … 249 253 } 250 254 251 static void cuda_irq(int n, istate_t *istate) 252 { 253 int scan_code = cuda_get_scancode(); 254 255 if (scan_code != -1) { 256 uint8_t scancode = (uint8_t) scan_code; 257 if ((scancode & 0x80) != 0x80) 258 chardev_push_character(&kbrd, lchars[scancode & 0x7f]); 255 static void cuda_irq_handler(irq_t *irq, void *arg, ...) 256 { 257 if (irq->notif_cfg.answerbox) 258 ipc_irq_send_notif(irq); 259 else { 260 int scan_code = cuda_get_scancode(); 261 262 if (scan_code != -1) { 263 uint8_t scancode = (uint8_t) scan_code; 264 if ((scancode & 0x80) != 0x80) 265 chardev_push_character(&kbrd, lchars[scancode & 0x7f]); 266 } 259 267 } 268 } 269 270 static irq_ownership_t cuda_claim(void) 271 { 272 return IRQ_ACCEPT; 260 273 } 261 274 … … 264 277 void cuda_grab(void) 265 278 { 266 vector = int_register(CUDA_IRQ, "cuda", cuda_irq); 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; 283 cuda_irq.notif_cfg.method = 0; 284 cuda_irq.notif_cfg.counter = 0; 285 } 267 286 } 268 287 … … 271 290 void cuda_release(void) 272 291 { 273 if (vector) 274 int_register(CUDA_IRQ, "user_interrupt", vector); 275 } 276 277 278 void cuda_init(uintptr_t base, size_t size) 279 { 280 cuda = (uint8_t *) hw_map(base, size); 281 282 int_register(CUDA_IRQ, "cuda", cuda_irq); 283 pic_enable_interrupt(CUDA_IRQ); 292 if (saved_notif_cfg.answerbox) 293 cuda_irq.notif_cfg = saved_notif_cfg; 294 } 295 296 297 void cuda_init(devno_t devno, uintptr_t base, size_t size) 298 { 299 cuda = (uint8_t *) hw_map(base, size); 284 300 285 301 chardev_initialize("cuda_kbd", &kbrd, &ops); 286 302 stdin = &kbrd; 287 303 288 sysinfo_set_item_val("cuda", NULL, true); 289 sysinfo_set_item_val("cuda.irq", NULL, CUDA_IRQ); 304 irq_initialize(&cuda_irq); 305 cuda_irq.devno = devno; 306 cuda_irq.inr = CUDA_IRQ; 307 cuda_irq.claim = cuda_claim; 308 cuda_irq.handler = cuda_irq_handler; 309 irq_register(&cuda_irq); 310 311 pic_enable_interrupt(CUDA_IRQ); 312 313 sysinfo_set_item_val("kbd", NULL, true); 314 sysinfo_set_item_val("kbd.devno", NULL, devno); 315 sysinfo_set_item_val("kbd.inr", NULL, CUDA_IRQ); 316 sysinfo_set_item_val("kbd.address.virtual", NULL, base); 317 318 cuda_grab(); 290 319 } 291 320
Note:
See TracChangeset
for help on using the changeset viewer.