Changeset 7688b5d in mainline for kernel/arch/mips32/src/drivers
- Timestamp:
- 2006-10-18T09:54:13Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 6fb30a1
- Parents:
- 19de05f
- Location:
- kernel/arch/mips32/src/drivers
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/mips32/src/drivers/arc.c
r19de05f r7688b5d 354 354 }; 355 355 356 iroutine old_timer;357 /** Do polling on timer interrupt */358 static void timer_replace(int n, istate_t *istate)359 {360 arc_keyboard_poll();361 old_timer(n, istate);362 arc_keyboard_poll();363 }364 365 356 void arc_console(void) 366 357 { … … 368 359 369 360 chardev_initialize("arc_console", &console, &arc_ops); 370 old_timer = int_register(TIMER_IRQ, "arc_kb_poll", timer_replace);361 timer_fnc = &arc_keyboard_poll; 371 362 stdin = &console; 372 363 stdout = &console; -
kernel/arch/mips32/src/drivers/msim.c
r19de05f r7688b5d 38 38 #include <arch/cp0.h> 39 39 #include <console/console.h> 40 #include <ddi/irq.h> 41 #include <sysinfo/sysinfo.h> 42 43 /** Address of devices. */ 44 #define MSIM_VIDEORAM 0xB0000000 45 #define MSIM_KBD_ADDRESS 0xB0000000 46 #define MSIM_KBD_IRQ 2 40 47 41 48 static chardev_t console; 49 static irq_t msim_irq; 42 50 43 51 static void msim_write(chardev_t *dev, const char ch); … … 90 98 91 99 /** Process keyboard interrupt. */ 92 static void msim_i nterrupt(int n, istate_t *istate)100 static void msim_irq_handler(irq_t *irq, void *arg, ...) 93 101 { 94 char ch = 0; 102 if ((irq->notif_cfg.notify) && (irq->notif_cfg.answerbox)) 103 ipc_irq_send_notif(irq); 104 else { 105 char ch = 0; 106 107 ch = *((char *) MSIM_KBD_ADDRESS); 108 if (ch =='\r') 109 ch = '\n'; 110 if (ch == 0x7f) 111 ch = '\b'; 112 chardev_push_character(&console, ch); 113 } 114 } 95 115 96 ch = *((char *) MSIM_KBD_ADDRESS); 97 if (ch =='\r') 98 ch = '\n'; 99 if (ch == 0x7f) 100 ch = '\b'; 101 chardev_push_character(&console, ch); 116 static irq_ownership_t msim_claim(void) 117 { 118 return IRQ_ACCEPT; 119 } 120 121 void msim_kbd_grab(void) 122 { 123 msim_irq.notif_cfg.notify = false; 124 } 125 126 void msim_kbd_release(void) 127 { 128 if (msim_irq.notif_cfg.answerbox) 129 msim_irq.notif_cfg.notify = true; 102 130 } 103 131 104 132 105 133 /* Return console object representing msim console */ 106 void msim_console( void)134 void msim_console(devno_t devno) 107 135 { 108 136 chardev_initialize("msim_console", &console, &msim_ops); 109 110 int_register(MSIM_KBD_IRQ, "msim_kbd", msim_interrupt);111 112 cp0_unmask_int(MSIM_KBD_IRQ);113 114 137 stdin = &console; 115 138 stdout = &console; 116 } 117 118 static iroutine oldvector; 119 void msim_kbd_grab(void) 120 { 121 oldvector = int_register(MSIM_KBD_IRQ, "msim_kbd", msim_interrupt); 122 } 123 void msim_kbd_release(void) 124 { 125 if (oldvector) 126 int_register(MSIM_KBD_IRQ, "user_interrupt", oldvector); 139 140 irq_initialize(&msim_irq); 141 msim_irq.devno = devno; 142 msim_irq.inr = MSIM_KBD_IRQ; 143 msim_irq.claim = msim_claim; 144 msim_irq.handler = msim_irq_handler; 145 irq_register(&msim_irq); 146 147 cp0_unmask_int(MSIM_KBD_IRQ); 148 149 sysinfo_set_item_val("kbd", NULL, true); 150 sysinfo_set_item_val("kbd.devno", NULL, devno); 151 sysinfo_set_item_val("kbd.inr", NULL, MSIM_KBD_IRQ); 152 sysinfo_set_item_val("kbd.address.virtual", NULL, MSIM_KBD_ADDRESS); 127 153 } 128 154 -
kernel/arch/mips32/src/drivers/serial.c
r19de05f r7688b5d 38 38 #include <console/chardev.h> 39 39 #include <console/console.h> 40 #include <ddi/irq.h> 40 41 42 #define SERIAL_IRQ 2 43 44 static irq_t serial_irq; 41 45 static chardev_t console; 42 46 static serial_t sconf[SERIAL_MAX]; … … 92 96 } 93 97 94 95 /** Process keyboard interrupt. Does not work in simics? */ 96 static void serial_interrupt(int n, void *stack) 98 static void serial_handler(void) 97 99 { 98 serial_t *sd = (serial_t *) console.data;100 serial_t *sd = (serial_t *) console.data; 99 101 char ch; 100 102 … … 108 110 } 109 111 112 /** Process keyboard interrupt. Does not work in simics? */ 113 static void serial_irq_handler(irq_t *irq, void *arg, ...) 114 { 115 if ((irq->notif_cfg.notify) && (irq->notif_cfg.answerbox)) 116 ipc_irq_send_notif(irq); 117 else 118 serial_handler(); 119 } 110 120 121 static irq_ownership_t serial_claim(void) 122 { 123 return IRQ_ACCEPT; 124 } 111 125 112 126 static chardev_operations_t serial_ops = { … … 117 131 }; 118 132 119 iroutine old_timer; 120 /** Do polling on timer interrupt */ 121 static void timer_replace(int n, istate_t *istate) 122 { 123 old_timer(n, istate); 124 serial_interrupt(n, istate); 125 } 126 127 void serial_console(void) 133 void serial_console(devno_t devno) 128 134 { 129 135 serial_t *sd = &sconf[0]; … … 133 139 console.data = sd; 134 140 kb_enabled = true; 141 142 irq_initialize(&serial_irq); 143 serial_irq.devno = devno; 144 serial_irq.inr = SERIAL_IRQ; 145 serial_irq.claim = serial_claim; 146 serial_irq.handler = serial_irq_handler; 147 irq_register(&serial_irq); 135 148 136 // int_register(2, "serial_drvr", serial_interrupt);137 149 /* I don't know why, but the serial interrupts simply 138 150 * don't work on simics 139 151 */ 140 old_timer = int_register(TIMER_IRQ, "serial_drvr_poll", timer_replace);152 timer_fnc = &serial_handler; 141 153 142 154 stdin = &console;
Note:
See TracChangeset
for help on using the changeset viewer.
