Changeset f5e39a32 in mainline
- 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
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/ppc32/include/drivers/cuda.h
r58a6d997 rf5e39a32 39 39 #include <typedefs.h> 40 40 41 #define CUDA_IRQ 10 42 43 extern void cuda_init(uintptr_t base, size_t size); 41 extern void cuda_init(devno_t devno, uintptr_t base, size_t size); 44 42 extern int cuda_get_scancode(void); 45 43 extern void cuda_grab(void); -
kernel/arch/ppc32/include/interrupt.h
r58a6d997 rf5e39a32 38 38 #include <arch/exception.h> 39 39 40 #define IRQ_COUNT 64 41 42 #define IVT_ITEMS (16 + IRQ_COUNT) 43 #define INT_OFFSET 16 44 45 #define int_register(it, name, handler) exc_register(((it) + INT_OFFSET), name, handler) 40 #define IVT_ITEMS 16 41 #define IVT_FIRST 0 46 42 47 43 #define VECTOR_DATA_STORAGE 2 -
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 -
kernel/arch/ppc32/src/drivers/pic.c
r58a6d997 rf5e39a32 81 81 82 82 pending = pic[PIC_PENDING_LOW]; 83 if (pending) {83 if (pending) 84 84 return fnzb32(pending); 85 }85 86 86 pending = pic[PIC_PENDING_HIGH]; 87 if (pending) {87 if (pending) 88 88 return fnzb32(pending) + 32; 89 }89 90 90 return -1; 91 91 } -
kernel/arch/ppc32/src/interrupt.c
r58a6d997 rf5e39a32 33 33 */ 34 34 35 #include <ddi/irq.h> 35 36 #include <interrupt.h> 36 37 #include <arch/interrupt.h> … … 41 42 #include <arch/drivers/pic.h> 42 43 #include <arch/mm/tlb.h> 44 #include <print.h> 43 45 44 46 … … 57 59 { 58 60 int inum; 59 61 60 62 while ((inum = pic_get_pending()) != -1) { 61 exc_dispatch(inum + INT_OFFSET, istate); 63 irq_t *irq = irq_dispatch_and_lock(inum); 64 if (irq) { 65 /* 66 * The IRQ handler was found. 67 */ 68 irq->handler(irq, irq->arg); 69 spinlock_unlock(&irq->lock); 70 } else { 71 /* 72 * Spurious interrupt. 73 */ 74 #ifdef CONFIG_DEBUG 75 printf("cpu%d: spurious interrupt (inum=%d)\n", CPU->id, inum); 76 #endif 77 } 62 78 pic_ack_interrupt(inum); 63 79 } -
kernel/arch/ppc32/src/ppc32.c
r58a6d997 rf5e39a32 42 42 #include <proc/uarg.h> 43 43 #include <console/console.h> 44 #include <ddi/device.h> 45 #include <ddi/irq.h> 44 46 #include <arch/drivers/pic.h> 47 48 #define IRQ_COUNT 64 45 49 46 50 bootinfo_t bootinfo; … … 71 75 { 72 76 if (config.cpu_active == 1) { 77 /* Initialize framebuffer */ 73 78 fb_init(bootinfo.screen.addr, bootinfo.screen.width, bootinfo.screen.height, bootinfo.screen.bpp, bootinfo.screen.scanline, false); 79 80 /* Initialize IRQ routing */ 81 irq_init(IRQ_COUNT, IRQ_COUNT); 74 82 75 83 /* Initialize PIC */ 76 84 pic_init(bootinfo.keyboard.addr, PAGE_SIZE); 77 85 78 cuda_init(bootinfo.keyboard.addr + 0x16000, 2 * PAGE_SIZE); 86 /* Initialize I/O controller */ 87 cuda_init(device_assign_devno(), bootinfo.keyboard.addr + 0x16000, 2 * PAGE_SIZE); 79 88 80 89 /* Merge all zones to 1 big zone */ -
uspace/kbd/arch/ppc32/src/kbd.c
r58a6d997 rf5e39a32 184 184 int kbd_arch_init(void) 185 185 { 186 return ipc_register_irq(sysinfo_value(" cuda.irq"), &cuda_kbd);186 return ipc_register_irq(sysinfo_value("kbd.inr"), sysinfo_value("kbd.devno"), 0, &cuda_kbd); 187 187 } 188 188 … … 208 208 /** @} 209 209 */ 210
Note:
See TracChangeset
for help on using the changeset viewer.