annotate libserial-posix/openport.c @ 995:74024eb17e04

fc-loadtool help: improve language regarding 16 MiB flash chips In FC project history, 16 MiB flash originally meant Pirelli DP-L10. Then we got FCDEV3B with the same flash (our own design), but now we are discovering more Calypso devices that used such large flash, both late Calypso era (Sony Ericsson K2x0) as well as much earlier ones (FIC FLUID devices.txt file with 2004 dates, Leonardo+ rev 5). Hence we need to migrate to more generic or neutral language in associated documentation, without giving elevated status to specific examples that drove our early project history.
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 03 Dec 2023 21:11:12 +0000
parents fd7b447b99e3
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
248
cb1ba53a1106 beginning of factored-out libserial
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
cb1ba53a1106 beginning of factored-out libserial
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 * This module implements the basic serial port opening operation.
cb1ba53a1106 beginning of factored-out libserial
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 */
cb1ba53a1106 beginning of factored-out libserial
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4
cb1ba53a1106 beginning of factored-out libserial
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 #include <sys/types.h>
cb1ba53a1106 beginning of factored-out libserial
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 #include <sys/file.h>
cb1ba53a1106 beginning of factored-out libserial
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 #include <sys/ioctl.h>
cb1ba53a1106 beginning of factored-out libserial
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 #include <stdio.h>
cb1ba53a1106 beginning of factored-out libserial
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 #include <stdlib.h>
cb1ba53a1106 beginning of factored-out libserial
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 #include <unistd.h>
cb1ba53a1106 beginning of factored-out libserial
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11
cb1ba53a1106 beginning of factored-out libserial
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 int target_fd;
cb1ba53a1106 beginning of factored-out libserial
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13
cb1ba53a1106 beginning of factored-out libserial
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 open_serial_port(ttyport)
cb1ba53a1106 beginning of factored-out libserial
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 char *ttyport;
cb1ba53a1106 beginning of factored-out libserial
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 {
cb1ba53a1106 beginning of factored-out libserial
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 target_fd = open(ttyport, O_RDWR|O_NONBLOCK);
cb1ba53a1106 beginning of factored-out libserial
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 if (target_fd < 0) {
cb1ba53a1106 beginning of factored-out libserial
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 perror(ttyport);
cb1ba53a1106 beginning of factored-out libserial
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 exit(1);
cb1ba53a1106 beginning of factored-out libserial
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 }
cb1ba53a1106 beginning of factored-out libserial
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 ioctl(target_fd, TIOCEXCL);
cb1ba53a1106 beginning of factored-out libserial
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 return 0;
cb1ba53a1106 beginning of factored-out libserial
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 }