Created a proper driver for the serial bus

* The driver can write to any of the pre-defined serial COM ports
* The driver can read from any of the pre-defined serial COM ports (Untested)
This commit is contained in:
2023-10-28 21:51:04 +02:00
parent 2522492835
commit 9c5667c454
5 changed files with 87 additions and 89 deletions

View File

@ -1,19 +1,29 @@
#pragma once
// For now these are the standard
// serial ports we can talk to
enum SERIALPORT {
COM1 = 0x3F8,
COM2 = 0x2F8,
COM3 = 0x3E8,
COM4 = 0x2E8
};
class Serial {
struct SerialConfig {
SERIALPORT port;
char baud_rate_lo ;
char baud_rate_hi;
};
class Serial {
public:
static Serial init();
void print();
Serial (SerialConfig config );
private:
const int COM1 = 0x3F8;
const int COM2 = 0x2F8;
const int COM3 = 0x3E8;
const int COM4 = 0x2E8;
char read();
void write(void* data, int length);
Serial();
~Serial();
private:
SERIALPORT port;
int is_transmit_empty();
};