FreeCalypso > hg > fc-pcm-if
comparison sw/libserial/openport.c @ 2:a4918a161d2e
sw: starting with libserial, copied from fc-sim-sniff
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Fri, 11 Oct 2024 22:37:11 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
1:b3190839cce3 | 2:a4918a161d2e |
---|---|
1 /* | |
2 * This module implements the basic serial port opening operation. | |
3 */ | |
4 | |
5 #include <sys/types.h> | |
6 #include <sys/file.h> | |
7 #include <sys/ioctl.h> | |
8 #include <stdio.h> | |
9 #include <stdlib.h> | |
10 #include <unistd.h> | |
11 | |
12 int target_fd; | |
13 | |
14 open_serial_port(ttyport) | |
15 char *ttyport; | |
16 { | |
17 target_fd = open(ttyport, O_RDWR|O_NONBLOCK); | |
18 if (target_fd < 0) { | |
19 perror(ttyport); | |
20 exit(1); | |
21 } | |
22 ioctl(target_fd, TIOCEXCL); | |
23 return 0; | |
24 } |