ArvernOS
Loading...
Searching...
No Matches
serial.h File Reference
#include <stdint.h>
Include dependency graph for serial.h:

Macros

#define SERIAL_COM1   0x3F8
 
#define SERIAL_LINE_ENABLE_DLAB   0x80
 
#define SERIAL_SPEED_115200   1
 115200 bauds.
 
#define SERIAL_SPEED_57600   2
 57600 bauds.
 
#define SERIAL_SPEED_38400   3
 38400 bauds.
 

Functions

void serial_init (uint16_t com, uint16_t speed)
 
void serial_print (uint16_t com, const char *str)
 
void serial_write (uint16_t com, char c)
 

Macro Definition Documentation

◆ SERIAL_COM1

#define SERIAL_COM1   0x3F8

All the I/O ports are calculated relative to the data port. This is because all serial ports (COM1, COM2, COM3, COM4) have their ports in the same order, but they start at different values.

◆ SERIAL_LINE_ENABLE_DLAB

#define SERIAL_LINE_ENABLE_DLAB   0x80

Tells the serial port to expect first the highest 8 bits on the data port, then the lowest 8 bits will follow.

Function Documentation

◆ serial_init()

void serial_init ( uint16_t com,
uint16_t speed )

Initializes the serial driver.

Parameters
coma serial port number
speedthe serial speed to use

◆ serial_print()

void serial_print ( uint16_t com,
const char * str )

Prints a string to the serial port.

Parameters
coma serial port number
strthe string to print to the serial port

◆ serial_write()

void serial_write ( uint16_t com,
char c )

Prints a character to the serial port.

Parameters
coma serial port number
cthe character to print to the serial port