Changeset 7688b5d in mainline for kernel/arch/mips32/src/drivers/msim.c
- 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
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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
Note:
See TracChangeset
for help on using the changeset viewer.