annotate libpwon/duart28c.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 7d1df6d831e4
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
736
7d1df6d831e4 libpwon: added -Pdtr and -Prts support for DUART28C
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 #include <sys/types.h>
7d1df6d831e4 libpwon: added -Pdtr and -Prts support for DUART28C
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 #include <sys/ioctl.h>
7d1df6d831e4 libpwon: added -Pdtr and -Prts support for DUART28C
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 #include <stdio.h>
7d1df6d831e4 libpwon: added -Pdtr and -Prts support for DUART28C
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 #include <stdlib.h>
7d1df6d831e4 libpwon: added -Pdtr and -Prts support for DUART28C
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 #include <string.h>
7d1df6d831e4 libpwon: added -Pdtr and -Prts support for DUART28C
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 #include <strings.h>
7d1df6d831e4 libpwon: added -Pdtr and -Prts support for DUART28C
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 #include <unistd.h>
7d1df6d831e4 libpwon: added -Pdtr and -Prts support for DUART28C
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8
7d1df6d831e4 libpwon: added -Pdtr and -Prts support for DUART28C
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 extern int target_fd;
7d1df6d831e4 libpwon: added -Pdtr and -Prts support for DUART28C
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10
7d1df6d831e4 libpwon: added -Pdtr and -Prts support for DUART28C
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 int bootctrl_duart28c_mode;
7d1df6d831e4 libpwon: added -Pdtr and -Prts support for DUART28C
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 static int mctl_arg;
7d1df6d831e4 libpwon: added -Pdtr and -Prts support for DUART28C
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13
7d1df6d831e4 libpwon: added -Pdtr and -Prts support for DUART28C
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 bootctrl_check_duart28c(bc_name)
7d1df6d831e4 libpwon: added -Pdtr and -Prts support for DUART28C
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 char *bc_name;
7d1df6d831e4 libpwon: added -Pdtr and -Prts support for DUART28C
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 {
7d1df6d831e4 libpwon: added -Pdtr and -Prts support for DUART28C
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 if (!strcmp(bc_name, "dtr")) {
7d1df6d831e4 libpwon: added -Pdtr and -Prts support for DUART28C
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 bootctrl_duart28c_mode = 1;
7d1df6d831e4 libpwon: added -Pdtr and -Prts support for DUART28C
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 mctl_arg = TIOCM_DTR;
7d1df6d831e4 libpwon: added -Pdtr and -Prts support for DUART28C
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 return 1;
7d1df6d831e4 libpwon: added -Pdtr and -Prts support for DUART28C
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 }
7d1df6d831e4 libpwon: added -Pdtr and -Prts support for DUART28C
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 if (!strcmp(bc_name, "rts")) {
7d1df6d831e4 libpwon: added -Pdtr and -Prts support for DUART28C
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 bootctrl_duart28c_mode = 1;
7d1df6d831e4 libpwon: added -Pdtr and -Prts support for DUART28C
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 mctl_arg = TIOCM_RTS;
7d1df6d831e4 libpwon: added -Pdtr and -Prts support for DUART28C
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 return 1;
7d1df6d831e4 libpwon: added -Pdtr and -Prts support for DUART28C
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 }
7d1df6d831e4 libpwon: added -Pdtr and -Prts support for DUART28C
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 return 0;
7d1df6d831e4 libpwon: added -Pdtr and -Prts support for DUART28C
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 }
7d1df6d831e4 libpwon: added -Pdtr and -Prts support for DUART28C
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29
7d1df6d831e4 libpwon: added -Pdtr and -Prts support for DUART28C
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 void
7d1df6d831e4 libpwon: added -Pdtr and -Prts support for DUART28C
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 fork_duart28c_pulse()
7d1df6d831e4 libpwon: added -Pdtr and -Prts support for DUART28C
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32 {
7d1df6d831e4 libpwon: added -Pdtr and -Prts support for DUART28C
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33 int i;
7d1df6d831e4 libpwon: added -Pdtr and -Prts support for DUART28C
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34
7d1df6d831e4 libpwon: added -Pdtr and -Prts support for DUART28C
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35 i = fork();
7d1df6d831e4 libpwon: added -Pdtr and -Prts support for DUART28C
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36 if (i < 0) {
7d1df6d831e4 libpwon: added -Pdtr and -Prts support for DUART28C
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37 perror("fork");
7d1df6d831e4 libpwon: added -Pdtr and -Prts support for DUART28C
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38 exit(1);
7d1df6d831e4 libpwon: added -Pdtr and -Prts support for DUART28C
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39 }
7d1df6d831e4 libpwon: added -Pdtr and -Prts support for DUART28C
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40 if (i)
7d1df6d831e4 libpwon: added -Pdtr and -Prts support for DUART28C
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41 return;
7d1df6d831e4 libpwon: added -Pdtr and -Prts support for DUART28C
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
42 ioctl(target_fd, TIOCMBIS, &mctl_arg);
7d1df6d831e4 libpwon: added -Pdtr and -Prts support for DUART28C
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
43 usleep(50000);
7d1df6d831e4 libpwon: added -Pdtr and -Prts support for DUART28C
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
44 ioctl(target_fd, TIOCMBIC, &mctl_arg);
7d1df6d831e4 libpwon: added -Pdtr and -Prts support for DUART28C
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
45 exit(0);
7d1df6d831e4 libpwon: added -Pdtr and -Prts support for DUART28C
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
46 }