summaryrefslogtreecommitdiffstats
path: root/sw/linux/src/serial.c
diff options
context:
space:
mode:
authorNao Pross <naopross@thearcway.org>2017-03-05 22:15:35 +0100
committerNao Pross <naopross@thearcway.org>2017-03-05 22:15:35 +0100
commit31e1544df5f97b90e855566031d5bb6d306b07c3 (patch)
tree64c043acdd9e8b857e1ff4db56cc50cc289976bf /sw/linux/src/serial.c
parentcreated doc (diff)
downloadz80uPC-31e1544df5f97b90e855566031d5bb6d306b07c3.tar.gz
z80uPC-31e1544df5f97b90e855566031d5bb6d306b07c3.zip
sw: started to implement serial on linux side
Diffstat (limited to 'sw/linux/src/serial.c')
-rw-r--r--sw/linux/src/serial.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/sw/linux/src/serial.c b/sw/linux/src/serial.c
index a13ef45..564676b 100644
--- a/sw/linux/src/serial.c
+++ b/sw/linux/src/serial.c
@@ -16,7 +16,27 @@ int serial_connect(const char *devpath, long baudrate)
return -1;
}
+ // TODO: update UI or add support for custom baudrate
// cfsetospeed(&tty,
+ // cfsetispeed(&tty,
+
+ tty.c_cflag &= ~PARENB; // no parity
+ tty.c_cflag &= ~CSTOPB; // no stop bit
+ tty.c_cflag |= CS8; // 8 bit data
+ tty.c_cflag &= ~CRTSCTS; // no flow control
+
+ tty.c_lflag = 0; // no signaling chars, no echo, no canonical processing
+ tty.c_oflag = 0; // no remapping, no delays
+ tty.c_cc[VMIN] = 0; // no block read
+ tty.c_cc[VTIME] = .5; // .5 seconds read timeout
+
+ tty.c_cflag |= CREAD | CLOCAL; // turn on read and ignore ctrl lines
+ tty.c_iflag &= ~(IXON | IXOFF | IXANY); // turn off s/w flow ctrl
+ tty.c_lflag &= ~(ICANON | ECHO | ECHOE | ISIG); // make raw
+ tty.c_oflag &= ~OPOST; // make raw
+
+ tcflush(fd , TCIFLUSH);
+ // if (tcsetaddr(
return fd;
}