summaryrefslogtreecommitdiffstats
path: root/sw-linux/rom-loader/serial.hpp
diff options
context:
space:
mode:
authorNao Pross <naopross@thearcway.org>2018-10-31 20:34:10 +0100
committerNao Pross <naopross@thearcway.org>2018-10-31 20:34:10 +0100
commit044a4181fb2f6730714489e06a9127240e21595c (patch)
tree14310f175376272b302267b59c67c618e89876bf /sw-linux/rom-loader/serial.hpp
parentUpdate gitignore (diff)
downloadz80uPC-044a4181fb2f6730714489e06a9127240e21595c.tar.gz
z80uPC-044a4181fb2f6730714489e06a9127240e21595c.zip
[linux] Add initial implementation of rom-loader
Diffstat (limited to 'sw-linux/rom-loader/serial.hpp')
-rw-r--r--sw-linux/rom-loader/serial.hpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/sw-linux/rom-loader/serial.hpp b/sw-linux/rom-loader/serial.hpp
new file mode 100644
index 0000000..35b35be
--- /dev/null
+++ b/sw-linux/rom-loader/serial.hpp
@@ -0,0 +1,24 @@
+#pragma once
+
+#include <string>
+
+extern "C" {
+#include <termios.h>
+}
+
+class serial
+{
+public:
+ serial(const std::string& port, speed_t baud);
+ ~serial();
+
+ int write(const std::string& data) const;
+ int write(const char * const data, size_t len) const;
+
+ char read() const;
+ std::string read(size_t howmany) const;
+
+private:
+ int m_fd;
+ struct termios m_settings;
+};