Ignore:
Timestamp:
Jul 7, 2017, 9:16:50 AM (7 years ago)
Author:
max@…
Message:

use a demultiplexer to get the channel on the serial port, and
make x86_printf print both on the VGA and COM1

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/hal/x86_64/core/hal_apic.c

    r153 r154  
    179179}
    180180
    181 void hal_com_send(char c)
     181void hal_com_send(uint8_t chan, char c)
    182182{
    183183        uint8_t mcr = in8(RS232_COM1_BASE + RS232_MCR);
     
    185185
    186186        while (!hal_com_transmit_empty());
     187        out8(RS232_COM1_BASE + RS232_DATA, chan | 0x80);
    187188        out8(RS232_COM1_BASE + RS232_DATA, c);
    188189
    189190        out8(RS232_COM1_BASE + RS232_MCR, mcr);
     191}
     192
     193/*
     194 * Called early to provide x86-specific messages. Interrupts disabled.
     195 */
     196void 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);
    190212}
    191213
Note: See TracChangeset for help on using the changeset viewer.