mirror of
https://github.com/Fennix-Project/Kernel.git
synced 2025-05-28 15:34:33 +00:00
Set baud rate to 115200
This commit is contained in:
parent
ca5745aa6d
commit
5427e7f2ca
@ -27,10 +27,16 @@ __no_instrument_function void NoProfiler_outportb(uint16_t Port, uint8_t Data)
|
||||
namespace UniversalAsynchronousReceiverTransmitter
|
||||
{
|
||||
#define SERIAL_ENABLE_DLAB 0x80
|
||||
#define SERIAL_RATE_115200_LO 0x01
|
||||
#define SERIAL_RATE_115200_HI 0x00
|
||||
#define SERIAL_RATE_57600_LO 0x02
|
||||
#define SERIAL_RATE_57600_HI 0x00
|
||||
#define SERIAL_RATE_38400_LO 0x03
|
||||
#define SERIAL_RATE_38400_HI 0x00
|
||||
#define SERIAL_BUFFER_EMPTY 0x20
|
||||
|
||||
/* TODO: Serial Port implementation needs reword. https://wiki.osdev.org/Serial_Ports */
|
||||
|
||||
SafeFunction __no_instrument_function UART::UART(SerialPorts Port)
|
||||
{
|
||||
#if defined(__amd64__) || defined(__i386__)
|
||||
@ -74,13 +80,13 @@ namespace UniversalAsynchronousReceiverTransmitter
|
||||
return;
|
||||
|
||||
// Initialize the serial port
|
||||
NoProfiler_outportb(Port + 1, 0x00); // Disable all interrupts
|
||||
NoProfiler_outportb(Port + 3, SERIAL_ENABLE_DLAB); // Enable DLAB (set baud rate divisor)
|
||||
NoProfiler_outportb(Port + 0, SERIAL_RATE_38400_LO); // Set divisor to 3 (lo byte) 38400 baud
|
||||
NoProfiler_outportb(Port + 1, SERIAL_RATE_38400_HI); // (hi byte)
|
||||
NoProfiler_outportb(Port + 3, 0x03); // 8 bits, no parity, one stop bit
|
||||
NoProfiler_outportb(Port + 2, 0xC7); // Enable FIFO, clear them, with 14-byte threshold
|
||||
NoProfiler_outportb(Port + 4, 0x0B); // IRQs enabled, RTS/DSR set
|
||||
NoProfiler_outportb(Port + 1, 0x00); // Disable all interrupts
|
||||
NoProfiler_outportb(Port + 3, SERIAL_ENABLE_DLAB); // Enable DLAB (set baud rate divisor)
|
||||
NoProfiler_outportb(Port + 0, SERIAL_RATE_115200_LO); // Set divisor to 1 (lo byte) 115200 baud
|
||||
NoProfiler_outportb(Port + 1, SERIAL_RATE_115200_HI); // (hi byte)
|
||||
NoProfiler_outportb(Port + 3, 0x03); // 8 bits, no parity, one stop bit
|
||||
NoProfiler_outportb(Port + 2, 0xC7); // Enable FIFO, clear them, with 14-byte threshold
|
||||
NoProfiler_outportb(Port + 4, 0x0B); // IRQs enabled, RTS/DSR set
|
||||
|
||||
// Check if the serial port is faulty.
|
||||
if (NoProfiler_inportb(Port + 0) != 0xAE)
|
||||
|
Loading…
x
Reference in New Issue
Block a user