2015-10-10 12:59:23 +00:00
|
|
|
#ifndef _SERIAL_HPP
|
|
|
|
#define _SERIAL_HPP
|
|
|
|
#include <output.hpp>
|
2015-10-13 14:11:06 +00:00
|
|
|
#include <input.hpp>
|
|
|
|
#include <textDISP.hpp>
|
2015-10-10 12:59:23 +00:00
|
|
|
#include <io.h>
|
|
|
|
#define SERIAL_IER 1
|
|
|
|
#define SERIAL_IIR 2
|
|
|
|
#define SERIAL_FCR 2
|
|
|
|
#define SERIAL_LCR 3
|
|
|
|
#define SERIAL_MCR 4
|
|
|
|
#define SERIAL_LSR 5
|
|
|
|
#define SERIAL_MSR 6
|
|
|
|
namespace MTGosHAL {
|
2015-10-13 14:11:06 +00:00
|
|
|
class Serial: public Output, public Input {
|
2015-10-10 12:59:23 +00:00
|
|
|
private:
|
|
|
|
uint16_t port;
|
2015-10-13 14:11:06 +00:00
|
|
|
uint64_t waittimes;
|
|
|
|
uint64_t transmits;
|
2015-10-17 09:28:06 +00:00
|
|
|
bool works;
|
2015-10-13 14:11:06 +00:00
|
|
|
auto isTransmitEmpty() -> int;
|
|
|
|
auto putChar(char chr) -> void;
|
|
|
|
auto serial_received() -> int;
|
|
|
|
auto getChar() -> char;
|
2015-10-10 12:59:23 +00:00
|
|
|
public:
|
2015-10-14 18:02:41 +00:00
|
|
|
Serial();
|
2015-10-13 14:11:06 +00:00
|
|
|
auto debug() -> void;
|
2015-10-10 12:59:23 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|