Added support for setting up a serial port. This first serial driver appears to only work correctly in QEMU.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
#ifndef IO_H
|
||||
#define IO_H
|
||||
void outb(unsigned short port, unsigned char data);
|
||||
unsigned char inb(unsigned short port);
|
||||
#endif
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
#ifndef KERNEL_H
|
||||
#define KERNEL_H
|
||||
|
||||
void write_screen(unsigned int, char, unsigned char, unsigned char);
|
||||
void move(unsigned short);
|
||||
void draw_s(char*, unsigned char, unsigned char);
|
||||
int strlen(char*);
|
||||
void clear_screen(void);
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
#ifndef SERIAL_H
|
||||
#define SERIAL_H
|
||||
/* All the I/O ports are calculated relative to the data port. This is
|
||||
because all serial ports have their ports in the same order but they
|
||||
start at different values.
|
||||
*/
|
||||
|
||||
#define COM1_PORT 0x3F8
|
||||
|
||||
#define SERIAL_DATA_PORT(base) (base)
|
||||
#define SERIAL_FIFO_COMMAND_PORT(base) (base + 2)
|
||||
#define SERIAL_LINE_COMMAND_PORT(base) (base + 3)
|
||||
#define SERIAL_MODEM_COMMAND_PORT(base) (base + 4)
|
||||
#define SERIAL_LINE_STATUS_PORT(base) (base + 5)
|
||||
|
||||
// Tells the serial port to expect the highest 8 bits on the data port first,
|
||||
// followed by the lowest 8 bits.
|
||||
#define SERIAL_LINE_ENABLE_DLAB 0x80
|
||||
|
||||
void set_serial_baud_rate(unsigned short, unsigned short);
|
||||
void configure_serial_line(unsigned short);
|
||||
int serial_transmit_fifo_empty(unsigned int);
|
||||
#endif
|
||||
Reference in New Issue
Block a user