From 044a4181fb2f6730714489e06a9127240e21595c Mon Sep 17 00:00:00 2001 From: Nao Pross Date: Wed, 31 Oct 2018 20:34:10 +0100 Subject: [linux] Add initial implementation of rom-loader --- sw-linux/rom-loader/serial.hpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 sw-linux/rom-loader/serial.hpp (limited to 'sw-linux/rom-loader/serial.hpp') 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 + +extern "C" { +#include +} + +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; +}; -- cgit v1.2.1