The manual
ginnOS
The reference: libc, the libraries and the kernel
Loading...
Searching...
No Matches
serial.h
Go to the documentation of this file.
1#pragma once
2
3/**
4 * minimal COM1 serial port driver (16550 UART), polling-mode transmit.
5 *
6 * intended for kernel debug output: it works before the VGA console is up
7 * and is visible headlessly under QEMU with `-serial stdio`. transmit only
8 * blocks by polling the line-status register, so it needs no IRQ and is
9 * safe to call from panic and early boot.
10 */
11
12#include "common/stdint.h"
13
14/**
15 * initialize COM1 (115200 baud, 8N1, FIFO enabled).
16 * safe to call once, early in boot, before interrupts are enabled.
17 */
18void serial_initialize(void);
19
20/**
21 * write a single character to COM1, blocking until the UART is ready.
22 * translates '\n' to "\r\n" so terminals render lines correctly.
23 * @param c character to send.
24 */
25void serial_putchar(char c);
26
27/**
28 * write a null-terminated string to COM1.
29 * @param str string to send.
30 */
31void serial_write(const char *str);
void serial_write(const char *str)
write a null-terminated string to COM1.
Definition serial.c:100
void serial_putchar(char c)
write a single character to COM1, blocking until the UART is ready.
Definition serial.c:83
void serial_initialize(void)
minimal COM1 serial port driver (16550 UART), polling-mode transmit.
Definition serial.c:37