Changeset 154
- Timestamp:
- Jul 7, 2017, 9:16:50 AM (7 years ago)
- Location:
- trunk/hal/x86_64/core
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/hal/x86_64/core/hal_apic.c
r153 r154 179 179 } 180 180 181 void hal_com_send( char c)181 void hal_com_send(uint8_t chan, char c) 182 182 { 183 183 uint8_t mcr = in8(RS232_COM1_BASE + RS232_MCR); … … 185 185 186 186 while (!hal_com_transmit_empty()); 187 out8(RS232_COM1_BASE + RS232_DATA, chan | 0x80); 187 188 out8(RS232_COM1_BASE + RS232_DATA, c); 188 189 189 190 out8(RS232_COM1_BASE + RS232_MCR, mcr); 191 } 192 193 /* 194 * Called early to provide x86-specific messages. Interrupts disabled. 195 */ 196 void hal_com_init_early() 197 { 198 /* Disable all interrupts */ 199 out8(RS232_COM1_BASE + RS232_IER, 0x00); 200 201 /* Set baudrate */ 202 out8(RS232_COM1_BASE + RS232_LCR, LCR_DLAB); 203 out8(RS232_COM1_BASE + RS232_DIVLO, BAUDRATE_DIV); 204 out8(RS232_COM1_BASE + RS232_DIVHI, 0); 205 206 /* 8bits, no parity, one stop bit */ 207 out8(RS232_COM1_BASE + RS232_LCR, LCR_DATA8); 208 209 /* DTR set, and also DSR */ 210 out8(RS232_COM1_BASE + RS232_MCR, MCR_DTR|MCR_IR); 211 out8(RS232_COM1_BASE + RS232_MSR, MSR_DSR); 190 212 } 191 213 -
trunk/hal/x86_64/core/hal_apic.h
r152 r154 22 22 #ifndef x86_ASM 23 23 char hal_com_read(); 24 void hal_com_send(char c); 24 void hal_com_send(uint8_t chan, char c); 25 void hal_com_init_early(); 25 26 26 27 void hal_ioapic_disable_entry(uint8_t index); -
trunk/hal/x86_64/core/hal_init.c
r152 r154 254 254 boot_info_t btinfo; 255 255 256 /* Initialize the serial port */ 257 hal_com_init_early(); 258 256 259 x86_printf("[+] init_x86_64 called\n"); 257 260 -
trunk/hal/x86_64/core/hal_interrupt.c
r152 r154 49 49 void hal_com1_intr(struct trapframe *tf) 50 50 { 51 char c = hal_com_read(); 51 static char prev; 52 uint8_t chan; 53 char c; 52 54 53 x86_printf("-> got com '%c'\n", c); 55 if (prev & 0x80) { 56 /* the previous char was the channel number (tty) */ 57 c = hal_com_read(); 58 chan = prev & 0x7F; 59 x86_printf("-> got com [%z,'%c']\n", (uint64_t)chan, c); 60 prev = 0; 61 } else { 62 prev = hal_com_read(); 63 } 64 54 65 return; 55 66 } -
trunk/hal/x86_64/core/x86_printf.c
r145 r154 23 23 #include <hal_boot.h> 24 24 #include <hal_internal.h> 25 #include <hal_apic.h> 25 26 26 27 #include <memcpy.h> … … 75 76 void x86_putc(char c) 76 77 { 78 hal_com_send(0, c); 79 77 80 if (c == '\n') { 78 81 cons_ptr = roundup(cons_ptr, CONS_X_SIZE * 2);
Note: See TracChangeset
for help on using the changeset viewer.