Changeset ac0cb2a in mainline for arch/mips32/src/drivers/keyboard.c
- Timestamp:
- 2005-12-08T00:29:53Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 944b15c
- Parents:
- 9d5e23c
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
arch/mips32/src/drivers/keyboard.c
r9d5e23c rac0cb2a 36 36 #include <synch/waitq.h> 37 37 #include <typedefs.h> 38 #include <arch/drivers/arc.h> 38 39 39 40 static void keyboard_enable(void); 40 41 static void keyboard_disable(void); 42 static void arc_kb_disable(void); 43 static void arc_kb_enable(void); 41 44 42 45 static chardev_t kbrd; 43 static chardev_operations_t ops = { 46 47 static chardev_operations_t arc_ops = { 48 .resume = arc_kb_enable, 49 .suspend = arc_kb_disable 50 }; 51 52 static chardev_operations_t msim_ops = { 44 53 .resume = keyboard_enable, 45 54 .suspend = keyboard_disable 46 55 }; 47 56 57 static int arc_kb_enabled; 58 48 59 /** Initialize keyboard subsystem. */ 49 60 void keyboard_init(void) 50 61 { 51 cp0_unmask_int(KEYBOARD_IRQ); 52 chardev_initialize(&kbrd, &ops); 62 if (arc_enabled()) { 63 chardev_initialize(&kbrd, &arc_ops); 64 arc_kb_enabled = 1; 65 } else { 66 cp0_unmask_int(KEYBOARD_IRQ); 67 chardev_initialize(&kbrd, &msim_ops); 68 } 53 69 stdin = &kbrd; 54 70 } … … 74 90 cp0_mask_int(KEYBOARD_IRQ); 75 91 } 92 93 /*****************************/ 94 /* Arc keyboard */ 95 96 void keyboard_poll(void) 97 { 98 int ch; 99 100 if (!arc_enabled() || !arc_kb_enabled) 101 return; 102 while ((ch = arc_getchar()) != -1) 103 chardev_push_character(&kbrd, ch); 104 } 105 106 static void arc_kb_enable(void) 107 { 108 arc_kb_enabled = 1; 109 } 110 111 /* Called from getc(). */ 112 static void arc_kb_disable(void) 113 { 114 arc_kb_enabled = 0; 115 }
Note:
See TracChangeset
for help on using the changeset viewer.