diff options
author | Nao Pross <naopross@thearcway.org> | 2017-02-14 11:48:19 +0100 |
---|---|---|
committer | Nao Pross <naopross@thearcway.org> | 2017-02-14 11:48:19 +0100 |
commit | 0bb03c0a1d96c23689cc420238a37b9fd15b739c (patch) | |
tree | f2c137723355541788327ae4da6dfc789e78936c /sw/linux/src/serial.c | |
parent | hw: created z80acpu in sch library (diff) | |
download | z80uPC-0bb03c0a1d96c23689cc420238a37b9fd15b739c.tar.gz z80uPC-0bb03c0a1d96c23689cc420238a37b9fd15b739c.zip |
sw: copied flash tool source from gameboymod
Diffstat (limited to 'sw/linux/src/serial.c')
-rw-r--r-- | sw/linux/src/serial.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/sw/linux/src/serial.c b/sw/linux/src/serial.c new file mode 100644 index 0000000..a13ef45 --- /dev/null +++ b/sw/linux/src/serial.c @@ -0,0 +1,22 @@ +#include "serial.h" + +int serial_connect(const char *devpath, long baudrate) +{ + int fd; + struct termios tty; + // struct termios tty_old; + + // open device + if ((fd = open(devpath, O_RDWR | O_NOCTTY)) < 0) { + return -1; + } + + // set parameters + if (tcgetattr(fd, &tty) != 0) { + return -1; + } + + // cfsetospeed(&tty, + + return fd; +} |