MCPcopy Create free account
hub / github.com/LemonOSProject/LemonOS / initialize_serial

Function initialize_serial

Kernel/src/arch/x86_64/serial.cpp:9–17  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7#define PORT 0x3F8 // COM 1
8
9void initialize_serial() {
10 outportb(PORT + 1, 0x00); // Disable all interrupts
11 outportb(PORT + 3, 0x80); // Enable DLAB (set baud rate divisor)
12 outportb(PORT + 0, 0x03); // Set divisor to 3 (lo byte) 38400 baud
13 outportb(PORT + 1, 0x00); // (hi byte)
14 outportb(PORT + 3, 0x03); // 8 bits, no parity, one stop bit
15 outportb(PORT + 2, 0xC7); // Enable FIFO, clear them, with 14-byte threshold
16 outportb(PORT + 4, 0x0B); // IRQs enabled, RTS/DSR set
17}
18
19int is_transmit_empty() {
20 return inportb(PORT + 5) & 0x20;

Callers 2

InitializeFunction · 0.85
InitCoreFunction · 0.85

Calls 1

outportbFunction · 0.85

Tested by

no test coverage detected