Changeset 93b84b3 in mainline
- Timestamp:
- 2005-12-12T16:30:07Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- ebbdb8f
- Parents:
- af9a7c5
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
arch/mips32/src/drivers/msim.c
raf9a7c5 r93b84b3 38 38 static void msim_enable(chardev_t *dev); 39 39 static void msim_disable(chardev_t *dev); 40 static char msim_do_read(chardev_t *dev); 40 41 41 42 static chardev_operations_t msim_ops = { 42 43 .resume = msim_enable, 43 44 .suspend = msim_disable, 44 .write = msim_write 45 .write = msim_write, 46 .read = msim_do_read, 45 47 }; 46 48 … … 64 66 65 67 #include <print.h> 68 /** Read character using polling, assume interrupts disabled */ 69 static char msim_do_read(chardev_t *dev) 70 { 71 char ch; 72 73 while (1) { 74 ch = *((volatile char *) MSIM_KBD_ADDRESS); 75 if (ch) { 76 if (ch == '\r') 77 return '\n'; 78 if (ch == 0x7f) 79 return '\b'; 80 return ch; 81 } 82 } 83 } 84 66 85 /** Process keyboard interrupt. */ 67 86 static void msim_interrupt(int n, void *stack) 68 87 { 69 char ch ;88 char ch = 0; 70 89 71 90 ch = *((char *) MSIM_KBD_ADDRESS); -
arch/mips32/src/drivers/serial.c
raf9a7c5 r93b84b3 72 72 } 73 73 74 static chardev_operations_t serial_ops = { 75 .resume = serial_enable, 76 .suspend = serial_disable, 77 .write = serial_write 78 }; 74 /** Read character from serial port, wait until available */ 75 static char serial_do_read(chardev_t *dev) 76 { 77 serial_t *sd = (serial_t *)dev->data; 78 char ch; 79 80 while (!(SERIAL_READ_LSR(sd->port) & 1)) 81 ; 82 ch = SERIAL_READ(sd->port); 83 84 if (ch =='\r') 85 ch = '\n'; 86 return ch; 87 } 88 79 89 80 90 /** Process keyboard interrupt. Does not work in simics? */ … … 93 103 } 94 104 105 106 107 static chardev_operations_t serial_ops = { 108 .resume = serial_enable, 109 .suspend = serial_disable, 110 .write = serial_write, 111 .read = serial_do_read 112 }; 95 113 96 114 iroutine old_timer; -
arch/mips32/src/panic.S
raf9a7c5 r93b84b3 39 39 /* From printf return directly to halt() */ 40 40 panic_printf: 41 lui $ra, %hi(halt) 41 jal printf 42 nop 43 j halt 44 nop 45 /* This code does not work, god knows why */ 46 /* lui $ra, %hi(halt) 42 47 j printf 43 ori $ra, %lo(halt) 48 ori $ra, %lo(halt) */ -
generic/include/console/chardev.h
raf9a7c5 r93b84b3 42 42 void (* resume)(chardev_t *); /**< Resume pushing characters. */ 43 43 void (* write)(chardev_t *, char c); /**< Write character to stream. */ 44 /** Read character directly from device, assume interrupts disabled */ 45 char (* read)(chardev_t *); 44 46 }; 45 47 -
generic/src/console/console.c
raf9a7c5 r93b84b3 35 35 #include <typedefs.h> 36 36 #include <arch.h> 37 #include <func.h> 38 #include <print.h> 37 39 38 40 /** Standard input character device. */ … … 50 52 __u8 ch; 51 53 ipl_t ipl; 54 55 if (haltstate) { 56 /* If we are here, we are hopefully on the processor, that 57 * issued the 'halt' command, so proceed to read the character 58 * directly from input 59 */ 60 if (chardev->op->read) 61 return chardev->op->read(chardev); 62 /* no other way of interacting with user, halt */ 63 printf("cpu: halted - no kconsole\n"); 64 cpu_halt(); 65 } 52 66 53 67 waitq_sleep(&chardev->wq); … … 115 129 void putchar(char c) 116 130 { 117 stdout->op->write(stdout, c); 131 if (stdout->op->write) 132 stdout->op->write(stdout, c); 118 133 } -
generic/src/console/kconsole.c
raf9a7c5 r93b84b3 248 248 putchar(c); 249 249 break; 250 } if (c == '\b') { 250 } if (c == '\b') { /* Backspace */ 251 251 if (position == 0) 252 252 continue; … … 262 262 continue; 263 263 } 264 if (c == '\t') { 264 if (c == '\t') { /* Tabulator */ 265 265 int found; 266 266 … … 310 310 continue; 311 311 } 312 if (c == 0x1b) { 312 if (c == 0x1b) { /* Special command */ 313 313 mod = _getc(input); 314 314 c = _getc(input); … … 318 318 319 319 if (c == 0x33 && _getc(input) == 0x7e) { 320 /* Delete */ 320 321 if (position == curlen) 321 322 continue; … … 332 333 position = 0; 333 334 } 334 else if (c == 0x46) { 335 else if (c == 0x46) { /* End */ 335 336 for (i=position;i<curlen;i++) 336 337 putchar(current[i]); … … 356 357 rdln_print_c(' ',curlen); 357 358 rdln_print_c('\b',curlen); 358 if (c == 0x41) 359 if (c == 0x41) /* Up */ 359 360 histposition--; 360 361 else -
generic/src/lib/func.c
raf9a7c5 r93b84b3 33 33 #include <arch.h> 34 34 #include <typedefs.h> 35 #include <console/kconsole.h> 35 36 36 37 __u32 haltstate = 0; /**< Halt flag */ … … 46 47 haltstate = 1; 47 48 interrupts_disable(); 49 #ifdef CONFIG_DEBUG 50 printf("\n"); 51 kconsole(NULL); /* Run kconsole as a last resort to user */ 52 #endif 53 48 54 if (CPU) 49 55 printf("cpu%d: halted\n", CPU->id);
Note:
See TracChangeset
for help on using the changeset viewer.